7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 08:41:41 +00:00

ADDED: New appearance control widget for PcbNew

Featuring:
- Layer view presets
- Per-type opacity for tracks, vias, pads, zones
- Net and netclass color and visibility controls

CHANGED: Simplified object visibilty controls

Fixes https://gitlab.com/kicad/code/kicad/-/issues/1951
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1981
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2003
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2173
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2254
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4325
This commit is contained in:
Jon Evans 2020-07-11 13:42:00 -04:00
parent d7f26cfdf2
commit bd14f8a82a
59 changed files with 5799 additions and 399 deletions

View File

@ -100,6 +100,8 @@ set( BMAPS_SMALL
trash
tree_nosel
tree_sel
visibility
visibility_off
www
)

View File

@ -0,0 +1,31 @@
/* Do not modify this file, it was automatically generated by the
* PNG2cpp CMake script, using a *.png file as input.
*/
#include <bitmaps_png/bitmaps_list.h>
static const unsigned char png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0xb5, 0xfa, 0x37,
0xea, 0x00, 0x00, 0x00, 0xe5, 0x49, 0x44, 0x41, 0x54, 0x28, 0x15, 0x05, 0xc1, 0xb1, 0x2b, 0x84,
0x01, 0x00, 0x07, 0xd0, 0xf7, 0x5d, 0xb1, 0x89, 0x2c, 0x06, 0x92, 0x52, 0xea, 0x92, 0x8b, 0x44,
0x8e, 0xae, 0xce, 0x22, 0x3b, 0x83, 0xba, 0xe5, 0x16, 0xfb, 0x2d, 0x8c, 0x36, 0x7f, 0x87, 0xdd,
0x62, 0x30, 0x18, 0x24, 0xb1, 0xe8, 0x0c, 0x4e, 0x19, 0x2c, 0x26, 0x74, 0xc9, 0x6a, 0x40, 0x9d,
0xef, 0xe7, 0x3d, 0x00, 0x86, 0x14, 0xa8, 0xa9, 0x83, 0x61, 0x80, 0x0a, 0x80, 0x47, 0x55, 0x6c,
0xd9, 0xc5, 0x9c, 0x27, 0x80, 0x8a, 0xc2, 0x0a, 0xb8, 0xd7, 0x04, 0xb0, 0xa9, 0x0b, 0x56, 0x14,
0x85, 0x69, 0xf7, 0x5a, 0xae, 0x2c, 0x9a, 0x35, 0x61, 0x4a, 0xbc, 0xe9, 0x7b, 0xd3, 0xb3, 0xed,
0xc4, 0x32, 0x34, 0x9d, 0xda, 0xd2, 0x13, 0x51, 0x8a, 0x88, 0x3b, 0x0d, 0x67, 0x36, 0x00, 0x8e,
0x95, 0xe2, 0xd5, 0x8e, 0x11, 0xa3, 0x5a, 0x3e, 0xc4, 0x9f, 0x43, 0x80, 0x03, 0x11, 0xdf, 0xe6,
0xad, 0xbb, 0x74, 0x61, 0xc9, 0xaa, 0x81, 0x88, 0x7d, 0x98, 0xf1, 0x2b, 0xe2, 0x5a, 0xa1, 0x2f,
0xe2, 0x19, 0x0f, 0x22, 0xbe, 0x4c, 0x54, 0x44, 0x40, 0x21, 0x4a, 0x50, 0xa2, 0x00, 0x51, 0x42,
0x47, 0xc4, 0x8f, 0x05, 0xab, 0x2e, 0x9c, 0xab, 0xa9, 0x1b, 0x88, 0x68, 0x03, 0x1c, 0x29, 0xc5,
0xbb, 0x3d, 0x63, 0xc6, 0xb5, 0x7d, 0x8a, 0x81, 0x0e, 0x00, 0x6c, 0xea, 0x8a, 0x88, 0x88, 0xb8,
0xb1, 0x06, 0x14, 0x00, 0xa8, 0x6a, 0x98, 0x14, 0xaf, 0x6e, 0xbd, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0x5e, 0x5d, 0x56, 0xf6, 0x32, 0x70,
0x52, 0x40, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE visibility_xpm[1] = {{ png, sizeof( png ), "visibility_xpm" }};
//EOF

View File

