Synchronize toolbars state with current options after rebuilding them.
Previously, for instance after modifying preferences or language, they were rebuilt but the tools state was not set due to a missing call to SyncToolbars() after rebuilding.
This commit is contained in:
parent
b5e01ea163
commit
858db3c104
common
eeschema
gerbview
include
pagelayout_editor
pcbnew
|
@ -858,3 +858,21 @@ bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::RecreateToolbars()
|
||||
{
|
||||
// Rebuild all toolbars, and update the checked state of check tools
|
||||
if( m_mainToolBar )
|
||||
ReCreateHToolbar();
|
||||
|
||||
if( m_drawToolBar ) // Drawing tools (typically on right edge of window)
|
||||
ReCreateVToolbar();
|
||||
|
||||
if( m_optionsToolBar ) // Options (typically on left edge of window)
|
||||
ReCreateOptToolbar();
|
||||
|
||||
if( m_auxiliaryToolBar ) // Additional tools under main toolbar
|
||||
ReCreateOptToolbar();
|
||||
|
||||
// Update the checked state of tools
|
||||
SyncToolbars();
|
||||
}
|
||||
|
|
|
@ -175,8 +175,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
Raise();
|
||||
Show( true );
|
||||
|
||||
m_toolManager->RunAction( ACTIONS::zoomFitScreen, false );
|
||||
|
||||
SyncView();
|
||||
GetCanvas()->GetViewControls()->SetSnapping( true );
|
||||
GetCanvas()->GetView()->UseDrawPriority( true );
|
||||
|
@ -191,6 +189,8 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
bbox.SetOrigin( -max_size_x /2, -max_size_y/2 );
|
||||
bbox.SetSize( max_size_x, max_size_y );
|
||||
GetCanvas()->GetView()->SetBoundary( bbox );
|
||||
|
||||
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -697,9 +697,7 @@ void LIB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
|
|||
{
|
||||
SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged );
|
||||
|
||||
ReCreateHToolbar();
|
||||
ReCreateVToolbar();
|
||||
ReCreateOptToolbar();
|
||||
RecreateToolbars();
|
||||
|
||||
if( aEnvVarsChanged )
|
||||
SyncLibraries( true );
|
||||
|
@ -715,9 +713,7 @@ void LIB_EDIT_FRAME::ShowChangedLanguage()
|
|||
SCH_BASE_FRAME::ShowChangedLanguage();
|
||||
|
||||
// tooltips in toolbars
|
||||
ReCreateHToolbar();
|
||||
ReCreateVToolbar();
|
||||
ReCreateOptToolbar();
|
||||
RecreateToolbars();
|
||||
|
||||
// status bar
|
||||
UpdateMsgPanel();
|
||||
|
|
|
@ -242,7 +242,7 @@ public:
|
|||
void OnExitKiCad( wxCommandEvent& event );
|
||||
void ReCreateHToolbar() override;
|
||||
void ReCreateVToolbar() override;
|
||||
void ReCreateOptToolbar();
|
||||
void ReCreateOptToolbar() override;
|
||||
double BestZoom() override; // Returns the best zoom
|
||||
|
||||
void LoadSettings( wxConfigBase* aCfg ) override;
|
||||
|
|
|
@ -1091,9 +1091,7 @@ void SCH_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
|
|||
{
|
||||
SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged );
|
||||
|
||||
ReCreateHToolbar();
|
||||
ReCreateVToolbar();
|
||||
ReCreateOptToolbar();
|
||||
RecreateToolbars();
|
||||
Layout();
|
||||
SendSizeEvent();
|
||||
}
|
||||
|
@ -1112,9 +1110,7 @@ void SCH_EDIT_FRAME::ShowChangedLanguage()
|
|||
SCH_BASE_FRAME::ShowChangedLanguage();
|
||||
|
||||
// tooltips in toolbars
|
||||
ReCreateHToolbar();
|
||||
ReCreateVToolbar();
|
||||
ReCreateOptToolbar();
|
||||
RecreateToolbars();
|
||||
|
||||
// status bar
|
||||
UpdateMsgPanel();
|
||||
|
|
|
@ -291,7 +291,7 @@ public:
|
|||
void CreateScreens();
|
||||
void ReCreateHToolbar() override;
|
||||
void ReCreateVToolbar() override;
|
||||
void ReCreateOptToolbar();
|
||||
void ReCreateOptToolbar() override;
|
||||
void ReCreateMenuBar() override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -93,6 +93,7 @@ public:
|
|||
void CloseLibraryViewer( wxCommandEvent& event );
|
||||
void ReCreateHToolbar() override;
|
||||
void ReCreateVToolbar() override;
|
||||
void ReCreateOptToolbar() override {}
|
||||
void ReCreateMenuBar() override;
|
||||
|
||||
double BestZoom() override;
|
||||
|
|
|
@ -215,6 +215,9 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
|
||||
m_LayersManager->ReFill();
|
||||
m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
|
||||
|
||||
// Update the checked state of tools
|
||||
SyncToolbars();
|
||||
}
|
||||
|
||||
|
||||
|
@ -401,6 +404,8 @@ void GERBVIEW_FRAME::ReFillLayerWidget()
|
|||
m_LayersManager->ReFill();
|
||||
m_SelLayerBox->Resync();
|
||||
ReCreateAuxiliaryToolbar();
|
||||
// Update the checked state of tools
|
||||
SyncToolbars();
|
||||
|
||||
wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager );
|
||||
wxSize bestz = m_LayersManager->GetBestSize();
|
||||
|
@ -1151,6 +1156,9 @@ void GERBVIEW_FRAME::ActivateGalCanvas()
|
|||
|
||||
ReCreateOptToolbar();
|
||||
ReCreateMenuBar();
|
||||
|
||||
// Update the checked state of tools
|
||||
SyncToolbars();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1254,9 +1262,7 @@ void GERBVIEW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
|
|||
{
|
||||
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged );
|
||||
|
||||
ReCreateHToolbar();
|
||||
ReCreateOptToolbar();
|
||||
ReCreateAuxiliaryToolbar();
|
||||
RecreateToolbars();
|
||||
Layout();
|
||||
SendSizeEvent();
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ public:
|
|||
/**
|
||||
* Create or update the left vertical toolbar (option toolbar
|
||||
*/
|
||||
void ReCreateOptToolbar();
|
||||
void ReCreateOptToolbar() override;
|
||||
|
||||
void ReCreateMenuBar() override;
|
||||
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
|
||||
|
|
|
@ -300,6 +300,7 @@ public:
|
|||
void ReCreateMenuBar() override { }
|
||||
virtual void ReCreateHToolbar() = 0;
|
||||
virtual void ReCreateVToolbar() = 0;
|
||||
virtual void ReCreateOptToolbar() = 0;
|
||||
virtual void ReCreateAuxiliaryToolbar() { }
|
||||
|
||||
/**
|
||||
|
@ -474,7 +475,7 @@ public:
|
|||
* Update the status bar information.
|
||||
*
|
||||
* The EDA_DRAW_FRAME level updates the absolute and relative coordinates and the
|
||||
* zoom information. If you override this virtual method, make sure to call this
|
||||
* zoom information. If you override this virtual method, make sure to call this
|
||||
* subclassed method.
|
||||
*/
|
||||
void UpdateStatusBar() override;
|
||||
|
@ -578,8 +579,13 @@ public:
|
|||
{
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
virtual const BOX2I GetDocumentExtents() const;
|
||||
|
||||
/**
|
||||
* Rebuild all toolbars, and update the checked state of ckeck tools
|
||||
*/
|
||||
void RecreateToolbars();
|
||||
};
|
||||
|
||||
#endif // DRAW_FRAME_H_
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -197,7 +197,7 @@ public:
|
|||
|
||||
// General
|
||||
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
|
||||
virtual void ReCreateOptToolbar() { }
|
||||
virtual void ReCreateOptToolbar() override { }
|
||||
virtual void ShowChangedLanguage() override;
|
||||
virtual void ReCreateMenuBar() override;
|
||||
virtual void UpdateStatusBar() override;
|
||||
|
|
|
@ -255,7 +255,6 @@ void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
// do not show the window because we do not want any paint event
|
||||
Show( false );
|
||||
|
||||
// was: Pgm().SaveCurrentSetupValues( m_configSettings );
|
||||
wxConfigSaveSetups( Kiface().KifaceSettings(), m_configSettings );
|
||||
|
||||
// On Linux, m_propertiesPagelayout must be destroyed
|
||||
|
@ -422,7 +421,6 @@ void PL_EDITOR_FRAME::SaveSettings( wxConfigBase* aCfg )
|
|||
aCfg->Write( lastUsedCustomWidthKey, PAGE_INFO::GetCustomWidthMils() );
|
||||
aCfg->Write( lastUsedCustomHeightKey, PAGE_INFO::GetCustomHeightMils() );
|
||||
|
||||
// was: wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
|
||||
wxConfigSaveSetups( aCfg, GetConfigurationSettings() );
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ public:
|
|||
* Create or update the left vertical toolbar (option toolbar
|
||||
* @note This is currently not used.
|
||||
*/
|
||||
void ReCreateOptToolbar();
|
||||
void ReCreateOptToolbar() override;
|
||||
|
||||
void ReCreateMenuBar() override;
|
||||
double BestZoom() override;
|
||||
|
|
|
@ -373,10 +373,7 @@ void PCB_BASE_FRAME::ShowChangedLanguage()
|
|||
EDA_DRAW_FRAME::ShowChangedLanguage();
|
||||
|
||||
// tooltips in toolbars
|
||||
ReCreateHToolbar();
|
||||
ReCreateAuxiliaryToolbar();
|
||||
ReCreateVToolbar();
|
||||
ReCreateOptToolbar();
|
||||
RecreateToolbars();
|
||||
|
||||
// status bar
|
||||
UpdateMsgPanel();
|
||||
|
@ -752,10 +749,7 @@ void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
|
|||
{
|
||||
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged );
|
||||
|
||||
ReCreateHToolbar();
|
||||
ReCreateAuxiliaryToolbar();
|
||||
ReCreateVToolbar();
|
||||
ReCreateOptToolbar();
|
||||
RecreateToolbars();
|
||||
|
||||
// The 3D viewer isn't in the Kiway, so send its update manually
|
||||
EDA_3D_VIEWER* viewer = Get3DViewerFrame();
|
||||
|
|
Loading…
Reference in New Issue