Commit 4f2921f3 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Pcbnew: footprint viewer wxAUI improvements.

* Make the tool bar dockable.
* Enable the overflow control in the tool bar in case the it does not fit in
  it's parent window.
* Fix some wxAuiPaneInfo usage issues.
* Remove unused wxAuiPaneInfo objects.
* Move perspective saving and loading into EDA_BASE_FRAME object in preparation
  for extending this to all frame windows.
parent 03a4f5c4
......@@ -56,6 +56,10 @@ const wxChar* traceAutoSave = wxT( "KicadAutoSave" );
/// Configuration file entry name for auto save interval.
static const wxChar* entryAutoSaveInterval = wxT( "AutoSaveInterval" );
/// Configuration file entry for wxAuiManger perspective.
static const wxChar* entryPerspective = wxT( "ModViewPerspective" );
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent,
ID_DRAWFRAME_TYPE aFrameType,
......@@ -213,6 +217,11 @@ void EDA_BASE_FRAME::LoadSettings()
if( maximized )
Maximize();
// Once this is fully implemented, wxAuiManager will be used to maintain the persistance of
// the main frame and all it's managed windows and all of the legacy frame persistence
// position code can be removed.
config->Read( m_FrameName + entryPerspective, &m_perspective );
}
......@@ -247,6 +256,11 @@ void EDA_BASE_FRAME::SaveSettings()
text = m_FrameName + entryAutoSaveInterval;
config->Write( text, m_autoSaveInterval );
}
// Once this is fully implemented, wxAuiManager will be used to maintain the persistance of
// the main frame and all it's managed windows and all of the legacy frame persistence
// position code can be removed.
config->Write( m_FrameName + entryPerspective, m_auimgr.SavePerspective() );
}
......
......@@ -136,6 +136,8 @@ protected:
/// The timer used to implement the auto save feature;
wxTimer* m_autoSaveTimer;
wxString m_perspective; ///< wxAuiManager perspective.
/**
* Function onAutoSaveTimer
* handles the auto save timer event.
......
......@@ -59,9 +59,6 @@
#define PREVIOUS_PART -1
static wxString entryPerspective( wxT( "ModViewPerspective" ) );
/**
* Save previous component library viewer state.
*/
......@@ -217,11 +214,13 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent,
m_auimgr.SetManagedWindow( this );
EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane();
EDA_PANEINFO vert;
vert.VerticalToolbarPane();
// Main toolbar is initially docked at the top of the main window and dockable on any side.
// The close button is disable because the footprint viewer has no main menu to re-enable it.
// The tool bar will only be dockable on the top or bottom of the main frame window. This is
// most likely due to the fact that the other windows are not dockable and are preventing the
// tool bar from docking on the right and left.
wxAuiPaneInfo toolbarPaneInfo;
toolbarPaneInfo.Name( wxT( "m_mainToolBar" ) ).ToolbarPane().Top().CloseButton( false );
EDA_PANEINFO info;
info.InfoToolbarPane();
......@@ -229,27 +228,25 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent,
EDA_PANEINFO mesg;
mesg.MessageToolbarPane();
// Manage main toolbar
m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
// Manage main toolbar, top pane
m_auimgr.AddPane( m_mainToolBar, toolbarPaneInfo );
// Manage the left window (list of libraries)
// Manage the list of libraries, left pane.
if( m_LibListWindow )
m_auimgr.AddPane( m_LibListWindow, wxAuiPaneInfo( info ).Name( wxT( "m_LibList" ) ).
Left().Row( 0 ) );
Left().Row( 1 ) );
// Manage the list of components)
// Manage the list of footprints, center pane.
m_auimgr.AddPane( m_FootprintListWindow,
wxAuiPaneInfo( info ).Name( wxT( "m_FootprintList" ) ).
Left().Row( 1 ) );
wxAuiPaneInfo( info ).Name( wxT( "m_FootprintList" ) ).Centre().Row( 1 ) );
// Manage the draw panel
// Manage the draw panel, right pane.
m_auimgr.AddPane( m_canvas,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).Centre().CloseButton( false ) );
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).Right().Row( 1 ).CloseButton( false ) );
// Manage the message panel
// Manage the message panel, bottom pane.
m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer( 10 ) );
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom() );
/* Now the minimum windows are fixed, set library list
* and component list of the previous values from last viewlib use
......@@ -547,8 +544,6 @@ void FOOTPRINT_VIEWER_FRAME::LoadSettings( )
wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );
cfg = wxGetApp().GetSettings();
cfg->Read( entryPerspective, &m_perspective );
}
......@@ -560,8 +555,6 @@ void FOOTPRINT_VIEWER_FRAME::SaveSettings()
wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );
cfg = wxGetApp().GetSettings();
cfg->Write( entryPerspective, m_auimgr.SavePerspective() );
}
......
......@@ -55,7 +55,6 @@ private:
// Flags
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
wxString m_configPath; // subpath for configuration
wxString m_perspective; // wxAuiManager perspective.
protected:
static wxString m_libraryName; // Current selected library
......
......@@ -44,10 +44,10 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
{
wxString msg;
if( m_mainToolBar == NULL )
if( m_mainToolBar == NULL )
{
m_mainToolBar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW );
// Set up toolbar
m_mainToolBar->AddTool( ID_MODVIEW_SELECT_LIB, wxEmptyString,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment