Browse Source

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
7.0
Jon Evans 3 years ago
parent
commit
2b0d7f65d0
  1. 17
      common/widgets/properties_panel.cpp
  2. 17
      pcbnew/widgets/pcb_properties_panel.cpp

17
common/widgets/properties_panel.cpp

@ -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();
@ -332,4 +347,4 @@ void PROPERTIES_PANEL::SetSplitterProportion( float aProportion )
{
m_splitter_key_proportion = aProportion;
RecalculateSplitterPos();
}
}

17
pcbnew/widgets/pcb_properties_panel.cpp

@ -44,16 +44,15 @@ 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() )
{
auto it = wxPGGlobalVars->m_mapEditorClasses.find( PG_UNIT_EDITOR::EDITOR_NAME );
if( it != wxPGGlobalVars->m_mapEditorClasses.end() )
{
m_editor = static_cast<PG_UNIT_EDITOR*>( it->second );
m_editor->UpdateFrame( m_frame );
found = true;
}
m_editor = static_cast<PG_UNIT_EDITOR*>( it->second );
m_editor->UpdateFrame( m_frame );
found = true;
}
if( !found )

Loading…
Cancel
Save