@ -0,0 +1,28 @@
/* Do not modify this file, it was automatically generated by the
* PNG2cpp CMake script, using a *.png file as input.
*/
#include <bitmaps_png/bitmaps_list.h>
static const unsigned char png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0xb5, 0xfa, 0x37,
0xea, 0x00, 0x00, 0x00, 0xb6, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x63, 0x60, 0xa0, 0x27, 0x48,
0xd7, 0x4f, 0xcd, 0x4a, 0x6f, 0x4b, 0x6b, 0x4d, 0xcf, 0x48, 0xd7, 0xc2, 0x90, 0x4c, 0x73, 0x4b,
0x3b, 0x9f, 0xf6, 0x1f, 0x08, 0xff, 0x81, 0xc9, 0xff, 0xe9, 0xc7, 0x53, 0x6c, 0x91, 0xa5, 0x5b,
0xc1, 0x12, 0x8f, 0x52, 0x83, 0x93, 0x78, 0xd3, 0xf8, 0x53, 0xa3, 0xd3, 0x5e, 0x00, 0x79, 0x7f,
0xd3, 0xca, 0x60, 0xd2, 0xa5, 0x60, 0x5d, 0xdf, 0x53, 0xb5, 0x61, 0x1a, 0x32, 0xcc, 0xd2, 0xfe,
0x80, 0xc4, 0x52, 0x53, 0x81, 0x9c, 0x64, 0xf9, 0xb4, 0x1f, 0x60, 0x05, 0xfb, 0x80, 0x4a, 0x37,
0xa6, 0x9f, 0x01, 0xc2, 0x75, 0x40, 0xd6, 0x39, 0xb0, 0xd8, 0x97, 0x2c, 0x09, 0x84, 0x82, 0x03,
0x28, 0x0a, 0x20, 0x2e, 0xfa, 0x94, 0x28, 0x0a, 0xb2, 0xa2, 0x00, 0xcc, 0xf9, 0x91, 0xa6, 0x0b,
0xf7, 0x8f, 0x25, 0xd4, 0x8a, 0x04, 0xa8, 0x40, 0x6a, 0x1d, 0xd8, 0x91, 0x4f, 0x52, 0x23, 0x12,
0x04, 0x92, 0x85, 0x52, 0x13, 0xd2, 0x5e, 0x01, 0x79, 0x7f, 0xd2, 0x0a, 0x90, 0xfd, 0xe1, 0x98,
0x7a, 0x12, 0xe2, 0x41, 0x28, 0x3c, 0x98, 0x62, 0x81, 0x11, 0x16, 0x29, 0x9a, 0xe9, 0x69, 0xe9,
0x8d, 0x69, 0x0d, 0xa9, 0x49, 0xc9, 0x2a, 0x74, 0x8d, 0x21, 0x00, 0xfd, 0xf4, 0x70, 0x5c, 0x67,
0xba, 0xa2, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE visibility_off_xpm[1] = {{ png, sizeof( png ), "visibility_off_xpm" }};
//EOF

View File

@ -496,6 +496,8 @@ EXTERN_BITMAP( via_annulus_xpm )
EXTERN_BITMAP( via_diameter_xpm )
EXTERN_BITMAP( via_hole_diameter_xpm )
EXTERN_BITMAP( viewlibs_icon_xpm )
EXTERN_BITMAP( visibility_xpm )
EXTERN_BITMAP( visibility_off_xpm )
EXTERN_BITMAP( warning_xpm )
EXTERN_BITMAP( width_track_via_xpm )
EXTERN_BITMAP( width_track_xpm )

