merge from testing
This commit is contained in:
commit
0a3830b6cd
|
@ -4,6 +4,30 @@ KiCad ChangeLog 2010
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
email address.
|
||||
|
||||
2011-Jan-1 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
================================================================================
|
||||
++new:
|
||||
* Added the basic structure to the Sweet parser in sch_part.cpp.
|
||||
* Got inheritence working off of the 'extends' keyword and PART::inherit()
|
||||
* Tossed the units support out of sweet.keywords, since we agreed to go dimensionless.
|
||||
++richio:
|
||||
* Added the problemInputLine support to PARSE_ERROR, so UI can show the
|
||||
offending line of bytes. Yes bytes, not even guaranteed to be characters.
|
||||
|
||||
|
||||
2010-dec-31 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
|
||||
================================================================================
|
||||
++all
|
||||
* Exclude boost header include path from Doxygen files.
|
||||
* Coding guide line and doxygen warning fixes.
|
||||
++EESchema
|
||||
* Rename OBJ_CMP_TO_LIST to SCH_REFERENCE.
|
||||
* Move code related to SCH_REFERENCE into the object where it belongs in hope
|
||||
that some day the object members can be made private instead of public.
|
||||
* Add GetComponent method to sheet path and sheet path list objects.
|
||||
* Move screen list code into screen list object.
|
||||
|
||||
|
||||
2010-Dec-28 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
================================================================================
|
||||
++richio:
|
||||
|
|
2
Doxyfile
2
Doxyfile
|
@ -88,7 +88,7 @@ INPUT_ENCODING = UTF-8
|
|||
FILE_PATTERNS = *.h \
|
||||
*.cpp
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE = include\boost
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_SYMBOLS =
|
||||
|
|
|
@ -1,43 +1,38 @@
|
|||
/* XPM */
|
||||
#ifndef XPMMAIN
|
||||
extern const char *annotate_down_right_xpm[];
|
||||
|
||||
#else
|
||||
const char *annotate_down_right_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 16 1",
|
||||
"@ c #89B09C",
|
||||
"O c #DB8F8F",
|
||||
". c #D4B7B7",
|
||||
"# c #85A794",
|
||||
"& c #72CAA2",
|
||||
"% c #9EB5A9",
|
||||
"- c #59CD99",
|
||||
"o c #E48080",
|
||||
"+ c #DC9897",
|
||||
" c none",
|
||||
"X c #D6A1A0",
|
||||
": c #E46264",
|
||||
"= c #64F6B4",
|
||||
"$ c #B4BEBC",
|
||||
"; c #69E5A9",
|
||||
"* c #81B79F",
|
||||
"= c #9A524C",
|
||||
": c #405814",
|
||||
"O c #932722",
|
||||
". c #BAA7A6",
|
||||
"X c #549454",
|
||||
"+ c #7C210E",
|
||||
" c None",
|
||||
"$ c #8C0505",
|
||||
"- c #AE7879",
|
||||
"@ c #097409",
|
||||
"* c #867258",
|
||||
"& c #308430",
|
||||
"# c #783820",
|
||||
"; c #9E3838",
|
||||
"% c #403F04",
|
||||
"o c #7FA57F",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" .X o. ",
|
||||
" .O +o. ",
|
||||
" .X O.X. ",
|
||||
" .O X. O. ",
|
||||
" @# $%%+. #% ",
|
||||
" && *=* $&&$",
|
||||
"@&-# %;*@ #;-@",
|
||||
" @@ .O% $ #@ ",
|
||||
" .X O. X. ",
|
||||
" .O O O. ",
|
||||
" .+O. X. ",
|
||||
" .: O. ",
|
||||
" $ ",
|
||||
" "
|
||||
" .X. oX ",
|
||||
"O+@#O .@@o ",
|
||||
"O$%$$ &@@o ",
|
||||
"*$$$= &@@@o ",
|
||||
".$$$. -#%&&@o ",
|
||||
" +$#.-;$$$+.X@o ",
|
||||
" *+*O$$$$$= X@o ",
|
||||
" o@X-=*:$$. X@o ",
|
||||
" o@X .@%$= $#@O;",
|
||||
" o@X &@$$. $$%$O",
|
||||
" o@X&@&$; =$$$-",
|
||||
" o@@@& -$$$ ",
|
||||
" X@@@. $$= ",
|
||||
" X@@o :+o ",
|
||||
" o@o X@o ",
|
||||
" o&. "
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -1,43 +1,38 @@
|
|||
/* XPM */
|
||||
#ifndef XPMMAIN
|
||||
extern const char *annotate_right_down_xpm[];
|
||||
|
||||
#else
|
||||
const char *annotate_right_down_xpm[] = {
|
||||
/* columns rows colors const chars-per-pixel */
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 16 1",
|
||||
"@ c #59CE99",
|
||||
"% c #D79E9C",
|
||||
"$ c #DC9393",
|
||||
"o c #FFB4B4",
|
||||
"* c #74CAA2",
|
||||
"X c #FFBDBD",
|
||||
". c #89AF9A",
|
||||
" c none",
|
||||
"- c #E46264",
|
||||
"# c #FFAAAC",
|
||||
"; c #64F6B4",
|
||||
"& c #84A794",
|
||||
"= c #69E5A9",
|
||||
": c #E08280",
|
||||
"O c #9BB5A5",
|
||||
"+ c #81B79F",
|
||||
"o c #A25451",
|
||||
"+ c #88A887",
|
||||
"* c #424004",
|
||||
"% c #308530",
|
||||
"@ c #8B0405",
|
||||
"# c #7C563C",
|
||||
" c None",
|
||||
"- c #B18B8C",
|
||||
"O c #BAA6A6",
|
||||
"X c #8E1C17",
|
||||
"$ c #549354",
|
||||
"; c #74381C",
|
||||
"& c #067205",
|
||||
". c #993F3B",
|
||||
"= c #748157",
|
||||
": c #AC7474",
|
||||
/* pixels */
|
||||
" . ",
|
||||
" XoooO+@Ooooo ",
|
||||
" #$%$&*=&%$%-X ",
|
||||
" X& X$ ",
|
||||
" X$o ",
|
||||
" $ ",
|
||||
" X O$o ",
|
||||
" O+=+ ",
|
||||
" O;@X ",
|
||||
" %.OX ",
|
||||
" %X ",
|
||||
" $o ",
|
||||
" $X X& ",
|
||||
" ::%$&*=.%$%$ ",
|
||||
" oooo.@@.oooo ",
|
||||
" . "
|
||||
" .XoO ",
|
||||
"+X@@@X#$$$$$$$+ ",
|
||||
"%&*@@@@&&&&&&&% ",
|
||||
"O#@@@X=+++$&&&O ",
|
||||
" X@.O O&&%O ",
|
||||
" O o@O+&&% ",
|
||||
" @@=&&$ ",
|
||||
" -@X&&= ",
|
||||
" o@**X@o ",
|
||||
" O@@@@@X- ",
|
||||
" +&@@@.- ",
|
||||
" +&&;oO X@.: ",
|
||||
"$&&&%%%%;@@@@;%+",
|
||||
"%&&&&&&&&*@@@@&%",
|
||||
" +++++++;@@@#++ ",
|
||||
" .X: "
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,169 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
sodipodi:docname="annotate_X.svg"
|
||||
inkscape:version="0.47 r22583"
|
||||
sodipodi:version="0.32"
|
||||
id="svg2"
|
||||
height="16.000000px"
|
||||
width="16.000000px"
|
||||
inkscape:export-filename="F:\kicad-launchpad\testing\bitmaps\sources\annotate_X.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000"
|
||||
version="1.1">
|
||||
<defs
|
||||
id="defs3">
|
||||
<inkscape:path-effect
|
||||
effect="skeletal"
|
||||
id="path-effect2834"
|
||||
is_visible="true"
|
||||
pattern="M 0,5 10,10 10,0 z"
|
||||
copytype="single_stretched"
|
||||
prop_scale="1"
|
||||
scale_y_rel="false"
|
||||
spacing="0"
|
||||
normal_offset="0"
|
||||
tang_offset="0"
|
||||
prop_units="false"
|
||||
vertical_pattern="false"
|
||||
fuse_tolerance="0" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 8 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="16 : 8 : 1"
|
||||
inkscape:persp3d-origin="8 : 5.3333333 : 1"
|
||||
id="perspective29" />
|
||||
<linearGradient
|
||||
id="linearGradient10731">
|
||||
<stop
|
||||
id="stop10733"
|
||||
offset="0.00000000"
|
||||
style="stop-color:#8787ff;stop-opacity:1.0000000;" />
|
||||
<stop
|
||||
id="stop10735"
|
||||
offset="1.0000000"
|
||||
style="stop-color:#ffffff;stop-opacity:1.0000000;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
y2="12.266582"
|
||||
x2="6.0408001"
|
||||
y1="17.050747"
|
||||
x1="11.430959"
|
||||
gradientTransform="scale(1.224745,0.816497)"
|
||||
id="linearGradient10737"
|
||||
xlink:href="#linearGradient10731"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
id="linearGradient2606">
|
||||
<stop
|
||||
style="stop-color:#ff7800;stop-opacity:1.0000000;"
|
||||
offset="0.00000000"
|
||||
id="stop2608" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1.0000000;"
|
||||
offset="1.0000000"
|
||||
id="stop2610" />
|
||||
</linearGradient>
|
||||
<inkscape:perspective
|
||||
id="perspective4268"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
inkscape:window-y="-4"
|
||||
inkscape:window-x="-4"
|
||||
inkscape:window-height="968"
|
||||
inkscape:window-width="1280"
|
||||
inkscape:guide-bbox="true"
|
||||
showguides="true"
|
||||
inkscape:guide-points="true"
|
||||
gridtolerance="0.50000000px"
|
||||
inkscape:grid-points="true"
|
||||
inkscape:grid-bbox="true"
|
||||
showgrid="true"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:document-units="px"
|
||||
inkscape:cy="8"
|
||||
inkscape:cx="2.8854733"
|
||||
inkscape:zoom="28.9375"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
borderopacity="1.0"
|
||||
bordercolor="#666666"
|
||||
pagecolor="#ffffff"
|
||||
id="base"
|
||||
inkscape:window-maximized="1">
|
||||
<inkscape:grid
|
||||
id="GridFromPre046Settings"
|
||||
type="xygrid"
|
||||
originx="0px"
|
||||
originy="0px"
|
||||
spacingx="0.50000000px"
|
||||
spacingy="0.50000000px"
|
||||
color="#0000ff"
|
||||
empcolor="#0000ff"
|
||||
opacity="0.2"
|
||||
empopacity="0.4"
|
||||
empspacing="2" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata4">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1"
|
||||
inkscape:groupmode="layer"
|
||||
inkscape:label="Layer 1">
|
||||
<path
|
||||
style="fill:none;stroke:#007100;stroke-width:1.97381759;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="M 2.6013377,1.2661359 2.5385809,14.170523 13.426862,1.3402729 l 0,13.8264601"
|
||||
id="path2838" />
|
||||
<path
|
||||
style="fill:none;stroke:#8c0000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="M 5.0524871,6.8017199 9.9672796,5.3380844 7.9002122,10.258565"
|
||||
id="path4254" />
|
||||
<path
|
||||
style="fill:none;stroke:#8f0000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="M 1.0314127,1.894766 2.4361783,6 4.2263917,1.970748"
|
||||
id="path4256" />
|
||||
<path
|
||||
style="fill:none;stroke:#8f0000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="M 11.92745,8.924017 13.332216,13.029252 15.122429,9"
|
||||
id="path4256-1" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer2"
|
||||
inkscape:label="fondo"
|
||||
sodipodi:insensitive="true">
|
||||
<rect
|
||||
style="fill:#ffffff;fill-opacity:0.00000000;stroke:none;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0.00000000;stroke-opacity:0.48858449"
|
||||
id="rect2277"
|
||||
width="16.000000"
|
||||
height="16.000000"
|
||||
x="0.00000000"
|
||||
y="0.00000000" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 5.5 KiB |
|
@ -0,0 +1,169 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
sodipodi:docname="annotate_X.svg"
|
||||
inkscape:version="0.47 r22583"
|
||||
sodipodi:version="0.32"
|
||||
id="svg2"
|
||||
height="16.000000px"
|
||||
width="16.000000px"
|
||||
inkscape:export-filename="C:\Documents and Settings\inigo\Escritorio\iconos\Export.png"
|
||||
inkscape:export-xdpi="90.000000"
|
||||
inkscape:export-ydpi="90.000000"
|
||||
version="1.1">
|
||||
<defs
|
||||
id="defs3">
|
||||
<inkscape:path-effect
|
||||
effect="skeletal"
|
||||
id="path-effect2834"
|
||||
is_visible="true"
|
||||
pattern="M 0,5 10,10 10,0 z"
|
||||
copytype="single_stretched"
|
||||
prop_scale="1"
|
||||
scale_y_rel="false"
|
||||
spacing="0"
|
||||
normal_offset="0"
|
||||
tang_offset="0"
|
||||
prop_units="false"
|
||||
vertical_pattern="false"
|
||||
fuse_tolerance="0" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 8 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="16 : 8 : 1"
|
||||
inkscape:persp3d-origin="8 : 5.3333333 : 1"
|
||||
id="perspective29" />
|
||||
<linearGradient
|
||||
id="linearGradient10731">
|
||||
<stop
|
||||
id="stop10733"
|
||||
offset="0.00000000"
|
||||
style="stop-color:#8787ff;stop-opacity:1.0000000;" />
|
||||
<stop
|
||||
id="stop10735"
|
||||
offset="1.0000000"
|
||||
style="stop-color:#ffffff;stop-opacity:1.0000000;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
y2="12.266582"
|
||||
x2="6.0408001"
|
||||
y1="17.050747"
|
||||
x1="11.430959"
|
||||
gradientTransform="scale(1.224745,0.816497)"
|
||||
id="linearGradient10737"
|
||||
xlink:href="#linearGradient10731"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
id="linearGradient2606">
|
||||
<stop
|
||||
style="stop-color:#ff7800;stop-opacity:1.0000000;"
|
||||
offset="0.00000000"
|
||||
id="stop2608" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1.0000000;"
|
||||
offset="1.0000000"
|
||||
id="stop2610" />
|
||||
</linearGradient>
|
||||
<inkscape:perspective
|
||||
id="perspective4268"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
inkscape:window-y="-4"
|
||||
inkscape:window-x="-4"
|
||||
inkscape:window-height="968"
|
||||
inkscape:window-width="1280"
|
||||
inkscape:guide-bbox="true"
|
||||
showguides="true"
|
||||
inkscape:guide-points="true"
|
||||
gridtolerance="0.50000000px"
|
||||
inkscape:grid-points="true"
|
||||
inkscape:grid-bbox="true"
|
||||
showgrid="true"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:document-units="px"
|
||||
inkscape:cy="8"
|
||||
inkscape:cx="2.8854733"
|
||||
inkscape:zoom="28.9375"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
borderopacity="1.0"
|
||||
bordercolor="#666666"
|
||||
pagecolor="#ffffff"
|
||||
id="base"
|
||||
inkscape:window-maximized="1">
|
||||
<inkscape:grid
|
||||
id="GridFromPre046Settings"
|
||||
type="xygrid"
|
||||
originx="0px"
|
||||
originy="0px"
|
||||
spacingx="0.50000000px"
|
||||
spacingy="0.50000000px"
|
||||
color="#0000ff"
|
||||
empcolor="#0000ff"
|
||||
opacity="0.2"
|
||||
empopacity="0.4"
|
||||
empspacing="2" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata4">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1"
|
||||
inkscape:groupmode="layer"
|
||||
inkscape:label="Layer 1">
|
||||
<path
|
||||
style="fill:none;stroke:#007100;stroke-width:1.97381759;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="M 1.0324229,2.4530527 13.93681,2.3902959 1.1065595,13.278577 l 13.8264605,0"
|
||||
id="path2838" />
|
||||
<path
|
||||
style="fill:none;stroke:#8c0000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="M 6.271378,5.8642645 4.8077422,10.779057 9.7282233,8.7119896"
|
||||
id="path4254" />
|
||||
<path
|
||||
style="fill:none;stroke:#8f0000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="M 1.9240173,1.0195985 6.0292515,2.4243641 2,4.2145775"
|
||||
id="path4256" />
|
||||
<path
|
||||
style="fill:none;stroke:#8f0000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 8.9496441,11.836293 4.1052349,1.404766 -4.0292523,1.790213"
|
||||
id="path4256-1" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer2"
|
||||
inkscape:label="fondo"
|
||||
sodipodi:insensitive="true">
|
||||
<rect
|
||||
style="fill:#ffffff;fill-opacity:0.00000000;stroke:none;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0.00000000;stroke-opacity:0.48858449"
|
||||
id="rect2277"
|
||||
width="16.000000"
|
||||
height="16.000000"
|
||||
x="0.00000000"
|
||||
y="0.00000000" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 5.5 KiB |
|
@ -680,7 +680,7 @@ bool WinEDA_App::SetLanguage( bool first_time )
|
|||
delete m_Locale;
|
||||
m_Locale = new wxLocale;
|
||||
|
||||
if( !m_Locale->Init( m_LanguageId ) )
|
||||
if( !m_Locale->Init( m_LanguageId, wxLOCALE_CONV_ENCODING ) )
|
||||
{
|
||||
wxLogDebug( wxT("This language is not supported by the system.") );
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ may choose to document this corresponding work in the CHANGELOG.txt file.
|
|||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2010 <author>
|
||||
* Copyright (C) 1992-2010 Kicad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 1992-2011 <author>
|
||||
* Copyright (C) 1992-2011 Kicad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
EESchema-LIBRARY Version 2.3 Date: 04/12/2010 17:36:18
|
||||
EESchema-LIBRARY Version 2.3 Date: 30/12/2010 18:27:52
|
||||
#
|
||||
# C
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
EESchema Schematic File Version 2 date 04/12/2010 17:36:18
|
||||
EESchema Schematic File Version 2 date 30/12/2010 18:27:52
|
||||
LIBS:power
|
||||
LIBS:device
|
||||
LIBS:valves
|
||||
|
@ -24,12 +24,13 @@ LIBS:display
|
|||
LIBS:cypress
|
||||
LIBS:siliconi
|
||||
LIBS:contrib
|
||||
EELAYER 23 0
|
||||
LIBS:ecc83-pp_v2-cache
|
||||
EELAYER 25 0
|
||||
EELAYER END
|
||||
$Descr A4 11700 8267
|
||||
Sheet 1 1
|
||||
Title "ECC Push-Pull"
|
||||
Date "11 dec 2006"
|
||||
Date "30 dec 2010"
|
||||
Rev "0.1"
|
||||
Comp ""
|
||||
Comment1 ""
|
||||
|
@ -41,7 +42,6 @@ Wire Wire Line
|
|||
6050 4450 6150 4450
|
||||
Wire Wire Line
|
||||
5750 3850 5750 4050
|
||||
Connection ~ 4450 4500
|
||||
Wire Wire Line
|
||||
4450 5400 4450 4450
|
||||
Wire Wire Line
|
||||
|
@ -102,7 +102,7 @@ L ECC83 U1
|
|||
U 3 1 48B4F266
|
||||
P 9950 5700
|
||||
F 0 "U1" H 10080 6010 50 0000 C CNN
|
||||
F 1 "ECC81_83" H 10300 5400 50 0000 C CNN
|
||||
F 1 "ECC83" H 10300 5400 50 0000 C CNN
|
||||
F 2 "VALVE-NOVAL_P" H 10220 5300 50 0001 C CNN
|
||||
3 9950 5700
|
||||
1 0 0 -1
|
||||
|
|
|
@ -21,6 +21,7 @@ set(EESCHEMA_SRCS
|
|||
cleanup.cpp
|
||||
cmp_library_keywords.cpp
|
||||
cmp_library_lexer.cpp
|
||||
component_references_lister.cpp
|
||||
controle.cpp
|
||||
cross-probing.cpp
|
||||
dangling_ends.cpp
|
||||
|
|
|
@ -13,190 +13,18 @@
|
|||
#include "class_sch_screen.h"
|
||||
#include "wxEeschemaStruct.h"
|
||||
|
||||
#include "netlist.h"
|
||||
#include "class_library.h"
|
||||
#include "protos.h"
|
||||
#include "sch_component.h"
|
||||
#include "netlist.h"
|
||||
#include "lib_pin.h"
|
||||
|
||||
|
||||
static int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
|
||||
SCH_SHEET_PATH* sheet );
|
||||
static void BreakReference( std::vector <OBJ_CMP_TO_LIST>& aComponentsList );
|
||||
static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList );
|
||||
static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsList );
|
||||
int GetLastReferenceNumber( int aObjet,
|
||||
std::vector <OBJ_CMP_TO_LIST>& aComponentsList );
|
||||
static int ExistUnit( int aObjet, int aUnit,
|
||||
std::vector <OBJ_CMP_TO_LIST>& aComponentsList );
|
||||
static int ReplaceDuplicatedTimeStamps();
|
||||
|
||||
|
||||
/* Set a sheet number, the sheet count for sheets in the whole schematic
|
||||
* and update the date in all screens
|
||||
*/
|
||||
void SCH_EDIT_FRAME::UpdateSheetNumberAndDate()
|
||||
{
|
||||
wxString date = GenDate();
|
||||
SCH_SCREENS s_list;
|
||||
|
||||
// Set the date
|
||||
for( SCH_SCREEN* screen = s_list.GetFirst(); screen != NULL;
|
||||
screen = s_list.GetNext() )
|
||||
screen->m_Date = date;
|
||||
|
||||
// Set sheet counts
|
||||
SetSheetNumberAndCount();
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Used to annotate the power symbols, before testing erc or computing
|
||||
* netlist when a component reannotation is not necessary
|
||||
*
|
||||
* In order to avoid conflicts the reference number starts with a 0. A
|
||||
* PWR with id 12 is named PWR12 in global annotation and PWR012 by the
|
||||
* Power annotation.
|
||||
****************************************************************************/
|
||||
void ReAnnotatePowerSymbolsOnly( void )
|
||||
{
|
||||
/* Build the whole sheet list in hierarchy (sheet, not screen) */
|
||||
SCH_SHEET_LIST SheetList;
|
||||
|
||||
SCH_SHEET_PATH* sheet;
|
||||
int CmpNumber = 1;
|
||||
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
||||
sheet = SheetList.GetNext() )
|
||||
{
|
||||
EDA_ITEM* DrawList = sheet->LastDrawList();
|
||||
|
||||
for( ; DrawList != NULL; DrawList = DrawList->Next() )
|
||||
{
|
||||
if( DrawList->Type() != SCH_COMPONENT_T )
|
||||
continue;
|
||||
|
||||
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList;
|
||||
LIB_COMPONENT* Entry =
|
||||
CMP_LIBRARY::FindLibraryComponent( DrawLibItem->GetLibName() );
|
||||
|
||||
if( ( Entry == NULL ) || !Entry->IsPower() )
|
||||
continue;
|
||||
|
||||
//DrawLibItem->ClearAnnotation(sheet); this clears all annotation :(
|
||||
wxString refstr = DrawLibItem->GetPrefix();
|
||||
|
||||
//str will be "C?" or so after the ClearAnnotation call.
|
||||
while( refstr.Last() == '?' )
|
||||
refstr.RemoveLast();
|
||||
|
||||
if( !refstr.StartsWith( wxT( "#" ) ) )
|
||||
refstr = wxT( "#" ) + refstr;
|
||||
refstr << wxT( "0" ) << CmpNumber;
|
||||
DrawLibItem->SetRef( sheet, refstr );
|
||||
CmpNumber++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* sort function to annotate items by their position.
|
||||
* Components are sorted
|
||||
* by reference
|
||||
* if same reference: by sheet
|
||||
* if same sheet, by X pos
|
||||
* if same X pos, by Y pos
|
||||
* if same Y pos, by time stamp
|
||||
*/
|
||||
static bool AnnotateBy_X_Position( const OBJ_CMP_TO_LIST& item1,
|
||||
const OBJ_CMP_TO_LIST& item2 )
|
||||
{
|
||||
int ii = item1.CompareRef( item2 );
|
||||
|
||||
if( ii == 0 )
|
||||
ii = item1.m_SheetPath.Cmp( item2.m_SheetPath );
|
||||
if( ii == 0 )
|
||||
ii = item1.m_RootCmp->m_Pos.x - item2.m_RootCmp->m_Pos.x;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_RootCmp->m_Pos.y - item2.m_RootCmp->m_Pos.y;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_TimeStamp - item2.m_TimeStamp;
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
|
||||
|
||||
/* sort function to annotate items by their position.
|
||||
* Components are sorted
|
||||
* by reference
|
||||
* if same reference: by sheet
|
||||
* if same sheet, by Y pos
|
||||
* if same Y pos, by X pos
|
||||
* if same X pos, by time stamp
|
||||
*/
|
||||
static bool AnnotateBy_Y_Position( const OBJ_CMP_TO_LIST& item1,
|
||||
const OBJ_CMP_TO_LIST& item2 )
|
||||
{
|
||||
int ii = item1.CompareRef( item2 );
|
||||
|
||||
if( ii == 0 )
|
||||
ii = item1.m_SheetPath.Cmp( item2.m_SheetPath );
|
||||
if( ii == 0 )
|
||||
ii = item1.m_RootCmp->m_Pos.y - item2.m_RootCmp->m_Pos.y;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_RootCmp->m_Pos.x - item2.m_RootCmp->m_Pos.x;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_TimeStamp - item2.m_TimeStamp;
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* qsort function to annotate items by value
|
||||
* Components are sorted
|
||||
* by reference
|
||||
* if same reference: by value
|
||||
* if same value: by unit number
|
||||
* if same unit number, by sheet
|
||||
* if same sheet, by time stamp
|
||||
*****************************************************************************/
|
||||
static bool AnnotateByValue( const OBJ_CMP_TO_LIST& item1,
|
||||
const OBJ_CMP_TO_LIST& item2 )
|
||||
{
|
||||
int ii = item1.CompareRef( item2 );
|
||||
|
||||
if( ii == 0 )
|
||||
ii = item1.CompareValue( item2 );
|
||||
if( ii == 0 )
|
||||
ii = item1.m_Unit - item2.m_Unit;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_SheetPath.Cmp( item2.m_SheetPath );
|
||||
if( ii == 0 )
|
||||
ii = item1.m_RootCmp->m_Pos.x - item2.m_RootCmp->m_Pos.x;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_RootCmp->m_Pos.y - item2.m_RootCmp->m_Pos.y;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_TimeStamp - item2.m_TimeStamp;
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* qsort function to annotate items by value
|
||||
* Components are sorted by time stamp
|
||||
*****************************************************************************/
|
||||
static bool SortByTimeStamp( const OBJ_CMP_TO_LIST& item1,
|
||||
const OBJ_CMP_TO_LIST& item2 )
|
||||
{
|
||||
int ii = item1.m_SheetPath.Cmp( item2.m_SheetPath );
|
||||
|
||||
if( ii == 0 )
|
||||
ii = item1.m_TimeStamp - item2.m_TimeStamp;
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
static void BreakReference( SCH_REFERENCE_LIST& aComponentsList );
|
||||
static void ReAnnotateComponents( SCH_REFERENCE_LIST& aComponentsList );
|
||||
static void ComputeReferenceNumber( SCH_REFERENCE_LIST& aComponentsList, bool aUseSheetNum );
|
||||
static int GetLastReferenceNumber( int aObjet,SCH_REFERENCE_LIST& aComponentsList );
|
||||
static int ExistUnit( int aObjet, int aUnit, SCH_REFERENCE_LIST& aComponentList );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -204,49 +32,23 @@ static bool SortByTimeStamp( const OBJ_CMP_TO_LIST& item1,
|
|||
* Remove current component annotations
|
||||
* @param aCurrentSheetOnly : if false: remove all annotations, else remove
|
||||
* annotation relative to the current sheet only
|
||||
* @param aRedraw : true to refresh display
|
||||
*/
|
||||
void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw )
|
||||
void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly )
|
||||
{
|
||||
SCH_ITEM* strct;
|
||||
SCH_SCREEN* screen;
|
||||
SCH_SCREENS ScreenList;
|
||||
|
||||
screen = ScreenList.GetFirst();
|
||||
|
||||
if( aCurrentSheetOnly )
|
||||
screen = GetScreen();
|
||||
|
||||
if( screen == NULL )
|
||||
return;
|
||||
|
||||
while( screen )
|
||||
{
|
||||
strct = screen->GetDrawItems();
|
||||
|
||||
for( ; strct; strct = strct->Next() )
|
||||
{
|
||||
if( strct->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
if( aCurrentSheetOnly )
|
||||
( (SCH_COMPONENT*) strct )->ClearAnnotation( m_CurrentSheet );
|
||||
else
|
||||
( (SCH_COMPONENT*) strct )->ClearAnnotation( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
OnModify( );
|
||||
if( aCurrentSheetOnly )
|
||||
break;
|
||||
screen = ScreenList.GetNext();
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
wxCHECK_RET( screen != NULL, wxT( "Attempt to clear annotation of a NULL screen." ) );
|
||||
screen->ClearAnnotation( m_CurrentSheet );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_SCREENS ScreenList;
|
||||
ScreenList.ClearAnnotation();
|
||||
}
|
||||
|
||||
|
||||
//update the References
|
||||
// Update the references for the sheet that is currently being displayed.
|
||||
m_CurrentSheet->UpdateAllScreenReferences();
|
||||
|
||||
if( aRedraw )
|
||||
DrawPanel->Refresh( true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -270,246 +72,114 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw )
|
|||
* stamps are used to handle annotation mainly in complex
|
||||
* hierarchies.
|
||||
*/
|
||||
void AnnotateComponents( SCH_EDIT_FRAME* parent,
|
||||
void SCH_EDIT_FRAME::AnnotateComponents(
|
||||
bool annotateSchematic,
|
||||
int sortOption,
|
||||
bool resetAnnotation,
|
||||
bool repairsTimestamps )
|
||||
{
|
||||
std::vector <OBJ_CMP_TO_LIST> ComponentsList;
|
||||
SCH_REFERENCE_LIST references;
|
||||
|
||||
wxBusyCursor dummy;
|
||||
|
||||
// Test and replace duplicate time stamps
|
||||
// duplicate can happen with old schematics, or schematic conversions or
|
||||
// manual editions of files ...
|
||||
SCH_SCREENS screens;
|
||||
|
||||
/* Build the sheet list */
|
||||
SCH_SHEET_LIST sheets;
|
||||
|
||||
// Test for and replace duplicate time stamps in components and sheets. Duplicate
|
||||
// time stamps can happen with old schematics, schematic conversions, or manual
|
||||
// editing of files.
|
||||
if( repairsTimestamps )
|
||||
{
|
||||
int ireplacecount = ReplaceDuplicatedTimeStamps();
|
||||
if( ireplacecount )
|
||||
int count = screens.ReplaceDuplicateTimeStamps();
|
||||
|
||||
if( count )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "%d duplicate time stamps replaced." ),
|
||||
ireplacecount );
|
||||
msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count );
|
||||
DisplayInfoMessage( NULL, msg, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
/* If it is an annotation for all the components, reset previous
|
||||
* annotation: */
|
||||
// If it is an annotation for all the components, reset previous annotation.
|
||||
if( resetAnnotation )
|
||||
parent->DeleteAnnotation( !annotateSchematic, false );
|
||||
DeleteAnnotation( !annotateSchematic );
|
||||
|
||||
/* Build the sheet list */
|
||||
SCH_SHEET_LIST SheetList;
|
||||
// Update the screen date.
|
||||
screens.SetDate( GenDate() );
|
||||
|
||||
/* Update the sheet number, sheet count and date */
|
||||
parent->UpdateSheetNumberAndDate();
|
||||
// Set sheet number and total sheet counts.
|
||||
SetSheetNumberAndCount();
|
||||
|
||||
/* Build component list */
|
||||
if( annotateSchematic )
|
||||
{
|
||||
SCH_SHEET_PATH* sheet;
|
||||
for( sheet = SheetList.GetFirst();
|
||||
sheet != NULL;
|
||||
sheet = SheetList.GetNext() )
|
||||
AddComponentsInSheetToList( ComponentsList, sheet );
|
||||
sheets.GetComponents( references );
|
||||
}
|
||||
else
|
||||
AddComponentsInSheetToList( ComponentsList, parent->GetSheet() );
|
||||
|
||||
{
|
||||
GetSheet()->GetComponents( references );
|
||||
}
|
||||
|
||||
/* Break full components reference in name (prefix) and number:
|
||||
* example: IC1 become IC, and 1 */
|
||||
BreakReference( ComponentsList );
|
||||
BreakReference( references );
|
||||
|
||||
bool useSheetNum = false;
|
||||
switch( sortOption )
|
||||
{
|
||||
case 0:
|
||||
sort( ComponentsList.begin(), ComponentsList.end(),
|
||||
AnnotateBy_X_Position );
|
||||
references.SortCmpByXCoordinate();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
sort( ComponentsList.begin(), ComponentsList.end(),
|
||||
AnnotateBy_Y_Position );
|
||||
useSheetNum = true;
|
||||
references.SortCmpByXCoordinate();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
sort( ComponentsList.begin(), ComponentsList.end(), AnnotateByValue );
|
||||
references.SortCmpByYCoordinate();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
useSheetNum = true;
|
||||
references.SortCmpByYCoordinate();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
references.SortComponentsByRefAndValue();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Recalculate reference numbers */
|
||||
ComputeReferenceNumber( ComponentsList );
|
||||
ReAnnotateComponents( ComponentsList );
|
||||
ComputeReferenceNumber( references, useSheetNum );
|
||||
ReAnnotateComponents( references );
|
||||
|
||||
/* Final control (just in case ... )*/
|
||||
parent->CheckAnnotate( NULL, !annotateSchematic );
|
||||
parent->OnModify( );
|
||||
parent->DrawPanel->Refresh( true );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function AddComponentsInSheetToList
|
||||
* Add a OBJ_CMP_TO_LIST object in aComponentsList for each component found
|
||||
* in sheet
|
||||
* @param aComponentsList = a std::vector list to fill
|
||||
* @param aSheet - The SCH_SHEET_PATH sheet to analyze
|
||||
*/
|
||||
int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
|
||||
SCH_SHEET_PATH* aSheet )
|
||||
{
|
||||
int NbrCmp = 0;
|
||||
EDA_ITEM* DrawList = aSheet->LastDrawList();
|
||||
SCH_COMPONENT* DrawLibItem;
|
||||
LIB_COMPONENT* Entry;
|
||||
|
||||
for( ; DrawList != NULL; DrawList = DrawList->Next() )
|
||||
{
|
||||
if( DrawList->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
DrawLibItem = (SCH_COMPONENT*) DrawList;
|
||||
Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->GetLibName() );
|
||||
|
||||
if( Entry == NULL )
|
||||
continue;
|
||||
|
||||
OBJ_CMP_TO_LIST new_object;
|
||||
new_object.m_RootCmp = DrawLibItem;
|
||||
new_object.m_Entry = Entry;
|
||||
new_object.m_Unit = DrawLibItem->GetUnitSelection( aSheet );
|
||||
new_object.m_SheetPath = *aSheet;
|
||||
new_object.m_IsNew = false;
|
||||
new_object.m_Flag = 0;
|
||||
new_object.m_TimeStamp = DrawLibItem->m_TimeStamp;
|
||||
|
||||
if( DrawLibItem->GetRef( aSheet ).IsEmpty() )
|
||||
DrawLibItem->SetRef( aSheet, wxT( "DefRef?" ) );
|
||||
|
||||
new_object.SetRef( DrawLibItem->GetRef( aSheet ) );
|
||||
|
||||
new_object.m_NumRef = -1;
|
||||
|
||||
if( DrawLibItem->GetField( VALUE )->m_Text.IsEmpty() )
|
||||
DrawLibItem->GetField( VALUE )->m_Text = wxT( "~" );
|
||||
|
||||
new_object.m_Value = &DrawLibItem->GetField( VALUE )->m_Text;
|
||||
|
||||
aComponentsList.push_back( new_object );
|
||||
NbrCmp++;
|
||||
}
|
||||
}
|
||||
|
||||
return NbrCmp;
|
||||
CheckAnnotate( NULL, !annotateSchematic );
|
||||
OnModify();
|
||||
DrawPanel->Refresh( true );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update the reference component for the schematic project (or the current
|
||||
* sheet)
|
||||
* Update the reference component for the schematic project (or the current sheet)
|
||||
*/
|
||||
static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
||||
static void ReAnnotateComponents( SCH_REFERENCE_LIST& aComponentList )
|
||||
{
|
||||
/* update the reference numbers */
|
||||
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
|
||||
for( unsigned ii = 0; ii < aComponentList.GetCount(); ii++ )
|
||||
{
|
||||
#if 0
|
||||
char* Text = aComponentsList[ii].m_Reference;
|
||||
SCH_COMPONENT* component = aComponentsList[ii].m_RootCmp;
|
||||
|
||||
if( aComponentsList[ii].m_NumRef < 0 )
|
||||
strcat( Text, "?" );
|
||||
else
|
||||
sprintf( Text + strlen( Text ), "%d", aComponentsList[ii].m_NumRef );
|
||||
|
||||
component->SetRef( &(aComponentsList[ii].m_SheetPath), CONV_FROM_UTF8( Text ) );
|
||||
#else
|
||||
|
||||
wxString ref = aComponentsList[ii].GetRef();
|
||||
SCH_COMPONENT* component = aComponentsList[ii].m_RootCmp;
|
||||
|
||||
if( aComponentsList[ii].m_NumRef < 0 )
|
||||
ref += wxChar( '?' );
|
||||
else
|
||||
ref << aComponentsList[ii].m_NumRef;
|
||||
|
||||
aComponentsList[ii].SetRef( ref );
|
||||
|
||||
component->SetRef( &aComponentsList[ii].m_SheetPath, ref );
|
||||
#endif
|
||||
|
||||
component->SetUnit( aComponentsList[ii].m_Unit );
|
||||
component->SetUnitSelection( &aComponentsList[ii].m_SheetPath,
|
||||
aComponentsList[ii].m_Unit );
|
||||
aComponentList[ii].Annotate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Split component reference designators into a name (prefix) and number.
|
||||
* Example: IC1 becomes IC and 1 in the .m_NumRef member.
|
||||
* For multi part per package components not already annotated, set .m_Unit
|
||||
* to a max value (0x7FFFFFFF).
|
||||
*
|
||||
* @param aComponentsList = list of component
|
||||
*/
|
||||
void BreakReference( std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
||||
void BreakReference( SCH_REFERENCE_LIST& aComponentsList )
|
||||
{
|
||||
std::string refText; // construct once outside loop
|
||||
|
||||
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
|
||||
{
|
||||
aComponentsList[ii].m_NumRef = -1;
|
||||
|
||||
refText = aComponentsList[ii].GetRefStr();
|
||||
|
||||
int ll = refText.length() - 1;
|
||||
|
||||
if( refText[ll] == '?' )
|
||||
{
|
||||
aComponentsList[ii].m_IsNew = true;
|
||||
|
||||
if( !aComponentsList[ii].IsPartsLocked() )
|
||||
aComponentsList[ii].m_Unit = 0x7FFFFFFF;
|
||||
|
||||
refText.erase(ll); // delete last char
|
||||
|
||||
aComponentsList[ii].SetRefStr( refText );
|
||||
}
|
||||
|
||||
else if( isdigit( refText[ll] ) == 0 )
|
||||
{
|
||||
aComponentsList[ii].m_IsNew = true;
|
||||
if( !aComponentsList[ii].IsPartsLocked() )
|
||||
aComponentsList[ii].m_Unit = 0x7FFFFFFF;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
while( ll >= 0 )
|
||||
{
|
||||
if( (refText[ll] <= ' ' ) || isdigit( refText[ll] ) )
|
||||
ll--;
|
||||
else
|
||||
{
|
||||
if( isdigit( refText[ll + 1] ) )
|
||||
{
|
||||
// nul terminated C string into cp
|
||||
const char* cp = refText.c_str() + ll + 1;
|
||||
|
||||
aComponentsList[ii].m_NumRef = atoi( cp );
|
||||
}
|
||||
|
||||
refText.erase( ll+1 ); // delete from ll+1 to end
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
aComponentsList[ii].SetRefStr( refText );
|
||||
}
|
||||
}
|
||||
for( unsigned ii = 0; ii < aComponentsList.GetCount(); ii++ )
|
||||
aComponentsList[ii].Split();
|
||||
}
|
||||
|
||||
|
||||
|
@ -517,14 +187,14 @@ void BreakReference( std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
|||
* Compute the reference number for components without reference number
|
||||
* Compute .m_NumRef member
|
||||
*/
|
||||
static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
||||
static void ComputeReferenceNumber( SCH_REFERENCE_LIST& aComponentsList, bool aUseSheetNum )
|
||||
{
|
||||
int LastReferenceNumber, NumberOfUnits, Unit;
|
||||
|
||||
/* Components with an invisible reference (power...) always are
|
||||
* re-annotated. So set their .m_IsNew member to true
|
||||
*/
|
||||
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
|
||||
for( unsigned ii = 0; ii < aComponentsList.GetCount(); ii++ )
|
||||
{
|
||||
if( aComponentsList[ii].GetRefStr()[0] == '#' )
|
||||
{
|
||||
|
@ -541,7 +211,7 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi
|
|||
unsigned first = 0;
|
||||
/* calculate the last used number for this reference prefix: */
|
||||
LastReferenceNumber = GetLastReferenceNumber( first, aComponentsList );
|
||||
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
|
||||
for( unsigned ii = 0; ii < aComponentsList.GetCount(); ii++ )
|
||||
{
|
||||
if( aComponentsList[ii].m_Flag )
|
||||
continue;
|
||||
|
@ -553,7 +223,13 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi
|
|||
first = ii;
|
||||
LastReferenceNumber = GetLastReferenceNumber( ii, aComponentsList );
|
||||
}
|
||||
|
||||
// when using sheet number, ensure annot number >= sheet number* 100
|
||||
if( aUseSheetNum )
|
||||
{
|
||||
int min_num = aComponentsList[ii].m_SheetNum * 100;
|
||||
if( LastReferenceNumber < min_num )
|
||||
LastReferenceNumber = min_num;
|
||||
}
|
||||
/* Annotation of one part per package components (trivial case)*/
|
||||
if( aComponentsList[ii].m_Entry->GetPartCount() <= 1 )
|
||||
{
|
||||
|
@ -562,6 +238,7 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi
|
|||
LastReferenceNumber++;
|
||||
aComponentsList[ii].m_NumRef = LastReferenceNumber;
|
||||
}
|
||||
|
||||
aComponentsList[ii].m_Unit = 1;
|
||||
aComponentsList[ii].m_Flag = 1;
|
||||
aComponentsList[ii].m_IsNew = false;
|
||||
|
@ -590,22 +267,26 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi
|
|||
{
|
||||
if( aComponentsList[ii].m_Unit == Unit )
|
||||
continue;
|
||||
|
||||
int found = ExistUnit( ii, Unit, aComponentsList );
|
||||
|
||||
if( found >= 0 )
|
||||
continue; /* this unit exists for this reference (unit
|
||||
* already annotated) */
|
||||
|
||||
/* Search a component to annotate ( same prefix, same value,
|
||||
* not annotated) */
|
||||
for( unsigned jj = ii + 1; jj < aComponentsList.size(); jj++ )
|
||||
for( unsigned jj = ii + 1; jj < aComponentsList.GetCount(); jj++ )
|
||||
{
|
||||
if( aComponentsList[jj].m_Flag ) // already tested
|
||||
continue;
|
||||
|
||||
if( aComponentsList[ii].CompareRef( aComponentsList[jj] ) != 0 )
|
||||
continue;
|
||||
|
||||
if( aComponentsList[jj].CompareValue( aComponentsList[ii] ) != 0 )
|
||||
continue;
|
||||
|
||||
if( !aComponentsList[jj].m_IsNew )
|
||||
continue;
|
||||
|
||||
|
@ -635,16 +316,16 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi
|
|||
* the search pattern)
|
||||
* @param aComponentsList = list of items
|
||||
*/
|
||||
int GetLastReferenceNumber( int aObjet,
|
||||
std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
||||
int GetLastReferenceNumber( int aObjet,SCH_REFERENCE_LIST& aComponentsList )
|
||||
{
|
||||
int LastNumber = 0;
|
||||
|
||||
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
|
||||
for( unsigned ii = 0; ii < aComponentsList.GetCount(); ii++ )
|
||||
{
|
||||
/* New identifier. */
|
||||
if( aComponentsList[aObjet].CompareRef( aComponentsList[ii] ) != 0 )
|
||||
continue;
|
||||
|
||||
if( LastNumber < aComponentsList[ii].m_NumRef )
|
||||
LastNumber = aComponentsList[ii].m_NumRef;
|
||||
}
|
||||
|
@ -657,19 +338,19 @@ int GetLastReferenceNumber( int aObjet,
|
|||
* Search in the sorted list of components, for a given component an other
|
||||
* component with the same reference and a given part unit. Mainly used to
|
||||
* manage multiple parts per package components.
|
||||
* @param aObjet = index in aComponentsList for the given OBJ_CMP_TO_LIST
|
||||
* @param aObjet = index in aComponentsList for the given SCH_REFERENCE
|
||||
* item to test
|
||||
* @param Unit = the given unit number to search
|
||||
* @param aComponentsList = list of items to examine
|
||||
* @return index in aComponentsList if found or -1 if not found
|
||||
*/
|
||||
static int ExistUnit( int aObjet, int Unit,
|
||||
std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
|
||||
static int ExistUnit( int aObjet, int Unit, SCH_REFERENCE_LIST& aComponentsList )
|
||||
{
|
||||
int NumRef;
|
||||
|
||||
NumRef = aComponentsList[aObjet].m_NumRef;
|
||||
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
|
||||
|
||||
for( unsigned ii = 0; ii < aComponentsList.GetCount(); ii++ )
|
||||
{
|
||||
if( aObjet == (int) ii )
|
||||
// Do not compare with itself !
|
||||
|
@ -717,20 +398,15 @@ int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOn
|
|||
/* build the screen list */
|
||||
SCH_SHEET_LIST SheetList;
|
||||
|
||||
std::vector <OBJ_CMP_TO_LIST> ComponentsList;
|
||||
SCH_REFERENCE_LIST ComponentsList;
|
||||
|
||||
/* Build the list of components */
|
||||
if( !aOneSheetOnly )
|
||||
{
|
||||
SCH_SHEET_PATH* sheet;
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
||||
sheet = SheetList.GetNext() )
|
||||
AddComponentsInSheetToList( ComponentsList, sheet );
|
||||
}
|
||||
SheetList.GetComponents( ComponentsList );
|
||||
else
|
||||
AddComponentsInSheetToList( ComponentsList, GetSheet() );
|
||||
GetSheet()->GetComponents( ComponentsList );
|
||||
|
||||
sort( ComponentsList.begin(), ComponentsList.end(), AnnotateByValue );
|
||||
ComponentsList.SortComponentsByRefAndValue();
|
||||
|
||||
/* Break full components reference in name (prefix) and number: example:
|
||||
* IC1 become IC, and 1 */
|
||||
|
@ -738,7 +414,8 @@ int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOn
|
|||
|
||||
/* count not yet annotated items */
|
||||
error = 0;
|
||||
int imax = ComponentsList.size() - 1;
|
||||
int imax = ComponentsList.GetCount() - 1;
|
||||
|
||||
for( int ii = 0; ii < imax; ii++ )
|
||||
{
|
||||
msg.Empty();
|
||||
|
@ -752,31 +429,25 @@ int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOn
|
|||
Buff = wxT( "?" );
|
||||
|
||||
cmpref = ComponentsList[ii].GetRef();
|
||||
msg.Printf( _( "item not annotated: %s%s" ),
|
||||
GetChars( cmpref ), GetChars( Buff ) );
|
||||
msg.Printf( _( "item not annotated: %s%s" ), GetChars( cmpref ), GetChars( Buff ) );
|
||||
|
||||
if( ( ComponentsList[ii].m_Unit > 0 )
|
||||
&& ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) )
|
||||
if( ( ComponentsList[ii].m_Unit > 0 ) && ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) )
|
||||
{
|
||||
Buff.Printf( _( "( unit %d)" ), ComponentsList[ii].m_Unit );
|
||||
msg << Buff;
|
||||
}
|
||||
|
||||
if( aMessageList )
|
||||
{
|
||||
aMessageList->Add( msg + wxT( "\n" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayError( NULL, msg );
|
||||
}
|
||||
|
||||
error++;
|
||||
break;
|
||||
}
|
||||
|
||||
// Annotate error
|
||||
if( MAX( ComponentsList[ii].m_Entry->GetPartCount(), 1 )
|
||||
< ComponentsList[ii].m_Unit )
|
||||
if( MAX( ComponentsList[ii].m_Entry->GetPartCount(), 1 ) < ComponentsList[ii].m_Unit )
|
||||
{
|
||||
if( ComponentsList[ii].m_NumRef >= 0 )
|
||||
Buff << ComponentsList[ii].m_NumRef;
|
||||
|
@ -785,19 +456,18 @@ int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOn
|
|||
|
||||
cmpref = ComponentsList[ii].GetRef();
|
||||
|
||||
msg.Printf( _( "Error item %s%s" ), GetChars( cmpref ),
|
||||
GetChars( Buff ) );
|
||||
msg.Printf( _( "Error item %s%s" ), GetChars( cmpref ), GetChars( Buff ) );
|
||||
|
||||
Buff.Printf( _( " unit %d and no more than %d parts" ),
|
||||
ComponentsList[ii].m_Unit,
|
||||
ComponentsList[ii].m_Entry->GetPartCount() );
|
||||
msg << Buff;
|
||||
|
||||
if( aMessageList )
|
||||
{
|
||||
aMessageList->Add( msg + wxT( "\n" ));
|
||||
}
|
||||
else
|
||||
DisplayError( NULL, msg );
|
||||
|
||||
error++;
|
||||
break;
|
||||
}
|
||||
|
@ -827,21 +497,19 @@ int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOn
|
|||
|
||||
cmpref = ComponentsList[ii].GetRef();
|
||||
|
||||
msg.Printf( _( "Multiple item %s%s" ),
|
||||
GetChars( cmpref ), GetChars( Buff ) );
|
||||
msg.Printf( _( "Multiple item %s%s" ), GetChars( cmpref ), GetChars( Buff ) );
|
||||
|
||||
if( ( ComponentsList[ii].m_Unit > 0 )
|
||||
&& ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) )
|
||||
if( ( ComponentsList[ii].m_Unit > 0 )&& ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) )
|
||||
{
|
||||
Buff.Printf( _( " (unit %d)" ), ComponentsList[ii].m_Unit );
|
||||
msg << Buff;
|
||||
}
|
||||
|
||||
if( aMessageList )
|
||||
{
|
||||
aMessageList->Add( msg + wxT( "\n" ));
|
||||
}
|
||||
else
|
||||
DisplayError( NULL, msg );
|
||||
|
||||
error++;
|
||||
continue;
|
||||
}
|
||||
|
@ -857,30 +525,26 @@ int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOn
|
|||
Buff = wxT( "?" );
|
||||
|
||||
cmpref = ComponentsList[ii].GetRef();
|
||||
msg.Printf( _( "Multiple item %s%s" ),
|
||||
GetChars( cmpref ), GetChars( Buff ) );
|
||||
msg.Printf( _( "Multiple item %s%s" ), GetChars( cmpref ), GetChars( Buff ) );
|
||||
|
||||
if( ( ComponentsList[ii].m_Unit > 0 )
|
||||
&& ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) )
|
||||
if( ( ComponentsList[ii].m_Unit > 0 ) && ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) )
|
||||
{
|
||||
Buff.Printf( _( " (unit %d)" ), ComponentsList[ii].m_Unit );
|
||||
msg << Buff;
|
||||
}
|
||||
|
||||
if( aMessageList )
|
||||
{
|
||||
aMessageList->Add( msg + wxT( "\n" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayError( NULL, msg );
|
||||
}
|
||||
|
||||
error++;
|
||||
}
|
||||
|
||||
/* Error if values are different between units, for the same
|
||||
* reference */
|
||||
int next = ii + 1;
|
||||
|
||||
if( ComponentsList[ii].CompareValue( ComponentsList[next] ) != 0 )
|
||||
{
|
||||
wxString nextcmpref = ComponentsList[next].GetRef();
|
||||
|
@ -910,26 +574,21 @@ int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOn
|
|||
#endif
|
||||
|
||||
if( aMessageList )
|
||||
{
|
||||
aMessageList->Add( msg + wxT( "\n" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayError( NULL, msg );
|
||||
}
|
||||
|
||||
error++;
|
||||
}
|
||||
}
|
||||
|
||||
// count the duplicated time stamps
|
||||
sort( ComponentsList.begin(), ComponentsList.end(), SortByTimeStamp );
|
||||
ComponentsList.SortComponentsByTimeStamp();
|
||||
|
||||
for( int ii = 0; ( ii < imax ) && ( error < 4 ); ii++ )
|
||||
{
|
||||
if( (ComponentsList[ii].m_TimeStamp
|
||||
!= ComponentsList[ii + 1].m_TimeStamp)
|
||||
|| ( ComponentsList[ii].m_SheetPath
|
||||
!= ComponentsList[ii + 1].m_SheetPath ) )
|
||||
if( ( ComponentsList[ii].m_TimeStamp != ComponentsList[ii + 1].m_TimeStamp )
|
||||
|| ( ComponentsList[ii].m_SheetPath != ComponentsList[ii + 1].m_SheetPath ) )
|
||||
continue;
|
||||
|
||||
/* Same time stamp found. */
|
||||
|
@ -949,102 +608,12 @@ int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOn
|
|||
GetChars( nextcmpref ), ComponentsList[ii + 1].m_NumRef );
|
||||
|
||||
if( aMessageList )
|
||||
{
|
||||
aMessageList->Add( msg + wxT( "\n" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayError( NULL, msg );
|
||||
}
|
||||
|
||||
error++;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************
|
||||
* function to sort sch_items by time stamp
|
||||
************************************************/
|
||||
static bool SortItemByTimeStamp( const SCH_ITEM* item1, const SCH_ITEM* item2 )
|
||||
{
|
||||
int ii = item1->m_TimeStamp - item2->m_TimeStamp;
|
||||
|
||||
/* if same time stamp, compare type, in order to have
|
||||
* first : component
|
||||
* after : sheet
|
||||
* because this is the first item that have its time stamp changed
|
||||
* and changing the time stamp of a sheet can loose annotation
|
||||
*/
|
||||
|
||||
if( ii == 0 && ( item1->Type() != item2->Type() ) )
|
||||
if( item1->Type() == SCH_SHEET_T )
|
||||
ii = -1;
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function ReplaceDuplicatedTimeStamps
|
||||
* Search for duplicate time stamps in the whole hierarchy, and replace
|
||||
* duplicate by new time stamps
|
||||
*/
|
||||
int ReplaceDuplicatedTimeStamps()
|
||||
{
|
||||
/* Build the whole screen list */
|
||||
SCH_SCREENS ScreenList;
|
||||
|
||||
/* Build the list of items with time stamps (components and sheets)
|
||||
* note: if all items have a different time stamp, this ensure also
|
||||
* different paths in complex hierarchy
|
||||
* this is the reason we have different time stamps for components AND
|
||||
* sheets
|
||||
*/
|
||||
std::vector <SCH_ITEM*> itemlist;
|
||||
SCH_SCREEN* screen;
|
||||
SCH_ITEM* item;
|
||||
|
||||
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
||||
{
|
||||
item = screen->GetDrawItems();
|
||||
|
||||
while( item )
|
||||
{
|
||||
if( ( item->Type() == SCH_SHEET_T )
|
||||
|| ( item->Type() == SCH_COMPONENT_T ) )
|
||||
itemlist.push_back( item );
|
||||
|
||||
item = item->Next();
|
||||
}
|
||||
}
|
||||
|
||||
// Test and replace duplicated time stamps
|
||||
int imax = itemlist.size() - 1;
|
||||
int errcount = 0;
|
||||
sort( itemlist.begin(), itemlist.end(), SortItemByTimeStamp );
|
||||
for( int ii = 0; ii < imax; ii++ )
|
||||
{
|
||||
item = itemlist[ii];
|
||||
SCH_ITEM* nextitem = itemlist[ii + 1];
|
||||
if( item->m_TimeStamp == nextitem->m_TimeStamp )
|
||||
{
|
||||
errcount++;
|
||||
|
||||
// for a component, update its Time stamp and its paths
|
||||
// (m_PathsAndReferences field)
|
||||
if( item->Type() == SCH_COMPONENT_T )
|
||||
( (SCH_COMPONENT*) item )->SetTimeStamp( GetTimeStamp() );
|
||||
|
||||
// for a sheet, update only its time stamp (annotation of its
|
||||
// components will be lost)
|
||||
// @todo: see how to change sheet paths for its cmp list (can
|
||||
// be possible in most cases)
|
||||
else
|
||||
item->m_TimeStamp = GetTimeStamp();
|
||||
}
|
||||
}
|
||||
|
||||
return errcount;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: build_BOM.cpp
|
||||
// Purpose:
|
||||
// Author: jean-pierre Charras
|
||||
// License: GPL license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -14,72 +13,20 @@
|
|||
#include "kicad_string.h"
|
||||
|
||||
#include "general.h"
|
||||
#include "netlist.h"
|
||||
#include "protos.h"
|
||||
#include "sch_sheet.h"
|
||||
#include "sch_component.h"
|
||||
#include "template_fieldnames.h"
|
||||
#include "netlist.h"
|
||||
|
||||
|
||||
/**
|
||||
* @bug - Every instance of fprintf() and fputs() in this file fails to check
|
||||
* the return value for an error.
|
||||
/* Fill aList with labels
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Function BuildComponentsListFromSchematic
|
||||
* creates the list of components found in the whole schematic.
|
||||
*
|
||||
* Goes through the 'sheets', not the screens, so that we account for
|
||||
* multiple instances of a given screen.
|
||||
*/
|
||||
void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||
{
|
||||
// Build the sheet list (which is not screen a screen list)
|
||||
SCH_SHEET_LIST sheetList; // uses a global
|
||||
|
||||
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() )
|
||||
{
|
||||
for( EDA_ITEM* schItem = path->LastDrawList(); schItem; schItem = schItem->Next() )
|
||||
{
|
||||
if( schItem->Type() != SCH_COMPONENT_T )
|
||||
continue;
|
||||
|
||||
SCH_COMPONENT* comp = (SCH_COMPONENT*) schItem;
|
||||
|
||||
comp->SetParent( path->LastScreen() );
|
||||
|
||||
OBJ_CMP_TO_LIST item;
|
||||
|
||||
item.m_RootCmp = comp;
|
||||
item.m_SheetPath = *path;
|
||||
item.m_Unit = comp->GetUnitSelection( path );
|
||||
|
||||
item.SetRef( comp->GetRef( path ) );
|
||||
|
||||
// skip pseudo components, which have a reference starting
|
||||
// with #, mainly power symbols
|
||||
if( item.GetRefStr()[0] == '#' )
|
||||
continue;
|
||||
|
||||
// Real component found, keep it
|
||||
aList.push_back( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Fill aList with Glabel info
|
||||
*/
|
||||
void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
|
||||
void GenListeGLabels( LABEL_OBJECT_LIST& aList )
|
||||
{
|
||||
// Build the sheet list
|
||||
SCH_SHEET_LIST sheetList;
|
||||
LABEL_OBJECT label;
|
||||
|
||||
LABEL_OBJECT lable;
|
||||
|
||||
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() )
|
||||
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() )
|
||||
{
|
||||
SCH_ITEM* schItem = (SCH_ITEM*) path->LastDrawList();
|
||||
|
||||
|
@ -89,22 +36,22 @@ void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
|
|||
{
|
||||
case SCH_HIERARCHICAL_LABEL_T:
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
lable.m_LabelType = schItem->Type();
|
||||
lable.m_SheetPath = *path;
|
||||
lable.m_Label = schItem;
|
||||
aList.push_back( lable );
|
||||
label.m_LabelType = schItem->Type();
|
||||
label.m_SheetPath = *path;
|
||||
label.m_Label = schItem;
|
||||
aList.push_back( label );
|
||||
break;
|
||||
|
||||
case SCH_SHEET_T:
|
||||
{
|
||||
SCH_SHEET* sheet = (SCH_SHEET*) schItem;
|
||||
|
||||
BOOST_FOREACH( SCH_SHEET_PIN sheetLabel, sheet->GetSheetPins() )
|
||||
BOOST_FOREACH( SCH_SHEET_PIN& sheetLabel, sheet->GetSheetPins() )
|
||||
{
|
||||
lable.m_LabelType = SCH_SHEET_LABEL_T;
|
||||
lable.m_SheetPath = *path;
|
||||
lable.m_Label = &sheetLabel;
|
||||
aList.push_back( lable );
|
||||
label.m_LabelType = SCH_SHEET_LABEL_T;
|
||||
label.m_SheetPath = *path;
|
||||
label.m_Label = &sheetLabel;
|
||||
aList.push_back( label );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -118,65 +65,6 @@ void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Compare function for sort()
|
||||
* components are sorted
|
||||
* by value
|
||||
* if same value: by reference
|
||||
* if same reference: by unit number
|
||||
*/
|
||||
bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 )
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
Text1 = &( obj1.m_RootCmp->GetField( VALUE )->m_Text );
|
||||
Text2 = &( obj2.m_RootCmp->GetField( VALUE )->m_Text );
|
||||
ii = Text1->CmpNoCase( *Text2 );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = RefDesStringCompare( obj1.GetRef(), obj2.GetRef() );
|
||||
}
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = obj1.m_Unit - obj2.m_Unit;
|
||||
}
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
|
||||
|
||||
/* compare function for sorting
|
||||
* components are sorted
|
||||
* by reference
|
||||
* if same reference: by value
|
||||
* if same value: by unit number
|
||||
*/
|
||||
bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 )
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
ii = RefDesStringCompare( obj1.GetRef(), obj2.GetRef() );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
Text1 = &( obj1.m_RootCmp->GetField( VALUE )->m_Text );
|
||||
Text2 = &( obj2.m_RootCmp->GetField( VALUE )->m_Text );
|
||||
ii = Text1->CmpNoCase( *Text2 );
|
||||
}
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = obj1.m_Unit - obj2.m_Unit;
|
||||
}
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
|
||||
|
||||
/* compare function for sorting labels
|
||||
* sort by
|
||||
* value
|
||||
|
@ -238,43 +126,10 @@ bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
|||
}
|
||||
|
||||
|
||||
/* Remove sub components from the list, when multiples parts per package are
|
||||
* found in this list
|
||||
* The component list **MUST** be sorted by reference and by unit number
|
||||
*/
|
||||
void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList )
|
||||
int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
|
||||
{
|
||||
SCH_COMPONENT* libItem;
|
||||
wxString oldName;
|
||||
wxString currName;
|
||||
|
||||
|
||||
for( unsigned ii = 0; ii < aList.size(); ii++ )
|
||||
{
|
||||
libItem = aList[ii].m_RootCmp;
|
||||
if( libItem == NULL )
|
||||
continue;
|
||||
|
||||
currName = aList[ii].GetRef();
|
||||
|
||||
if( !oldName.IsEmpty() )
|
||||
{
|
||||
if( oldName == currName ) // currName is a subpart of oldName:
|
||||
// remove it
|
||||
{
|
||||
aList.erase( aList.begin() + ii );
|
||||
ii--;
|
||||
}
|
||||
}
|
||||
oldName = currName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
||||
{
|
||||
SCH_LABEL* DrawTextItem;
|
||||
SCH_SHEET_PIN* DrawSheetLabel;
|
||||
SCH_LABEL* label;
|
||||
SCH_SHEET_PIN* pinsheet;
|
||||
wxString msg, sheetpath;
|
||||
wxString labeltype;
|
||||
|
||||
|
@ -284,7 +139,7 @@ int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
|||
{
|
||||
case SCH_HIERARCHICAL_LABEL_T:
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
DrawTextItem = (SCH_LABEL*)(aList[ii].m_Label);
|
||||
label = (SCH_LABEL*)(aList[ii].m_Label);
|
||||
|
||||
if( aList[ii].m_LabelType == SCH_HIERARCHICAL_LABEL_T )
|
||||
labeltype = wxT( "Hierarchical" );
|
||||
|
@ -293,19 +148,19 @@ int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
|||
|
||||
sheetpath = aList[ii].m_SheetPath.PathHumanReadable();
|
||||
msg.Printf( _( "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n" ),
|
||||
GetChars( DrawTextItem->m_Text ),
|
||||
GetChars( label->m_Text ),
|
||||
GetChars( labeltype ),
|
||||
GetChars( sheetpath ),
|
||||
(float) DrawTextItem->m_Pos.x / 1000,
|
||||
(float) DrawTextItem->m_Pos.y / 1000 );
|
||||
(float) label->m_Pos.x / 1000,
|
||||
(float) label->m_Pos.y / 1000 );
|
||||
|
||||
fputs( CONV_TO_UTF8( msg ), f );
|
||||
break;
|
||||
|
||||
case SCH_SHEET_LABEL_T:
|
||||
{
|
||||
DrawSheetLabel = (SCH_SHEET_PIN*) aList[ii].m_Label;
|
||||
int jj = DrawSheetLabel->m_Shape;
|
||||
pinsheet = (SCH_SHEET_PIN*) aList[ii].m_Label;
|
||||
int jj = pinsheet->m_Shape;
|
||||
|
||||
if( jj < 0 )
|
||||
jj = NET_TMAX;
|
||||
|
@ -316,11 +171,11 @@ int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
|||
wxString labtype = CONV_FROM_UTF8( SheetLabelType[jj] );
|
||||
|
||||
msg.Printf( _( "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ),
|
||||
GetChars( DrawSheetLabel->m_Text ),
|
||||
GetChars( pinsheet->m_Text ),
|
||||
GetChars( labtype ),
|
||||
GetChars( aList[ii].m_SheetPath.PathHumanReadable() ),
|
||||
(float) DrawSheetLabel->m_Pos.x / 1000,
|
||||
(float) DrawSheetLabel->m_Pos.y / 1000 );
|
||||
(float) pinsheet->m_Pos.x / 1000,
|
||||
(float) pinsheet->m_Pos.y / 1000 );
|
||||
|
||||
fputs( CONV_TO_UTF8( msg ), f );
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ wxString LIB_COMPONENT::GetLibraryName()
|
|||
|
||||
|
||||
/**
|
||||
* Function IsMulti
|
||||
* Function ReturnSubReference
|
||||
* @return the sub reference for component having multiple parts per package.
|
||||
* The sub reference identify the part (or unit)
|
||||
* @param aUnit = the part identifier ( 1 to 26)
|
||||
|
|
|
@ -545,7 +545,7 @@ public:
|
|||
bool IsMulti() { return m_unitCount > 1; }
|
||||
|
||||
/**
|
||||
* Function IsMulti
|
||||
* Function ReturnSubReference
|
||||
* @return the sub reference for component having multiple parts per package.
|
||||
* The sub reference identify the part (or unit)
|
||||
* @param aUnit = the part identifier ( 1 to max count)
|
||||
|
|
|
@ -123,4 +123,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
// Buffer to build the list of items used in netlist and erc calculations
|
||||
typedef std::vector <NETLIST_OBJECT*> NETLIST_OBJECT_LIST;
|
||||
|
||||
|
||||
#endif // _CLASS_NETLIST_OBJECT_H_
|
||||
|
|
|
@ -0,0 +1,328 @@
|
|||
/*
|
||||
* component_references_lister.cpp: creates a flat list of components.
|
||||
* Needed for annotation and BOM.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2011 jean-pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
||||
* Copyright (C) 1992-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 Kicad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#include <algorithm> // to use sort vector
|
||||
#include <vector>
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
#include "kicad_string.h"
|
||||
#include "wxEeschemaStruct.h"
|
||||
#include "wxstruct.h"
|
||||
#include "netlist.h"
|
||||
#include "class_sch_screen.h"
|
||||
#include "sch_component.h"
|
||||
|
||||
|
||||
|
||||
/* sort function to annotate items from their position.
|
||||
* Components are sorted
|
||||
* by reference
|
||||
* if same reference: by sheet
|
||||
* if same sheet, by X pos
|
||||
* if same X pos, by Y pos
|
||||
* if same Y pos, by time stamp
|
||||
*/
|
||||
bool SCH_REFERENCE_LIST::sortBy_X_Position( const SCH_REFERENCE& item1,
|
||||
const SCH_REFERENCE& item2 )
|
||||
{
|
||||
int ii = item1.CompareRef( item2 );
|
||||
|
||||
if( ii == 0 )
|
||||
ii = item1.m_SheetNum - item2.m_SheetNum;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_CmpPos.x - item2.m_CmpPos.x;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_CmpPos.y - item2.m_CmpPos.y;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_TimeStamp - item2.m_TimeStamp;
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
|
||||
|
||||
/* sort function to annotate items by their position.
|
||||
* Components are sorted
|
||||
* by reference
|
||||
* if same reference: by sheet
|
||||
* if same sheet, by Y pos
|
||||
* if same Y pos, by X pos
|
||||
* if same X pos, by time stamp
|
||||
*/
|
||||
bool SCH_REFERENCE_LIST::sortBy_Y_Position( const SCH_REFERENCE& item1,
|
||||
const SCH_REFERENCE& item2 )
|
||||
{
|
||||
int ii = item1.CompareRef( item2 );
|
||||
|
||||
if( ii == 0 )
|
||||
ii = item1.m_SheetNum - item2.m_SheetNum;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_CmpPos.y - item2.m_CmpPos.y;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_CmpPos.x - item2.m_CmpPos.x;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_TimeStamp - item2.m_TimeStamp;
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* sort function to annotate items by value
|
||||
* Components are sorted
|
||||
* by reference
|
||||
* if same reference: by value
|
||||
* if same value: by unit number
|
||||
* if same unit number, by sheet
|
||||
* if same sheet, by position X, and Y
|
||||
*/
|
||||
bool SCH_REFERENCE_LIST::sortByRefAndValue( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 )
|
||||
{
|
||||
int ii = item1.CompareRef( item2 );
|
||||
if( ii == 0 )
|
||||
ii = item1.CompareValue( item2 );
|
||||
if( ii == 0 )
|
||||
ii = item1.m_Unit - item2.m_Unit;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_SheetNum - item2.m_SheetNum;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_CmpPos.x - item2.m_CmpPos.x;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_CmpPos.y - item2.m_CmpPos.y;
|
||||
if( ii == 0 )
|
||||
ii = item1.m_TimeStamp - item2.m_TimeStamp;
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
|
||||
/* sort function for for list by values
|
||||
* components are sorted
|
||||
* by value
|
||||
* if same value: by reference
|
||||
* if same reference: by unit number
|
||||
*/
|
||||
bool SCH_REFERENCE_LIST::sortComponentsByValueOnly( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 )
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
Text1 = &( item1.m_RootCmp->GetField( VALUE )->m_Text );
|
||||
Text2 = &( item2.m_RootCmp->GetField( VALUE )->m_Text );
|
||||
ii = Text1->CmpNoCase( *Text2 );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = RefDesStringCompare( item1.GetRef(), item2.GetRef() );
|
||||
}
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = item1.m_Unit - item2.m_Unit;
|
||||
}
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function sortComponentsByReferenceOnly
|
||||
* compare function for sorting in BOM creation.
|
||||
* components are sorted
|
||||
* by reference
|
||||
* if same reference: by value
|
||||
* if same value: by unit number
|
||||
*/
|
||||
bool SCH_REFERENCE_LIST::sortComponentsByReferenceOnly( const SCH_REFERENCE& item1,
|
||||
const SCH_REFERENCE& item2 )
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
ii = RefDesStringCompare( item1.GetRef(), item2.GetRef() );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
Text1 = &( item1.m_RootCmp->GetField( VALUE )->m_Text );
|
||||
Text2 = &( item2.m_RootCmp->GetField( VALUE )->m_Text );
|
||||
ii = Text1->CmpNoCase( *Text2 );
|
||||
}
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = item1.m_Unit - item2.m_Unit;
|
||||
}
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* qsort function to annotate items by value
|
||||
* Components are sorted by time stamp
|
||||
*****************************************************************************/
|
||||
bool SCH_REFERENCE_LIST::sortByTimeStamp( const SCH_REFERENCE& item1,
|
||||
const SCH_REFERENCE& item2 )
|
||||
{
|
||||
int ii = item1.m_SheetPath.Cmp( item2.m_SheetPath );
|
||||
|
||||
if( ii == 0 )
|
||||
ii = item1.m_TimeStamp - item2.m_TimeStamp;
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
|
||||
|
||||
/* Remove sub components from the list, when multiples parts per package are
|
||||
* found in this list
|
||||
*/
|
||||
void SCH_REFERENCE_LIST::RemoveSubComponentsFromList( )
|
||||
{
|
||||
SCH_COMPONENT* libItem;
|
||||
wxString oldName;
|
||||
wxString currName;
|
||||
|
||||
// The component list **MUST** be sorted by reference and by unit number
|
||||
// in order to find all parts of a component
|
||||
SortComponentsByReferenceOnly();
|
||||
for( unsigned ii = 0; ii < componentFlatList.size(); ii++ )
|
||||
{
|
||||
libItem = componentFlatList[ii].m_RootCmp;
|
||||
if( libItem == NULL )
|
||||
continue;
|
||||
|
||||
currName = componentFlatList[ii].GetRef();
|
||||
|
||||
if( !oldName.IsEmpty() )
|
||||
{
|
||||
if( oldName == currName ) // currName is a subpart of oldName:
|
||||
// remove it
|
||||
{
|
||||
componentFlatList.erase( componentFlatList.begin() + ii );
|
||||
ii--;
|
||||
}
|
||||
}
|
||||
oldName = currName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_COMPONENT* aLibComponent,
|
||||
SCH_SHEET_PATH& aSheetPath )
|
||||
{
|
||||
wxASSERT( aComponent != NULL && aLibComponent != NULL );
|
||||
|
||||
m_RootCmp = aComponent;
|
||||
m_Entry = aLibComponent;
|
||||
m_Unit = aComponent->GetUnitSelection( &aSheetPath );
|
||||
m_SheetPath = aSheetPath;
|
||||
m_IsNew = false;
|
||||
m_Flag = 0;
|
||||
m_TimeStamp = aComponent->m_TimeStamp;
|
||||
m_CmpPos = aComponent->m_Pos;
|
||||
m_SheetNum = 0;
|
||||
|
||||
if( aComponent->GetRef( &aSheetPath ).IsEmpty() )
|
||||
aComponent->SetRef( &aSheetPath, wxT( "DefRef?" ) );
|
||||
|
||||
SetRef( aComponent->GetRef( &aSheetPath ) );
|
||||
|
||||
m_NumRef = -1;
|
||||
|
||||
if( aComponent->GetField( VALUE )->GetText().IsEmpty() )
|
||||
aComponent->GetField( VALUE )->SetText( wxT( "~" ) );
|
||||
|
||||
m_Value = &aComponent->GetField( VALUE )->m_Text;
|
||||
}
|
||||
|
||||
|
||||
void SCH_REFERENCE::Annotate()
|
||||
{
|
||||
if( m_NumRef < 0 )
|
||||
m_Ref += wxChar( '?' );
|
||||
else
|
||||
m_Ref = CONV_TO_UTF8( GetRef() << m_NumRef );
|
||||
|
||||
m_RootCmp->SetRef( &m_SheetPath, CONV_FROM_UTF8( m_Ref.c_str() ) );
|
||||
m_RootCmp->SetUnit( m_Unit );
|
||||
m_RootCmp->SetUnitSelection( &m_SheetPath, m_Unit );
|
||||
}
|
||||
|
||||
|
||||
void SCH_REFERENCE::Split()
|
||||
{
|
||||
std::string refText = GetRefStr();
|
||||
|
||||
m_NumRef = -1;
|
||||
|
||||
int ll = refText.length() - 1;
|
||||
|
||||
if( refText[ll] == '?' )
|
||||
{
|
||||
m_IsNew = true;
|
||||
|
||||
if( !IsPartsLocked() )
|
||||
m_Unit = 0x7FFFFFFF;
|
||||
|
||||
refText.erase( ll ); // delete last char
|
||||
|
||||
SetRefStr( refText );
|
||||
}
|
||||
else if( isdigit( refText[ll] ) == 0 )
|
||||
{
|
||||
m_IsNew = true;
|
||||
|
||||
if( !IsPartsLocked() )
|
||||
m_Unit = 0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
while( ll >= 0 )
|
||||
{
|
||||
if( (refText[ll] <= ' ' ) || isdigit( refText[ll] ) )
|
||||
ll--;
|
||||
else
|
||||
{
|
||||
if( isdigit( refText[ll + 1] ) )
|
||||
{
|
||||
// null terminated C string into cp
|
||||
const char* cp = refText.c_str() + ll + 1;
|
||||
|
||||
m_NumRef = atoi( cp );
|
||||
}
|
||||
|
||||
refText.erase( ll+1 ); // delete from ll+1 to end
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetRefStr( refText );
|
||||
}
|
||||
}
|
||||
|
|
@ -9,17 +9,12 @@
|
|||
#include "bitmaps.h"
|
||||
#include "common.h"
|
||||
#include "wxEeschemaStruct.h"
|
||||
#include "class_drawpanel.h"
|
||||
|
||||
#include "annotate_dialog.h"
|
||||
|
||||
#define KEY_ANNOTATE_SORT_OPTION wxT("AnnotateSortOption")
|
||||
|
||||
extern void AnnotateComponents( SCH_EDIT_FRAME* parent,
|
||||
bool annotateSchematic,
|
||||
int sortOption,
|
||||
bool resetAnnotation,
|
||||
bool repairsTimestamps );
|
||||
|
||||
|
||||
DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent )
|
||||
: DIALOG_ANNOTATE_BASE( parent )
|
||||
|
@ -44,29 +39,35 @@ void DIALOG_ANNOTATE::InitValues()
|
|||
m_Config->Read(KEY_ANNOTATE_SORT_OPTION, &option, 0l);
|
||||
switch( option )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
m_rbSortBy_X_Position->SetValue(1);
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
m_rbSortBy_X_Position_and_useSheet->SetValue(1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
m_rbSortBy_Y_Position->SetValue(1);
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
rbSortByValue->SetValue(1);
|
||||
case 3:
|
||||
m_rbSortBy_Y_Position_and_useSheet->SetValue(1);
|
||||
break;
|
||||
|
||||
default:
|
||||
case 4:
|
||||
rbSortByValue->SetValue(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
wxBitmap bitmap0(annotate_down_right_xpm);
|
||||
annotate_down_right_bitmap->SetBitmap(bitmap0);
|
||||
annotate_down_right_bitmap1->SetBitmap(bitmap0);
|
||||
wxBitmap bitmap1(annotate_right_down_xpm);
|
||||
annotate_right_down_bitmap->SetBitmap(bitmap1);
|
||||
annotate_right_down_bitmap1->SetBitmap(bitmap1);
|
||||
wxBitmap bitmap2(add_text_xpm);
|
||||
annotate_by_value_bitmap->SetBitmap(bitmap2);
|
||||
|
||||
|
@ -97,7 +98,9 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
|
|||
response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL );
|
||||
if (response == wxCANCEL)
|
||||
return;
|
||||
AnnotateComponents( m_Parent, GetLevel(), GetSortOrder(), GetResetItems() , true );
|
||||
m_Parent->AnnotateComponents( GetLevel(), GetSortOrder(), GetResetItems() , true );
|
||||
m_Parent->DrawPanel->Refresh();
|
||||
|
||||
m_btnClear->Enable();
|
||||
}
|
||||
|
||||
|
@ -119,7 +122,9 @@ void DIALOG_ANNOTATE::OnClearAnnotationCmpClick( wxCommandEvent& event )
|
|||
wxICON_EXCLAMATION | wxOK | wxCANCEL );
|
||||
if (response == wxCANCEL)
|
||||
return;
|
||||
m_Parent->DeleteAnnotation( GetLevel() ? false : true, true );
|
||||
m_Parent->DeleteAnnotation( GetLevel() ? false : true );
|
||||
m_Parent->DrawPanel->Refresh();
|
||||
|
||||
m_btnClear->Enable(false);
|
||||
}
|
||||
|
||||
|
@ -157,14 +162,20 @@ int DIALOG_ANNOTATE::GetSortOrder( void )
|
|||
/****************************************/
|
||||
/**
|
||||
* @return 0 if annotation by X position,
|
||||
* 1 if annotation by Y position
|
||||
* 2 if annotation by value
|
||||
* 1 if annotation by X position and use sheet number,
|
||||
* 2 if annotation by Y position,
|
||||
* 3 if annotation by Y position and use sheet number,
|
||||
* 4 if annotation by value
|
||||
*/
|
||||
{
|
||||
if ( m_rbSortBy_X_Position->GetValue() )
|
||||
return 0;
|
||||
if ( m_rbSortBy_Y_Position->GetValue() )
|
||||
if ( m_rbSortBy_X_Position_and_useSheet->GetValue() )
|
||||
return 1;
|
||||
return 2;
|
||||
if ( m_rbSortBy_Y_Position->GetValue() )
|
||||
return 2;
|
||||
if ( m_rbSortBy_Y_Position_and_useSheet->GetValue() )
|
||||
return 3;
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,139 +1,167 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 21 2008)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_annotate_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bmainSizer;
|
||||
bmainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bupperSizer;
|
||||
bupperSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticTextScope = new wxStaticText( this, wxID_ANY, _("Scope"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextScope->Wrap( -1 );
|
||||
m_staticTextScope->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
|
||||
|
||||
bupperSizer->Add( m_staticTextScope, 0, wxALL, 6 );
|
||||
|
||||
wxBoxSizer* bscopeOptSizer;
|
||||
bscopeOptSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_rbEntireSchematic = new wxRadioButton( this, ID_ENTIRE_SCHEMATIC, _("Use the &entire schematic"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
||||
bscopeOptSizer->Add( m_rbEntireSchematic, 0, wxALL, 3 );
|
||||
|
||||
m_rbCurrPage = new wxRadioButton( this, ID_CURRENT_PAGE, _("Use the current &page only"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bscopeOptSizer->Add( m_rbCurrPage, 0, wxALL, 3 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bscopeOptSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_rbKeepAnnotation = new wxRadioButton( this, ID_KEEP_ANNOTATION, _("&Keep existing annotation"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
||||
bscopeOptSizer->Add( m_rbKeepAnnotation, 0, wxALL, 3 );
|
||||
|
||||
m_rbResetAnnotation = new wxRadioButton( this, ID_RESET_ANNOTATION, _("&Reset existing annotation"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bscopeOptSizer->Add( m_rbResetAnnotation, 0, wxALL, 3 );
|
||||
|
||||
bupperSizer->Add( bscopeOptSizer, 0, wxEXPAND|wxLEFT|wxALIGN_RIGHT, 25 );
|
||||
|
||||
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bupperSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_staticTextOrder = new wxStaticText( this, wxID_ANY, _("Annotation Order"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextOrder->Wrap( -1 );
|
||||
m_staticTextOrder->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
|
||||
|
||||
bupperSizer->Add( m_staticTextOrder, 0, wxALL, 6 );
|
||||
|
||||
wxBoxSizer* b_orderOptSizer;
|
||||
b_orderOptSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizerXpos;
|
||||
bSizerXpos = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_rbSortBy_X_Position = new wxRadioButton( this, ID_SORT_BY_X_POSITION, _("Sort Components by &X Position"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
||||
bSizerXpos->Add( m_rbSortBy_X_Position, 0, wxALL, 3 );
|
||||
|
||||
|
||||
bSizerXpos->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
annotate_down_right_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerXpos->Add( annotate_down_right_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT, 12 );
|
||||
|
||||
b_orderOptSizer->Add( bSizerXpos, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerYpos;
|
||||
bSizerYpos = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_rbSortBy_Y_Position = new wxRadioButton( this, ID_SORT_BY_Y_POSITION, _("Sort Components by &Y Position"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerYpos->Add( m_rbSortBy_Y_Position, 0, wxALL, 3 );
|
||||
|
||||
|
||||
bSizerYpos->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
annotate_right_down_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerYpos->Add( annotate_right_down_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 12 );
|
||||
|
||||
b_orderOptSizer->Add( bSizerYpos, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerValuepos;
|
||||
bSizerValuepos = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
rbSortByValue = new wxRadioButton( this, ID_SORT_BY_VALUE, _("Sort Components by &Value"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerValuepos->Add( rbSortByValue, 0, wxALL, 3 );
|
||||
|
||||
|
||||
bSizerValuepos->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
annotate_by_value_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerValuepos->Add( annotate_by_value_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 12 );
|
||||
|
||||
b_orderOptSizer->Add( bSizerValuepos, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
bupperSizer->Add( b_orderOptSizer, 1, wxEXPAND|wxLEFT, 25 );
|
||||
|
||||
m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bupperSizer->Add( m_staticline5, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bButtonsSizer;
|
||||
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_btnClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bButtonsSizer->Add( m_btnClose, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_btnClear = new wxButton( this, ID_CLEAR_ANNOTATION_CMP, _("Clear Annotation"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bButtonsSizer->Add( m_btnClear, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_btnApply = new wxButton( this, wxID_APPLY, _("Annotation"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bButtonsSizer->Add( m_btnApply, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
bupperSizer->Add( bButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 6 );
|
||||
|
||||
bmainSizer->Add( bupperSizer, 1, wxALL|wxEXPAND, 6 );
|
||||
|
||||
this->SetSizer( bmainSizer );
|
||||
this->Layout();
|
||||
bmainSizer->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
m_btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnCancelClick ), NULL, this );
|
||||
m_btnClear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), NULL, this );
|
||||
m_btnApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_ANNOTATE_BASE::~DIALOG_ANNOTATE_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnCancelClick ), NULL, this );
|
||||
m_btnClear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), NULL, this );
|
||||
m_btnApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this );
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Sep 8 2010)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_annotate_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bmainSizer;
|
||||
bmainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bupperSizer;
|
||||
bupperSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticTextScope = new wxStaticText( this, wxID_ANY, _("Scope"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextScope->Wrap( -1 );
|
||||
m_staticTextScope->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
|
||||
|
||||
bupperSizer->Add( m_staticTextScope, 0, wxALL, 6 );
|
||||
|
||||
wxBoxSizer* bscopeOptSizer;
|
||||
bscopeOptSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_rbEntireSchematic = new wxRadioButton( this, ID_ENTIRE_SCHEMATIC, _("Use the &entire schematic"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
||||
bscopeOptSizer->Add( m_rbEntireSchematic, 0, wxALL, 3 );
|
||||
|
||||
m_rbCurrPage = new wxRadioButton( this, ID_CURRENT_PAGE, _("Use the current &page only"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bscopeOptSizer->Add( m_rbCurrPage, 0, wxALL, 3 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bscopeOptSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_rbKeepAnnotation = new wxRadioButton( this, ID_KEEP_ANNOTATION, _("&Keep existing annotation"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
||||
bscopeOptSizer->Add( m_rbKeepAnnotation, 0, wxALL, 3 );
|
||||
|
||||
m_rbResetAnnotation = new wxRadioButton( this, ID_RESET_ANNOTATION, _("&Reset existing annotation"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bscopeOptSizer->Add( m_rbResetAnnotation, 0, wxALL, 3 );
|
||||
|
||||
bupperSizer->Add( bscopeOptSizer, 0, wxEXPAND|wxLEFT|wxALIGN_RIGHT, 25 );
|
||||
|
||||
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bupperSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_staticTextOrder = new wxStaticText( this, wxID_ANY, _("Annotation Order"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextOrder->Wrap( -1 );
|
||||
m_staticTextOrder->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
|
||||
|
||||
bupperSizer->Add( m_staticTextOrder, 0, wxALL, 6 );
|
||||
|
||||
wxBoxSizer* b_orderOptSizer;
|
||||
b_orderOptSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizerXpos;
|
||||
bSizerXpos = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_rbSortBy_X_Position = new wxRadioButton( this, ID_SORT_BY_X_POSITION, _("Sort components by &X position"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
||||
bSizerXpos->Add( m_rbSortBy_X_Position, 0, wxALL, 3 );
|
||||
|
||||
|
||||
bSizerXpos->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
annotate_down_right_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerXpos->Add( annotate_down_right_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT, 12 );
|
||||
|
||||
b_orderOptSizer->Add( bSizerXpos, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerXpos_and_use_sheet;
|
||||
bSizerXpos_and_use_sheet = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_rbSortBy_X_Position_and_useSheet = new wxRadioButton( this, wxID_ANY, _("Sort components by X position and use sheet &number"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerXpos_and_use_sheet->Add( m_rbSortBy_X_Position_and_useSheet, 0, wxALL, 3 );
|
||||
|
||||
|
||||
bSizerXpos_and_use_sheet->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
annotate_down_right_bitmap1 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerXpos_and_use_sheet->Add( annotate_down_right_bitmap1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT, 12 );
|
||||
|
||||
b_orderOptSizer->Add( bSizerXpos_and_use_sheet, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerYpos;
|
||||
bSizerYpos = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_rbSortBy_Y_Position = new wxRadioButton( this, ID_SORT_BY_Y_POSITION, _("Sort components by &Y position"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerYpos->Add( m_rbSortBy_Y_Position, 0, wxALL, 3 );
|
||||
|
||||
|
||||
bSizerYpos->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
annotate_right_down_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerYpos->Add( annotate_right_down_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 12 );
|
||||
|
||||
b_orderOptSizer->Add( bSizerYpos, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerYpos_and_useSheet;
|
||||
bSizerYpos_and_useSheet = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_rbSortBy_Y_Position_and_useSheet = new wxRadioButton( this, wxID_ANY, _("Sort components by Y position and use &sheet number"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerYpos_and_useSheet->Add( m_rbSortBy_Y_Position_and_useSheet, 0, wxALL, 3 );
|
||||
|
||||
|
||||
bSizerYpos_and_useSheet->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
annotate_right_down_bitmap1 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerYpos_and_useSheet->Add( annotate_right_down_bitmap1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 12 );
|
||||
|
||||
b_orderOptSizer->Add( bSizerYpos_and_useSheet, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerValuepos;
|
||||
bSizerValuepos = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
rbSortByValue = new wxRadioButton( this, ID_SORT_BY_VALUE, _("Sort components by &value"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerValuepos->Add( rbSortByValue, 0, wxALL, 3 );
|
||||
|
||||
|
||||
bSizerValuepos->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
annotate_by_value_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerValuepos->Add( annotate_by_value_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 12 );
|
||||
|
||||
b_orderOptSizer->Add( bSizerValuepos, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
bupperSizer->Add( b_orderOptSizer, 1, wxEXPAND|wxLEFT, 25 );
|
||||
|
||||
m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bupperSizer->Add( m_staticline5, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bButtonsSizer;
|
||||
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_btnClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bButtonsSizer->Add( m_btnClose, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_btnClear = new wxButton( this, ID_CLEAR_ANNOTATION_CMP, _("Clear Annotation"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bButtonsSizer->Add( m_btnClear, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_btnApply = new wxButton( this, wxID_APPLY, _("Annotation"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bButtonsSizer->Add( m_btnApply, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
bupperSizer->Add( bButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 6 );
|
||||
|
||||
bmainSizer->Add( bupperSizer, 1, wxALL|wxEXPAND, 6 );
|
||||
|
||||
this->SetSizer( bmainSizer );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
m_btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnCancelClick ), NULL, this );
|
||||
m_btnClear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), NULL, this );
|
||||
m_btnApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_ANNOTATE_BASE::~DIALOG_ANNOTATE_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnCancelClick ), NULL, this );
|
||||
m_btnClear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), NULL, this );
|
||||
m_btnApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,82 +1,89 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 21 2008)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __dialog_annotate_base__
|
||||
#define __dialog_annotate_base__
|
||||
|
||||
#include <wx/intl.h>
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/statbmp.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define ID_ENTIRE_SCHEMATIC 1000
|
||||
#define ID_CURRENT_PAGE 1001
|
||||
#define ID_KEEP_ANNOTATION 1002
|
||||
#define ID_RESET_ANNOTATION 1003
|
||||
#define ID_SORT_BY_X_POSITION 1004
|
||||
#define ID_SORT_BY_Y_POSITION 1005
|
||||
#define ID_SORT_BY_VALUE 1006
|
||||
#define ID_CLEAR_ANNOTATION_CMP 1007
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_ANNOTATE_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_ANNOTATE_BASE : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticTextScope;
|
||||
wxRadioButton* m_rbEntireSchematic;
|
||||
wxRadioButton* m_rbCurrPage;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxRadioButton* m_rbKeepAnnotation;
|
||||
wxRadioButton* m_rbResetAnnotation;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxStaticText* m_staticTextOrder;
|
||||
wxRadioButton* m_rbSortBy_X_Position;
|
||||
|
||||
wxStaticBitmap* annotate_down_right_bitmap;
|
||||
wxRadioButton* m_rbSortBy_Y_Position;
|
||||
|
||||
wxStaticBitmap* annotate_right_down_bitmap;
|
||||
wxRadioButton* rbSortByValue;
|
||||
|
||||
wxStaticBitmap* annotate_by_value_bitmap;
|
||||
wxStaticLine* m_staticline5;
|
||||
wxButton* m_btnClose;
|
||||
wxButton* m_btnClear;
|
||||
wxButton* m_btnApply;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnClearAnnotationCmpClick( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnApplyClick( wxCommandEvent& event ){ event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Annotate Schematic"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_ANNOTATE_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__dialog_annotate_base__
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Sep 8 2010)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __dialog_annotate_base__
|
||||
#define __dialog_annotate_base__
|
||||
|
||||
#include <wx/intl.h>
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/statbmp.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define ID_ENTIRE_SCHEMATIC 1000
|
||||
#define ID_CURRENT_PAGE 1001
|
||||
#define ID_KEEP_ANNOTATION 1002
|
||||
#define ID_RESET_ANNOTATION 1003
|
||||
#define ID_SORT_BY_X_POSITION 1004
|
||||
#define ID_SORT_BY_Y_POSITION 1005
|
||||
#define ID_SORT_BY_VALUE 1006
|
||||
#define ID_CLEAR_ANNOTATION_CMP 1007
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_ANNOTATE_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_ANNOTATE_BASE : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticTextScope;
|
||||
wxRadioButton* m_rbEntireSchematic;
|
||||
wxRadioButton* m_rbCurrPage;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxRadioButton* m_rbKeepAnnotation;
|
||||
wxRadioButton* m_rbResetAnnotation;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxStaticText* m_staticTextOrder;
|
||||
wxRadioButton* m_rbSortBy_X_Position;
|
||||
|
||||
wxStaticBitmap* annotate_down_right_bitmap;
|
||||
wxRadioButton* m_rbSortBy_X_Position_and_useSheet;
|
||||
|
||||
wxStaticBitmap* annotate_down_right_bitmap1;
|
||||
wxRadioButton* m_rbSortBy_Y_Position;
|
||||
|
||||
wxStaticBitmap* annotate_right_down_bitmap;
|
||||
wxRadioButton* m_rbSortBy_Y_Position_and_useSheet;
|
||||
|
||||
wxStaticBitmap* annotate_right_down_bitmap1;
|
||||
wxRadioButton* rbSortByValue;
|
||||
|
||||
wxStaticBitmap* annotate_by_value_bitmap;
|
||||
wxStaticLine* m_staticline5;
|
||||
wxButton* m_btnClose;
|
||||
wxButton* m_btnClear;
|
||||
wxButton* m_btnApply;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnClearAnnotationCmpClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Annotate Schematic"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 432,376 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_ANNOTATE_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__dialog_annotate_base__
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Name: dialog_build_BOM.cpp
|
||||
// Author: jean-pierre Charras
|
||||
// Modified by:
|
||||
|
@ -31,6 +30,12 @@
|
|||
#include "protos.h"
|
||||
|
||||
|
||||
extern void GenListeGLabels( std::vector <LABEL_OBJECT>& aList );
|
||||
extern bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 );
|
||||
extern bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 );
|
||||
extern int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList );
|
||||
|
||||
|
||||
/* Local variables */
|
||||
static bool s_ListByRef = TRUE;
|
||||
static bool s_ListByValue = TRUE;
|
||||
|
@ -222,11 +227,12 @@ void DIALOG_BUILD_BOM::SavePreferences()
|
|||
s_ListBySheet = m_GenListLabelsbySheet->GetValue();
|
||||
s_BrowseCreatedList = m_GetListBrowser->GetValue();
|
||||
|
||||
// (aved in config ):
|
||||
// (saved in config ):
|
||||
|
||||
// Determine current settings of both radiobutton groups
|
||||
s_OutputFormOpt = m_OutputFormCtrl->GetSelection();
|
||||
s_OutputSeparatorOpt = m_OutputSeparatorCtrl->GetSelection();
|
||||
|
||||
if( s_OutputSeparatorOpt < 0 )
|
||||
s_OutputSeparatorOpt = 0;
|
||||
|
||||
|
@ -249,10 +255,12 @@ void DIALOG_BUILD_BOM::SavePreferences()
|
|||
|
||||
// Now save current settings of all "Fields to add" checkboxes
|
||||
long addfields = 0;
|
||||
|
||||
for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ )
|
||||
{
|
||||
if( *s_AddFieldList[ii] )
|
||||
addfields |= bitmask;
|
||||
|
||||
bitmask <<= 1;
|
||||
}
|
||||
|
||||
|
@ -319,7 +327,7 @@ void DIALOG_BUILD_BOM::Create_BOM_Lists( int aTypeFile,
|
|||
GenereListeOfItems( m_ListFileName, aIncludeSubComponents );
|
||||
break;
|
||||
|
||||
case 1: // speadsheet
|
||||
case 1: // spreadsheet
|
||||
CreateExportList( m_ListFileName, aIncludeSubComponents );
|
||||
break;
|
||||
|
||||
|
@ -390,19 +398,17 @@ void DIALOG_BUILD_BOM::CreatePartsList( const wxString& aFullFileName, bool aInc
|
|||
return;
|
||||
}
|
||||
|
||||
std::vector <OBJ_CMP_TO_LIST> cmplist;
|
||||
SCH_REFERENCE_LIST cmplist;
|
||||
SCH_SHEET_LIST sheetList; // uses a global
|
||||
|
||||
BuildComponentsListFromSchematic( cmplist );
|
||||
sheetList.GetComponents( cmplist, false );
|
||||
|
||||
// sort component list by ref and remove sub components
|
||||
if( !aIncludeSubComponents )
|
||||
{
|
||||
sort( cmplist.begin(), cmplist.end(), SortComponentsByReference );
|
||||
DeleteSubCmp( cmplist );
|
||||
}
|
||||
cmplist.RemoveSubComponentsFromList();
|
||||
|
||||
// sort component list by value
|
||||
sort( cmplist.begin(), cmplist.end(), SortComponentsByValue );
|
||||
cmplist.SortComponentsByValueOnly( );
|
||||
PrintComponentsListByPart( f, cmplist,aIncludeSubComponents );
|
||||
|
||||
fclose( f );
|
||||
|
@ -428,14 +434,16 @@ void DIALOG_BUILD_BOM::CreateExportList( const wxString& aFullFileName,
|
|||
return;
|
||||
}
|
||||
|
||||
std::vector <OBJ_CMP_TO_LIST> cmplist;
|
||||
BuildComponentsListFromSchematic( cmplist );
|
||||
SCH_REFERENCE_LIST cmplist;
|
||||
SCH_SHEET_LIST sheetList; // uses a global
|
||||
|
||||
sheetList.GetComponents( cmplist, false );
|
||||
|
||||
// sort component list
|
||||
sort( cmplist.begin(), cmplist.end(), SortComponentsByReference );
|
||||
cmplist.SortComponentsByReferenceOnly( );
|
||||
|
||||
if( !aIncludeSubComponents )
|
||||
DeleteSubCmp( cmplist );
|
||||
cmplist.RemoveSubComponentsFromList();
|
||||
|
||||
// create the file
|
||||
PrintComponentsListByRef( f, cmplist, TRUE, aIncludeSubComponents );
|
||||
|
@ -464,32 +472,34 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
|
|||
return;
|
||||
}
|
||||
|
||||
std::vector <OBJ_CMP_TO_LIST> cmplist;
|
||||
BuildComponentsListFromSchematic( cmplist );
|
||||
SCH_REFERENCE_LIST cmplist;
|
||||
SCH_SHEET_LIST sheetList;
|
||||
|
||||
sheetList.GetComponents( cmplist, false );
|
||||
|
||||
itemCount = cmplist.GetCount();
|
||||
|
||||
itemCount = cmplist.size();
|
||||
if( itemCount )
|
||||
{
|
||||
// creates the list file
|
||||
DateAndTime( Line );
|
||||
|
||||
wxString Title = wxGetApp().GetAppName() + wxT( " " ) +
|
||||
GetBuildVersion();
|
||||
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||
|
||||
fprintf( f, "%s >> Creation date: %s\n", CONV_TO_UTF8( Title ), Line );
|
||||
|
||||
// sort component list
|
||||
sort( cmplist.begin(), cmplist.end(), SortComponentsByReference );
|
||||
cmplist.SortComponentsByReferenceOnly();
|
||||
|
||||
if( !aIncludeSubComponents )
|
||||
DeleteSubCmp( cmplist );
|
||||
cmplist.RemoveSubComponentsFromList();
|
||||
|
||||
if( m_ListCmpbyRefItems->GetValue() )
|
||||
PrintComponentsListByRef( f, cmplist, false, aIncludeSubComponents );
|
||||
|
||||
if( m_ListCmpbyValItems->GetValue() )
|
||||
{
|
||||
sort( cmplist.begin(), cmplist.end(), SortComponentsByValue );
|
||||
cmplist.SortComponentsByValueOnly();
|
||||
PrintComponentsListByVal( f, cmplist, aIncludeSubComponents );
|
||||
}
|
||||
}
|
||||
|
@ -569,11 +579,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
|
|||
|
||||
/* Print the B.O.M sorted by reference
|
||||
*/
|
||||
int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
||||
FILE* f,
|
||||
std::vector <OBJ_CMP_TO_LIST>& aList,
|
||||
bool CompactForm,
|
||||
bool aIncludeSubComponents )
|
||||
int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
|
||||
SCH_REFERENCE_LIST& aList,
|
||||
bool CompactForm,
|
||||
bool aIncludeSubComponents )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
|
@ -621,7 +630,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
|||
wxString subRef;
|
||||
|
||||
// Print list of items
|
||||
for( unsigned ii = 0; ii < aList.size(); ii++ )
|
||||
for( unsigned ii = 0; ii < aList.GetCount(); ii++ )
|
||||
{
|
||||
EDA_ITEM* item = aList[ii].m_RootCmp;
|
||||
|
||||
|
@ -672,25 +681,23 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
|||
if( aIncludeSubComponents )
|
||||
{
|
||||
msg = aList[ii].m_SheetPath.PathHumanReadable();
|
||||
BASE_SCREEN * screen = (BASE_SCREEN*) comp->GetParent();
|
||||
|
||||
if( CompactForm )
|
||||
if( screen )
|
||||
{
|
||||
fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
|
||||
|
||||
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) comp->GetParent(),
|
||||
comp->m_Pos );
|
||||
|
||||
fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
|
||||
CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
|
||||
|
||||
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) comp->GetParent(),
|
||||
comp->m_Pos );
|
||||
|
||||
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
|
||||
if( CompactForm )
|
||||
{
|
||||
fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
|
||||
msg = m_Parent->GetXYSheetReferences( screen, comp->m_Pos );
|
||||
fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
|
||||
CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
|
||||
msg = m_Parent->GetXYSheetReferences( screen, comp->m_Pos );
|
||||
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -714,16 +721,14 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
|||
* This is true for most designs but will produce an
|
||||
* incorrect output if two or more parts with the same
|
||||
* value have different footprints, tolerances, voltage
|
||||
* rating, etc. Also usefull if the following fields
|
||||
* rating, etc. Also useful if the following fields
|
||||
* are edited:
|
||||
* FIELD1 - manufacture
|
||||
* FIELD2 - manufacture part number
|
||||
* FIELD3 - distributor part number
|
||||
*/
|
||||
int DIALOG_BUILD_BOM::PrintComponentsListByPart(
|
||||
FILE* f,
|
||||
std::vector <OBJ_CMP_TO_LIST>& aList,
|
||||
bool aIncludeSubComponents)
|
||||
int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* f, SCH_REFERENCE_LIST& aList,
|
||||
bool aIncludeSubComponents )
|
||||
{
|
||||
int qty = 0;
|
||||
wxString refName;
|
||||
|
@ -740,11 +745,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart(
|
|||
SCH_COMPONENT* nextCmp;
|
||||
SCH_COMPONENT dummyCmp; // A dummy component, to store fields
|
||||
|
||||
for( unsigned ii = 0; ii < aList.size(); ii++ )
|
||||
for( unsigned ii = 0; ii < aList.GetCount(); ii++ )
|
||||
{
|
||||
currCmp = (SCH_COMPONENT*) aList[ii].m_RootCmp;
|
||||
|
||||
if( ii < aList.size() -1 )
|
||||
if( ii < aList.GetCount() -1 )
|
||||
nextCmp = aList[ii+1].m_RootCmp;
|
||||
else
|
||||
nextCmp = NULL;
|
||||
|
@ -800,7 +805,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart(
|
|||
|
||||
lastRef = refName;
|
||||
|
||||
// if the next cmoponent has same value the line will be printed after.
|
||||
// if the next component has same value the line will be printed after.
|
||||
#if defined(KICAD_GOST)
|
||||
if( nextCmp && nextCmp->GetField( VALUE )->m_Text.CmpNoCase( valName ) == 0
|
||||
&& nextCmp->GetField( FOOTPRINT )->m_Text.CmpNoCase( footName ) == 0
|
||||
|
@ -856,10 +861,9 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart(
|
|||
}
|
||||
|
||||
|
||||
int DIALOG_BUILD_BOM::PrintComponentsListByVal(
|
||||
FILE* f,
|
||||
std::vector <OBJ_CMP_TO_LIST>& aList,
|
||||
bool aIncludeSubComponents )
|
||||
int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
|
||||
SCH_REFERENCE_LIST& aList,
|
||||
bool aIncludeSubComponents )
|
||||
{
|
||||
EDA_ITEM* schItem;
|
||||
SCH_COMPONENT* DrawLibItem;
|
||||
|
@ -871,11 +875,12 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
|
|||
|
||||
if( aIncludeSubComponents )
|
||||
msg << _( " (with SubCmp)" );
|
||||
|
||||
msg << wxT( "\n" );
|
||||
|
||||
fputs( CONV_TO_UTF8( msg ), f );
|
||||
|
||||
for( unsigned ii = 0; ii < aList.size(); ii++ )
|
||||
for( unsigned ii = 0; ii < aList.GetCount(); ii++ )
|
||||
{
|
||||
schItem = aList[ii].m_RootCmp;
|
||||
|
||||
|
@ -910,11 +915,14 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
|
|||
// print the sheet path
|
||||
if( aIncludeSubComponents )
|
||||
{
|
||||
msg = aList[ii].m_SheetPath.PathHumanReadable();
|
||||
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
|
||||
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) DrawLibItem->GetParent(),
|
||||
DrawLibItem->m_Pos );
|
||||
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
|
||||
BASE_SCREEN * screen = (BASE_SCREEN*) DrawLibItem->GetParent();
|
||||
if( screen )
|
||||
{
|
||||
msg = aList[ii].m_SheetPath.PathHumanReadable();
|
||||
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
|
||||
msg = m_Parent->GetXYSheetReferences( screen, DrawLibItem->m_Pos );
|
||||
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
}
|
||||
|
||||
PrintFieldData( f, DrawLibItem );
|
||||
|
|
|
@ -46,13 +46,13 @@ private:
|
|||
*/
|
||||
void CreatePartsList( const wxString& aFullFileName, bool aIncludeSubComponents );
|
||||
|
||||
int PrintComponentsListByRef( FILE* f, std::vector <OBJ_CMP_TO_LIST>& aList,
|
||||
int PrintComponentsListByRef( FILE* f, SCH_REFERENCE_LIST& aList,
|
||||
bool CompactForm, bool aIncludeSubComponents );
|
||||
|
||||
int PrintComponentsListByVal( FILE* f, std::vector <OBJ_CMP_TO_LIST>& aList,
|
||||
int PrintComponentsListByVal( FILE* f, SCH_REFERENCE_LIST& aList,
|
||||
bool aIncludeSubComponents );
|
||||
|
||||
int PrintComponentsListByPart( FILE* f, std::vector <OBJ_CMP_TO_LIST>& aList,
|
||||
int PrintComponentsListByPart( FILE* f, SCH_REFERENCE_LIST& aList,
|
||||
bool aIncludeSubComponents );
|
||||
|
||||
void PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem, bool CompactForm = FALSE );
|
||||
|
|
|
@ -412,7 +412,9 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
|
|||
|
||||
m_writeErcFile = m_WriteResultOpt->GetValue();
|
||||
|
||||
ReAnnotatePowerSymbolsOnly();
|
||||
/* Build the whole sheet list in hierarchy (sheet, not screen) */
|
||||
SCH_SHEET_LIST sheets;
|
||||
sheets.AnnotatePowerSymbols();
|
||||
|
||||
if( m_Parent->CheckAnnotate( aMessagesList, false ) )
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include "eeschema_id.h"
|
||||
#include "general.h"
|
||||
#include "netlist.h"
|
||||
#include "netlist_control.h"
|
||||
#include "protos.h"
|
||||
#include "libeditframe.h"
|
||||
#include "eeschema_config.h"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <wx/gdicmn.h>
|
||||
|
||||
#include "block_commande.h"
|
||||
#include "class_netlist_object.h"
|
||||
|
||||
|
||||
class SCH_ITEM;
|
||||
|
@ -203,4 +204,12 @@ extern int g_ItemSelectetColor;
|
|||
// eeschema
|
||||
extern int g_InvisibleItemColor;
|
||||
|
||||
/* Global Variables */
|
||||
|
||||
extern NETLIST_OBJECT_LIST g_NetObjectslist;
|
||||
|
||||
extern bool g_OptNetListUseNames; /* TRUE to use names rather than
|
||||
* net numbers. SPICE netlist only
|
||||
*/
|
||||
|
||||
#endif // _GENERAL_H_
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
#include "general.h"
|
||||
#include "netlist.h"
|
||||
#include "netlist_control.h"
|
||||
#include "protos.h"
|
||||
#include "class_library.h"
|
||||
#include "lib_pin.h"
|
||||
|
@ -143,7 +144,7 @@ class EXPORT_HELP
|
|||
|
||||
/**
|
||||
* Function eraseDuplicatePins
|
||||
* removes duplicate Pins fromt the pin list, m_SortedComponentPinList.
|
||||
* removes duplicate Pins from the pin list, m_SortedComponentPinList.
|
||||
* (This is a list of pins found in the whole schematic, for a single
|
||||
* component.) These duplicate pins were put in list because some pins (powers... )
|
||||
* are found more than one time when we have a multiple parts per package
|
||||
|
@ -725,7 +726,7 @@ XNODE* EXPORT_HELP::makeGenericLibParts()
|
|||
LIB_COMPONENT* lcomp = (LIB_COMPONENT*) *it;
|
||||
CMP_LIBRARY* library = lcomp->GetLibrary();
|
||||
|
||||
m_Libraries.insert( library ); // inserts component's library iff unique
|
||||
m_Libraries.insert( library ); // inserts component's library if unique
|
||||
|
||||
XNODE* xlibpart;
|
||||
xlibparts->AddChild( xlibpart = node( sLibpart ) );
|
||||
|
@ -958,7 +959,7 @@ XNODE* EXPORT_HELP::makeGenericComponents()
|
|||
|
||||
XNODE* xcomp; // current component being constructed
|
||||
|
||||
// Output the component's elments in order of expected access frequency.
|
||||
// Output the component's elements in order of expected access frequency.
|
||||
// This may not always look best, but it will allow faster execution
|
||||
// under XSL processing systems which do sequential searching within
|
||||
// an element.
|
||||
|
@ -1015,8 +1016,8 @@ XNODE* EXPORT_HELP::makeGenericComponents()
|
|||
timeStamp.Printf( sTSFmt, comp->m_TimeStamp );
|
||||
xcomp->AddChild( node( sTStamp, timeStamp ) );
|
||||
|
||||
// Add pins list for this cmponent.
|
||||
// Usedful to build netlist which have pads connection inside the footprint description
|
||||
// Add pins list for this component.
|
||||
// Useful to build netlist which have pads connection inside the footprint description
|
||||
// (Spice, OrcadPCB2 ...)
|
||||
XNODE* xpinslist;
|
||||
xcomp->AddChild( xpinslist = node( sPins ) );
|
||||
|
@ -1086,7 +1087,7 @@ bool EXPORT_HELP::WriteGENERICNetList( SCH_EDIT_FRAME* frame, const wxString& aO
|
|||
|
||||
return xdoc.Save( aOutFileName, 2 /* indent bug, today was ignored by wxXml lib */ );
|
||||
|
||||
#else // ouput the well established/old generic net list format which was not XML.
|
||||
#else // output the well established/old generic net list format which was not XML.
|
||||
|
||||
wxString field;
|
||||
wxString footprint;
|
||||
|
@ -1341,7 +1342,7 @@ bool EXPORT_HELP::WriteNetListPCBNEW( SCH_EDIT_FRAME* frame, FILE* f, bool with_
|
|||
int ret = 0; // zero now, OR in the sign bit on error
|
||||
wxString netName;
|
||||
|
||||
std::vector<OBJ_CMP_TO_LIST> cmpList;
|
||||
std::vector< SCH_REFERENCE > cmpList;
|
||||
|
||||
DateAndTime( dateBuf );
|
||||
|
||||
|
@ -1361,6 +1362,7 @@ bool EXPORT_HELP::WriteNetListPCBNEW( SCH_EDIT_FRAME* frame, FILE* f, bool with_
|
|||
for( EDA_ITEM* item = path->LastDrawList(); item; item = item->Next() )
|
||||
{
|
||||
SCH_COMPONENT* comp = findNextComponentAndCreatPinList( item, path );
|
||||
|
||||
if( !comp )
|
||||
break;
|
||||
|
||||
|
@ -1375,8 +1377,7 @@ bool EXPORT_HELP::WriteNetListPCBNEW( SCH_EDIT_FRAME* frame, FILE* f, bool with_
|
|||
{
|
||||
if( entry->GetFootPrints().GetCount() != 0 ) // Put in list
|
||||
{
|
||||
cmpList.push_back( OBJ_CMP_TO_LIST() );
|
||||
|
||||
cmpList.push_back( SCH_REFERENCE() );
|
||||
cmpList.back().m_RootCmp = comp;
|
||||
cmpList.back().SetRef( comp->GetRef( path ) );
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "sch_no_connect.h"
|
||||
#include "sch_text.h"
|
||||
#include "sch_sheet.h"
|
||||
|
||||
#include "algorithm"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
@ -369,8 +368,8 @@ void FindBestNetNameForEachNet( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
|||
* @param aLabelItemBuffer = list of NETLIST_OBJECT type labels candidates.
|
||||
* labels are local labels, hierarchical labels or pin labels
|
||||
* labels in included sheets have a lower priority than labels in the current sheet.
|
||||
* so labels inside the root sheet have the highter priority.
|
||||
* pin labels are global labels and have the highter priority
|
||||
* so labels inside the root sheet have the higher priority.
|
||||
* pin labels are global labels and have the higher priority
|
||||
* local labels have the lower priority
|
||||
* labels having the same priority are sorted by alphabetic order.
|
||||
*
|
||||
|
@ -434,7 +433,7 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
|
|||
}
|
||||
else // not global: names are prefixed by their sheetpath
|
||||
{
|
||||
// use name defined in highter hierarchical sheet
|
||||
// use name defined in higher hierarchical sheet
|
||||
// (i.e. shorter path because paths are /<timestamp1>/<timestamp2>/...
|
||||
// and timestamp = 8 letters.
|
||||
if( candidate->m_SheetList.Path().Length() < item->m_SheetList.Path().Length() )
|
||||
|
|
|
@ -2,6 +2,32 @@
|
|||
/* netlist.h */
|
||||
/***************/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2011 jean-pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
||||
* Copyright (C) 1992-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 Kicad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NETLIST_H_
|
||||
#define _NETLIST_H_
|
||||
|
||||
|
@ -9,6 +35,7 @@
|
|||
#include "macros.h"
|
||||
|
||||
#include "class_libentry.h"
|
||||
#include "sch_sheet_path.h"
|
||||
|
||||
|
||||
class SCH_COMPONENT;
|
||||
|
@ -18,37 +45,18 @@ class SCH_COMPONENT;
|
|||
|
||||
#define ISBUS 1
|
||||
|
||||
#define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
|
||||
|
||||
#include "class_netlist_object.h"
|
||||
|
||||
/* Id to select netlist type */
|
||||
enum TypeNetForm {
|
||||
NET_TYPE_UNINIT = 0,
|
||||
NET_TYPE_PCBNEW,
|
||||
NET_TYPE_ORCADPCB2,
|
||||
NET_TYPE_CADSTAR,
|
||||
NET_TYPE_SPICE,
|
||||
NET_TYPE_CUSTOM1, /* NET_TYPE_CUSTOM1
|
||||
* is the first id for user netlist format
|
||||
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
|
||||
* is the last id for user netlist format
|
||||
*/
|
||||
NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1 + CUSTOMPANEL_COUNTMAX - 1
|
||||
};
|
||||
|
||||
|
||||
/* Max pin number per component and footprint */
|
||||
#define MAXPIN 5000
|
||||
|
||||
|
||||
/* object used in annotation to handle a list of components in schematic
|
||||
* because in a complex hierarchy, a component is used more than once,
|
||||
* and its reference is depending on the sheet path
|
||||
* for the same component, we must create a flat list of components
|
||||
* used in nelist generation, BOM generation and annotation
|
||||
/**
|
||||
* Class SCH_REFERENCE
|
||||
* is used as a helper to define a component's reference designator in a schematic. This
|
||||
* helper is required in a complex hierarchy because a component can be used more than
|
||||
* once and its reference depends on the sheet path. This class is used to flatten the
|
||||
* schematic hierarchy for annotation, net list generation, and bill of material
|
||||
* generation.
|
||||
*/
|
||||
class OBJ_CMP_TO_LIST
|
||||
class SCH_REFERENCE
|
||||
{
|
||||
private:
|
||||
/// Component reference prefix, without number (for IC1, this is IC) )
|
||||
|
@ -60,7 +68,10 @@ public:
|
|||
LIB_COMPONENT* m_Entry; // the source component in library
|
||||
int m_Unit; /* Selected part (For multi parts per
|
||||
* package) depending on sheet path */
|
||||
wxPoint m_CmpPos; // The physical position of the component in schematic
|
||||
// used to annotate by Y ou Y position
|
||||
SCH_SHEET_PATH m_SheetPath; /* the sheet path for this component */
|
||||
int m_SheetNum; // the sheet num for this component
|
||||
unsigned long m_TimeStamp; /* unique identification number
|
||||
* depending on sheet path */
|
||||
bool m_IsNew; /* true for not yet annotated
|
||||
|
@ -73,7 +84,7 @@ public:
|
|||
|
||||
public:
|
||||
|
||||
OBJ_CMP_TO_LIST()
|
||||
SCH_REFERENCE()
|
||||
{
|
||||
m_RootCmp = NULL;
|
||||
m_Entry = NULL;
|
||||
|
@ -83,8 +94,27 @@ public:
|
|||
m_Value = NULL;
|
||||
m_NumRef = 0;
|
||||
m_Flag = 0;
|
||||
m_SheetNum = 0;
|
||||
}
|
||||
|
||||
SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_COMPONENT* aLibComponent,
|
||||
SCH_SHEET_PATH& aSheetPath );
|
||||
|
||||
/**
|
||||
* Function Annotate
|
||||
* updates the annotation of the component according the the current object state.
|
||||
*/
|
||||
void Annotate();
|
||||
|
||||
/**
|
||||
* Function Split
|
||||
* attempts to split the reference designator into a name (U) and number (1). If the
|
||||
* last character is '?' or not a digit, the reference is tagged as not annotated.
|
||||
* For components with multiple parts per package that are not already annotated, set
|
||||
* m_Unit to a max value (0x7FFFFFFF).
|
||||
*/
|
||||
void Split();
|
||||
|
||||
/* Some accessors which hide the strategy of how the reference is stored,
|
||||
thereby making it easy to change that strategy.
|
||||
*/
|
||||
|
@ -108,13 +138,13 @@ public:
|
|||
}
|
||||
|
||||
|
||||
int CompareValue( const OBJ_CMP_TO_LIST& item ) const
|
||||
int CompareValue( const SCH_REFERENCE& item ) const
|
||||
{
|
||||
return m_Value->CmpNoCase( *item.m_Value );
|
||||
}
|
||||
|
||||
|
||||
int CompareRef( const OBJ_CMP_TO_LIST& item ) const
|
||||
int CompareRef( const SCH_REFERENCE& item ) const
|
||||
{
|
||||
return m_Ref.compare( item.m_Ref );
|
||||
}
|
||||
|
@ -126,30 +156,225 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/* object used in annotation to handle a list of components in schematic
|
||||
* because in a complex hierarchy, a component is used more than once,
|
||||
* and its reference is depending on the sheet path
|
||||
* for the same component, we must create a flat list of components
|
||||
* used in nelist generation, BOM generation and annotation
|
||||
*/
|
||||
|
||||
/* Global Variables */
|
||||
class SCH_REFERENCE_LIST
|
||||
{
|
||||
private:
|
||||
std::vector <SCH_REFERENCE> componentFlatList;
|
||||
|
||||
// Buffer to build the list of items used in netlist and erc calculations
|
||||
typedef std::vector <NETLIST_OBJECT*> NETLIST_OBJECT_LIST;
|
||||
extern NETLIST_OBJECT_LIST g_NetObjectslist;
|
||||
public:
|
||||
/** Constructor
|
||||
*/
|
||||
SCH_REFERENCE_LIST()
|
||||
{
|
||||
}
|
||||
|
||||
extern bool g_OptNetListUseNames; /* TRUE to use names rather than
|
||||
* net numbers. SPICE netlist only
|
||||
*/
|
||||
SCH_REFERENCE& operator[]( int aIndex )
|
||||
{
|
||||
return componentFlatList[ aIndex ];
|
||||
}
|
||||
|
||||
/* Prototypes: */
|
||||
void FreeNetObjectsList( std::vector <NETLIST_OBJECT*>& aNetObjectslist );
|
||||
/**
|
||||
* Function GetCount
|
||||
* @return the number of items in the list
|
||||
*/
|
||||
unsigned GetCount()
|
||||
{
|
||||
return componentFlatList.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetItem
|
||||
* @return the aIdx item
|
||||
*/
|
||||
SCH_REFERENCE& GetItem(int aIdx)
|
||||
{
|
||||
return componentFlatList[aIdx];
|
||||
}
|
||||
|
||||
/**
|
||||
* Function AddItem
|
||||
* Add a OBJ_CMP_TO_LIST object in aComponentsList for each component found
|
||||
* in sheet
|
||||
* @param aItem - a SCH_REFERENCE item to add
|
||||
*/
|
||||
void AddItem( SCH_REFERENCE& aItem )
|
||||
{
|
||||
componentFlatList.push_back( aItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function RemoveSubComponentsFromList
|
||||
* Remove sub components from the list, when multiples parts per package are
|
||||
* found in this list.
|
||||
* Useful to create BOM, when a component must appear only once
|
||||
*/
|
||||
void RemoveSubComponentsFromList( );
|
||||
|
||||
/* Sort functions:
|
||||
* Sort functions are used to sort components for annotatioon or BOM generation.
|
||||
* Because sorting depend on we want to do, there are many sort functions.
|
||||
* Note:
|
||||
* When creating BOM, components are fully annotated.
|
||||
* references are somethink like U3, U5 or R4, R8
|
||||
* When annotating, some or all components are not annotated,
|
||||
* i.e. ref is only U or R, with no number.
|
||||
*/
|
||||
/**
|
||||
* Function SortCmpByXCoordinate
|
||||
* sort the flat list by X coordinates.
|
||||
* The list is always sorted first by ref and sheet
|
||||
*/
|
||||
void SortCmpByXCoordinate()
|
||||
{
|
||||
sort( componentFlatList.begin(), componentFlatList.end(), sortBy_X_Position );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SortCmpByYCoordinate
|
||||
* sort the flat list by Y coordinates.
|
||||
* The list is always sorted first by ref and sheet
|
||||
*/
|
||||
void SortCmpByYCoordinate()
|
||||
{
|
||||
sort( componentFlatList.begin(), componentFlatList.end(), sortBy_Y_Position );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SortComponentsByTimeStamp
|
||||
* sort the flat list by Time Stamp.
|
||||
* Useful to detect duplicate Time Stamps
|
||||
*/
|
||||
void SortComponentsByTimeStamp()
|
||||
{
|
||||
sort( componentFlatList.begin(), componentFlatList.end(), sortByTimeStamp );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SortComponentsByValue
|
||||
* sort the flat list by Value.
|
||||
* Values are sorted by numeric values, not by alpahbetic order
|
||||
* The list is always sorted first by ref
|
||||
*/
|
||||
void SortComponentsByRefAndValue()
|
||||
{
|
||||
sort( componentFlatList.begin(), componentFlatList.end(), sortByRefAndValue );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SortComponentsByReferenceOnly
|
||||
* sort the flat list by references
|
||||
* For BOM, sorted by reference
|
||||
*/
|
||||
void SortComponentsByReferenceOnly()
|
||||
{
|
||||
sort( componentFlatList.begin(), componentFlatList.end(), sortComponentsByReferenceOnly );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SortComponentsByValueOnly
|
||||
* sort the flat list by references
|
||||
* For BOM, sorted by values
|
||||
*/
|
||||
void SortComponentsByValueOnly()
|
||||
{
|
||||
sort( componentFlatList.begin(), componentFlatList.end(), sortComponentsByValueOnly );
|
||||
}
|
||||
|
||||
private:
|
||||
/* sort functions used to sort componentFlatList
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function sortByRefAndValue
|
||||
* sort function to annotate items by value
|
||||
* Components are sorted
|
||||
* by reference (when used, referenc is only U ot R, with no number)
|
||||
* if same reference: by value
|
||||
* if same value: by unit number
|
||||
* if same unit number, by sheet
|
||||
* if same sheet, by position X, and Y
|
||||
* @param item1, item2 = SCH_REFERENCE items to compare
|
||||
*/
|
||||
static bool sortByRefAndValue( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||
/**
|
||||
* Function sortBy_X_Position
|
||||
* sort function to annotate items from their position.
|
||||
* Components are sorted
|
||||
* by reference (when used, referenc is only U ot R, with no number)
|
||||
* if same reference: by sheet
|
||||
* if same sheet, by X pos
|
||||
* if same X pos, by Y pos
|
||||
* if same Y pos, by time stamp
|
||||
* @param item1, item2 = SCH_REFERENCE items to compare
|
||||
*/
|
||||
static bool sortBy_X_Position( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||
|
||||
/**
|
||||
* Function sortBy_Y_Position
|
||||
* sort function to annotate items from their position.
|
||||
* Components are sorted
|
||||
* by reference (when used, referenc is only U ot R, with no number)
|
||||
* if same reference: by sheet
|
||||
* if same sheet, by Y pos
|
||||
* if same Y pos, by X pos
|
||||
* if same X pos, by time stamp
|
||||
* @param item1, item2 = SCH_REFERENCE items to compare
|
||||
*/
|
||||
static bool sortBy_Y_Position( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||
|
||||
static bool sortByTimeStamp( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||
|
||||
/**
|
||||
* Function sortComponentsByValueOnly
|
||||
* compare function for sorting in BOM creation.
|
||||
* components are sorted
|
||||
* by value
|
||||
* if same value: by reference
|
||||
* if same reference: by unit number
|
||||
* @param item1, item2 = SCH_REFERENCE items to compare
|
||||
*/
|
||||
|
||||
static bool sortComponentsByValueOnly( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||
/**
|
||||
* Function sortComponentsByReferenceOnly
|
||||
* compare function for sorting in BOM creation.
|
||||
* components are sorted
|
||||
* by reference
|
||||
* if same reference: by value (happens only for multi parts per package)
|
||||
* if same value: by unit number
|
||||
* @param item1, item2 = SCH_REFERENCE items to compare
|
||||
*/
|
||||
static bool sortComponentsByReferenceOnly( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||
};
|
||||
|
||||
/**
|
||||
* Function ReturnUserNetlistTypeName
|
||||
* to retrieve user netlist type names
|
||||
* @param first_item = true: return first name of the list, false = return next
|
||||
* @return a wxString : name of the type netlist or empty string
|
||||
* this function must be called first with "first_item" = true
|
||||
* and after with "first_item" = false to get all the other existing netlist
|
||||
* names
|
||||
* helper Class LABEL_OBJECT
|
||||
* is used in build BOM to handle the list of labels in schematic
|
||||
* because in a complex hierarchy, a label is used more than once,
|
||||
* and had more than one sheet path, so we must create a flat list of labels
|
||||
*/
|
||||
wxString ReturnUserNetlistTypeName( bool first_item );
|
||||
class LABEL_OBJECT
|
||||
{
|
||||
public:
|
||||
int m_LabelType;
|
||||
SCH_ITEM* m_Label;
|
||||
|
||||
//have to store it here since the object references will be duplicated.
|
||||
SCH_SHEET_PATH m_SheetPath; //composed of UIDs
|
||||
|
||||
public: LABEL_OBJECT()
|
||||
{
|
||||
m_Label = NULL;
|
||||
m_LabelType = 0;
|
||||
}
|
||||
};
|
||||
typedef std::vector <LABEL_OBJECT> LABEL_OBJECT_LIST;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -517,7 +517,8 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
|
|||
bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
|
||||
bool aUse_netnames )
|
||||
{
|
||||
ReAnnotatePowerSymbolsOnly();
|
||||
SCH_SHEET_LIST sheets;
|
||||
sheets.AnnotatePowerSymbols();
|
||||
|
||||
// Performs some controls:
|
||||
if( CheckAnnotate( NULL, 0 ) )
|
||||
|
@ -534,19 +535,8 @@ bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
|
|||
}
|
||||
|
||||
/* Cleanup the entire hierarchy */
|
||||
SCH_SCREENS ScreenList;
|
||||
for( SCH_SCREEN* screen = ScreenList.GetFirst();
|
||||
screen != NULL;
|
||||
screen = ScreenList.GetNext() )
|
||||
{
|
||||
bool ModifyWires;
|
||||
ModifyWires = screen->SchematicCleanUp( NULL );
|
||||
|
||||
// if wire list has changed, delete the Undo Redo list to avoid
|
||||
// pointer problems with deleted data
|
||||
if( ModifyWires )
|
||||
screen->ClearUndoRedoList();
|
||||
}
|
||||
SCH_SCREENS screens;
|
||||
screens.SchematicCleanUp();
|
||||
|
||||
BuildNetListBase();
|
||||
bool success = WriteNetListFile( aFormat, aFullFileName, g_OptNetListUseNames );
|
||||
|
@ -555,23 +545,18 @@ bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
void WinEDA_NetlistFrame::OnCancelClick( wxCommandEvent& event )
|
||||
/***********************************************************/
|
||||
{
|
||||
EndModal( NET_ABORT );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event )
|
||||
/***********************************************************/
|
||||
{
|
||||
wxFileName fn;
|
||||
wxString ExecFile, CommandLine;
|
||||
|
||||
g_SimulatorCommandLine =
|
||||
m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->GetValue();
|
||||
g_SimulatorCommandLine = m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->GetValue();
|
||||
g_SimulatorCommandLine.Trim( FALSE );
|
||||
g_SimulatorCommandLine.Trim( TRUE );
|
||||
ExecFile = g_SimulatorCommandLine.BeforeFirst( ' ' );
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
#ifndef _NETLIST_CONTROL_H_
|
||||
#define _NETLIST_CONTROL_H_
|
||||
|
||||
class WinEDA_EnterText;
|
||||
|
||||
|
||||
/* Event id for notebook page buttons: */
|
||||
enum id_netlist {
|
||||
ID_CREATE_NETLIST = 1550,
|
||||
|
@ -67,6 +70,24 @@ public:
|
|||
};
|
||||
|
||||
|
||||
#define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
|
||||
|
||||
/* Id to select netlist type */
|
||||
enum TypeNetForm {
|
||||
NET_TYPE_UNINIT = 0,
|
||||
NET_TYPE_PCBNEW,
|
||||
NET_TYPE_ORCADPCB2,
|
||||
NET_TYPE_CADSTAR,
|
||||
NET_TYPE_SPICE,
|
||||
NET_TYPE_CUSTOM1, /* NET_TYPE_CUSTOM1
|
||||
* is the first id for user netlist format
|
||||
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
|
||||
* is the last id for user netlist format
|
||||
*/
|
||||
NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1 + CUSTOMPANEL_COUNTMAX - 1
|
||||
};
|
||||
|
||||
|
||||
/* Dialog frame for creating netlists */
|
||||
class WinEDA_NetlistFrame : public wxDialog
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ class PLOTTER;
|
|||
class SCH_SHEET;
|
||||
class LIB_PIN;
|
||||
class LABEL_OBJECT;
|
||||
class OBJ_CMP_TO_LIST;
|
||||
class NETLIST_OBJECT;
|
||||
|
||||
|
||||
wxString ReturnDefaultFieldName( int aFieldNdx );
|
||||
|
@ -65,43 +65,11 @@ bool LibItemInBox( int x1, int y1, int x2, int y2, SCH_COMPONENT* Draw
|
|||
void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct );
|
||||
|
||||
|
||||
// build_BOM.cpp
|
||||
/**
|
||||
* Class LABEL_OBJECT
|
||||
* is used in build BOM to handle the list of labels in schematic
|
||||
* because in a complex hierarchy, a label is used more than once,
|
||||
* and had more than one sheet path, so we must create a flat list of labels
|
||||
*/
|
||||
class LABEL_OBJECT
|
||||
{
|
||||
public:
|
||||
int m_LabelType;
|
||||
SCH_ITEM* m_Label;
|
||||
|
||||
//have to store it here since the object references will be duplicated.
|
||||
SCH_SHEET_PATH m_SheetPath; //composed of UIDs
|
||||
|
||||
public: LABEL_OBJECT()
|
||||
{
|
||||
m_Label = NULL;
|
||||
m_LabelType = 0;
|
||||
}
|
||||
};
|
||||
|
||||
void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList );
|
||||
void GenListeGLabels( std::vector <LABEL_OBJECT>& aList );
|
||||
bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 );
|
||||
bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 );
|
||||
bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 );
|
||||
bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 );
|
||||
void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList );
|
||||
int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList );
|
||||
|
||||
|
||||
// operations_on_item_lists.cpp
|
||||
|
||||
/**
|
||||
* Function DuplicateStruct
|
||||
* Routine to create a new copy of given struct.
|
||||
* creates a new copy of given struct.
|
||||
* @param aDrawStruct = the SCH_ITEM to duplicate
|
||||
* @param aClone (defualt = true)
|
||||
* if true duplicate also some parameters that must be unique
|
||||
|
@ -194,12 +162,6 @@ EDA_Colors ReturnLayerColor( int Layer );
|
|||
/**************/
|
||||
int IsBusLabel( const wxString& LabelDrawList );
|
||||
|
||||
/***************/
|
||||
/* ANNOTATE.CPP */
|
||||
/***************/
|
||||
void ReAnnotatePowerSymbolsOnly();
|
||||
|
||||
|
||||
/************/
|
||||
/* PLOT.CPP */
|
||||
/************/
|
||||
|
@ -312,4 +274,19 @@ void DisplayOptionFrame( SCH_EDIT_FRAME* parent, const wxPoint& framepos );
|
|||
/****************/
|
||||
void RemoteCommand( const char* cmdline );
|
||||
|
||||
|
||||
/* Prototypes in netlist_control.cpp */
|
||||
void FreeNetObjectsList( std::vector <NETLIST_OBJECT*>& aNetObjectslist );
|
||||
|
||||
/**
|
||||
* Function ReturnUserNetlistTypeName
|
||||
* to retrieve user netlist type names
|
||||
* @param first_item = true: return first name of the list, false = return next
|
||||
* @return a wxString : name of the type netlist or empty string
|
||||
* this function must be called first with "first_item" = true
|
||||
* and after with "first_item" = false to get all the other existing netlist
|
||||
* names
|
||||
*/
|
||||
wxString ReturnUserNetlistTypeName( bool first_item );
|
||||
|
||||
#endif /* __PROTOS_H__ */
|
||||
|
|
|
@ -622,7 +622,7 @@ void SCH_COMPONENT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet )
|
||||
void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
|
||||
{
|
||||
wxString defRef = m_prefix;
|
||||
bool KeepMulti = false;
|
||||
|
@ -648,15 +648,15 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet )
|
|||
wxString NewHref;
|
||||
wxString path;
|
||||
|
||||
if( aSheet )
|
||||
path = GetPath( aSheet );
|
||||
if( aSheetPath )
|
||||
path = GetPath( aSheetPath );
|
||||
|
||||
for( unsigned int ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
|
||||
{
|
||||
// Break hierarchical reference in path, ref and multi selection:
|
||||
reference_fields = wxStringTokenize( m_PathsAndReferences[ii], separators );
|
||||
|
||||
if( aSheet == NULL || reference_fields[0].Cmp( path ) == 0 )
|
||||
if( aSheetPath == NULL || reference_fields[0].Cmp( path ) == 0 )
|
||||
{
|
||||
if( KeepMulti ) // Get and keep part selection
|
||||
multi = reference_fields[2];
|
||||
|
@ -680,6 +680,8 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet )
|
|||
// UpdateAllScreenReferences for the active sheet.
|
||||
// But this call cannot made here.
|
||||
m_Fields[REFERENCE].m_Text = defRef; //for drawing.
|
||||
|
||||
SetModified();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ class SCH_COMPONENT : public SCH_ITEM
|
|||
/**
|
||||
* Defines the hierarchical path and reference of the component. This allowa support
|
||||
* for hierarchical sheets that reference the same schematic. The foramt for the path
|
||||
* is /<sheet time stamp>/<sheet time stamp>/... A single / denotes the root
|
||||
* sheet.
|
||||
* is /<sheet time stamp>/<sheet time stamp>/.../&lscomponent time stamp>.
|
||||
* A single / denotes the root sheet.
|
||||
*/
|
||||
wxArrayString m_PathsAndReferences;
|
||||
|
||||
|
@ -168,10 +168,10 @@ public:
|
|||
/**
|
||||
* Function ClearAnnotation
|
||||
* clears exiting component annotation ( i.i IC23 changed to IC? and part reset to 1)
|
||||
* @param aSheet: SCH_SHEET_PATH value: if NULL remove all annotations,
|
||||
* else remove annotation relative to this sheetpath
|
||||
* @param aSheetPath: SCH_SHEET_PATH value: if NULL remove all annotations,
|
||||
* else remove annotation relative to this sheetpath
|
||||
*/
|
||||
void ClearAnnotation( SCH_SHEET_PATH* aSheet );
|
||||
void ClearAnnotation( SCH_SHEET_PATH* aSheetPath );
|
||||
|
||||
/**
|
||||
* Function SetTimeStamp
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "general.h"
|
||||
#include "protos.h"
|
||||
#include "netlist.h"
|
||||
#include "class_library.h"
|
||||
#include "sch_items.h"
|
||||
#include "sch_line.h"
|
||||
|
@ -418,10 +419,57 @@ int SCH_SCREEN::CountConnectedItems( const wxPoint& aPos, bool aTestJunctions )
|
|||
}
|
||||
|
||||
|
||||
void SCH_SCREEN::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
|
||||
{
|
||||
for( SCH_ITEM* item = GetDrawItems(); item != NULL; item = item->Next() )
|
||||
{
|
||||
if( item->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
||||
|
||||
component->ClearAnnotation( aSheetPath );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_SCREEN::GetHierarchicalItems( std::vector <SCH_ITEM*> aItems )
|
||||
{
|
||||
SCH_ITEM* item = GetDrawItems();
|
||||
|
||||
while( item )
|
||||
{
|
||||
if( ( item->Type() == SCH_SHEET_T ) || ( item->Type() == SCH_COMPONENT_T ) )
|
||||
aItems.push_back( item );
|
||||
|
||||
item = item->Next();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
/* Class SCH_SCREENS to handle the list of screens in a hierarchy */
|
||||
/******************************************************************/
|
||||
|
||||
/**
|
||||
* Function SortByTimeStamp
|
||||
* sorts a list of schematic items by time stamp and type.
|
||||
*/
|
||||
static bool SortByTimeStamp( const SCH_ITEM* item1, const SCH_ITEM* item2 )
|
||||
{
|
||||
int ii = item1->m_TimeStamp - item2->m_TimeStamp;
|
||||
|
||||
/* If the time stamps are the same, compare type in order to have component objects
|
||||
* before sheet object. This is done because the changing the sheet time stamp
|
||||
* before the component time stamp could cause the current annotation to be lost.
|
||||
*/
|
||||
if( ( ii == 0 && ( item1->Type() != item2->Type() ) ) && ( item1->Type() == SCH_SHEET_T ) )
|
||||
ii = -1;
|
||||
|
||||
return ii < 0;
|
||||
}
|
||||
|
||||
|
||||
SCH_SCREENS::SCH_SCREENS()
|
||||
{
|
||||
m_index = 0;
|
||||
|
@ -503,3 +551,72 @@ void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_SCREENS::ClearAnnotation()
|
||||
{
|
||||
for( size_t i = 0; i < m_screens.size(); i++ )
|
||||
m_screens[i]->ClearAnnotation( NULL );
|
||||
}
|
||||
|
||||
|
||||
void SCH_SCREENS::SchematicCleanUp()
|
||||
{
|
||||
for( size_t i = 0; i < m_screens.size(); i++ )
|
||||
{
|
||||
// if wire list has changed, delete the undo/redo list to avoid
|
||||
// pointer problems with deleted data.
|
||||
if( m_screens[i]->SchematicCleanUp( NULL ) )
|
||||
m_screens[i]->ClearUndoRedoList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int SCH_SCREENS::ReplaceDuplicateTimeStamps()
|
||||
{
|
||||
std::vector <SCH_ITEM*> items;
|
||||
SCH_ITEM* item;
|
||||
|
||||
for( size_t i = 0; i < m_screens.size(); i++ )
|
||||
m_screens[i]->GetHierarchicalItems( items );
|
||||
|
||||
if( items.size() < 2 )
|
||||
return 0;
|
||||
|
||||
sort( items.begin(), items.end(), SortByTimeStamp );
|
||||
|
||||
int count = 0;
|
||||
|
||||
for( size_t ii = 0; ii < items.size() - 1; ii++ )
|
||||
{
|
||||
item = items[ii];
|
||||
|
||||
SCH_ITEM* nextItem = items[ii + 1];
|
||||
|
||||
if( item->m_TimeStamp == nextItem->m_TimeStamp )
|
||||
{
|
||||
count++;
|
||||
|
||||
// for a component, update its Time stamp and its paths
|
||||
// (m_PathsAndReferences field)
|
||||
if( item->Type() == SCH_COMPONENT_T )
|
||||
( (SCH_COMPONENT*) item )->SetTimeStamp( GetTimeStamp() );
|
||||
|
||||
// for a sheet, update only its time stamp (annotation of its
|
||||
// components will be lost)
|
||||
// @todo: see how to change sheet paths for its cmp list (can
|
||||
// be possible in most cases)
|
||||
else
|
||||
item->m_TimeStamp = GetTimeStamp();
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
void SCH_SCREENS::SetDate( const wxString& aDate )
|
||||
{
|
||||
for( size_t i = 0; i < m_screens.size(); i++ )
|
||||
m_screens[i]->m_Date = aDate;
|
||||
}
|
||||
|
|
|
@ -861,6 +861,11 @@ void SCH_SHEET::DisplayInfo( WinEDA_DrawFrame* frame )
|
|||
frame->ClearMsgPanel();
|
||||
frame->AppendMsgPanel( _( "Sheet name" ), m_SheetName, CYAN );
|
||||
frame->AppendMsgPanel( _( "File name" ), m_FileName, BROWN );
|
||||
#if 0 // Set to 1 to display the sheet time stamp (mainly for test)
|
||||
wxString msg;
|
||||
msg.Printf(wxT("%.8X"), m_TimeStamp );
|
||||
frame->AppendMsgPanel( _( "Time Stamp" ), msg, BLUE );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include "class_sch_screen.h"
|
||||
#include "sch_item_struct.h"
|
||||
|
||||
#include "netlist.h"
|
||||
#include "class_library.h"
|
||||
#include "sch_sheet.h"
|
||||
#include "sch_sheet_path.h"
|
||||
#include "sch_component.h"
|
||||
|
@ -55,16 +57,20 @@ bool SCH_SHEET_PATH::BuildSheetPathInfoFromSheetPathValue( const wxString& aPath
|
|||
return true;
|
||||
|
||||
SCH_ITEM* schitem = LastDrawList();
|
||||
|
||||
while( schitem && GetSheetsCount() < NB_MAX_SHEET )
|
||||
{
|
||||
if( schitem->Type() == SCH_SHEET_T )
|
||||
{
|
||||
SCH_SHEET* sheet = (SCH_SHEET*) schitem;
|
||||
Push( sheet );
|
||||
|
||||
if( aPath == Path() )
|
||||
return true;
|
||||
|
||||
if( BuildSheetPathInfoFromSheetPathValue( aPath ) )
|
||||
return true;
|
||||
|
||||
Pop();
|
||||
}
|
||||
schitem = schitem->Next();
|
||||
|
@ -84,17 +90,17 @@ int SCH_SHEET_PATH::Cmp( const SCH_SHEET_PATH& aSheetPathToTest ) const
|
|||
{
|
||||
if( m_numSheets > aSheetPathToTest.m_numSheets )
|
||||
return 1;
|
||||
|
||||
if( m_numSheets < aSheetPathToTest.m_numSheets )
|
||||
return -1;
|
||||
|
||||
//otherwise, same number of sheets.
|
||||
for( unsigned i = 0; i<m_numSheets; i++ )
|
||||
{
|
||||
if( m_sheets[i]->m_TimeStamp >
|
||||
aSheetPathToTest.m_sheets[i]->m_TimeStamp )
|
||||
if( m_sheets[i]->m_TimeStamp > aSheetPathToTest.m_sheets[i]->m_TimeStamp )
|
||||
return 1;
|
||||
if( m_sheets[i]->m_TimeStamp <
|
||||
aSheetPathToTest.m_sheets[i]->m_TimeStamp )
|
||||
|
||||
if( m_sheets[i]->m_TimeStamp < aSheetPathToTest.m_sheets[i]->m_TimeStamp )
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -111,6 +117,7 @@ SCH_SHEET* SCH_SHEET_PATH::Last()
|
|||
{
|
||||
if( m_numSheets )
|
||||
return m_sheets[m_numSheets - 1];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -122,8 +129,10 @@ SCH_SHEET* SCH_SHEET_PATH::Last()
|
|||
SCH_SCREEN* SCH_SHEET_PATH::LastScreen()
|
||||
{
|
||||
SCH_SHEET* lastSheet = Last();
|
||||
|
||||
if( lastSheet )
|
||||
return lastSheet->m_AssociatedScreen;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -196,6 +205,7 @@ SCH_SHEET* SCH_SHEET_PATH::Pop()
|
|||
m_numSheets--;
|
||||
return m_sheets[m_numSheets];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -266,6 +276,78 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences()
|
|||
}
|
||||
|
||||
|
||||
void SCH_SHEET_PATH::AnnotatePowerSymbols( int* aReference )
|
||||
{
|
||||
int ref = 1;
|
||||
|
||||
if( aReference != NULL )
|
||||
ref = *aReference;
|
||||
|
||||
for( EDA_ITEM* item = LastDrawList(); item != NULL; item = item->Next() )
|
||||
{
|
||||
if( item->Type() != SCH_COMPONENT_T )
|
||||
continue;
|
||||
|
||||
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
||||
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( component->GetLibName() );
|
||||
|
||||
if( ( entry == NULL ) || !entry->IsPower() )
|
||||
continue;
|
||||
|
||||
wxString refstr = component->GetPrefix();
|
||||
|
||||
//str will be "C?" or so after the ClearAnnotation call.
|
||||
while( refstr.Last() == '?' )
|
||||
refstr.RemoveLast();
|
||||
|
||||
if( !refstr.StartsWith( wxT( "#" ) ) )
|
||||
refstr = wxT( "#" ) + refstr;
|
||||
|
||||
refstr << wxT( "0" ) << ref;
|
||||
component->SetRef( this, refstr );
|
||||
ref++;
|
||||
}
|
||||
|
||||
if( aReference != NULL )
|
||||
*aReference = ref;
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHEET_PATH::GetComponents( SCH_REFERENCE_LIST& aReferences,
|
||||
bool aIncludePowerSymbols )
|
||||
{
|
||||
// Search to sheet path number:
|
||||
int sheetnumber = 1; // 1 = root
|
||||
SCH_SHEET_LIST sheetList;
|
||||
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path != NULL;
|
||||
path = sheetList.GetNext(), sheetnumber++ )
|
||||
if( Cmp(*path) == 0 )
|
||||
break;
|
||||
|
||||
for( SCH_ITEM* item = LastDrawList(); item != NULL; item = item->Next() )
|
||||
{
|
||||
if( item->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
||||
|
||||
// Skip pseudo components, which have a reference starting with #. This mainly
|
||||
// effects power symbols.
|
||||
if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
|
||||
continue;
|
||||
|
||||
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( component->GetLibName() );
|
||||
|
||||
if( entry == NULL )
|
||||
continue;
|
||||
|
||||
SCH_REFERENCE reference = SCH_REFERENCE( component, entry, *this );
|
||||
reference.m_SheetNum = sheetnumber;
|
||||
aReferences.AddItem( reference );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SCH_ITEM* SCH_SHEET_PATH::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap )
|
||||
{
|
||||
bool hasWrapped = false;
|
||||
|
@ -371,6 +453,7 @@ bool SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 )
|
|||
m_numSheets = d1.m_numSheets;
|
||||
|
||||
unsigned i;
|
||||
|
||||
for( i = 0; i < m_numSheets; i++ )
|
||||
{
|
||||
m_sheets[i] = d1.m_sheets[i];
|
||||
|
@ -437,8 +520,10 @@ SCH_SHEET_LIST::SCH_SHEET_LIST( SCH_SHEET* aSheet )
|
|||
m_index = 0;
|
||||
m_count = 0;
|
||||
m_List = NULL;
|
||||
|
||||
if( aSheet == NULL )
|
||||
aSheet = g_RootSheet;
|
||||
|
||||
BuildSheetList( aSheet );
|
||||
}
|
||||
|
||||
|
@ -450,8 +535,10 @@ SCH_SHEET_LIST::SCH_SHEET_LIST( SCH_SHEET* aSheet )
|
|||
SCH_SHEET_PATH* SCH_SHEET_LIST::GetFirst()
|
||||
{
|
||||
m_index = 0;
|
||||
|
||||
if( GetCount() > 0 )
|
||||
return &( m_List[0] );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -465,6 +552,7 @@ SCH_SHEET_PATH* SCH_SHEET_LIST::GetNext()
|
|||
{
|
||||
if( m_index < GetCount() )
|
||||
m_index++;
|
||||
|
||||
return GetSheet( m_index );
|
||||
}
|
||||
|
||||
|
@ -501,6 +589,7 @@ SCH_SHEET_PATH* SCH_SHEET_LIST::GetSheet( int aIndex )
|
|||
{
|
||||
if( aIndex < GetCount() )
|
||||
return &( m_List[aIndex] );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -546,6 +635,23 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
|
|||
}
|
||||
|
||||
|
||||
void SCH_SHEET_LIST::AnnotatePowerSymbols()
|
||||
{
|
||||
int ref = 1;
|
||||
|
||||
for( SCH_SHEET_PATH* path = GetFirst(); path != NULL; path = GetNext() )
|
||||
path->AnnotatePowerSymbols( &ref );
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHEET_LIST::GetComponents( SCH_REFERENCE_LIST& aReferences,
|
||||
bool aIncludePowerSymbols )
|
||||
{
|
||||
for( SCH_SHEET_PATH* path = GetFirst(); path != NULL; path = GetNext() )
|
||||
path->GetComponents( aReferences, aIncludePowerSymbols );
|
||||
}
|
||||
|
||||
|
||||
SCH_ITEM* SCH_SHEET_LIST::FindNextItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFoundIn,
|
||||
SCH_ITEM* aLastItem, bool aWrap )
|
||||
{
|
||||
|
@ -566,6 +672,7 @@ SCH_ITEM* SCH_SHEET_LIST::FindNextItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFo
|
|||
{
|
||||
if( aSheetFoundIn )
|
||||
*aSheetFoundIn = sheet;
|
||||
|
||||
return drawItem;
|
||||
}
|
||||
else if( !firstItemFound && drawItem == aLastItem )
|
||||
|
@ -610,6 +717,7 @@ SCH_ITEM* SCH_SHEET_LIST::FindPreviousItem( KICAD_T aType, SCH_SHEET_PATH** aShe
|
|||
{
|
||||
if( aSheetFoundIn )
|
||||
*aSheetFoundIn = sheet;
|
||||
|
||||
return drawItem;
|
||||
}
|
||||
else if( !firstItemFound && drawItem == aLastItem )
|
||||
|
@ -661,6 +769,7 @@ SCH_ITEM* SCH_SHEET_LIST::MatchNextItem( wxFindReplaceData& aSearchData,
|
|||
{
|
||||
if( aSheetFoundIn )
|
||||
*aSheetFoundIn = sheet;
|
||||
|
||||
return drawItem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ class SCH_SCREEN;
|
|||
class SCH_MARKER;
|
||||
class SCH_SHEET;
|
||||
class SCH_ITEM;
|
||||
class SCH_REFERENCE_LIST;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -185,6 +186,25 @@ public:
|
|||
*/
|
||||
void UpdateAllScreenReferences();
|
||||
|
||||
/**
|
||||
* Function AnnotatePowerSymbols
|
||||
* annotates the power symbols only starting at \a aReference in the sheet path.
|
||||
* @param aReference A pointer to the number for the reference designator of the
|
||||
* first power symbol to be annotated. If the pointer is NULL
|
||||
* the annotation starts at 1. The number is incremented for
|
||||
* each power symbol annotated.
|
||||
*/
|
||||
void AnnotatePowerSymbols( int* aReference );
|
||||
|
||||
/**
|
||||
* Function GetComponents
|
||||
* adds a SCH_REFERENCE() object to \a aReferences for each component in the sheet.
|
||||
* @param aReferences List of references to populate.
|
||||
* @param aIncludePowerSymbols Set to false to only get normal components.
|
||||
*/
|
||||
void GetComponents( SCH_REFERENCE_LIST& aReferences,
|
||||
bool aIncludePowerSymbols = true );
|
||||
|
||||
/**
|
||||
* Find the next schematic item in this sheet ojbect.
|
||||
*
|
||||
|
@ -230,7 +250,7 @@ public:
|
|||
|
||||
/**
|
||||
* Class SCH_SHEET_LIST
|
||||
* handles the list of Sheets in a hiearchy.
|
||||
* handles the list of Sheets in a hierarchy.
|
||||
* Sheets are not unique, there can be many sheets with the same
|
||||
* filename and the same SCH_SCREEN reference.
|
||||
* The schematic (SCH_SCREEN) is shared between these sheets,
|
||||
|
@ -316,6 +336,22 @@ public:
|
|||
*/
|
||||
SCH_SHEET_PATH* GetSheet( int aIndex );
|
||||
|
||||
/**
|
||||
* Function AnnotatePowerSymbols
|
||||
* clear and annotates the entire hierarchy of the sheet path list.
|
||||
*/
|
||||
void AnnotatePowerSymbols();
|
||||
|
||||
/**
|
||||
* Function GetComponents
|
||||
* adds a SCH_REFERENCE() object to \a aReferences for each component in the list
|
||||
* of sheets.
|
||||
* @param aReferences List of references to populate.
|
||||
* @param aIncludePowerSymbols Set to false to only get normal components.
|
||||
*/
|
||||
void GetComponents( SCH_REFERENCE_LIST& aReferences,
|
||||
bool aIncludePowerSymbols = true );
|
||||
|
||||
/**
|
||||
* Function FindNextItem
|
||||
* searches the entire schematic for the next schematic object.
|
||||
|
@ -370,7 +406,7 @@ private:
|
|||
* @param aSheet is the starting sheet from which the list is built,
|
||||
* or NULL indicating that g_RootSheet should be used.
|
||||
*/
|
||||
void BuildSheetList( SCH_SHEET* sheet );
|
||||
void BuildSheetList( SCH_SHEET* aSheet );
|
||||
};
|
||||
|
||||
#endif // CLASS_DRAWSHEET_PATH_H
|
||||
|
|
|
@ -287,8 +287,10 @@ void SCH_EDIT_FRAME::SetSheetNumberAndCount()
|
|||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
{
|
||||
wxString sheetpath = sheet->Path();
|
||||
|
||||
if( sheetpath == current_sheetpath ) // Current sheet path found
|
||||
break;
|
||||
|
||||
SheetNumber++; /* Not found, increment sheet
|
||||
* number before this current
|
||||
* path */
|
||||
|
@ -323,11 +325,13 @@ void SCH_EDIT_FRAME::CreateScreens()
|
|||
{
|
||||
g_RootSheet = new SCH_SHEET();
|
||||
}
|
||||
|
||||
if( g_RootSheet->m_AssociatedScreen == NULL )
|
||||
{
|
||||
g_RootSheet->m_AssociatedScreen = new SCH_SCREEN();
|
||||
g_RootSheet->m_AssociatedScreen->m_RefCount++;
|
||||
}
|
||||
|
||||
g_RootSheet->m_AssociatedScreen->m_FileName = m_DefaultSchematicFileName;
|
||||
g_RootSheet->m_AssociatedScreen->m_Date = GenDate();
|
||||
m_CurrentSheet->Clear();
|
||||
|
@ -335,6 +339,7 @@ void SCH_EDIT_FRAME::CreateScreens()
|
|||
|
||||
if( GetBaseScreen() == NULL )
|
||||
SetBaseScreen( new SCH_SCREEN() );
|
||||
|
||||
GetBaseScreen()->SetZoom( 4 * GetBaseScreen()->m_ZoomScalar );
|
||||
GetBaseScreen()->m_UndoRedoCountMax = 10;
|
||||
}
|
||||
|
|
|
@ -757,6 +757,10 @@ public:
|
|||
* @return a wwString withe the style name( Normal, Italic, Bold, Bold+Italic)
|
||||
*/
|
||||
wxString GetTextStyleName();
|
||||
|
||||
void SetText( const wxString& aText ) { m_Text = aText; }
|
||||
|
||||
wxString GetText() const { return m_Text; }
|
||||
};
|
||||
|
||||
#endif /* BASE_STRUCT_H */
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
class LIB_PIN;
|
||||
class SCH_COMPONENT;
|
||||
|
||||
class SCH_SHEET_PATH;
|
||||
|
||||
/* Max number of sheets in a hierarchy project: */
|
||||
#define NB_MAX_SHEET 500
|
||||
|
@ -118,6 +118,21 @@ public:
|
|||
|
||||
LIB_PIN* GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponent = NULL );
|
||||
|
||||
/**
|
||||
* Function ClearAnnotation
|
||||
* clears the annotation for the components in \a aSheetPath on the screen.
|
||||
* @param aSheetPath The sheet path of the component annotation to clear. If NULL then
|
||||
* the entire heirarchy is cleared.
|
||||
*/
|
||||
void ClearAnnotation( SCH_SHEET_PATH* aSheetPath );
|
||||
|
||||
/**
|
||||
* Function GetHierarchicalItems
|
||||
* adds all schematica sheet and component object in the screen to \a aItems.
|
||||
* @param aItems Hierarchical item list.
|
||||
*/
|
||||
void GetHierarchicalItems( std::vector <SCH_ITEM*> aItems );
|
||||
|
||||
virtual void AddItem( SCH_ITEM* aItem ) { BASE_SCREEN::AddItem( (EDA_ITEM*) aItem ); }
|
||||
virtual void InsertItem( EDA_ITEMS::iterator aIter, SCH_ITEM* aItem )
|
||||
{
|
||||
|
@ -145,6 +160,35 @@ public:
|
|||
SCH_SCREEN* GetNext();
|
||||
SCH_SCREEN* GetScreen( unsigned int aIndex );
|
||||
|
||||
/**
|
||||
* Function ClearAnnotation
|
||||
* clears the annotation for all components in the hierarchy.
|
||||
*/
|
||||
void ClearAnnotation();
|
||||
|
||||
/**
|
||||
* Function SchematicCleanUp
|
||||
* merges and breaks wire segments in the entire schematic hierarchy.
|
||||
*/
|
||||
void SchematicCleanUp();
|
||||
|
||||
/**
|
||||
* Function ReplaceDuplicateTimeStamps
|
||||
* test all sheet and component objects in the schematic for duplicate time stamps
|
||||
* an replaces them as neccessary. Time stamps must be unique in order for complex
|
||||
* hierarcies know which components go to which sheets.
|
||||
* @return The number of duplicate time stamps replaced.
|
||||
*/
|
||||
int ReplaceDuplicateTimeStamps();
|
||||
|
||||
/**
|
||||
* Function SetDate
|
||||
* sets the date string for every screen to \a aDate.
|
||||
* @see GetDate()
|
||||
* @param aDate The date string to set for each screen.
|
||||
*/
|
||||
void SetDate( const wxString& aDate );
|
||||
|
||||
private:
|
||||
void AddScreenToList( SCH_SCREEN* aScreen );
|
||||
void BuildScreenList( EDA_ITEM* aItem );
|
||||
|
|
|
@ -22,15 +22,15 @@ public:
|
|||
/**
|
||||
* Function ListSet
|
||||
* Add a list of items.
|
||||
* @param list = a string containing items. Items are separated by '\n'
|
||||
* @param aList = a string containing items. Items are separated by '\n'
|
||||
*/
|
||||
void ListSet(const wxString &list);
|
||||
void ListSet(const wxString &aList);
|
||||
/**
|
||||
* Function ListSet
|
||||
* Add a list of items.
|
||||
* @param list = a wxArrayString containing items.
|
||||
* @param aList = a wxArrayString containing items.
|
||||
*/
|
||||
void ListSet(const wxArrayString &list);
|
||||
void ListSet(const wxArrayString &aList);
|
||||
|
||||
void ListClear();
|
||||
/**
|
||||
|
|
|
@ -273,11 +273,38 @@ public:
|
|||
* Remove current component annotations
|
||||
* @param aCurrentSheetOnly : if false: remove all annotations, else
|
||||
* remove annotation relative to the current
|
||||
* sheet only
|
||||
* @param aRedraw : true to refresh display
|
||||
* sheet only
|
||||
*/
|
||||
void DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw );
|
||||
void DeleteAnnotation( bool aCurrentSheetOnly );
|
||||
|
||||
/**
|
||||
* Function AnnotateComponents:
|
||||
*
|
||||
* Compute the annotation of the components for the whole project, or the
|
||||
* current sheet only. All the components or the new ones only will be
|
||||
* annotated.
|
||||
* @param annotateSchematic : true = entire schematic annotation,
|
||||
* false = current sheet only
|
||||
* @param sortOption : 0 = annotate by sorting X position,
|
||||
* 1 = annotate by sorting X position,
|
||||
* and use sheet number to calculate annotation
|
||||
* 2 = annotate by sorting Y position,
|
||||
* 3 = annotate by sorting Y position,
|
||||
* and use sheet number to calculate annotation
|
||||
* 4 = annotate by sorting value
|
||||
* @param resetAnnotation : true = remove previous annotation
|
||||
* false = annotate new components only
|
||||
* @param repairsTimestamps : true = test for duplicate times stamps and
|
||||
* replace duplicated
|
||||
* Note: this option could change previous annotation, because time
|
||||
* stamps are used to handle annotation mainly in complex
|
||||
* hierarchies.
|
||||
* When the sheet number is used in annotation,
|
||||
* for each sheet annotation starts from sheet number * 100
|
||||
* ( the first sheet uses 100 to 199, the second 200 to 299 ... )
|
||||
*/
|
||||
void AnnotateComponents(bool annotateSchematic, int sortOption,
|
||||
bool resetAnnotation, bool repairsTimestamps );
|
||||
// Functions used for hierarchy handling
|
||||
void InstallPreviousSheet();
|
||||
void InstallNextScreen( SCH_SHEET* Sheet );
|
||||
|
@ -471,13 +498,6 @@ private:
|
|||
public:
|
||||
bool EditSheet( SCH_SHEET* Sheet, wxDC* DC );
|
||||
|
||||
/**
|
||||
* Function UpdateSheetNumberAndDate
|
||||
* Set a sheet number, the sheet count for sheets in the whole schematic
|
||||
* and update the date in all screens
|
||||
*/
|
||||
void UpdateSheetNumberAndDate();
|
||||
|
||||
private:
|
||||
void StartMoveSheet( SCH_SHEET* sheet, wxDC* DC );
|
||||
SCH_SHEET_PIN* Create_PinSheet( SCH_SHEET* Sheet, wxDC* DC );
|
||||
|
|
|
@ -45,7 +45,7 @@ CPolyLine::~CPolyLine()
|
|||
* if more than one outside contour are found, extra CPolyLines will be created
|
||||
* because copper areas have only one outside contour
|
||||
* Therefore, if this results in new CPolyLines, return them as std::vector pa
|
||||
* @param aExtraPolys: pointer on a std::vector<CPolyLine*> to store extra CPolyLines
|
||||
* @param aExtraPolyList: pointer on a std::vector<CPolyLine*> to store extra CPolyLines
|
||||
* @param bRetainArcs == TRUE, try to retain arcs in polys
|
||||
* @return number of external contours, or -1 if error
|
||||
*/
|
||||
|
|
|
@ -224,7 +224,7 @@ public:
|
|||
* if more than one outside contour are found, extra CPolyLines will be created
|
||||
* because copper areas have only one outside contour
|
||||
* Therefore, if this results in new CPolyLines, return them as std::vector pa
|
||||
* @param aExtraPolys: pointer on a std::vector<CPolyLine*> to store extra CPolyLines
|
||||
* @param aExtraPolyList: pointer on a std::vector<CPolyLine*> to store extra CPolyLines
|
||||
* @param bRetainArcs == false, try to retain arcs in polys
|
||||
* @return number of external contours, or -1 if error
|
||||
*/
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*! \file kbool/_dl_itr.cpp
|
||||
/*! \file _dl_itr.cpp
|
||||
\brief Double Linked list with Iterators on list
|
||||
\author Probably Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Probably Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: _dl_itr.cpp,v 1.5 2009/04/23 19:35:24 titato Exp $
|
||||
*/
|
||||
|
||||
|
@ -143,9 +143,9 @@ class | Dtype | item object in list
|
|||
too see if list is empty
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
if (_intlist.Empty())
|
||||
|
||||
|
||||
cout << "empty";
|
||||
\endcode
|
||||
*/
|
||||
|
@ -163,9 +163,9 @@ bool DL_List<Dtype>::empty()
|
|||
too see if list contains only one object
|
||||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
if (_intlist.count() == 1)
|
||||
|
||||
|
||||
cout << "one object in list";
|
||||
\endcode
|
||||
*/
|
||||
|
@ -181,11 +181,11 @@ int DL_List<Dtype>::count()
|
|||
\note
|
||||
The objects itself are not deleted, only removed from the list.
|
||||
The user is responsible for memory management.
|
||||
|
||||
|
||||
\note
|
||||
The iterator level must be zero to be able to use this function,
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\note
|
||||
Use this function if an iterator is not needed to do more complex things.
|
||||
This will save time, since the iterator does not have to be created.
|
||||
|
@ -194,13 +194,13 @@ int DL_List<Dtype>::count()
|
|||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
int a=123;
|
||||
|
||||
|
||||
int b=345;
|
||||
|
||||
|
||||
_intlist.insbegin(a);
|
||||
|
||||
|
||||
_intlist.insbegin(b);
|
||||
|
||||
|
||||
_intlist.remove_all();
|
||||
\endcode
|
||||
*/
|
||||
|
@ -233,28 +233,28 @@ remove the object at the begin of the list (head).
|
|||
\note
|
||||
The object itself is not deleted, only removed from the list.
|
||||
The user is responsible for memory management.
|
||||
|
||||
|
||||
\note
|
||||
The iterator level must be zero to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
\note
|
||||
The list must contain objects, else an error will be generated.
|
||||
|
||||
|
||||
\note
|
||||
Use this function if an iterator is not needed to do more complex things. This will save time, since the iterator does not
|
||||
have to be created.
|
||||
|
||||
|
||||
\par Example:
|
||||
too insert integer a at begin of list and remove it directly.
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
_intlist.insbegin(a)
|
||||
|
||||
|
||||
_intlist.removehead();
|
||||
|
||||
|
||||
\endcode
|
||||
*/
|
||||
template <class Dtype>
|
||||
|
@ -277,7 +277,7 @@ void DL_List<Dtype>::removehead()
|
|||
|
||||
/*!
|
||||
remove the object at the begin of the list (head).
|
||||
|
||||
|
||||
\note
|
||||
- The object itself is not deleted, only removed from the list.
|
||||
The user is responsible for memory management.
|
||||
|
@ -286,18 +286,18 @@ remove the object at the begin of the list (head).
|
|||
- The list must contain objects, else an error will be generated.
|
||||
- Use this function if an iterator is not needed to do more complex things.
|
||||
This will save time, since the iterator does not have to be created.
|
||||
|
||||
|
||||
\par Example:
|
||||
too insert integer a at end of list and remove it directly.
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
_intlist.insend(a)
|
||||
|
||||
|
||||
_intlist.removetail();
|
||||
|
||||
|
||||
\endcode
|
||||
*/
|
||||
template <class Dtype>
|
||||
|
@ -322,7 +322,7 @@ insert the object given at the end of the list, after tail
|
|||
\note
|
||||
The iterator level must be zero to be able to use this function,
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\note
|
||||
Use this function if an iterator is not needed to do more complex things.
|
||||
This will save time, since the iterator does not have to be created.
|
||||
|
@ -330,9 +330,9 @@ This will save time, since the iterator does not have to be created.
|
|||
too insert integer a at end of list
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
_intlist.insend(a)
|
||||
\endcode
|
||||
\param newitem an object for which the template list was generated
|
||||
|
@ -360,18 +360,18 @@ insert the object given at the begin of the list, before head
|
|||
\note
|
||||
The iterator level must be zero to be able to use this function,
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\note
|
||||
Use this function if an iterator is not needed to do more complex things.
|
||||
This will save time, since the iterator does not have to be created.
|
||||
|
||||
|
||||
\par Example:
|
||||
too insert integer a at begin of list
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
_intlist.insbegin(a)
|
||||
\endcode
|
||||
\param newitem an object for which the template list was generated
|
||||
|
@ -401,15 +401,15 @@ get head item
|
|||
which is at head of list|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
int b=345;
|
||||
|
||||
|
||||
int c;
|
||||
|
||||
|
||||
_intlist.insbegin(a)
|
||||
|
||||
|
||||
_intlist.insbegin(b)
|
||||
c=_intlist.headitem()
|
||||
\endcode
|
||||
|
@ -428,15 +428,15 @@ get tail item
|
|||
is at the tail of list
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
int b=345;
|
||||
|
||||
|
||||
int c;
|
||||
_intlist.insbegin(a)
|
||||
_intlist.insbegin(b)
|
||||
|
||||
|
||||
c=_intlist.headitem()
|
||||
\endcode
|
||||
*/
|
||||
|
@ -449,7 +449,7 @@ Dtype DL_List<Dtype>::tailitem()
|
|||
/*!
|
||||
* \note
|
||||
The iterator level must be zero to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
* \note The list may not be the same list as this list
|
||||
* \param otherlist the list to take the items from
|
||||
*/
|
||||
|
@ -497,23 +497,23 @@ void DL_List<Dtype>::takeover( DL_List<Dtype>* otherlist )
|
|||
to insert integer a and b into list and remove_all directly using an iterator
|
||||
\code
|
||||
DL_List<int>* a_list = new DL_List<int>(); // declaration and allocation
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
int b=345;
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(a_list);
|
||||
|
||||
|
||||
a_listiter->insbegin(a)
|
||||
|
||||
|
||||
a_listiter->insbegin(b)
|
||||
|
||||
|
||||
a_listiter->remove_all()
|
||||
|
||||
|
||||
} //to destruct the iterator before the list is deleted
|
||||
|
||||
|
||||
delete a_list; #delete it (must have no iterators attached to it)
|
||||
\endcode
|
||||
*/
|
||||
|
@ -585,11 +585,11 @@ tcarg: class | Dtype | list item object
|
|||
How to construct a list of type integer and a second iterator for it:|
|
||||
\code
|
||||
DL_List<int>* IntegerList;
|
||||
|
||||
|
||||
IntegerList = new DL_List<int>();
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(IntegerList);
|
||||
|
||||
|
||||
DL_Iter<int>* a_secondlistiter=new DL_Iter<int>(a_listiter);
|
||||
\endcode
|
||||
\param otheriter other iterator on same list
|
||||
|
@ -610,21 +610,21 @@ Later on when a list is constructed,the iterator can be attached to it.
|
|||
This way an iterator to a specific list can be made static to a class, and can be used
|
||||
for several lists at the same time. \n
|
||||
tcarg: class | Dtype | list item object
|
||||
|
||||
|
||||
\par Example
|
||||
How to construct an iterator, without having a list first.
|
||||
This constructs an iterator for a list of the given type, but the list thus not yet exist.
|
||||
\code
|
||||
DL_Iter<int>* a_iter=new DL_Iter<int>();
|
||||
|
||||
|
||||
DL_List<int>* IntegerList;
|
||||
|
||||
|
||||
IntegerList = new DL_List<int>();
|
||||
|
||||
|
||||
a_iter.Attach(IntegerList);
|
||||
|
||||
|
||||
a_iter.insend(123);
|
||||
|
||||
|
||||
a_iter.Detach();
|
||||
\endcode
|
||||
*/
|
||||
|
@ -655,15 +655,15 @@ static to a class, and can be used for several lists at the same time.\n
|
|||
How to construct an iterator, without having a list first, and attach an iterator later:|
|
||||
\code
|
||||
DL_Iter<int>* a_iter=new DL_Iter<int>();
|
||||
|
||||
|
||||
DL_List<int>* IntegerList;
|
||||
|
||||
|
||||
IntegerList = new DL_List<int>();
|
||||
|
||||
|
||||
a_iter.Attach(IntegerList);
|
||||
|
||||
|
||||
a_iter.insend(123);
|
||||
|
||||
|
||||
a_iter.Detach();
|
||||
\endcode
|
||||
\param newlist the list to attached the iterator to
|
||||
|
@ -687,15 +687,15 @@ and can be used for several lists at the same time. \n
|
|||
How to construct an iterator, without having a list first, and attach an iterator later:
|
||||
\code
|
||||
DL_Iter<int>* a_iter=new DL_Iter<int>();
|
||||
|
||||
|
||||
DL_List<int>* IntegerList;
|
||||
|
||||
|
||||
IntegerList = new DL_List<int>();
|
||||
|
||||
|
||||
a_iter.Attach(IntegerList);
|
||||
|
||||
|
||||
a_iter.insend(123);
|
||||
|
||||
|
||||
a_iter.Detach();
|
||||
\endcode
|
||||
\param newlist: the list to attached the iterator to
|
||||
|
@ -755,22 +755,22 @@ to move all objects in a list to the list of the iterator.
|
|||
\note
|
||||
The iterator level must be one to be able to use this function,
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\note
|
||||
The list may not be the same list as the iterator list
|
||||
\par Example
|
||||
to take over all items in _intlist|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
DL_List<int> _intlist2; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist2);
|
||||
|
||||
|
||||
_intlist->insend(a) // insert at end
|
||||
|
||||
|
||||
a_listiter2->takeover(_intlist)
|
||||
\endcode
|
||||
\param otherlist the list to take the items from
|
||||
|
@ -808,28 +808,28 @@ void DL_Iter<Dtype>::takeover( DL_List<Dtype>* otherlist )
|
|||
to move all objects in a list (using iterator of that list) to the list of the iterator.
|
||||
\note
|
||||
The iterator level for both iterators must be one to be able to use this function,
|
||||
|
||||
|
||||
\note
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\note
|
||||
The list may not be the same list as the iterator list
|
||||
|
||||
|
||||
\par Example
|
||||
to take over all items in a_listiter1 it's list|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
DL_List<int> _intlist2; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter1=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist2);
|
||||
|
||||
|
||||
a_listiter1->insend(a) // insert at end
|
||||
|
||||
|
||||
a_listiter2->takeover(a_listiter1)
|
||||
\\!to move all objects in a list (using iterator of that list) to the list of the iterator
|
||||
\endcode
|
||||
|
@ -872,27 +872,27 @@ to move maxcount objects in a list (using iterator of that list)
|
|||
to the list of the iterator.
|
||||
\note The iterator level for both iterators must be one to be able to use this function,
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\note The list may not be the same list as the iterator list
|
||||
|
||||
|
||||
\note If less then maxcount objects are available in the source iterator,
|
||||
all of them are taken and no error will accur
|
||||
|
||||
|
||||
\par Example
|
||||
to take over 1 item from a_listiter1 it's list
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
DL_List<int> _intlist2; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter1=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist2);
|
||||
|
||||
|
||||
a_listiter1->insend(a) // insert at end
|
||||
|
||||
|
||||
a_listiter2->takeover(a_listiter1,1);
|
||||
//! to move maxcount objects in a list (using iterator of that list) to the list of the iterator
|
||||
\endcode
|
||||
|
@ -987,13 +987,13 @@ put the iterator root object before the current iterator position in the list.
|
|||
The current object will become the new head of the list.
|
||||
\note The iterator level must be one to be able to use this function,
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\par Example
|
||||
move the root object to make the new head the old tail object|
|
||||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
|
@ -1036,7 +1036,7 @@ The current object will become the new tail of the list.
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
|
@ -1076,7 +1076,7 @@ is list empty (contains items or not)?
|
|||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
if (a_listiter->Empty())
|
||||
cout << "empty"
|
||||
\endcode
|
||||
|
@ -1100,7 +1100,7 @@ the end can be tested with this function.
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->tohead();
|
||||
//traverse forwards
|
||||
while ( ! a_listiter->hitroot())
|
||||
|
@ -1108,7 +1108,7 @@ while ( ! a_listiter->hitroot())
|
|||
cout << "The item =" << a_listiter->item();
|
||||
a_listiter++; //goto next object
|
||||
}
|
||||
|
||||
|
||||
a_listiter->totail();
|
||||
//traverse backwards
|
||||
while ( ! a_listiter->hitroot())
|
||||
|
@ -1135,7 +1135,7 @@ is the iterator at the head of the list.
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->tohead();
|
||||
if (a_listiter->athead())
|
||||
cout << "at the head The item =" << a_listiter->item();
|
||||
|
@ -1159,7 +1159,7 @@ is the iterator at the tail of the list.
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->totail();
|
||||
if (a_listiter->attail())
|
||||
cout << "at the tail The item =" << a_listiter->item();
|
||||
|
@ -1183,7 +1183,7 @@ does the iterator/list contain the given object
|
|||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
a_listiter->insend(1234);
|
||||
|
||||
|
||||
if (a_listiter->has(1234))
|
||||
cout << "yes it does";
|
||||
\endcode
|
||||
|
@ -1233,7 +1233,7 @@ go to first item, if list is empty goto hite
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->tohead();
|
||||
\endcode
|
||||
|
@ -1254,7 +1254,7 @@ go to last item, if list is empty goto hite
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->totail();
|
||||
\endcode
|
||||
|
@ -1275,7 +1275,7 @@ set the iterator position to the root (empty dummy) object in the list.
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->toroot();
|
||||
while (a_listiter->iterate())
|
||||
|
@ -1298,7 +1298,7 @@ how to iterate backwards
|
|||
\code
|
||||
DL_List <int> _intlist; //create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->tohead();
|
||||
while (!a_listiter->hitroot())
|
||||
|
@ -1324,7 +1324,7 @@ how to iterate backwards
|
|||
\code
|
||||
DL_List <int> _intlist; //create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->tohead();
|
||||
while (!a_listiter->hitroot())
|
||||
|
@ -1351,7 +1351,7 @@ how to iterate backwards
|
|||
\code
|
||||
DL_List <int> _intlist; //create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->totail();
|
||||
while (!a_listiter->hitroot())
|
||||
|
@ -1378,7 +1378,7 @@ how to iterate backwards
|
|||
\code
|
||||
DL_List <int> _intlist; //create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->totail();
|
||||
while (!a_listiter->hitroot())
|
||||
|
@ -1454,11 +1454,11 @@ put the iterator at the position of the given object in the list.
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
|
||||
|
||||
a_listiter->toitem(2345); template <class Dtype>
|
||||
\endcode
|
||||
*/
|
||||
|
@ -1488,7 +1488,7 @@ put the iterator at the same position as the given iterator in the list.
|
|||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
|
@ -1535,27 +1535,27 @@ bool DL_Iter<Dtype>::tonode( DL_Node<Dtype> *othernode )
|
|||
/*!
|
||||
advance the iterator one position in the next direction in the list.
|
||||
\return returns true if not at the end/root of the list else false.
|
||||
|
||||
|
||||
\note This function combines iteration and testing for the end of
|
||||
the list in one.
|
||||
|
||||
|
||||
\note Therefore we do not have to advance the iterator ourselves.
|
||||
|
||||
|
||||
\note
|
||||
The iterator is first put to the next object, before testing for the end of the list. |
|
||||
This is why we need to start at the root element in general usage.
|
||||
|
||||
|
||||
\par Example
|
||||
iterate through all the items in a list
|
||||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
a_listiter->tobegin(2345);
|
||||
|
||||
|
||||
while (a_listiter->iterate())
|
||||
{ cout << a_listiter->item(); }
|
||||
\endcode
|
||||
|
@ -1583,7 +1583,7 @@ since there is no item there.
|
|||
\code
|
||||
DL_List <int> _intlist; //create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->tohead();
|
||||
int theitem=a_listiter->item();
|
||||
|
@ -1634,11 +1634,11 @@ cycle the list twice
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->tohead();
|
||||
|
||||
|
||||
int count=2*a_listiter->count();
|
||||
while (count)
|
||||
{
|
||||
|
@ -1681,11 +1681,11 @@ cycle the list twice
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->totail();
|
||||
|
||||
|
||||
int count=2*a_listiter->count();
|
||||
while (count)
|
||||
{
|
||||
|
@ -1723,23 +1723,23 @@ void DL_Iter<Dtype>::remove_all()
|
|||
/*!
|
||||
remove object at current iterator position from the list.
|
||||
\note The object itself is not deleted, only removed from the list. The user is responsible for memory management.
|
||||
|
||||
|
||||
\note The iterator level must be one to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
\note The list must contain an object at the current iterator position, else an error will be generated.
|
||||
\par Example:
|
||||
to insert integer a at begin of list and remove it directly
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insbegin(a);
|
||||
|
||||
|
||||
a_listiter->tohead();
|
||||
|
||||
|
||||
a_listiter->remove();
|
||||
\endcode
|
||||
*/
|
||||
|
@ -1767,21 +1767,21 @@ void DL_Iter<Dtype>::remove()
|
|||
/*!
|
||||
remove the object at the begin of the list using an iterator
|
||||
\note The object itself is not deleted, only removed from the list. The user is responsible for memory management.
|
||||
|
||||
|
||||
\note The iterator level must be one to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
\note The list must contain objects, else an error will be generated.
|
||||
|
||||
|
||||
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
|
||||
\par Example:
|
||||
to insert integer a at begin of list and remove it directly|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insbegin(a);
|
||||
a_listiter->removehead();
|
||||
\endcode
|
||||
|
@ -1808,21 +1808,21 @@ void DL_Iter<Dtype>::removehead()
|
|||
/*!
|
||||
//remove the object at the end of the list using an iterator
|
||||
\note The object itself is not deleted, only removed from the list. The user is responsible for memory management.
|
||||
|
||||
|
||||
\note The iterator level must be one to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
\note The list must contain objects, else an error will be generated.
|
||||
|
||||
|
||||
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
|
||||
\par Example:
|
||||
to insert integer a at end of list and remove it directly
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(a);
|
||||
a_listiter->removetail();
|
||||
\endcode
|
||||
|
@ -1848,19 +1848,19 @@ void DL_Iter<Dtype>::removetail()
|
|||
|
||||
/*!
|
||||
insert the object given at the end of the list
|
||||
|
||||
|
||||
\note The iterator level must be one to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
|
||||
\par Example:
|
||||
to insert integer a at end of list|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(a);
|
||||
\endcode
|
||||
*/
|
||||
|
@ -1882,18 +1882,18 @@ DL_Node<Dtype>* DL_Iter<Dtype>::insend( Dtype newitem )
|
|||
/*!
|
||||
insert the object given at the begin of the list
|
||||
\note The iterator level must be one to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
|
||||
|
||||
|
||||
\par Example:
|
||||
to insert integer a at begin of list|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insbegin(a);
|
||||
\endcode
|
||||
\param newitem an object for which the template list/iterator was generated
|
||||
|
@ -1919,9 +1919,9 @@ DL_Node<Dtype>* DL_Iter<Dtype>::insbegin( Dtype newitem )
|
|||
to insert integer before the iterator position in the list|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
a_listiter->totail();
|
||||
a_listiter->insbefore(a); // insert before tail
|
||||
|
@ -1954,9 +1954,9 @@ insert the object given after the current position of the iterator in list
|
|||
\par Example: to insert integer after the iterator position in the list|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
a_listiter->tohead();
|
||||
a_listiter->insafter(a); // insert after head
|
||||
|
@ -1986,30 +1986,30 @@ DL_Node<Dtype>* DL_Iter<Dtype>::insafter( Dtype newitem )
|
|||
sort all items in the list according to the compare function.
|
||||
when items need to be swapped to reach the right order the swap function will be called also.
|
||||
\note There are no restrictions on the internal decision in the compare function when to return -1,0,1.
|
||||
|
||||
|
||||
\note The swap function can be used to change items when they are swapped.
|
||||
fcmp (function, fcmp)
|
||||
\verbatim
|
||||
|
||||
|
||||
Declaration: int (*fcmp) (Dtype,Dtype)
|
||||
|
||||
|
||||
compare function pointer, the function takes two objects in the list. It must return -1, 0, 1, to sort the list in upgoing
|
||||
order the function should return:
|
||||
|
||||
|
||||
-1 is returned if the first object is bigger then the second.
|
||||
0 is returned if the objects are equal.
|
||||
1 is returned if the first object is smaller then the second.
|
||||
|
||||
|
||||
To sort the list in downgoing order:
|
||||
|
||||
|
||||
1 is returned if the first object is bigger then the second.
|
||||
0 is returned if the objects are equal.
|
||||
-1 is returned if the first object is smaller then the second.
|
||||
|
||||
|
||||
fswap (function, fswap)
|
||||
|
||||
|
||||
Declaration: void (*fswap) (Dtype,Dtype)
|
||||
|
||||
|
||||
swap function pointer, the function takes two objects in the list. It will be called when the objects are swapped to
|
||||
reach the right order. If it is NULL, it will not be called.
|
||||
\endverbatim
|
||||
|
@ -2022,10 +2022,10 @@ int numbersorter(int a,int b)
|
|||
if(a == b) return(0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
a_listiter->insend(1234);
|
||||
|
@ -2110,34 +2110,34 @@ int DL_Iter<Dtype>::cocktailsort( int ( *fcmp ) ( Dtype, Dtype ), bool ( *fswap
|
|||
|
||||
/*!
|
||||
sort all items in the list according to the compare function.
|
||||
|
||||
|
||||
\note
|
||||
There are no restrictions on the internal decision in the compare function when to return -1,0,1.
|
||||
|
||||
|
||||
\note
|
||||
For the mergesort function the objects will be swapped when the return value is -1.
|
||||
|
||||
|
||||
\note
|
||||
\verbatim
|
||||
|
||||
|
||||
fcmp (function, fcmp)
|
||||
|
||||
|
||||
Declaration: int (*fcmp) (Dtype,Dtype)
|
||||
|
||||
|
||||
compare function pointer, the function takes two objects in the list. It must return -1, 0, 1, to sort the list in upgoing
|
||||
order the function should return:
|
||||
|
||||
|
||||
-1 is returned if the first object is bigger then the second.
|
||||
0 is returned if the objects are equal.
|
||||
1 is returned if the first object is smaller then the second.
|
||||
|
||||
|
||||
To sort the list in downgoing order:
|
||||
|
||||
|
||||
1 is returned if the first object is bigger then the second.
|
||||
0 is returned if the objects are equal.
|
||||
-1 is returned if the first object is smaller then the second.
|
||||
\endverbatim
|
||||
|
||||
|
||||
!tcarg: class | Dtype | list item object
|
||||
\par example
|
||||
sort the list in upgoing order using mergesort and the function numbersorter|
|
||||
|
@ -2149,10 +2149,10 @@ int numbersorter(int a,int b)
|
|||
if(a == b) return(0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
a_listiter->insend(1234);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*! \file kbool/include/kbool/_dl_itr.h
|
||||
\author Klaas Holwerda
|
||||
|
||||
/*! \file _dl_itr.h
|
||||
\author Klaas Holwerda
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: _dl_itr.h,v 1.6 2009/09/10 17:04:09 titato Exp $
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*! \file kbool/_lnk_itr.cpp
|
||||
/*! \file _lnk_itr.cpp
|
||||
\author Probably Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Probably Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: _lnk_itr.cpp,v 1.4 2009/02/06 21:33:03 titato Exp $
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*! \file kbool/include/kbool/_lnk_itr.h
|
||||
/*! \file _lnk_itr.h
|
||||
\author Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: _lnk_itr.h,v 1.4 2009/09/10 17:04:09 titato Exp $
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*! \file include/booleng.h
|
||||
/*! \file booleng.h
|
||||
\author Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: booleng.h,v 1.9 2009/09/14 18:18:03 titato Exp $
|
||||
*/
|
||||
|
||||
|
@ -225,7 +225,7 @@ template<class Type> class TDLI;
|
|||
The boolean operation ( BOOL_OR, BOOL_AND, BOOL_EXOR, BOOL_A_SUB_B, BOOL_B_SUB_A )
|
||||
are based on the two sets of polygons in group A and B.
|
||||
The other operation on group A only.
|
||||
|
||||
|
||||
At the end of the operation the resulting polygons can be extracted.
|
||||
*/
|
||||
class A2DKBOOLDLLEXP Bool_Engine
|
||||
|
@ -257,7 +257,7 @@ public:
|
|||
/*
|
||||
The algorithm takes into account gaps and inaccuracies caused by rounding to integer coordinates
|
||||
in the original data.
|
||||
Imagine two rectangles one with a side ( 0,0 ) ( 2.0, 17.0 )
|
||||
Imagine two rectangles one with a side ( 0,0 ) ( 2.0, 17.0 )
|
||||
and the other has a side ( 0,0 ) ( 1.0, 8.5 )
|
||||
If for some reason those coordinates where round to ( 0,0 ) ( 2, 17 ) ( 0,0 ) ( 1, 9 ),
|
||||
there will be clearly a gap or overlap that was not intended.
|
||||
|
@ -280,8 +280,8 @@ public:
|
|||
Grid makes sure that the integer data used within the algorithm has room for extra intersections
|
||||
smaller than the smallest number within the input data.
|
||||
The input data scaled up with DGrid is related to the accuracy the user has in his input data.
|
||||
Another scaling with Grid is applied on top of it to create space in the integer number for
|
||||
even smaller numbers.
|
||||
Another scaling with Grid is applied on top of it to create space in the integer number for
|
||||
even smaller numbers.
|
||||
*/
|
||||
void SetGrid( B_INT grid );
|
||||
|
||||
|
@ -299,7 +299,7 @@ public:
|
|||
doubles, part of the integers used in vertexes within the boolean algorithm.
|
||||
And therefore DGRID bigger than 1 is not usefull, you would only loose accuracy.
|
||||
Within the algorithm all input data is multiplied with DGRID, and the result
|
||||
is rounded to an integer.
|
||||
is rounded to an integer.
|
||||
*/
|
||||
void SetDGrid( double dgrid );
|
||||
|
||||
|
@ -417,7 +417,7 @@ public:
|
|||
|
||||
//! if set true holes are linked into outer contours by double overlapping segments.
|
||||
/*!
|
||||
This mode is needed when the software using the boolean algorithm does
|
||||
This mode is needed when the software using the boolean algorithm does
|
||||
not understand hole polygons. In that case a contour and its holes form one
|
||||
polygon. In cases where software understands the concept of holes, contours
|
||||
are clockwise oriented, while holes are anticlockwise oriented.
|
||||
|
@ -457,11 +457,11 @@ public:
|
|||
if (booleng->StartPolygonAdd(GROUP_A))
|
||||
{
|
||||
booleng->AddPoint(100,100);
|
||||
booleng->AddPoint(-100,100);
|
||||
booleng->AddPoint(-100,-100);
|
||||
booleng->AddPoint(100,-100);
|
||||
booleng->AddPoint(-100,100);
|
||||
booleng->AddPoint(-100,-100);
|
||||
booleng->AddPoint(100,-100);
|
||||
}
|
||||
booleng->EndPolygonAdd();
|
||||
booleng->EndPolygonAdd();
|
||||
|
||||
\param A_or_B defines if the new polygon will be of group A or B
|
||||
|
||||
|
@ -469,7 +469,7 @@ public:
|
|||
to another polygon added.
|
||||
So the contour polygon ClockWise, then add counterclockwise polygons for holes, and visa versa.
|
||||
BUT only if m_orientationEntryMode is set true, else all polygons are redirected, and become
|
||||
individual areas without holes.
|
||||
individual areas without holes.
|
||||
Holes in such a case must be linked into the contour using two extra segments.
|
||||
*/
|
||||
bool StartPolygonAdd( GroupType A_or_B );
|
||||
|
@ -505,7 +505,7 @@ public:
|
|||
/*!
|
||||
This iterates through the first graph in the graphlist.
|
||||
Setting the current kbNode properly by following the links in the graph
|
||||
through its nodes.
|
||||
through its nodes.
|
||||
*/
|
||||
bool PolygonHasMorePoints();
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*! \file include/graph.h
|
||||
/*! \file graph.h
|
||||
\author Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: graph.h,v 1.5 2009/09/10 17:04:09 titato Exp $
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*! \file include/graphlst.h
|
||||
/*! \file graphlst.h
|
||||
\author Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: graphlst.h,v 1.4 2009/09/10 17:04:09 titato Exp $
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*! \file include/line.h
|
||||
/*! \file line.h
|
||||
\brief Mainy used for calculating crossings
|
||||
\author Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: line.h,v 1.5 2009/09/10 17:04:09 titato Exp $
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*! \file include/link.h
|
||||
/*! \file link.h
|
||||
\brief Part of a graph, connection between nodes (Header)
|
||||
\author Klaas Holwerda or Julian Smart
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: link.h,v 1.5 2009/09/10 17:04:09 titato Exp $
|
||||
*/
|
||||
|
||||
|
@ -23,13 +23,13 @@ class kbRecord;
|
|||
|
||||
//! segment within a graph
|
||||
/*
|
||||
A Graph contains a list of kbLink, the kbLink or connected by Node's.
|
||||
Several kbLink can be connected to one Node.
|
||||
A Graph contains a list of kbLink, the kbLink or connected by Node's.
|
||||
Several kbLink can be connected to one Node.
|
||||
A kbLink has a direction defined by its begin and end node.
|
||||
Node do have a list of connected kbLink's.
|
||||
So one can walk trough a graph in two ways:
|
||||
1- via its kbLink list
|
||||
2- via the node connected to the kbLink's
|
||||
1- via its kbLink list
|
||||
2- via the node connected to the kbLink's
|
||||
*/
|
||||
class A2DKBOOLDLLEXP kbLink
|
||||
{
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*! \file include/lpoint.h
|
||||
/*! \file lpoint.h
|
||||
\author Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: lpoint.h,v 1.4 2009/09/10 17:04:09 titato Exp $
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*! \file include/node.h
|
||||
/*! \file node.h
|
||||
\brief Holds a GDSII node structure (Header)
|
||||
\author Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: node.h,v 1.7 2009/09/14 16:50:12 titato Exp $
|
||||
*/
|
||||
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
kbLink* GetNotFlat();
|
||||
|
||||
//! get a link to a hole or from a hole.
|
||||
kbLink* GetHoleLink( kbLink* const prev, LinkStatus whatside,
|
||||
kbLink* GetHoleLink( kbLink* const prev, LinkStatus whatside,
|
||||
bool checkbin, BOOL_OP operation );
|
||||
|
||||
int Merge( kbNode* );
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*! \file include/record.h
|
||||
/*! \file record.h
|
||||
\author Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: record.h,v 1.5 2009/09/10 17:04:09 titato Exp $
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*! \file include/scanbeam.h
|
||||
/*! \file scanbeam.h
|
||||
\author Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: scanbeam.h,v 1.6 2009/09/10 17:04:09 titato Exp $
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*! \file kbool/include/kbool/statusb.h
|
||||
/*! \file statusb.h
|
||||
\author Probably Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Probably Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: statusb.h,v 1.3 2009/02/06 21:33:03 titato Exp $
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*! \file kbool/include/kbool/valuesvc.h
|
||||
/*! \file valuesvc.h
|
||||
\author Probably Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Probably Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: valuesvc.h,v 1.2 2009/02/06 21:33:03 titato Exp $
|
||||
*/
|
||||
|
|
|
@ -17,7 +17,7 @@ using namespace std;
|
|||
* Function TestLineHit
|
||||
* test for hit on line segment i.e. a point within a given distance from segment
|
||||
* @param x, y = cursor coords
|
||||
* @param xi,yi and xf,yf = the end-points of the line segment
|
||||
* @param xi,yi,xf,yf = the end-points of the line segment
|
||||
* @param dist = maximum distance for hit
|
||||
* return true if dist < distance between the point and the segment
|
||||
*/
|
||||
|
@ -484,7 +484,7 @@ int FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function TestForIntersectionOfStraightLineSegments
|
||||
* Test for intersection of line segments
|
||||
* If lines are parallel, returns false
|
||||
|
|
|
@ -64,7 +64,7 @@ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1,
|
|||
* Function GetPointToLineSegmentDistance
|
||||
* Get distance between line segment and point
|
||||
* @param x,y = point
|
||||
* @param xi,yi and xf,yf = the end-points of the line segment
|
||||
* @param xi,yi, xf,yf = the end-points of the line segment
|
||||
* @return the distance
|
||||
*/
|
||||
double GetPointToLineSegmentDistance( int x, int y, int xi, int yi, int xf, int yf );
|
||||
|
|
Loading…
Reference in New Issue