Commit bd19d310 authored by Hauptmech's avatar Hauptmech Committed by Wayne Stambaugh

Hauptmech's centralized wxAuiPaneInfo patch.

parent ae84ca2f
......@@ -72,18 +72,9 @@ EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title, long
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
wxAuiPaneInfo vert( horiz );
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane();
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
......
......@@ -82,18 +82,17 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
wxAuiPaneInfo vert( horiz );
EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane();
EDA_PANEINFO vert;
vert.VerticalToolbarPane();
EDA_PANEINFO mesg;
mesg.MessageToolbarPane();
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). Row( 0 ) );
......@@ -106,7 +105,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
wxAuiPaneInfo().Name( wxT( "DisplayFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
......
......@@ -135,15 +135,13 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
horiz.LeftDockable( false ).RightDockable( false );
EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane();
EDA_PANEINFO info;
info.InfoToolbarPane();
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
......@@ -155,7 +153,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
if( m_FootprintList )
m_auimgr.AddPane( m_FootprintList,
wxAuiPaneInfo( horiz ).Name( wxT( "m_FootprintList" ) ).
wxAuiPaneInfo( info ).Name( wxT( "m_FootprintList" ) ).
Right().BestSize( (int) ( m_FrameSize.x * 0.36 ), m_FrameSize.y ) );
m_auimgr.Update();
......
......@@ -217,18 +217,17 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
wxAuiPaneInfo vert( horiz );
EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane();
EDA_PANEINFO vert;
vert.VerticalToolbarPane();
EDA_PANEINFO mesg;
mesg.MessageToolbarPane();
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
......@@ -243,7 +242,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
m_auimgr.Update();
......
......@@ -209,18 +209,16 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane();
EDA_PANEINFO vert;
vert.VerticalToolbarPane();
EDA_PANEINFO mesg;
mesg.MessageToolbarPane();
wxAuiPaneInfo vert( horiz );
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
......@@ -237,7 +235,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
m_auimgr.AddPane( DrawPanel, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel )
m_auimgr.AddPane( MsgPanel, wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.AddPane( MsgPanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().
Layer(10) );
m_auimgr.Update();
......
......@@ -174,18 +174,19 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
wxAuiPaneInfo vert( horiz );
EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane();
EDA_PANEINFO vert;
vert.VerticalToolbarPane();
EDA_PANEINFO info;
info.InfoToolbarPane();
EDA_PANEINFO mesg;
mesg.MessageToolbarPane();
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
// Manage main toolbal
m_auimgr.AddPane( m_HToolBar,
......@@ -195,21 +196,21 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
// Manage the left window (list of libraries)
if( m_LibListWindow )
m_auimgr.AddPane( m_LibListWindow, wxAuiPaneInfo( vert ).Name( wxT( "m_LibList" ) ).
Left().Row( 0 ).MinSize( minsize ) );
m_auimgr.AddPane( m_LibListWindow, wxAuiPaneInfo( info ).Name( wxT( "m_LibList" ) ).
Left().Row( 0 ));
// Manage the list of components)
m_auimgr.AddPane( m_CmpListWindow,
wxAuiPaneInfo( vert ).Name( wxT( "m_CmpList" ) ).
Left().Row( 1 ).MinSize( minsize ) );
wxAuiPaneInfo( info ).Name( wxT( "m_CmpList" ) ).
Left().Row( 1 ) );
// Manage the draw panel
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo( vert ).Name( wxT( "DrawFrame" ) ).Centre() );
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).Centre() );
// Manage the message panel
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
/* Now the minimum windows are fixed, set library list
and component list of the previous values from last viewlib use
......
......@@ -82,24 +82,21 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
wxAuiPaneInfo vert( horiz );
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
// LAYER_WIDGET is floatable, but initially docked at far right
wxAuiPaneInfo lyrs;
lyrs.CloseButton( false );
EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane();
EDA_PANEINFO vert;
vert.VerticalToolbarPane();
EDA_PANEINFO mesg;
mesg.MessageToolbarPane();
EDA_PANEINFO lyrs;
lyrs.LayersToolbarPane();
lyrs.MinSize( m_LayersManager->GetBestSize() );
lyrs.BestSize( m_LayersManager->GetBestSize() );
lyrs.Caption( _( "Visibles" ) );
lyrs.IsFloatable();
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
......@@ -110,7 +107,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Row( 1 ) );
m_auimgr.AddPane( m_LayersManager,
lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Row( 0 ) );
lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 0 ) );
if( m_OptionsToolBar )
m_auimgr.AddPane( m_OptionsToolBar,
......@@ -122,7 +119,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
if( MsgPanel )
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
ReFillLayerWidget(); // this is near end because contents establish size
m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
......
......@@ -911,4 +911,111 @@ static inline void AddMenuItem( wxMenu* aMenu,
# define SET_BITMAP( aImage ) item->SetBitmap( aImage )
#endif
/**
* Specialization of the wxAuiPaneInfo class for Kicad panels.
*
* Documentation for wxAui is poor at this time. The following notes spring from errors made in
* previous kicad implementations:
*
* wxAuiPaneInfo.ToolbarPane() and .Defaults() are used to clear and then prepare the objects so
* only use them once at the beginning of configuration..
*
* Panels are organized in layers, from 0 (close to the center) and increasing outward. Note
* that for ToolbarPanes, layer 0 considered a special default value, and ToolbarPanes on
* layer 0 are pushed to layer 10 automatically. Use Layer 1 for the inner layer as a work-
* around.
*
* Each panel has rows, starting at 0. Each row has positions starting at 0. Each item in a panel
* can have it's row and position set.
*
* Eventually panels will be moveable. Each initialization function sets up the panel for this,
* then after a //==// break has additional calls to anchor toolbars in a way that matches
* present functionality.
*/
class EDA_PANEINFO : public wxAuiPaneInfo
{
public:
/**
* Function HorizontalToolbarPane
* Change *this to a horizontal toolbar for kicad.
*/
EDA_PANEINFO& HorizontalToolbarPane()
{
ToolbarPane();
CloseButton( false );
LeftDockable( false );
RightDockable( false );
//==================== Remove calls below here for moveable toolbars //
Gripper( false );
DockFixed( true );
Movable( false );
Resizable( true );
return *this;
}
/**
* Function VerticalToolbarPane
* Change *this to a vertical toolbar for kicad.
*/
EDA_PANEINFO& VerticalToolbarPane()
{
ToolbarPane();
CloseButton( false );
TopDockable( false );
BottomDockable( false );
//==================== Remove calls below here for moveable toolbars //
Gripper( false );
DockFixed( true );
Movable( false );
Resizable( true );
return *this;
}
/**
* Function MessageToolbarPane
* Change *this to a message pane for kicad.
*
*/
EDA_PANEINFO& MessageToolbarPane()
{
Gripper( false );
DockFixed( true );
Movable( false );
Floatable( false );
CloseButton( false );
CaptionVisible( false );
return *this;
}
/**
* Function LayersToolbarPane
* Change *this to a layers toolbar for kicad.
*/
EDA_PANEINFO& LayersToolbarPane()
{
CloseButton( false );
return *this;
}
/**
* Function InfoToolbarPane
* Change *this to a information panel for for kicad.
*
* Info panes are used for vertical display of information next to the center pane.
* Used in cvpcb and libviewer primarily
*/
EDA_PANEINFO& InfoToolbarPane()
{
Gripper( false );
CloseButton( false );
CaptionVisible( false );
return *this;
}
};
#endif /* WXSTRUCT_H */
......@@ -68,15 +68,11 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
horiz.LeftDockable( false );
horiz.RightDockable( false );
EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane();
EDA_PANEINFO info;
info.InfoToolbarPane();
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
......@@ -88,9 +84,10 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
if( m_LeftWin )
m_auimgr.AddPane( m_LeftWin,
wxAuiPaneInfo().Name( wxT( "m_LeftWin" ) ).Floatable( false ).
CloseButton( false ).Left().BestSize( m_LeftWin_Width, clientsize.y ).
Layer( 1 ).CaptionVisible( false ) );
wxAuiPaneInfo(info).Name( wxT( "m_LeftWin" ) ).Left().
BestSize( m_LeftWin_Width, clientsize.y ).
Layer( 1 ) );
m_auimgr.Update();
}
......
......@@ -155,18 +155,14 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane();
wxAuiPaneInfo vert( horiz );
EDA_PANEINFO vert;
vert.VerticalToolbarPane();
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
EDA_PANEINFO mesg_pane;
mesg_pane.MessageToolbarPane();
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). Row( 0 ) );
......@@ -184,7 +180,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
wxAuiPaneInfo( mesg_pane ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
m_auimgr.Update();
}
......
......@@ -333,66 +333,51 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_auimgr.SetManagedWindow( this );
// Create a wxAuiPaneInfo template for other wxAuiPaneInfo items
// Actual wxAuiPaneInfo items will be built from this item.
wxAuiPaneInfo horiz;
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
// Create a second template from the first:
wxAuiPaneInfo vert( horiz );
// Set specific options for horizontal and vertical toolbars, using horiz and vert
// wxAuiPaneInfo items to manage them.
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
// Create a template from the horiz wxAuiPaneInfo, specific to horizontal toolbars:
wxAuiPaneInfo horiz_tb( horiz );
horiz_tb.ToolbarPane().Gripper( false );
EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane();
EDA_PANEINFO vert;
vert.VerticalToolbarPane();
EDA_PANEINFO mesg;
mesg.MessageToolbarPane();
// Create a wxAuiPaneInfo for the Layers Manager, not derived from the template.
// LAYER_WIDGET is floatable, but initially docked at far right
wxAuiPaneInfo lyrs;
EDA_PANEINFO lyrs;
lyrs.LayersToolbarPane();
lyrs.MinSize( m_Layers->GetBestSize() ); // updated in ReFillLayerWidget
lyrs.BestSize( m_Layers->GetBestSize() );
lyrs.CloseButton( false );
lyrs.Caption( _( "Visibles" ) );
lyrs.IsFloatable();
if( m_HToolBar ) // The main horizontal toolbar
{
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz_tb ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
}
if( m_AuxiliaryToolBar ) // the auxiliary horizontal toolbar, that shows track and via sizes, zoom ...)
{
m_auimgr.AddPane( m_AuxiliaryToolBar,
wxAuiPaneInfo( horiz_tb ).Name( wxT( "m_AuxiliaryToolBar" ) ).Top().Row( 1 ) );
wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).Top().Row( 1 ) );
}
if( m_AuxVToolBar ) // The auxiliary vertical toolbar (currently microwave tools)
m_auimgr.AddPane( m_AuxVToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_AuxVToolBar" ) ).Right().Row( 2 ).Hide() );
wxAuiPaneInfo( vert ).Name( wxT( "m_AuxVToolBar" ) ).Right().Layer( 1 ).Position(1).Hide() );
if( m_VToolBar ) // The main right vertical toolbar
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Row( 1 ) );
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Layer( 1 ) );
// Add the layer manager (right side of pcbframe)
m_auimgr.AddPane( m_Layers, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Row( 0 ) );
m_auimgr.AddPane( m_Layers, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 2 ) );
if( m_OptionsToolBar ) // The left vertical toolbar
{
m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left()
.ToolbarPane().Gripper( false ) );
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left().Layer(1) );
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_auimgr.GetPane( wxT( "m_AuxVToolBar" ) ).Show( m_show_microwave_tools );
......@@ -404,7 +389,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
if( MsgPanel )
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
ReFillLayerWidget(); // this is near end because contents establish size
m_Layers->ReFillRender(); // Update colors in Render after the config is read
......
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