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.
This commit is contained in:
Seth Hillbrand 2018-12-02 12:21:43 -07:00
parent 4363cc0bec
commit 2a865ef4b6
2 changed files with 14 additions and 1 deletions

View File

@ -71,6 +71,7 @@ TOOL_BASE::TOOL_BASE( const std::string& aToolName ) :
m_startItem = nullptr; m_startItem = nullptr;
m_startLayer = 0; m_startLayer = 0;
m_startHighlight = false;
m_endItem = nullptr; m_endItem = nullptr;
m_gridHelper = nullptr; m_gridHelper = nullptr;
@ -210,10 +211,21 @@ void TOOL_BASE::highlightNet( bool aEnabled, int aNetcode )
RENDER_SETTINGS* rs = getView()->GetPainter()->GetSettings(); RENDER_SETTINGS* rs = getView()->GetPainter()->GetSettings();
if( aNetcode >= 0 && aEnabled ) 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 ); rs->SetHighlight( true, aNetcode );
}
else else
{
if( !m_startHighlight )
rs->SetHighlight( false ); rs->SetHighlight( false );
m_startHighlight = false;
}
getView()->UpdateAllLayersColor(); getView()->UpdateAllLayersColor();
} }

View File

@ -68,6 +68,7 @@ protected:
ITEM* m_startItem; ITEM* m_startItem;
int m_startLayer; int m_startLayer;
VECTOR2I m_startSnapPoint; VECTOR2I m_startSnapPoint;
bool m_startHighlight; ///< Keeps track of whether the net was highlighted before routing
ITEM* m_endItem; ITEM* m_endItem;
VECTOR2I m_endSnapPoint; VECTOR2I m_endSnapPoint;