Move eeschema find notification to the infobar and improve the infobar widget

* Move it to a panel along with the canvas to have a better UI
* Allow the infobar to automatically close after a set time

CHANGED: The eeschema find notifications now use the infobar instead of
a popup window
This commit is contained in:
Ian McInerney 2020-05-20 02:31:47 +01:00
parent 2bc57ade28
commit 73a1ce3e84
13 changed files with 226 additions and 62 deletions

View File

@ -196,6 +196,7 @@ set( COMMON_WIDGET_SRCS
widgets/grid_icon_text_helpers.cpp widgets/grid_icon_text_helpers.cpp
widgets/grid_text_button_helpers.cpp widgets/grid_text_button_helpers.cpp
widgets/indicator_icon.cpp widgets/indicator_icon.cpp
widgets/infobar.cpp
widgets/layer_box_selector.cpp widgets/layer_box_selector.cpp
widgets/lib_tree.cpp widgets/lib_tree.cpp
widgets/mathplot.cpp widgets/mathplot.cpp
@ -211,7 +212,6 @@ set( COMMON_WIDGET_SRCS
widgets/wx_busy_indicator.cpp widgets/wx_busy_indicator.cpp
widgets/wx_grid.cpp widgets/wx_grid.cpp
widgets/wx_angle_text.cpp widgets/wx_angle_text.cpp
widgets/wx_infobar.cpp
) )
set( COMMON_PAGE_LAYOUT_SRCS set( COMMON_PAGE_LAYOUT_SRCS

View File

@ -81,6 +81,7 @@ 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

@ -19,20 +19,28 @@
*/ */
#include <id.h> #include <id.h>
#include <widgets/wx_infobar.h> #include <widgets/infobar.h>
#include <wx/aui/framemanager.h> #include <wx/aui/framemanager.h>
#include <wx/debug.h>
#include <wx/infobar.h> #include <wx/infobar.h>
#include <wx/sizer.h>
#include <wx/timer.h>
BEGIN_EVENT_TABLE( WX_INFOBAR, wxInfoBarGeneric ) BEGIN_EVENT_TABLE( WX_INFOBAR, wxInfoBarGeneric )
EVT_BUTTON( ID_CLOSE_INFOBAR, WX_INFOBAR::OnCloseButton ) EVT_BUTTON( ID_CLOSE_INFOBAR, WX_INFOBAR::OnCloseButton )
EVT_TIMER( ID_CLOSE_INFOBAR, WX_INFOBAR::OnTimer )
END_EVENT_TABLE() END_EVENT_TABLE()
WX_INFOBAR::WX_INFOBAR( wxWindow* aParent, wxAuiManager *aMgr, wxWindowID aWinid ) WX_INFOBAR::WX_INFOBAR( wxWindow* aParent, wxAuiManager *aMgr, wxWindowID aWinid )
: wxInfoBarGeneric( aParent, aWinid ), : wxInfoBarGeneric( aParent, aWinid ),
m_showTime( 0 ),
m_showTimer( nullptr ),
m_auiManager( aMgr ) m_auiManager( aMgr )
{ {
m_showTimer = new wxTimer( this, ID_CLOSE_INFOBAR );
// On GTK, the infobar seems to start too small, so increase its height // On GTK, the infobar seems to start too small, so increase its height
#ifdef __WXGTK__ #ifdef __WXGTK__
int sx, sy; int sx, sy;
@ -42,33 +50,60 @@ WX_INFOBAR::WX_INFOBAR( wxWindow* aParent, wxAuiManager *aMgr, wxWindowID aWinid
} }
void WX_INFOBAR::SetShowTime( int aTime )
{
m_showTime = aTime;
}
void WX_INFOBAR::ShowMessageFor( const wxString& aMessage, int aTime, int aFlags )
{
m_showTime = aTime;
ShowMessage( aMessage, aFlags );
}
void WX_INFOBAR::ShowMessage( const wxString& aMessage, int aFlags ) void WX_INFOBAR::ShowMessage( const wxString& aMessage, int aFlags )
{ {
wxInfoBarGeneric::ShowMessage( aMessage, aFlags ); wxInfoBarGeneric::ShowMessage( aMessage, aFlags );
UpdateAuiLayout( true ); if( m_auiManager )
UpdateAuiLayout( true );
if( m_showTime > 0 )
m_showTimer->StartOnce( m_showTime );
Refresh();
Update();
} }
void WX_INFOBAR::Dismiss() void WX_INFOBAR::Dismiss()
{ {
wxInfoBarGeneric::Dismiss(); wxInfoBarGeneric::Dismiss();
UpdateAuiLayout( false );
if( m_auiManager )
UpdateAuiLayout( false );
} }
void WX_INFOBAR::UpdateAuiLayout( bool aShow ) void WX_INFOBAR::UpdateAuiLayout( bool aShow )
{ {
// Update the AUI pane that contains the infobar wxASSERT( m_auiManager );
if( 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 ) if( aShow )
m_auiManager->GetPane( this ).Show(); pane.Show();
else else
m_auiManager->GetPane( this ).Hide(); pane.Hide();
m_auiManager->Update();
} }
// Update the AUI manager regardless
m_auiManager->Update();
} }
@ -84,6 +119,8 @@ void WX_INFOBAR::AddButton( wxButton* aButton )
{ {
wxSizer* sizer = GetSizer(); wxSizer* sizer = GetSizer();
wxASSERT( aButton );
#ifdef __WXMAC__ #ifdef __WXMAC__
// Based on the code in the original class: // Based on the code in the original class:
// smaller buttons look better in the (narrow) info bar under OS X // smaller buttons look better in the (narrow) info bar under OS X
@ -130,7 +167,52 @@ void WX_INFOBAR::RemoveAllButtons()
} }
void WX_INFOBAR::OnCloseButton( wxCommandEvent& aEvt ) void WX_INFOBAR::OnCloseButton( wxCommandEvent& aEvent )
{ {
Dismiss(); Dismiss();
} }
void WX_INFOBAR::OnTimer( wxTimerEvent& aEvent )
{
// Reset and clear the timer
m_showTimer->Stop();
m_showTime = 0;
Dismiss();
}
EDA_INFOBAR_PANEL::EDA_INFOBAR_PANEL( wxWindow* aParent, wxWindowID aId, const wxPoint& aPos,
const wxSize& aSize, long aStyle, const wxString& aName )
: wxPanel( aParent, aId, aPos, aSize, aStyle, aName )
{
m_mainSizer = new wxFlexGridSizer( 1, 0, 0 );
m_mainSizer->SetFlexibleDirection( wxBOTH );
m_mainSizer->AddGrowableCol( 0, 1 );
SetSizer( m_mainSizer );
}
void EDA_INFOBAR_PANEL::AddInfoBar( WX_INFOBAR* aInfoBar )
{
wxASSERT( aInfoBar );
aInfoBar->Reparent( this );
m_mainSizer->Add( aInfoBar, 1, wxALIGN_TOP | wxEXPAND, 0 );
m_mainSizer->Layout();
}
void EDA_INFOBAR_PANEL::AddOtherItem( wxWindow* aOtherItem )
{
wxASSERT( aOtherItem );
aOtherItem->Reparent( this );
m_mainSizer->Add( aOtherItem, 1, wxALIGN_BOTTOM | wxEXPAND, 0 );
m_mainSizer->AddGrowableRow( 1, 1 );
m_mainSizer->Layout();
}

View File

@ -55,7 +55,7 @@
#include <tool/actions.h> #include <tool/actions.h>
#include <tools/sch_editor_control.h> #include <tools/sch_editor_control.h>
#include <netlist.h> #include <netlist.h>
#include <widgets/wx_infobar.h> #include <widgets/infobar.h>
bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName, bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName,
@ -499,6 +499,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
UpdateTitle(); UpdateTitle();
wxFileName fn = Prj().AbsolutePath( GetScreen()->GetFileName() ); wxFileName fn = Prj().AbsolutePath( GetScreen()->GetFileName() );
m_infoBar->Dismiss();
if( fn.FileExists() && !fn.IsFileWritable() ) if( fn.FileExists() && !fn.IsFileWritable() )
{ {

View File

@ -58,6 +58,7 @@
#include <tools/lib_edit_tool.h> #include <tools/lib_edit_tool.h>
#include <tools/lib_move_tool.h> #include <tools/lib_move_tool.h>
#include <tools/lib_pin_tool.h> #include <tools/lib_pin_tool.h>
#include <widgets/infobar.h>
#include <widgets/lib_tree.h> #include <widgets/lib_tree.h>
#include <widgets/symbol_tree_pane.h> #include <widgets/symbol_tree_pane.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
@ -148,6 +149,12 @@ 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
m_infoBar = new WX_INFOBAR( this );
m_canvasPanel = new EDA_INFOBAR_PANEL( this );
m_canvasPanel->AddInfoBar( m_infoBar );
m_canvasPanel->AddOtherItem( GetCanvas() );
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
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) );
@ -159,7 +166,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
.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(1) );
m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() ); m_auimgr.AddPane( m_canvasPanel, wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
m_auimgr.Update(); m_auimgr.Update();

View File

@ -69,7 +69,7 @@
#include <tools/sch_editor_control.h> #include <tools/sch_editor_control.h>
#include <tools/sch_line_wire_bus_tool.h> #include <tools/sch_line_wire_bus_tool.h>
#include <tools/sch_move_tool.h> #include <tools/sch_move_tool.h>
#include <widgets/wx_infobar.h> #include <widgets/infobar.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <wx/cmdline.h> #include <wx/cmdline.h>
@ -215,7 +215,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_AboutTitle = "Eeschema"; m_AboutTitle = "Eeschema";
m_findReplaceDialog = nullptr; m_findReplaceDialog = nullptr;
m_findReplaceStatusPopup = nullptr;
m_generateNetlistAndExit = false; m_generateNetlistAndExit = false;
m_netlistFilename = wxEmptyString; m_netlistFilename = wxEmptyString;
@ -240,7 +239,11 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
ReCreateVToolbar(); ReCreateVToolbar();
ReCreateOptToolbar(); ReCreateOptToolbar();
m_infoBar = new WX_INFOBAR( this, &m_auimgr ); // Create the infobar and the panel to hold it and the canvas
m_infoBar = new WX_INFOBAR( this );
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 );
@ -256,16 +259,11 @@ 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_infoBar, m_auimgr.AddPane( m_canvasPanel,
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) );
// 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 );
@ -527,11 +525,6 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
m_findStringHistoryList = m_findReplaceDialog->GetFindEntries(); m_findStringHistoryList = m_findReplaceDialog->GetFindEntries();
m_replaceStringHistoryList = m_findReplaceDialog->GetReplaceEntries(); m_replaceStringHistoryList = m_findReplaceDialog->GetReplaceEntries();
m_findReplaceStatusPopup->Destroy();
m_findReplaceStatusPopup = nullptr;
// Must destroy statusPopup first as it holds a pointer to the dialog
m_findReplaceDialog->Destroy(); m_findReplaceDialog->Destroy();
m_findReplaceDialog = nullptr; m_findReplaceDialog = nullptr;
} }
@ -678,11 +671,6 @@ void SCH_EDIT_FRAME::UpdateHierarchyNavigator( bool aForceUpdate )
void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace ) void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace )
{ {
if( m_findReplaceStatusPopup )
m_findReplaceStatusPopup->Destroy();
// Must destroy statusPopup first as it holds a pointer to the dialog
if( m_findReplaceDialog ) if( m_findReplaceDialog )
m_findReplaceDialog->Destroy(); m_findReplaceDialog->Destroy();
@ -692,25 +680,22 @@ void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace )
m_findReplaceDialog->SetFindEntries( m_findStringHistoryList ); m_findReplaceDialog->SetFindEntries( m_findStringHistoryList );
m_findReplaceDialog->SetReplaceEntries( m_replaceStringHistoryList ); m_findReplaceDialog->SetReplaceEntries( m_replaceStringHistoryList );
m_findReplaceDialog->Show( true ); m_findReplaceDialog->Show( true );
m_findReplaceStatusPopup = new STATUS_TEXT_POPUP( m_findReplaceDialog );
m_findReplaceStatusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
} }
void SCH_EDIT_FRAME::ShowFindReplaceStatus( const wxString& aMsg ) void SCH_EDIT_FRAME::ShowFindReplaceStatus( const wxString& aMsg, int aStatusTime )
{ {
wxPoint pos = wxGetMousePosition() - m_findReplaceStatusPopup->GetSize() - wxPoint( 10, 10 ); // Prepare the infobar, since we don't know its state
m_infoBar->RemoveAllButtons();
m_infoBar->AddCloseButton();
m_findReplaceStatusPopup->SetText( aMsg ); m_infoBar->ShowMessageFor( aMsg, aStatusTime, wxICON_INFORMATION );
m_findReplaceStatusPopup->Move( pos );
m_findReplaceStatusPopup->PopupFor( 3000 );
} }
void SCH_EDIT_FRAME::ClearFindReplaceStatus() void SCH_EDIT_FRAME::ClearFindReplaceStatus()
{ {
m_findReplaceStatusPopup->Hide(); m_infoBar->Dismiss();
} }
@ -719,11 +704,6 @@ void SCH_EDIT_FRAME::OnFindDialogClose()
m_findStringHistoryList = m_findReplaceDialog->GetFindEntries(); m_findStringHistoryList = m_findReplaceDialog->GetFindEntries();
m_replaceStringHistoryList = m_findReplaceDialog->GetReplaceEntries(); m_replaceStringHistoryList = m_findReplaceDialog->GetReplaceEntries();
m_findReplaceStatusPopup->Destroy();
m_findReplaceStatusPopup = nullptr;
// Must destroy statusPopup first as it holds a pointer to the dialog
m_findReplaceDialog->Destroy(); m_findReplaceDialog->Destroy();
m_findReplaceDialog = nullptr; m_findReplaceDialog = nullptr;
} }

