From 2a865ef4b67f8d8f6da5830dc73fe420e19c06ae Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 2 Dec 2018 12:21:43 -0700 Subject: [PATCH] pcbnew: Remember highlighted net while routing If the user has specifically requested a net to be highlighted before routing, we keep the net highlighted after the route is completed. --- pcbnew/router/pns_tool_base.cpp | 14 +++++++++++++- pcbnew/router/pns_tool_base.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp index 169a6ffcf4..999f5fcfad 100644 --- a/pcbnew/router/pns_tool_base.cpp +++ b/pcbnew/router/pns_tool_base.cpp @@ -71,6 +71,7 @@ TOOL_BASE::TOOL_BASE( const std::string& aToolName ) : m_startItem = nullptr; m_startLayer = 0; + m_startHighlight = false; m_endItem = nullptr; m_gridHelper = nullptr; @@ -210,9 +211,20 @@ void TOOL_BASE::highlightNet( bool aEnabled, int aNetcode ) RENDER_SETTINGS* rs = getView()->GetPainter()->GetSettings(); if( aNetcode >= 0 && aEnabled ) + { + // If the user has previously set the current net to be highlighted, + // we assume they want to keep it highlighted after routing + m_startHighlight = ( rs->IsHighlightEnabled() && rs->GetHighlightNetCode() == aNetcode ); + rs->SetHighlight( true, aNetcode ); + } else - rs->SetHighlight( false ); + { + if( !m_startHighlight ) + rs->SetHighlight( false ); + + m_startHighlight = false; + } getView()->UpdateAllLayersColor(); } diff --git a/pcbnew/router/pns_tool_base.h b/pcbnew/router/pns_tool_base.h index e3bc22b4c1..5ee6d6ce1a 100644 --- a/pcbnew/router/pns_tool_base.h +++ b/pcbnew/router/pns_tool_base.h @@ -68,6 +68,7 @@ protected: ITEM* m_startItem; int m_startLayer; VECTOR2I m_startSnapPoint; + bool m_startHighlight; ///< Keeps track of whether the net was highlighted before routing ITEM* m_endItem; VECTOR2I m_endSnapPoint;