Gerbview: clear all previous highlight selections, after clearing all layers.

Fixes #8893
https://gitlab.com/kicad/code/kicad/issues/8893
This commit is contained in:
jean-pierre charras 2021-07-30 15:52:28 +02:00
parent baf6798695
commit 1dbd4fcb7d
3 changed files with 18 additions and 4 deletions

View File

@ -104,6 +104,15 @@ void GERBVIEW_RENDER_SETTINGS::LoadDisplayOptions( const GBR_DISPLAY_OPTIONS& aO
} }
void GERBVIEW_RENDER_SETTINGS::ClearHighlightSelections()
{
// Clear all highlight selections (dcode, net, component, attribute selection)
m_componentHighlightString.Empty();
m_netHighlightString.Empty();
m_attributeHighlightString.Empty();
m_dcodeHighlightValue = -1;
}
COLOR4D GERBVIEW_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const COLOR4D GERBVIEW_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
{ {
const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem ); const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );

View File

@ -129,6 +129,9 @@ public:
return m_diffMode; return m_diffMode;
} }
/// Clear all highlight selections (dcode, net, component, attribute selection)
void ClearHighlightSelections();
/// If set to anything but an empty string, will highlight items with matching component /// If set to anything but an empty string, will highlight items with matching component
wxString m_componentHighlightString; wxString m_componentHighlightString;

View File

@ -165,10 +165,7 @@ int GERBVIEW_CONTROL::HighlightControl( const TOOL_EVENT& aEvent )
m_frame->m_SelNetnameBox->SetSelection( 0 ); m_frame->m_SelNetnameBox->SetSelection( 0 );
m_frame->m_SelAperAttributesBox->SetSelection( 0 ); m_frame->m_SelAperAttributesBox->SetSelection( 0 );
settings->m_netHighlightString = ""; settings->ClearHighlightSelections();
settings->m_componentHighlightString = "";
settings->m_attributeHighlightString = "";
settings->m_dcodeHighlightValue = -1;
GERBER_FILE_IMAGE* gerber = m_frame->GetGbrImage( m_frame->GetActiveLayer() ); GERBER_FILE_IMAGE* gerber = m_frame->GetGbrImage( m_frame->GetActiveLayer() );
@ -321,6 +318,11 @@ int GERBVIEW_CONTROL::ClearAllLayers( const TOOL_EVENT& aEvent )
canvas()->Refresh(); canvas()->Refresh();
m_frame->ClearMsgPanel(); m_frame->ClearMsgPanel();
// Clear pending highlight selections, now outdated
KIGFX::GERBVIEW_RENDER_SETTINGS* settings =
static_cast<KIGFX::GERBVIEW_PAINTER*>( getView()->GetPainter() )->GetSettings();
settings->ClearHighlightSelections();
return 0; return 0;
} }