View File

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
viewBox="0 0 24 24"
version="1.1"
id="svg3803"
sodipodi:docname="visibility.svg"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)">
<metadata
id="metadata3809">
<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:license
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
id="defs3807" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1370"
id="namedview3805"
showgrid="false"
showguides="true"
inkscape:guide-bbox="true"
inkscape:zoom="45.254834"
inkscape:cx="-4.3168652"
inkscape:cy="15.336071"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg3803">
<sodipodi:guide
position="0,0"
orientation="0,24"
id="guide3862"
inkscape:locked="false" />
<sodipodi:guide
position="24,0"
orientation="-24,0"
id="guide3864"
inkscape:locked="false" />
<sodipodi:guide
position="24,24"
orientation="0,-24"
id="guide3866"
inkscape:locked="false" />
<sodipodi:guide
position="0,24"
orientation="24,0"
id="guide3868"
inkscape:locked="false" />
<sodipodi:guide
position="3.335608,16.474179"
orientation="0,1"
id="guide3872"
inkscape:locked="false" />
<sodipodi:guide
position="6.9364841,18.795302"
orientation="0,1"
id="guide3874"
inkscape:locked="false" />
<sodipodi:guide
position="1,12.010067"
orientation="1,0"
id="guide3876"
inkscape:locked="false"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="22.959732,12.010067"
orientation="1,0"
id="guide3878"
inkscape:locked="false" />
<sodipodi:guide
position="11.321966,19.51172"
orientation="0,1"
id="guide3910"
inkscape:locked="false" />
<sodipodi:guide
position="12,14.295302"
orientation="1,0"
id="guide3915"
inkscape:locked="false"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="8.3999893,19.167397"
orientation="1,0"
id="guide4765"
inkscape:locked="false" />
<sodipodi:guide
position="15.6,21.898213"
orientation="1,0"
id="guide4767"
inkscape:locked="false"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="24,24"
orientation="1,0"
id="guide4784"
inkscape:locked="false" />
</sodipodi:namedview>
<path
d="M0 0h24v24H0z"
fill="none"
id="path3799" />
<path
d="m 11.959732,5.1644295 c -5.0000005,0 -9.2700005,2.8303087 -11.00000046,6.8255035 1.72999996,3.995195 5.99999996,6.825504 11.00000046,6.825504 5,0 9.27,-2.830309 11,-6.825504 -1.73,-3.9951948 -6,-6.8255035 -11,-6.8255035 z m 0,11.3758395 c -2.7600005,0 -5.0000005,-2.03855 -5.0000005,-4.550336 0,-2.5117854 2.24,-4.5503357 5.0000005,-4.5503357 2.76,0 5,2.0385503 5,4.5503357 0,2.511786 -2.24,4.550336 -5,4.550336 z m 0,-7.2805375 c -1.66,0 -3.0000005,1.2194895 -3.0000005,2.7302015 0,1.510712 1.3400005,2.730202 3.0000005,2.730202 1.66,0 3,-1.21949 3,-2.730202 0,-1.510712 -1.34,-2.7302015 -3,-2.7302015 z"
id="path3801"
inkscape:connector-curvature="0"
style="stroke-width:0.95397437" />
<rect
style="stroke-width:0.89999998;stroke-miterlimit:4;stroke-dasharray:none;paint-order:stroke fill markers"
id="rect4742"
width="1.5100671"
height="3.6040268"
x="-2.3988652"
y="4.2705975"
ry="0.0195265"
transform="rotate(-40.846397)" />
<rect
style="stroke-width:0.89999998;stroke-miterlimit:4;stroke-dasharray:none;paint-order:stroke fill markers"
id="rect4742-5"
width="1.5100671"
height="3.6040268"
x="5.4401145"
y="3.1494057"
ry="0.0195265"
transform="rotate(-14.26516)" />
<rect
style="stroke-width:0.89999998;stroke-miterlimit:4;stroke-dasharray:none;paint-order:stroke fill markers"
id="rect4742-6"
width="1.5100671"
height="3.6040268"
x="11.323424"
y="0.88057196"
ry="0.0195265"
transform="rotate(0.01862949)" />
<rect
style="stroke-width:0.89999998;stroke-miterlimit:4;stroke-dasharray:none;paint-order:stroke fill markers"
id="rect4742-5-2"
width="1.5100671"
height="3.6040268"
x="-17.841269"
y="-2.7698705"
ry="0.0195265"
transform="matrix(-0.96916574,-0.24640974,-0.24640974,0.96916574,0,0)" />
<rect
style="stroke-width:0.89999998;stroke-miterlimit:4;stroke-dasharray:none;paint-order:stroke fill markers"
id="rect4742-9"
width="1.5100671"
height="3.6040268"
x="-20.526423"
y="-11.402325"
ry="0.0195265"
transform="matrix(-0.75646568,-0.65403339,-0.65403339,0.75646568,0,0)" />
</svg>

After

(image error) Size: 6.4 KiB

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
viewBox="0 0 24 24"
version="1.1"
id="svg3803"
sodipodi:docname="visibility_off.svg"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)">
<metadata
id="metadata3809">
<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:license
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
id="defs3807" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1370"
id="namedview3805"
showgrid="false"
showguides="true"
inkscape:guide-bbox="true"
inkscape:zoom="16"
inkscape:cx="-1.087079"
inkscape:cy="10.657984"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg3803">
<sodipodi:guide
position="0,0"
orientation="0,24"
id="guide3862"
inkscape:locked="false" />
<sodipodi:guide
position="24,0"
orientation="-24,0"
id="guide3864"
inkscape:locked="false" />
<sodipodi:guide
position="24,24"
orientation="0,-24"
id="guide3866"
inkscape:locked="false" />
<sodipodi:guide
position="0,24"
orientation="24,0"
id="guide3868"
inkscape:locked="false" />
<sodipodi:guide
position="3.335608,16.474179"
orientation="0,1"
id="guide3872"
inkscape:locked="false" />
<sodipodi:guide
position="6.9364841,18.795302"
orientation="0,1"
id="guide3874"
inkscape:locked="false" />
<sodipodi:guide
position="1,12.010067"
orientation="1,0"
id="guide3876"
inkscape:locked="false"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="22.959732,12.010067"
orientation="1,0"
id="guide3878"
inkscape:locked="false" />
<sodipodi:guide
position="11.321966,19.51172"
orientation="0,1"
id="guide3910"
inkscape:locked="false" />
<sodipodi:guide
position="12,14.295302"
orientation="1,0"
id="guide3915"
inkscape:locked="false"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="8.3999893,19.167397"
orientation="1,0"
id="guide4765"
inkscape:locked="false" />
<sodipodi:guide
position="15.6,21.898213"
orientation="1,0"
id="guide4767"
inkscape:locked="false"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="24,24"
orientation="1,0"
id="guide4784"
inkscape:locked="false" />
<sodipodi:guide
position="0.95973154,12.010067"
orientation="0,1"
id="guide4834"
inkscape:locked="false" />
</sodipodi:namedview>
<path
d="M0 0h24v24H0z"
fill="none"
id="path3799" />
<path
d="m 11.959732,5.1644295 c -5.0000005,0 -9.2700005,2.8303087 -11.00000046,6.8255035 1.72999996,3.995195 5.99999996,6.825504 11.00000046,6.825504 5,0 9.27,-2.830309 11,-6.825504 -1.73,-3.9951948 -6,-6.8255035 -11,-6.8255035 z m 0,11.3758395 c -2.7600005,0 -5.0000005,-2.03855 -5.0000005,-4.550336 0,-2.5117854 2.24,-4.5503357 5.0000005,-4.5503357 2.76,0 5,2.0385503 5,4.5503357 0,2.511786 -2.24,4.550336 -5,4.550336 z"
id="path3801"
inkscape:connector-curvature="0"
style="fill:#666666;stroke-width:0.95397437"
sodipodi:nodetypes="scscssssss" />
<rect
style="fill:#666666;stroke-width:1.41000319;stroke-miterlimit:4;stroke-dasharray:none;paint-order:stroke fill markers"
id="rect4742-6"
width="2.3932726"
height="5.5814533"
x="10.76524"
y="-14.781991"
ry="0.030240133"
transform="matrix(-3.1770953e-4,0.99999995,-0.99999994,-3.3273889e-4,0,0)" />
</svg>

After

(image error) Size: 5.2 KiB

View File

@ -198,6 +198,7 @@ set( COMMON_DLG_SRCS
set( COMMON_WIDGET_SRCS
widgets/app_progress_dialog.cpp
widgets/bitmap_toggle.cpp
widgets/button_row_panel.cpp
widgets/color_swatch.cpp
widgets/footprint_choice.cpp

View File

@ -651,6 +651,7 @@ LSET LSET::FrontAssembly()
F_SilkS,
F_Mask,
F_Fab,
F_CrtYd
};
static const LSET saved( front_assembly, arrayDim( front_assembly ) );
@ -664,6 +665,7 @@ LSET LSET::BackAssembly()
B_SilkS,
B_Mask,
B_Fab,
B_CrtYd
};
static const LSET saved( back_assembly, arrayDim( back_assembly ) );
@ -854,3 +856,68 @@ PCB_LAYER_ID ToLAYER_ID( int aLayer )
return PCB_LAYER_ID( aLayer );
}
GAL_SET::GAL_SET( const GAL_LAYER_ID* aArray, unsigned aCount ) : GAL_SET()
{
for( unsigned i = 0; i < aCount; ++i )
set( aArray[i] );
}
std::vector<GAL_LAYER_ID> GAL_SET::Seq() const
{
std::vector<GAL_LAYER_ID> ret;
for( size_t i = 0; i < size(); ++i )
{
if( test( i ) )
ret.push_back( static_cast<GAL_LAYER_ID>( i ) );
}
return ret;
}
GAL_SET GAL_SET::DefaultVisible()
{
static const GAL_LAYER_ID visible[] = {
LAYER_VIAS,
LAYER_VIA_MICROVIA,
LAYER_VIA_BBLIND,
LAYER_VIA_THROUGH,
LAYER_NON_PLATEDHOLES,
LAYER_MOD_TEXT_FR,
LAYER_MOD_TEXT_BK,
// LAYER_MOD_TEXT_INVISIBLE, // Invisible text hidden by default
LAYER_ANCHOR,
LAYER_PAD_FR,
LAYER_PAD_BK,
LAYER_RATSNEST,
LAYER_GRID,
LAYER_GRID_AXES,
LAYER_NO_CONNECTS,
LAYER_MOD_FR,
LAYER_MOD_BK,
LAYER_MOD_VALUES,
LAYER_MOD_REFERENCES,
LAYER_TRACKS,
LAYER_PADS_TH,
LAYER_PADS_PLATEDHOLES,
LAYER_VIAS_HOLES,
LAYER_DRC_ERROR,
LAYER_DRC_WARNING,
// LAYER_DRC_EXCLUSION, // DRC exclusions hidden by default
LAYER_WORKSHEET,
LAYER_GP_OVERLAY,
LAYER_SELECT_OVERLAY,
LAYER_PCB_BACKGROUND,
LAYER_CURSOR,
LAYER_AUX_ITEMS,
LAYER_DRAW_BITMAPS,
LAYER_PADS,
LAYER_ZONES,
};
static const GAL_SET saved( visible, arrayDim( visible ) );
return saved;
}

View File

@ -68,7 +68,7 @@ void WS_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
}
const COLOR4D& WS_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
COLOR4D WS_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
{
const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );

View File

