CHANGED: Net highlight in PcbNew is now persistent to match Eeschema

CHANGED: Highlight net tool changed to highlight display toggle; moved to left toolbar
CHANGED: Multi-net highlight is now accessible when using the highlight net action
ADDED: Highlight Net and Clear Highlight actions to Net Tools context menu
ADDED: Default hotkey (Ctrl+`) for toggling net highlighting

The current and previous net highlight state are now stored and can be toggled
on or off with an action (no hotkey by default).

Highlight is now treated as a persistent state rather than a tool that is entered,
meaning there is no longer a special tool to enter in order to highlight nets.
Highlighting can be controlled while any other tool is active using the hotkeys
or context menu on a net object.

Tweak the icons for highlight net and layer display mode to better disambiguate them.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8250
This commit is contained in:
Jon Evans 2021-05-29 11:53:55 -04:00
parent acb024f622
commit eff9746f34
16 changed files with 237 additions and 214 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 B

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 305 B

View File

@ -13,7 +13,7 @@
viewBox="0 0 24 24"
version="1.1"
sodipodi:docname="contrast_mode.svg"
inkscape:version="1.0.1 (c497b03c, 2020-09-10)"
inkscape:version="1.0.2 (1.0.2+r75+1)"
inkscape:export-filename="/home/seth/code/kicad/kicad_bitmaps/bitmaps_png/sources/contrast_mode.png"
inkscape:export-xdpi="1890.4615"
inkscape:export-ydpi="1890.4615">
@ -55,15 +55,15 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="995"
inkscape:window-width="2560"
inkscape:window-height="1371"
id="namedview3143"
showgrid="true"
inkscape:zoom="24.408623"
inkscape:cx="11.458471"
inkscape:cy="13.139804"
inkscape:window-x="1280"
inkscape:window-y="23"
inkscape:zoom="45.254834"
inkscape:cx="7.8087159"
inkscape:cy="9.3949822"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="Слой_1"
inkscape:document-rotation="0">
@ -74,7 +74,8 @@
spacingy="0.5"
color="#c1c1ff"
opacity="0.1254902"
empspacing="2" />
empspacing="2"
enabled="true" />
</sodipodi:namedview>
<defs
id="defs3124">
@ -126,47 +127,30 @@
<title
id="title3126">contrast_mode</title>
<path
id="polyline3128"
style="fill:none;stroke:#848484;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 16.5,22.5 14,17.491366 H 5.118"
style="fill:none;stroke:#f2647e;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 10.166667,12 h 5.5 l 9,9"
id="path1554"
sodipodi:nodetypes="ccc" />
<path
id="polyline3130"
style="fill:none;stroke:#f2647e;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 11.092,12.505366 H 17 l 5,9"
sodipodi:nodetypes="ccc" />
<polyline
class="cls-2"
points="3 3 7 14 12.092 14"
style="fill:none;stroke:#c0c0c0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 1,3.4946319 2,2 8,8.0000001"
id="polyline3132"
transform="translate(-1,-1.4946319)"
style="stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke:#f2647e;stroke-opacity:1" />
<line
class="cls-3"
x1="15.160109"
y1="7.5238228"
x2="22.5"
y2="7.5238228"
id="line3134"
style="stroke:#848484;stroke-width:3.09707;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
sodipodi:nodetypes="ccc"
transform="translate(-1,-1.4946319)" />
<path
class="cls-4"
d="m 15.047108,8.4818142 -5,-0.0049 C 9.6167807,8.4771034 9.2347098,8.2016514 9.0989078,7.7933142 l -2,-5.9951 c -0.4710159,-1.28838267 1.4993519,-1.94586453 1.8964,-0.6328 l 1.7725002,5.3115 6.476528,0.025711 C 17.797031,6.5048193 16.5,6.9764461 16,7.4764461 15.792741,7.8304469 15.314225,8.1704919 15.047108,8.4818142 Z"
id="path3136"
style="stroke:#42B8EB;stroke-opacity:1;fill:#42B8EB;fill-opacity:1"
sodipodi:nodetypes="ccccccscc" />
id="polyline3132-3"
style="fill:none;stroke:#f2647e;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 5,-1 6,6 m 0,0 h 5 l 8,8"
sodipodi:nodetypes="ccccc" />
<path
class="cls-4"
d="m 4.490928,18.517313 -4.52339084,-0.01728 c -1.33332286,-0.0051 -1.28238706,-1.953388 0.05088291,-1.96632 l 7.06634683,-0.06854 c 0.5526746,-0.0054 -2.041143,2.054254 -2.5938389,2.052142 z"
id="path3138"
sodipodi:nodetypes="sssss"
style="fill:#42B8EB;fill-opacity:1;stroke:#42B8EB;stroke-linecap:square;stroke-opacity:1" />
<line
class="cls-3"
x1="0.5"
y1="23.5"
x2="23.5"
y2="0.5"
id="line158655"
style="fill:none;stroke:#DED3DD;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
id="polyline3132-3-6"
style="fill:none;stroke:#c0c0c0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 0,13 6,6 m 0,0 h 9 l 5,5"
sodipodi:nodetypes="ccccc" />
<circle
style="fill:#ffffff;fill-opacity:1;stroke:#f29100;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"
id="path991"
cy="12"
cx="10"
r="1.5" />
</svg>

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -30,8 +30,8 @@
id="namedview34"
showgrid="true"
inkscape:zoom="37.889139"
inkscape:cx="2.5768824"
inkscape:cy="10.805587"
inkscape:cx="2.8153171"
inkscape:cy="12.582575"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
@ -117,39 +117,33 @@
<title
id="title17">net_highlight</title>
<path
id="polyline19"
style="fill:none;stroke:#42B8EB;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round"
d="M 24,11 H 16 6"
id="polyline21"
style="fill:none;stroke:#f2647e;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none"
d="M 6.5,11.5 V 24 Z"
sodipodi:nodetypes="ccc"
inkscape:connector-curvature="0" />
<path
id="polyline21"
style="fill:none;stroke:#f2647e;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round"
d="m 6,10.293247 v 8 8 -8 z"
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0" />
<path
class="cls-4"
d="M 8.2315,11.0001 A 2.2400001,2.24 0 1 1 5.9915011,8.7600997 2.2403945,2.2403944 0 0 1 8.2315,11.0001 Z"
id="path25"
style="fill:#f29100;stroke-width:0.63999999"
inkscape:connector-curvature="0" />
<path
class="cls-3"
d="M 7.122252,11.00002 A 1.130752,1.130752 0 1 1 5.9915,9.8692679 1.130752,1.130752 0 0 1 7.122252,11.00002 Z"
id="path27"
inkscape:connector-curvature="0"
style="fill:#ffffff;stroke-width:0.51199996;fill-opacity:1" />
<path
id="polyline29"
style="fill:none;stroke:#c0c0c0;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="M -0.5250758,3.007 9,3 14,8 v 17"
style="fill:none;stroke:#c0c0c0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 0,4 h 10 l 5,5 v 14.5"
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc"
d="M 3.4749242,-0.993 12,-1 19,5.6049767 V 24.583204"
style="fill:none;stroke:#c0c0c0;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
sodipodi:nodetypes="ccc"
d="m 14,0 6,6 v 18"
style="fill:none;stroke:#c0c0c0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path856" />
<path
id="polyline19"
style="fill:none;stroke:#42b8eb;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none"
d="M 24,11.5 H 5.5"
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0" />
<circle
style="fill:#ffffff;stroke:#f29100;stroke-width:4;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"
id="path1564"
cx="6.5"
cy="11.5"
r="1.5" />
</svg>

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

84
bitmaps_png/sources/light/contrast_mode.svg Executable file → Normal file
View File

@ -13,7 +13,7 @@
viewBox="0 0 24 24"
version="1.1"
sodipodi:docname="contrast_mode.svg"
inkscape:version="1.0.1 (c497b03c, 2020-09-10)"
inkscape:version="1.0.2 (1.0.2+r75+1)"
inkscape:export-filename="/home/seth/code/kicad/kicad_bitmaps/bitmaps_png/sources/contrast_mode.png"
inkscape:export-xdpi="1890.4615"
inkscape:export-ydpi="1890.4615">
@ -55,15 +55,15 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="995"
inkscape:window-width="2560"
inkscape:window-height="1371"
id="namedview3143"
showgrid="true"
inkscape:zoom="24.408623"
inkscape:cx="11.458471"
inkscape:cy="13.139804"
inkscape:window-x="1280"
inkscape:window-y="23"
inkscape:zoom="45.254834"
inkscape:cx="7.8087159"
inkscape:cy="9.3949822"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="Слой_1"
inkscape:document-rotation="0">
@ -74,7 +74,8 @@
spacingy="0.5"
color="#c1c1ff"
opacity="0.1254902"
empspacing="2" />
empspacing="2"
enabled="true" />
</sodipodi:namedview>
<defs
id="defs3124">
@ -93,10 +94,10 @@
offset="1"
stop-color="#c6c6c5"
id="stop6191"
style="stop-color:#545454;stop-opacity:1" />
style="stop-color:#DED3DD;stop-opacity:1" />
</linearGradient>
<style
id="style3116">.cls-1,.cls-2,.cls-3,.cls-5{fill:none;stroke-linecap:round;stroke-linejoin:round;}.cls-1,.cls-2,.cls-3{stroke-width:2px;}.cls-1{stroke:url(#Безымянный_градиент_19);}.cls-2{stroke:#1a81c4;}.cls-3{stroke:url(#Безымянный_градиент_19-2);}.cls-4{fill:#bf2641;}.cls-5{stroke:#545454;}</style>
id="style3116">.cls-1,.cls-2,.cls-3,.cls-5{fill:none;stroke-linecap:round;stroke-linejoin:round;}.cls-1,.cls-2,.cls-3{stroke-width:2px;}.cls-1{stroke:url(#Безымянный_градиент_19);}.cls-2{stroke:#42B8EB;}.cls-3{stroke:url(#Безымянный_градиент_19-2);}.cls-4{fill:#f2647e;}.cls-5{stroke:#DED3DD;}</style>
<linearGradient
id="Безымянный_градиент_19"
x1="18"
@ -113,7 +114,7 @@
offset="1"
stop-color="#c6c6c5"
id="stop3120"
style="stop-color:#545454;stop-opacity:1" />
style="stop-color:#DED3DD;stop-opacity:1" />
</linearGradient>
<linearGradient
id="Безымянный_градиент_19-2"
@ -126,47 +127,30 @@
<title
id="title3126">contrast_mode</title>
<path
id="polyline3128"
style="fill:none;stroke:#848484;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 16.5,22.5 14,17.491366 H 5.118"
style="fill:none;stroke:#bf2641;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 10.166667,12 h 5.5 l 9,9"
id="path1554"
sodipodi:nodetypes="ccc" />
<path
id="polyline3130"
style="fill:none;stroke:#bf2641;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 11.092,12.505366 H 17 l 5,9"
sodipodi:nodetypes="ccc" />
<polyline
class="cls-2"
points="3 3 7 14 12.092 14"
style="fill:none;stroke:#545454;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 1,3.4946319 2,2 8,8.0000001"
id="polyline3132"
transform="translate(-1,-1.4946319)"
style="stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke:#bf2641;stroke-opacity:1" />
<line
class="cls-3"
x1="15.160109"
y1="7.5238228"
x2="22.5"
y2="7.5238228"
id="line3134"
style="stroke:#848484;stroke-width:3.09707;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
sodipodi:nodetypes="ccc"
transform="translate(-1,-1.4946319)" />
<path
class="cls-4"
d="m 15.047108,8.4818142 -5,-0.0049 C 9.6167807,8.4771034 9.2347098,8.2016514 9.0989078,7.7933142 l -2,-5.9951 c -0.4710159,-1.28838267 1.4993519,-1.94586453 1.8964,-0.6328 l 1.7725002,5.3115 6.476528,0.025711 C 17.797031,6.5048193 16.5,6.9764461 16,7.4764461 15.792741,7.8304469 15.314225,8.1704919 15.047108,8.4818142 Z"
id="path3136"
style="stroke:#1a81c4;stroke-opacity:1;fill:#1a81c4;fill-opacity:1"
sodipodi:nodetypes="ccccccscc" />
id="polyline3132-3"
style="fill:none;stroke:#bf2641;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 5,-1 6,6 m 0,0 h 5 l 8,8"
sodipodi:nodetypes="ccccc" />
<path
class="cls-4"
d="m 4.490928,18.517313 -4.52339084,-0.01728 c -1.33332286,-0.0051 -1.28238706,-1.953388 0.05088291,-1.96632 l 7.06634683,-0.06854 c 0.5526746,-0.0054 -2.041143,2.054254 -2.5938389,2.052142 z"
id="path3138"
sodipodi:nodetypes="sssss"
style="fill:#1a81c4;fill-opacity:1;stroke:#1a81c4;stroke-linecap:square;stroke-opacity:1" />
<line
class="cls-3"
x1="0.5"
y1="23.5"
x2="23.5"
y2="0.5"
id="line158655"
style="fill:none;stroke:#545454;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
id="polyline3132-3-6"
style="fill:none;stroke:#545454;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 0,13 6,6 m 0,0 h 9 l 5,5"
sodipodi:nodetypes="ccccc" />
<circle
style="fill:#ffffff;fill-opacity:1;stroke:#f29100;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"
id="path991"
cy="12"
cx="10"
r="1.5" />
</svg>

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

62
bitmaps_png/sources/light/net_highlight.svg Executable file → Normal file
View File

@ -12,7 +12,7 @@
viewBox="0 0 24 24"
version="1.1"
sodipodi:docname="net_highlight.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
inkscape:version="1.0.2 (1.0.2+r75+1)"
inkscape:export-filename="/Users/jeff/kicad_dev/kicad/bitmaps_png/png_26/net_highlight.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
@ -25,16 +25,16 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2478"
inkscape:window-height="1573"
inkscape:window-width="2560"
inkscape:window-height="1371"
id="namedview34"
showgrid="true"
inkscape:zoom="37.889139"
inkscape:cx="8.4228849"
inkscape:cy="10.805587"
inkscape:cx="2.8153171"
inkscape:cy="12.582575"
inkscape:window-x="0"
inkscape:window-y="37"
inkscape:window-maximized="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="Слой_1"
inkscape:document-rotation="0"
inkscape:measure-start="0,0"
@ -80,7 +80,7 @@
<defs
id="defs15">
<style
id="style3">.cls-1,.cls-2,.cls-5,.cls-6{fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}.cls-1{stroke:#1a81c4;}.cls-2{stroke:#bf2641;}.cls-3{fill:#b9b9b9;}.cls-4{fill:#f29100;}.cls-5{stroke:url(#Безымянный_градиент_19);}.cls-6{stroke:url(#Безымянный_градиент_3);}</style>
id="style3">.cls-1,.cls-2,.cls-5,.cls-6{fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}.cls-1{stroke:#42B8EB;}.cls-2{stroke:#f2647e;}.cls-3{fill:#8f8f8f;}.cls-4{fill:#f29100;}.cls-5{stroke:url(#Безымянный_градиент_19);}.cls-6{stroke:url(#Безымянный_градиент_3);}</style>
<linearGradient
id="Безымянный_градиент_19"
x1="9.2548"
@ -117,39 +117,33 @@
<title
id="title17">net_highlight</title>
<path
id="polyline19"
style="fill:none;stroke:#1a81c4;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round"
d="M 24,11 H 16 6"
id="polyline21"
style="fill:none;stroke:#bf2641;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 6.5,11.5 V 24 Z"
sodipodi:nodetypes="ccc"
inkscape:connector-curvature="0" />
<path
id="polyline21"
style="fill:none;stroke:#bf2641;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round"
d="m 6,10.293247 v 8 8 -8 z"
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0" />
<path
class="cls-4"
d="M 8.2315,11.0001 A 2.2400001,2.24 0 1 1 5.9915011,8.7600997 2.2403945,2.2403944 0 0 1 8.2315,11.0001 Z"
id="path25"
style="fill:#f29100;stroke-width:0.63999999"
inkscape:connector-curvature="0" />
<path
class="cls-3"
d="M 7.122252,11.00002 A 1.130752,1.130752 0 1 1 5.9915,9.8692679 1.130752,1.130752 0 0 1 7.122252,11.00002 Z"
id="path27"
inkscape:connector-curvature="0"
style="fill:#ffffff;stroke-width:0.51199996;fill-opacity:1" />
<path
id="polyline29"
style="fill:none;stroke:#848484;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="M -0.5250758,3.007 9,3 14,8 v 17"
style="fill:none;stroke:#545454;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 0,4 h 10 l 5,5 v 14.5"
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc"
d="M 3.4749242,-0.993 12,-1 19,5.6049767 V 24.583204"
style="fill:none;stroke:#848484;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
sodipodi:nodetypes="ccc"
d="m 14,0 6,6 v 18"
style="fill:none;stroke:#545454;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path856" />
<path
id="polyline19"
style="fill:none;stroke:#1a81c4;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 24,11.5 H 5.5"
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0" />
<circle
style="fill:#ffffff;stroke:#f29100;stroke-width:4;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"
id="path1564"
cx="6.5"
cy="11.5"
r="1.5" />
</svg>

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -164,6 +164,21 @@ public:
m_highlightNetcodes.clear();
}
/**
* Turns on highlighting and highlights multiple nets
* @param aHighlight is a set of netcodes to highlight
* @param aEnabled tells if highlighting should be enabled.
*/
inline void SetHighlight( std::set<int>& aHighlight, bool aEnabled = true )
{
m_highlightEnabled = aEnabled;
if( aEnabled )
m_highlightNetcodes = aHighlight;
else
m_highlightNetcodes.clear();
}
/**
* Turns on/off high contrast display mode.
*/

View File

@ -46,6 +46,7 @@
#include <wildcards_and_files_ext.h>
#include <pcb_draw_panel_gal.h>
#include <functional>
#include <pcb_painter.h>
#include <project/project_file.h>
#include <project/project_local_settings.h>
#include <project/net_settings.h>
@ -624,11 +625,27 @@ void PCB_EDIT_FRAME::setupUIConditions()
return GetDisplayOptions().m_DisplayRatsnestLinesCurved;
};
auto netHighlightCond =
[this]( const SELECTION& )
{
KIGFX::RENDER_SETTINGS* settings = GetCanvas()->GetView()->GetPainter()->GetSettings();
return !settings->GetHighlightNetCodes().empty();
};
auto enableNetHighlightCond =
[this]( const SELECTION& )
{
BOARD_INSPECTION_TOOL* tool = m_toolManager->GetTool<BOARD_INSPECTION_TOOL>();
return tool->IsNetHighlightSet();
};
mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) );
mgr->SetConditions( PCB_ACTIONS::showRatsnest, CHECK( globalRatsnestCond ) );
mgr->SetConditions( PCB_ACTIONS::ratsnestLineMode, CHECK( curvedRatsnestCond ) );
mgr->SetConditions( PCB_ACTIONS::toggleNetHighlight,
CHECK( netHighlightCond ).Enable( enableNetHighlightCond ) );
mgr->SetConditions( PCB_ACTIONS::boardSetup , ENABLE( enableBoardSetupCondition ) );
@ -706,7 +723,6 @@ void PCB_EDIT_FRAME::setupUIConditions()
CURRENT_TOOL( ACTIONS::zoomTool );
CURRENT_TOOL( ACTIONS::measureTool );
CURRENT_TOOL( ACTIONS::selectionTool );
CURRENT_TOOL( PCB_ACTIONS::highlightNetTool );
CURRENT_TOOL( PCB_ACTIONS::localRatsnestTool );

View File

@ -352,6 +352,10 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( PCB_ACTIONS::showRatsnest, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::ratsnestLineMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::toggleNetHighlight, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayEnable, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayDisable, ACTION_TOOLBAR::TOGGLE );
@ -361,7 +365,6 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::viaDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::trackDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
// Tools to show/hide toolbars:
m_optionsToolBar->AddScaledSeparator( this );
@ -429,7 +432,6 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
}
m_drawToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::highlightNetTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::localRatsnestTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->AddScaledSeparator( this );

View File

@ -54,8 +54,7 @@ BOARD_INSPECTION_TOOL::BOARD_INSPECTION_TOOL() :
m_frame( nullptr )
{
m_probingSchToPcb = false;
m_lastNetcode = -1;
m_dynamicData = nullptr;
m_dynamicData = nullptr;
}
@ -69,7 +68,8 @@ public:
Add( PCB_ACTIONS::showNet );
Add( PCB_ACTIONS::hideNet );
// Add( PCB_ACTIONS::highlightNet );
Add( PCB_ACTIONS::highlightNetSelection );
Add( PCB_ACTIONS::clearHighlight );
}
private:
@ -844,21 +844,35 @@ int BOARD_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
if( aUseSelection )
{
const PCB_SELECTION& selection = selectionTool->GetSelection();
std::set<int> netcodes;
for( auto item : selection )
{
if( auto ci = dyn_cast<BOARD_CONNECTED_ITEM*>( item ) )
{
int item_net = ci->GetNetCode();
if( net < 0 )
net = item_net;
else if( net != item_net ) // more than one net selected: do nothing
return false;
}
netcodes.insert( ci->GetNetCode() );
}
enableHighlight = ( net >= 0 && !settings->GetHighlightNetCodes().count( net ) );
enableHighlight = !netcodes.empty();
if( enableHighlight && netcodes.size() > 1 )
{
// If we are doing a multi-highlight, cross-probing back and other stuff is not
// yet supported
settings->SetHighlight( netcodes );
board->ResetNetHighLight();
for( int multiNet : netcodes )
board->SetHighLightNet( multiNet, true );
board->HighLightON();
m_toolMgr->GetView()->UpdateAllLayersColor();
m_currentlyHighlighted = netcodes;
return true;
}
else if( enableHighlight )
{
net = *netcodes.begin();
}
}
// If we didn't get a net to highlight from the selection, use the cursor
@ -928,7 +942,7 @@ int BOARD_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
if( enableHighlight != settings->IsHighlightEnabled() || !netcodes.count( net ) )
{
if( !netcodes.empty() )
m_lastNetcode = *netcodes.begin();
m_lastHighlighted = netcodes;
settings->SetHighlight( enableHighlight, net );
m_toolMgr->GetView()->UpdateAllLayersColor();
@ -937,6 +951,7 @@ int BOARD_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
// Store the highlighted netcode in the current board (for dialogs for instance)
if( enableHighlight && net >= 0 )
{
m_currentlyHighlighted = netcodes;
board->SetHighLightNet( net );
board->HighLightON();
@ -952,6 +967,7 @@ int BOARD_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
}
else
{
m_currentlyHighlighted.clear();
board->ResetNetHighLight();
m_frame->SetMsgPanel( board );
m_frame->SendCrossProbeNetName( "" );
@ -969,16 +985,30 @@ int BOARD_INSPECTION_TOOL::HighlightNet( const TOOL_EVENT& aEvent )
if( netcode > 0 )
{
m_lastNetcode = highlighted.empty() ? -1 : *highlighted.begin();
m_lastHighlighted = highlighted;
settings->SetHighlight( true, netcode );
m_toolMgr->GetView()->UpdateAllLayersColor();
m_currentlyHighlighted.clear();
m_currentlyHighlighted.insert( netcode );
}
else if( aEvent.IsAction( &PCB_ACTIONS::highlightNetSelection ) )
{
// Highlight selection (cursor position will be ignored)
highlightNet( getViewControls()->GetMousePosition(), true );
}
else if( aEvent.IsAction( &PCB_ACTIONS::toggleLastNetHighlight ) )
{
int temp = highlighted.empty() ? -1 : *highlighted.begin();
settings->SetHighlight( true, m_lastNetcode );
std::set<int> temp = highlighted;
settings->SetHighlight( m_lastHighlighted );
m_toolMgr->GetView()->UpdateAllLayersColor();
m_currentlyHighlighted = m_lastHighlighted;
m_lastHighlighted = temp;
}
else if( aEvent.IsAction( &PCB_ACTIONS::toggleNetHighlight ) )
{
bool turnOn = highlighted.empty() && !m_currentlyHighlighted.empty();
settings->SetHighlight( m_currentlyHighlighted, turnOn );
m_toolMgr->GetView()->UpdateAllLayersColor();
m_lastNetcode = temp;
}
else // Highlight the net belonging to the item under the cursor
{
@ -994,6 +1024,9 @@ int BOARD_INSPECTION_TOOL::ClearHighlight( const TOOL_EVENT& aEvent )
BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
KIGFX::RENDER_SETTINGS* settings = m_toolMgr->GetView()->GetPainter()->GetSettings();
m_currentlyHighlighted.clear();
m_lastHighlighted.clear();
board->ResetNetHighLight();
settings->SetHighlight( false );
m_toolMgr->GetView()->UpdateAllLayersColor();
@ -1002,7 +1035,7 @@ int BOARD_INSPECTION_TOOL::ClearHighlight( const TOOL_EVENT& aEvent )
return 0;
}
#if 0
int BOARD_INSPECTION_TOOL::HighlightNetTool( const TOOL_EVENT& aEvent )
{
std::string tool = aEvent.GetCommandStr().get();
@ -1034,7 +1067,7 @@ int BOARD_INSPECTION_TOOL::HighlightNetTool( const TOOL_EVENT& aEvent )
return 0;
}
#endif
int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
{
@ -1347,22 +1380,18 @@ void BOARD_INSPECTION_TOOL::setTransitions()
Go( &BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest,
PCB_ACTIONS::updateLocalRatsnest.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ListNets, PCB_ACTIONS::listNets.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ShowStatisticsDialog, PCB_ACTIONS::boardStatistics.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::InspectClearance, PCB_ACTIONS::inspectClearance.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::InspectConstraints,
PCB_ACTIONS::inspectConstraints.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ListNets, PCB_ACTIONS::listNets.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ShowStatisticsDialog, PCB_ACTIONS::boardStatistics.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::InspectClearance, PCB_ACTIONS::inspectClearance.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::InspectConstraints, PCB_ACTIONS::inspectConstraints.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::highlightNet.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightNet,
PCB_ACTIONS::highlightNetSelection.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightNet,
PCB_ACTIONS::toggleLastNetHighlight.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ClearHighlight, PCB_ACTIONS::clearHighlight.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightNetTool, PCB_ACTIONS::highlightNetTool.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ClearHighlight, ACTIONS::cancelInteractive.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightItem, PCB_ACTIONS::highlightItem.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::highlightNet.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::highlightNetSelection.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::toggleLastNetHighlight.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ClearHighlight, PCB_ACTIONS::clearHighlight.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::toggleNetHighlight.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightItem, PCB_ACTIONS::highlightItem.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HideNet, PCB_ACTIONS::hideNet.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ShowNet, PCB_ACTIONS::showNet.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HideNet, PCB_ACTIONS::hideNet.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ShowNet, PCB_ACTIONS::showNet.MakeEvent() );
}

View File

@ -119,6 +119,14 @@ public:
int InspectConstraints( const TOOL_EVENT& aEvent );
/**
* @return true if a net or nets to highlight have been set
*/
bool IsNetHighlightSet() const
{
return !m_currentlyHighlighted.empty();
}
private:
///< Event handler to recalculate dynamic ratsnest.
void ratsnestTimer( wxTimerEvent& aEvent );
@ -155,7 +163,8 @@ private:
PCB_EDIT_FRAME* m_frame; // Pointer to the currently used edit frame.
bool m_probingSchToPcb; // Recursion guard when cross-probing to Eeschema
int m_lastNetcode; // Used for toggling between last two highlighted nets
std::set<int> m_currentlyHighlighted; // Active net being highlighted, or -1 when off
std::set<int> m_lastHighlighted; // Used for toggling between last two highlighted nets
CONNECTIVITY_DATA* m_dynamicData; // Cached connectivity data from the selection

View File

@ -701,19 +701,19 @@ TOOL_ACTION PCB_ACTIONS::toggleLastNetHighlight( "pcbnew.EditorControl.toggleLas
_( "Toggle Last Net Highlight" ), _( "Toggle between last two highlighted nets" ) );
TOOL_ACTION PCB_ACTIONS::clearHighlight( "pcbnew.EditorControl.clearHighlight",
AS_GLOBAL, 0, "",
AS_GLOBAL, '~', "",
_( "Clear Net Highlighting" ), _( "Clear any existing net highlighting" ) );
TOOL_ACTION PCB_ACTIONS::highlightNetTool( "pcbnew.EditorControl.highlightNetTool",
AS_GLOBAL, 0, "",
_( "Highlight Nets" ), _( "Highlight all copper items of a net" ),
BITMAPS::net_highlight, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::toggleNetHighlight( "pcbnew.EditorControl.toggleNetHighlight",
AS_GLOBAL, MD_CTRL + '`', "",
_( "Toggle Net Highlight" ), _( "Toggle net highlighting" ),
BITMAPS::net_highlight );
TOOL_ACTION PCB_ACTIONS::highlightNetSelection( "pcbnew.EditorControl.highlightNetSelection",
AS_GLOBAL,
// Don't be tempted to remove "Modern Toolset only". It's in the legacy property name.
'`', LEGACY_HK_NAME( "Toggle Highlight of Selected Net (Modern Toolset only)" ),
_( "Highlight Net" ), _( "Highlight all copper items of a net" ),
_( "Highlight Net" ), _( "Highlight all copper items on the selected net(s)" ),
BITMAPS::net_highlight );
TOOL_ACTION PCB_ACTIONS::highlightItem( "pcbnew.EditorControl.highlightItem",

View File

@ -445,14 +445,13 @@ public:
static TOOL_ACTION inspectClearance;
static TOOL_ACTION inspectConstraints;
// Appearance controls
static TOOL_ACTION clearHighlight;
static TOOL_ACTION highlightNet;
static TOOL_ACTION toggleLastNetHighlight;
static TOOL_ACTION highlightNetTool;
static TOOL_ACTION highlightNetSelection;
static TOOL_ACTION highlightItem;
static TOOL_ACTION clearHighlight; // Turns off highlight and resets previous highlight
static TOOL_ACTION highlightNet; // Highlights a net by code (cross-probe highlight)
static TOOL_ACTION toggleLastNetHighlight; // Toggles between current and previous highlight
static TOOL_ACTION toggleNetHighlight; // Toggles between highlight off and highlight on
static TOOL_ACTION highlightNetSelection; // Turns on highlight and takes net from selection
static TOOL_ACTION highlightItem; // Select component via cross-probe
static TOOL_ACTION hideNet;
static TOOL_ACTION showNet;

View File

@ -440,9 +440,6 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
ExitGroup();
ClearSelection();
if( evt->FirstResponder() == this )
m_toolMgr->RunAction( PCB_ACTIONS::clearHighlight );
}
else
{