Compare commits

..

1 Commits
0.4rc2 ... 0.4b

Author SHA1 Message Date
scorpio810
7c7af63470 Tag version 0.4 beta
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/tags/0.4b@3438 bfdf4180-ca20-0410-9c96-a3a8aa849046
2014-11-02 16:32:01 +00:00
142 changed files with 10826 additions and 13388 deletions

View File

@@ -2,7 +2,6 @@
<names>
<name lang="en">Fluorescent tube</name>
<name lang="fr">Tube fluorescent</name>
<name lang="it">Tubo fluorescente</name>
</names>
<informations></informations>
<description>

View File

@@ -1,4 +1,5 @@
<definition width="20" version="0.4" hotspot_x="3" hotspot_y="10" height="20" link_type="previous_report" type="element" ic="true" orientation="dyyy">
<definition width="70" version="0.3" hotspot_x="49" hotspot_y="15" height="30" type="element" ic="true" orientation="dyyy"
link_type="previous_report">
<names>
<name lang="ar">الصفحة السابقة</name>
<name lang="de">Vorherige Seite</name>
@@ -8,15 +9,15 @@
<name lang="fr">Folio précédent</name>
<name lang="pl">Wejście adresowe</name>
<name lang="es">folio anterior</name>
<name lang="nl">Referentie Vorig</name>
<name lang="cs">Předchozí list</name>
<name lang="nl">Referentie Vorig</name>
</names>
<informations>Author: The QElectroTech team
License: see http://qelectrotech.org/wiki/doc/elements_license</informations>
<description>
<polygon x4="-1" antialias="true" style="line-style:normal;line-weight:normal;filling:black;color:black" closed="false" y1="-4" x1="-1" y2="4" x2="-1" y3="0" x3="9" y4="-4"/>
<line length1="1.5" length2="1.5" antialias="false" end1="none" end2="none" style="line-style:normal;line-weight:normal;filling:none;color:black" y1="0" x1="9" y2="0" x2="12"/>
<input x="-44" y="0" size="9" rotate="true" text="/" tagg="label"/>
<terminal x="13" y="0" orientation="e"/>
<input x="-44" y="0" size="9" rotate="true" text="/"/>
<terminal x="13" y="0" nameHidden="0" number="" name="" orientation="e"/>
</description>
</definition>

View File

@@ -1,4 +1,5 @@
<definition width="30" version="0.4" hotspot_x="21" hotspot_y="10" height="20" link_type="next_report" type="element" ic="true" orientation="dyyy">
<definition width="40" version="0.3" hotspot_x="18" hotspot_y="15" height="30" type="element" ic="true" orientation="dyyy"
link_type="next_report">
<names>
<name lang="ar">الصفحة التالية</name>
<name lang="de">Nächste Seite</name>
@@ -8,15 +9,15 @@
<name lang="fr">Folio suivant</name>
<name lang="pl">Wyjście adresowe</name>
<name lang="es">Folio siguiente</name>
<name lang="nl">Referentie volgend</name>
<name lang="cs">Další list</name>
<name lang="nl">Referentie volgend</name>
</names>
<informations>Author: The QElectroTech team
License: see http://qelectrotech.org/wiki/doc/elements_license</informations>
<description>
<polygon x4="-9" antialias="true" style="line-style:normal;line-weight:normal;filling:black;color:black" closed="false" y1="-4" x1="-9" y2="4" x2="-9" y3="0" x3="2" y4="-4"/>
<line length1="1.5" length2="1.5" antialias="false" end1="none" end2="none" style="line-style:normal;line-weight:normal;filling:none;color:black" y1="0" x1="-9" y2="0" x2="-12"/>
<input x="6" y="0" size="9" rotate="true" text="/" tagg="label"/>
<terminal x="-13" y="0" orientation="w"/>
<input x="6" y="0" size="9" rotate="true" text="/"/>
<terminal x="-13" y="0" nameHidden="0" number="" name="" orientation="w"/>
</description>
</definition>

View File

@@ -2,6 +2,5 @@
<names>
<name lang="en">Cables</name>
<name lang="fr">Cables</name>
<name lang="it">Cavi</name>
</names>
</qet-directory>

View File

@@ -1,15 +1,8 @@
<project folioSheetQuantity="0" title="" version="0.4">
<properties/>
<project title="" version="0.3">
<newdiagrams>
<border displayrows="true" cols="17" displaycols="true" colsize="60" rows="8" rowsize="80"/>
<inset title="" folio="" author="" filename="" date="null"/>
<conductors num="_" vertirotatetext="0" displaytext="1" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<report label="/%f.%l%c"/>
<xrefs>
<xref snapto="label" switchprefix="" powerprefix="" displayhas="contacts" type="protection" showpowerctc="false" delayprefix=""/>
<xref snapto="bottom" switchprefix="" powerprefix="" displayhas="cross" type="coil" showpowerctc="false" delayprefix=""/>
</xrefs>
<conductors_autonums/>
<conductors num="_" type="multi"/>
</newdiagrams>
<diagram title="Exemple Moteur double sens" displayrows="true" cols="15" folio="" displaycols="true" height="500" colsize="50" order="1" rows="6" author="Benoît A" filename="Exemples QET" rowsize="80">
<defaultconductor type="simple"/>

View File

