Allow both aui-manager-based infobars and window overlay infobars.
This commit is contained in:
parent
7e7e2b940d
commit
47ea51ec34
|
@ -144,13 +144,12 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent, const wxSt
|
||||||
|
|
||||||
m_auimgr.SetManagedWindow( this );
|
m_auimgr.SetManagedWindow( this );
|
||||||
|
|
||||||
|
CreateInfoBar();
|
||||||
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_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
|
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
|
||||||
|
|
||||||
// Call Update() to fix all pane default sizes.
|
FinishAUIInitialization();
|
||||||
m_auimgr.Update();
|
|
||||||
|
|
||||||
m_infoBar = new WX_INFOBAR( m_canvas );
|
|
||||||
m_canvas->SetInfoBar( m_infoBar );
|
m_canvas->SetInfoBar( m_infoBar );
|
||||||
m_canvas->SetStatusBar( status_bar );
|
m_canvas->SetStatusBar( status_bar );
|
||||||
|
|
||||||
|
|
|
@ -683,6 +683,34 @@ void EDA_BASE_FRAME::PrintMsg( const wxString& text )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_BASE_FRAME::CreateInfoBar()
|
||||||
|
{
|
||||||
|
#if defined( __WXOSX_MAC__ )
|
||||||
|
m_infoBar = new WX_INFOBAR( GetToolCanvas() );
|
||||||
|
#else
|
||||||
|
m_infoBar = new WX_INFOBAR( this, m_auimgr );
|
||||||
|
|
||||||
|
m_auimgr.AddPane( m_infoBar, EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_BASE_FRAME::FinishAUIInitialization()
|
||||||
|
{
|
||||||
|
#if defined( __WXOSX_MAC__ )
|
||||||
|
m_auimgr.Update();
|
||||||
|
#else
|
||||||
|
// 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();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_BASE_FRAME::ShowInfoBarError( const wxString& aErrorMsg, bool aShowCloseButton )
|
void EDA_BASE_FRAME::ShowInfoBarError( const wxString& aErrorMsg, bool aShowCloseButton )
|
||||||
{
|
{
|
||||||
m_infoBar->RemoveAllButtons();
|
m_infoBar->RemoveAllButtons();
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <id.h>
|
#include <id.h>
|
||||||
#include <widgets/infobar.h>
|
#include <widgets/infobar.h>
|
||||||
#include "wx/artprov.h"
|
#include "wx/artprov.h"
|
||||||
|
#include <wx/aui/framemanager.h>
|
||||||
#include <wx/debug.h>
|
#include <wx/debug.h>
|
||||||
#include <wx/infobar.h>
|
#include <wx/infobar.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
|
@ -40,11 +41,12 @@ BEGIN_EVENT_TABLE( WX_INFOBAR, wxInfoBarGeneric )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
WX_INFOBAR::WX_INFOBAR( wxWindow* aParent, wxWindowID aWinid )
|
WX_INFOBAR::WX_INFOBAR( wxWindow* aParent, wxAuiManager* aMgr, wxWindowID aWinid )
|
||||||
: wxInfoBarGeneric( aParent, aWinid ),
|
: wxInfoBarGeneric( aParent, aWinid ),
|
||||||
m_showTime( 0 ),
|
m_showTime( 0 ),
|
||||||
m_updateLock( false ),
|
m_updateLock( false ),
|
||||||
m_showTimer( nullptr )
|
m_showTimer( nullptr ),
|
||||||
|
m_auiManager( aMgr )
|
||||||
{
|
{
|
||||||
m_showTimer = new wxTimer( this, ID_CLOSE_INFOBAR );
|
m_showTimer = new wxTimer( this, ID_CLOSE_INFOBAR );
|
||||||
|
|
||||||
|
@ -133,6 +135,9 @@ void WX_INFOBAR::ShowMessage( const wxString& aMessage, int aFlags )
|
||||||
|
|
||||||
wxInfoBarGeneric::ShowMessage( aMessage, aFlags );
|
wxInfoBarGeneric::ShowMessage( aMessage, aFlags );
|
||||||
|
|
||||||
|
if( m_auiManager )
|
||||||
|
updateAuiLayout( true );
|
||||||
|
|
||||||
if( m_showTime > 0 )
|
if( m_showTime > 0 )
|
||||||
m_showTimer->StartOnce( m_showTime );
|
m_showTimer->StartOnce( m_showTime );
|
||||||
|
|
||||||
|
@ -150,6 +155,9 @@ void WX_INFOBAR::Dismiss()
|
||||||
|
|
||||||
wxInfoBarGeneric::Dismiss();
|
wxInfoBarGeneric::Dismiss();
|
||||||
|
|
||||||
|
if( m_auiManager )
|
||||||
|
updateAuiLayout( false );
|
||||||
|
|
||||||
m_updateLock = false;
|
m_updateLock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,6 +174,26 @@ void WX_INFOBAR::onSize( wxSizeEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WX_INFOBAR::updateAuiLayout( bool aShow )
|
||||||
|
{
|
||||||
|
wxASSERT( m_auiManager );
|
||||||
|
|
||||||
|
wxAuiPaneInfo& pane = m_auiManager->GetPane( this );
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void WX_INFOBAR::AddButton( wxWindowID aId, const wxString& aLabel )
|
void WX_INFOBAR::AddButton( wxWindowID aId, const wxString& aLabel )
|
||||||
{
|
{
|
||||||
wxButton* button = new wxButton( this, aId, aLabel );
|
wxButton* button = new wxButton( this, aId, aLabel );
|
||||||
|
|
|
@ -129,6 +129,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
|
||||||
|
|
||||||
m_auimgr.SetManagedWindow( this );
|
m_auimgr.SetManagedWindow( this );
|
||||||
|
|
||||||
|
CreateInfoBar();
|
||||||
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
|
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
|
||||||
.Top().Layer( 6 ) );
|
.Top().Layer( 6 ) );
|
||||||
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
|
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
|
||||||
|
@ -138,10 +139,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
|
||||||
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
|
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
|
||||||
.Bottom().Layer( 6 ) );
|
.Bottom().Layer( 6 ) );
|
||||||
|
|
||||||
// Call Update() to fix all pane default sizes.
|
FinishAUIInitialization();
|
||||||
m_auimgr.Update();
|
|
||||||
|
|
||||||
m_infoBar = new WX_INFOBAR( GetCanvas() );
|
|
||||||
|
|
||||||
auto& galOpts = GetGalDisplayOptions();
|
auto& galOpts = GetGalDisplayOptions();
|
||||||
galOpts.m_axesEnabled = true;
|
galOpts.m_axesEnabled = true;
|
||||||
|
|
|
@ -249,6 +249,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
m_auimgr.SetManagedWindow( this );
|
m_auimgr.SetManagedWindow( this );
|
||||||
|
|
||||||
|
CreateInfoBar();
|
||||||
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
|
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
|
||||||
.Top().Layer( 6 ) );
|
.Top().Layer( 6 ) );
|
||||||
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
|
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
|
||||||
|
@ -260,10 +261,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
|
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
|
||||||
.Bottom().Layer( 6 ) );
|
.Bottom().Layer( 6 ) );
|
||||||
|
|
||||||
// Call Update() to fix all pane default sizes.
|
FinishAUIInitialization();
|
||||||
m_auimgr.Update();
|
|
||||||
|
|
||||||
m_infoBar = new WX_INFOBAR( GetCanvas() );
|
|
||||||
|
|
||||||
resolveCanvasType();
|
resolveCanvasType();
|
||||||
SwitchCanvas( m_canvasType );
|
SwitchCanvas( m_canvasType );
|
||||||
|
|
|
@ -148,6 +148,7 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
m_auimgr.SetManagedWindow( this );
|
m_auimgr.SetManagedWindow( this );
|
||||||
|
|
||||||
|
CreateInfoBar();
|
||||||
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
|
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
|
||||||
.Top().Layer( 6 ) );
|
.Top().Layer( 6 ) );
|
||||||
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
|
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
|
||||||
|
@ -165,10 +166,7 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" )
|
m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" )
|
||||||
.CentrePane() );
|
.CentrePane() );
|
||||||
|
|
||||||
// Call Update() to fix all pane default sizes.
|
FinishAUIInitialization();
|
||||||
m_auimgr.Update();
|
|
||||||
|
|
||||||
m_infoBar = new WX_INFOBAR( GetCanvas() );
|
|
||||||
|
|
||||||
if( m_settings->m_LibWidth > 0 )
|
if( m_settings->m_LibWidth > 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -205,6 +205,10 @@ public:
|
||||||
|
|
||||||
void PrintMsg( const wxString& text );
|
void PrintMsg( const wxString& text );
|
||||||
|
|
||||||
|
void CreateInfoBar();
|
||||||
|
|
||||||
|
void FinishAUIInitialization();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the #WX_INFOBAR that can be displayed on the top of the canvas.
|
* @return the #WX_INFOBAR that can be displayed on the top of the canvas.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
|
|
||||||
|
|
||||||
|
class wxAuiManager;
|
||||||
class wxHyperlinkCtrl;
|
class wxHyperlinkCtrl;
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ public:
|
||||||
* @param aMgr is the AUI manager that this infobar is added to
|
* @param aMgr is the AUI manager that this infobar is added to
|
||||||
* @param aWinId is the ID for this infobar object
|
* @param aWinId is the ID for this infobar object
|
||||||
*/
|
*/
|
||||||
WX_INFOBAR( wxWindow* aParent, wxWindowID aWinid = wxID_ANY );
|
WX_INFOBAR( wxWindow* aParent, wxAuiManager* aMgr = nullptr, wxWindowID aWinid = wxID_ANY );
|
||||||
|
|
||||||
~WX_INFOBAR();
|
~WX_INFOBAR();
|
||||||
|
|
||||||
|
@ -200,10 +201,18 @@ protected:
|
||||||
|
|
||||||
void onSize( wxSizeEvent& aEvent );
|
void onSize( wxSizeEvent& aEvent );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the AUI pane to show or hide this infobar.
|
||||||
|
*
|
||||||
|
* @param aShow is true to show the pane
|
||||||
|
*/
|
||||||
|
void updateAuiLayout( bool aShow );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_showTime; ///< The time to show the infobar. 0 = don't auto hide
|
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
|
bool m_updateLock; ///< True if this infobar requested the UI update
|
||||||
wxTimer* m_showTimer; ///< The timer counting the autoclose period
|
wxTimer* m_showTimer; ///< The timer counting the autoclose period
|
||||||
|
wxAuiManager* m_auiManager; ///< The AUI manager that contains this infobar
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
|
@ -150,6 +150,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
m_auimgr.SetManagedWindow( this );
|
m_auimgr.SetManagedWindow( this );
|
||||||
|
|
||||||
|
CreateInfoBar();
|
||||||
m_propertiesPagelayout = new PROPERTIES_FRAME( this );
|
m_propertiesPagelayout = new PROPERTIES_FRAME( this );
|
||||||
|
|
||||||
// Rows; layers 4 - 6
|
// Rows; layers 4 - 6
|
||||||
|
@ -174,11 +175,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" )
|
m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" )
|
||||||
.Center() );
|
.Center() );
|
||||||
|
|
||||||
|
FinishAUIInitialization();
|
||||||
// Call Update() to fix all pane default sizes.
|
|
||||||
m_auimgr.Update();
|
|
||||||
|
|
||||||
m_infoBar = new WX_INFOBAR( GetCanvas() );
|
|
||||||
|
|
||||||
resolveCanvasType();
|
resolveCanvasType();
|
||||||
SwitchCanvas( m_canvasType );
|
SwitchCanvas( m_canvasType );
|
||||||
|
|
|
@ -199,6 +199,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||||
|
|
||||||
m_auimgr.SetManagedWindow( this );
|
m_auimgr.SetManagedWindow( this );
|
||||||
|
|
||||||
|
CreateInfoBar();
|
||||||
|
|
||||||
unsigned int auiFlags = wxAUI_MGR_DEFAULT;
|
unsigned int auiFlags = wxAUI_MGR_DEFAULT;
|
||||||
#if !defined( _WIN32 )
|
#if !defined( _WIN32 )
|
||||||
// Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds
|
// Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds
|
||||||
|
@ -247,10 +249,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||||
m_auimgr.GetArtProvider()->SetColour( wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
|
m_auimgr.GetArtProvider()->SetColour( wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
|
||||||
wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
|
wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
|
||||||
|
|
||||||
// Call Update() to fix all pane default sizes.
|
FinishAUIInitialization();
|
||||||
m_auimgr.Update();
|
|
||||||
|
|
||||||
m_infoBar = new WX_INFOBAR( GetCanvas() );
|
|
||||||
|
|
||||||
if( m_settings->m_LibWidth > 0 )
|
if( m_settings->m_LibWidth > 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -225,6 +225,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
m_auimgr.SetManagedWindow( this );
|
m_auimgr.SetManagedWindow( this );
|
||||||
|
|
||||||
|
CreateInfoBar();
|
||||||
|
|
||||||
unsigned int auiFlags = wxAUI_MGR_DEFAULT;
|
unsigned int auiFlags = wxAUI_MGR_DEFAULT;
|
||||||
#if !defined( _WIN32 )
|
#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
|
||||||
|
@ -272,10 +274,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
m_auimgr.GetArtProvider()->SetColour( wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
|
m_auimgr.GetArtProvider()->SetColour( wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
|
||||||
wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
|
wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
|
||||||
|
|
||||||
// Call Update() to fix all pane default sizes.
|
FinishAUIInitialization();
|
||||||
m_auimgr.Update();
|
|
||||||
|
|
||||||
m_infoBar = new WX_INFOBAR( GetCanvas() );
|
|
||||||
|
|
||||||
if( PCBNEW_SETTINGS* settings = dynamic_cast<PCBNEW_SETTINGS*>( config() ) )
|
if( PCBNEW_SETTINGS* settings = dynamic_cast<PCBNEW_SETTINGS*>( config() ) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue