From 1dbd4fcb7d0a925b04c87a4ac1f7ee65c11d9f23 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 30 Jul 2021 15:52:28 +0200 Subject: [PATCH] Gerbview: clear all previous highlight selections, after clearing all layers. Fixes #8893 https://gitlab.com/kicad/code/kicad/issues/8893 --- gerbview/gerbview_painter.cpp | 9 +++++++++ gerbview/gerbview_painter.h | 3 +++ gerbview/tools/gerbview_control.cpp | 10 ++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/gerbview/gerbview_painter.cpp b/gerbview/gerbview_painter.cpp index 982cff9bf9..874d640df6 100644 --- a/gerbview/gerbview_painter.cpp +++ b/gerbview/gerbview_painter.cpp @@ -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 { const EDA_ITEM* item = dynamic_cast( aItem ); diff --git a/gerbview/gerbview_painter.h b/gerbview/gerbview_painter.h index 9401beb4db..688b0f4531 100644 --- a/gerbview/gerbview_painter.h +++ b/gerbview/gerbview_painter.h @@ -129,6 +129,9 @@ public: 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 wxString m_componentHighlightString; diff --git a/gerbview/tools/gerbview_control.cpp b/gerbview/tools/gerbview_control.cpp index f1385dd8c8..6a8b9928f6 100644 --- a/gerbview/tools/gerbview_control.cpp +++ b/gerbview/tools/gerbview_control.cpp @@ -165,10 +165,7 @@ int GERBVIEW_CONTROL::HighlightControl( const TOOL_EVENT& aEvent ) m_frame->m_SelNetnameBox->SetSelection( 0 ); m_frame->m_SelAperAttributesBox->SetSelection( 0 ); - settings->m_netHighlightString = ""; - settings->m_componentHighlightString = ""; - settings->m_attributeHighlightString = ""; - settings->m_dcodeHighlightValue = -1; + settings->ClearHighlightSelections(); GERBER_FILE_IMAGE* gerber = m_frame->GetGbrImage( m_frame->GetActiveLayer() ); @@ -321,6 +318,11 @@ int GERBVIEW_CONTROL::ClearAllLayers( const TOOL_EVENT& aEvent ) canvas()->Refresh(); m_frame->ClearMsgPanel(); + // Clear pending highlight selections, now outdated + KIGFX::GERBVIEW_RENDER_SETTINGS* settings = + static_cast( getView()->GetPainter() )->GetSettings(); + settings->ClearHighlightSelections(); + return 0; }