@ -43,9 +43,6 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( const wxString& aFilename ) :
},
LSET::AllLayersMask().FmtHex() ) );
static GAL_SET defaultVisible;
defaultVisible.set().reset( GAL_LAYER_INDEX( LAYER_MOD_TEXT_INVISIBLE ) );
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "board.visible_items",
[&]() -> nlohmann::json
{
@ -61,7 +58,7 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( const wxString& aFilename ) :
{
if( !aVal.is_array() || aVal.empty() )
{
m_VisibleItems = defaultVisible;
m_VisibleItems = GAL_SET::DefaultVisible();
return;
}
@ -149,7 +146,23 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( const wxString& aFilename ) :
&m_ContrastModeDisplay, HIGH_CONTRAST_MODE::NORMAL, HIGH_CONTRAST_MODE::NORMAL,
HIGH_CONTRAST_MODE::HIDDEN ) );
m_params.emplace_back( new PARAM<double>( "board.opacity.tracks", &m_TrackOpacity, 1.0 ) );
m_params.emplace_back( new PARAM<double>( "board.opacity.vias", &m_ViaOpacity, 1.0 ) );
m_params.emplace_back( new PARAM<double>( "board.opacity.pads", &m_PadOpacity, 1.0 ) );
m_params.emplace_back( new PARAM<double>( "board.opacity.zones", &m_ZoneOpacity, 1.0 ) );
m_params.emplace_back( new PARAM_LIST<wxString>( "board.hidden_nets", &m_HiddenNets, {} ) );
m_params.emplace_back( new PARAM_ENUM<NET_COLOR_MODE>( "board.net_color_mode",
&m_NetColorMode, NET_COLOR_MODE::RATSNEST, NET_COLOR_MODE::OFF,
NET_COLOR_MODE::ALL ) );
// TODO: move the rest of PCB_DISPLAY_OPTIONS that are project-specific in here
#if 0
m_params.emplace_back( new PARAM_ENUM<ZONE_DISPLAY_MODE>( "board.zone_display_mode",
&m_ZoneDisplayMode, ZONE_DISPLAY_MODE::SHOW_FILLED, ZONE_DISPLAY_MODE::SHOW_OUTLINED,
ZONE_DISPLAY_MODE::SHOW_FILLED ) );
#endif
}

View File

@ -142,7 +142,6 @@ COLOR_SETTINGS::COLOR_SETTINGS( wxString aFilename ) :
CLR( "board.ratsnest", LAYER_RATSNEST, COLOR4D( WHITE ) );
CLR( "board.select_overlay", LAYER_SELECT_OVERLAY, COLOR4D( DARKRED ) );
CLR( "board.through_via", LAYER_VIA_THROUGH, COLOR4D( LIGHTGRAY ) );
CLR( "board.via", LAYER_VIAS, COLOR4D( BLACK ) );
CLR( "board.via_blind_buried", LAYER_VIA_BBLIND, COLOR4D( BROWN ) );
CLR( "board.via_hole", LAYER_VIAS_HOLES, COLOR4D( WHITE ) );
CLR( "board.via_micro", LAYER_VIA_MICROVIA, COLOR4D( CYAN ) );

View File

@ -0,0 +1,72 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jon Evans <jon@craftyjon.com>
*
* 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 <widgets/bitmap_toggle.h>
wxDEFINE_EVENT( TOGGLE_CHANGED, wxCommandEvent );
BITMAP_TOGGLE::BITMAP_TOGGLE( wxWindow *aParent, wxWindowID aId, const wxBitmap& aCheckedBitmap,
const wxBitmap& aUncheckedBitmap, bool aChecked ) :
wxPanel( aParent, aId ),
m_checked( aChecked ),
m_unchecked_bitmap( aUncheckedBitmap ),
m_checked_bitmap( aCheckedBitmap )
{
wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
SetSizer( sizer );
const wxBitmap& bitmap = aChecked ? m_checked_bitmap : m_unchecked_bitmap;
m_bitmap = new wxStaticBitmap( this, aId, bitmap, wxDefaultPosition, bitmap.GetSize() );
sizer->Add( m_bitmap, 0, 0 );
m_bitmap->Bind( wxEVT_LEFT_UP,
[&]( wxMouseEvent& )
{
SetValue( !GetValue() );
wxCommandEvent event( TOGGLE_CHANGED );
event.SetInt( m_checked );
event.SetEventObject( this );
wxPostEvent( this, event );
} );
auto passOnEvent =
[&]( wxEvent& aEvent )
{
wxPostEvent( this, aEvent );
};
m_bitmap->Bind( wxEVT_RIGHT_DOWN, passOnEvent );
m_bitmap->Bind( wxEVT_RIGHT_UP, passOnEvent );
}
void BITMAP_TOGGLE::SetValue( bool aValue )
{
m_checked = aValue;
m_bitmap->SetBitmap( aValue ? m_checked_bitmap : m_unchecked_bitmap );
}

View File

