Move to the AUI version of the infobar

The sizer-based version had issues with the event processing
inside the GAL panel on Windows systems.

Fixes https://gitlab.com/kicad/code/kicad/issues/4501
This commit is contained in:
Ian McInerney 2020-05-21 18:22:12 +01:00
parent a02f4cc7e4
commit fca7ade81f
9 changed files with 58 additions and 41 deletions

View File

@ -81,7 +81,6 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_toolDispatcher = NULL; m_toolDispatcher = NULL;
m_messagePanel = NULL; m_messagePanel = NULL;
m_infoBar = nullptr; m_infoBar = nullptr;
m_canvasPanel = nullptr;
m_currentScreen = NULL; m_currentScreen = NULL;
m_showBorderAndTitleBlock = false; // true to display reference sheet. m_showBorderAndTitleBlock = false; // true to display reference sheet.
m_LastGridSizeId = 0; m_LastGridSizeId = 0;

View File

@ -149,11 +149,8 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
DisplayCmpDoc(); DisplayCmpDoc();
RebuildSymbolUnitsList(); RebuildSymbolUnitsList();
// Create the infobar and the panel to hold it and the canvas // Create the infobar
m_infoBar = new WX_INFOBAR( this ); m_infoBar = new WX_INFOBAR( this, &m_auimgr );
m_canvasPanel = new EDA_INFOBAR_PANEL( this );
m_canvasPanel->AddInfoBar( m_infoBar );
m_canvasPanel->AddOtherItem( GetCanvas() );
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
@ -161,13 +158,21 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().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_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ).Left().Layer(1) m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ).Left().Layer(2)
.Caption( _( "Libraries" ) ).MinSize( 250, -1 ) .Caption( _( "Libraries" ) ).MinSize( 250, -1 )
.BestSize( m_settings->m_LibWidth, -1 ).Resizable() ); .BestSize( m_settings->m_LibWidth, -1 ).Resizable() );
m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(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_canvasPanel, 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.
m_auimgr.Update();
// We don't want the infobar displayed right away
m_auimgr.GetPane( "InfoBar" ).Hide();
m_auimgr.Update(); m_auimgr.Update();
GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId ); GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId );

View File

@ -241,11 +241,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
ReCreateVToolbar(); ReCreateVToolbar();
ReCreateOptToolbar(); ReCreateOptToolbar();
// Create the infobar and the panel to hold it and the canvas // Create the infobar
m_infoBar = new WX_INFOBAR( this ); m_infoBar = new WX_INFOBAR( this, &m_auimgr );
m_canvasPanel = new EDA_INFOBAR_PANEL( this );
m_canvasPanel->AddInfoBar( m_infoBar );
m_canvasPanel->AddOtherItem( GetCanvas() );
// Initialize common print setup dialog settings. // Initialize common print setup dialog settings.
m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER ); m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
@ -261,11 +258,19 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
m_auimgr.AddPane( m_drawToolBar, m_auimgr.AddPane( m_drawToolBar,
EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) ); EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) );
m_auimgr.AddPane( m_canvasPanel, m_auimgr.AddPane( m_infoBar,
EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) );
m_auimgr.AddPane( GetCanvas(),
EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
m_auimgr.AddPane( m_messagePanel, m_auimgr.AddPane( m_messagePanel,
EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
// Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
// hidding it.
m_auimgr.Update();
// We don't want the infobar displayed right away
m_auimgr.GetPane( "InfoBar" ).Hide();
m_auimgr.Update(); m_auimgr.Update();
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true ); GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true );

View File

@ -625,6 +625,8 @@ public:
CaptionVisible( false ); CaptionVisible( false );
Movable( false ); Movable( false );
Resizable( true ); Resizable( true );
PaneBorder( false );
DockFixed( true );
return *this; return *this;
} }
}; };

View File

@ -116,7 +116,6 @@ protected:
int m_MsgFrameHeight; int m_MsgFrameHeight;
WX_INFOBAR* m_infoBar; WX_INFOBAR* m_infoBar;
EDA_INFOBAR_PANEL* m_canvasPanel; // The panel that holds the canvas and infobar
COLOR_SETTINGS* m_colorSettings; COLOR_SETTINGS* m_colorSettings;

View File