View File

@ -135,7 +135,6 @@ private:
///< to call a custom net list generator. ///< to call a custom net list generator.
DIALOG_SCH_FIND* m_findReplaceDialog; DIALOG_SCH_FIND* m_findReplaceDialog;
STATUS_TEXT_POPUP* m_findReplaceStatusPopup;
wxString m_plotDirectoryName; wxString m_plotDirectoryName;
wxString m_netListFormat; wxString m_netListFormat;
@ -314,7 +313,7 @@ public:
*/ */
HIERARCHY_NAVIG_DLG* FindHierarchyNavigator(); HIERARCHY_NAVIG_DLG* FindHierarchyNavigator();
void ShowFindReplaceStatus( const wxString& aMsg ); void ShowFindReplaceStatus( const wxString& aMsg, int aStatusTime );
void ClearFindReplaceStatus(); void ClearFindReplaceStatus();
/** /**

View File

@ -40,6 +40,7 @@ class ACTION_TOOLBAR;
class COLOR_SETTINGS; class COLOR_SETTINGS;
class TOOL_MENU; class TOOL_MENU;
class APP_SETTINGS_BASE; class APP_SETTINGS_BASE;
class EDA_INFOBAR_PANEL;
class WX_INFOBAR; class WX_INFOBAR;
namespace KIGFX namespace KIGFX
@ -115,6 +116,7 @@ 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

@ -18,6 +18,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef INFOBAR_H_
#define INFOBAR_H_
#include <wx/infobar.h> #include <wx/infobar.h>
#include <wx/wx.h> #include <wx/wx.h>
@ -28,6 +31,7 @@ class wxAuiManager;
* A modified version of the wxInfoBar class that allows us to: * A modified version of the wxInfoBar class that allows us to:
* * Show the close button along with the other buttons * * Show the close button along with the other buttons
* * Remove all user-provided buttons at once * * Remove all user-provided buttons at once
* * Allow automaticly hiding the infobar after a time period
* *
* This inherits from the generic infobar because the native infobar * This inherits from the generic infobar because the native infobar
* on GTK doesn't include the icon on the left and it looks worse. * on GTK doesn't include the icon on the left and it looks worse.
@ -44,6 +48,17 @@ public:
*/ */
WX_INFOBAR( wxWindow* aParent, wxAuiManager* aMgr = nullptr, wxWindowID aWinid = wxID_ANY ); WX_INFOBAR( wxWindow* aParent, wxAuiManager* aMgr = nullptr, wxWindowID aWinid = wxID_ANY );
/**
* Set the time period to show the infobar.
*
* This only applies for the next showing of the infobar,
* so it must be reset every time. A value of 0 disables
* the automatic hiding (this is the default).
*
* @param aTime is the time in milliseconds to show the infobar
*/
void SetShowTime( int aTime );
/** /**
* Add the default close button to the infobar on the right side. * Add the default close button to the infobar on the right side.
* *
@ -73,6 +88,16 @@ public:
*/ */
void RemoveAllButtons(); void RemoveAllButtons();
/**
* Show the infobar with the provided message and icon for a specific period
* of time.
*
* @param aMessage is the message to display
* @param aTime is the amount of time to show the infobar
* @param aFlags is the flag containing the icon to display on the left side of the infobar
*/
void ShowMessageFor( const wxString& aMessage, int aTime, int aFlags = wxICON_INFORMATION );
/** /**
* Show the info bar with the provided message and icon. * Show the info bar with the provided message and icon.
* *
@ -92,7 +117,12 @@ protected:
* Event handler for the close button. * Event handler for the close button.
* This is bound to ID_CLOSE_INFOBAR on the infobar. * This is bound to ID_CLOSE_INFOBAR on the infobar.
*/ */
void OnCloseButton( wxCommandEvent& aEvt ); void OnCloseButton( wxCommandEvent& aEvent );
/**
* Event handler for the automatic closing timer.
*/
void OnTimer( wxTimerEvent& aEvent );
/** /**
* Update the AUI pane to show or hide this infobar. * Update the AUI pane to show or hide this infobar.
@ -101,7 +131,51 @@ protected:
*/ */
void UpdateAuiLayout( bool aShow ); void UpdateAuiLayout( bool aShow );
wxAuiManager* m_auiManager; int m_showTime; ///< The time to show the infobar. 0 = don't auto hide
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()
}; };
/**
* A wxPanel derived class that hold an infobar and another control.
* The infobar is located at the top of the panel, and the other control
* is located below it.
*
* This allows the infobar to be controlled nicely by an AUI manager,
* since adding the infobar on its own to the AUI manager produces
* artifacts when showing/hiding it due to the AUI pane layout.
*
*/
class EDA_INFOBAR_PANEL : public wxPanel
{
public:
EDA_INFOBAR_PANEL( wxWindow* aParent, wxWindowID aId = wxID_ANY,
const wxPoint& aPos = wxDefaultPosition,
const wxSize& aSize = wxSize( -1,-1 ),
long aStyle = wxTAB_TRAVERSAL,
const wxString& aName = wxEmptyString );
/**
* Add the given infobar object to the panel
*
* @param aInfoBar is the infobar to add
*/
void AddInfoBar( WX_INFOBAR* aInfoBar );
/**
* Add the other item to the panel.
* This item will expand to fill up the vertical space left.
*
* @param aOtherItem is the item to add
*/
void AddOtherItem( wxWindow* aOtherItem );
protected:
// The sizer containing the infobar and the other object
wxFlexGridSizer* m_mainSizer;
};
#endif // INFOBAR_H_