@ -214,15 +214,17 @@ void COLOR_SWATCH::GetNewSwatchColor()
DIALOG_COLOR_PICKER dialog( ::wxGetTopLevelParent( this ), m_color, true, nullptr, m_default );
if( dialog.ShowModal() == wxID_OK )
{
newColor = dialog.GetColor();
if( newColor != COLOR4D::UNSPECIFIED || m_default == COLOR4D::UNSPECIFIED )
{
m_color = newColor;
if( newColor != COLOR4D::UNSPECIFIED || m_default == COLOR4D::UNSPECIFIED )
{
m_color = newColor;
wxBitmap bm = MakeBitmap( newColor, m_background, m_size );
m_swatch->SetBitmap( bm );
wxBitmap bm = MakeBitmap( newColor, m_background, m_size );
m_swatch->SetBitmap( bm );
sendSwatchChangeEvent( *this );
sendSwatchChangeEvent( *this );
}
}
}

View File

@ -102,7 +102,7 @@ void SCH_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
}
const COLOR4D& SCH_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
COLOR4D SCH_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
{
return m_layerColors[ aLayer ];
}

View File

@ -77,7 +77,7 @@ public:
void LoadColors( const COLOR_SETTINGS* aSettings ) override;
/// @copydoc RENDER_SETTINGS::GetColor()
virtual const COLOR4D& GetColor( const VIEW_ITEM* aItem, int aLayer ) const override;
virtual COLOR4D GetColor( const VIEW_ITEM* aItem, int aLayer ) const override;
bool IsBackgroundDark() const override
{

View File

@ -102,7 +102,7 @@ void GERBVIEW_RENDER_SETTINGS::LoadDisplayOptions( const GBR_DISPLAY_OPTIONS& aO
}
const COLOR4D& GERBVIEW_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
COLOR4D GERBVIEW_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
{
const EDA_ITEM* item = static_cast<const EDA_ITEM*>( aItem );
static const COLOR4D transparent = COLOR4D( 0, 0, 0, 0 );

View File

@ -61,7 +61,7 @@ public:
void LoadDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions );
/// @copydoc RENDER_SETTINGS::GetColor()
virtual const COLOR4D& GetColor( const VIEW_ITEM* aItem, int aLayer ) const override;
virtual COLOR4D GetColor( const VIEW_ITEM* aItem, int aLayer ) const override;
/**
* Function GetLayerColor

View File

@ -170,7 +170,7 @@ enum GAL_LAYER_ID: int
{
GAL_LAYER_ID_START = NETNAMES_LAYER_ID_END,
LAYER_VIAS = GAL_LAYER_ID_START,
LAYER_VIAS = GAL_LAYER_ID_START, ///< Meta control for all vias opacity/visibility
LAYER_VIA_MICROVIA, ///< to draw micro vias
LAYER_VIA_BBLIND, ///< to draw blind/buried vias
LAYER_VIA_THROUGH, ///< to draw usual through hole vias
@ -211,6 +211,13 @@ enum GAL_LAYER_ID: int
LAYER_WORKSHEET_PAGE1, ///< for pageLayout editor previewing
LAYER_WORKSHEET_PAGEn, ///< for pageLayout editor previewing
LAYER_PADS, ///< Meta control for all pads opacity/visibility (color ignored)
LAYER_ZONES, ///< Control for copper zone opacity/visibility (color ignored)
/// Virtual layers for stacking zones and tracks on a given copper layer
LAYER_ZONE_START,
LAYER_ZONE_END = LAYER_ZONE_START + PCB_LAYER_ID_COUNT,
/// Add new GAL layers here
GAL_LAYER_ID_END
@ -219,6 +226,9 @@ enum GAL_LAYER_ID: int
/// Use this macro to convert a GAL layer to a 0-indexed offset from LAYER_VIAS
#define GAL_LAYER_INDEX( x ) ( x - GAL_LAYER_ID_START )
/// Macro for getting the zone layer for a given copper layer
#define ZONE_LAYER_FOR( copperLayer ) ( LAYER_ZONE_START + copperLayer )
constexpr int GAL_LAYER_ID_COUNT = GAL_LAYER_ID_END - GAL_LAYER_ID_START;
inline GAL_LAYER_ID operator++( GAL_LAYER_ID& a )
@ -227,6 +237,12 @@ inline GAL_LAYER_ID operator++( GAL_LAYER_ID& a )
return a;
}
inline GAL_LAYER_ID ToGalLayer( int aInteger )
{
wxASSERT( aInteger >= GAL_LAYER_ID_START && aInteger <= GAL_LAYER_ID_END );
return static_cast<GAL_LAYER_ID>( aInteger );
}
/// Used for via types
inline GAL_LAYER_ID operator+( const GAL_LAYER_ID& a, int b )
{
@ -235,9 +251,14 @@ inline GAL_LAYER_ID operator+( const GAL_LAYER_ID& a, int b )
return t;
}
typedef std::bitset<GAL_LAYER_ID_COUNT> GAL_BASE_SET;
/// Helper for storing and iterating over GAL_LAYER_IDs
class GAL_SET : public std::bitset<GAL_LAYER_ID_COUNT>
class GAL_SET : public GAL_BASE_SET
{
private:
static constexpr int start = static_cast<int>( GAL_LAYER_ID_START );
public:
GAL_SET() : std::bitset<GAL_LAYER_ID_COUNT>()
{
@ -247,30 +268,34 @@ public:
{
}
GAL_SET( const GAL_LAYER_ID* aArray, unsigned aCount );
GAL_SET& set()
{
std::bitset<GAL_LAYER_ID_COUNT>::set();
GAL_BASE_SET::set();
return *this;
}
GAL_SET& set( size_t aPos, bool aVal = true )
GAL_SET& set( int aPos, bool aVal = true )
{
std::bitset<GAL_LAYER_ID_COUNT>::set( aPos, aVal );
GAL_BASE_SET::set( aPos, aVal );
return *this;
}
std::vector<GAL_LAYER_ID> Seq() const
GAL_SET& set( GAL_LAYER_ID aPos, bool aVal = true )
{
std::vector<GAL_LAYER_ID> ret;
for( size_t i = 0; i < size(); ++i )
{
if( test( i ) )
ret.push_back( static_cast<GAL_LAYER_ID>( i ) );
}
return ret;
GAL_BASE_SET::set( static_cast<int>( aPos ) - start, aVal );
return *this;
}
bool Contains( GAL_LAYER_ID aPos )
{
return test( static_cast<int>( aPos ) - start );
}
std::vector<GAL_LAYER_ID> Seq() const;
static GAL_SET DefaultVisible();
};
/// Eeschema drawing layers
@ -905,6 +930,12 @@ inline bool IsNetnameLayer( LAYER_NUM aLayer )
}
inline bool IsZoneLayer( LAYER_NUM aLayer )
{
return aLayer >= LAYER_ZONE_START && aLayer <= LAYER_ZONE_END;
}
inline bool IsDCodeLayer( int aLayer )
{
return aLayer >= (GERBVIEW_LAYER_ID_START + GERBER_DRAWLAYERS_COUNT) &&

View File

@ -74,22 +74,34 @@ public:
/// How trace clearances are displayed. @see TRACE_CLEARANCE_DISPLAY_MODE_T.
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode;
int m_DisplayZonesMode;
/// @see ZONE_DISPLAY_MODE - stored in the project
ZONE_DISPLAY_MODE m_ZoneDisplayMode;
int m_DisplayNetNamesMode; /* 0 do not show netnames,
* 1 show netnames on pads
* 2 show netnames on tracks
* 3 show netnames on tracks and pads
*/
/// How inactive layers are displayed. @see HIGH_CONTRAST_MODE
/// How inactive layers are displayed. @see HIGH_CONTRAST_MODE - stored in the project
HIGH_CONTRAST_MODE m_ContrastModeDisplay;
/// How to use color overrides on specific nets and netclasses
NET_COLOR_MODE m_NetColorMode;
int m_MaxLinksShowed; // in track creation: number of hairwires shown
bool m_ShowModuleRatsnest; // When moving a footprint: allows displaying a ratsnest
bool m_ShowGlobalRatsnest; // If true, show all
bool m_DisplayRatsnestLinesCurved; // Airwires can be drawn as straight lines (false)
// or curved lines (true)
// These opacity overrides multiply with any opacity in the base layer color
double m_TrackOpacity; ///< Opacity override for all tracks
double m_ViaOpacity; ///< Opacity override for all types of via
double m_PadOpacity; ///< Opacity override for SMD pads and PTHs
double m_ZoneOpacity; ///< Opacity override for filled zone areas
public:
PCB_DISPLAY_OPTIONS();

View File

@ -76,8 +76,8 @@ struct SELECTION_FILTER_OPTIONS
};
/**
* Determines how inactive layers should be displayed
*/
* Determines how inactive layers should be displayed
*/
enum class HIGH_CONTRAST_MODE
{
NORMAL = 0, ///> Non-active layers are shown normally (no high-contrast mode)
@ -85,6 +85,22 @@ enum class HIGH_CONTRAST_MODE
HIDDEN ///> Non-active layers are hidden
};
///> Determines how zones should be displayed
enum class ZONE_DISPLAY_MODE
{
SHOW_FILLED, ///< Filled polygons are shown
HIDE_FILLED, ///< Only the zone outline is shown
SHOW_OUTLINED ///< Outlines of filled polygons are shown
};
///> Determines how net color overrides should be applied
enum class NET_COLOR_MODE
{
OFF, ///< Net (and netclass) colors are not shown
RATSNEST, ///< Net/netclass colors are shown on ratsnest lines only
ALL ///< Net/netclass colors are shown on all net copper
};
/**
* A saved set of layers that are visible
*/
@ -94,25 +110,34 @@ struct LAYER_PRESET
LSET layers; ///< Board layers that are visible
GAL_SET renderLayers; ///< Render layers (e.g. object types) that are visible
PCB_LAYER_ID activeLayer; ///< Optional layer to set active when this preset is loaded
bool readOnly; ///< True if this is a read-only (built-in) preset
LAYER_PRESET( const wxString& aName ) :
LAYER_PRESET( const wxString& aName = wxEmptyString ) :
name( aName ),
activeLayer( UNSELECTED_LAYER )
{
layers = LSET::AllLayersMask();
renderLayers = GAL_SET::DefaultVisible();
readOnly = false;
}
LAYER_PRESET( const wxString& aName, const LSET& aSet ) :
LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers ) :
name( aName ),
layers( aSet ),
layers( aVisibleLayers ),
activeLayer( UNSELECTED_LAYER )
{
renderLayers = GAL_SET::DefaultVisible();
readOnly = false;
}
LAYER_PRESET( const wxString& aName, const LSET& aSet, PCB_LAYER_ID aActive ) :
LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, const GAL_SET& aVisibleObjects,
PCB_LAYER_ID aActiveLayer ) :
name( aName ),
layers( aSet ),
activeLayer( aActive )
layers( aVisibleLayers ),
renderLayers( aVisibleObjects ),
activeLayer( aActiveLayer )
{
readOnly = false;
}
bool LayersMatch( const LAYER_PRESET& aOther )

