Properties: sync wxPGGlobalVars map state with editor global state

Thanks to @dsa-t for suggesting this

(maybe)
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12297
This commit is contained in:
Jon Evans 2022-12-08 07:55:57 -05:00
parent 0a881e091c
commit 2b0d7f65d0
2 changed files with 24 additions and 10 deletions

View File

@ -31,6 +31,7 @@
#include <wx/settings.h>
#include <wx/stattext.h>
#include <wx/propgrid/advprops.h>
extern APIIMPORT wxPGGlobalVarsClass* wxPGGlobalVars;
@ -48,6 +49,20 @@ PROPERTIES_PANEL::PROPERTIES_PANEL( wxWindow* aParent, EDA_BASE_FRAME* aFrame )
if( !wxPGGlobalVars )
wxPGInitResourceModule();
// See https://gitlab.com/kicad/code/kicad/-/issues/12297
// and https://github.com/wxWidgets/wxWidgets/issues/11787
if( wxPGGlobalVars->m_mapEditorClasses.empty() )
{
wxPGEditor_TextCtrl = nullptr;
wxPGEditor_Choice = nullptr;
wxPGEditor_ComboBox = nullptr;
wxPGEditor_TextCtrlAndButton = nullptr;
wxPGEditor_CheckBox = nullptr;
wxPGEditor_ChoiceAndButton = nullptr;
wxPGEditor_SpinCtrl = nullptr;
wxPGEditor_DatePickerCtrl = nullptr;
}
delete wxPGGlobalVars->m_defaultRenderer;
wxPGGlobalVars->m_defaultRenderer = new PG_CELL_RENDERER();

View File

@ -44,8 +44,8 @@ PCB_PROPERTIES_PANEL::PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_EDIT_FRAME* a
m_propMgr.Rebuild();
bool found = false;
if( wxPGGlobalVars )
{
wxASSERT( wxPGGlobalVars );
auto it = wxPGGlobalVars->m_mapEditorClasses.find( PG_UNIT_EDITOR::EDITOR_NAME );
if( it != wxPGGlobalVars->m_mapEditorClasses.end() )
@ -54,7 +54,6 @@ PCB_PROPERTIES_PANEL::PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_EDIT_FRAME* a
m_editor->UpdateFrame( m_frame );
found = true;
}
}
if( !found )
{