View File

@ -34,7 +34,7 @@
#include <pl_editor_frame.h> #include <pl_editor_frame.h>
#include <properties_frame.h> #include <properties_frame.h>
#include <pl_editor_id.h> #include <pl_editor_id.h>
#include <widgets/wx_infobar.h> #include <widgets/infobar.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
@ -231,6 +231,7 @@ bool PL_EDITOR_FRAME::LoadPageLayoutDescrFile( const wxString& aFullFileName )
GetScreen()->ClrModify(); GetScreen()->ClrModify();
wxFileName fn = aFullFileName; wxFileName fn = aFullFileName;
m_infoBar->Dismiss();
if( fn.FileExists() && !fn.IsFileWritable() ) if( fn.FileExists() && !fn.IsFileWritable() )
{ {

View File

@ -56,7 +56,7 @@
#include <tools/pl_point_editor.h> #include <tools/pl_point_editor.h>
#include <invoke_pl_editor_dialog.h> #include <invoke_pl_editor_dialog.h>
#include <tools/pl_editor_control.h> #include <tools/pl_editor_control.h>
#include <widgets/wx_infobar.h> #include <widgets/infobar.h>
BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME ) BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
EVT_CLOSE( PL_EDITOR_FRAME::OnCloseWindow ) EVT_CLOSE( PL_EDITOR_FRAME::OnCloseWindow )
@ -125,7 +125,17 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
ReCreateHToolbar(); ReCreateHToolbar();
ReCreateVToolbar(); ReCreateVToolbar();
m_infoBar = new WX_INFOBAR( this, &m_auimgr ); // TODO (ISM): Figure out why using the infobar panel doesn't work here (it works
// in the other frames) but using the AUI pane version does.
// 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

@ -65,6 +65,7 @@
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/zoom_tool.h> #include <tool/zoom_tool.h>
#include <tools/position_relative_tool.h> #include <tools/position_relative_tool.h>
#include <widgets/infobar.h>
#include <widgets/lib_tree.h> #include <widgets/lib_tree.h>
#include <widgets/paged_dialog.h> #include <widgets/paged_dialog.h>
#include <widgets/progress_reporter.h> #include <widgets/progress_reporter.h>
@ -196,6 +197,12 @@ 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
m_infoBar = new WX_INFOBAR( this );
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
@ -213,7 +220,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_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( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( m_canvasPanel, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
GetCanvas()->GetView()->SetScale( GetZoomLevelCoeff() / GetScreen()->GetZoom() ); GetCanvas()->GetView()->SetScale( GetZoomLevelCoeff() / GetScreen()->GetZoom() );
ActivateGalCanvas(); ActivateGalCanvas();

View File

@ -87,7 +87,7 @@
#include <netlist_reader/pcb_netlist.h> #include <netlist_reader/pcb_netlist.h>
#include <wx/wupdlock.h> #include <wx/wupdlock.h>
#include <dialog_drc.h> // for DIALOG_DRC_WINDOW_NAME definition #include <dialog_drc.h> // for DIALOG_DRC_WINDOW_NAME definition
#include <widgets/wx_infobar.h> #include <widgets/infobar.h>
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON) #if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
#include <python_scripting.h> #include <python_scripting.h>
@ -223,7 +223,11 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
ReCreateOptToolbar(); ReCreateOptToolbar();
ReCreateMicrowaveVToolbar(); ReCreateMicrowaveVToolbar();
m_infoBar = new WX_INFOBAR( this, &m_auimgr ); // Create the infobar and the panel to hold it and the canvas
m_infoBar = new WX_INFOBAR( this );
m_canvasPanel = new EDA_INFOBAR_PANEL( this );
m_canvasPanel->AddInfoBar( m_infoBar );
m_canvasPanel->AddOtherItem( GetCanvas() );
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
@ -234,8 +238,6 @@ 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,
@ -250,7 +252,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( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( m_canvasPanel, 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 );
@ -260,9 +262,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// because contents establish size // because contents establish size
syncLayerWidgetLayer(); syncLayerWidgetLayer();
// We don't want the infobar displayed right away
m_auimgr.GetPane( "InfoBar" ).Hide();
m_auimgr.Update(); 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 );
@ -714,6 +713,7 @@ void PCB_EDIT_FRAME::onBoardLoaded()
UpdateTitle(); UpdateTitle();
wxFileName fn = GetBoard()->GetFileName(); wxFileName fn = GetBoard()->GetFileName();
m_infoBar->Dismiss();
// Display a warning that the file is read only // Display a warning that the file is read only
if( fn.FileExists() && !fn.IsFileWritable() ) if( fn.FileExists() && !fn.IsFileWritable() )