Work-around for preference crash with multiple GAL docs open.

This commit is contained in:
Jeff Young 2018-10-13 19:41:45 +01:00
parent 29e0e6921b
commit f1e2f142a6
2 changed files with 26 additions and 13 deletions

View File

@ -74,9 +74,11 @@ public:
int m_FastGrid2; // 2nd fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox) int m_FastGrid2; // 2nd fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox)
protected: protected:
BOARD* m_Pcb; BOARD* m_Pcb;
GENERAL_COLLECTOR* m_Collector; GENERAL_COLLECTOR* m_Collector;
PCB_GENERAL_SETTINGS m_configSettings; PCB_GENERAL_SETTINGS m_configSettings;
bool m_toolbarsDirty;
void updateGridSelectBox(); void updateGridSelectBox();
void updateZoomSelectBox(); void updateZoomSelectBox();
@ -583,6 +585,8 @@ public:
virtual void OnSwitchCanvas( wxCommandEvent& aEvent ); virtual void OnSwitchCanvas( wxCommandEvent& aEvent );
void OnUpdateToolbars( wxUpdateUIEvent& aEvent );
// User interface update event handlers. // User interface update event handlers.
void OnUpdateCoordType( wxUpdateUIEvent& aEvent ); void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
void OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent ); void OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent );

View File

@ -88,6 +88,7 @@ BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, PCB_BASE_FRAME::OnToggleEdgeDrawMode ) EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, PCB_BASE_FRAME::OnToggleEdgeDrawMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, PCB_BASE_FRAME::OnToggleTextDrawMode ) EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, PCB_BASE_FRAME::OnToggleTextDrawMode )
EVT_UPDATE_UI( ID_H_TOOLBAR, PCB_BASE_FRAME::OnUpdateToolbars )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, PCB_BASE_FRAME::OnUpdateCoordType ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, PCB_BASE_FRAME::OnUpdateCoordType )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_PADS_SKETCH, PCB_BASE_FRAME::OnUpdatePadDrawMode ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_PADS_SKETCH, PCB_BASE_FRAME::OnUpdatePadDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH, PCB_BASE_FRAME::OnUpdateGraphicDrawMode ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH, PCB_BASE_FRAME::OnUpdateGraphicDrawMode )
@ -108,10 +109,10 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize, const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString & aFrameName ) : long aStyle, const wxString & aFrameName ) :
EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ), EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
m_configSettings( aFrameType ) m_Pcb( nullptr ),
m_configSettings( aFrameType ),
m_toolbarsDirty( false )
{ {
m_Pcb = NULL;
m_UserGridSize = wxPoint( (int) 10 * IU_PER_MILS, (int) 10 * IU_PER_MILS ); m_UserGridSize = wxPoint( (int) 10 * IU_PER_MILS, (int) 10 * IU_PER_MILS );
m_Collector = new GENERAL_COLLECTOR(); m_Collector = new GENERAL_COLLECTOR();
@ -477,10 +478,7 @@ void PCB_BASE_FRAME::ShowChangedLanguage()
EDA_DRAW_FRAME::ShowChangedLanguage(); EDA_DRAW_FRAME::ShowChangedLanguage();
// tooltips in toolbars // tooltips in toolbars
ReCreateHToolbar(); m_toolbarsDirty = true;
ReCreateAuxiliaryToolbar();
ReCreateVToolbar();
ReCreateOptToolbar();
// status bar // status bar
UpdateMsgPanel(); UpdateMsgPanel();
@ -1064,10 +1062,7 @@ void PCB_BASE_FRAME::CommonSettingsChanged()
{ {
EDA_DRAW_FRAME::CommonSettingsChanged(); EDA_DRAW_FRAME::CommonSettingsChanged();
ReCreateHToolbar(); m_toolbarsDirty = true;
ReCreateAuxiliaryToolbar();
ReCreateVToolbar();
ReCreateOptToolbar();
EDA_3D_VIEWER* viewer = Get3DViewerFrame(); EDA_3D_VIEWER* viewer = Get3DViewerFrame();
@ -1080,6 +1075,20 @@ void PCB_BASE_FRAME::CommonSettingsChanged()
} }
void PCB_BASE_FRAME::OnUpdateToolbars( wxUpdateUIEvent& aEvent )
{
if( m_toolbarsDirty )
{
ReCreateHToolbar();
ReCreateAuxiliaryToolbar();
ReCreateVToolbar();
ReCreateOptToolbar();
m_toolbarsDirty = false;
}
}
void PCB_BASE_FRAME::OnModify() void PCB_BASE_FRAME::OnModify()
{ {
GetScreen()->SetModify(); GetScreen()->SetModify();