View File

@ -94,6 +94,17 @@ public:
/// The current contrast mode
HIGH_CONTRAST_MODE m_ContrastModeDisplay;
/// The current net color mode
NET_COLOR_MODE m_NetColorMode;
/// How zones are drawn (TODO: not yet used)
ZONE_DISPLAY_MODE m_ZoneDisplayMode;
double m_TrackOpacity; ///< Opacity override for all tracks
double m_ViaOpacity; ///< Opacity override for all types of via
double m_PadOpacity; ///< Opacity override for SMD pads and PTH
double m_ZoneOpacity; ///< Opacity override for filled zones
/**
* A list of netnames that have been manually hidden in the board editor.
* Currently, hiding nets means hiding the ratsnest for those nets.

View File

@ -151,14 +151,13 @@ public:
bool GetHighContrast() const { return m_hiContrastEnabled; }
/**
* Function GetColor
* Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer
* using currently used render settings.
* @param aItem is the VIEW_ITEM.
* @param aLayer is the layer.
* @return The color.
*/
virtual const COLOR4D& GetColor( const VIEW_ITEM* aItem, int aLayer ) const = 0;
virtual COLOR4D GetColor( const VIEW_ITEM* aItem, int aLayer ) const = 0;
float GetWorksheetLineWidth() const { return m_worksheetLineWidth; }

