Browse Source

SYMBOL_EDIT_FRAME: try to fix toolbars visibility issue on wxWidgets 3.3

The root cause is RestoreAuiLayout() that restore the previous Aui perspective
can be called only when all panes are created, because (at least on Windows)
when items managed by m_auimgr are not the same as those existing when saved
by Perspective() in config, broken settings (visibility, position) can happen.

Partial fix for #21828
master
jean-pierre charras 7 hours ago
parent
commit
6f38240f33
  1. 30
      eeschema/symbol_editor/symbol_edit_frame.cpp

30
eeschema/symbol_editor/symbol_edit_frame.cpp

@ -147,6 +147,7 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
LoadSettings( m_settings );
m_libMgr = new LIB_SYMBOL_LIBRARY_MANAGER( *this );
bool loadingCancelled = false;
{
@ -161,6 +162,7 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
}
SyncLibraries( false, loadingCancelled );
m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr );
m_treePane->GetLibTree()->SetSortMode( (LIB_TREE_MODEL_ADAPTER::SORT_MODE) m_settings->m_LibrarySortMode );
@ -210,6 +212,16 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
.Bottom().Layer( 6 ) );
m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( "LeftToolbar" )
.Left().Layer( 2 ) );
m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( "RightToolbar" )
.Right().Layer( 2 ) );
// Center
m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" )
.CentrePane() );
// Columns; layers 1 - 3
m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "LibraryTree" )
.Left().Layer( 3 )
@ -220,8 +232,16 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.AddPane( m_propertiesPanel, defaultPropertiesPaneInfo( this ) );
m_auimgr.AddPane( m_selectionFilterPanel, defaultSchSelectionFilterPaneInfo( this ) );
// Can be called only when all panes are created, because (at least on Windows) when items
// managed by m_auimgr are not the same as those existing when saved by Perspective()
// in config, broken settings can happen.
RestoreAuiLayout();
// Protect against broken saved Perspective() due to bugs in previous version
// This is currently a workaround.
m_auimgr.GetPane( "TopMainToolbar" ).Top().Layer( 6 ).Position(0);
m_auimgr.GetPane( "LeftToolbar" ).Position(0);
// Show or hide m_propertiesPanel depending on current settings:
wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
@ -231,16 +251,6 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
propertiesPaneInfo.Show( m_settings->m_AuiPanels.show_properties );
updateSelectionFilterVisbility();
m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( "LeftToolbar" )
.Left().Layer( 2 ) );
m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( "RightToolbar" )
.Right().Layer( 2 ) );
// Center
m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" )
.CentrePane() );
FinishAUIInitialization();
// Can't put this in LoadSettings, because it has to be called before setupTools :/

Loading…
Cancel
Save