From dc6fcc262c0c258e825d030b55a7b276d6ea0056 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 7 Nov 2022 09:11:49 +0100 Subject: [PATCH] Pcbnew : allows overwriting viewport with same name in appearance manager. Fixes #12765 https://gitlab.com/kicad/code/kicad/issues/12765 --- pcbnew/widgets/appearance_controls.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index f6047f6101..d64df5848b 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -2746,7 +2746,7 @@ void APPEARANCE_CONTROLS::updateViewportSelection( const wxString& aName ) { int idx = m_cbViewports->FindString( aName ); - if( idx >= 0 && m_cbViewports->GetSelection() != idx ) + if( idx >= 0 && idx < (int)m_cbViewports->GetCount() - 3 /* separator */ ) { m_cbViewports->SetSelection( idx ); m_lastSelectedViewport = static_cast( m_cbViewports->GetClientData( idx ) ); @@ -2806,6 +2806,7 @@ void APPEARANCE_CONTROLS::onViewportChanged( wxCommandEvent& aEvent ) } else { + m_viewports[name].rect = m_frame->GetCanvas()->GetView()->GetViewport(); index = m_cbViewports->FindString( name ); m_viewportMRU.Remove( name ); }