From 73b7b104cd9ef2c5f709928db1d66c02c1dfc5a0 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 11 Dec 2020 12:09:37 +0000 Subject: [PATCH] Fix some issues with Infobar sizing. This also commits to the new strategy as it wasn't really compatible with if-def-ing anymore. --- 3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp | 11 ++--- 3d-viewer/3d_viewer/eda_3d_viewer.cpp | 28 +++-------- common/widgets/infobar.cpp | 40 ++++----------- cvpcb/display_footprints_frame.cpp | 23 ++++----- eeschema/sch_edit_frame.cpp | 32 +++++------- eeschema/symbol_editor/symbol_edit_frame.cpp | 35 ++++++------- include/widgets/infobar.h | 12 ++--- pagelayout_editor/pl_editor_frame.cpp | 42 +++++++--------- pcbnew/footprint_edit_frame.cpp | 52 ++++++++++---------- pcbnew/pcb_edit_frame.cpp | 52 +++++++++----------- pcbnew/router/router_tool.cpp | 3 +- pcbnew/widgets/appearance_controls.cpp | 2 +- 12 files changed, 135 insertions(+), 197 deletions(-) diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp b/3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp index b0ce4e6ead..91e6ce0cca 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp +++ b/3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp @@ -89,11 +89,9 @@ PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, FOOTPRI m_dummyFootprint = new FOOTPRINT( *aFootprint ); m_dummyBoard->Add( m_dummyFootprint ); - // Create the infobar - m_infobar = new WX_INFOBAR( this ); - // Create the 3D canvas - m_previewPane = new EDA_3D_CANVAS( this, COGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE::AA_8X ), + m_previewPane = new EDA_3D_CANVAS( this, + COGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE::AA_8X ), m_dummyBoard, m_boardAdapter, m_currentCamera, aFrame->Prj().Get3DCacheManager() ); @@ -119,9 +117,8 @@ PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, FOOTPRI m_SizerPanelView->Add( m_infobar, 0, wxEXPAND, 0 ); m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND, 5 ); - // Tell the canvas about the infobar - if( m_infobar ) - m_previewPane->SetInfoBar( m_infobar ); + m_infobar = new WX_INFOBAR( this ); + m_previewPane->SetInfoBar( m_infobar ); for( wxEventType eventType : { wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT } ) Connect( eventType, wxMenuEventHandler( PANEL_PREV_3D::OnMenuEvent ), NULL, this ); diff --git a/3d-viewer/3d_viewer/eda_3d_viewer.cpp b/3d-viewer/3d_viewer/eda_3d_viewer.cpp index 99b2e8d50d..10486566b6 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer.cpp @@ -141,31 +141,19 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent, const wxSt CreateMenuBar(); ReCreateMainToolbar(); - // Create the infobar - m_infoBar = new WX_INFOBAR( this, &m_auimgr ); - m_auimgr.SetManagedWindow( this ); - m_auimgr.AddPane( m_mainToolBar, - EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer( 6 ) ); - m_auimgr.AddPane( m_infoBar, - EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) ); - m_auimgr.AddPane( m_canvas, - EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); + m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ) + .Top().Layer( 6 ) ); + m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ) + .Center() ); - // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before - // hidding it. + // Call Update() to fix all pane default sizes. m_auimgr.Update(); - // We don't want the infobar displayed right away - m_auimgr.GetPane( "InfoBar" ).Hide(); - m_auimgr.Update(); - - if( m_canvas ) - { - m_canvas->SetInfoBar( m_infoBar ); - m_canvas->SetStatusBar( status_bar ); - } + m_infoBar = new WX_INFOBAR( m_canvas ); + m_canvas->SetInfoBar( m_infoBar ); + m_canvas->SetStatusBar( status_bar ); // Fixes bug in Windows (XP and possibly others) where the canvas requires the focus // in order to receive mouse events. Otherwise, the user has to click somewhere on diff --git a/common/widgets/infobar.cpp b/common/widgets/infobar.cpp index 4e3f181ff3..87638cc38b 100644 --- a/common/widgets/infobar.cpp +++ b/common/widgets/infobar.cpp @@ -21,7 +21,6 @@ #include #include #include "wx/artprov.h" -#include #include #include #include @@ -41,23 +40,16 @@ BEGIN_EVENT_TABLE( WX_INFOBAR, wxInfoBarGeneric ) END_EVENT_TABLE() -WX_INFOBAR::WX_INFOBAR( wxWindow* aParent, wxAuiManager* aMgr, wxWindowID aWinid ) +WX_INFOBAR::WX_INFOBAR( wxWindow* aParent, wxWindowID aWinid ) : wxInfoBarGeneric( aParent, aWinid ), m_showTime( 0 ), m_updateLock( false ), - m_showTimer( nullptr ), - m_auiManager( aMgr ) + m_showTimer( nullptr ) { m_showTimer = new wxTimer( this, ID_CLOSE_INFOBAR ); -#if 1 - m_auiManager = nullptr; SetShowHideEffects( wxSHOW_EFFECT_ROLL_TO_BOTTOM, wxSHOW_EFFECT_ROLL_TO_TOP ); SetEffectDuration( 300 ); -#else - // Don't use any effects since they leave the sizer area visible under the infobar - SetShowHideEffects( wxSHOW_EFFECT_NONE, wxSHOW_EFFECT_NONE ); -#endif // The infobar seems to start too small, so increase its height int sx, sy; @@ -78,6 +70,8 @@ WX_INFOBAR::WX_INFOBAR( wxWindow* aParent, wxAuiManager* aMgr, wxWindowID aWinid RemoveAllButtons(); Layout(); + + m_parent->Bind( wxEVT_SIZE, &WX_INFOBAR::onSize, this ); } @@ -133,9 +127,6 @@ void WX_INFOBAR::ShowMessage( const wxString& aMessage, int aFlags ) wxInfoBarGeneric::ShowMessage( aMessage, aFlags ); - if( m_auiManager ) - UpdateAuiLayout( true ); - if( m_showTime > 0 ) m_showTimer->StartOnce( m_showTime ); @@ -153,30 +144,19 @@ void WX_INFOBAR::Dismiss() wxInfoBarGeneric::Dismiss(); - if( m_auiManager ) - UpdateAuiLayout( false ); - m_updateLock = false; } -void WX_INFOBAR::UpdateAuiLayout( bool aShow ) +void WX_INFOBAR::onSize( wxSizeEvent& aEvent ) { - wxASSERT( m_auiManager ); + int barWidth = GetSize().GetWidth(); + int parentWidth = m_parent->GetSize().GetWidth(); - wxAuiPaneInfo& pane = m_auiManager->GetPane( this ); + if( barWidth != parentWidth ) + SetSize( parentWidth, GetSize().GetHeight() ); - // If the infobar is in a pane, then show/hide the pane - if( pane.IsOk() ) - { - if( aShow ) - pane.Show(); - else - pane.Hide(); - } - - // Update the AUI manager regardless - m_auiManager->Update(); + aEvent.Skip(); } diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp index 13abf70bfc..840b1ae356 100644 --- a/cvpcb/display_footprints_frame.cpp +++ b/cvpcb/display_footprints_frame.cpp @@ -127,24 +127,21 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa ReCreateVToolbar(); ReCreateOptToolbar(); - // Create the infobar - m_infoBar = new WX_INFOBAR( this, &m_auimgr ); - m_auimgr.SetManagedWindow( this ); - m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); - m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); - m_auimgr.AddPane( m_infoBar, EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) ); - m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); - m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); + m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ) + .Top().Layer( 6 ) ); + m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ) + .Left().Layer( 3 ) ); + m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ) + .Center() ); + m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ) + .Bottom().Layer( 6 ) ); - // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before - // hidding it. + // Call Update() to fix all pane default sizes. m_auimgr.Update(); - // We don't want the infobar displayed right away - m_auimgr.GetPane( "InfoBar" ).Hide(); - m_auimgr.Update(); + m_infoBar = new WX_INFOBAR( GetCanvas() ); auto& galOpts = GetGalDisplayOptions(); galOpts.m_axesEnabled = true; diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 3fb21f9531..a93dea529a 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -241,9 +241,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : ReCreateVToolbar(); ReCreateOptToolbar(); - // Create the infobar - m_infoBar = new WX_INFOBAR( this, &m_auimgr ); - // Initialize common print setup dialog settings. m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER ); m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM ); @@ -252,26 +249,21 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_auimgr.SetManagedWindow( this ); - m_auimgr.AddPane( m_mainToolBar, - EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); - m_auimgr.AddPane( m_optionsToolBar, - EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); - m_auimgr.AddPane( m_drawToolBar, - EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) ); - m_auimgr.AddPane( m_infoBar, - EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) ); - m_auimgr.AddPane( GetCanvas(), - EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); - m_auimgr.AddPane( m_messagePanel, - EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); + m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ) + .Top().Layer( 6 ) ); + m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ) + .Left().Layer( 3 ) ); + m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ) + .Right().Layer( 2 ) ); + m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ) + .Center() ); + m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ) + .Bottom().Layer( 6 ) ); - // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before - // hidding it. + // Call Update() to fix all pane default sizes. m_auimgr.Update(); - // We don't want the infobar displayed right away - m_auimgr.GetPane( "InfoBar" ).Hide(); - m_auimgr.Update(); + m_infoBar = new WX_INFOBAR( GetCanvas() ); resolveCanvasType(); SwitchCanvas( m_canvasType ); diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index dc017104ac..fcaa5c7bc3 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -145,32 +145,29 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : DisplaySymbolDatasheet(); RebuildSymbolUnitsList(); - // Create the infobar - m_infoBar = new WX_INFOBAR( this, &m_auimgr ); - m_auimgr.SetManagedWindow( this ); - m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); - m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); + m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ) + .Top().Layer( 6 ) ); + m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ) + .Bottom().Layer( 6 ) ); - m_auimgr.AddPane( m_optionsToolBar, - EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); - m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ).Left().Layer(2) - .Caption( _( "Libraries" ) ).MinSize( 250, -1 ).BestSize( 250, -1 ) ); - m_auimgr.AddPane( m_drawToolBar, - EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) ); - m_auimgr.AddPane( m_infoBar, - EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) ); + m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ) + .Left().Layer( 3 ) ); + m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ) + .Left().Layer( 2 ) + .Caption( _( "Libraries" ) ) + .MinSize( 250, -1 ).BestSize( 250, -1 ) ); + m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ) + .Right().Layer( 2 ) ); - m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() ); + m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" ) + .CentrePane() ); - // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before - // hidding it. + // Call Update() to fix all pane default sizes. m_auimgr.Update(); - // We don't want the infobar displayed right away - m_auimgr.GetPane( "InfoBar" ).Hide(); - m_auimgr.Update(); + m_infoBar = new WX_INFOBAR( GetCanvas() ); if( m_settings->m_LibWidth > 0 ) { diff --git a/include/widgets/infobar.h b/include/widgets/infobar.h index 686b970bb1..2f2567096b 100644 --- a/include/widgets/infobar.h +++ b/include/widgets/infobar.h @@ -26,7 +26,6 @@ #include -class wxAuiManager; class wxHyperlinkCtrl; @@ -77,7 +76,7 @@ public: * @param aMgr is the AUI manager that this infobar is added to * @param aWinId is the ID for this infobar object */ - WX_INFOBAR( wxWindow* aParent, wxAuiManager* aMgr = nullptr, wxWindowID aWinid = wxID_ANY ); + WX_INFOBAR( wxWindow* aParent, wxWindowID aWinid = wxID_ANY ); ~WX_INFOBAR(); @@ -199,17 +198,12 @@ protected: */ void OnTimer( wxTimerEvent& aEvent ); - /** - * Update the AUI pane to show or hide this infobar. - * - * @param aShow is true to show the pane - */ - void UpdateAuiLayout( bool aShow ); + void onSize( wxSizeEvent& aEvent ); +protected: int m_showTime; ///< The time to show the infobar. 0 = don't auto hide bool m_updateLock; ///< True if this infobar requested the UI update wxTimer* m_showTimer; ///< The timer counting the autoclose period - wxAuiManager* m_auiManager; ///< The AUI manager that contains this infobar DECLARE_EVENT_TABLE() }; diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index 7ed7fee62e..dc3aa0425c 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -118,9 +118,6 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : ReCreateVToolbar(); ReCreateOptToolbar(); - // Create the infobar - m_infoBar = new WX_INFOBAR( this, &m_auimgr ); - wxWindow* stsbar = GetStatusBar(); int dims[] = { @@ -155,34 +152,33 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_propertiesPagelayout = new PROPERTIES_FRAME( this ); - // Horizontal items; layers 4 - 6 - m_auimgr.AddPane( m_mainToolBar, - EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); - m_auimgr.AddPane( m_optionsToolBar, - EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); - m_auimgr.AddPane( m_messagePanel, - EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); - m_auimgr.AddPane( m_infoBar, - EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) ); + // Rows; layers 4 - 6 + m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ) + .Top().Layer( 6 ) ); + m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ) + .Left().Layer( 3 ) ); + m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ) + .Bottom().Layer( 6 ) ); - // Vertical items; layers 1 - 3 - m_auimgr.AddPane( m_drawToolBar, - EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) ); + // Columns; layers 1 - 3 + m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ) + .Right().Layer( 2 ) ); - m_auimgr.AddPane( m_propertiesPagelayout, EDA_PANE().Palette().Name( "Props" ).Right().Layer(3) - .Caption( _( "Properties" ) ).MinSize( m_propertiesPagelayout->GetMinSize() ) + m_auimgr.AddPane( m_propertiesPagelayout, EDA_PANE().Palette().Name( "Props" ) + .Right().Layer( 3 ) + .Caption( _( "Properties" ) ) + .MinSize( m_propertiesPagelayout->GetMinSize() ) .BestSize( m_propertiesFrameWidth, -1 ) ); - m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); + // Center + m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ) + .Center() ); - // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before - // hidding it. + // Call Update() to fix all pane default sizes. m_auimgr.Update(); - // We don't want the infobar displayed right away - m_auimgr.GetPane( "InfoBar" ).Hide(); - m_auimgr.Update(); + m_infoBar = new WX_INFOBAR( GetCanvas() ); resolveCanvasType(); SwitchCanvas( m_canvasType ); diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index ac48f64996..14e1d9cdcb 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -197,44 +197,49 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, SetActiveLayer( F_SilkS ); - // Create the infobar - m_infoBar = new WX_INFOBAR( this, &m_auimgr ); - m_auimgr.SetManagedWindow( this ); unsigned int auiFlags = wxAUI_MGR_DEFAULT; #if !defined( _WIN32 ) - // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds of graphical glitches + // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds + // of graphical glitches auiFlags |= wxAUI_MGR_LIVE_RESIZE; #endif m_auimgr.SetFlags( auiFlags ); - // Horizontal items; layers 4 - 6 - m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer( 6 ) ); - m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer( 6 ) ); - m_auimgr.AddPane( m_infoBar, - EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) ); + // Rows; layers 4 - 6 + m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ) + .Top().Layer( 6 ) ); + m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ) + .Bottom().Layer( 6 ) ); - // Vertical items; layers 1 - 3 - m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer( 3 ) ); - m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(2) - .Caption( _( "Libraries" ) ).MinSize( 250, 400 ).Resizable() ); + // Columns; layers 1 - 3 + m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ) + .Left().Layer( 3 ) ); + m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" ) + .Left().Layer(2) + .Caption( _( "Libraries" ) ) + .MinSize( 250, 400 ).Resizable() ); - m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) ); + m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ) + .Right().Layer(2) ); - m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( "LayersManager" ).Right().Layer( 3 ) + m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( "LayersManager" ) + .Right().Layer( 3 ) .Caption( _( "Appearance" ) ).PaneBorder( false ) .MinSize( 180, -1 ).BestSize( 180, -1 ) ); - m_auimgr.AddPane( m_selectionFilterPanel, - EDA_PANE().Palette().Name( "SelectionFilter" ).Right().Layer( 3 ) - .Caption( _( "Selection Filter" ) ).PaneBorder( false ).Position( 2 ) + m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Palette().Name( "SelectionFilter" ) + .Right().Layer( 3 ).Position( 2 ) + .Caption( _( "Selection Filter" ) ).PaneBorder( false ) .MinSize( 160, -1 ).BestSize( m_selectionFilterPanel->GetBestSize() ) ); + // Center + m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ) + .Center() ); + // The selection filter doesn't need to grow in the vertical direction when docked m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0; - m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); - ActivateGalCanvas(); m_auimgr.GetArtProvider()->SetColour( wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR, @@ -242,13 +247,10 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, m_auimgr.GetArtProvider()->SetColour( wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR, wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) ); - // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before - // hidding it. + // Call Update() to fix all pane default sizes. m_auimgr.Update(); - // We don't want the infobar displayed right away - m_auimgr.GetPane( "InfoBar" ).Hide(); - m_auimgr.Update(); + m_infoBar = new WX_INFOBAR( GetCanvas() ); if( m_settings->m_LibWidth > 0 ) { diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 9afda10be7..8570b6fe29 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -221,9 +221,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this ); - // Create the infobar - m_infoBar = new WX_INFOBAR( this, &m_auimgr ); - m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas() ); m_auimgr.SetManagedWindow( this ); @@ -235,34 +232,34 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : #endif m_auimgr.SetFlags( auiFlags ); - // Horizontal items; layers 4 - 6 - m_auimgr.AddPane( m_mainToolBar, - EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); - m_auimgr.AddPane( m_auxiliaryToolBar, - EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top().Layer(5) ); - m_auimgr.AddPane( m_messagePanel, - EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); - m_auimgr.AddPane( m_infoBar, - EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) ); + // Rows; layers 4 - 6 + m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ) + .Top().Layer( 6 ) ); + m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( "AuxToolbar" ) + .Top().Layer( 5 ) ); + m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ) + .Bottom().Layer( 6 ) ); - // Vertical items; layers 1 - 3 - m_auimgr.AddPane( m_optionsToolBar, - EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); + // Columns; layers 1 - 3 + m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ) + .Left().Layer( 3 ) ); - m_auimgr.AddPane( m_drawToolBar, - EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(3) ); + m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ) + .Right().Layer( 3 ) ); - m_auimgr.AddPane( m_appearancePanel, - EDA_PANE().Name( "LayersManager" ).Right().Layer( 4 ) + m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( "LayersManager" ) + .Right().Layer( 4 ) .Caption( _( "Appearance" ) ).PaneBorder( false ) .MinSize( 180, -1 ).BestSize( 180, -1 ) ); - m_auimgr.AddPane( m_selectionFilterPanel, - EDA_PANE().Name( "SelectionFilter" ).Right().Layer( 4 ) - .Caption( _( "Selection Filter" ) ).PaneBorder( false ).Position( 2 ) + m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Name( "SelectionFilter" ) + .Right().Layer( 4 ).Position( 2 ) + .Caption( _( "Selection Filter" ) ).PaneBorder( false ) .MinSize( 180, -1 ).BestSize( 180, -1 ) ); - m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); + // Center + m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ) + .Center() ); m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools ); m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools ); @@ -275,10 +272,11 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_auimgr.GetArtProvider()->SetColour( wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR, wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) ); - // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before - // hidding it. + // Call Update() to fix all pane default sizes. m_auimgr.Update(); + m_infoBar = new WX_INFOBAR( GetCanvas() ); + if( PCBNEW_SETTINGS* settings = dynamic_cast( config() ) ) { if( settings->m_AuiPanels.right_panel_width > 0 ) @@ -300,10 +298,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_appearancePanel->SetTabIndex( settings->m_AuiPanels.appearance_panel_tab ); } - // We don't want the infobar displayed right away - m_auimgr.GetPane( "InfoBar" ).Hide(); - m_auimgr.Update(); - GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false ); // This is used temporarily to fix a client size issue on GTK that causes zoom to fit diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 69b6f1b371..7652d2d68f 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -762,7 +762,8 @@ int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia ) { WX_INFOBAR* infobar = frame()->GetInfoBar(); wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, - _( "Show board setup" ), wxEmptyString ); + _( "Show board setup" ), + wxEmptyString ); button->Bind( wxEVT_COMMAND_HYPERLINK, std::function( [&]( wxHyperlinkEvent& aEvent ) diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index 02e1dec102..d62b8f458f 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -2773,7 +2773,7 @@ void APPEARANCE_CONTROLS::onReadOnlySwatch() [&]( wxHyperlinkEvent& aEvent ) { wxCommandEvent dummy; - m_frame->OnPreferences( dummy ); + m_frame->OnPreferences( dummy ); } ) ); infobar->RemoveAllButtons();