@ -148,6 +148,10 @@ protected:
* since adding the infobar on its own to the AUI manager produces * since adding the infobar on its own to the AUI manager produces
* artifacts when showing/hiding it due to the AUI pane layout. * artifacts when showing/hiding it due to the AUI pane layout.
* *
* Note that this implementation currently has issues on Windows with
* event processing inside the GAL canvas, see:
* https://gitlab.com/kicad/code/kicad/-/issues/4501
*
*/ */
class EDA_INFOBAR_PANEL : public wxPanel class EDA_INFOBAR_PANEL : public wxPanel
{ {

View File

@ -125,17 +125,8 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
ReCreateHToolbar(); ReCreateHToolbar();
ReCreateVToolbar(); ReCreateVToolbar();
// TODO (ISM): Figure out why using the infobar panel doesn't work here (it works // Create the infobar
// in the other frames) but using the AUI pane version does. m_infoBar = new WX_INFOBAR( this, &m_auimgr );
// When the panel is used, the infobar isn't shown until the window is resized
// (but the sizer has a space for it), and the sizer space doesn't disappear
// when it is dismissed until the window is resized.
// Create the infobar and the panel to hold it and the canvas
m_infoBar = new WX_INFOBAR( this, &m_auimgr );
//m_canvasPanel = new EDA_INFOBAR_PANEL( this );
//m_canvasPanel->AddInfoBar( m_infoBar );
//m_canvasPanel->AddOtherItem( GetCanvas() );
wxWindow* stsbar = GetStatusBar(); wxWindow* stsbar = GetStatusBar();
int dims[] = { int dims[] = {

View File

@ -197,35 +197,41 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_Layers->SelectLayer( F_SilkS ); m_Layers->SelectLayer( F_SilkS );
m_Layers->OnLayerSelected(); m_Layers->OnLayerSelected();
// Create the infobar and the panel to hold it and the canvas // Create the infobar
m_infoBar = new WX_INFOBAR( this ); m_infoBar = new WX_INFOBAR( this, &m_auimgr );
m_canvasPanel = new EDA_INFOBAR_PANEL( this );
m_canvasPanel->AddInfoBar( m_infoBar );
m_canvasPanel->AddOtherItem( GetCanvas() );
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
// Horizontal items; layers 4 - 6 // Horizontal items; layers 4 - 6
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().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_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
m_auimgr.AddPane( m_infoBar,
EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) );
// Vertical items; layers 1 - 3 // Vertical items; layers 1 - 3
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(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(1) m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(2)
.Caption( _( "Libraries" ) ).MinSize( 250, 400 ) .Caption( _( "Libraries" ) ).MinSize( 250, 400 )
.BestSize( m_defaultLibWidth, -1 ) ); .BestSize( m_defaultLibWidth, -1 ) );
m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) ); m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) );
m_auimgr.AddPane( m_Layers, EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(3) m_auimgr.AddPane( m_Layers, EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(3)
.Caption( _( "Layers Manager" ) ).PaneBorder( false ) .Caption( _( "Layers Manager" ) ).PaneBorder( false )
.MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ) ); .MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ) );
m_auimgr.AddPane( m_canvasPanel, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
GetCanvas()->GetView()->SetScale( GetZoomLevelCoeff() / GetScreen()->GetZoom() ); GetCanvas()->GetView()->SetScale( GetZoomLevelCoeff() / GetScreen()->GetZoom() );
ActivateGalCanvas(); ActivateGalCanvas();
// Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
// hidding it.
m_auimgr.Update(); m_auimgr.Update();
// We don't want the infobar displayed right away
m_auimgr.GetPane( "InfoBar" ).Hide();
m_auimgr.Update();
GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId ); GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId );
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false ); GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false );
updateTitle(); updateTitle();

View File

@ -223,11 +223,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
ReCreateOptToolbar(); ReCreateOptToolbar();
ReCreateMicrowaveVToolbar(); ReCreateMicrowaveVToolbar();
// Create the infobar and the panel to hold it and the canvas // Create the infobar
m_infoBar = new WX_INFOBAR( this ); m_infoBar = new WX_INFOBAR( this, &m_auimgr );
m_canvasPanel = new EDA_INFOBAR_PANEL( this );
m_canvasPanel->AddInfoBar( m_infoBar );
m_canvasPanel->AddOtherItem( GetCanvas() );
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
@ -238,6 +235,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top().Layer(5) ); EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top().Layer(5) );
m_auimgr.AddPane( m_messagePanel, m_auimgr.AddPane( m_messagePanel,
EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
m_auimgr.AddPane( m_infoBar,
EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) );
// Vertical items; layers 1 - 3 // Vertical items; layers 1 - 3
m_auimgr.AddPane( m_optionsToolBar, m_auimgr.AddPane( m_optionsToolBar,
@ -252,7 +251,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
.Caption( _( "Layers Manager" ) ).PaneBorder( false ) .Caption( _( "Layers Manager" ) ).PaneBorder( false )
.MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ) ); .MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ) );
m_auimgr.AddPane( m_canvasPanel, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools ); m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools ); m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools );
@ -262,7 +261,14 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// because contents establish size // because contents establish size
syncLayerWidgetLayer(); syncLayerWidgetLayer();
// Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
// hidding it.
m_auimgr.Update(); m_auimgr.Update();
// We don't want the infobar displayed right away
m_auimgr.GetPane( "InfoBar" ).Hide();
m_auimgr.Update();
GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId ); GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId );
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false ); GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false );