kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #30095
More layer selection options.
Added a few more layer selections to the layer sidebar.
Also included two modified versions of the show all layers icon, for
front and back, but I couldnt find out how to make them into the cpp files.
link: https://www.youtube.com/watch?v=148ZMCNWqTw&feature=youtu.be
>From c0a54d61cc873bed5eb1e221bafb483144bdb705 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristoffer=20=C3=96dmark?= <kristoffer.odmark90@xxxxxxxxx>
Date: Wed, 19 Jul 2017 23:37:10 +0200
Subject: [PATCH] added more layer selector features
---
bitmaps_png/sources/show_all_back_layers.svg | 302 ++++++++++++++++++++++++++
bitmaps_png/sources/show_all_front_layers.svg | 302 ++++++++++++++++++++++++++
pcbnew/class_pcb_layer_widget.cpp | 206 +++++++++++++-----
pcbnew/class_pcb_layer_widget.h | 20 +-
4 files changed, 769 insertions(+), 61 deletions(-)
create mode 100644 bitmaps_png/sources/show_all_back_layers.svg
create mode 100644 bitmaps_png/sources/show_all_front_layers.svg
diff --git a/bitmaps_png/sources/show_all_back_layers.svg b/bitmaps_png/sources/show_all_back_layers.svg
new file mode 100644
index 000000000..efcc3892c
--- /dev/null
+++ b/bitmaps_png/sources/show_all_back_layers.svg
@@ -0,0 +1,302 @@
+<?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: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"
+ height="26"
+ width="26"
+ version="1.1"
+ id="svg2"
+ inkscape:version="0.92.1 r"
+ sodipodi:docname="show_all_back.svg">
+ <metadata
+ id="metadata40">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <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="1440"
+ id="namedview38"
+ showgrid="true"
+ inkscape:snap-to-guides="false"
+ inkscape:snap-grids="true"
+ inkscape:zoom="20.153846"
+ inkscape:cx="13"
+ inkscape:cy="13"
+ inkscape:window-x="2560"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2"
+ showguides="true"
+ inkscape:guide-bbox="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3017"
+ empspacing="2"
+ visible="true"
+ enabled="true"
+ snapvisiblegridlinesonly="true"
+ spacingx="0.5"
+ spacingy="0.5"
+ originx="0"
+ originy="0" />
+ </sodipodi:namedview>
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3784"
+ inkscape:collect="always">
+ <stop
+ id="stop3786"
+ offset="0"
+ style="stop-color:#bebebe;stop-opacity:1" />
+ <stop
+ id="stop3788"
+ offset="1"
+ style="stop-color:#d2d2d2;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3013"
+ inkscape:collect="always">
+ <stop
+ id="stop3015"
+ offset="0"
+ style="stop-color:#6e6e6e;stop-opacity:1" />
+ <stop
+ id="stop3017"
+ offset="1"
+ style="stop-color:#8c8c8c;stop-opacity:1" />
+ </linearGradient>
+ <filter
+ id="c"
+ height="1.3651"
+ width="1.2097"
+ color-interpolation-filters="sRGB"
+ y="-0.18257"
+ x="-0.10484">
+ <feGaussianBlur
+ stdDeviation="1.5978799"
+ id="feGaussianBlur7" />
+ </filter>
+ <filter
+ id="d"
+ height="1.4696"
+ width="1.4809999"
+ color-interpolation-filters="sRGB"
+ y="-0.23481999"
+ x="-0.24049">
+ <feGaussianBlur
+ stdDeviation="1.5978799"
+ id="feGaussianBlur10" />
+ </filter>
+ <linearGradient
+ id="c-1"
+ y2="6.7758002"
+ gradientUnits="userSpaceOnUse"
+ x2="20.631001"
+ gradientTransform="matrix(0.98748,0,0,1.0024,-5.1519366,34.914162)"
+ y1="42.254002"
+ x1="19.648001">
+ <stop
+ stop-color="#b6b6b6"
+ offset="0"
+ id="stop7" />
+ <stop
+ stop-color="#f2f2f2"
+ offset=".5"
+ id="stop9" />
+ <stop
+ stop-color="#fafafa"
+ offset=".67613"
+ id="stop11" />
+ <stop
+ stop-color="#d8d8d8"
+ offset=".84052"
+ id="stop13" />
+ <stop
+ stop-color="#f2f2f2"
+ offset=".875"
+ id="stop15" />
+ <stop
+ stop-color="#dbdbdb"
+ offset="1"
+ id="stop17" />
+ </linearGradient>
+ <linearGradient
+ id="d-9"
+ y2="-4.3003001"
+ gradientUnits="userSpaceOnUse"
+ x2="25.291"
+ gradientTransform="matrix(0.99518,0,0,0.9948,21.199415,27.899328)"
+ y1="-3.6324"
+ x1="50.153">
+ <stop
+ stop-color="#fff"
+ offset="0"
+ id="stop20" />
+ <stop
+ offset="1"
+ id="stop22" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3846"
+ id="radialGradient3852"
+ cx="13"
+ cy="13"
+ fx="13"
+ fy="13"
+ r="12"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.75,0,0,0.75,3.25,3.25)" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3846">
+ <stop
+ style="stop-color:#a3a3a3;stop-opacity:1"
+ offset="0"
+ id="stop3848" />
+ <stop
+ style="stop-color:#dcdcdc;stop-opacity:1"
+ offset="1"
+ id="stop3850" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3836"
+ id="linearGradient3842"
+ x1="25.5"
+ y1="25.5"
+ x2="25.5"
+ y2="1"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3836">
+ <stop
+ style="stop-color:#505050;stop-opacity:1"
+ offset="0"
+ id="stop3838" />
+ <stop
+ style="stop-color:#969696;stop-opacity:1"
+ offset="1"
+ id="stop3840" />
+ </linearGradient>
+ <radialGradient
+ r="12"
+ fy="15.666667"
+ fx="-10.333331"
+ cy="15.666667"
+ cx="-10.333331"
+ gradientTransform="matrix(0.54166672,1.9742641e-8,-1.9742639e-8,0.54166667,22.097221,8.0138889)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient3873"
+ xlink:href="#linearGradient3784"
+ inkscape:collect="always" />
+ <linearGradient
+ gradientTransform="translate(20.999999,1.4999999)"
+ y2="6"
+ x2="5.500001"
+ y1="24"
+ x1="5.500001"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3875"
+ xlink:href="#linearGradient3013"
+ inkscape:collect="always" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4067"
+ id="linearGradient4065"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.41988577,0,0,0.39843198,7.524294,7.9051743)"
+ x1="8.6861582"
+ y1="9.6206512"
+ x2="37.265358"
+ y2="35.973965" />
+ <linearGradient
+ id="linearGradient4067"
+ y2="39.685001"
+ gradientUnits="userSpaceOnUse"
+ x2="34.534"
+ gradientTransform="matrix(1.2419,0,0,1.2419,36.866,-2.4533)"
+ y1="12.285"
+ x1="14.463">
+ <stop
+ stop-color="#c9c9c9"
+ offset="0"
+ id="stop4069" />
+ <stop
+ stop-color="#f8f8f8"
+ offset="0.44999999"
+ id="stop4071" />
+ <stop
+ stop-color="#e2e2e2"
+ offset="0.66666645"
+ id="stop4073" />
+ <stop
+ stop-color="#b0b0b0"
+ offset="0.95000005"
+ id="stop4075" />
+ <stop
+ stop-color="#c9c9c9"
+ offset="1"
+ id="stop4077" />
+ </linearGradient>
+ </defs>
+ <path
+ sodipodi:nodetypes="ccccc"
+ inkscape:connector-curvature="0"
+ id="path3835"
+ d="m 10.5,16.5 15,0 -10,8 -15,0 z"
+ style="fill:#a000a0;fill-opacity:1;stroke:#4d4d4d;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <g
+ transform="matrix(1.6382539,0,0,1.5572263,-0.2427793,0.36314149)"
+ id="g16">
+ <rect
+ height="16"
+ width="16"
+ y="0"
+ x="0"
+ id="rect18"
+ style="fill-opacity:0" />
+ </g>
+ <path
+ style="fill:#00a000;fill-opacity:1;stroke:#4d4d4d;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 11,11.5 14.5,0 -10,8 -15,0 z"
+ id="rect3828"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ inkscape:connector-curvature="0"
+ id="path3831"
+ d="m 10.5,6.5 15,0 -10,8 -15,0 z"
+ style="fill:#ffffff;fill-opacity:1;stroke:#4d4d4d;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:#4d4d4d;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 10.5,1.5 15,0 -10,8 -15,0 z"
+ id="path3833"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccc" />
+</svg>
diff --git a/bitmaps_png/sources/show_all_front_layers.svg b/bitmaps_png/sources/show_all_front_layers.svg
new file mode 100644
index 000000000..9eee8e325
--- /dev/null
+++ b/bitmaps_png/sources/show_all_front_layers.svg
@@ -0,0 +1,302 @@
+<?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: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"
+ height="26"
+ width="26"
+ version="1.1"
+ id="svg2"
+ inkscape:version="0.92.1 r"
+ sodipodi:docname="show_all_front.svg">
+ <metadata
+ id="metadata40">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <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="1440"
+ id="namedview38"
+ showgrid="true"
+ inkscape:snap-to-guides="false"
+ inkscape:snap-grids="true"
+ inkscape:zoom="20.153846"
+ inkscape:cx="13"
+ inkscape:cy="13"
+ inkscape:window-x="2560"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2"
+ showguides="true"
+ inkscape:guide-bbox="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3017"
+ empspacing="2"
+ visible="true"
+ enabled="true"
+ snapvisiblegridlinesonly="true"
+ spacingx="0.5"
+ spacingy="0.5"
+ originx="0"
+ originy="0" />
+ </sodipodi:namedview>
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3784"
+ inkscape:collect="always">
+ <stop
+ id="stop3786"
+ offset="0"
+ style="stop-color:#bebebe;stop-opacity:1" />
+ <stop
+ id="stop3788"
+ offset="1"
+ style="stop-color:#d2d2d2;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3013"
+ inkscape:collect="always">
+ <stop
+ id="stop3015"
+ offset="0"
+ style="stop-color:#6e6e6e;stop-opacity:1" />
+ <stop
+ id="stop3017"
+ offset="1"
+ style="stop-color:#8c8c8c;stop-opacity:1" />
+ </linearGradient>
+ <filter
+ id="c"
+ height="1.3651"
+ width="1.2097"
+ color-interpolation-filters="sRGB"
+ y="-0.18257"
+ x="-0.10484">
+ <feGaussianBlur
+ stdDeviation="1.5978799"
+ id="feGaussianBlur7" />
+ </filter>
+ <filter
+ id="d"
+ height="1.4696"
+ width="1.4809999"
+ color-interpolation-filters="sRGB"
+ y="-0.23481999"
+ x="-0.24049">
+ <feGaussianBlur
+ stdDeviation="1.5978799"
+ id="feGaussianBlur10" />
+ </filter>
+ <linearGradient
+ id="c-1"
+ y2="6.7758002"
+ gradientUnits="userSpaceOnUse"
+ x2="20.631001"
+ gradientTransform="matrix(0.98748,0,0,1.0024,-5.1519366,34.914162)"
+ y1="42.254002"
+ x1="19.648001">
+ <stop
+ stop-color="#b6b6b6"
+ offset="0"
+ id="stop7" />
+ <stop
+ stop-color="#f2f2f2"
+ offset=".5"
+ id="stop9" />
+ <stop
+ stop-color="#fafafa"
+ offset=".67613"
+ id="stop11" />
+ <stop
+ stop-color="#d8d8d8"
+ offset=".84052"
+ id="stop13" />
+ <stop
+ stop-color="#f2f2f2"
+ offset=".875"
+ id="stop15" />
+ <stop
+ stop-color="#dbdbdb"
+ offset="1"
+ id="stop17" />
+ </linearGradient>
+ <linearGradient
+ id="d-9"
+ y2="-4.3003001"
+ gradientUnits="userSpaceOnUse"
+ x2="25.291"
+ gradientTransform="matrix(0.99518,0,0,0.9948,21.199415,27.899328)"
+ y1="-3.6324"
+ x1="50.153">
+ <stop
+ stop-color="#fff"
+ offset="0"
+ id="stop20" />
+ <stop
+ offset="1"
+ id="stop22" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3846"
+ id="radialGradient3852"
+ cx="13"
+ cy="13"
+ fx="13"
+ fy="13"
+ r="12"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.75,0,0,0.75,3.25,3.25)" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3846">
+ <stop
+ style="stop-color:#a3a3a3;stop-opacity:1"
+ offset="0"
+ id="stop3848" />
+ <stop
+ style="stop-color:#dcdcdc;stop-opacity:1"
+ offset="1"
+ id="stop3850" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3836"
+ id="linearGradient3842"
+ x1="25.5"
+ y1="25.5"
+ x2="25.5"
+ y2="1"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3836">
+ <stop
+ style="stop-color:#505050;stop-opacity:1"
+ offset="0"
+ id="stop3838" />
+ <stop
+ style="stop-color:#969696;stop-opacity:1"
+ offset="1"
+ id="stop3840" />
+ </linearGradient>
+ <radialGradient
+ r="12"
+ fy="15.666667"
+ fx="-10.333331"
+ cy="15.666667"
+ cx="-10.333331"
+ gradientTransform="matrix(0.54166672,1.9742641e-8,-1.9742639e-8,0.54166667,22.097221,8.0138889)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient3873"
+ xlink:href="#linearGradient3784"
+ inkscape:collect="always" />
+ <linearGradient
+ gradientTransform="translate(20.999999,1.4999999)"
+ y2="6"
+ x2="5.500001"
+ y1="24"
+ x1="5.500001"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3875"
+ xlink:href="#linearGradient3013"
+ inkscape:collect="always" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4067"
+ id="linearGradient4065"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.41988577,0,0,0.39843198,7.524294,7.9051743)"
+ x1="8.6861582"
+ y1="9.6206512"
+ x2="37.265358"
+ y2="35.973965" />
+ <linearGradient
+ id="linearGradient4067"
+ y2="39.685001"
+ gradientUnits="userSpaceOnUse"
+ x2="34.534"
+ gradientTransform="matrix(1.2419,0,0,1.2419,36.866,-2.4533)"
+ y1="12.285"
+ x1="14.463">
+ <stop
+ stop-color="#c9c9c9"
+ offset="0"
+ id="stop4069" />
+ <stop
+ stop-color="#f8f8f8"
+ offset="0.44999999"
+ id="stop4071" />
+ <stop
+ stop-color="#e2e2e2"
+ offset="0.66666645"
+ id="stop4073" />
+ <stop
+ stop-color="#b0b0b0"
+ offset="0.95000005"
+ id="stop4075" />
+ <stop
+ stop-color="#c9c9c9"
+ offset="1"
+ id="stop4077" />
+ </linearGradient>
+ </defs>
+ <path
+ sodipodi:nodetypes="ccccc"
+ inkscape:connector-curvature="0"
+ id="path3835"
+ d="m 10.5,16.5 15,0 -10,8 -15,0 z"
+ style="fill:#ffffff;fill-opacity:1;stroke:#4d4d4d;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <g
+ transform="matrix(1.6382539,0,0,1.5572263,-0.2427793,0.36314149)"
+ id="g16">
+ <rect
+ height="16"
+ width="16"
+ y="0"
+ x="0"
+ id="rect18"
+ style="fill-opacity:0" />
+ </g>
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:#4d4d4d;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 11,11.5 14.5,0 -10,8 -15,0 z"
+ id="rect3828"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ inkscape:connector-curvature="0"
+ id="path3831"
+ d="m 10.5,6.5 15,0 -10,8 -15,0 z"
+ style="fill:#e60000;fill-opacity:1;stroke:#4d4d4d;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ style="fill:#00a0a0;fill-opacity:1;stroke:#4d4d4d;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 10.5,1.5 15,0 -10,8 -15,0 z"
+ id="path3833"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccc" />
+</svg>
diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp
index 48979829e..6fa35a484 100644
--- a/pcbnew/class_pcb_layer_widget.cpp
+++ b/pcbnew/class_pcb_layer_widget.cpp
@@ -107,7 +107,7 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwn
// since Popupmenu() calls this->ProcessEvent() we must call this->Connect()
// and not m_LayerScrolledWindow->Connect()
- Connect( ID_SHOW_ALL_COPPER_LAYERS, ID_SHOW_ALL_LAYERS,
+ Connect( ID_SHOW_ALL_COPPER_LAYERS, ID_LAST_VALUE - 1,
wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler( PCB_LAYER_WIDGET::onPopupSelection ), NULL, this );
// install the right click handler into each control at end of ReFill()
@@ -179,11 +179,28 @@ void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event )
menu.AppendSeparator();
+ AddMenuItem( &menu, ID_SHOW_ALL_NON_COPPER,
+ _( "Show All Non Copper Layers" ),
+ KiBitmap( select_w_layer_xpm ) );
+ AddMenuItem( &menu, ID_HIDE_ALL_NON_COPPER,
+ _( "Hide All Non Copper Layers" ),
+ KiBitmap( show_no_copper_layers_xpm ) );
+
+ menu.AppendSeparator();
+
AddMenuItem( &menu, ID_SHOW_NO_LAYERS, _( "Hide All Layers" ),
KiBitmap( show_no_layers_xpm ) );
AddMenuItem( &menu, ID_SHOW_ALL_LAYERS, _( "Show All Layers" ),
KiBitmap( show_all_layers_xpm ) );
+ menu.AppendSeparator();
+
+ AddMenuItem( &menu, ID_SHOW_ALL_FRONT, _( "Show All Front Layers" ),
+ KiBitmap( show_no_layers_xpm ) );
+
+ AddMenuItem( &menu, ID_SHOW_ALL_BACK, _( "Show All Back Layers" ),
+ KiBitmap( show_all_layers_xpm ) );
+
PopupMenu( &menu );
passOnFocus();
@@ -199,76 +216,155 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
m_alwaysShowActiveCopperLayer = ( menuId == ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE );
force_active_layer_visible = ( menuId == ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE ||
- menuId == ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE );
+ menuId == ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE );
switch( menuId )
{
- case ID_SHOW_NO_LAYERS:
- case ID_SHOW_ALL_LAYERS:
- visible = menuId == ID_SHOW_ALL_LAYERS;
- rowCount = GetLayerRowCount();
+ case ID_SHOW_NO_LAYERS:
+ case ID_SHOW_ALL_LAYERS:
+ {
+ visible = ( menuId == ID_SHOW_ALL_LAYERS );
+ rowCount = GetLayerRowCount();
- for( int row=0; row<rowCount; ++row )
- {
- bool isLast;
- wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
- PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
- cb->SetValue( visible );
+ for( int row=0; row<rowCount; ++row )
+ {
+ bool isLast;
+ wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
+ PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
+ cb->SetValue( visible );
- isLast = row == rowCount-1;
+ isLast = row == rowCount-1;
- OnLayerVisible( layer, visible, isLast );
+ OnLayerVisible( layer, visible, isLast );
- if( isLast )
+ if( isLast )
+ break;
+ }
break;
- }
- break;
-
- case ID_SHOW_ALL_COPPER_LAYERS:
- case ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE:
- case ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE:
- case ID_SHOW_NO_COPPER_LAYERS:
-
- // Search the last copper layer row index:
- int lastCu = -1;
- rowCount = GetLayerRowCount();
- for( int row = rowCount-1; row>=0; --row )
- {
- wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
- PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
+ }
- if( IsCopperLayer( layer ) )
+ case ID_SHOW_ALL_COPPER_LAYERS:
+ case ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE:
+ case ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE:
+ case ID_SHOW_NO_COPPER_LAYERS:
+ case ID_HIDE_ALL_NON_COPPER:
+ case ID_SHOW_ALL_NON_COPPER:
{
- lastCu = row;
+
+ // Search the last copper layer row index:
+ int lastCu = -1;
+ rowCount = GetLayerRowCount();
+ for( int row = rowCount-1; row>=0; --row )
+ {
+ wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
+ PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
+
+ if( IsCopperLayer( layer ) )
+ {
+ lastCu = row;
+ break;
+ }
+ }
+
+ // Enable/disable the copper layers visibility:
+ int startrow = 0;
+
+ if( ( menuId == ID_SHOW_ALL_NON_COPPER ) ||
+ ( menuId == ID_HIDE_ALL_NON_COPPER ) )
+ {
+ startrow = lastCu + 1;
+ }
+
+ for( int row = startrow; row<rowCount; ++row )
+ {
+ wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
+ PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
+
+ visible = ( ( menuId == ID_SHOW_ALL_COPPER_LAYERS ) || ( menuId == ID_SHOW_ALL_NON_COPPER ) );
+
+ if( force_active_layer_visible && (layer == myframe->GetActiveLayer() ) )
+ visible = true;
+
+ cb->SetValue( visible );
+
+ bool isLastLayer = (row == lastCu);
+
+ if( ( menuId == ID_SHOW_ALL_NON_COPPER ) ||
+ ( menuId == ID_HIDE_ALL_NON_COPPER ) )
+ {
+ isLastLayer = false;
+ }
+ OnLayerVisible( layer, visible, isLastLayer );
+
+ if( isLastLayer )
+ break;
+ }
break;
}
- }
-
- // Enable/disable the copper layers visibility:
- for( int row=0; row<rowCount; ++row )
- {
- wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
- PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
- if( IsCopperLayer( layer ) )
+ case ID_SHOW_ALL_FRONT:
{
- visible = menuId == ID_SHOW_ALL_COPPER_LAYERS;
-
- if( force_active_layer_visible && (layer == myframe->GetActiveLayer() ) )
- visible = true;
-
- cb->SetValue( visible );
-
- bool isLastCopperLayer = (row == lastCu);
- OnLayerVisible( layer, visible, isLastCopperLayer );
-
- if( isLastCopperLayer )
- break;
+ visible = false;
+ rowCount = GetLayerRowCount();
+
+ for( int row=0; row<rowCount; ++row )
+ {
+ bool isLast;
+ wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
+ PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
+ isLast = ( row == rowCount-1 );
+
+ if( layer == F_Paste || layer == F_SilkS ||
+ layer == F_Mask || layer == F_Cu ||
+ layer == F_Fab || layer == F_CrtYd )
+ {
+ visible = true;
+ }
+ else
+ {
+ visible = false;
+ }
+
+ cb->SetValue( visible );
+ OnLayerVisible( layer, visible, isLast );
+
+ if( isLast )
+ break;
+ }
+ break;
+ }
+ case ID_SHOW_ALL_BACK:
+ {
+ visible = false;
+ rowCount = GetLayerRowCount();
+
+ for( int row=0; row<rowCount; ++row )
+ {
+ bool isLast;
+ wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
+ PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
+ isLast = ( row == rowCount-1 );
+
+ if( layer == B_Paste || layer == B_SilkS ||
+ layer == B_Mask || layer == B_Cu ||
+ layer == B_Fab || layer == B_CrtYd )
+ {
+ visible = true;
+ }
+ else
+ {
+ visible = false;
+ }
+
+ cb->SetValue( visible );
+ OnLayerVisible( layer, visible, isLast );
+
+ if( isLast )
+ break;
+ }
+ break;
}
- }
- break;
-
}
}
diff --git a/pcbnew/class_pcb_layer_widget.h b/pcbnew/class_pcb_layer_widget.h
index 5c623de39..dae4062d3 100644
--- a/pcbnew/class_pcb_layer_widget.h
+++ b/pcbnew/class_pcb_layer_widget.h
@@ -118,12 +118,20 @@ protected:
PCB_BASE_FRAME* myframe;
// popup menu ids.
-#define ID_SHOW_ALL_COPPER_LAYERS wxID_HIGHEST
-#define ID_SHOW_NO_COPPER_LAYERS (wxID_HIGHEST+1)
-#define ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE (wxID_HIGHEST+2)
-#define ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE (wxID_HIGHEST+3)
-#define ID_SHOW_NO_LAYERS (wxID_HIGHEST+4)
-#define ID_SHOW_ALL_LAYERS (wxID_HIGHEST+5)
+ enum POPUP_ID
+ {
+ ID_SHOW_ALL_COPPER_LAYERS = wxID_HIGHEST,
+ ID_SHOW_NO_COPPER_LAYERS,
+ ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE,
+ ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE,
+ ID_SHOW_NO_LAYERS,
+ ID_SHOW_ALL_LAYERS,
+ ID_SHOW_ALL_FRONT,
+ ID_SHOW_ALL_BACK,
+ ID_HIDE_ALL_NON_COPPER,
+ ID_SHOW_ALL_NON_COPPER,
+ ID_LAST_VALUE
+ };
virtual bool AreArbitraryColorsAllowed() override;
--
2.13.2
Follow ups