diff --git a/bitmaps_png/png/contrast_mode_24.png b/bitmaps_png/png/contrast_mode_24.png index 314d0e9fa5..a57de94b26 100644 Binary files a/bitmaps_png/png/contrast_mode_24.png and b/bitmaps_png/png/contrast_mode_24.png differ diff --git a/bitmaps_png/png/contrast_mode_dark_24.png b/bitmaps_png/png/contrast_mode_dark_24.png index 06ce0f474d..9fec1dc5c8 100644 Binary files a/bitmaps_png/png/contrast_mode_dark_24.png and b/bitmaps_png/png/contrast_mode_dark_24.png differ diff --git a/bitmaps_png/png/net_highlight_24.png b/bitmaps_png/png/net_highlight_24.png index 055763d86e..178b74c102 100644 Binary files a/bitmaps_png/png/net_highlight_24.png and b/bitmaps_png/png/net_highlight_24.png differ diff --git a/bitmaps_png/png/net_highlight_dark_24.png b/bitmaps_png/png/net_highlight_dark_24.png index a1f913aef3..672553f570 100644 Binary files a/bitmaps_png/png/net_highlight_dark_24.png and b/bitmaps_png/png/net_highlight_dark_24.png differ diff --git a/bitmaps_png/sources/dark/contrast_mode.svg b/bitmaps_png/sources/dark/contrast_mode.svg index fe11e01c9b..cbc0140373 100644 --- a/bitmaps_png/sources/dark/contrast_mode.svg +++ b/bitmaps_png/sources/dark/contrast_mode.svg @@ -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" /> @@ -126,47 +127,30 @@ contrast_mode - - + sodipodi:nodetypes="ccc" + transform="translate(-1,-1.4946319)" /> + 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" /> - + 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" /> + diff --git a/bitmaps_png/sources/dark/net_highlight.svg b/bitmaps_png/sources/dark/net_highlight.svg index 8d1fd503db..5da8ebd947 100644 --- a/bitmaps_png/sources/dark/net_highlight.svg +++ b/bitmaps_png/sources/dark/net_highlight.svg @@ -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 @@ net_highlight - - - + + diff --git a/bitmaps_png/sources/light/contrast_mode.svg b/bitmaps_png/sources/light/contrast_mode.svg old mode 100755 new mode 100644 index a713c2d5f4..deec97e57b --- a/bitmaps_png/sources/light/contrast_mode.svg +++ b/bitmaps_png/sources/light/contrast_mode.svg @@ -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" /> @@ -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" /> + 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="stop-color:#DED3DD;stop-opacity:1" /> contrast_mode - - + sodipodi:nodetypes="ccc" + transform="translate(-1,-1.4946319)" /> + 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" /> - + 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" /> + diff --git a/bitmaps_png/sources/light/net_highlight.svg b/bitmaps_png/sources/light/net_highlight.svg old mode 100755 new mode 100644 index 34eda92fd8..f3414fbf0d --- a/bitmaps_png/sources/light/net_highlight.svg +++ b/bitmaps_png/sources/light/net_highlight.svg @@ -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 @@ + 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);} net_highlight - - - + + diff --git a/include/render_settings.h b/include/render_settings.h index 00088f4d7f..688790850e 100644 --- a/include/render_settings.h +++ b/include/render_settings.h @@ -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& aHighlight, bool aEnabled = true ) + { + m_highlightEnabled = aEnabled; + + if( aEnabled ) + m_highlightNetcodes = aHighlight; + else + m_highlightNetcodes.clear(); + } + /** * Turns on/off high contrast display mode. */ diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index eb0c3b58a7..c3742d0c71 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -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(); + 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 ); diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index 1c3105c906..ad24e34802 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -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 ); diff --git a/pcbnew/tools/board_inspection_tool.cpp b/pcbnew/tools/board_inspection_tool.cpp index 6b170621f4..65099baa82 100644 --- a/pcbnew/tools/board_inspection_tool.cpp +++ b/pcbnew/tools/board_inspection_tool.cpp @@ -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 netcodes; for( auto item : selection ) { if( auto ci = dyn_cast( 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 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( 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() ); } diff --git a/pcbnew/tools/board_inspection_tool.h b/pcbnew/tools/board_inspection_tool.h index 689f364541..bd48f5ebab 100644 --- a/pcbnew/tools/board_inspection_tool.h +++ b/pcbnew/tools/board_inspection_tool.h @@ -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 m_currentlyHighlighted; // Active net being highlighted, or -1 when off + std::set m_lastHighlighted; // Used for toggling between last two highlighted nets CONNECTIVITY_DATA* m_dynamicData; // Cached connectivity data from the selection diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 66bc6c6abb..bb492a226f 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -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", diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index 65ff6f55f4..304358bf8f 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -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; diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index 95e22b7fc0..c5ae5f8019 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -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 {