@@ -1,482 +1,439 @@
<project folioSheetQuantity="0" title="" version="0.4">
<project title="" version="0.3">
<properties/>
<newdiagrams>
<border displayrows="true" cols="15" displaycols="true" colsize="50" rows="6" rowsize="80"/>
<inset title="" folio="%id/%total" author="" filename="" date="null"/>
<conductors num="_" vertirotatetext="0" displaytext="1" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<report label="/%f.%l%c"/>
<xrefs>
<xref snapto="label" switchprefix="" powerprefix="" displayhas="contacts" type="protection" showpowerctc="false" delayprefix=""/>
<xref snapto="bottom" switchprefix="" powerprefix="" displayhas="cross" type="coil" showpowerctc="false" delayprefix=""/>
</xrefs>
<conductors_autonums/>
<conductors num="_" vertirotatetext="0" type="multi" horizrotatetext="0"/>
</newdiagrams>
<diagram title="General" displayrows="true" version="0.4" cols="15" folio="%id/%total" displaycols="true" height="500" colsize="50" order="1" rows="6" author="" filename="" date="null" rowsize="80">
<defaultconductor num="_" vertirotatetext="0" displaytext="1" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<diagram title="General" displayrows="true" cols="15" folio="%id/%total" displaycols="true" height="500" colsize="50" order="1" rows="6" author="" filename="" rowsize="80">
<defaultconductor num="_" type="multi"/>
<elements>
<element x="220" y="60" type="embed://import/grafcet2/etape_initiale.elmt" uuid="{290895c8-ebd6-48a0-bce2-fb5ec0e47051}" orientation="0">
<element x="220" y="370" type="embed://import/grafcet/etape.elmt" orientation="0">
<terminals>
<terminal x="0" y="21" nameHidden="0" number="" id="0" name="" orientation="2"/>
</terminals>
<inputs>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="E 00"/>
</inputs>
</element>
<element x="220" y="130" type="embed://import/grafcet2/et.elmt" uuid="{d7760ee4-d015-4bfb-abf4-e29200a216ef}" orientation="0">
<terminals>
<terminal x="0" y="1" nameHidden="0" number="" id="1" name="" orientation="0"/>
<terminal x="4" y="-2" nameHidden="0" number="" id="2" name="" orientation="1"/>
<terminal x="4" y="2" nameHidden="0" number="" id="3" name="" orientation="1"/>
<terminal x="0" y="-1" nameHidden="0" number="" id="4" name="" orientation="2"/>
</terminals>
<inputs/>
</element>
<element x="260" y="160" type="embed://import/grafcet/actions/action.elmt" uuid="{bb97e0c4-140c-49f4-ba51-3fb12c4335b8}" orientation="0">
<terminals>
<terminal x="6" y="0" nameHidden="0" number="" id="5" name="" orientation="3"/>
</terminals>
<inputs>
<input x="8" y="2" text="motor on"/>
</inputs>
</element>
<element x="220" y="420" type="embed://import/grafcet/saut.elmt" uuid="{0208f0ad-81ff-4937-bc00-bd2c3c50db7f}" orientation="0">
<terminals>
<terminal x="0" y="-1" nameHidden="0" number="" id="6" name="" orientation="0"/>
<terminal x="-8" y="0" nameHidden="0" number="" id="7" name="" orientation="3"/>
</terminals>
<inputs>
<input x="-15" y="45" text="E 00"/>
<input x="15" y="2" text="T 03"/>
</inputs>
</element>
<element x="220" y="170" type="embed://import/grafcet2/etape.elmt" uuid="{12113ca8-85f5-4358-8548-fe386fa41760}" orientation="0">
<terminals>
<terminal x="0" y="-21" nameHidden="0" number="" id="8" name="" orientation="0"/>
<terminal x="0" y="21" nameHidden="0" number="" id="9" name="" orientation="2"/>
<terminal x="36" y="-10" nameHidden="0" number="" id="10" name="" orientation="1"/>
</terminals>
<inputs>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="E 01"/>
</inputs>
</element>
<element x="490" y="150" type="embed://import/grafcet/actions/action.elmt" uuid="{c09ec501-48a7-4171-b6a5-3ef1f5880177}" orientation="0">
<terminals>
<terminal x="6" y="0" nameHidden="0" number="" id="11" name="" orientation="3"/>
</terminals>
<inputs>
<input x="8" y="2" text="lubrification on"/>
</inputs>
</element>
<element x="440" y="170" type="embed://import/grafcet2/etape.elmt" uuid="{4f75422f-9751-4bb8-98b5-8fd87e5f062c}" orientation="0">
<terminals>
<terminal x="0" y="-21" nameHidden="0" number="" id="12" name="" orientation="0"/>
<terminal x="0" y="21" nameHidden="0" number="" id="13" name="" orientation="2"/>
<terminal x="36" y="-10" nameHidden="0" number="" id="14" name="" orientation="1"/>
</terminals>
<inputs>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="E 02"/>
</inputs>
</element>
<element x="220" y="110" type="embed://import/grafcet2/transition.elmt" uuid="{dc46b143-bf5e-4003-be77-f0f80bfcca64}" orientation="0">
<terminals>
<terminal x="0" y="1" nameHidden="0" number="" id="15" name="" orientation="2"/>
<terminal x="0" y="-1" nameHidden="0" number="" id="16" name="" orientation="0"/>
<terminal x="-8" y="0" nameHidden="0" number="" id="17" name="" orientation="3"/>
</terminals>
<inputs>
<input x="15" y="2" text="T 00"/>
</inputs>
</element>
<element x="280" y="360" type="embed://import/grafcet/actions/action.elmt" uuid="{bcc8a9ca-948b-4074-83a3-e4853e2f210c}" orientation="0">
<terminals>
<terminal x="6" y="0" nameHidden="0" number="" id="18" name="" orientation="3"/>
</terminals>
<inputs>
<input x="8" y="2" text="motor off"/>
</inputs>
</element>
<element x="220" y="280" type="embed://import/grafcet2/macro/etape.elmt" uuid="{1944db54-0a05-4305-8f66-b8ce2c6ed487}" orientation="0">
<terminals>
<terminal x="-8" y="39.6667" nameHidden="0" number="" id="19" name="" orientation="3"/>
<terminal x="0" y="40.6667" nameHidden="0" number="" id="20" name="" orientation="2"/>
<terminal x="0" y="-21" nameHidden="0" number="" id="21" name="" orientation="0"/>
</terminals>
<inputs>
<input x="18" y="42" text="1"/>
<input x="18" y="42" text="1"/>
<input x="-30" y="13.6667" text=""/>
<input x="-20" y="-0.333333" text="M 03"/>
</inputs>
</element>
<element x="220" y="230" type="embed://import/grafcet2/transition.elmt" uuid="{578bf044-62aa-4ed7-b9ac-762b8a88d129}" orientation="0">
<terminals>
<terminal x="0" y="1" nameHidden="0" number="" id="22" name="" orientation="2"/>
<terminal x="0" y="-1" nameHidden="0" number="" id="23" name="" orientation="0"/>
<terminal x="-8" y="0" nameHidden="0" number="" id="24" name="" orientation="3"/>
</terminals>
<inputs>
<input x="15" y="2" text="T 02"/>
</inputs>
</element>
<element x="220" y="370" type="embed://import/grafcet/etape.elmt" uuid="{b9ad5d40-37f7-4af2-b69b-12e97b0142a3}" orientation="0">
<terminals>
<terminal x="0" y="-21" nameHidden="0" number="" id="25" name="" orientation="0"/>
<terminal x="0" y="21" nameHidden="0" number="" id="26" name="" orientation="2"/>
<terminal x="36" y="-10" nameHidden="0" number="" id="27" name="" orientation="1"/>
<terminal x="0" y="-21" id="0" orientation="0"/>
<terminal x="0" y="21" id="1" orientation="2"/>
<terminal x="36" y="-10" id="2" orientation="1"/>
</terminals>
<inputs>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="E 06"/>
</inputs>
</element>
<element x="220" y="230" type="embed://import/grafcet2/transition.elmt" orientation="0">
<terminals>
<terminal x="0" y="1" id="3" orientation="2"/>
<terminal x="0" y="-1" id="4" orientation="0"/>
<terminal x="-8" y="0" id="5" orientation="3"/>
</terminals>
<inputs>
<input x="15" y="2" text="T 02"/>
</inputs>
</element>
<element x="220" y="280" type="embed://import/grafcet2/macro/etape.elmt" orientation="0">
<terminals>
<terminal x="-8" y="39.6667" id="6" orientation="3"/>
<terminal x="0" y="40.6667" id="7" orientation="2"/>
<terminal x="0" y="-21" id="8" orientation="0"/>
</terminals>
<inputs>
<input x="-30" y="13.6667" text=""/>
<input x="-20" y="-0.333333" text="M 03"/>
</inputs>
</element>
<element x="280" y="360" type="embed://import/grafcet/actions/action.elmt" orientation="0">
<terminals>
<terminal x="6" y="0" id="9" orientation="3"/>
</terminals>
<inputs>
<input x="8" y="2" text="motor off"/>
</inputs>
</element>
<element x="220" y="110" type="embed://import/grafcet2/transition.elmt" orientation="0">
<terminals>
<terminal x="0" y="1" id="10" orientation="2"/>
<terminal x="0" y="-1" id="11" orientation="0"/>
<terminal x="-8" y="0" id="12" orientation="3"/>
</terminals>
<inputs>
<input x="15" y="2" text="T 00"/>
</inputs>
</element>
<element x="440" y="170" type="embed://import/grafcet2/etape.elmt" orientation="0">
<terminals>
<terminal x="0" y="-21" id="13" orientation="0"/>
<terminal x="0" y="21" id="14" orientation="2"/>
<terminal x="36" y="-10" id="15" orientation="1"/>
</terminals>
<inputs>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="E 02"/>
</inputs>
</element>
<element x="490" y="150" type="embed://import/grafcet/actions/action.elmt" orientation="0">
<terminals>
<terminal x="6" y="0" id="16" orientation="3"/>
</terminals>
<inputs>
<input x="8" y="2" text="lubrification on"/>
</inputs>
</element>
<element x="220" y="170" type="embed://import/grafcet2/etape.elmt" orientation="0">
<terminals>
<terminal x="0" y="-21" id="17" orientation="0"/>
<terminal x="0" y="21" id="18" orientation="2"/>
<terminal x="36" y="-10" id="19" orientation="1"/>
</terminals>
<inputs>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="E 01"/>
</inputs>
</element>
<element x="220" y="420" type="embed://import/grafcet/saut.elmt" orientation="0">
<terminals>
<terminal x="0" y="-1" id="20" orientation="0"/>
<terminal x="-8" y="0" id="21" orientation="3"/>
</terminals>
<inputs>
<input x="-15" y="45" text="E 00"/>
<input x="15" y="2" text="T 03"/>
</inputs>
</element>
<element x="260" y="160" type="embed://import/grafcet/actions/action.elmt" orientation="0">
<terminals>
<terminal x="6" y="0" id="22" orientation="3"/>
</terminals>
<inputs>
<input x="8" y="2" text="motor on"/>
</inputs>
</element>
<element x="220" y="130" type="embed://import/grafcet2/et.elmt" orientation="0">
<terminals>
<terminal x="0" y="1" id="23" orientation="0"/>
<terminal x="4" y="-2" id="24" orientation="1"/>
<terminal x="4" y="2" id="25" orientation="1"/>
<terminal x="0" y="-1" id="26" orientation="2"/>
</terminals>
<inputs/>
</element>
<element x="220" y="60" type="embed://import/grafcet2/etape_initiale.elmt" orientation="0">
<terminals>
<terminal x="0" y="21" id="27" orientation="2"/>
</terminals>
<inputs>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="E 00"/>
</inputs>
</element>
</elements>
<conductors>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="14" terminal2="11" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="3" terminal2="12" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="4" terminal2="8" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="2" terminal2="12" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="26" terminal2="6" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="0" terminal2="16" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="18" terminal2="27" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="13" terminal2="23" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="9" terminal2="23" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="22" terminal2="21" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="20" terminal2="25" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="15" terminal2="4" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" terminal1="10" terminal2="26" type="multi"/>
<conductor num="_" terminal1="7" terminal2="0" type="multi"/>
<conductor num="_" terminal1="3" terminal2="8" type="multi"/>
<conductor num="_" terminal1="18" terminal2="4" type="multi"/>
<conductor num="_" terminal1="14" terminal2="4" type="multi"/>
<conductor num="_" terminal1="9" terminal2="2" type="multi"/>
<conductor num="_" terminal1="27" terminal2="11" type="multi"/>
<conductor num="_" terminal1="1" terminal2="20" type="multi"/>
<conductor num="_" terminal1="24" terminal2="13" type="multi"/>
<conductor num="_" terminal1="26" terminal2="17" type="multi"/>
<conductor num="_" terminal1="25" terminal2="13" type="multi"/>
<conductor num="_" terminal1="15" terminal2="16" type="multi"/>
</conductors>
</diagram>
<diagram title="Macro 3" displayrows="true" version="0.4" cols="15" folio="%id/%total" displaycols="true" height="500" colsize="50" order="2" rows="6" author="" filename="" date="null" rowsize="80">
<defaultconductor num="_" vertirotatetext="0" displaytext="1" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<diagram title="Macro 3" displayrows="true" cols="15" folio="%id/%total" displaycols="true" height="500" colsize="50" order="2" rows="6" author="" filename="" rowsize="80">
<defaultconductor num="_" type="multi"/>
<elements>
<element x="460" y="310" type="embed://import/grafcet2/etape.elmt" uuid="{3ba984a9-4ca5-4fa2-9a11-85c41ddb349b}" orientation="0">
<element x="460" y="160" type="embed://import/grafcet2/etape.elmt" orientation="0">
<terminals>
<terminal x="0" y="-21" nameHidden="0" number="" id="0" name="" orientation="0"/>
<terminal x="0" y="21" nameHidden="0" number="" id="1" name="" orientation="2"/>
<terminal x="36" y="-10" nameHidden="0" number="" id="2" name="" orientation="1"/>
</terminals>
<inputs>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="E 05"/>
</inputs>
</element>
<element x="170" y="350" type="embed://import/automatisme/fonction/entree.elmt" uuid="{12483728-267f-4c2f-b7ea-4ef02acb67b1}" orientation="0">
<terminals>
<terminal x="36" y="0" nameHidden="0" number="" id="3" name="" orientation="1"/>
</terminals>
<inputs>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
<input x="-2" y="5" text="I"/>
<input x="-2" y="5" text="I"/>
</inputs>
</element>
<element x="340" y="390" type="embed://import/automatisme/fonction/ou.elmt" uuid="{546bea81-a292-4105-8d0b-e696cbe2b71a}" orientation="0">
<terminals>
<terminal x="36" y="0" nameHidden="0" number="" id="4" name="" orientation="1"/>
<terminal x="-36" y="-20" nameHidden="0" number="" id="5" name="" orientation="3"/>
<terminal x="-36" y="20" nameHidden="0" number="" id="6" name="" orientation="3"/>
</terminals>
<inputs>
<input x="-46" y="10" text="_"/>
<input x="-46" y="-30" text="_"/>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
<input x="-11.5" y="5" text="≥1"/>
<input x="-11.5" y="5" text="≥1"/>
</inputs>
</element>
<element x="460" y="460" type="embed://import/grafcet2/macro/etape_sortie.elmt" uuid="{16ff747c-27ef-4d71-a637-e69948ec7778}" orientation="0">
<terminals>
<terminal x="0" y="-21" nameHidden="0" number="" id="7" name="" orientation="0"/>
</terminals>
<inputs>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="S 03"/>
</inputs>
</element>
<element x="170" y="430" type="embed://import/automatisme/fonction/entree.elmt" uuid="{901dcb49-d67c-459d-98dc-f77992b63bfb}" orientation="0">
<terminals>
<terminal x="36" y="0" nameHidden="0" number="" id="8" name="" orientation="1"/>
</terminals>
<inputs>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
<input x="-2" y="5" text="I"/>
<input x="-2" y="5" text="I"/>
</inputs>
</element>
<element x="330" y="220" type="embed://import/automatisme/fonction/et.elmt" uuid="{dff2338c-a7d0-4c8e-95bd-fde0887d0b1b}" orientation="0">
<terminals>
<terminal x="36" y="0" nameHidden="0" number="" id="9" name="" orientation="1"/>
<terminal x="-36" y="-20" nameHidden="0" number="" id="10" name="" orientation="3"/>
<terminal x="-36" y="20" nameHidden="0" number="" id="11" name="" orientation="3"/>
</terminals>
<inputs>
<input x="-46" y="10" text="_"/>
<input x="-46" y="-30" text="_"/>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
<input x="-6" y="5" text="&amp;"/>
<input x="-6" y="5" text="&amp;"/>
</inputs>
</element>
<element x="520" y="170" type="embed://import/grafcet/actions/continue.elmt" uuid="{b216ef62-54ea-4a6b-9900-1987a932f765}" orientation="0">
<terminals>
<terminal x="7" y="0" nameHidden="0" number="" id="12" name="" orientation="3"/>
</terminals>
<inputs>
<input x="25" y="2" text="action"/>
<input x="8" y="3" text="="/>
<input x="8" y="3" text="="/>
</inputs>
</element>
<element x="520" y="300" type="embed://import/grafcet/actions/continue.elmt" uuid="{f962fd78-860d-4193-b517-d06bac16cbf5}" orientation="0">
<terminals>
<terminal x="7" y="0" nameHidden="0" number="" id="13" name="" orientation="3"/>
</terminals>
<inputs>
<input x="25" y="2" text="action"/>
<input x="8" y="3" text="="/>
<input x="8" y="3" text="="/>
</inputs>
</element>
<element x="460" y="220" type="embed://import/grafcet2/transition.elmt" uuid="{3c0fd8ce-8b1f-4f6f-ab43-1d22d4e6b5d8}" orientation="0">
<terminals>
<terminal x="0" y="1" nameHidden="0" number="" id="14" name="" orientation="2"/>
<terminal x="0" y="-1" nameHidden="0" number="" id="15" name="" orientation="0"/>
<terminal x="-8" y="0" nameHidden="0" number="" id="16" name="" orientation="3"/>
</terminals>
<inputs>
<input x="15" y="2" text="T 30"/>
</inputs>
</element>
<element x="520" y="150" type="embed://import/grafcet/actions/continue.elmt" uuid="{c154f8fa-ee5a-4400-a419-dc5aaaddd6a2}" orientation="0">
<terminals>
<terminal x="7" y="0" nameHidden="0" number="" id="17" name="" orientation="3"/>
</terminals>
<inputs>
<input x="25" y="2" text="action"/>
<input x="8" y="3" text="="/>
<input x="8" y="3" text="="/>
</inputs>
</element>
<element x="460" y="70" type="embed://import/grafcet2/macro/etape_entree.elmt" uuid="{b6a9dba6-bded-458f-a948-d0f34ec92671}" orientation="0">
<terminals>
<terminal x="0" y="41" nameHidden="0" number="" id="18" name="" orientation="2"/>
<terminal x="-8" y="40" nameHidden="0" number="" id="19" name="" orientation="3"/>
</terminals>
<inputs>
<input x="19" y="42" text="1"/>
<input x="19" y="42" text="1"/>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="E 03"/>
</inputs>
</element>
<element x="170" y="180" type="embed://import/automatisme/fonction/entree.elmt" uuid="{dcc4fd4d-cfa8-4f72-9990-a5ae8e83307d}" orientation="0">
<terminals>
<terminal x="36" y="0" nameHidden="0" number="" id="20" name="" orientation="1"/>
</terminals>
<inputs>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
<input x="-2" y="5" text="I"/>
<input x="-2" y="5" text="I"/>
</inputs>
</element>
<element x="520" y="160" type="embed://import/grafcet/actions/continue.elmt" uuid="{91b0d252-9167-4feb-baf1-25120b97a3ae}" orientation="0">
<terminals>
<terminal x="7" y="0" nameHidden="0" number="" id="21" name="" orientation="3"/>
</terminals>
<inputs>
<input x="25" y="2" text="action"/>
<input x="8" y="3" text="="/>
<input x="8" y="3" text="="/>
</inputs>
</element>
<element x="170" y="260" type="embed://import/automatisme/fonction/entree.elmt" uuid="{82fd394e-304e-44c8-a695-c1cda10c3e21}" orientation="0">
<terminals>
<terminal x="36" y="0" nameHidden="0" number="" id="22" name="" orientation="1"/>
</terminals>
<inputs>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
<input x="-2" y="5" text="I"/>
<input x="-2" y="5" text="I"/>
</inputs>
</element>
<element x="460" y="390" type="embed://import/grafcet2/transition.elmt" uuid="{bdb1cc69-7e03-4f4f-a4fc-c11413f16278}" orientation="0">
<terminals>
<terminal x="0" y="1" nameHidden="0" number="" id="23" name="" orientation="2"/>
<terminal x="0" y="-1" nameHidden="0" number="" id="24" name="" orientation="0"/>
<terminal x="-8" y="0" nameHidden="0" number="" id="25" name="" orientation="3"/>
</terminals>
<inputs>
<input x="15" y="2" text="T 31"/>
</inputs>
</element>
<element x="460" y="160" type="embed://import/grafcet2/etape.elmt" uuid="{68ae6a60-f2ae-4c1b-99c9-1993b2964eb4}" orientation="0">
<terminals>
<terminal x="0" y="-21" nameHidden="0" number="" id="26" name="" orientation="0"/>
<terminal x="0" y="21" nameHidden="0" number="" id="27" name="" orientation="2"/>
<terminal x="36" y="-10" nameHidden="0" number="" id="28" name="" orientation="1"/>
<terminal x="0" y="-21" id="0" orientation="0"/>
<terminal x="0" y="21" id="1" orientation="2"/>
<terminal x="36" y="-10" id="2" orientation="1"/>
</terminals>
<inputs>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="E 04"/>
</inputs>
</element>
</elements>
<conductors>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="3" terminal2="5" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="4" terminal2="25" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="8" terminal2="6" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="20" terminal2="10" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="22" terminal2="11" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="23" terminal2="7" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="28" terminal2="21" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="24" terminal2="1" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="2" terminal2="13" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="18" terminal2="26" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="27" terminal2="15" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="28" terminal2="17" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="9" terminal2="16" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="12" terminal2="28" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="14" terminal2="0" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
</conductors>
</diagram>
<diagram title="Conditions" displayrows="true" version="0.4" cols="15" folio="%id/%total" displaycols="true" height="500" colsize="50" order="3" rows="6" author="" filename="" date="null" rowsize="80">
<defaultconductor num="_" vertirotatetext="0" displaytext="1" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<elements>
<element x="450" y="400" type="embed://import/automatisme/lader/output/sortie.elmt" uuid="{3a059f35-2597-48b7-9730-c399198908c5}" orientation="0">
<element x="460" y="390" type="embed://import/grafcet2/transition.elmt" orientation="0">
<terminals>
<terminal x="-20" y="0" nameHidden="0" number="" id="0" name="" orientation="3"/>
<terminal x="0" y="1" id="3" orientation="2"/>
<terminal x="0" y="-1" id="4" orientation="0"/>
<terminal x="-8" y="0" id="5" orientation="3"/>
</terminals>
<inputs>
<input x="-18" y="-10" text="T03_"/>
<input x="15" y="2" text="T 31"/>
</inputs>
</element>
<element x="290" y="430" type="embed://import/automatisme/lader/input/entree.elmt" uuid="{c5876a7c-c5c3-4842-baee-050f23a81f6d}" orientation="0">
<element x="170" y="260" type="embed://import/automatisme/fonction/entree.elmt" orientation="0">
<terminals>
<terminal x="20" y="0" nameHidden="0" number="" id="1" name="" orientation="1"/>
<terminal x="-20" y="0" nameHidden="0" number="" id="2" name="" orientation="3"/>
<terminal x="36" y="0" id="6" orientation="1"/>
</terminals>
<inputs>
<input x="-18" y="-10" text="Arrêt urgence"/>
</inputs>
</element>
<element x="200" y="400" type="embed://import/sources/multifilaire/src_p.elmt" uuid="{486f95db-99d4-4148-b8c4-cb7ab5e3ab1d}" orientation="0">
<terminals>
<terminal x="6" y="0" nameHidden="0" number="" id="3" name="" orientation="1"/>
</terminals>
<inputs>
<input x="-12" y="3" text="L"/>
<input x="-12" y="3" text="L"/>
</inputs>
</element>
<element x="290" y="370" type="embed://import/automatisme/lader/input/entree.elmt" uuid="{6046d2e7-4cab-4e46-8d15-1ccebefabd3d}" orientation="0">
<terminals>
<terminal x="20" y="0" nameHidden="0" number="" id="4" name="" orientation="1"/>
<terminal x="-20" y="0" nameHidden="0" number="" id="5" name="" orientation="3"/>
</terminals>
<inputs>
<input x="-18" y="-10" text="Bouton stop"/>
</inputs>
</element>
<element x="190" y="100" type="embed://import/automatisme/fonction/entree.elmt" uuid="{9681f5f3-8ad4-4fef-b6fe-501ab028fc1f}" orientation="0">
<terminals>
<terminal x="36" y="0" nameHidden="0" number="" id="6" name="" orientation="1"/>
</terminals>
<inputs>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="Bouton start"/>
<input x="-2" y="5" text="I"/>
<input x="-2" y="5" text="I"/>
</inputs>
</element>
<element x="190" y="220" type="embed://import/automatisme/fonction/entree.elmt" uuid="{1b95c847-07a9-465c-ad5c-095b93bc3d06}" orientation="0">
<terminals>
<terminal x="36" y="0" nameHidden="0" number="" id="7" name="" orientation="1"/>
</terminals>
<inputs>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="Arrêt urgence"/>
<input x="-2" y="5" text="I"/>
<input x="-2" y="5" text="I"/>
</inputs>
</element>
<element x="310" y="220" type="embed://import/automatisme/fonction/non.elmt" uuid="{2ff0c5b1-dd75-4660-b5b5-13df9a365c93}" orientation="0">
<terminals>
<terminal x="-36" y="0" nameHidden="0" number="" id="8" name="" orientation="3"/>
<terminal x="36" y="0" nameHidden="0" number="" id="9" name="" orientation="1"/>
</terminals>
<inputs>
<input x="-46" y="-10" text="_"/>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
<input x="-5" y="5" text="1"/>
<input x="-5" y="5" text="1"/>
</inputs>
</element>
<element x="560" y="160" type="embed://import/automatisme/fonction/sortie.elmt" uuid="{2d78796c-4495-4030-8548-acbdfbefbbc0}" orientation="0">
<element x="520" y="160" type="embed://import/grafcet/actions/continue.elmt" orientation="0">
<terminals>
<terminal x="-36" y="0" nameHidden="0" number="" id="10" name="" orientation="3"/>
<terminal x="7" y="0" id="7" orientation="3"/>
</terminals>
<inputs>
<input x="-46" y="-10" text="_"/>
<input x="-25" y="50" text="T01"/>
<input x="-6.5" y="5" text="Q"/>
<input x="-6.5" y="5" text="Q"/>
<input x="25" y="2" text="action"/>
</inputs>
</element>
<element x="420" y="160" type="embed://import/automatisme/fonction/et.elmt" uuid="{39e1f6ea-04f2-4d8f-877e-02cfb7b60f36}" orientation="0">
<element x="170" y="180" type="embed://import/automatisme/fonction/entree.elmt" orientation="0">
<terminals>
<terminal x="36" y="0" nameHidden="0" number="" id="11" name="" orientation="1"/>
<terminal x="-36" y="-20" nameHidden="0" number="" id="12" name="" orientation="3"/>
<terminal x="-36" y="20" nameHidden="0" number="" id="13" name="" orientation="3"/>
<terminal x="36" y="0" id="8" orientation="1"/>
</terminals>
<inputs>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
</inputs>
</element>
<element x="460" y="70" type="embed://import/grafcet2/macro/etape_entree.elmt" orientation="0">
<terminals>
<terminal x="0" y="41" id="9" orientation="2"/>
<terminal x="-8" y="40" id="10" orientation="3"/>
</terminals>
<inputs>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="E 03"/>
</inputs>
</element>
<element x="520" y="150" type="embed://import/grafcet/actions/continue.elmt" orientation="0">
<terminals>
<terminal x="7" y="0" id="11" orientation="3"/>
</terminals>
<inputs>
<input x="25" y="2" text="action"/>
</inputs>
</element>
<element x="460" y="220" type="embed://import/grafcet2/transition.elmt" orientation="0">
<terminals>
<terminal x="0" y="1" id="12" orientation="2"/>
<terminal x="0" y="-1" id="13" orientation="0"/>
<terminal x="-8" y="0" id="14" orientation="3"/>
</terminals>
<inputs>
<input x="15" y="2" text="T 30"/>
</inputs>
</element>
<element x="520" y="300" type="embed://import/grafcet/actions/continue.elmt" orientation="0">
<terminals>
<terminal x="7" y="0" id="15" orientation="3"/>
</terminals>
<inputs>
<input x="25" y="2" text="action"/>
</inputs>
</element>
<element x="520" y="170" type="embed://import/grafcet/actions/continue.elmt" orientation="0">
<terminals>
<terminal x="7" y="0" id="16" orientation="3"/>
</terminals>
<inputs>
<input x="25" y="2" text="action"/>
</inputs>
</element>
<element x="330" y="220" type="embed://import/automatisme/fonction/et.elmt" orientation="0">
<terminals>
<terminal x="36" y="0" id="17" orientation="1"/>
<terminal x="-36" y="-20" id="18" orientation="3"/>
<terminal x="-36" y="20" id="19" orientation="3"/>
</terminals>
<inputs>
<input x="-46" y="10" text="_"/>
<input x="-46" y="-30" text="_"/>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
<input x="-6" y="5" text="&amp;"/>
<input x="-6" y="5" text="&amp;"/>
</inputs>
</element>
<element x="170" y="430" type="embed://import/automatisme/fonction/entree.elmt" orientation="0">
<terminals>
<terminal x="36" y="0" id="20" orientation="1"/>
</terminals>
<inputs>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
</inputs>
</element>
<element x="460" y="460" type="embed://import/grafcet2/macro/etape_sortie.elmt" orientation="0">
<terminals>
<terminal x="0" y="-21" id="21" orientation="0"/>
</terminals>
<inputs>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="S 03"/>
</inputs>
</element>
<element x="340" y="390" type="embed://import/automatisme/fonction/ou.elmt" orientation="0">
<terminals>
<terminal x="36" y="0" id="22" orientation="1"/>
<terminal x="-36" y="-20" id="23" orientation="3"/>
<terminal x="-36" y="20" id="24" orientation="3"/>
</terminals>
<inputs>
<input x="-46" y="10" text="_"/>
<input x="-46" y="-30" text="_"/>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
</inputs>
</element>
<element x="170" y="350" type="embed://import/automatisme/fonction/entree.elmt" orientation="0">
<terminals>
<terminal x="36" y="0" id="25" orientation="1"/>
</terminals>
<inputs>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
</inputs>
</element>
<element x="460" y="310" type="embed://import/grafcet2/etape.elmt" orientation="0">
<terminals>
<terminal x="0" y="-21" id="26" orientation="0"/>
<terminal x="0" y="21" id="27" orientation="2"/>
<terminal x="36" y="-10" id="28" orientation="1"/>
</terminals>
<inputs>
<input x="-30" y="14" text=""/>
<input x="-20" y="0" text="E 05"/>
</inputs>
</element>
</elements>
<conductors>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="4" terminal2="0" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="1" terminal2="0" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0">
<segment length="0" orientation="horizontal"/>
<segment length="56" orientation="horizontal"/>
<segment length="-30" orientation="vertical"/>
<segment length="56" orientation="horizontal"/>
<segment length="0" orientation="horizontal"/>
</conductor>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="5" terminal2="2" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0">
<segment length="-9" orientation="horizontal"/>
<segment length="-27" orientation="horizontal"/>
<segment length="60" orientation="vertical"/>
<segment length="27" orientation="horizontal"/>
<segment length="9" orientation="horizontal"/>
</conductor>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="6" terminal2="12" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="7" terminal2="8" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="9" terminal2="13" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="11" terminal2="10" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0"/>
<conductor num="_" vertirotatetext="0" displaytext="1" terminal1="3" terminal2="5" type="multi" horizrotatetext="0" numsize="9" onetextperfolio="0">
<conductor num="_" terminal1="12" terminal2="26" type="multi"/>
<conductor num="_" terminal1="16" terminal2="2" type="multi"/>
<conductor num="_" terminal1="17" terminal2="14" type="multi"/>
<conductor num="_" terminal1="2" terminal2="11" type="multi"/>
<conductor num="_" terminal1="1" terminal2="13" type="multi"/>
<conductor num="_" terminal1="9" terminal2="0" type="multi"/>
<conductor num="_" terminal1="28" terminal2="15" type="multi"/>
<conductor num="_" terminal1="4" terminal2="27" type="multi"/>
<conductor num="_" terminal1="2" terminal2="7" type="multi"/>
<conductor num="_" terminal1="3" terminal2="21" type="multi"/>
<conductor num="_" terminal1="6" terminal2="19" type="multi"/>
<conductor num="_" terminal1="8" terminal2="18" type="multi"/>
<conductor num="_" terminal1="20" terminal2="24" type="multi"/>
<conductor num="_" terminal1="22" terminal2="5" type="multi"/>
<conductor num="_" terminal1="25" terminal2="23" type="multi"/>
</conductors>
</diagram>
<diagram title="Conditions" displayrows="true" cols="15" folio="%id/%total" displaycols="true" height="500" colsize="50" order="3" rows="6" author="" filename="" rowsize="80">
<defaultconductor num="_" type="multi"/>
<elements>
<element x="420" y="160" type="embed://import/automatisme/fonction/et.elmt" orientation="0">
<terminals>
<terminal x="36" y="0" id="0" orientation="1"/>
<terminal x="-36" y="-20" id="1" orientation="3"/>
<terminal x="-36" y="20" id="2" orientation="3"/>
</terminals>
<inputs>
<input x="-46" y="10" text="_"/>
<input x="-46" y="-30" text="_"/>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
</inputs>
</element>
<element x="560" y="160" type="embed://import/automatisme/fonction/sortie.elmt" orientation="0">
<terminals>
<terminal x="-36" y="0" id="3" orientation="3"/>
</terminals>
<inputs>
<input x="-46" y="-10" text="_"/>
<input x="-25" y="50" text="T01"/>
</inputs>
</element>
<element x="310" y="220" type="embed://import/automatisme/fonction/non.elmt" orientation="0">
<terminals>
<terminal x="-36" y="0" id="4" orientation="3"/>
<terminal x="36" y="0" id="5" orientation="1"/>
</terminals>
<inputs>
<input x="-46" y="-10" text="_"/>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="_"/>
</inputs>
</element>
<element x="190" y="220" type="embed://import/automatisme/fonction/entree.elmt" orientation="0">
<terminals>
<terminal x="36" y="0" id="6" orientation="1"/>
</terminals>
<inputs>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="Arrêt urgence"/>
</inputs>
</element>
<element x="190" y="100" type="embed://import/automatisme/fonction/entree.elmt" orientation="0">
<terminals>
<terminal x="36" y="0" id="7" orientation="1"/>
</terminals>
<inputs>
<input x="25" y="-10" text="_"/>
<input x="-25" y="50" text="Bouton start"/>
</inputs>
</element>
<element x="290" y="370" type="embed://import/automatisme/lader/input/entree.elmt" orientation="0">
<terminals>
<terminal x="20" y="0" id="8" orientation="1"/>
<terminal x="-20" y="0" id="9" orientation="3"/>
</terminals>
<inputs>
<input x="-18" y="-10" text="Bouton stop"/>
</inputs>
</element>
<element x="200" y="400" type="embed://import/sources/multifilaire/src_p.elmt" orientation="0">
<terminals>
<terminal x="6" y="0" id="10" orientation="1"/>
</terminals>
<inputs/>
</element>
<element x="290" y="430" type="embed://import/automatisme/lader/input/entree.elmt" orientation="0">
<terminals>
<terminal x="20" y="0" id="11" orientation="1"/>
<terminal x="-20" y="0" id="12" orientation="3"/>
</terminals>
<inputs>
<input x="-18" y="-10" text="Arrêt urgence"/>
</inputs>
</element>
<element x="450" y="400" type="embed://import/automatisme/lader/output/sortie.elmt" orientation="0">
<terminals>
<terminal x="-20" y="0" id="13" orientation="3"/>
</terminals>
<inputs>
<input x="-18" y="-10" text="T03_"/>
</inputs>
</element>
</elements>
<conductors>
<conductor num="_" terminal1="10" terminal2="9" type="multi">
<segment length="9" orientation="horizontal"/>
<segment length="11" orientation="horizontal"/>
<segment length="-30" orientation="vertical"/>
<segment length="27" orientation="horizontal"/>
<segment length="9" orientation="horizontal"/>
</conductor>
<conductor num="_" terminal1="0" terminal2="3" type="multi"/>
<conductor num="_" terminal1="5" terminal2="2" type="multi"/>
<conductor num="_" terminal1="6" terminal2="4" type="multi"/>
<conductor num="_" terminal1="7" terminal2="1" type="multi"/>
<conductor num="_" terminal1="9" terminal2="12" type="multi">
<segment length="-9" orientation="horizontal"/>
<segment length="-27" orientation="horizontal"/>
<segment length="60" orientation="vertical"/>
<segment length="27" orientation="horizontal"/>
<segment length="9" orientation="horizontal"/>
</conductor>
<conductor num="_" terminal1="11" terminal2="13" type="multi">
<segment length="0" orientation="horizontal"/>
<segment length="56" orientation="horizontal"/>
<segment length="-30" orientation="vertical"/>
<segment length="56" orientation="horizontal"/>
<segment length="0" orientation="horizontal"/>
</conductor>
<conductor num="_" terminal1="8" terminal2="13" type="multi"/>
</conductors>
<inputs>
<input x="360" y="290" text="&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;>&#xa;&lt;html>&lt;head>&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; />&lt;style type=&quot;text/css&quot;>&#xa;p, li { white-space: pre-wrap; }&#xa;&lt;/style>&lt;/head>&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;>&#xa;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;>Condition T02 si - moteur en marche - lubrification en marche &lt;/p>&lt;/body>&lt;/html>"/>
<input x="540" y="290" text="Condition T02 si&#xa; - moteur en marche&#xa; - lubrification en marche&#xa;"/>
</inputs>
</diagram>
<collection>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 44 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
<context>
<name>QETElementEditor</name>
<message numerus="yes">
<location filename="../sources/editor/qetelementeditor.cpp" line="589"/>
<location filename="../sources/editor/qetelementeditor.cpp" line="626"/>
<source>%n partie(s) sélectionnée(s).</source>
<translation>
<numerusform>%n partie sélectionnée.</numerusform>
@@ -12,7 +12,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../sources/editor/qetelementeditor.cpp" line="683"/>
<location filename="../sources/editor/qetelementeditor.cpp" line="720"/>
<source>La vérification de cet élément a généré %n avertissement(s) :</source>
<comment>message box content</comment>
<translation>
@@ -87,8 +87,8 @@
</translation>
</message>
<message numerus="yes">
<location filename="../sources/diagramcommands.cpp" line="1221"/>
<location filename="../sources/diagramcommands.cpp" line="1236"/>
<location filename="../sources/diagramcommands.cpp" line="1251"/>
<source>Délier %n élément(s)</source>
<translation>
<numerusform>Délier %n élément</numerusform>

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,7 @@ APPBIN="$BUNDLE/Contents/MacOS/$APPNAME"
current_dir=$(dirname "$0")
# On se remet au depart
cd "${current_dir}/../"
cd ${current_dir}/../
# Emplacement courant
current_dir=$(PWD)
@@ -74,11 +74,8 @@ svn up
# recupere le numero de la nouvelle revision
revAp=$(svnversion | cut -d : -f 2 | tr -d '[:alpha:]')
# On recupere le numero de version de l'originale
tagName=$(sed -n "s/const QString displayedVersion =\(.*\)/\1/p" sources/qet.h | cut -d\" -f2 | cut -d\" -f1 )
# Dmg de la dernière revision déjà créé
if [ -e "packaging/mac-osx/${APPNAME} $tagName r$revAp.dmg" ] ; then
if [ -e "packaging/mac-osx/${APPNAME}_$revAp.dmg" ] ; then
echo "There are not new updates, make disk image can"
echo "take a lot of time (5 min). Can you continu?"
echo "[y/n]"
@@ -104,8 +101,8 @@ echo "Adding the version tag..."
mkdir temp
cp -Rf "sources/qet.h" "temp/qet.h"
# On modifie l'originale avec le numero de revision du depot svn
sed -i "" "s/const QString displayedVersion =.*/const QString displayedVersion = \"$tagName r$revAp\";/" sources/qet.h
# On modifie l'originale avec le numero de version
sed -i "" "s/const QString displayedVersion = \"0.4-dev\"/const QString displayedVersion = \"0.4-dev-r$revAp\"/" sources/qet.h
# Apres la compilation
cleanVerionTag () {
@@ -182,7 +179,7 @@ else
fi
# On rajoute le numero de version pour "cmd + i"
sed -i "" "s/<string>Created by Qt\/QMake<\/string>/<string>$tagName r$revAp<\/string>/" qelectrotech.app/Contents/Info.plist
sed -i "" "s/<string>Created by Qt\/QMake<\/string>/<string>0.4 dev r$revAp<\/string>/" qelectrotech.app/Contents/Info.plist
### copy over frameworks ############################################
@@ -244,11 +241,11 @@ echo 'Preparing (removing hold files)... '
if [ -e "/Volumes/${APPNAME}" ]; then
hdiutil detach -quiet "/Volumes/${APPNAME}"
fi
if [ -e "${APPNAME} $tagName r$revAp.dmg" ] ; then
rm -f "${APPNAME} $tagName r$revAp.dmg"
if [ -e "${APPNAME}_$revAp.dmg" ] ; then
rm -f "${APPNAME}_$revAp.dmg"
fi
if [ -e "packaging/mac-osx/${APPNAME} $tagName r$revAp.dmg" ] ; then
rm -f "packaging/mac-osx/${APPNAME} $tagName r$revAp.dmg"
if [ -e "packaging/mac-osx/${APPNAME}_$revAp.dmg" ] ; then
rm -f "packaging/mac-osx/${APPNAME}_$revAp.dmg"
fi
if [ -e $imagedir ] ; then
rm -rf $imagedir
@@ -271,13 +268,13 @@ strip "$imagedir/$APPBIN"
# Creating a disk image from a folder
echo 'Creating disk image... '
hdiutil create -quiet -ov -srcfolder $imagedir -format UDBZ -volname "${APPNAME}" "${APPNAME} $tagName r$revAp.dmg"
hdiutil internet-enable -yes -quiet "${APPNAME} $tagName r$revAp.dmg"
hdiutil create -quiet -ov -srcfolder $imagedir -format UDBZ -volname "${APPNAME}" "${APPNAME}_${revAp}.dmg"
hdiutil internet-enable -yes -quiet "${APPNAME}_${revAp}.dmg"
# Clean up disk folder
echo 'Cleaning up... '
cp -Rf "${APPNAME} $tagName r$revAp.dmg" "packaging/mac-osx/${APPNAME} $tagName r$revAp.dmg"
rm -f "${APPNAME} $tagName r$revAp.dmg"
cp -Rf "${APPNAME}_$revAp.dmg" "packaging/mac-osx/${APPNAME}_$revAp.dmg"
rm -f "${APPNAME}_$revAp.dmg"
rm -rf $imagedir
rm -rf $BUNDLE
@@ -305,8 +302,6 @@ svnversion | grep -q '[MS:]' ; if [ $? -eq 0 ] ; then
echo This is not the same version as the deposit.
echo You can use \'svn diff\' to see the differences.
echo And use \'svn revert \<fichier\>\' to delete the difference.
echo To go back, you can use svn update -r 360
echo to go to revision number 360.
echo
fi

View File

@@ -63,32 +63,18 @@ DEFINES += QET_ALLOW_OVERRIDE_CD_OPTION
TEMPLATE = app
DEPENDPATH += .
INCLUDEPATH += sources \
sources/titleblock \
sources/ui sources/qetgraphicsitem \
sources/richtext \
sources/factory \
sources/properties \
sources/dvevent \
sources/editor \
sources/editor/esevent \
sources/undocommand
INCLUDEPATH += sources sources/editor sources/titleblock sources/ui sources/qetgraphicsitem sources/richtext sources/factory sources/properties sources/dvevent
# Fichiers sources
HEADERS += $$files(sources/*.h) $$files(sources/ui/*.h) $$files(sources/editor/*.h) $$files(sources/titleblock/*.h) $$files(sources/richtext/*.h) $$files(sources/qetgraphicsitem/*.h) $$files(sources/factory/*.h) \
$$files(sources/properties/*.h) \
$$files(sources/editor/ui/*.h) \
$$files(sources/editor/esevent/*.h) \
$$files(sources/dvevent/*.h) \
$$files(sources/undocommand/*.h)
$$files(sources/dvevent/*.h)
SOURCES += $$files(sources/*.cpp) $$files(sources/editor/*.cpp) $$files(sources/titleblock/*.cpp) $$files(sources/richtext/*.cpp) $$files(sources/ui/*.cpp) $$files(sources/qetgraphicsitem/*.cpp) $$files(sources/factory/*.cpp) \
$$files(sources/properties/*.cpp) \
$$files(sources/editor/ui/*.cpp) \
$$files(sources/editor/esevent/*.cpp) \
$$files(sources/dvevent/*.cpp) \
$$files(sources/undocommand/*.cpp)
$$files(sources/dvevent/*.cpp)
# Liste des fichiers qui seront incorpores au binaire en tant que ressources Qt
RESOURCES += qelectrotech.qrc

View File

@@ -180,8 +180,6 @@ QWidget *AboutQET::contributorsTab() const {
addAuthor(contributors, "Nuno Pinheiro", "nuno@nuno-icons.com", tr("Ic\364nes"));
addAuthor(contributors, "Cyril Frausti", "cyril@qelectrotech.org", tr("D\351veloppement"));
addAuthor(contributors, "Arun Kishore Eswara", "eswara.arun@gmail.com", tr("Documentation"));
addAuthor(contributors, "Ren\351 Negre", "runsys@qelectrotech.org", tr("D\351veloppement"));
addAuthor(contributors, "Ronny Desmedt", "r.desmedt@live.be", tr("D\351veloppement"));
contributors -> setOpenExternalLinks(true);

View File

@@ -22,7 +22,6 @@
#include "conductor.h"
#include "diagram.h"
#include "potentialtextsdialog.h"
#include "qet.h"
/**
*Constructor
@@ -60,7 +59,7 @@ void ConductorAutoNumerotation::checkPotential(Conductor *conductor) {
foreach (const Conductor *c, c_list) strl<<(c->text());
//check text list, isn't same in potential, ask user what to do
if (!QET::eachStrIsEqual(strl)) {
if (!eachIsEqual(strl)) {
PotentialTextsDialog ptd(conductor, conductor->diagramEditor());
if ( ptd.exec() == QDialog::Accepted ) {
ConductorAutoNumerotation can(conductor);
@@ -112,7 +111,7 @@ void ConductorAutoNumerotation::numeratePotential() {
QStringList strl;
foreach (const Conductor *cc, conductor_list) strl<<(cc->text());
//the texts is identicals
if (QET::eachStrIsEqual(strl)) {
if (eachIsEqual(strl)) {
ConductorProperties cp = conductor_ -> properties();
cp.text = strl.at(0);
conductor_ -> setProperties(cp);
@@ -141,3 +140,13 @@ void ConductorAutoNumerotation::numerateNewConductor() {
applyText(ncc.toRepresentedString());
m_diagram->project()->addConductorAutoNum(m_diagram -> conductorsAutonumName(), ncc.next());
}
/**
* @return true if every text of qsl is identical, else false.
*/
bool eachIsEqual (const QStringList &qsl) {
foreach (const QString t, qsl) {
if (qsl.at(0) != t) return false;
}
return true;
}

View File

@@ -44,4 +44,6 @@ class ConductorAutoNumerotation {
QSet <Conductor *> conductor_list;
};
bool eachIsEqual (const QStringList &);
#endif // CONDUCTORAUTONUMEROTATION_H

View File

@@ -195,7 +195,7 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage
projects_view_mode_ = new QGroupBox(tr("Projets"), this);
windowed_mode_ = new QRadioButton(tr("Utiliser des fen\352tres"), projects_view_mode_);
tabbed_mode_ = new QRadioButton(tr("Utiliser des onglets"), projects_view_mode_);
use_trackpad_ = new QCheckBox(tr("Utiliser les gestes du pav\351 tactile"), projects_view_mode_);
use_trackpad_ = new QCheckBox(tr("Utiliser les gestures du trackpad"), projects_view_mode_);
warning_view_mode_ = new QLabel(tr("Ces param\350tres s'appliqueront d\350s la prochaine ouverture d'un \351diteur de sch\351mas."));
elements_management_ = new QGroupBox(tr("Gestion des \351l\351ments"), this);

View File

@@ -41,22 +41,20 @@ const qreal Diagram::margin = 5.0;
// static variable to keep track of present background color of the diagram.
QColor Diagram::background_color = Qt::white;
/**
* @brief Diagram::Diagram
* Constructor
* @param project : The project of this diagram and also parent QObject
*/
Diagram::Diagram(QETProject *project) :
QGraphicsScene (project),
project_ (nullptr),
diagram_qet_version_ (-1),
draw_grid_ (true),
use_border_ (true),
draw_terminals_ (true),
draw_colored_conductors_ (true)
Constructeur
@param parent Le QObject parent du schema
*/
Diagram::Diagram(QObject *parent) :
QGraphicsScene(parent),
project_(0),
diagram_qet_version_(-1),
draw_grid_(true),
use_border_(true),
draw_terminals_(true),
draw_colored_conductors_(true),
read_only_(false)
{
setProject(project);
qgi_manager_ = new QGIManager(this);
setBackgroundBrush(Qt::white);
conductor_setter_ = new QGraphicsLineItem(0, 0);
@@ -68,12 +66,18 @@ Diagram::Diagram(QETProject *project) :
conductor_setter_ -> setPen(t);
conductor_setter_ -> setLine(QLineF(QPointF(0.0, 0.0), QPointF(0.0, 0.0)));
//Init object for manage movement
elements_mover_ = new ElementsMover();
element_texts_mover_ = new ElementTextsMover();
// initialise les objets gerant les deplacements
elements_mover_ = new ElementsMover(); // deplacements d'elements/conducteurs/textes
element_texts_mover_ = new ElementTextsMover(); // deplacements d'ElementTextItem
connect(&border_and_titleblock, SIGNAL(needTitleBlockTemplate(const QString &)), this, SLOT(setTitleBlockTemplate(const QString &)));
connect(&border_and_titleblock, SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(titleChanged(const QString &)));
connect(
&border_and_titleblock, SIGNAL(needTitleBlockTemplate(const QString &)),
this, SLOT(setTitleBlockTemplate(const QString &))
);
connect(
&border_and_titleblock, SIGNAL(diagramTitleChanged(const QString &)),
this, SLOT(titleChanged(const QString &))
);
}
/**
@@ -551,7 +555,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
if (type_id.startsWith("embed://")) element_location.setProject(project_);
int state = 0;
Element *nvel_elmt = ElementFactory::Instance() -> createElement(element_location, 0, &state);
Element *nvel_elmt = ElementFactory::Instance()->createElement(element_location, 0, this, &state);
if (state) {
QString debug_message = QString("Diagram::fromXml() : Le chargement de la description de l'element %1 a echoue avec le code d'erreur %2").arg(element_location.path()).arg(state);
qDebug() << qPrintable(debug_message);
@@ -572,16 +576,15 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
}
}
// Load text
// chargement de tous les textes du fichiers XML
QList<IndependentTextItem *> added_texts;
foreach (QDomElement text_xml, QET::findInDomElement(root, "inputs", "input")) {
IndependentTextItem *iti = new IndependentTextItem();
IndependentTextItem *iti = new IndependentTextItem(this);
iti -> fromXml(text_xml);
addItem(iti);
added_texts << iti;
}
// Load image
QList<DiagramImageItem *> added_images;
foreach (QDomElement image_xml, QET::findInDomElement(root, "images", "image")) {
DiagramImageItem *dii = new DiagramImageItem ();
@@ -590,7 +593,6 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
added_images << dii;
}
// Load shape
QList<QetShapeItem *> added_shapes;
foreach (QDomElement shape_xml, QET::findInDomElement(root, "shapes", "shape")) {
QetShapeItem *dii = new QetShapeItem (QPointF(0,0));
@@ -599,53 +601,71 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
added_shapes << dii;
}
// Load conductor
QList<Conductor *> added_conductors;
foreach (QDomElement f, QET::findInDomElement(root, "conductors", "conductor"))
{
if (!Conductor::valideXml(f)) continue;
// gere la translation des nouveaux elements et texte si celle-ci est demandee
if (position != QPointF()) {
// determine quel est le coin superieur gauche du rectangle entourant les elements ajoutes
qreal minimum_x = 0, minimum_y = 0;
bool init = false;
QList<QGraphicsItem *> added_items;
foreach (Element *added_element, added_elements) added_items << added_element;
foreach (DiagramTextItem *added_text, added_texts) added_items << added_text;
foreach (DiagramImageItem *added_image, added_images) added_items << added_image;
foreach (QetShapeItem *added_shape, added_shapes) added_items << added_shape;
foreach (QGraphicsItem *item, added_items) {
QPointF csg = item -> mapToScene(item -> boundingRect()).boundingRect().topLeft();
qreal px = csg.x();
qreal py = csg.y();
if (!init) {
minimum_x = px;
minimum_y = py;
init = true;
} else {
if (px < minimum_x) minimum_x = px;
if (py < minimum_y) minimum_y = py;
}
}
qreal diff_x = position.x() - minimum_x;
qreal diff_y = position.y() - minimum_y;
foreach (Element *added_element, added_elements) {
added_element -> setPos(added_element -> pos().x() + diff_x, added_element -> pos().y() + diff_y);
}
foreach (DiagramTextItem *added_text, added_texts) {
added_text -> setPos(added_text -> pos().x() + diff_x, added_text -> pos().y() + diff_y);
}
foreach (DiagramImageItem *added_image, added_images) {
added_image -> setPos(added_image -> pos().x() + diff_x, added_image -> pos().y() + diff_y);
}
foreach (QetShapeItem *added_shape, added_shapes) {
added_shape -> setPos(added_shape -> pos().x() + diff_x, added_shape -> pos().y() + diff_y);
}
}
//Check if terminal that conductor must be linked is know
// chargement de tous les Conducteurs du fichier XML
QList<Conductor *> added_conductors;
foreach (QDomElement f, QET::findInDomElement(root, "conductors", "conductor")) {
if (!Conductor::valideXml(f)) continue;
// verifie que les bornes que le conducteur relie sont connues
int id_p1 = f.attribute("terminal1").toInt();
int id_p2 = f.attribute("terminal2").toInt();
if (table_adr_id.contains(id_p1) && table_adr_id.contains(id_p2))
{
if (table_adr_id.contains(id_p1) && table_adr_id.contains(id_p2)) {
// pose le conducteur... si c'est possible
Terminal *p1 = table_adr_id.value(id_p1);
Terminal *p2 = table_adr_id.value(id_p2);
if (p1 != p2)
{
Conductor *c = new Conductor(table_adr_id.value(id_p1), table_adr_id.value(id_p2));
addItem(c);
if (p1 != p2) {
bool can_add_conductor = true;
bool cia = ((Element *)p2 -> parentItem()) -> internalConnections();
if (!cia) {
foreach(QGraphicsItem *item, p2 -> parentItem() -> children()) {
if (item == p1) can_add_conductor = false;
}
}
if (can_add_conductor) {
Conductor *c = new Conductor(table_adr_id.value(id_p1), table_adr_id.value(id_p2), this);
c -> fromXml(f);
added_conductors << c;
}
}
else qDebug() << "Diagram::fromXml() : Le chargement du conducteur" << id_p1 << id_p2 << "a echoue";
}
//Translate items if a new position was given in parameter
if (position != QPointF()) {
QList<QGraphicsItem *> added_items;
foreach (Element *added_element, added_elements ) added_items << added_element;
foreach (Conductor *added_cond, added_conductors) added_items << added_cond;
foreach (QetShapeItem *added_shape, added_shapes ) added_items << added_shape;
foreach (DiagramTextItem *added_text, added_texts ) added_items << added_text;
foreach (DiagramImageItem *added_image, added_images ) added_items << added_image;
//Get the top left corner of the rectangle that contain all added items
QRectF items_rect;
foreach (QGraphicsItem *item, added_items) {
items_rect = items_rect.united(item -> mapToScene(item -> boundingRect()).boundingRect());
}
QPointF point_ = items_rect.topLeft();
QPointF pos_ = Diagram::snapToGrid(QPointF (position.x() - point_.x(),
position.y() - point_.y()));
//Translate all added items
foreach (QGraphicsItem *qgi, added_items)
qgi -> setPos( qgi -> pos() += pos_);
} else qDebug() << "Diagram::fromXml() : Le chargement du conducteur" << id_p1 << id_p2 << "a echoue";
}
// remplissage des listes facultatives
@@ -738,7 +758,6 @@ void Diagram::addItem(Conductor *conductor) {
QGraphicsScene::addItem(conductor);
conductor -> terminal1 -> addConductor(conductor);
conductor -> terminal2 -> addConductor(conductor);
conductor -> calculateTextItemPosition();
}
}
@@ -1177,22 +1196,6 @@ QSet<ConductorTextItem *> Diagram::selectedConductorTexts() const {
return(selected_texts);
}
/**
* @brief Diagram::selectedElementTexts
* @return the list of element texts selected
*/
QSet<ElementTextItem*> Diagram::selectedElementTexts() const {
QSet<ElementTextItem *> selected_texts;
foreach(QGraphicsItem *item, selectedItems()) {
if (ElementTextItem *cti = qgraphicsitem_cast< ElementTextItem*>(item)) {
selected_texts << cti;
}
}
return(selected_texts);
}
/// @return true si le presse-papier semble contenir un schema
bool Diagram::clipboardMayContainDiagram() {
QString clipboard_text = QApplication::clipboard() -> text().trimmed();
@@ -1210,24 +1213,18 @@ QETProject *Diagram::project() const {
/**
* @brief Diagram::setProject
* Set parent project of this diagram, project also become the parent QObject of this diagram
* @param project new project
* @param project: set parent project of this diagram or 0 if this diagram haven't got a parent project
*/
void Diagram::setProject(QETProject *project)
{
if (project_ == project) return;
if (project_)
{
void Diagram::setProject(QETProject *project) {
if (project_) {
disconnect (project_, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
disconnect (project_, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
}
project_ = project;
setParent (project);
if (project_) {
connect (project_, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
connect (project_, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
}
}
/**
@@ -1256,13 +1253,20 @@ qreal Diagram::declaredQElectroTechVersion(bool fallback_to_project) const {
}
/**
* @brief Diagram::isReadOnly
* @return true if this diagram is read only.
* This method is same has call Diagram::project() -> isReadOnly()
*/
bool Diagram::isReadOnly() const
{
return project_ -> isReadOnly();
@return true si le schema est en lecture seule
*/
bool Diagram::isReadOnly() const {
return(read_only_);
}
/**
@param read_only true pour passer le schema en lecture seule, false sinon
*/
void Diagram::setReadOnly(bool read_only) {
if (read_only_ != read_only) {
read_only_ = read_only;
emit(readOnlyChanged(read_only_));
}
}
/**

View File

@@ -47,14 +47,14 @@ class ElementTextsMover;
This class represents an electric diagram. It manages its various child
elements, conductors and texts and handles their graphic rendering.
*/
class Diagram : public QGraphicsScene
{
class Diagram : public QGraphicsScene {
Q_OBJECT
// constructors, destructor
public:
Diagram(QETProject *project);
Diagram(QObject * = 0);
virtual ~Diagram();
private:
Diagram(const Diagram &diagram);
@@ -97,6 +97,7 @@ class Diagram : public QGraphicsScene
bool use_border_;
bool draw_terminals_;
bool draw_colored_conductors_;
bool read_only_;
QString m_conductors_autonum_name;
@@ -123,7 +124,10 @@ class Diagram : public QGraphicsScene
int folioIndex() const;
qreal declaredQElectroTechVersion(bool = true) const;
void showMe() {emit showDiagram(this);}
// methods related to read only mode
bool isReadOnly() const;
void setReadOnly(bool);
// methods related to conductor creation
void setConductor(bool);
@@ -180,7 +184,6 @@ class Diagram : public QGraphicsScene
QList<Element *> elements() const;
QSet<DiagramTextItem *> selectedTexts() const;
QSet<ConductorTextItem *> selectedConductorTexts() const;
QSet<ElementTextItem*> selectedElementTexts() const;
QSet<Conductor *> selectedConductors() const;
DiagramContent content() const;
DiagramContent selectedContent();
@@ -212,10 +215,13 @@ class Diagram : public QGraphicsScene
signals:
void showDiagram (Diagram *);
void written();
void readOnlyChanged(bool);
void usedTitleBlockTemplateChanged(const QString &);
void diagramTitleChanged(Diagram *, const QString &);
void findElementRequired(const ElementsLocation &); /// Signal emitted when users wish to locate an element from the diagram within elements collection
void editElementRequired(const ElementsLocation &); /// Signal emitted when users wish to edit an element from the diagram
/// Signal emitted when users wish to locate an element from the diagram within elements collection
void findElementRequired(const ElementsLocation &);
/// Signal emitted when users wish to edit an element from the diagram
void editElementRequired(const ElementsLocation &);
void reportPropertiesChanged(QString);
void XRefPropertiesChanged();
};

View File

@@ -77,22 +77,17 @@ DeleteElementsCommand::~DeleteElementsCommand() {
/// annule les suppressions
void DeleteElementsCommand::undo() {
diagram -> showMe();
// remet les elements
foreach(Element *e, removed_content.elements) {
diagram -> addItem(e);
}
//We relink element after every element was added to diagram
foreach(Element *e, removed_content.elements) {
foreach (Element *elmt, m_link_hash[e]) {
e -> linkToElement(elmt);
}
}
// remet les conducteurs
foreach(Conductor *c, removed_content.conductors(DiagramContent::AnyConductor)) {
diagram -> addItem(c);
}
// remet les textes
foreach(IndependentTextItem *t, removed_content.textFields) {
diagram -> addItem(t);
}
@@ -118,7 +113,7 @@ void DeleteElementsCommand::redo() {
diagram -> removeItem(c);
//If option one text per folio is enable, and the text item of
//current conductor is visible (that mean the conductor have the single displayed text)
//current conductor is visible (that mean the conductor own the single displayed text)
//We call adjustTextItemPosition to other conductor at the same potential to keep
//a visible text on this potential.
if (diagram -> defaultConductorProperties.m_one_text_per_folio && c -> textItem() -> isVisible()) {
@@ -132,9 +127,6 @@ void DeleteElementsCommand::redo() {
// Remove elements
foreach(Element *e, removed_content.elements) {
//Get linked element, for relink it at undo
if (!e->linkedElements().isEmpty())
m_link_hash.insert(e, e->linkedElements());
diagram -> removeItem(e);
}
@@ -232,13 +224,6 @@ void PasteDiagramCommand::redo() {
eti -> setPlainText("_");
}
}
//Reset the text of conductors
foreach (Conductor *c, content.conductorsToMove) {
ConductorProperties cp = c -> properties();
cp.text = c->diagram() ? c -> diagram() -> defaultConductorProperties.text : "_";
c -> setProperties(cp);
}
}
else {
// paste the elements

View File

@@ -101,8 +101,6 @@ class DeleteElementsCommand : public QUndoCommand {
DiagramContent removed_content;
/// diagram which the content is removed from
Diagram *diagram;
/// keep linked element for each removed element linked to other element.
QHash <Element *, QList<Element *> > m_link_hash;
};
/**

View File

@@ -96,8 +96,7 @@ bool DiagramContext::keyMustShow(const QString &key) const {
}
bool DiagramContext::operator==(const DiagramContext &dc) const {
return(content_ == dc.content_ &&
content_show == dc.content_show);
return(content_ == dc.content_);
}
bool DiagramContext::operator!=(const DiagramContext &dc) const {

View File

@@ -24,12 +24,16 @@ qreal DiagramFolioList::colWidths[4] = {0.1, 0.55, 0.2, 0.15};
/**
* @brief DiagramFolioList::DiagramFolioList
* Constructor
* @param project : The project of this diagram and also parent QObject
* @param project QETproject *: The project from which this constructor was called. Important to setProject().
* @param parent parent QObject
*/
DiagramFolioList::DiagramFolioList( QETProject *project) :
Diagram(project)
{
DiagramFolioList::DiagramFolioList( QETProject *project, QObject *parent) : Diagram(parent) {
if (project) {
setProject(project);
id = project -> getFolioSheetsQuantity();
}
else
id = 0;
}
/**

View File

@@ -24,7 +24,7 @@
class DiagramFolioList : public Diagram
{
public:
DiagramFolioList(QETProject *project);
DiagramFolioList( QETProject *project = 0, QObject *parent = 0);
virtual ~DiagramFolioList();
virtual QList<QLineF *> lines() const {return list_lines_;}
virtual QList<QRectF *> rectangles() const {return list_rectangles_;}

View File

@@ -48,14 +48,11 @@
@param diagram Schema a afficher ; si diagram vaut 0, un nouveau Diagram est utilise
@param parent Le QWidget parent de cette vue de schema
*/
DiagramView::DiagramView(Diagram *diagram, QWidget *parent) :
QGraphicsView (parent),
scene (diagram),
m_event_interface (nullptr)
{
DiagramView::DiagramView(Diagram *diagram, QWidget *parent) : QGraphicsView(parent) {
grabGesture(Qt::PinchGesture);
setAttribute(Qt::WA_DeleteOnClose, true);
setInteractive(true);
m_event_interface = nullptr;
QString whatsthis = tr(
"Ceci est la zone dans laquelle vous concevez vos sch\351mas en y ajoutant"
@@ -70,6 +67,7 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) :
setRenderHint(QPainter::TextAntialiasing, true);
setRenderHint(QPainter::SmoothPixmapTransform, true);
scene = diagram ? diagram : new Diagram(this);
setScene(scene);
scene -> undoStack().setClean();
setWindowIcon(QET::Icons::QETLogo);
@@ -86,6 +84,7 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) :
connect(scene, SIGNAL(showDiagram(Diagram*)), this, SIGNAL(showDiagram(Diagram*)));
connect(scene, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
connect(scene, SIGNAL(readOnlyChanged(bool)), this, SLOT(applyReadOnly()));
connect(&(scene -> border_and_titleblock), SIGNAL(borderChanged(QRectF, QRectF)), this, SLOT(adjustSceneRect()));
connect(&(scene -> border_and_titleblock), SIGNAL(displayChanged()), this, SLOT(adjustSceneRect()));
connect(&(scene -> border_and_titleblock), SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(updateWindowTitle()));
@@ -315,7 +314,7 @@ void DiagramView::handleTitleBlockDrop(QDropEvent *e) {
void DiagramView::handleTextDrop(QDropEvent *e) {
if (scene -> isReadOnly() || (e -> mimeData() -> hasText() == false) ) return;
IndependentTextItem *iti = new IndependentTextItem (e -> mimeData() -> text());
IndependentTextItem *iti = new IndependentTextItem (e -> mimeData() -> text(), scene);
if (e -> mimeData() -> hasHtml()) {
iti -> setHtml (e -> mimeData() -> text());
@@ -864,7 +863,7 @@ bool DiagramView::mustIntegrateTitleBlockTemplate(const TitleBlockTemplateLocati
bool DiagramView::addElementAtPos(const ElementsLocation &location, const QPoint &pos) {
// construit une instance de l'element correspondant a l'emplacement
int state;
Element *el = ElementFactory::Instance()->createElement(location, 0, &state);
Element *el = ElementFactory::Instance()->createElement(location, 0, diagram(), &state);
if (state) {
delete el;
return(false);

View File

@@ -35,26 +35,25 @@ class DiagramView : public QGraphicsView {
// constructors, destructor
public:
DiagramView(Diagram *diagram, QWidget * = 0);
DiagramView(Diagram * = 0, QWidget * = 0);
virtual ~DiagramView();
private:
DiagramView(const DiagramView &);
// attributes
private:
Diagram *scene;
DVEventInterface *m_event_interface;
QMenu *context_menu;
QAction *paste_here;
QAction *find_element_;
QPoint paste_here_pos;
bool fresh_focus_in_; ///< Indicate the focus was freshly gained
ElementsLocation next_location_;
QPoint next_position_;
QPointF center_view_;
QPointF rubber_band_origin;
bool fresh_focus_in_; ///< Indicate the focus was freshly gained
ElementsLocation next_location_;
DVEventInterface *m_event_interface;
// methods
public:

View File

@@ -143,9 +143,7 @@ void DVEventAddShape::updateHelpCross(const QPoint &p) {
//If line isn't created yet, we create it.
if (!m_help_horiz || !m_help_verti) {
QPen pen;
pen.setWidthF(0.4);
pen.setCosmetic(true);
pen.setColor(Qt::darkGray);
pen.setColor(Qt::yellow);
//Add +5 for each line, because the topleft of diagram isn't draw at position (0:0) but (5:5)
if (!m_help_horiz) {
m_help_horiz = new QGraphicsLineItem(m_diagram -> border_and_titleblock.rowsHeaderWidth() + 5, 0,

View File

@@ -296,6 +296,7 @@ void AddPartCommand::redo() {
part -> setZValue(z);
}
editor_scene_ -> clearSelection();
part -> setSelected(true);
first_redo = false;
return;
}

View File

@@ -31,9 +31,6 @@
#include "elementcontent.h"
#include "nameslist.h"
#include "ui/elementpropertieseditorwidget.h"
#include "eseventinterface.h"
#include <QKeyEvent>
/**
Constructeur
@@ -44,12 +41,11 @@ ElementScene::ElementScene(QETElementEditor *editor, QObject *parent) :
QGraphicsScene(parent),
m_elmt_type("simple"),
qgi_manager(this),
m_event_interface(nullptr),
element_editor(editor),
decorator_(0)
{
behavior = Normal;
setItemIndexMethod(NoIndex);
current_polygon = NULL;
setGrid(1, 1);
initPasteArea();
undo_stack.setClean();
@@ -61,28 +57,88 @@ ElementScene::ElementScene(QETElementEditor *editor, QObject *parent) :
/// Destructeur
ElementScene::~ElementScene() {
delete decorator_lock_;
if (m_event_interface) delete m_event_interface;
}
/**
* @brief ElementScene::mouseMoveEvent
* @param e
*/
Passe la scene en mode "selection et deplacement de parties"
*/
void ElementScene::slot_move() {
behavior = Normal;
}
/**
Passe la scene en mode "ajout de ligne"
*/
void ElementScene::slot_addLine() {
behavior = Line;
}
/**
Passe la scene en mode "ajout de rectangle"
*/
void ElementScene::slot_addRectangle() {
behavior = Rectangle;
}
/**
Passe la scene en mode "ajout de cercle"
*/
void ElementScene::slot_addCircle() {
behavior = Circle;
}
/**
Passe la scene en mode "ajout d'ellipse"
*/
void ElementScene::slot_addEllipse() {
behavior = Ellipse;
}
/**
Passe la scene en mode "ajout de polygone"
*/
void ElementScene::slot_addPolygon() {
behavior = Polygon;
}
/**
Passe la scene en mode "ajout de texte statique"
*/
void ElementScene::slot_addText() {
behavior = Text;
}
/**
Passe la scene en mode "ajout de borne"
*/
void ElementScene::slot_addTerminal() {
behavior = Terminal;
}
/**
Passe la scene en mode "ajout d'arc de cercle"
*/
void ElementScene::slot_addArc() {
behavior = Arc;
}
/**
Passe la scene en mode "ajout de champ de texte"
*/
void ElementScene::slot_addTextField() {
behavior = TextField;
}
/**
Gere les mouvements de la souris
@param e objet decrivant l'evenement
*/
void ElementScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
if (m_event_interface) {
if (m_event_interface -> mouseMoveEvent(e)) {
if (m_event_interface->isFinish()) {
emit(partsAdded());
delete m_event_interface; m_event_interface = nullptr;
}
return;
}
}
QPointF event_pos = e -> scenePos();
if (!e -> modifiers() & Qt::ControlModifier)
event_pos = snapToGrid(event_pos);
if (mustSnapToGrid(e)) snapToGrid(event_pos);
if (behavior != Polygon && current_polygon != NULL) current_polygon = NULL;
if (behavior == PasteArea) {
QRectF current_rect(paste_area_ -> rect());
current_rect.moveCenter(event_pos);
@@ -90,41 +146,107 @@ void ElementScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
return;
}
QRectF temp_rect;
QPointF temp_point;
QPolygonF temp_polygon;
if (e -> buttons() & Qt::LeftButton) {
switch(behavior) {
case Line:
current_line -> setLine(QLineF(current_line -> line().p1(), event_pos));
break;
case Rectangle:
temp_rect = current_rectangle -> rect();
temp_rect.setBottomRight(event_pos);
current_rectangle -> setRect(temp_rect);
break;
case Ellipse:
temp_rect = current_ellipse -> rect();
temp_rect.setBottomRight(event_pos);
current_ellipse -> setRect(temp_rect);
break;
case Arc:
temp_rect = current_arc -> rect();
temp_rect.setBottomRight(event_pos);
current_arc -> setRect(temp_rect);
break;
case Polygon:
if (current_polygon == NULL) break;
temp_polygon = current_polygon -> polygon();
temp_polygon.pop_back();
temp_polygon << event_pos;
current_polygon -> setPolygon(temp_polygon);
break;
case Normal:
default:
QGraphicsScene::mouseMoveEvent(e);
}
} else if (behavior == Polygon && current_polygon != NULL) {
temp_polygon = current_polygon -> polygon();
temp_polygon.pop_back();
temp_polygon << event_pos;
current_polygon -> setPolygon(temp_polygon);
} else QGraphicsScene::mouseMoveEvent(e);
}
/**
* @brief ElementScene::mousePressEvent
* @param e
*/
Gere les appuis sur les boutons de la souris
@param e objet decrivant l'evenement
*/
void ElementScene::mousePressEvent(QGraphicsSceneMouseEvent *e) {
if (m_event_interface) {
if (m_event_interface -> mousePressEvent(e)) {
if (m_event_interface->isFinish()) {
emit(partsAdded());
delete m_event_interface; m_event_interface = nullptr;
}
return;
}
}
QPointF event_pos = e -> scenePos();
if (mustSnapToGrid(e)) snapToGrid(event_pos);
if (behavior != Polygon && current_polygon != NULL) current_polygon = NULL;
QPolygonF temp_polygon;
if (e -> button() & Qt::LeftButton) {
switch(behavior) {
case Line:
current_line = new PartLine(element_editor, 0, this);
current_line -> setLine(QLineF(event_pos, event_pos));
break;
case Rectangle:
current_rectangle = new PartRectangle(element_editor, 0, this);
current_rectangle -> setRect(QRectF(event_pos, QSizeF(0.0, 0.0)));
break;
case Ellipse:
current_ellipse = new PartEllipse(element_editor, 0, this);
current_ellipse -> setRect(QRectF(event_pos, QSizeF(0.0, 0.0)));
current_ellipse -> setProperty("antialias", true);
break;
case Arc:
current_arc = new PartArc(element_editor, 0, this);
current_arc -> setRect(QRectF(event_pos, QSizeF(0.0, 0.0)));
current_arc -> setProperty("antialias", true);
break;
case Polygon:
if (current_polygon == NULL) {
current_polygon = new PartPolygon(element_editor, 0, this);
temp_polygon = QPolygonF(0);
} else temp_polygon = current_polygon -> polygon();
// au debut, on insere deux points
if (!temp_polygon.count()) temp_polygon << event_pos;
temp_polygon << event_pos;
current_polygon -> setPolygon(temp_polygon);
break;
case Normal:
default:
QGraphicsScene::mousePressEvent(e);
}
} else QGraphicsScene::mousePressEvent(e);
}
/**
* @brief ElementScene::mouseReleaseEvent
* @param e
*/
Gere les relachements de boutons de la souris
@param e objet decrivant l'evenement
*/
void ElementScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
if (m_event_interface) {
if (m_event_interface -> mouseReleaseEvent(e)) {
if (m_event_interface->isFinish()) {
emit(partsAdded());
delete m_event_interface; m_event_interface = nullptr;
}
return;
}
}
QPointF event_pos = e -> scenePos();
if (mustSnapToGrid(e)) snapToGrid(event_pos);
PartTerminal *terminal;
PartText *text;
PartTextField *textfield;
if (behavior != Polygon && current_polygon != NULL) current_polygon = NULL;
if (behavior == PasteArea) {
defined_paste_area_ = paste_area_ -> rect();
@@ -134,43 +256,70 @@ void ElementScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
return;
}
if (e -> button() & Qt::LeftButton) {
switch(behavior) {
case Line:
if (qgiManager().manages(current_line)) break;
undo_stack.push(new AddPartCommand(tr("ligne"), this, current_line));
emit(partsAdded());
endCurrentBehavior(e);
break;
case Rectangle:
if (qgiManager().manages(current_rectangle)) break;
current_rectangle -> setRect(current_rectangle -> rect().normalized());
undo_stack.push(new AddPartCommand(tr("rectangle"), this, current_rectangle));
emit(partsAdded());
endCurrentBehavior(e);
break;
case Ellipse:
if (qgiManager().manages(current_ellipse)) break;
current_ellipse -> setRect(current_ellipse -> rect().normalized());
undo_stack.push(new AddPartCommand(tr("ellipse"), this, current_ellipse));
emit(partsAdded());
endCurrentBehavior(e);
break;
case Arc:
if (qgiManager().manages(current_arc)) break;
current_arc-> setRect(current_arc -> rect().normalized());
undo_stack.push(new AddPartCommand(tr("arc"), this, current_arc));
emit(partsAdded());
endCurrentBehavior(e);
break;
case Terminal:
terminal = new PartTerminal(element_editor, 0, this);
terminal -> setPos(event_pos);
undo_stack.push(new AddPartCommand(tr("borne"), this, terminal));
emit(partsAdded());
endCurrentBehavior(e);
break;
case Text:
text = new PartText(element_editor, 0, this);
text -> setPos(event_pos);
undo_stack.push(new AddPartCommand(tr("texte"), this, text));
emit(partsAdded());
endCurrentBehavior(e);
break;
case TextField:
textfield = new PartTextField(element_editor, 0, this);
textfield -> setPos(event_pos);
undo_stack.push(new AddPartCommand(tr("champ de texte"), this, textfield));
emit(partsAdded());
endCurrentBehavior(e);
break;
case Normal:
default:
// detecte les deplacements de parties
QGraphicsScene::mouseReleaseEvent(e);
}
/**
* @brief ElementScene::mouseDoubleClickEvent
* @param event
*/
void ElementScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {
if (m_event_interface) {
if (m_event_interface -> mouseDoubleClickEvent(event)) {
if (m_event_interface->isFinish()) {
moving_parts_ = false;
}
} else if (e -> button() & Qt::RightButton) {
if (behavior == Polygon && current_polygon != NULL) {
undo_stack.push(new AddPartCommand(tr("polygone"), this, current_polygon));
current_polygon = NULL;
emit(partsAdded());
delete m_event_interface; m_event_interface = nullptr;
}
return;
}
}
QGraphicsScene::mouseDoubleClickEvent(event);
}
/**
* @brief ElementScene::keyPressEvent
* manage key press event
* @param event
*/
void ElementScene::keyPressEvent(QKeyEvent *event) {
if (m_event_interface) {
if (m_event_interface -> keyPressEvent(event)) {
if (m_event_interface->isFinish()) {
emit(partsAdded());
delete m_event_interface; m_event_interface = nullptr;
}
return;
}
}
QGraphicsScene::keyPressEvent(event);
endCurrentBehavior(e);
} else QGraphicsScene::mouseReleaseEvent(e);
} else QGraphicsScene::mouseReleaseEvent(e);
}
/**
@@ -195,18 +344,17 @@ void ElementScene::drawForeground(QPainter *p, const QRectF &rect) {
}
/**
* @brief ElementScene::setEventInterface
* Set a new event interface
* @param interface
*/
void ElementScene::setEventInterface(ESEventInterface *interface) {
if (m_event_interface) {
delete m_event_interface;
//We must to re-init because previous interface
//Reset his own init when deleted
interface->init();
A partir d'un evenement souris, cette methode regarde si la touche shift est
enfoncee ou non. Si oui, elle laisse le comportement en cours (cercle,
texte, polygone, ...). Si non, elle repasse en mode normal / selection.
@param event objet decrivant l'evenement souris
*/
void ElementScene::endCurrentBehavior(const QGraphicsSceneMouseEvent *event) {
if (!(event -> modifiers() & Qt::ShiftModifier)) {
// la touche Shift n'est pas enfoncee : on demande le mode normal
behavior = Normal;
emit(needNormalMode());
}
m_event_interface = interface;
}
/**
@@ -270,6 +418,7 @@ const QDomDocument ElementScene::toXml(bool all_parts) {
root.setAttribute("hotspot_y", QString("%1").arg(-(qRound(size.y() - (ymargin/2)))));
root.setAttribute("orientation", "dyyy"); //we keep the orientation for compatibility with previous version of qet
root.setAttribute("version", QET::version);
root.setAttribute("ic", "true"); //we keep the internal connection for compatibility with previous version of qet
root.setAttribute("link_type", m_elmt_type);
// noms de l'element
@@ -458,15 +607,19 @@ void ElementScene::copy() {
last_copied_ = clipboard_content;
}
/**
Gere le fait de coller le contenu du presse-papier = l'importer dans le
presse-papier a une position donnee.
*/
void ElementScene::paste() {
}
void ElementScene::contextMenu(QContextMenuEvent *event) {
if (behavior == ElementScene::Normal)
element_editor -> contextMenu(event);
}
QETElementEditor* ElementScene::editor() const {
return element_editor;
}
/**
Selectionne une liste de parties
@param content liste des parties a selectionner
@@ -944,10 +1097,19 @@ void ElementScene::initPasteArea() {
@param point une reference vers un QPointF. Cet objet sera modifie.
*/
QPointF ElementScene::snapToGrid(QPointF point) {
void ElementScene::snapToGrid(QPointF &point) {
point.rx() = qRound(point.x() / x_grid) * x_grid;
point.ry() = qRound(point.y() / y_grid) * y_grid;
return point;
}
/**
@param e Evenement souris
@return true s'il faut utiliser le snap-to-grid
Typiquement, cette methode retourne true si l'evenement souris se produit
sans la touche Ctrl enfoncee.
*/
bool ElementScene::mustSnapToGrid(QGraphicsSceneMouseEvent *e) {
return(!(e -> modifiers() & Qt::ControlModifier));
}
/**

View File

@@ -23,13 +23,15 @@
#include "qgimanager.h"
#include "elementcontent.h"
#include "diagramcontext.h"
class CustomElementPart;
class ElementEditionCommand;
class ElementPrimitiveDecorator;
class QETElementEditor;
class ESEventInterface;
class QKeyEvent;
class PartLine;
class PartRectangle;
class PartEllipse;
class PartPolygon;
class PartArc;
/**
This class is the canvas allowing the visual edition of an electrial element.
It displays the various primitives composing the drawing of the element, the
@@ -41,7 +43,7 @@ class ElementScene : public QGraphicsScene {
// enum
public:
enum Behavior { Normal, PasteArea };
enum Behavior { Normal, Line, Rectangle, Circle, Ellipse, Polygon, Text, Terminal, Arc, TextField, PasteArea };
enum ItemOption {
SortByZValue = 1,
IncludeTerminals = 2,
@@ -50,7 +52,7 @@ class ElementScene : public QGraphicsScene {
NonSelected = 16,
SelectedOrNot = 24
};
Q_DECLARE_FLAGS(ItemOptions, ItemOption)
Q_DECLARE_FLAGS(ItemOptions, ItemOption);
// constructors, destructor
public:
@@ -81,10 +83,15 @@ class ElementScene : public QGraphicsScene {
*/
QPointF fsi_pos;
QPointF moving_press_pos;
bool moving_parts_;
/// Variables related to drawing
ESEventInterface *m_event_interface;
Behavior behavior;
PartLine *current_line;
PartRectangle *current_rectangle;
PartEllipse *current_ellipse;
PartPolygon *current_polygon;
PartArc *current_arc;
QETElementEditor *element_editor;
/// Variables to manage the paste area on the scene
@@ -104,10 +111,10 @@ class ElementScene : public QGraphicsScene {
// methods
public:
void setEventInterface (ESEventInterface *interface);
QPointF snapToGrid(QPointF point);
void setNames(const NamesList &);
NamesList names() const;
bool internalConnections();
void setInternalConnections(bool);
QString informations() const;
void setInformations(const QString &);
QString elementType () const {return m_elmt_type;}
@@ -131,17 +138,15 @@ class ElementScene : public QGraphicsScene {
bool wasCopiedFromThisElement(const QString &);
void cut();
void copy();
void paste();
void contextMenu (QContextMenuEvent *event);
QETElementEditor* editor() const;
protected:
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *);
virtual void mousePressEvent (QGraphicsSceneMouseEvent *);
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *);
virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event);
virtual void keyPressEvent (QKeyEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *);
virtual void mousePressEvent(QGraphicsSceneMouseEvent *);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
virtual void drawForeground(QPainter *, const QRectF &);
virtual void endCurrentBehavior(const QGraphicsSceneMouseEvent *);
private:
QRectF elementContentBoundingRect(const ElementContent &) const;
@@ -151,11 +156,23 @@ class ElementScene : public QGraphicsScene {
ElementContent addContentAtPos(const ElementContent &, const QPointF &, QString * = 0);
void addPrimitive(QGraphicsItem *);
void initPasteArea();
void snapToGrid(QPointF &);
bool mustSnapToGrid(QGraphicsSceneMouseEvent *);
static bool zValueLessThan(QGraphicsItem *, QGraphicsItem *);
QMutex *decorator_lock_;
void centerElementToOrigine();
public slots:
void slot_move();
void slot_addLine();
void slot_addRectangle();
void slot_addCircle();
void slot_addEllipse();
void slot_addPolygon();
void slot_addText();
void slot_addArc();
void slot_addTerminal();
void slot_addTextField();
void slot_select(const ElementContent &);
void slot_selectAll();
void slot_deselectAll();
@@ -172,6 +189,11 @@ class ElementScene : public QGraphicsScene {
void stackAction(ElementEditionCommand *);
signals:
/**
Signal emitted when the scene requires the element editor to switch back to
normal mode.
*/
void needNormalMode();
/// Signal emitted after one or several parts were added
void partsAdded();
/// Signal emitted after one or several parts were removed

View File

@@ -18,7 +18,6 @@
#include "elementview.h"
#include "qetelementeditor.h"
#include "editorcommands.h"
#include "qetapp.h"
/**
Constructeur
@param scene ElementScene visualisee par cette ElementView
@@ -29,7 +28,6 @@ ElementView::ElementView(ElementScene *scene, QWidget *parent) :
scene_(scene),
offset_paste_count_(0)
{
grabGesture(Qt::PinchGesture);
setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
setInteractive(true);
setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
@@ -37,6 +35,7 @@ ElementView::ElementView(ElementScene *scene, QWidget *parent) :
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
zoomReset();
connect(scene_, SIGNAL(pasteAreaDefined(const QRectF &)), this, SLOT(pasteAreaDefined(const QRectF &)));
connect(scene_, SIGNAL(partsAdded()), this, SLOT(adjustSceneRect()));
connect(scene_, SIGNAL(needZoomFit()), this, SLOT(zoomFit()));
}
@@ -114,20 +113,6 @@ void ElementView::zoomOut() {
scale(0.75, 0.75);
}
/**
Agrandit le schema avec le trackpad
*/
void ElementView::zoomInSlowly() {
scale(1.02, 1.02);
}
/**
Retrecit le schema avec le trackpad
*/
void ElementView::zoomOutSlowly() {
scale(0.98, 0.98);
}
/**
Agrandit ou rectrecit le schema de facon a ce que tous les elements du
schema soient visibles a l'ecran. S'il n'y a aucun element sur le schema,
@@ -154,8 +139,8 @@ void ElementView::zoomReset() {
*/
void ElementView::adjustSceneRect() {
QRectF esgr = scene_ -> elementSceneGeometricRect();
QRectF vpbr = mapToScene(this -> viewport()->rect()).boundingRect();
QRectF new_scene_rect = vpbr.adjusted(-vpbr.width()/4, -vpbr.height()/4, vpbr.width()/4, vpbr.height()/4);
QRectF vpbr = mapToScene(this -> viewport() -> rect()).boundingRect();
QRectF new_scene_rect = vpbr.adjusted(-vpbr.height()/4, -vpbr.width()/4, vpbr.height()/4, vpbr.width()/4);
setSceneRect(new_scene_rect.united(esgr));
}
@@ -398,67 +383,26 @@ void ElementView::mouseReleaseEvent(QMouseEvent *e) {
}
/**
* @brief ElementView::gestures
* @return
*/
bool ElementView::gestures() const {
return(QETApp::settings().value("diagramview/gestures", false).toBool());
}
/**
* @brief ElementView::wheelEvent
* @param e
*/
Gere les actions liees a la rollette de la souris
@param e QWheelEvent decrivant l'evenement rollette
*/
void ElementView::wheelEvent(QWheelEvent *e) {
//Zoom and scrolling
if ( gestures() ) {
if (e -> modifiers() & Qt::ControlModifier)
e -> delta() > 0 ? zoomInSlowly() : zoomOutSlowly();
else
QGraphicsView::wheelEvent(e);
} else {
e -> delta() > 0 ? zoomIn(): zoomOut();
if (e->buttons() != Qt::MidButton) {
if (!(e -> modifiers() & Qt::ControlModifier)) {
if (e -> delta() > 0){
zoomIn();
}
else{
zoomOut();
}
}
else {
QAbstractScrollArea::wheelEvent(e);
}
}
}
/**
Gere les evenements de la ElementView
@param e Evenement
*/
bool ElementView::event(QEvent *e) {
// By default touch events are converted to mouse events. So
// after this event we will get a mouse event also but we want
// to handle touch events as gestures only. So we need this safeguard
// to block mouse events that are actually generated from touch.
if (e->type() == QEvent::Gesture)
return gestureEvent(static_cast<QGestureEvent *>(e));
return(QGraphicsView::event(e));
}
/**
* Utilise le pincement du trackpad pour zoomer
* @brief ElementView::gestureEvent
* @param event
* @return
*/
bool ElementView::gestureEvent(QGestureEvent *event){
if (QGesture *gesture = event->gesture(Qt::PinchGesture)) {
QPinchGesture *pinch = static_cast<QPinchGesture *>(gesture);
if (pinch->changeFlags() & QPinchGesture::ScaleFactorChanged){
qreal value = gesture->property("scaleFactor").toReal();
if (value > 1){
zoomInSlowly();
}else{
zoomOutSlowly();
}
}
}
return true;
}
/**
Dessine l'arriere-plan de l'editeur, cad la grille.
@param p Le QPainter a utiliser pour dessiner
@@ -481,32 +425,29 @@ void ElementView::drawBackground(QPainter *p, const QRectF &r) {
qreal zoom_factor = matrix().m11();
// choisit la granularite de la grille en fonction du zoom en cours
int drawn_x_grid = 1;//scene_ -> xGrid();
int drawn_y_grid = 1;//scene_ -> yGrid();
int drawn_x_grid = scene_ -> xGrid();
int drawn_y_grid = scene_ -> yGrid();
bool draw_grid = true;
bool draw_cross = false;
if (zoom_factor < (4.0/3.0)) { //< no grid
if (zoom_factor < (4.0/3.0)) {
// pas de grille du tout
draw_grid = false;
} else if (zoom_factor < 4.0) { //< grid 10*10
} else if (zoom_factor < 4.0) {
// grille a 10 px
drawn_x_grid *= 10;
drawn_y_grid *= 10;
}else if (zoom_factor < 8.0) { //< grid 5*5
drawn_x_grid *= 5;
drawn_y_grid *= 5;
draw_cross = true;
} else if (zoom_factor < 10.0) { //< grid 2*2
} else if (zoom_factor < 6.0) {
// grille a 2 px (avec croix)
drawn_x_grid *= 2;
drawn_y_grid *= 2;
draw_cross = true;
} else { //< grid 1*1
} else {
// grille a 1 px (avec croix)
draw_cross = true;
}
scene_->setGrid(drawn_x_grid, drawn_y_grid);
if (draw_grid) {
// draw the dot of the grid
// dessine les points de la grille
p -> setPen(Qt::black);
p -> setBrush(Qt::NoBrush);
qreal limite_x = r.x() + r.width();

View File

@@ -47,8 +47,6 @@ class ElementView : public QGraphicsView {
void mousePressEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *);
bool gestureEvent(QGestureEvent *event);
bool event(QEvent *event);
void wheelEvent(QWheelEvent *);
virtual void drawBackground(QPainter *, const QRectF &);
@@ -60,8 +58,6 @@ class ElementView : public QGraphicsView {
void setSelectionMode();
void zoomIn();
void zoomOut();
void zoomInSlowly();
void zoomOutSlowly();
void zoomFit();
void zoomReset();
void adjustSceneRect();
@@ -90,7 +86,6 @@ class ElementView : public QGraphicsView {
QPointF start_top_left_corner_;
QPointF reference_view_;
QPointF center_view_;
bool gestures() const;
bool is_moving_view_; ///< Indicate whether the visualisation mode has been enabled due to mouse/keyboard interactions
};
#endif

View File

@@ -1,189 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include "elementscene.h"
#include "partarc.h"
#include "editorcommands.h"
#include "eseventaddarc.h"
/**
* @brief ESEventAddArc::ESEventAddArc
* @param scene
*/
ESEventAddArc::ESEventAddArc(ElementScene *scene) :
ESEventInterface(scene),
m_arc(nullptr),
m_inverted(false)
{}
/**
* @brief ESEventAddArc::~ESEventAddArc
*/
ESEventAddArc::~ESEventAddArc() {
if (m_running || m_abort)
delete m_arc;
}
/**
* @brief ESEventAddPolygon::mousePressEvent
* @param event
* @return
*/
bool ESEventAddArc::mousePressEvent(QGraphicsSceneMouseEvent *event) {
if (event -> button() == Qt::LeftButton) {
if(!m_running) m_running = true;
QPointF pos = m_scene->snapToGrid(event -> scenePos());
//create new arc
if (!m_arc) {
m_arc = new PartArc(m_editor, 0, m_scene);
m_arc -> setRect(QRectF(pos, pos));
m_arc -> setAngle(90);
m_arc -> setProperty("antialias", true);
m_origin = pos;
return true;
}
//Add arc to scene
m_arc -> setRect(m_arc->rect().normalized());
m_scene -> undoStack().push(new AddPartCommand(QObject::tr("Arc"), m_scene, m_arc));
//Set m_arc to nullptr for create new ellipse at next mouse press
m_arc = nullptr;
return true;
}
return false;
}
/**
* @brief ESEventAddArc::mouseMoveEvent
* @param event
* @return
*/
bool ESEventAddArc::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
updateHelpCross(event -> scenePos());
if (!m_arc) return false;
m_mouse_pos = m_scene -> snapToGrid(event -> scenePos());
updateArc();
return true;
}
/**
* @brief ESEventAddArc::mouseReleaseEvent
* @param event
* @return
*/
bool ESEventAddArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
if (event -> button() == Qt::RightButton) {
if (m_arc) {delete m_arc; m_arc = nullptr;}
else {m_running = false;}
return true;
}
return false;
}
/**
* @brief ESEventAddArc::keyPressEvent
* @param event
* @return
*/
bool ESEventAddArc::keyPressEvent(QKeyEvent *event) {
if (m_arc && event->key() == Qt::Key_Space) {
m_inverted = m_inverted ? false : true;
updateArc();
return true;
}
return (ESEventInterface::keyPressEvent(event));
}
/**
* @brief ESEventAddArc::updateArc
* Redraw the arc with curent value
*/
void ESEventAddArc::updateArc() {
qreal width = (m_mouse_pos.x() - m_origin.x())*2;
if (width < 0) width *= -1;
qreal height = (m_mouse_pos.y() - m_origin.y())*2;
if (height < 0) height *= -1;
QPointF pos_ = m_origin;
//Draw arc inverted
if (m_inverted) {
//Adjust the start angle to be snapped at the origin point of draw
if (m_mouse_pos.y() > m_origin.y()) {
if (m_mouse_pos.x() > m_origin.x()) {
pos_.ry() -= height/2;
m_arc->setStartAngle(180);
}
else {
pos_.rx() -= width/2;
m_arc->setStartAngle(90);
}
}
else {
if (m_mouse_pos.x() > m_origin.x()) {
pos_.ry() -= height;
pos_.rx() -= width/2;
m_arc->setStartAngle(270);
}
else {
pos_.rx() -= width;
pos_.ry() -= height/2;
m_arc->setStartAngle(0);
}
}
}
//Draw arc non inverted
else {
//Adjust the start angle to be snapped at the origin point of draw
if (m_mouse_pos.y() > m_origin.y()) {
if (m_mouse_pos.x() > m_origin.x()) {
pos_.rx() -= width/2;
m_arc->setStartAngle(0);
}
else {
pos_.rx() -= width;
pos_.ry() -= height/2;
m_arc->setStartAngle(270);
}
}
else {
if (m_mouse_pos.x() > m_origin.x()) {
pos_.ry() -= height/2;
m_arc->setStartAngle(90);
}
else {
pos_.rx() -= width/2;
pos_.ry() -= height;
m_arc->setStartAngle(180);
}
}
}
m_arc -> setRect(QRectF(pos_, QSizeF(width, height)));
}

View File

@@ -1,51 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ESEVENTADDARC_H
#define ESEVENTADDARC_H
#include "eseventinterface.h"
class ElementScene;
class PartArc;
class QGraphicsSceneMouseEvent;
/**
* @brief The ESEventAddArc class
* This ESEvent manage creation of arc in an ElementScene
*/
class ESEventAddArc : public ESEventInterface
{
public:
ESEventAddArc(ElementScene *scene);
virtual ~ESEventAddArc();
virtual bool mousePressEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseMoveEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
virtual bool keyPressEvent (QKeyEvent *event);
private:
void updateArc ();
private:
PartArc *m_arc;
QPointF m_origin, m_mouse_pos;
bool m_inverted;
};
#endif // ESEVENTADDARC_H

View File

@@ -1,106 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include "eseventaddellipse.h"
#include "partellipse.h"
#include "editorcommands.h"
#include "elementscene.h"
/**
* @brief ESEventAddEllipse::ESEventAddEllipse
* @param scene
*/
ESEventAddEllipse::ESEventAddEllipse(ElementScene *scene) :
ESEventInterface(scene),
m_ellipse(nullptr)
{}
/**
* @brief ESEventAddEllipse::~ESEventAddEllipse
*/
ESEventAddEllipse::~ESEventAddEllipse() {
if (m_running || m_abort){
delete m_ellipse;
}
}
/**
* @brief ESEventAddEllipse::mousePressEvent
* @param event
* @return
*/
bool ESEventAddEllipse::mousePressEvent(QGraphicsSceneMouseEvent *event) {
if (event -> button() == Qt::LeftButton) {
if(!m_running) m_running = true;
QPointF pos = m_scene->snapToGrid(event -> scenePos());
//create new ellpise
if (!m_ellipse) {
m_ellipse = new PartEllipse(m_editor, 0, m_scene);
m_ellipse -> setRect(QRectF(pos, pos));
m_origin = pos;
return true;
}
//Add ellipse to scene
m_ellipse -> setRect(m_ellipse -> rect().normalized());
m_scene -> undoStack().push(new AddPartCommand(QObject::tr("Ellipse"), m_scene, m_ellipse));
//Set m_ellipse to nullptr for create new ellipse at next mouse press
m_ellipse = nullptr;
return true;
}
return false;
}
/**
* @brief ESEventAddRect::mouseMoveEvent
* @param event
* @return
*/
bool ESEventAddEllipse::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
updateHelpCross(event -> scenePos());
if (!m_ellipse) return false;
QPointF mouse_pos = m_scene -> snapToGrid(event -> scenePos());
qreal width = (mouse_pos.x() - m_origin.x())*2;
qreal height = (mouse_pos.y() - m_origin.y())*2;
QPointF pos(m_origin.x() - width/2,
m_origin.y() - height/2);
m_ellipse -> setRect(QRectF(pos, QSizeF(width, height)));
return true;
}
/**
* @brief ESEventAddEllipse::mouseReleaseEvent
* @param event
* @return
*/
bool ESEventAddEllipse::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
if (event -> button() == Qt::RightButton) {
if (m_ellipse) {delete m_ellipse; m_ellipse = nullptr;}
else {m_running = false;}
return true;
}
return false;
}

View File

@@ -1,47 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ESEVENTADDELLIPSE_H
#define ESEVENTADDELLIPSE_H
#include "eseventinterface.h"
#include <QPointF>
class ElementScene;
class PartEllipse;
class QGraphicsSceneMouseEvent;
/**
* @brief The ESEventAddEllipse class
* This ESEvent manage creation of ellpise in an ElementScene
*/
class ESEventAddEllipse : public ESEventInterface
{
public:
ESEventAddEllipse(ElementScene *scene);
~ESEventAddEllipse();
virtual bool mousePressEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseMoveEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
private:
PartEllipse *m_ellipse;
QPointF m_origin;
};
#endif // ESEVENTADDELLIPSE_H

View File

@@ -1,102 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QGraphicsSceneMouseEvent>
#include <QObject>
#include "eseventaddline.h"
#include "elementscene.h"
#include "qetelementeditor.h"
#include "partline.h"
#include "editorcommands.h"
/**
* @brief ESEventAddLine::ESEventAddLine
* Constructor
* @param scene : scene where we operate this action
*/
ESEventAddLine::ESEventAddLine(ElementScene *scene) :
ESEventInterface (scene),
m_line (nullptr)
{}
/**
* @brief ESEventAddLine::~ESEventAddLine
* destructor
*/
ESEventAddLine::~ESEventAddLine() {
if (m_running || m_abort)
delete m_line;
}
/**
* @brief ESEventAddLine::mousePressEvent
* @param event
* @return
*/
bool ESEventAddLine::mousePressEvent(QGraphicsSceneMouseEvent *event) {
if (event -> button() == Qt::LeftButton) {
if (! m_running) m_running = true;
QPointF pos = m_scene -> snapToGrid(event -> scenePos());
//Create new line
if (!m_line) {
m_line = new PartLine(m_editor, 0, m_scene);
m_line -> setLine(QLineF(pos, pos));
return true;
}
//Add new line to scene
m_scene -> undoStack().push(new AddPartCommand(QObject::tr("ligne"), m_scene, m_line));
//Set m_line to nullptr for create new line at next mouse press
m_line = nullptr;
return true;
}
return false;
}
/**
* @brief ESEventAddLine::mouseMoveEvent
* @param event
* @return
*/
bool ESEventAddLine::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
updateHelpCross (event -> scenePos());
if (!m_line) return false;
m_line -> setP2(m_scene -> snapToGrid(event -> scenePos()));
return true;
}
/**
* @brief ESEventAddLine::mouseReleaseEvent
* @param event
* @return
*/
bool ESEventAddLine::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
if (event -> button() == Qt::RightButton) {
if (m_line) {delete m_line; m_line = nullptr;}
else {m_running = false;}
return true;
}
return false;
}

View File

@@ -1,45 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ESEVENTADDLINE_H
#define ESEVENTADDLINE_H
#include "eseventinterface.h"
class ElementScene;
class PartLine;
class QGraphicsSceneMouseEvent;
/**
* @brief The ESEventAddLine class
* This ESEvent manage creation of line in a ElementScene
*/
class ESEventAddLine : public ESEventInterface
{
public:
ESEventAddLine(ElementScene *scene);
virtual ~ESEventAddLine();
virtual bool mousePressEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseMoveEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
private:
PartLine *m_line;
};
#endif // ESEVENTADDLINE_H

View File

@@ -1,117 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include "eseventaddpolygon.h"
#include "elementscene.h"
#include "partpolygon.h"
#include "editorcommands.h"
/**
* @brief ESEventAddPolygon::ESEventAddPolygon
* @param scene
*/
ESEventAddPolygon::ESEventAddPolygon(ElementScene *scene) :
ESEventInterface(scene),
m_polygon(nullptr)
{}
/**
* @brief ESEventAddPolygon::~ESEventAddPolygon
*/
ESEventAddPolygon::~ESEventAddPolygon() {
if (m_running || m_abort)
delete m_polygon;
}
/**
* @brief ESEventAddPolygon::mousePressEvent
* @param event
* @return
*/
bool ESEventAddPolygon::mousePressEvent(QGraphicsSceneMouseEvent *event) {
if (event -> button() == Qt::LeftButton) {
if(!m_running) m_running = true;
QPointF pos = m_scene->snapToGrid(event -> scenePos());
//create new polygon
if (!m_polygon) {
m_polygon = new PartPolygon(m_editor, 0, m_scene);
m_polygon -> addPoint(pos);
}
m_polygon -> addPoint(pos);
return true;
}
return false;
}
/**
* @brief ESEventAddPolygon::mouseMoveEvent
* @param event
* @return
*/
bool ESEventAddPolygon::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
updateHelpCross(event -> scenePos());
if (!m_polygon) return false;
m_polygon -> setLastPoint(m_scene -> snapToGrid(event -> scenePos()));
return true;
}
/**
* @brief ESEventAddPolygon::mouseReleaseEvent
* @param event
* @return
*/
bool ESEventAddPolygon::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
if (event -> button() == Qt::RightButton) {
if (m_polygon) {
m_polygon -> removeLastPoint();
if (m_polygon -> polygon().size() > 1)
{ m_polygon -> setLastPoint(m_scene -> snapToGrid(event -> scenePos())); }
else
{ delete m_polygon; m_polygon = nullptr; }
}
else
{ m_running = false; }
return true;
}
return false;
}
/**
* @brief ESEventAddPolygon::mouseDoubleClickEvent
* @param event
* @return
*/
bool ESEventAddPolygon::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {
if (event -> button() == Qt::LeftButton) {
if (m_polygon) {
m_polygon -> addPoint(m_scene -> snapToGrid(event -> scenePos()));
m_scene -> undoStack().push(new AddPartCommand(QObject::tr("Polygone"), m_scene, m_polygon));
//Set m_polygon to nullptr for create new polygon at next mouse press
m_polygon = nullptr;
return true;
}
}
return false;
}

View File

@@ -1,46 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ESEVENTADDPOLYGON_H
#define ESEVENTADDPOLYGON_H
#include "eseventinterface.h"
class ElementScene;
class PartPolygon;
class QGraphicsSceneMouseEvent;
/**
* @brief The ESEventAddPolygon class
* This ESEvent manage creation of polygon in an ElementScene
*/
class ESEventAddPolygon : public ESEventInterface
{
public:
ESEventAddPolygon(ElementScene *scene);
virtual ~ESEventAddPolygon();
virtual bool mousePressEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseMoveEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event);
private:
PartPolygon *m_polygon;
};
#endif // ESEVENTADDPOLYGON_H

View File

@@ -1,97 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include "eseventaddrect.h"
#include "elementscene.h"
#include "partrectangle.h"
#include "editorcommands.h"
/**
* @brief ESEventAddRect::ESEventAddRect
* @param scene
*/
ESEventAddRect::ESEventAddRect(ElementScene *scene) :
ESEventInterface(scene),
m_rect(nullptr)
{}
/**
* @brief ESEventAddRect::~ESEventAddRect
*/
ESEventAddRect::~ESEventAddRect() {
if (m_running || m_abort)
delete m_rect;
}
/**
* @brief ESEventAddRect::mousePressEvent
* @param event
* @return
*/
bool ESEventAddRect::mousePressEvent(QGraphicsSceneMouseEvent *event) {
if (event -> button() == Qt::LeftButton) {
if(!m_running) m_running = true;
QPointF pos = m_scene->snapToGrid(event -> scenePos());
//create new rectangle
if (!m_rect) {
m_rect = new PartRectangle(m_editor, 0, m_scene);
m_rect -> setRect(QRectF(pos, pos));
return true;
}
//Add rectangle to scene
m_rect -> setRect(m_rect -> rect().normalized());
m_scene -> undoStack().push(new AddPartCommand(QObject::tr("Rectangle"), m_scene, m_rect));
//Set m_rect to nullptr for create new rectangle at next mouse press
m_rect = nullptr;
return true;
}
return false;
}
/**
* @brief ESEventAddRect::mouseMoveEvent
* @param event
* @return
*/
bool ESEventAddRect::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
updateHelpCross(event -> scenePos());
if (!m_rect) return false;
QRectF rect(m_rect -> rect().topLeft(), m_scene->snapToGrid(event -> scenePos()));
m_rect -> setRect(rect);
return true;
}
/**
* @brief ESEventAddRect::mouseReleaseEvent
* @param event
* @return
*/
bool ESEventAddRect::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
if (event -> button() == Qt::RightButton) {
if (m_rect) {delete m_rect; m_rect = nullptr;}
else {m_running = false;}
return true;
}
return false;
}

View File

@@ -1,41 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ESEVENTADDRECT_H
#define ESEVENTADDRECT_H
#include "eseventinterface.h"
class ElementScene;
class PartRectangle;
class QGraphicsSceneMouseEvent;
class ESEventAddRect : public ESEventInterface
{
public:
ESEventAddRect(ElementScene *scene);
virtual ~ESEventAddRect();
virtual bool mousePressEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseMoveEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
private:
PartRectangle *m_rect;
};
#endif // ESEVENTADDRECT_H

View File

@@ -1,107 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include "partterminal.h"
#include "editorcommands.h"
#include "elementscene.h"
#include "eseventaddterminal.h"
/**
* @brief ESEventAddTerminal::ESEventAddTerminal
* @param scene
*/
ESEventAddTerminal::ESEventAddTerminal(ElementScene *scene) :
ESEventInterface(scene)
{
m_terminal = new PartTerminal(m_editor, 0, m_scene);
m_running = true;
}
/**
* @brief ESEventAddTerminal::~ESEventAddTerminal
*/
ESEventAddTerminal::~ESEventAddTerminal() {
delete m_terminal;
}
/**
* @brief ESEventAddTerminal::mouseMoveEvent
* @param event
* @return
*/
bool ESEventAddTerminal::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
QPointF pos = m_scene -> snapToGrid(event -> scenePos());
updateHelpCross(pos);
m_terminal -> setPos(pos);
return true;
}
/**
* @brief ESEventAddTerminal::mouseReleaseEvent
* @param event
* @return
*/
bool ESEventAddTerminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
if (event -> button() == Qt::LeftButton) {
m_scene -> undoStack().push(new AddPartCommand(QObject::tr("Borne"), m_scene, m_terminal));
//Set new terminal with same rotation
Qet::Orientation ori = m_terminal -> orientation();
m_terminal = new PartTerminal(m_editor, 0, m_scene);
m_terminal -> setOrientation(ori);
m_terminal -> setPos(m_scene -> snapToGrid(event -> scenePos()));
return true;
}
else if (event -> button() == Qt::RightButton) {
m_running = false;
return true;
}
return false;
}
/**
* @brief ESEventAddTerminal::keyPressEvent
* @param event
* @return
*/
bool ESEventAddTerminal::keyPressEvent(QKeyEvent *event) {
if (event -> key() == Qt::Key_Space) {
switch (m_terminal->orientation()) {
case Qet::North :
m_terminal -> setOrientation(Qet::East);
break;
case Qet::East :
m_terminal -> setOrientation(Qet::South);
break;
case Qet::South :
m_terminal -> setOrientation(Qet::West);
break;
case Qet::West :
m_terminal -> setOrientation(Qet::North);
break;
default :
m_terminal -> setOrientation(Qet::North);
break;
}
return true;
}
return (ESEventInterface::keyPressEvent(event));
}

View File

@@ -1,45 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ESEVENTADDTERMINAL_H
#define ESEVENTADDTERMINAL_H
#include "eseventinterface.h"
class ElementScene;
class PartTerminal;
class QGraphicsSceneMouseEvent;
/**
* @brief The ESEventAddTerminal class
* This ESEvent manage creation of terminal in an ElementScene
*/
class ESEventAddTerminal : public ESEventInterface
{
public:
ESEventAddTerminal(ElementScene *scene);
virtual ~ESEventAddTerminal();
virtual bool mouseMoveEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
virtual bool keyPressEvent (QKeyEvent *event);
private:
PartTerminal *m_terminal;
};
#endif // ESEVENTADDTERMINAL_H

View File

@@ -1,76 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include "eseventaddtext.h"
#include "parttext.h"
#include "editorcommands.h"
#include "elementscene.h"
/**
* @brief ESEventAddText::ESEventAddText
* @param scene
*/
ESEventAddText::ESEventAddText(ElementScene *scene) :
ESEventInterface(scene)
{
m_text = new PartText(m_editor, 0, m_scene);
m_running = true;
}
/**
* @brief ESEventAddText::~ESEventAddText
*/
ESEventAddText::~ESEventAddText() {
delete m_text;
}
/**
* @brief ESEventAddText::mouseMoveEvent
* @param event
* @return
*/
bool ESEventAddText::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
QPointF pos = m_scene -> snapToGrid(event -> scenePos());
updateHelpCross(pos);
m_text->setPos(pos);
return true;
}
/**
* @brief ESEventAddText::mouseReleaseEvent
* @param event
* @return
*/
bool ESEventAddText::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
if (event->button() == Qt::LeftButton) {
m_scene -> undoStack().push(new AddPartCommand(QObject::tr("Texte"), m_scene, m_text));
//Set new text
m_text = new PartText(m_editor, 0, m_scene);
m_text -> setPos(m_scene -> snapToGrid(event -> scenePos()));
return true;
}
else if (event->button() == Qt::RightButton) {
m_running = false;
return true;
}
return false;
}

View File

@@ -1,44 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ESEVENTADDTEXT_H
#define ESEVENTADDTEXT_H
#include "eseventinterface.h"
class ElementScene;
class PartText;
class QGraphicsSceneMouseEvent;
/**
* @brief The ESEventAddText class
* This ESEvent manage creation of text in an ElementScene
*/
class ESEventAddText : public ESEventInterface
{
public:
ESEventAddText(ElementScene *scene);
virtual ~ESEventAddText();
virtual bool mouseMoveEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
private:
PartText *m_text;
};
#endif // ESEVENTADDTEXT_H

View File

@@ -1,76 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include "parttextfield.h"
#include "editorcommands.h"
#include "elementscene.h"
#include "eseventaddtextfield.h"
/**
* @brief ESEventAddTextField::ESEventAddTextField
* @param scene
*/
ESEventAddTextField::ESEventAddTextField(ElementScene *scene) :
ESEventInterface(scene)
{
m_text = new PartTextField(m_editor, 0, m_scene);
m_running = true;
}
/**
* @brief ESEventAddTextField::~ESEventAddTextField
*/
ESEventAddTextField::~ESEventAddTextField() {
delete m_text;
}
/**
* @brief ESEventAddTextField::ESEventAddTextField
* @param event
* @return
*/
bool ESEventAddTextField::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
QPointF pos = m_scene -> snapToGrid(event -> scenePos());
updateHelpCross(pos);
m_text->setPos(pos);
return true;
}
/**
* @brief ESEventAddTextField::ESEventAddTextField
* @param event
* @return
*/
bool ESEventAddTextField::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
if (event->button() == Qt::LeftButton) {
m_scene -> undoStack().push(new AddPartCommand(QObject::tr("Champ texte"), m_scene, m_text));
//Set new text
m_text = new PartTextField(m_editor, 0, m_scene);
m_text -> setPos(m_scene -> snapToGrid(event -> scenePos()));
return true;
}
else if (event->button() == Qt::RightButton) {
m_running = false;
return true;
}
return false;
}

View File

@@ -1,44 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ESEVENTADDTEXTFIELD_H
#define ESEVENTADDTEXTFIELD_H
#include "eseventinterface.h"
class ElementScene;
class PartTextField;
class QGraphicsSceneMouseEvent;
/**
* @brief The ESEventAddTextField class
* This ESEvent manage creation of text field in an ElementScene
*/
class ESEventAddTextField : public ESEventInterface
{
public:
ESEventAddTextField(ElementScene *scene);
virtual ~ESEventAddTextField();
virtual bool mouseMoveEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
private:
PartTextField *m_text;
};
#endif // ESEVENTADDTEXTFIELD_H

View File

@@ -1,125 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "eseventinterface.h"
#include "elementscene.h"
#include "qetelementeditor.h"
#include <QGraphicsSceneMouseEvent>
ESEventInterface::ESEventInterface(ElementScene *scene) :
m_scene (scene),
m_editor (scene->editor()),
m_help_horiz (nullptr),
m_help_verti (nullptr),
m_running (false),
m_abort (false)
{
init();
}
void ESEventInterface::init() {
foreach (QGraphicsView *qgv, m_scene->views())
qgv->setContextMenuPolicy(Qt::NoContextMenu);
m_editor->slot_setNoDragToView();
}
ESEventInterface::~ESEventInterface() {
delete m_help_horiz;
delete m_help_verti;
foreach (QGraphicsView *qgv, m_scene->views())
qgv->setContextMenuPolicy(Qt::DefaultContextMenu);
m_editor->slot_setRubberBandToView();
}
bool ESEventInterface::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {
Q_UNUSED (event);
return false;
}
bool ESEventInterface::mousePressEvent(QGraphicsSceneMouseEvent *event) {
Q_UNUSED (event);
return false;
}
bool ESEventInterface::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
Q_UNUSED (event);
return false;
}
bool ESEventInterface::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
Q_UNUSED (event);
return false;
}
bool ESEventInterface::wheelEvent(QGraphicsSceneWheelEvent *event) {
Q_UNUSED (event);
return false;
}
/**
* @brief ESEventInterface::keyPressEvent
* By default, press escape key abort the curent action
* @param event
* @return
*/
bool ESEventInterface::keyPressEvent(QKeyEvent *event) {
if (event->key() == Qt::Key_Escape) {
m_running = false;
m_abort = true;
return true;
}
return false;
}
bool ESEventInterface::KeyReleaseEvent(QKeyEvent *event) {
Q_UNUSED (event);
return false;
}
bool ESEventInterface::isRunning() const {
return m_running;
}
bool ESEventInterface::isFinish() const {
return !m_running;
}
void ESEventInterface::updateHelpCross(const QPointF &p) {
//If line isn't created yet, we create it.
if (!m_help_horiz || !m_help_verti) {
QPen pen;
pen.setColor(Qt::darkBlue);
if (!m_help_horiz) {
m_help_horiz = new QGraphicsLineItem(-10000, 0, 10000, 0, 0, m_scene);
m_help_horiz -> setPen(pen);
}
if (!m_help_verti) {
m_help_verti = new QGraphicsLineItem(0, -10000, 0, 10000, 0, m_scene);
m_help_verti -> setPen(pen);
}
}
//Update the position of the cross
QPointF point = m_scene -> snapToGrid(p);
m_help_horiz -> setY(point.y());
m_help_verti -> setX(point.x());
}

View File

@@ -1,57 +0,0 @@
/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ESEVENTINTERFACE_H
#define ESEVENTINTERFACE_H
class QGraphicsSceneMouseEvent;
class QGraphicsSceneWheelEvent;
class QKeyEvent;
class ElementScene;
class QETElementEditor;
class QGraphicsLineItem;
class QPointF;
class ESEventInterface
{
public:
ESEventInterface(ElementScene *scene);
virtual ~ESEventInterface();
void init();
virtual bool mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event);
virtual bool mousePressEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseMoveEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
virtual bool wheelEvent (QGraphicsSceneWheelEvent *event);
virtual bool keyPressEvent (QKeyEvent *event);
virtual bool KeyReleaseEvent (QKeyEvent *event);
virtual bool isRunning () const;
virtual bool isFinish () const;
protected:
void updateHelpCross (const QPointF &p);
protected:
ElementScene *m_scene;
QETElementEditor *m_editor;
QGraphicsLineItem *m_help_horiz, *m_help_verti;
bool m_running, m_abort;
};
#endif // ESEVENTINTERFACE_H

View File

@@ -223,15 +223,6 @@ void PartLine::setY1(qreal y1) {
setLine(QLineF(p, line().p2()));
}
/**
* @brief PartLine::setP1
* set first point to P1
* @param p1
*/
void PartLine::setP1(QPointF p1) {
setLine(QLineF(p1, line().p2()));
}
/**
* @brief PartLine::setX2
* set x of P2
@@ -254,15 +245,6 @@ void PartLine::setY2(qreal y2) {
setLine(QLineF(line().p1(), p));
}
/**
* @brief PartLine::setP2
* set second point to P2
* @param p2
*/
void PartLine::setP2(QPointF p2) {
setLine(QLineF(line().p1(), p2));
}
/**
Gere les changements intervenant sur cette partie
@param change Type de changement

View File

@@ -78,45 +78,30 @@ class PartLine : public CustomElementGraphicPart, public QGraphicsLineItem {
Q_PROPERTY(qreal x1 READ x1 WRITE setX1)
qreal x1() const {return sceneP1().x();}
void setX1(qreal x1);
// Y value of the first point
Q_PROPERTY(qreal y1 READ y1 WRITE setY1)
qreal y1() const {return sceneP1().y();}
void setY1(qreal y1);
//pos of firts point
Q_PROPERTY(QPointF p1 READ sceneP1 WRITE setP1)
void setP1 (QPointF p1);
// X value of the second point
Q_PROPERTY(qreal x2 READ x2 WRITE setX2)
qreal x2() const {return sceneP2().x();}
void setX2(qreal x2);
// Y value of the second point
Q_PROPERTY(qreal y2 READ y2 WRITE setY2)
qreal y2() const {return sceneP2().y();}
void setY2(qreal y2);
//pos of second point
Q_PROPERTY(QPointF p2 READ sceneP2 WRITE setP2)
void setP2 (QPointF p2);
// End type of the first point
Q_PROPERTY(Qet::EndType end1 READ firstEndType WRITE setFirstEndType)
Qet::EndType firstEndType() const {return first_end;}
void setFirstEndType(const Qet::EndType &et) {first_end = et;}
// End type of the second point
Q_PROPERTY(Qet::EndType end2 READ secondEndType WRITE setSecondEndType)
Qet::EndType secondEndType() const {return second_end;}
void setSecondEndType(const Qet::EndType &et) {second_end = et;}
// Size of end type of first point
Q_PROPERTY(qreal length1 READ firstEndLength WRITE setFirstEndLength)
qreal firstEndLength() const {return first_length;}
void setFirstEndLength(const qreal &l) {first_length = qMin(qAbs(l), line().length());}
// Size of end type of the second point
Q_PROPERTY(qreal length2 READ secondEndLength WRITE setSecondEndLength)
qreal secondEndLength() const {return second_length;}

View File

@@ -173,45 +173,6 @@ QET::ScalingMethod PartPolygon::preferredScalingMethod() const {
return(QET::RoundScaleRatios);
}
/**
* @brief PartPolygon::addPoint
* Add new point to polygon
* @param point
*/
void PartPolygon::addPoint(const QPointF &point) {
QPolygonF poly = polygon();
poly << point;
setPolygon(poly);
}
/**
* @brief PartPolygon::setLastPoint
* Set the last point of polygon to @point
* @param point
*/
void PartPolygon::setLastPoint(const QPointF &point) {
QPolygonF poly = polygon();
if (poly.size())
poly.pop_back();
poly << point;
setPolygon(poly);
}
/**
* @brief PartPolygon::removeLastPoint
* Remove the last point of polygon
*/
void PartPolygon::removeLastPoint() {
QPolygonF poly = polygon();
if (poly.size())
poly.pop_back();
setPolygon(poly);
}
/**
@return le rectangle delimitant cette partie.
*/

View File

@@ -58,10 +58,6 @@ class PartPolygon : public CustomElementGraphicPart, public QGraphicsPolygonItem
virtual void handleUserTransformation(const QRectF &, const QRectF &);
virtual QET::ScalingMethod preferredScalingMethod() const;
void addPoint (const QPointF &point);
void setLastPoint (const QPointF &point);
void removeLastPoint ();
///PROPERTY
// Closed (join the first and last point by a line)
Q_PROPERTY(bool closed READ isClosed WRITE setClosed)

View File

@@ -38,18 +38,10 @@
#include "terminaleditor.h"
#include "texteditor.h"
#include "textfieldeditor.h"
#include "partterminal.h"
#include "parttextfield.h"
#include "eseventaddline.h"
#include "eseventaddrect.h"
#include "eseventaddellipse.h"
#include "eseventaddpolygon.h"
#include "eseventaddarc.h"
#include "eseventaddtext.h"
#include "eseventaddtextfield.h"
#include "eseventaddterminal.h"
#include <QMessageBox>
/*
Nombre maximum de primitives affichees par la "liste des parties"
@@ -130,9 +122,8 @@ void QETElementEditor::setFileName(const QString &fn) {
}
/**
* @brief QETElementEditor::setupActions
* Create action used in Element editor
*/
Met en place les actions
*/
void QETElementEditor::setupActions() {
new_element = new QAction(QET::Icons::DocumentNew, tr("&Nouveau"), this);
open = new QAction(QET::Icons::DocumentOpen, tr("&Ouvrir"), this);
@@ -152,9 +143,36 @@ void QETElementEditor::setupActions() {
paste_from_elmt = new QAction(QET::Icons::Element, tr("un \351l\351ment"), this);
inv_select = new QAction( tr("Inverser la s\351lection"), this);
edit_delete = new QAction(QET::Icons::EditDelete, tr("&Supprimer"), this);
zoom_in = new QAction(QET::Icons::ZoomIn, tr("Zoom avant"), this);
zoom_out = new QAction(QET::Icons::ZoomOut, tr("Zoom arri\350re"), this);
zoom_fit = new QAction(QET::Icons::ZoomFitBest, tr("Zoom adapt\351"), this);
zoom_reset = new QAction(QET::Icons::ZoomOriginal, tr("Pas de zoom"), this);
edit_names = new QAction(QET::Icons::Names, tr("\311diter les noms"), this);
edit_author = new QAction(QET::Icons::UserInformations, tr("\311diter les informations sur l'auteur"), this);
m_edit_properties = new QAction(QET::Icons::ElementEdit, tr("\311diter les propri\351t\351es de l'\351l\351ment"), this);
edit_raise = new QAction(QET::Icons::Raise, tr("Rapprocher"), this);
edit_lower = new QAction(QET::Icons::Lower, tr("\311loigner"), this);
edit_backward = new QAction(QET::Icons::SendBackward, tr("Envoyer au fond"), this);
edit_forward = new QAction(QET::Icons::BringForward, tr("Amener au premier plan"), this);
move = new QAction(QET::Icons::PartSelect, tr("D\351placer un objet"), this);
add_line = new QAction(QET::Icons::PartLine, tr("Ajouter une ligne"), this);
add_rectangle = new QAction(QET::Icons::PartRectangle, tr("Ajouter un rectangle"), this);
add_ellipse = new QAction(QET::Icons::PartEllipse, tr("Ajouter une ellipse"), this);
add_polygon = new QAction(QET::Icons::PartPolygon, tr("Ajouter un polygone"), this);
add_text = new QAction(QET::Icons::PartText, tr("Ajouter du texte"), this);
add_arc = new QAction(QET::Icons::PartArc, tr("Ajouter un arc de cercle"), this);
add_terminal = new QAction(QET::Icons::Terminal, tr("Ajouter une borne"), this);
add_textfield = new QAction(QET::Icons::PartTextField, tr("Ajouter un champ de texte"), this);
QString add_status_tip = tr("Maintenez la touche Shift enfonc\351e pour effectuer plusieurs ajouts d'affil\351e");
add_line -> setStatusTip(add_status_tip);
add_rectangle -> setStatusTip(add_status_tip);
add_ellipse -> setStatusTip(add_status_tip);
add_text -> setStatusTip(add_status_tip);
add_arc -> setStatusTip(add_status_tip);
add_terminal -> setStatusTip(add_status_tip);
add_textfield -> setStatusTip(add_status_tip);
add_polygon -> setStatusTip(tr("Utilisez le bouton droit de la souris pour poser le dernier point du polygone"));
undo = ce_scene -> undoStack().createUndoAction(this, tr("Annuler"));
redo = ce_scene -> undoStack().createRedoAction(this, tr("Refaire"));
@@ -183,9 +201,19 @@ void QETElementEditor::setupActions() {
edit_delete -> setShortcut(QKeySequence(tr("Backspace")));
#endif
zoom_in -> setShortcut(QKeySequence::ZoomIn);
zoom_out -> setShortcut(QKeySequence::ZoomOut);
zoom_fit -> setShortcut(QKeySequence(tr("Ctrl+9")));
zoom_reset -> setShortcut(QKeySequence(tr("Ctrl+0")));
edit_names -> setShortcut(QKeySequence(tr("Ctrl+E")));
edit_author -> setShortcut(tr("Ctrl+Y"));
edit_raise -> setShortcut(QKeySequence(tr("Ctrl+Shift+Up")));
edit_lower -> setShortcut(QKeySequence(tr("Ctrl+Shift+Down")));
edit_backward -> setShortcut(QKeySequence(tr("Ctrl+Shift+End")));
edit_forward -> setShortcut(QKeySequence(tr("Ctrl+Shift+Home")));
connect(new_element, SIGNAL(triggered()), this, SLOT(slot_new()));
connect(open, SIGNAL(triggered()), this, SLOT(slot_open()));
connect(open_file, SIGNAL(triggered()), this, SLOT(slot_openFile()));
@@ -203,92 +231,72 @@ void QETElementEditor::setupActions() {
connect(paste_in_area, SIGNAL(triggered()), ce_view, SLOT(pasteInArea()));
connect(paste_from_file, SIGNAL(triggered()), this, SLOT(pasteFromFile()));
connect(paste_from_elmt, SIGNAL(triggered()), this, SLOT(pasteFromElement()));
connect(zoom_in, SIGNAL(triggered()), ce_view, SLOT(zoomIn()));
connect(zoom_out, SIGNAL(triggered()), ce_view, SLOT(zoomOut()));
connect(zoom_fit, SIGNAL(triggered()), ce_view, SLOT(zoomFit()));
connect(zoom_reset, SIGNAL(triggered()), ce_view, SLOT(zoomReset()));
connect(edit_delete, SIGNAL(triggered()), ce_scene, SLOT(slot_delete()));
connect(edit_names, SIGNAL(triggered()), ce_scene, SLOT(slot_editNames()));
connect(edit_author, SIGNAL(triggered()), ce_scene, SLOT(slot_editAuthorInformations()));
connect(m_edit_properties, SIGNAL(triggered()), ce_scene, SLOT(slot_editProperties()));
connect(edit_forward, SIGNAL(triggered()), ce_scene, SLOT(slot_bringForward()));
connect(edit_raise, SIGNAL(triggered()), ce_scene, SLOT(slot_raise()));
connect(edit_lower, SIGNAL(triggered()), ce_scene, SLOT(slot_lower()));
connect(edit_backward, SIGNAL(triggered()), ce_scene, SLOT(slot_sendBackward()));
connect(move, SIGNAL(triggered()), ce_scene, SLOT(slot_move()));
connect(add_line, SIGNAL(triggered()), ce_scene, SLOT(slot_addLine()));
connect(add_rectangle, SIGNAL(triggered()), ce_scene, SLOT(slot_addRectangle()));
connect(add_ellipse, SIGNAL(triggered()), ce_scene, SLOT(slot_addEllipse()));
connect(add_polygon, SIGNAL(triggered()), ce_scene, SLOT(slot_addPolygon()));
connect(add_text, SIGNAL(triggered()), ce_scene, SLOT(slot_addText()));
connect(add_arc, SIGNAL(triggered()), ce_scene, SLOT(slot_addArc()));
connect(add_terminal, SIGNAL(triggered()), ce_scene, SLOT(slot_addTerminal()));
connect(add_textfield, SIGNAL(triggered()), ce_scene, SLOT(slot_addTextField()));
connect(move, SIGNAL(triggered()), this, SLOT(slot_setRubberBandToView()));
connect(add_line, SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
connect(add_rectangle, SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
connect(add_ellipse, SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
connect(add_polygon, SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
connect(add_text, SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
connect(add_arc, SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
connect(add_terminal, SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
connect(add_textfield, SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
connect(ce_scene, SIGNAL(needNormalMode()), this, SLOT(slot_setNormalMode()));
/*
* Action related to change depth of primitive
*/
m_depth_ag = new QActionGroup(this);
move -> setCheckable(true);
add_line -> setCheckable(true);
add_rectangle -> setCheckable(true);
add_ellipse -> setCheckable(true);
add_polygon -> setCheckable(true);
add_text -> setCheckable(true);
add_arc -> setCheckable(true);
add_terminal -> setCheckable(true);
add_textfield -> setCheckable(true);
QAction *edit_forward = new QAction(QET::Icons::BringForward, tr("Amener au premier plan"), m_depth_ag);
QAction *edit_raise = new QAction(QET::Icons::Raise, tr("Rapprocher"), m_depth_ag);
QAction *edit_lower = new QAction(QET::Icons::Lower, tr("\311loigner"), m_depth_ag);
QAction *edit_backward = new QAction(QET::Icons::SendBackward, tr("Envoyer au fond"), m_depth_ag);
edit_raise -> setShortcut(QKeySequence(tr("Ctrl+Shift+Up")));
edit_lower -> setShortcut(QKeySequence(tr("Ctrl+Shift+Down")));
edit_backward -> setShortcut(QKeySequence(tr("Ctrl+Shift+End")));
edit_forward -> setShortcut(QKeySequence(tr("Ctrl+Shift+Home")));
connect(edit_forward, SIGNAL(triggered()), ce_scene, SLOT(slot_bringForward() ));
connect(edit_raise, SIGNAL(triggered()), ce_scene, SLOT(slot_raise() ));
connect(edit_lower, SIGNAL(triggered()), ce_scene, SLOT(slot_lower() ));
connect(edit_backward, SIGNAL(triggered()), ce_scene, SLOT(slot_sendBackward() ));
depth_toolbar = addToolBar(tr("Profondeur", "toolbar title"));
depth_toolbar -> setObjectName("depth_toolbar");
depth_toolbar -> addActions(m_depth_ag -> actions());
addToolBar(Qt::TopToolBarArea, depth_toolbar);
/*
* Action related to zoom
*/
m_zoom_ag = new QActionGroup(this);
QAction *zoom_in = new QAction(QET::Icons::ZoomIn, tr("Zoom avant"), m_zoom_ag);
QAction *zoom_out = new QAction(QET::Icons::ZoomOut, tr("Zoom arri\350re"), m_zoom_ag);
QAction *zoom_fit = new QAction(QET::Icons::ZoomFitBest, tr("Zoom adapt\351"), m_zoom_ag);
QAction *zoom_reset = new QAction(QET::Icons::ZoomOriginal, tr("Pas de zoom"), m_zoom_ag);
zoom_in -> setShortcut(QKeySequence::ZoomIn);
zoom_out -> setShortcut(QKeySequence::ZoomOut);
zoom_fit -> setShortcut(QKeySequence(tr("Ctrl+9")));
zoom_reset -> setShortcut(QKeySequence(tr("Ctrl+0")));
connect(zoom_in, SIGNAL(triggered()), ce_view, SLOT(zoomIn() ));
connect(zoom_out, SIGNAL(triggered()), ce_view, SLOT(zoomOut() ));
connect(zoom_fit, SIGNAL(triggered()), ce_view, SLOT(zoomFit() ));
connect(zoom_reset, SIGNAL(triggered()), ce_view, SLOT(zoomReset() ));
/*
* Action related to primitive creation
*/
connect (ce_scene, SIGNAL(partsAdded()), this, SLOT(UncheckAddPrimitive()));
parts = new QActionGroup(this);
parts -> addAction(move);
parts -> addAction(add_line);
parts -> addAction(add_rectangle);
parts -> addAction(add_ellipse);
parts -> addAction(add_polygon);
parts -> addAction(add_arc);
parts -> addAction(add_text);
parts -> addAction(add_textfield);
parts -> addAction(add_terminal);
parts -> setExclusive(true);
QAction *add_line = new QAction(QET::Icons::PartLine, tr("Ajouter une ligne"), parts);
QAction *add_rectangle = new QAction(QET::Icons::PartRectangle, tr("Ajouter un rectangle"), parts);
QAction *add_ellipse = new QAction(QET::Icons::PartEllipse, tr("Ajouter une ellipse"), parts);
QAction *add_polygon = new QAction(QET::Icons::PartPolygon, tr("Ajouter un polygone"), parts);
QAction *add_text = new QAction(QET::Icons::PartText, tr("Ajouter du texte"), parts);
QAction *add_arc = new QAction(QET::Icons::PartArc, tr("Ajouter un arc de cercle"), parts);
QAction *add_terminal = new QAction(QET::Icons::Terminal, tr("Ajouter une borne"), parts);
QAction *add_textfield = new QAction(QET::Icons::PartTextField, tr("Ajouter un champ de texte"), parts);
foreach (QAction *action, parts -> actions()) action -> setCheckable(true);
connect(add_line, SIGNAL(triggered()), this, SLOT(addLine() ));
connect(add_rectangle, SIGNAL(triggered()), this, SLOT(addRect() ));
connect(add_ellipse, SIGNAL(triggered()), this, SLOT(addEllipse() ));
connect(add_polygon, SIGNAL(triggered()), this, SLOT(addPolygon() ));
connect(add_text, SIGNAL(triggered()), this, SLOT(addText() ));
connect(add_arc, SIGNAL(triggered()), this, SLOT(addArc() ));
connect(add_terminal, SIGNAL(triggered()), this, SLOT(addTerminal() ));
connect(add_textfield, SIGNAL(triggered()), this, SLOT(addTextField() ));
parts_toolbar = addToolBar(tr("Parties", "toolbar title"));
parts_toolbar -> setAllowedAreas(Qt::AllToolBarAreas);
parts_toolbar = new QToolBar(tr("Parties", "toolbar title"), this);
parts_toolbar -> setObjectName("parts");
parts_toolbar -> addActions(parts -> actions());
addToolBar(Qt::LeftToolBarArea, parts_toolbar);
foreach (QAction *action, parts -> actions()) parts_toolbar -> addAction(action);
move -> setChecked(true);
parts_toolbar -> setAllowedAreas(Qt::AllToolBarAreas);
/*
QAction *xml_preview = new QAction(QET::Icons::DialogInformation, tr("XML"), this);
connect(xml_preview, SIGNAL(triggered()), this, SLOT(xmlPreview()));
parts_toolbar -> addAction(xml_preview);
*/
main_toolbar = new QToolBar(tr("Outils", "toolbar title"), this);
main_toolbar -> setObjectName("main_toolbar");
@@ -296,6 +304,8 @@ void QETElementEditor::setupActions() {
view_toolbar -> setObjectName("display");
element_toolbar = new QToolBar(tr("\311l\351ment", "toolbar title"), this);
element_toolbar -> setObjectName("element_toolbar");
depth_toolbar = new QToolBar(tr("Profondeur", "toolbar title"), this);
depth_toolbar -> setObjectName("depth_toolbar");
main_toolbar -> addAction(new_element);
main_toolbar -> addAction(open);
@@ -314,9 +324,16 @@ void QETElementEditor::setupActions() {
element_toolbar -> addAction(edit_names);
element_toolbar -> addAction(m_edit_properties);
depth_toolbar -> addAction(edit_forward);
depth_toolbar -> addAction(edit_raise);
depth_toolbar -> addAction(edit_lower);
depth_toolbar -> addAction(edit_backward);
addToolBar(Qt::TopToolBarArea, main_toolbar);
addToolBar(Qt::TopToolBarArea, view_toolbar);
addToolBar(Qt::TopToolBarArea, element_toolbar);
addToolBar(Qt::TopToolBarArea, depth_toolbar);
addToolBar(Qt::LeftToolBarArea, parts_toolbar);
connect(ce_scene, SIGNAL(selectionChanged()), this, SLOT(slot_updateInformations()));
connect(ce_scene, SIGNAL(selectionChanged()), this, SLOT(slot_updateMenus()));
@@ -334,8 +351,8 @@ void QETElementEditor::setupActions() {
}
/**
* @brief QETElementEditor::setupMenus
*/
Met en place les menus.
*/
void QETElementEditor::setupMenus() {
file_menu = new QMenu(tr("&Fichier"), this);
edit_menu = new QMenu(tr("&\311dition"), this);
@@ -350,8 +367,7 @@ void QETElementEditor::setupMenus() {
file_menu -> addAction(new_element);
file_menu -> addAction(open);
file_menu -> addAction(open_file);
QMenu *recentfile = file_menu -> addMenu(QET::Icons::DocumentOpenRecent, tr("&R\351cemment ouverts"));
recentfile->addActions(QETApp::elementsRecentFiles()->menu()->actions());
file_menu -> addMenu(QETApp::elementsRecentFiles() -> menu());
connect(QETApp::elementsRecentFiles(), SIGNAL(fileOpeningRequested(const QString &)), this, SLOT(openRecentFile(const QString &)));
file_menu -> addAction(save);
file_menu -> addAction(save_as);
@@ -385,9 +401,15 @@ void QETElementEditor::setupMenus() {
edit_menu -> addAction(edit_author);
edit_menu -> addAction(m_edit_properties);
edit_menu -> addSeparator();
edit_menu -> addActions(m_depth_ag -> actions());
edit_menu -> addAction(edit_forward);
edit_menu -> addAction(edit_raise);
edit_menu -> addAction(edit_lower);
edit_menu -> addAction(edit_backward);
display_menu -> addActions(m_zoom_ag -> actions());
display_menu -> addAction(zoom_in);
display_menu -> addAction(zoom_out);
display_menu -> addAction(zoom_fit);
display_menu -> addAction(zoom_reset);
insertMenu(settings_menu_, file_menu);
insertMenu(settings_menu_, edit_menu);
@@ -414,7 +436,10 @@ void QETElementEditor::contextMenu(QContextMenuEvent *event) {
menu.addAction(paste_in_area);
menu.addMenu(paste_from_menu);
menu.addSeparator();
menu.addActions(m_depth_ag -> actions());
menu.addAction(edit_forward);
menu.addAction(edit_raise);
menu.addAction(edit_lower);
menu.addAction(edit_backward);
menu.exec(event -> globalPos());
}
@@ -436,13 +461,15 @@ void QETElementEditor::slot_updateMenus() {
paste_from_elmt -> setEnabled(!read_only);
parts_list -> setEnabled(!read_only);
// Action enabled if primitive selected
// actions dependant de la presence de parties selectionnees
deselectall -> setEnabled(selected_items);
cut -> setEnabled(selected_items);
copy -> setEnabled(selected_items);
edit_delete -> setEnabled(selected_items);
foreach (QAction *action, m_depth_ag -> actions())
action->setEnabled(selected_items);
edit_forward -> setEnabled(selected_items);
edit_raise -> setEnabled(selected_items);
edit_lower -> setEnabled(selected_items);
edit_backward -> setEnabled(selected_items);
// actions dependant du contenu du presse-papiers
paste -> setEnabled(clipboard_elmt);
@@ -473,6 +500,7 @@ void QETElementEditor::slot_updateTitle() {
void QETElementEditor::setupInterface() {
// editeur
ce_scene = new ElementScene(this, this);
ce_scene -> slot_move();
ce_view = new ElementView(ce_scene, this);
slot_setRubberBandToView();
setCentralWidget(ce_view);
@@ -558,6 +586,15 @@ void QETElementEditor::slot_setNoDragToView() {
ce_view -> setDragMode(QGraphicsView::NoDrag);
}
/**
Passe l'editeur en mode normal
*/
void QETElementEditor::slot_setNormalMode() {
if (!move -> isChecked()) move -> setChecked(true);
ce_view -> setDragMode(QGraphicsView::RubberBandDrag);
ce_scene -> slot_move();
}
/**
Met a jour la zone d'information et d'edition des primitives.
Si plusieurs primitives sont selectionnees, seule leur quantite est
@@ -637,8 +674,7 @@ bool QETElementEditor::checkElement() {
/// Check master, slave and simple element
if(ce_scene -> elementType() == "master" ||
ce_scene -> elementType() == "slave" ||
ce_scene -> elementType() == "simple" ||
ce_scene -> elementType().contains("report")) {
ce_scene -> elementType() == "simple" ) {
bool wrng = true;
foreach (CustomElementPart *cep, ce_scene->primitives()) {
@@ -648,7 +684,7 @@ bool QETElementEditor::checkElement() {
if (wrng) {
errors << qMakePair(
tr("Absence de champ texte 'label'", "warning title"),
tr("Les \351l\351ments ma\356tres, esclaves, simple et renvoie de folio doivent poss\351der "
tr("Les \351l\351ments ma\356tres, esclaves et simple doivent poss\351der "
"un champ texte comportant le tagg 'label'", "warning description"));
}
}
@@ -882,78 +918,6 @@ bool QETElementEditor::isReadOnly() const {
return(read_only);
}
/**
* @brief QETElementEditor::addLine
* Set line creation interface to scene
*/
void QETElementEditor::addLine() {
ce_scene -> setEventInterface(new ESEventAddLine(ce_scene));
}
/**
* @brief QETElementEditor::addRect
* Set rectangle creation interface to scene
*/
void QETElementEditor::addRect() {
ce_scene -> setEventInterface(new ESEventAddRect(ce_scene));
}
/**
* @brief QETElementEditor::addEllipse
* Set ellipse creation interface to scene
*/
void QETElementEditor::addEllipse() {
ce_scene -> setEventInterface(new ESEventAddEllipse(ce_scene));
}
/**
* @brief QETElementEditor::addPolygon
* Set polygon creation interface to scene
*/
void QETElementEditor::addPolygon() {
ce_scene -> setEventInterface(new ESEventAddPolygon(ce_scene));
}
/**
* @brief QETElementEditor::addArc
* Set arc creation interface to scene
*/
void QETElementEditor::addArc() {
ce_scene -> setEventInterface(new ESEventAddArc(ce_scene));
}
/**
* @brief QETElementEditor::addText
* Set text creation interface to scene
*/
void QETElementEditor::addText() {
ce_scene -> setEventInterface(new ESEventAddText(ce_scene));
}
/**
* @brief QETElementEditor::addTextField
* Set text field creation interface to scene
*/
void QETElementEditor::addTextField() {
ce_scene -> setEventInterface(new ESEventAddTextField(ce_scene));
}
/**
* @brief QETElementEditor::addTerminal
* Set terminal creation interface to scene
*/
void QETElementEditor::addTerminal() {
ce_scene -> setEventInterface(new ESEventAddTerminal(ce_scene));
}
/**
* @brief QETElementEditor::UncheckAddPrimitive
* Uncheck all action related to primitive
*/
void QETElementEditor::UncheckAddPrimitive() {
foreach(QAction *action, parts->actions()) action -> setChecked(false);
}
/**
Lance l'assistant de creation d'un nouvel element.
*/

View File

@@ -23,10 +23,8 @@
#include "elementscene.h"
#include "orientationset.h"
#include "elementslocation.h"
class ElementItemEditor;
class ElementView;
/**
This class represents an element editor, allowing users to draw, change and
configure a particular electrical element.
@@ -40,9 +38,6 @@ class QETElementEditor : public QETMainWindow {
virtual ~QETElementEditor();
private:
QETElementEditor(const QETElementEditor &);
void setupActions();
void setupMenus();
void setupInterface();
// attributes
private:
@@ -77,10 +72,15 @@ class QETElementEditor : public QETMainWindow {
QAction *cut, *copy, *paste, *paste_in_area, *paste_from_file, *paste_from_elmt;
QAction *undo, *redo;
QAction *edit_delete, *edit_size_hs, *edit_names, *edit_author, *m_edit_properties;
QAction *edit_raise, *edit_lower, *edit_backward, *edit_forward;
/// actions for the "display" menu
QAction *zoom_in, *zoom_out, *zoom_fit, *zoom_reset;
/// toolbars
QToolBar *parts_toolbar, *main_toolbar, *view_toolbar, *depth_toolbar, *element_toolbar;
/// Action group
QActionGroup *parts, *m_zoom_ag, *m_depth_ag;
/// toolbars actions
QActionGroup *parts;
QAction *move, *add_line, *add_rectangle, *add_ellipse, *add_polygon, *add_text;
QAction *add_arc, *add_terminal, *add_textfield;
/// minimum window title
QString min_title;
/// filename of the currently edited element
@@ -118,21 +118,14 @@ class QETElementEditor : public QETMainWindow {
virtual void firstActivation(QEvent *);
private:
void setupActions();
void setupMenus();
void setupInterface();
bool canClose();
QWidget *clearToolsDock();
void copyAndPasteXml(const QDomDocument &);
public slots:
void addLine();
void addRect();
void addEllipse();
void addPolygon();
void addArc();
void addText();
void addTextField();
void addTerminal();
void UncheckAddPrimitive();
void slot_new();
void slot_open();
void slot_openFile();
@@ -144,6 +137,7 @@ class QETElementEditor : public QETMainWindow {
bool slot_saveAsFile();
void slot_setRubberBandToView();
void slot_setNoDragToView();
void slot_setNormalMode();
void slot_updateInformations();
void slot_updateMenus();
void slot_updateTitle();

View File

@@ -196,7 +196,7 @@ QPixmap ElementsCollectionCache::pixmap() const {
*/
bool ElementsCollectionCache::fetchData(const ElementsLocation &location) {
int state;
Element *custom_elmt = ElementFactory::Instance() -> createElement(location, 0, &state);
Element *custom_elmt = ElementFactory::Instance()->createElement(location, 0, 0, &state);
if (state) {
qDebug() << "ElementsCollectionCache::fetchData() : Le chargement du composant" << qPrintable(location.toString()) << "a echoue avec le code d'erreur" << state;
} else {

View File

@@ -294,7 +294,7 @@ void ElementsPanel::startElementDrag(const ElementsLocation &location) {
// element temporaire pour fournir un apercu
int elmt_creation_state;
Element *temp_elmt = ElementFactory::Instance() -> createElement(location, 0, &elmt_creation_state);
Element *temp_elmt = ElementFactory::Instance()->createElement(location, 0, 0, &elmt_creation_state);
if (elmt_creation_state) {
delete temp_elmt;
return;

View File

@@ -72,8 +72,6 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer ce sch\351ma"), this);
prj_move_diagram_up = new QAction(QET::Icons::GoUp, tr("Remonter ce sch\351ma"), this);
prj_move_diagram_down = new QAction(QET::Icons::GoDown, tr("Abaisser ce sch\351ma"), this);
prj_move_diagram_upx10 = new QAction(QET::Icons::GoUp, tr("Remonter ce sch\351ma x10"), this);
prj_move_diagram_downx10 = new QAction(QET::Icons::GoDown, tr("Abaisser ce sch\351ma x10"), this);
tbt_add = new QAction(QET::Icons::TitleBlock, tr("Nouveau mod\350le"), this);
tbt_edit = new QAction(QET::Icons::TitleBlock, tr("\311diter ce mod\350le"), this);
tbt_remove = new QAction(QET::Icons::TitleBlock, tr("Supprimer ce mod\350le"), this);
@@ -120,8 +118,6 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
connect(prj_del_diagram, SIGNAL(triggered()), this, SLOT(deleteDiagram()));
connect(prj_move_diagram_up, SIGNAL(triggered()), this, SLOT(moveDiagramUp()));
connect(prj_move_diagram_down, SIGNAL(triggered()), this, SLOT(moveDiagramDown()));
connect(prj_move_diagram_upx10, SIGNAL(triggered()), this, SLOT(moveDiagramUpx10()));
connect(prj_move_diagram_downx10, SIGNAL(triggered()), this, SLOT(moveDiagramDownx10()));
connect(tbt_add, SIGNAL(triggered()), this, SLOT(addTitleBlockTemplate()));
connect(tbt_edit, SIGNAL(triggered()), this, SLOT(editTitleBlockTemplate()));
connect(tbt_remove, SIGNAL(triggered()), this, SLOT(removeTitleBlockTemplate()));
@@ -315,25 +311,6 @@ void ElementsPanelWidget::moveDiagramDown() {
}
}
/**
Emet le signal requestForDiagramMoveUpx10 avec le schema selectionne
*/
void ElementsPanelWidget::moveDiagramUpx10() {
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
emit(requestForDiagramMoveUpx10(selected_diagram));
}
}
/**
Emet le signal requestForDiagramMoveDownx10 avec le schema selectionne
*/
void ElementsPanelWidget::moveDiagramDownx10() {
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
emit(requestForDiagramMoveDownx10(selected_diagram));
}
}
/**
Opens a template editor to create a new title block template.
*/
@@ -454,8 +431,6 @@ void ElementsPanelWidget::updateButtons() {
prj_del_diagram -> setEnabled(is_writable);
prj_move_diagram_up -> setEnabled(is_writable && diagram_position > 0);
prj_move_diagram_down -> setEnabled(is_writable && diagram_position < project_diagrams_count - 1);
prj_move_diagram_upx10 -> setEnabled(is_writable && diagram_position > 10);
prj_move_diagram_downx10 -> setEnabled(is_writable && diagram_position < project_diagrams_count - 10);
setElementsActionEnabled(false);
} else if (current_type == QET::TitleBlockTemplatesCollection) {
TitleBlockTemplateLocation location = elements_panel -> templateLocationForItem(current_item);
@@ -558,10 +533,8 @@ void ElementsPanelWidget::handleContextMenu(const QPoint &pos) {
case QET::Diagram:
context_menu -> addAction(prj_prop_diagram);
context_menu -> addAction(prj_del_diagram);
context_menu -> addAction(prj_move_diagram_upx10);
context_menu -> addAction(prj_move_diagram_up);
context_menu -> addAction(prj_move_diagram_down);
context_menu -> addAction(prj_move_diagram_downx10);
break;
case QET::TitleBlockTemplatesCollection:
context_menu -> addAction(tbt_add);

View File

@@ -44,7 +44,7 @@ class ElementsPanelWidget : public QWidget {
QAction *new_category, *edit_category, *delete_category;
QAction *delete_collection;
QAction *new_element, *edit_element, *delete_element, *open_element;
QAction *prj_activate, *prj_close, *prj_edit_prop, *prj_prop_diagram, *prj_add_diagram, *prj_del_diagram, *prj_move_diagram_up, *prj_move_diagram_down, *prj_move_diagram_upx10, *prj_move_diagram_downx10;
QAction *prj_activate, *prj_close, *prj_edit_prop, *prj_prop_diagram, *prj_add_diagram, *prj_del_diagram, *prj_move_diagram_up, *prj_move_diagram_down;
QAction *tbt_add, *tbt_edit, *tbt_remove;
QAction *copy_elements_, *move_elements_, *cancel_elements_;
QMenu *context_menu;
@@ -67,8 +67,6 @@ class ElementsPanelWidget : public QWidget {
void requestForDiagramDeletion(Diagram *);
void requestForDiagramMoveUp(Diagram *);
void requestForDiagramMoveDown(Diagram *);
void requestForDiagramMoveUpx10(Diagram *);
void requestForDiagramMoveDownx10(Diagram *);
public slots:
void clearFilterTextField();
@@ -83,8 +81,6 @@ class ElementsPanelWidget : public QWidget {
void deleteDiagram();
void moveDiagramUp();
void moveDiagramDown();
void moveDiagramUpx10();
void moveDiagramDownx10();
void addTitleBlockTemplate();
void editTitleBlockTemplate();
void removeTitleBlockTemplate();

View File

@@ -31,31 +31,29 @@ ElementFactory* ElementFactory::factory_ = 0;
* @brief ElementFactory::createElement
* @param location create element at this location
* @param qgi parent item for this elemnt
* @param s diagram of the element
* @param state state of the creation
* @return the element or 0
*/
Element * ElementFactory::createElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state)
{
Element * ElementFactory::createElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) {
// recupere la definition de l'element
ElementsCollectionItem *element_item = QETApp::collectionItem(location);
ElementDefinition *element_definition;
if (!element_item ||\
!element_item -> isElement() ||\
!(element_definition = qobject_cast<ElementDefinition *>(element_item)))
{
!(element_definition = qobject_cast<ElementDefinition *>(element_item))) {
if (state) *state = 1;
return 0;
}
if (element_definition->xml().hasAttribute("link_type"))
{
if (element_definition->xml().hasAttribute("link_type")) {
QString link_type = element_definition->xml().attribute("link_type");
if (link_type == "next_report" || link_type == "previous_report") return (new ReportElement(location, link_type, qgi, state));
if (link_type == "master") return (new MasterElement (location, qgi, state));
if (link_type == "slave") return (new SlaveElement (location, qgi, state));
if (link_type == "terminal") return (new TerminalElement (location, qgi, state));
if (link_type == "next_report" || link_type == "previous_report") return (new ReportElement(location, link_type, qgi, s, state));
if (link_type == "master") return (new MasterElement (location, qgi, s, state));
if (link_type == "slave") return (new SlaveElement (location, qgi, s, state));
if (link_type == "terminal") return (new TerminalElement (location, qgi, s, state));
}
//default if nothing match for link_type
return (new SimpleElement(location, qgi, state));
return (new SimpleElement(location, qgi, s, state));
}

View File

@@ -45,7 +45,6 @@ class ElementFactory
}
return factory_;
}
// delete the instance of factory
static void dropInstance () {
static QMutex mutex;
@@ -56,7 +55,6 @@ class ElementFactory
mutex.unlock();
}
}
//attributes
private:
static ElementFactory* factory_;
@@ -69,7 +67,7 @@ class ElementFactory
~ElementFactory() {}
public:
Element * createElement (const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
Element * createElement (const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
};
//ElementFactory ElementFactory::factory_ = 0;
#endif // ELEMENTFACTORY_H

View File

@@ -969,13 +969,11 @@ void GenericPanel::diagramRemoved(QETProject *project, Diagram *diagram) {
}
/**
* @brief GenericPanel::projectDiagramsOrderChanged
* @param project project where diagram moved
* @param from Index of diagram before move
* @param to Index of diagram after move
*/
void GenericPanel::projectDiagramsOrderChanged(QETProject *project, int from, int to)
{
@param project Projet auquel appartiennent les schemas concernes
@param from Index de l'onglet avant le deplacement
@param to Index de l'onglet apres le deplacement
*/
void GenericPanel::projectDiagramsOrderChanged(QETProject *project, int from, int to) {
// get the item representing the provided project
QTreeWidgetItem *qtwi_project = itemForProject(project);
if (!qtwi_project) return;
@@ -986,23 +984,23 @@ void GenericPanel::projectDiagramsOrderChanged(QETProject *project, int from, in
// remove the QTWI then insert it back at the adequate location
bool was_selected = moved_qtwi_diagram -> isSelected();
qtwi_project -> removeChild (moved_qtwi_diagram);
qtwi_project -> insertChild (to, moved_qtwi_diagram);
qtwi_project -> removeChild(moved_qtwi_diagram);
qtwi_project -> insertChild(to, moved_qtwi_diagram);
// update the QTWI labels because they may display the folio index
for (int i = qMin(from, to); i < qMax(from, to) + 1; i++)
{
QTreeWidgetItem *qtwi_diagram = qtwi_project -> child(i);
foreach (int diagram_index, QList<int>() << from << to) {
QTreeWidgetItem *qtwi_diagram = qtwi_project -> child(diagram_index);
if (!qtwi_diagram) continue;
Diagram *diagram = valueForItem<Diagram *>(qtwi_diagram);
if (diagram)
if (diagram) {
updateDiagramItem(qtwi_diagram, diagram);
}
}
if (was_selected)
if (was_selected) {
setCurrentItem(moved_qtwi_diagram);
}
emit(panelContentChanged());
}

View File

@@ -81,7 +81,7 @@ bool nomenclature::saveToCSVFile() {
QString nomenclature::getNomenclature() {
//Process...
QString data = tr("NOMENCLATURE : ") + m_project -> title() + "\n\n";
data += tr("Folio") +";"+ tr("Sch\351ma") +";"+ tr("D\351signation qet")+";"+ tr("Label") +";"+ tr("D\351signation")+";"+ tr("Commentaire") +";"+ tr("Fabriquant") +";"+ tr("Reference") +";"+ tr("Machine-reference")+"\n";
data += tr("Folio") +";"+ tr("Sch\351ma") +";"+ tr("D\351signation")+";"+ tr("Label") +";"+ tr("Commentaire") +";"+ tr("Fabriquant") +";"+ tr("Reference") +";"+ tr("Machine-reference")+"\n";
if(m_list_diagram.isEmpty()) return data;
@@ -115,7 +115,6 @@ QString nomenclature::getElementInfo(const Element *elmt) {
info += diagram -> title() + ";";
info += elmt -> name() + ";";
info += elmt_info["label"].toString() + ";";
info += elmt_info["designation"].toString() + ";";
info += elmt_info["comment"].toString() + ";";
info += elmt_info["manufacturer"].toString() + ";";
info += elmt_info["manufacturer-reference"].toString() + ";";

View File

@@ -113,6 +113,13 @@ QList<Diagram *> ProjectView::getDiagrams(ProjectSaveOptions options) {
}
}
if (options & ModifiedDiagramsOnly) {
foreach (Diagram *diagram, selection) {
if (!diagram -> undoStack().isClean() || !diagram -> wasWritten()) continue;
selection.removeOne(diagram);
}
}
return(selection);
}
@@ -308,8 +315,8 @@ void ProjectView::addNewDiagram() {
*/
void ProjectView::addNewDiagramFolioList() {
if (project_ -> isReadOnly()) return;
int i = 1; //< Each new diagram is added to the end of the project.
//< We use @i to move the folio list at second position in the project
int i = 0; //< Each new diagram is added to the end of the project.
//< We use @i to move the folio list at the beginning of the project
foreach (Diagram *d, project_ -> addNewDiagramFolioList()) {
DiagramView *new_diagram_view = new DiagramView(d);
addDiagram(new_diagram_view);
@@ -364,8 +371,11 @@ void ProjectView::removeDiagram(DiagramView *diagram_view) {
// verifie que le schema est bien present dans le projet
if (!diagram_ids_.values().contains(diagram_view)) return;
//Ask confirmation to user.
// demande confirmation a l'utilisateur
if (
diagram_view -> diagram() -> wasWritten() ||\
!diagram_view -> diagram() -> undoStack().isClean()
) {
int answer = QET::MessageBox::question(
this,
tr("Supprimer le sch\351ma ?", "message box title"),
@@ -376,6 +386,10 @@ void ProjectView::removeDiagram(DiagramView *diagram_view) {
if (answer != QMessageBox::Yes) {
return;
}
}
// notifie le reste du monde que le DiagramView va disparaitre
emit(diagramAboutToBeRemoved(diagram_view));
// enleve le DiagramView des onglets
int diagram_tab_id = diagram_ids_.key(diagram_view);
@@ -501,48 +515,6 @@ void ProjectView::moveDiagramDown(Diagram *diagram) {
moveDiagramDown(findDiagram(diagram));
}
/**
Deplace le schema diagram_view vers le haut / la gauche x10
*/
void ProjectView::moveDiagramUpx10(DiagramView *diagram_view) {
if (!diagram_view) return;
int diagram_view_position = diagram_ids_.key(diagram_view);
if (!diagram_view_position) {
// le schema est le premier du projet
return;
}
tabs_ -> moveTab(diagram_view_position, diagram_view_position - 10);
}
/**
Deplace le schema diagram vers le haut / la gauche x10
*/
void ProjectView::moveDiagramUpx10(Diagram *diagram) {
moveDiagramUpx10(findDiagram(diagram));
}
/**
Deplace le schema diagram_view vers le bas / la droite x10
*/
void ProjectView::moveDiagramDownx10(DiagramView *diagram_view) {
if (!diagram_view) return;
int diagram_view_position = diagram_ids_.key(diagram_view);
if (diagram_view_position + 1 == diagram_ids_.count()) {
// le schema est le dernier du projet
return;
}
tabs_ -> moveTab(diagram_view_position, diagram_view_position + 10);
}
/**
Deplace le schema diagram vers le bas / la droite x10
*/
void ProjectView::moveDiagramDownx10(Diagram *diagram) {
moveDiagramDownx10(findDiagram(diagram));
}
/**
Ce slot demarre un dialogue permettant a l'utilisateur de parametrer et de
lancer l'impression de toute ou partie du projet.
@@ -805,7 +777,7 @@ void ProjectView::loadDiagrams() {
// If project have the folios list, move it at the beginning of the project
if (project_ -> getFolioSheetsQuantity()) {
for (int i = 0; i < project_->getFolioSheetsQuantity(); i++)
tabs_ -> moveTab(diagrams().size()-1, + 1);
tabs_ -> moveTab(diagrams().size()-1, 0);
}
}

View File

@@ -34,6 +34,7 @@ class ProjectView : public QWidget {
public:
enum ProjectSaveOption {
ModifiedDiagramsOnly = 1,
CurrentDiagram = 2,
AllDiagramsButCurrent = 4,
AllDiagrams = 6
@@ -73,14 +74,10 @@ class ProjectView : public QWidget {
void moveDiagramUp(Diagram *);
void moveDiagramDown(DiagramView *);
void moveDiagramDown(Diagram *);
void moveDiagramUpx10(DiagramView *);
void moveDiagramUpx10(Diagram *);
void moveDiagramDownx10(DiagramView *);
void moveDiagramDownx10(Diagram *);
void printProject();
void exportProject();
QETResult save();
QETResult saveAs(ProjectSaveOptions = ProjectSaveOptions(AllDiagrams));
QETResult saveAs(ProjectSaveOptions = ProjectSaveOptions(AllDiagrams | ModifiedDiagramsOnly));
QETResult doSave(ProjectSaveOptions);
void saveDiagrams(const QList<Diagram *> &);
int cleanProject();
@@ -91,6 +88,7 @@ class ProjectView : public QWidget {
signals:
void diagramAdded(DiagramView *);
void diagramAboutToBeRemoved(DiagramView *);
void diagramRemoved(DiagramView *);
void diagramActivated(DiagramView *);
void diagramOrderChanged(ProjectView *, int, int);

View File

@@ -683,18 +683,3 @@ QPointF QET::graphicsSceneEventPos(QEvent *event) {
}
return(event_scene_pos);
}
/**
* @brief QET::eachStrIsEqual
* @param qsl list of string to compare
* @return true if every string is identical, else false;
* The list must not be empty
* If the list can be empty, call isEmpty() before calling this function
*/
bool QET::eachStrIsEqual(const QStringList &qsl) {
if (qsl.size() == 1) return true;
foreach (const QString t, qsl) {
if (qsl.at(0) != t) return false;
}
return true;
}

View File

@@ -27,7 +27,7 @@ namespace QET {
/// QElectroTech version (as string, used to mark projects and elements XML documents)
const QString version = "0.4";
/// QElectroTech displayed version
const QString displayedVersion = "0.4-rc2";
const QString displayedVersion = "0.4-b";
QString license();
/// Oriented movements
@@ -154,7 +154,6 @@ namespace QET {
QString titleBlockColumnLengthToString(const TitleBlockColumnLength &);
bool writeXmlFile(QDomDocument &, const QString &, QString * = 0);
QPointF graphicsSceneEventPos(QEvent *);
bool eachStrIsEqual (const QStringList &qsl);
}
class Qet : public QObject {

View File

@@ -346,7 +346,6 @@ QStringList QETApp::elementInfoKeys() {
QStringList info_list;
info_list << "label"
<< "comment"
<< "designation"
<< "manufacturer"
<< "manufacturer-reference"
<< "machine-manufacturer-reference";
@@ -363,7 +362,6 @@ QStringList QETApp::elementInfoKeys() {
QString QETApp::elementTranslatedInfoKey(QString &info) {
if (info == "label") return tr("Label");
else if (info == "comment") return tr("Commentaire");
else if (info == "designation") return tr("D\351signation");
else if (info == "manufacturer") return tr("Fabriquant");
else if (info == "manufacturer-reference") return tr("R\351f\351rence fabriquant");
else if (info == "machine-manufacturer-reference") return tr("R\351f\351rence fabriquant machine");

View File

@@ -44,12 +44,10 @@
#include <QMessageBox>
/**
* @brief QETDiagramEditor::QETDiagramEditor
* Constructor
* @param files, list of files to open
* @param parent, parent widget
constructeur
@param files Liste de fichiers a ouvrir
@param parent le widget parent de la fenetre principale
*/
QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
QETMainWindow(parent),
@@ -59,12 +57,13 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
m_selection_actions_group (this),
m_row_column_actions_group (this),
m_file_actions_group (this),
open_dialog_dir (QDesktopServices::storageLocation(QDesktopServices::DesktopLocation))
open_dialog_dir (QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)),
can_update_actions (true)
{
//Setup the mdi area at center of application
// mise en place de l'interface MDI au centre de l'application
setCentralWidget(&workspace);
//Set object name to be retrieved by the stylesheets
// nomme l'objet afin qu'il soit reperable par les feuilles de style
workspace.setBackground(QBrush(Qt::NoBrush));
workspace.setObjectName("mdiarea");
@@ -72,11 +71,16 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
workspace.setTabsClosable(true);
#endif
//Set the signal mapper
// mise en place du signalmapper
connect(&windowMapper, SIGNAL(mapped(QWidget *)), this, SLOT(activateWidget(QWidget *)));
// titre de la fenetre
setWindowTitle(tr("QElectroTech", "window title"));
// icone de la fenetre
setWindowIcon(QET::Icons::QETLogo);
// barre de statut de la fenetre
statusBar() -> showMessage(tr("QElectroTech", "status bar message"));
setUpElementsPanel();
@@ -85,30 +89,37 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
setUpToolBar();
setUpMenu();
tabifyDockWidget(qdw_undo, qdw_pa);
//By default the windows is maximised
// la fenetre est maximisee par defaut
setMinimumSize(QSize(500, 350));
setWindowState(Qt::WindowMaximized);
connect (&workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(subWindowActivated(QMdiSubWindow*)));
connect (QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(slot_updatePasteAction()));
connect (&undo_group, SIGNAL(cleanChanged(bool)), this, SLOT(activeUndoStackCleanChanged(bool)));
// connexions signaux / slots pour une interface sensee
connect(&workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slot_updateWindowsMenu()));
connect(&workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slot_updateUndoStack()));
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(slot_updatePasteAction()));
// lecture des parametres
readSettings();
// affichage
show();
//If valid file path is given as arguments
// si des chemins de fichiers valides sont passes en arguments
uint opened_projects = 0;
if (files.count())
{
//So we open this files
foreach(QString file, files)
if (openAndAddProject(file, false))
if (files.count()) {
// alors on ouvre ces fichiers
foreach(QString file, files) {
bool project_opening = openAndAddProject(file, false);
if (project_opening) {
++ opened_projects;
}
}
}
slot_updateActions();
// si aucun schema n'a ete ouvert jusqu'a maintenant, on ouvre un nouveau schema
//if (!opened_projects) newProject();
}
/**
@@ -131,7 +142,6 @@ void QETDiagramEditor::setUpElementsPanel() {
qdw_pa -> setMinimumWidth (160);
qdw_pa -> setWidget (pa = new ElementsPanelWidget(qdw_pa));
addDockWidget(Qt::LeftDockWidgetArea, qdw_pa);
connect(pa, SIGNAL(requestForProject (QETProject *)), this, SLOT(activateProject(QETProject *)));
connect(pa, SIGNAL(requestForProjectClosing (QETProject *)), this, SLOT(closeProject(QETProject *)));
@@ -143,8 +153,6 @@ void QETDiagramEditor::setUpElementsPanel() {
connect(pa, SIGNAL(requestForDiagramDeletion (Diagram *)), this, SLOT(removeDiagram(Diagram *)));
connect(pa, SIGNAL(requestForDiagramMoveUp (Diagram *)), this, SLOT(moveDiagramUp(Diagram *)));
connect(pa, SIGNAL(requestForDiagramMoveDown (Diagram *)), this, SLOT(moveDiagramDown(Diagram *)));
connect(pa, SIGNAL(requestForDiagramMoveUpx10 (Diagram *)), this, SLOT(moveDiagramUpx10(Diagram *)));
connect(pa, SIGNAL(requestForDiagramMoveDownx10 (Diagram *)), this, SLOT(moveDiagramDownx10(Diagram *)));
}
/**
@@ -166,8 +174,6 @@ void QETDiagramEditor::setUpUndoStack() {
qdw_undo -> setFeatures(QDockWidget::AllDockWidgetFeatures);
qdw_undo -> setMinimumWidth(160);
qdw_undo -> setWidget(undo_view);
addDockWidget(Qt::LeftDockWidgetArea, qdw_undo);
}
/**
@@ -613,44 +619,30 @@ void QETDiagramEditor::exportDialog() {
}
/**
* @brief QETDiagramEditor::save
* Ask the current active project to save
*/
Methode enregistrant le schema dans le dernier nom de fichier connu.
@return true si l'enregistrement a reussi, false sinon
*/
void QETDiagramEditor::save() {
if (ProjectView *project_view = currentProject()) {
QETResult saved = project_view -> save();
if (saved.isOk()) {
save_file -> setDisabled(true);
QETApp::projectsRecentFiles() -> fileWasOpened(project_view -> project() -> filePath());
QString title = (project_view -> project() -> title ());
if (title.isEmpty()) title = "QElectroTech ";
QString filePath = (project_view -> project() -> filePath ());
statusBar()-> showMessage(tr("Projet %1 enregistr\351 dans le repertoire: %2.").arg(title).arg (filePath), 2000);
}
else {
} else {
showError(saved);
}
}
}
/**
* @brief QETDiagramEditor::saveAs
* Ask the current active project to save as
*/
Cette methode demande un nom de fichier a l'utilisateur pour enregistrer le schema
@return true si l'enregistrement a reussi, false sinon
*/
void QETDiagramEditor::saveAs() {
if (ProjectView *project_view = currentProject()) {
QETResult save_file = project_view -> saveAs();
if (save_file.isOk()) {
QETApp::projectsRecentFiles() -> fileWasOpened(project_view -> project() -> filePath());
QString title = (project_view -> project() -> title ());
if (title.isEmpty()) title = "QElectroTech ";
QString filePath = (project_view -> project() -> filePath ());
statusBar()->showMessage(tr("Projet %1 enregistr\351 dans le repertoire: %2.").arg(title).arg (filePath), 2000);
}
else {
} else {
showError(save_file);
}
}
@@ -867,8 +859,6 @@ bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) {
ProjectView *project_view = new ProjectView(project);
addProjectView(project_view);
undo_group.addStack(project -> undoStack());
// met a jour le panel d'elements
if (update_panel) {
pa -> elementsPanel().projectWasOpened(project);
@@ -1142,22 +1132,24 @@ void QETDiagramEditor::slot_setVisualisationMode() {
}
/**
* @brief QETDiagramEditor::slot_updateActions
* Manage actions
*/
void QETDiagramEditor::slot_updateActions()
{
gere les actions
*/
void QETDiagramEditor::slot_updateActions() {
DiagramView *dv = currentDiagram();
ProjectView *pv = currentProject();
bool opened_project = pv;
bool opened_diagram = dv;
bool editable_project = (pv && !pv -> project() -> isReadOnly());
bool editable_diagram = (dv && !dv -> diagram() -> isReadOnly());
// actions ayant juste besoin d'un document ouvert
close_file -> setEnabled(opened_project);
save_file -> setEnabled(editable_project);
save_file_as -> setEnabled(opened_project);
prj_edit_prop -> setEnabled(opened_project);
prj_add_diagram -> setEnabled(editable_project);
//prj_add_diagram_foliolist -> setEnabled(editable_project);
prj_del_diagram -> setEnabled(editable_project);
prj_clean -> setEnabled(editable_project);
prj_diagramList -> setEnabled(opened_project);
@@ -1166,12 +1158,12 @@ void QETDiagramEditor::slot_updateActions()
print -> setEnabled(opened_diagram);
infos_diagram -> setEnabled(opened_diagram);
prj_nomenclature -> setEnabled(editable_project);
m_zoom_actions_group. setEnabled(opened_diagram);
m_select_actions_group. setEnabled(opened_diagram);
m_add_item_actions_group. setEnabled(editable_project);
m_row_column_actions_group.setEnabled(editable_project);
m_zoom_actions_group.setEnabled(opened_diagram);
m_select_actions_group.setEnabled(opened_diagram);
m_add_item_actions_group.setEnabled(editable_diagram);
m_row_column_actions_group.setEnabled(editable_diagram);
slot_updateUndoStack();
slot_updateModeActions();
slot_updatePasteAction();
slot_updateComplexActions();
@@ -1181,17 +1173,12 @@ void QETDiagramEditor::slot_updateActions()
* @brief QETDiagramEditor::slot_updateUndoStack
* Update the undo stack view
*/
void QETDiagramEditor::slot_updateUndoStack()
{
void QETDiagramEditor::slot_updateUndoStack() {
ProjectView *pv = currentProject();
if (pv)
{
if (pv && can_update_actions) {
undo_group.setActiveStack(pv->project()->undoStack());
save_file -> setEnabled (undo_group.activeStack() -> count() && !pv -> project() -> isReadOnly());
}
else
{
save_file -> setDisabled(true);
undo -> setEnabled (undo_group.canUndo());
redo -> setEnabled (undo_group.canRedo());
}
}
@@ -1223,14 +1210,13 @@ void QETDiagramEditor::slot_updateComplexActions() {
// actions ayant besoin de textes selectionnes
int selected_texts = dv ? (dv -> diagram() -> selectedTexts().count()) : 0;
int selected_conductor_texts = dv ? (dv -> diagram() -> selectedConductorTexts().count()) : 0;
int selected_element_texts = dv ? (dv -> diagram() -> selectedElementTexts().count()) : 0;
rotate_texts -> setEnabled(editable_diagram && selected_texts);
// actions need only one editable item
int selected_image = dv ? dv -> diagram() -> selectedContent().count(DiagramContent::Images) : 0;
int selected_shape = dv ? dv -> diagram() -> selectedContent().count(DiagramContent::Shapes) : 0;
int selected_editable = selected_elements_count + (selected_texts - selected_conductor_texts - selected_element_texts) + selected_image + selected_shape;
int selected_editable = selected_elements_count + (selected_texts - selected_conductor_texts) + selected_image + selected_shape;
if (selected_editable == 1) {
edit_selection -> setEnabled(true);
@@ -1297,46 +1283,65 @@ void QETDiagramEditor::slot_updatePasteAction() {
}
/**
* @brief QETDiagramEditor::addProjectView
* Add a new project view to workspace and
* build the connection between the projectview / project and this QETDiagramEditor.
* @param project_view, project view to add
*/
void QETDiagramEditor::addProjectView(ProjectView *project_view)
{
Ajoute un projet dans l'espace de travail
@param project_view Le projet a ajouter dans l'espace de travail
*/
void QETDiagramEditor::addProjectView(ProjectView *project_view) {
if (!project_view) return;
foreach(DiagramView *dv, project_view -> diagrams())
diagramWasAdded(dv);
//Manage the close event of project
connect(project_view, SIGNAL(projectClosed(ProjectView*)), this, SLOT(projectWasClosed(ProjectView *)));
//Manage the adding of diagram
connect(project_view, SIGNAL(diagramAdded(DiagramView *)), this, SLOT(diagramWasAdded(DiagramView *)));
if (QETProject *project = project_view -> project())
connect(project, SIGNAL(readOnlyChanged(QETProject *, bool)), this, SLOT(slot_updateActions()));
//Manage request for edit or find element and titleblock
connect(project_view, SIGNAL(findElementRequired(const ElementsLocation &)), this, SLOT(findElementInPanel(const ElementsLocation &)));
connect(project_view, SIGNAL(editElementRequired(const ElementsLocation &)), this, SLOT(editElementInEditor(const ElementsLocation &)));
connect(project_view, SIGNAL(editTitleBlockTemplate(const TitleBlockTemplateLocation &, bool)), QETApp::instance(), SLOT(openTitleBlockTemplate(TitleBlockTemplateLocation, bool)));
// display error messages sent by the project view
connect(project_view, SIGNAL(errorEncountered(QString)), this, SLOT(showError(const QString &)));
//We maximise the new window if the current window is inexistent or maximized
// on maximise la nouvelle fenetre si la fenetre en cours est inexistante ou bien maximisee
QWidget *current_window = workspace.activeSubWindow();
bool maximise = ((!current_window) || (current_window -> windowState() & Qt::WindowMaximized));
//Add the new window
// ajoute la fenetre
QMdiSubWindow *sub_window = workspace.addSubWindow(project_view);
sub_window -> setWindowIcon(project_view -> windowIcon());
sub_window -> systemMenu() -> clear();
//Display the new window
// lie les schemas du projet a l'editeur :
// quand on change de schemas a l'interieur d'un projet, on met a jour les menus
connect(project_view, SIGNAL(diagramActivated(DiagramView *)), this, SLOT(slot_updateWindowsMenu()));
connect(project_view, SIGNAL(diagramActivated(DiagramView *)), this, SLOT(slot_updateActions()));
//connect(project_view->project(), SIGNAL(projectModified(QETProject*,bool)), save_file, SLOT(setEnabled(bool)));
foreach(DiagramView *dv, project_view -> diagrams()) {
diagramWasAdded(dv);
}
// gere la fermeture du projet
connect(project_view, SIGNAL(projectClosed(ProjectView*)), this, SLOT(projectWasClosed(ProjectView *)));
// gere l'ajout et le retrait de schema du projet
connect(project_view, SIGNAL(diagramAdded(DiagramView *)), this, SLOT(diagramWasAdded(DiagramView *)));
connect(project_view, SIGNAL(diagramAdded(DiagramView *)), this, SLOT(slot_updateActions()));
connect(project_view, SIGNAL(diagramAboutToBeRemoved(DiagramView *)), this, SLOT(diagramIsAboutToBeRemoved(DiagramView *)));
connect(project_view, SIGNAL(diagramRemoved(DiagramView *)), this, SLOT(diagramWasRemoved(DiagramView *)));
connect(project_view, SIGNAL(diagramRemoved(DiagramView *)), this, SLOT(slot_updateActions()));
if (QETProject *project = project_view -> project()) {
// on met aussi les menus a jour quand un projet passe en lecture seule ou non
connect(project, SIGNAL(readOnlyChanged(QETProject *, bool)), this, SLOT(slot_updateActions()));
}
// gere les demandes consistant a retrouver un element dans le panel
connect(project_view, SIGNAL(findElementRequired(const ElementsLocation &)), this, SLOT(findElementInPanel(const ElementsLocation &)));
// gere les demandes pour l'edition d'un element
connect(project_view, SIGNAL(editElementRequired(const ElementsLocation &)), this, SLOT(editElementInEditor(const ElementsLocation &)));
// handles requests to edit and/or duplicate an existing title block template
connect(
project_view, SIGNAL(editTitleBlockTemplate(const TitleBlockTemplateLocation &, bool)),
QETApp::instance(), SLOT(openTitleBlockTemplate(TitleBlockTemplateLocation, bool))
);
// display error messages sent by the project view
connect(project_view, SIGNAL(errorEncountered(QString)), this, SLOT(showError(const QString &)));
// affiche la fenetre
if (maximise) project_view -> showMaximized();
else project_view -> show();
slot_updateActions();
}
/**
@@ -1661,7 +1666,6 @@ void QETDiagramEditor::projectWasClosed(ProjectView *project_view) {
QETProject *project = project_view -> project();
if (project) {
pa -> elementsPanel().projectWasClosed(project);
undo_group.removeStack(project -> undoStack());
QETApp::unregisterProject(project);
}
project_view -> deleteLater();
@@ -1788,46 +1792,6 @@ void QETDiagramEditor::moveDiagramDown(Diagram *diagram) {
}
}
/**
Change l'ordre des schemas d'un projet, en decalant le schema vers le haut /
la gauche x10
@param diagram Schema a decaler vers le haut / la gauche x10
*/
void QETDiagramEditor::moveDiagramUpx10(Diagram *diagram) {
if (!diagram) return;
// recupere le projet contenant le schema
if (QETProject *diagram_project = diagram -> project()) {
if (diagram_project -> isReadOnly()) return;
// recupere la vue sur ce projet
if (ProjectView *project_view = findProject(diagram_project)) {
project_view -> moveDiagramUpx10(diagram);
}
}
}
/**
Change l'ordre des schemas d'un projet, en decalant le schema vers le bas /
la droite x10
@param diagram Schema a decaler vers le bas / la droite x10
*/
void QETDiagramEditor::moveDiagramDownx10(Diagram *diagram) {
if (!diagram) return;
// recupere le projet contenant le schema
if (QETProject *diagram_project = diagram -> project()) {
if (diagram_project -> isReadOnly()) return;
// recupere la vue sur ce projet
if (ProjectView *project_view = findProject(diagram_project)) {
project_view -> moveDiagramDownx10(diagram);
}
}
}
/**
Nettoie le projet courant
*/
@@ -1853,6 +1817,7 @@ void QETDiagramEditor::nomenclatureProject() {
void QETDiagramEditor::removeDiagramFromProject() {
if (ProjectView *current_project = currentProject()) {
if (DiagramView *current_diagram = current_project -> currentDiagram()) {
can_update_actions = false;
bool isFolioList = false;
// if diagram to remove is a "folio list sheet", then set a flag.
@@ -1884,17 +1849,36 @@ void QETDiagramEditor::removeDiagramFromProject() {
}
/**
* @brief QETDiagramEditor::diagramWasAdded
* Manage the adding of diagram view in a project
* @param dv, added diagram view
*/
void QETDiagramEditor::diagramWasAdded(DiagramView *dv)
{
Gere l'ajout d'un schema dans un projet
@param dv DiagramView concerne
*/
void QETDiagramEditor::diagramWasAdded(DiagramView *dv) {
// quand on change qqc a l'interieur d'un schema, on met a jour les menus
undo_group.addStack(&(dv -> diagram() -> undoStack()));
connect(dv, SIGNAL(selectionChanged()), this, SLOT(slot_updateComplexActions()));
connect(dv, SIGNAL(modeChanged()), this, SLOT(slot_updateModeActions()));
connect(dv, SIGNAL(itemAdded()), this, SLOT(addItemFinish()));
}
/**
Gere le retrait d'un schema dans un projet avant que le retrait ne soit effectif
@param dv DiagramView concerne
*/
void QETDiagramEditor::diagramIsAboutToBeRemoved(DiagramView *dv) {
undo_group.removeStack(&(dv -> diagram() -> undoStack()));
can_update_actions = false;
}
/**
Gere le retrait d'un schema dans un projet apres que le retrait soit effectif
@param dv DiagramView concerne
*/
void QETDiagramEditor::diagramWasRemoved(DiagramView *dv) {
Q_UNUSED(dv);
can_update_actions = true;
slot_updateUndoStack();
}
/**
@param location Emplacement de l'element a retrouver dans le panel
d'elements.
@@ -1986,28 +1970,3 @@ void QETDiagramEditor::showError(const QString &error) {
void QETDiagramEditor::addItemFinish() {
m_add_item_actions_group.checkedAction()->setChecked(false);
}
/**
* @brief QETDiagramEditor::subWindowActivated
* Slot used to update menu and undo stack when subwindows of MDIarea was activated
* @param subWindows
*/
void QETDiagramEditor::subWindowActivated(QMdiSubWindow *subWindows)
{
Q_UNUSED(subWindows);
slot_updateActions();
slot_updateWindowsMenu();
}
/**
* @brief QETDiagramEditor::activeUndoStackCleanChanged
* Enable the QAction save_file when @clean is set to false
* @clean at true do nothing;
* @param clean
*/
void QETDiagramEditor::activeUndoStackCleanChanged(bool clean) {
if (!clean) {
save_file -> setEnabled(true);
}
}

View File

@@ -146,11 +146,11 @@ class QETDiagramEditor : public QETMainWindow {
void removeDiagramFromProject();
void moveDiagramUp(Diagram *);
void moveDiagramDown(Diagram *);
void moveDiagramUpx10(Diagram *);
void moveDiagramDownx10(Diagram *);
void cleanCurrentProject();
void nomenclatureProject();
void diagramWasAdded(DiagramView *);
void diagramIsAboutToBeRemoved(DiagramView *);
void diagramWasRemoved(DiagramView *);
void findElementInPanel(const ElementsLocation &);
void findSelectedElementInPanel();
void editElementInEditor(const ElementsLocation &);
@@ -158,10 +158,6 @@ class QETDiagramEditor : public QETMainWindow {
void showError(const QETResult &);
void showError(const QString &);
void addItemFinish();
void subWindowActivated(QMdiSubWindow *subWindows);
private slots:
void activeUndoStackCleanChanged (bool clean);
// attributes
public:
@@ -233,5 +229,6 @@ class QETDiagramEditor : public QETMainWindow {
QToolBar *diagram_bar;
QToolBar *m_add_item_toolBar;
QUndoGroup undo_group;
bool can_update_actions;
};
#endif

View File

@@ -37,7 +37,7 @@ CommentItem::CommentItem(Element *elmt) :
connect(elmt, SIGNAL(yChanged()), this, SLOT (autoPos()));
connect(elmt, SIGNAL(rotationChanged()), this, SLOT (autoPos()));
}
connect(elmt, SIGNAL(elementInfoChange(DiagramContext,DiagramContext)), this, SLOT (updateLabel()));
connect(elmt, SIGNAL(elementInfoChange(DiagramContext)), this, SLOT (updateLabel()));
updateLabel();
}
@@ -121,7 +121,7 @@ void CommentItem::updateLabel() {
painter.setPen (pen);
painter.setFont (QETApp::diagramTextsFont(6));
QRectF drawing_rect(QPointF(0,0), QSizeF(70, 100));
QRectF drawing_rect(QPointF(0,0), QSizeF(100, 100));
QRectF text_bounding;
painter.drawText(drawing_rect, Qt::TextWordWrap | Qt::AlignHCenter, m_comment, &text_bounding);
@@ -129,7 +129,6 @@ void CommentItem::updateLabel() {
text_bounding.adjust(-1,0,1,0); //adjust only for better visual
painter.drawRoundedRect(text_bounding, 2, 2);
prepareGeometryChange();
m_bounding_rect = text_bounding;
}

View File

@@ -39,12 +39,11 @@ QBrush Conductor::square_brush = QBrush(Qt::darkGreen);
@param p2 Seconde Borne a laquelle le conducteur est lie
@param parent_diagram QGraphicsScene a laquelle appartient le conducteur
*/
Conductor::Conductor(Terminal *p1, Terminal* p2) :
Conductor::Conductor(Terminal *p1, Terminal* p2, Diagram *parent_diagram) :
QObject(),
QGraphicsPathItem(0),
QGraphicsPathItem(0, parent_diagram),
terminal1(p1),
terminal2(p2),
bMouseOver(false),
destroyed_(false),
text_item(0),
segments(NULL),
@@ -92,6 +91,7 @@ Conductor::Conductor(Terminal *p1, Terminal* p2) :
// ajout du champ de texte editable
text_item = new ConductorTextItem(properties_.text, this);
text_item -> setFlag(QGraphicsItem::ItemStacksBehindParent);
calculateTextItemPosition();
connect(
text_item,
SIGNAL(diagramTextChanged(DiagramTextItem *, const QString &, const QString &)),
@@ -444,10 +444,6 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi
}
}
// if mouse over conductor change size
if ( bMouseOver ) conductor_pen.setWidthF(3.0);
else conductor_pen.setWidthF(1.0);
// affectation du QPen et de la QBrush modifies au QPainter
qp -> setBrush(conductor_brush);
QPen final_conductor_pen = conductor_pen;
@@ -681,6 +677,7 @@ void Conductor::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
if (!(e -> modifiers() & Qt::ControlModifier)) {
QGraphicsPathItem::mouseReleaseEvent(e);
}
calculateTextItemPosition();
}
/**
@@ -690,8 +687,9 @@ void Conductor::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
void Conductor::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
Q_UNUSED(e);
segments_squares_scale_ = 2.0;
bMouseOver = true;
if (isSelected()) {
update();
}
}
/**
@@ -701,23 +699,24 @@ void Conductor::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
void Conductor::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
Q_UNUSED(e);
segments_squares_scale_ = 1.0;
if (isSelected()) {
update();
bMouseOver = false;
}
}
/**
* @brief Conductor::hoverMoveEvent conductor
* @param e QGraphicsSceneHoverEvent describing the event
*/
Gere les mouvements de souris au dessus du conducteur
@param e Le QGraphicsSceneHoverEvent decrivant l'evenement
*/
void Conductor::hoverMoveEvent(QGraphicsSceneHoverEvent *e) {
/*
if (isSelected()) {
QPointF hover_point = mapFromScene(e -> pos()) + scenePos();
QPointF hover_point = mapFromScene(e -> pos());
ConductorSegment *segment = segments;
bool cursor_set = false;
while (segment -> hasNextSegment()) {
if (hasClickedOn(hover_point, segment -> secondPoint())) {
setCursor(Qt::ForbiddenCursor);
setCursor(Qt::CrossCursor);
cursor_set = true;
} else if (hasClickedOn(hover_point, segment -> middle())) {
setCursor(segment -> isVertical() ? Qt::SplitHCursor : Qt::SplitVCursor);
@@ -727,7 +726,7 @@ void Conductor::hoverMoveEvent(QGraphicsSceneHoverEvent *e) {
}
if (!cursor_set) setCursor(Qt::ArrowCursor);
}
*/
QGraphicsPathItem::hoverMoveEvent(e);
}
@@ -952,66 +951,27 @@ bool Conductor::hasClickedOn(QPointF press_point, QPointF point) const {
}
/**
* @brief Conductor::fromXml
* Load the conductor and her information from xml element
* @param e
* @return true is loading success else return false
*/
bool Conductor::fromXml(QDomElement &e) {
setPos(e.attribute("x", 0).toDouble(),
e.attribute("y", 0).toDouble());
bool return_ = pathFromXml(e);
text_item -> fromXml(e);
properties_. fromXml(e);
readProperties();
return return_;
}
/**
Exporte les caracteristiques du conducteur sous forme d'une element XML.
@param d Le document XML a utiliser pour creer l'element XML
@param table_adr_id Hash stockant les correspondances entre les ids des
bornes dans le document XML et leur adresse en memoire
@return Un element XML representant le conducteur
Charge les caracteristiques du conducteur depuis un element XML.
@param e Un element XML
@return true si le chargement a reussi, false sinon
*/
QDomElement Conductor::toXml(QDomDocument &d, QHash<Terminal *, int> &table_adr_id) const {
QDomElement e = d.createElement("conductor");
e.setAttribute("x", pos().x());
e.setAttribute("y", pos().y());
e.setAttribute("terminal1", table_adr_id.value(terminal1));
e.setAttribute("terminal2", table_adr_id.value(terminal2));
// on n'exporte les segments du conducteur que si ceux-ci ont
// ete modifies par l'utilisateur
if (modified_path) {
// parcours et export des segments
QDomElement current_segment;
foreach(ConductorSegment *segment, segmentsList()) {
current_segment = d.createElement("segment");
current_segment.setAttribute("orientation", segment -> isHorizontal() ? "horizontal" : "vertical");
current_segment.setAttribute("length", QString("%1").arg(segment -> length()));
e.appendChild(current_segment);
bool Conductor::fromXml(QDomElement &e) {
// recupere la "configuration" du conducteur
properties_.fromXml(e);
readProperties();
qreal user_pos_x, user_pos_y;
if (
QET::attributeIsAReal(e, "userx", &user_pos_x) &&
QET::attributeIsAReal(e, "usery", &user_pos_y)
) {
text_item -> forceMovedByUser(true);
text_item -> setPos(user_pos_x, user_pos_y);
}
if (e.hasAttribute("rotation")) {
text_item -> setRotationAngle(e.attribute("rotation").toDouble());
text_item -> forceRotateByUser(true);
}
// Export the properties and text
properties_. toXml(e);
text_item -> toXml(e);
return(e);
}
/**
* @brief Conductor::pathFromXml
* Generate the path from xml file
* @param e
* @return true if generate path success else return false
*/
bool Conductor::pathFromXml(const QDomElement &e) {
// parcourt les elements XML "segment" et en extrait deux listes de longueurs
// les segments non valides sont ignores
QList<qreal> segments_x, segments_y;
@@ -1037,12 +997,8 @@ bool Conductor::pathFromXml(const QDomElement &e) {
}
}
//If there isn't segment we generate automatic path and return true
if (!segments_x.size()) {
generateConductorPath(terminal1 -> dockConductor(), terminal1 -> orientation(), terminal2 -> dockConductor(), terminal2 -> orientation());
return(true);
}
// s'il n'y a pas de segments, on renvoie true
if (!segments_x.size()) return(true);
// les longueurs recueillies doivent etre coherentes avec les positions des bornes
qreal width = 0.0, height = 0.0;
foreach (qreal t, segments_x) width += t;
@@ -1064,7 +1020,7 @@ bool Conductor::pathFromXml(const QDomElement &e) {
/* on recree les segments a partir des donnes XML */
// cree la liste de points
QList<QPointF> points_list;
points_list << mapFromScene(t1);
points_list << t1;
for (int i = 0 ; i < segments_x.size() ; ++ i) {
points_list << QPointF(
points_list.last().x() + segments_x.at(i),
@@ -1082,6 +1038,43 @@ bool Conductor::pathFromXml(const QDomElement &e) {
return(true);
}
/**
Exporte les caracteristiques du conducteur sous forme d'une element XML.
@param d Le document XML a utiliser pour creer l'element XML
@param table_adr_id Hash stockant les correspondances entre les ids des
bornes dans le document XML et leur adresse en memoire
@return Un element XML representant le conducteur
*/
QDomElement Conductor::toXml(QDomDocument &d, QHash<Terminal *, int> &table_adr_id) const {
QDomElement e = d.createElement("conductor");
e.setAttribute("terminal1", table_adr_id.value(terminal1));
e.setAttribute("terminal2", table_adr_id.value(terminal2));
// on n'exporte les segments du conducteur que si ceux-ci ont
// ete modifies par l'utilisateur
if (modified_path) {
// parcours et export des segments
QDomElement current_segment;
foreach(ConductorSegment *segment, segmentsList()) {
current_segment = d.createElement("segment");
current_segment.setAttribute("orientation", segment -> isHorizontal() ? "horizontal" : "vertical");
current_segment.setAttribute("length", QString("%1").arg(segment -> length()));
e.appendChild(current_segment);
}
}
// exporte la "configuration" du conducteur
properties_.toXml(e);
if (text_item -> wasRotateByUser()) {
e.setAttribute("rotation", QString("%1").arg(text_item -> rotationAngle()));
}
if (text_item -> wasMovedByUser()) {
e.setAttribute("userx", QString("%1").arg(text_item -> pos().x()));
e.setAttribute("usery", QString("%1").arg(text_item -> pos().y()));
}
return(e);
}
/// @return les segments de ce conducteur
const QList<ConductorSegment *> Conductor::segmentsList() const {
if (segments == NULL) return(QList<ConductorSegment *>());
@@ -1335,11 +1328,8 @@ void Conductor::setText(const QString &t) {
* @param p : properties
*/
void Conductor::setProperties(const ConductorProperties &p) {
if (properties_ != p)
{
properties_ = p;
readProperties();
}
}
/**

View File

@@ -43,7 +43,7 @@ class Conductor : public QObject, public QGraphicsPathItem {
// constructors, destructor
public:
Conductor(Terminal *, Terminal *);
Conductor(Terminal *, Terminal *, Diagram * = 0);
virtual ~Conductor();
private:
@@ -92,15 +92,9 @@ class Conductor : public QObject, public QGraphicsPathItem {
bool containsPoint(const QPointF &) const;
QString text() const;
void setText(const QString &);
public:
static bool valideXml (QDomElement &);
bool fromXml (QDomElement &);
QDomElement toXml (QDomDocument &, QHash<Terminal *, int> &) const;
private:
bool pathFromXml(const QDomElement &);
public:
static bool valideXml(QDomElement &);
bool fromXml(QDomElement &);
QDomElement toXml(QDomDocument &, QHash<Terminal *, int> &) const;
const QList<ConductorSegment *> segmentsList() const;
void setProperties(const ConductorProperties &);
ConductorProperties properties() const;
@@ -130,8 +124,6 @@ class Conductor : public QObject, public QGraphicsPathItem {
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *);
virtual QVariant itemChange(GraphicsItemChange, const QVariant &);
bool bMouseOver;
private:
/// Functional properties
ConductorProperties properties_;

View File

@@ -25,14 +25,12 @@
@param parent_conductor Conducteur auquel ce texte est rattache
@param parent_diagram Schema auquel ce texte et son conducteur parent sont rattaches
*/
ConductorTextItem::ConductorTextItem(Conductor *parent_conductor) :
DiagramTextItem(parent_conductor),
ConductorTextItem::ConductorTextItem(Conductor *parent_conductor, Diagram *parent_diagram) :
DiagramTextItem(parent_conductor, parent_diagram),
parent_conductor_(parent_conductor),
moved_by_user_(false),
rotate_by_user_(false)
{
setAcceptsHoverEvents(true);
}
{}
/**
Constructeur
@@ -40,8 +38,8 @@ ConductorTextItem::ConductorTextItem(Conductor *parent_conductor) :
@param parent_conductor Conducteur auquel ce texte est rattache
@param parent_diagram Schema auquel ce texte et son conducteur parent sont rattaches
*/
ConductorTextItem::ConductorTextItem(const QString &text, Conductor *parent_conductor) :
DiagramTextItem(text, parent_conductor),
ConductorTextItem::ConductorTextItem(const QString &text, Conductor *parent_conductor, Diagram *parent_diagram) :
DiagramTextItem(text, parent_conductor, parent_diagram),
parent_conductor_(parent_conductor),
moved_by_user_(false),
rotate_by_user_(false)
@@ -62,36 +60,38 @@ Conductor *ConductorTextItem::parentConductor() const {
}
/**
* @brief ConductorTextItem::fromXml
* Read the properties stored in the xml element given in parameter
* @param e
*/
Permet de lire le texte a mettre dans le champ a partir d'un element XML.
Cette methode se base sur la position du champ pour assigner ou non la
valeur a ce champ.
@param e L'element XML representant le champ de texte
*/
void ConductorTextItem::fromXml(const QDomElement &e) {
if (e.hasAttribute("userx")) {
setPos(e.attribute("userx").toDouble(),
e.attribute("usery").toDouble());
moved_by_user_ = true;
}
if (e.hasAttribute("rotation")) {
setRotation(e.attribute("rotation").toDouble());
rotate_by_user_ = true;
setPlainText(e.attribute("text"));
qreal user_pos_x, user_pos_y;
if (
QET::attributeIsAReal(e, "userx", &user_pos_x) &&
QET::attributeIsAReal(e, "usery", &user_pos_y)
) {
setPos(user_pos_x, user_pos_y);
}
setRotationAngle(e.attribute("rotation").toDouble());
}
/**
* @brief ConductorTextItem::toXml
* Export the properties of this text in the attribute of the xml element given in parameter
* The properties exported are position and rotation (only if moved or rotate by user)
* @param xml
*/
void ConductorTextItem::toXml(QDomElement &xml) const {
if (moved_by_user_) {
xml.setAttribute("userx", QString("%1").arg(pos().x()));
xml.setAttribute("usery", QString("%1").arg(pos().y()));
}
if (rotate_by_user_) {
xml.setAttribute("rotation", QString("%1").arg(rotation()));
@param document Le document XML a utiliser
@return L'element XML representant ce champ de texte
*/
QDomElement ConductorTextItem::toXml(QDomDocument &document) const {
QDomElement result = document.createElement("input");
result.setAttribute("userx", QString("%1").arg(pos().x()));
result.setAttribute("usery", QString("%1").arg(pos().y()));
result.setAttribute("text", toPlainText());
if (rotationAngle()) {
result.setAttribute("rotation", QString("%1").arg(rotationAngle()));
}
return(result);
}
/**
@@ -203,40 +203,3 @@ void ConductorTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
QGraphicsTextItem::mouseReleaseEvent(e);
}
}
/**
When mouse over element
change bMouseOver to true (used in paint() function )
@param e QGraphicsSceneHoverEvent
*/
void ConductorTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
Q_UNUSED(e);
bMouseOver = true;
QString str_ToolTip = toPlainText();
setToolTip( str_ToolTip );
update();
}
/**
When mouse over element leave the position
change bMouseOver to false(used in paint() function )
@param e QGraphicsSceneHoverEvent
*/
void ConductorTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
Q_UNUSED(e);
//qDebug() << "Leave mouse over";
bMouseOver = false;
update();
}
/**
Do nothing default function .
@param e QGraphicsSceneHoverEvent
*/
void ConductorTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *e) {
Q_UNUSED(e);
QGraphicsTextItem::hoverMoveEvent(e);
}

View File

@@ -31,8 +31,8 @@ class ConductorTextItem : public DiagramTextItem {
// constructors, destructor
public:
ConductorTextItem(Conductor * = 0);
ConductorTextItem(const QString &, Conductor * = 0);
ConductorTextItem(Conductor * = 0, Diagram * = 0);
ConductorTextItem(const QString &, Conductor * = 0, Diagram * = 0);
virtual ~ConductorTextItem();
private:
ConductorTextItem(const ConductorTextItem &);
@@ -42,7 +42,7 @@ class ConductorTextItem : public DiagramTextItem {
enum { Type = UserType + 1006 };
Conductor *parentConductor() const;
virtual void fromXml(const QDomElement &);
virtual void toXml (QDomElement &xml) const;
virtual QDomElement toXml(QDomDocument &) const;
// methods
public:
@@ -57,11 +57,6 @@ class ConductorTextItem : public DiagramTextItem {
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
protected:
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *);
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *);
// attributes
private:
Conductor *parent_conductor_;

View File

@@ -32,20 +32,14 @@
* @brief CrossRefItem::CrossRefItem
* Default constructor
* @param elmt element to display the cross ref and also parent item.
* elmt must be in a diagram
*/
/**
* @brief CrossRefItem::CrossRefItem
* @param elmt
*/
CrossRefItem::CrossRefItem(Element *elmt) :
QGraphicsObject(elmt),
m_element (elmt)
{
Q_ASSERT_X(elmt->diagram(), "CrossRefItem constructor", "Parent element is not in a diagram");
m_properties = elmt->diagram()->defaultXRefProperties(elmt->kindInformations()["type"].toString());
connect(elmt, SIGNAL(elementInfoChange(DiagramContext)), this, SLOT(updateLabel()));
connect(elmt -> diagram() -> project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
connect(elmt -> diagram() -> project(), SIGNAL(diagramRemoved(QETProject*,Diagram*)), this, SLOT(updateLabel()));
connect(elmt -> diagram(), SIGNAL(XRefPropertiesChanged()), this, SLOT(updateProperties()));
@@ -112,13 +106,6 @@ QString CrossRefItem::elementPositionText(const Element *elmt, const bool &add_p
void CrossRefItem::allElementsPositionText(QString &no_str, QString &nc_str, const bool &add_prefix) const {
QString *tmp_str;
foreach (Element *elmt, m_element->linkedElements()) {
//We continue if element is a power contact and xref propertie
//is set to don't show power contact
if (m_properties.displayHas() == XRefProperties::Cross &&
!m_properties.showPowerContact() &&
elmt -> kindInformations()["type"].toString() == "power")
continue;
QString state = elmt->kindInformations()["state"].toString();
//NO and NC are displayed in single place in the cross
@@ -172,7 +159,6 @@ void CrossRefItem::updateProperties() {
void CrossRefItem::updateLabel() {
//init the shape and bounding rect
m_shape_path = QPainterPath();
prepareGeometryChange();
m_bounding_rect = QRectF();
//init the painter
@@ -197,6 +183,8 @@ void CrossRefItem::updateLabel() {
qp.end();
autoPos();
update();
checkMustShow();
}
/**
@@ -286,23 +274,18 @@ void CrossRefItem::buildHeaderContact() {
* The cross ref item is drawing according to the size of the cross bounding rect.
*/
void CrossRefItem::setUpCrossBoundingRect(QPainter &painter) {
//this is the default size of cross ref item
QRectF default_bounding(0, 0, 40, header + cross_min_heigth);
//No need to calcul if nothing is linked
if (!m_element->isFree()) {
QString no_str, nc_str;
allElementsPositionText(no_str, nc_str, true);
//There is no string to display, we return now
if (no_str.isEmpty() && nc_str.isEmpty()) return;
//this is the default size of cross ref item
QRectF default_bounding(0, 0, 40, header + cross_min_heigth);
/*
* Adjust the size of default_bounding if needed.
* We calcule the size by using a single text
* because in the method fillCrossRef, the text is draw like this (aka single text)
*/
//Adjust the size of default_bounding if needed.
//We calcule the size by using a single text
//because in the method fillCrossRef, the text is draw like this (aka single text)
//Adjust according to the NO
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, no_str);
@@ -317,11 +300,10 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter) {
default_bounding.setHeight(bounding.height() + header); //adjust the heigth
if (bounding.width() > default_bounding.width()/2)
default_bounding.setWidth(bounding.width()*2); //adjust the width
}
m_shape_path.addRect(default_bounding);
prepareGeometryChange();
m_bounding_rect = default_bounding;
}
}
/**
@@ -333,9 +315,6 @@ void CrossRefItem::drawHasCross(QPainter &painter) {
//calcul the size of the cross
setUpCrossBoundingRect(painter);
//Bounding rect is empty that mean there's no contact to draw
if (boundingRect().isEmpty()) return;
//draw the cross
QRectF br = boundingRect();
painter.drawLine(br.width()/2, 0, br.width()/2, br.height()); //vertical line
@@ -358,8 +337,6 @@ void CrossRefItem::drawHasCross(QPainter &painter) {
* @param painter painter to use
*/
void CrossRefItem::drawHasContacts(QPainter &painter) {
if (m_element -> isFree()) return;
m_drawed_contacts = 0;
//Draw each linked contact
@@ -384,7 +361,6 @@ void CrossRefItem::drawHasContacts(QPainter &painter) {
}
QRectF br(0, 0, 50, m_drawed_contacts*10+4);
prepareGeometryChange();
m_bounding_rect = br;
m_shape_path.addRect(br);
}
@@ -516,6 +492,8 @@ void CrossRefItem::fillCrossRef(QPainter &painter) {
rect_.moveTopLeft(QPointF (middle_cross, header));
painter.drawText(rect_, Qt::AlignTop | Qt::AlignRight, nc_str);
}
/**
@@ -524,29 +502,64 @@ void CrossRefItem::fillCrossRef(QPainter &painter) {
* @param painter painter to use for draw the text
*/
void CrossRefItem::AddExtraInfo(QPainter &painter) {
QString comment = m_element -> elementInformations()["comment"].toString();
bool must_show = m_element -> elementInformations().keyMustShow("comment");
QString comment = m_element-> elementInformations()["comment"].toString();
bool must_show = m_element-> elementInformations().keyMustShow("comment");
if (!comment.isEmpty() && must_show) {
painter.save();
painter.setFont(QETApp::diagramTextsFont(6));
QRectF r, text_bounding;
qreal center = boundingRect().center().x();
r = QRectF(QPointF(center - 35, boundingRect().bottom()),
QPointF(center + 35, boundingRect().bottom() + 50));
r = QRectF(QPointF(center - 50, boundingRect().bottom()),
QPointF(center + 50, boundingRect().bottom() + 50));
painter.drawText(r, Qt::TextWordWrap | Qt::AlignHCenter, comment, &text_bounding);
text_bounding.adjust(-1,0,1,0); //adjust only for better visual
m_shape_path.addRect(text_bounding);
prepareGeometryChange();
m_bounding_rect = m_bounding_rect.united(text_bounding);
painter.drawRoundedRect(text_bounding, 2, 2);
painter.restore();
}
}
/**
* @brief CrossRefItem::checkMustShow
* Check the propertie of this Xref for know if we
* must to be show or not
*/
void CrossRefItem::checkMustShow() {
//We always show Xref when is displayed has contact
if (m_properties.displayHas() == XRefProperties::Contacts) {
this->show();
return;
}
//if Xref is display has cross and we must to don't show power contact, check it
else if (m_properties.displayHas() == XRefProperties::Cross && !m_properties.showPowerContact()) {
bool power = false;
foreach (Element *elmt, m_element->linkedElements()) {
// contact checked isn't power, show this xref and return;
if (elmt->kindInformations()["type"].toString() != "power") {
this->show();
return;
} else {
power = true;
}
}
if (power) {
this->hide();
return;
}
}
//By default, show this Xref
else {
this->show();
return;
}
}
/**
* @brief CrossRefItem::setTextParent
* Set the text field tagged "label" of m_element
@@ -555,6 +568,6 @@ void CrossRefItem::AddExtraInfo(QPainter &painter) {
void CrossRefItem::setTextParent() {
ElementTextItem *eti = m_element->taggedText("label");
if (eti) setParentItem(eti);
else qDebug() << "CrossRefItem,no text tagged 'label' found to set has parent";
else qDebug() << "CrossRefItem,no texte tagged 'label' found to set has parent";
}

View File

@@ -82,6 +82,7 @@ class CrossRefItem : public QGraphicsObject
void drawContact (QPainter &painter, int flags, QString str = QString());
void fillCrossRef (QPainter &painter);
void AddExtraInfo (QPainter &painter);
void checkMustShow ();
void setTextParent ();
//Attributes

View File

@@ -44,8 +44,8 @@
- 7 : L'analyse d'un element XML decrivant une partie du dessin de l'element a echoue
- 8 : Aucune partie du dessin n'a pu etre chargee
*/
CustomElement::CustomElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
FixedElement(qgi),
CustomElement::CustomElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
FixedElement(qgi, s),
elmt_state(-1),
location_(location),
forbid_antialiasing(false)
@@ -137,12 +137,13 @@ bool CustomElement::buildFromXml(const QDomElement &xml_def_elmt, int *state) {
return(false);
}
// on peut d'ores et deja specifier la taille et le hotspot
setSize(w, h);
setHotspot(QPoint(hot_x, hot_y));
setInternalConnections(xml_def_elmt.attribute("ic") == "true");
//the definition must have childs
if (xml_def_elmt.firstChild().isNull())
{
// la definition est supposee avoir des enfants
if (xml_def_elmt.firstChild().isNull()) {
if (state) *state = 6;
return(false);
}
@@ -758,7 +759,7 @@ Terminal *CustomElement::parseTerminal(QDomElement &e) {
else if (e.attribute("orientation") == "e") terminalo = Qet::East;
else if (e.attribute("orientation") == "w") terminalo = Qet::West;
else return(0);
Terminal *new_terminal = new Terminal(terminalx, terminaly, terminalo, this);
Terminal *new_terminal = new Terminal(terminalx, terminaly, terminalo, this, qobject_cast<Diagram *>(scene()));
new_terminal -> setZValue(420); // valeur arbitraire pour maintenir les bornes au-dessus des champs de texte
list_terminals << new_terminal;
return(new_terminal);

Some files were not shown because too many files have changed in this diff Show More