View File

@ -0,0 +1,69 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jon Evans <jon@craftyjon.com>
*
* 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 _BITMAP_TOGGLE_H
#define _BITMAP_TOGGLE_H
#include <wx/wx.h>
//#include <common.h>
#include <gal/color4d.h>
wxDECLARE_EVENT( TOGGLE_CHANGED, wxCommandEvent );
/**
* A checkbox control except with custom bitmaps for the checked and unchecked states
*
* This is useful in space-constrained situations where native toggle button controls are too big
*/
class BITMAP_TOGGLE : public wxPanel
{
public:
BITMAP_TOGGLE() {}
BITMAP_TOGGLE( wxWindow *aParent, wxWindowID aId, const wxBitmap& aCheckedBitmap,
const wxBitmap& aUncheckedBitmap, bool aChecked = false );
///> Set the checkbox state
void SetValue( bool aValue );
///> Read the checkbox state
bool GetValue() { return m_checked; }
private:
bool m_checked;
wxStaticBitmap* m_bitmap;
///> Bitmap to display in unchecked state
wxBitmap m_unchecked_bitmap;
///> Bitmap to display in checked state
wxBitmap m_checked_bitmap;
};
#endif

View File

@ -54,7 +54,7 @@ public:
void LoadColors( const COLOR_SETTINGS* aSettings ) override;
/// @copydoc RENDER_SETTINGS::GetColor()
virtual const COLOR4D& GetColor( const VIEW_ITEM* aItem, int aLayer ) const override;
virtual COLOR4D GetColor( const VIEW_ITEM* aItem, int aLayer ) const override;
inline bool IsBackgroundDark() const override
{

View File

@ -339,8 +339,11 @@ set( PCBNEW_CLASS_SRCS
footprint_preview_panel.cpp
footprint_tree_pane.cpp
widgets/appearance_controls.cpp
widgets/appearance_controls_base.cpp
widgets/panel_selection_filter.cpp
widgets/panel_selection_filter_base.cpp
)
set( PCBNEW_SRCS

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