diff --git a/3d-viewer/3d_frame.cpp b/3d-viewer/3d_frame.cpp index 1add311005..5466786d3b 100644 --- a/3d-viewer/3d_frame.cpp +++ b/3d-viewer/3d_frame.cpp @@ -23,6 +23,7 @@ #include "trackball.h" #include +#include Info_3D_Visu g_Parm_3D_Visu; double g_Draw3d_dx; @@ -79,6 +80,30 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, // Make a Pcb3D_GLCanvas m_Canvas = new Pcb3D_GLCanvas( this ); +#if KICAD_AUIMANAGER + 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); + + m_auimgr.AddPane(m_HToolBar, + wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top()); + + m_auimgr.AddPane(m_Canvas, + wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane()); + + m_auimgr.Update(); +#endif } @@ -127,7 +152,7 @@ void WinEDA3D_DrawFrame::GetSettings() config->Read( wxT( "BgColor_Blue" ), &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 ); } -#ifdef __WXMAC__ +#if defined( __WXMAC__ ) && !defined( __WXOSX_COCOA__ ) // for macOSX, the window must be below system (macOSX) toolbar if( m_FramePos.y < GetMBarHeight() ) diff --git a/3d-viewer/3d_toolbar.cpp b/3d-viewer/3d_toolbar.cpp index beba8758df..902af190a5 100644 --- a/3d-viewer/3d_toolbar.cpp +++ b/3d-viewer/3d_toolbar.cpp @@ -21,9 +21,9 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar() m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); - - SetToolBar( m_HToolBar ); - +#if !KICAD_AUIMANAGER + SetToolBar( (wxToolBar*)m_HToolBar ); +#endif // Set up toolbar m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString, wxBitmap( import3d_xpm ), diff --git a/3d-viewer/3d_viewer.h b/3d-viewer/3d_viewer.h index 590afdeb36..14f0fe1805 100644 --- a/3d-viewer/3d_viewer.h +++ b/3d-viewer/3d_viewer.h @@ -138,7 +138,6 @@ private: #if wxCHECK_VERSION( 2, 9, 0 ) wxGLContext* m_glRC; #endif - public: Pcb3D_GLCanvas( WinEDA3D_DrawFrame *parent ); ~Pcb3D_GLCanvas(); @@ -178,12 +177,16 @@ class WinEDA3D_DrawFrame: public wxFrame public: WinEDA_BasePcbFrame * m_Parent; Pcb3D_GLCanvas * m_Canvas; - wxToolBar * m_HToolBar; - wxToolBar * m_VToolBar; + WinEDA_Toolbar * m_HToolBar; + WinEDA_Toolbar * m_VToolBar; int m_InternalUnits; wxPoint m_FramePos; wxSize m_FrameSize; +#if KICAD_AUIMANAGER + wxAuiManager m_auimgr; + ~WinEDA3D_DrawFrame() { m_auimgr.UnInit(); }; +#endif private: wxString m_FrameName; // name used for writting and reading setup // It is "Frame3D" diff --git a/common/basicframe.cpp b/common/basicframe.cpp index 8f57bd78c0..38ffa57663 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -54,6 +54,7 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, * zone utilisateur de la fenetre principale */ m_FramePos.x = m_FramePos.y = 0; m_FrameSize.y -= m_MsgFrameHeight; + } @@ -114,7 +115,7 @@ void WinEDA_BasicFrame::LoadSettings() } // Ensure Window title bar is visible -#ifdef __WXMAC__ +#if defined( __WXMAC__ ) && !defined( __WXOSX_COCOA__ ) // for macOSX, the window must be below system (macOSX) toolbar Ypos_min = GetMBarHeight(); diff --git a/common/drawframe.cpp b/common/drawframe.cpp index f8dfbaaba9..8b3fae6a48 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -116,6 +116,9 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame() { if( m_CurrentScreen != NULL ) delete m_CurrentScreen; +#if KICAD_AUIMANAGER + m_auimgr.UnInit(); +#endif } @@ -322,6 +325,10 @@ void WinEDA_DrawFrame::SetToolbars() /***************************************/ { DisplayUnitsMsg(); +#if KICAD_AUIMANAGER +if(m_auimgr.GetManagedWindow()) + m_auimgr.Update(); +#endif } @@ -391,6 +398,7 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv ) m_FrameSize = size; size.y -= m_MsgFrameHeight; +#if !KICAD_AUIMANAGER if( MsgPanel ) // Positionnement en bas d'ecran { MsgPanel->SetSize( 0, size.y, size.x, m_MsgFrameHeight ); @@ -446,7 +454,7 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv ) size.y - opt_size.y - 1 ); DrawPanel->Move( opt_size.x, opt_size.y + Auxtoolbar_size.y + 1 ); } - +#endif SizeEv.Skip(); } diff --git a/common/toolbars.cpp b/common/toolbars.cpp index c9e14d6163..13027abc99 100644 --- a/common/toolbars.cpp +++ b/common/toolbars.cpp @@ -15,8 +15,13 @@ WinEDA_Toolbar::WinEDA_Toolbar( id_toolbar type, wxWindow * parent, wxWindowID id, bool horizontal ): +#if KICAD_AUITOOLBAR + wxAuiToolBar( parent, id, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | (horizontal ? wxAUI_TB_HORZ_LAYOUT : wxAUI_TB_VERTICAL)) +#else wxToolBar( parent, id, wxPoint( -1,-1 ), wxSize( -1,-1 ), horizontal ? wxTB_HORIZONTAL : wxTB_VERTICAL ) +#endif { m_Parent = parent; Pnext = NULL; diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index 696b20d020..5a6ad6ed5c 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -181,6 +181,33 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) : // Framesize and position SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); +#if KICAD_AUIMANAGER + 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); + + m_auimgr.AddPane(m_HToolBar, + wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top()); + + m_auimgr.AddPane(m_FootprintList, + wxAuiPaneInfo(horiz).Name(wxT("m_FootprintList")).Left().BestSize(m_FrameSize.x * 0.3 ,m_FrameSize.y * 0.9)); + + m_auimgr.AddPane(m_ListCmp, + wxAuiPaneInfo().Name(wxT("m_ListCmp")).CentrePane()); + + m_auimgr.Update(); +#endif } @@ -196,6 +223,10 @@ WinEDA_CvpcbFrame::~WinEDA_CvpcbFrame() ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ); config->Write( wxT( FILTERFOOTPRINTKEY ), state ); } + +#if KICAD_AUIMANAGER + m_auimgr.UnInit(); +#endif } diff --git a/cvpcb/displayframe.cpp b/cvpcb/displayframe.cpp index cba2ba49d4..a0eebd8676 100644 --- a/cvpcb/displayframe.cpp +++ b/cvpcb/displayframe.cpp @@ -126,7 +126,7 @@ void WinEDA_DisplayFrame::ReCreateHToolbar() m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); - SetToolBar( m_HToolBar ); + SetToolBar( (wxToolBar*) m_HToolBar ); m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, wxBitmap( display_options_xpm ), diff --git a/cvpcb/tool_cvpcb.cpp b/cvpcb/tool_cvpcb.cpp index 94390df396..0f74d4d04e 100644 --- a/cvpcb/tool_cvpcb.cpp +++ b/cvpcb/tool_cvpcb.cpp @@ -23,8 +23,9 @@ void WinEDA_CvpcbFrame::ReCreateHToolbar() return; m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); - SetToolBar( m_HToolBar ); - +#if !KICAD_AUIMANAGER + SetToolBar( (wxToolBar *)m_HToolBar ); +#endif m_HToolBar->AddTool( ID_CVPCB_READ_INPUT_NETLIST, wxEmptyString, wxBitmap( open_xpm ), _( "Open a NetList file" ) ); diff --git a/eeschema/libframe.cpp b/eeschema/libframe.cpp index b62f7eedbb..36fd33e051 100644 --- a/eeschema/libframe.cpp +++ b/eeschema/libframe.cpp @@ -187,6 +187,36 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, UpdatePartSelectList(); Zoom_Automatique( false ); Show( true ); + +#if KICAD_AUIMANAGER + 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); + + m_auimgr.AddPane(m_HToolBar, + wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0)); + + m_auimgr.AddPane(m_VToolBar, + wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right()); + + m_auimgr.AddPane(DrawPanel, + wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane()); + + m_auimgr.AddPane(MsgPanel, + wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom()); + m_auimgr.Update(); +#endif } diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 1653e0af33..2a7a26f6f5 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -187,6 +187,41 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, ReCreateHToolbar(); ReCreateVToolbar(); ReCreateOptToolbar(); + +#if KICAD_AUIMANAGER + 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); + + m_auimgr.AddPane(m_HToolBar, + wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0)); + + m_auimgr.AddPane(m_VToolBar, + wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right()); + + m_auimgr.AddPane(m_OptionsToolBar, + wxAuiPaneInfo(vert).Name(wxT("m_OptionsToolBar")).Left()); + + m_auimgr.AddPane(DrawPanel, + wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane()); + + m_auimgr.AddPane(MsgPanel, + wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom()); + + m_auimgr.Update(); +#endif + } diff --git a/eeschema/tool_lib.cpp b/eeschema/tool_lib.cpp index 6de8d64ba0..454de7e1ee 100644 --- a/eeschema/tool_lib.cpp +++ b/eeschema/tool_lib.cpp @@ -94,8 +94,9 @@ void WinEDA_LibeditFrame::ReCreateHToolbar() return; m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); - SetToolBar( m_HToolBar ); - +#if !KICAD_AUIMANAGER + SetToolBar( (wxToolBar*)m_HToolBar ); +#endif // Set up toolbar m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_LIB, wxEmptyString, wxBitmap( save_library_xpm ), diff --git a/eeschema/tool_sch.cpp b/eeschema/tool_sch.cpp index 0387b7ba42..60665bc80a 100644 --- a/eeschema/tool_sch.cpp +++ b/eeschema/tool_sch.cpp @@ -27,8 +27,9 @@ void WinEDA_SchematicFrame::ReCreateHToolbar() wxString msg; m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); - SetToolBar( m_HToolBar ); - +#if !KICAD_AUIMANAGER + SetToolBar( (wxToolBar*)m_HToolBar ); +#endif // Set up toolbar m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, wxBitmap( new_xpm ), _( "New schematic project" ) ); diff --git a/eeschema/tool_viewlib.cpp b/eeschema/tool_viewlib.cpp index 7f0f0acaeb..0b705bc84a 100644 --- a/eeschema/tool_viewlib.cpp +++ b/eeschema/tool_viewlib.cpp @@ -27,7 +27,10 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar() { m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); - SetToolBar( m_HToolBar ); + +#if !KICAD_AUIMANAGER + SetToolBar( (wxToolBar*)m_HToolBar ); +#endif // Set up toolbar m_HToolBar->AddTool( ID_LIBVIEW_SELECT_LIB, wxEmptyString, diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 1cc3ba8632..b8d331d0d7 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -121,6 +121,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, m_LibListSize.y = size.y; wxPoint win_pos( 0, 0 ); +#if !KICAD_AUIMANAGER if( Library == NULL ) { // Creates the libraries window display @@ -165,7 +166,30 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, m_CmpListWindow->GetClientSize() - wxSize( EXTRA_BORDER_SIZE * 2, 0 ), 0, NULL, wxLB_HSCROLL ); +#else + if( Library == NULL ) + { + m_LibList = + new wxListBox( this, ID_LIBVIEW_LIB_LIST, + wxPoint( 0, 0 ), + wxDefaultSize, + 0, NULL, wxLB_HSCROLL ); + } + else + { + m_libraryName = Library->GetName(); + m_entryName.Clear(); + m_unit = 1; + m_convert = 1; + m_LibListSize.x = 0; + } + m_CmpList = new wxListBox( this , ID_LIBVIEW_CMP_LIST, + wxPoint( 0, 0 ), + wxDefaultSize, + 0, NULL, wxLB_HSCROLL ); + +#endif if( m_LibList ) ReCreateListLib(); DisplayLibInfos(); @@ -173,6 +197,40 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, DrawPanel->SetAcceleratorTable( table ); Zoom_Automatique( false ); Show( TRUE ); + +#if KICAD_AUIMANAGER + 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); + + m_auimgr.AddPane(m_HToolBar, + wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0)); + + m_auimgr.AddPane(m_LibList, + wxAuiPaneInfo(vert).Name(wxT("m_LibList")).Left().Row(0)); + + m_auimgr.AddPane(m_CmpList, + wxAuiPaneInfo(vert).Name(wxT("m_CmpList")).Left().Row(1)); + + m_auimgr.AddPane(DrawPanel, + wxAuiPaneInfo(vert).Name(wxT("DrawFrame")).Center()); + + m_auimgr.AddPane(MsgPanel, + wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom()); + + m_auimgr.Update(); +#endif } @@ -281,7 +339,10 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv ) m_CmpList->SetSize( m_CmpListWindow->GetClientSize() - wxSize( EXTRA_BORDER_SIZE * 2, 0 ) ); } - +#if KICAD_AUIMANAGER + if(m_auimgr.GetManagedWindow()) + m_auimgr.Update(); +#endif SizeEv.Skip(); } diff --git a/gerbview/gerberframe.cpp b/gerbview/gerberframe.cpp index f22a119705..be9892a89e 100644 --- a/gerbview/gerberframe.cpp +++ b/gerbview/gerberframe.cpp @@ -156,6 +156,39 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father, ReCreateHToolbar(); ReCreateVToolbar(); ReCreateOptToolbar(); +#if KICAD_AUIMANAGER + 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); + + m_auimgr.AddPane(m_HToolBar, + wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0)); + + m_auimgr.AddPane(m_VToolBar, + wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right()); + + m_auimgr.AddPane(m_OptionsToolBar, + wxAuiPaneInfo(vert).Name(wxT("m_OptionsToolBar")).Left()); + + m_auimgr.AddPane(DrawPanel, + wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane()); + + m_auimgr.AddPane(MsgPanel, + wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom()); + + m_auimgr.Update(); +#endif } @@ -288,6 +321,10 @@ void WinEDA_GerberFrame::SetToolbars() } DisplayUnitsMsg(); +#if KICAD_AUIMANAGER + if(m_auimgr.GetManagedWindow()) + m_auimgr.Update(); +#endif } diff --git a/gerbview/tool_gerber.cpp b/gerbview/tool_gerber.cpp index c96ec1d6e8..48ef61a593 100644 --- a/gerbview/tool_gerber.cpp +++ b/gerbview/tool_gerber.cpp @@ -161,8 +161,9 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void ) } m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); - SetToolBar( m_HToolBar ); - +#if !KICAD_AUIMANAGER + SetToolBar( (wxToolBar*)m_HToolBar ); +#endif // Set up toolbar m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, wxBitmap( new_xpm ), diff --git a/include/wxstruct.h b/include/wxstruct.h index 555df11e4e..7e66e42dc3 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -6,6 +6,12 @@ #ifndef WXSTRUCT_H #define WXSTRUCT_H +// @todo: these 2 defines need to be moved into the top most CMakeLists.txt as a CMake OPTION. +// and they need to be boiled down to a single OPTION, not 2, and we need to add the wxWidgets aui +// library to the link image under these circumstances. I volunteer, but need a day or so. Dick +//#define KICAD_AUITOOLBAR 1 +//#define KICAD_AUIMANAGER 1 + #include @@ -15,6 +21,10 @@ #include #include +#if defined(KICAD_AUIMANAGER) +#include +#endif + //C++ guarantees that operator delete checks its argument for null-ness #ifndef SAFE_DELETE @@ -101,6 +111,10 @@ public: // It is "SchematicFrame", "PcbFrame" .... wxString m_AboutTitle; // Name of program displayed in About. +#ifdef KICAD_AUIMANAGER + wxAuiManager m_auimgr; +#endif + public: // Constructor and destructor @@ -642,7 +656,11 @@ public: /* class WinEDA_Toolbar */ /*************************/ +#if KICAD_AUITOOLBAR +class WinEDA_Toolbar : public wxAuiToolBar +#else class WinEDA_Toolbar : public wxToolBar +#endif { public: wxWindow* m_Parent; @@ -655,6 +673,21 @@ public: WinEDA_Toolbar( id_toolbar type, wxWindow* parent, wxWindowID id, bool horizontal ); WinEDA_Toolbar* Next() { return Pnext; } + +#if KICAD_AUITOOLBAR + bool GetToolState(int toolId) {return GetToolToggled(toolId); }; + + void AddRadioTool(int toolid, const wxString& label, const wxBitmap& bitmap, + const wxBitmap& bmpDisabled = wxNullBitmap, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString, + wxObject *data = NULL) { + AddTool( toolid, label, bitmap, bmpDisabled, wxITEM_CHECK, shortHelp, longHelp, data); + }; + + void SetToolNormalBitmap(int id, const wxBitmap& bitmap) {}; + void SetRows(int nRows) {}; +#endif }; diff --git a/kicad/buildmnu.cpp b/kicad/buildmnu.cpp index ac9cb5fe9f..f625cd5860 100644 --- a/kicad/buildmnu.cpp +++ b/kicad/buildmnu.cpp @@ -19,12 +19,12 @@ BEGIN_EVENT_TABLE( WinEDA_MainFrame, WinEDA_BasicFrame ) /* Window events */ EVT_SIZE( WinEDA_MainFrame::OnSize ) EVT_CLOSE( WinEDA_MainFrame::OnCloseWindow ) - +#if !KICAD_AUIMANAGER /* Sash drag events */ EVT_SASH_DRAGGED( ID_LEFT_FRAME, WinEDA_MainFrame::OnSashDrag ) EVT_SASH_DRAGGED( ID_BOTTOM_FRAME, WinEDA_MainFrame::OnSashDrag ) EVT_SASH_DRAGGED( ID_MAIN_COMMAND, WinEDA_MainFrame::OnSashDrag ) - +#endif /* Toolbar events */ EVT_TOOL( ID_NEW_PROJECT, WinEDA_MainFrame::OnLoadProject ) EVT_TOOL( ID_LOAD_PROJECT, WinEDA_MainFrame::OnLoadProject ) @@ -253,8 +253,9 @@ void WinEDA_MainFrame::RecreateBaseHToolbar() // Allocate memory for m_HToolBar m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); - SetToolBar( m_HToolBar ); - +#if !KICAD_AUIMANAGER + SetToolBar( (wxToolBar*)m_HToolBar ); +#endif // Set up toolbar m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, wxBitmap( new_project_xpm ), diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index b465446a9c..ece003e896 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -1,4 +1,5 @@ /***********************************************************/ + /* mdiframe.cpp - WinEDA_MainFrame is the kicad main frame */ /***********************************************************/ @@ -69,6 +70,7 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent, m_LeftWin->SetSashVisible( wxSASH_RIGHT, TRUE ); m_LeftWin->SetExtraBorderSize( 2 ); +#if !KICAD_AUIMANAGER // Bottom Window: box to display messages m_BottomWin = new wxSashLayoutWindow( this, ID_BOTTOM_FRAME, wxDefaultPosition, wxDefaultSize, @@ -83,7 +85,11 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent, m_DialogWin = new wxTextCtrl( m_BottomWin, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxNO_BORDER | wxTE_READONLY ); - +#else + m_DialogWin = new wxTextCtrl( this, wxID_ANY, wxEmptyString, + wxDefaultPosition, wxDefaultSize, + wxTE_MULTILINE | wxNO_BORDER | wxTE_READONLY ); +#endif // m_CommandWin is the box with buttons which launch eechema, pcbnew ... m_CommandWin = new WinEDA_CommandFrame( this, ID_MAIN_COMMAND, wxPoint( m_LeftWin_Width, 0 ), @@ -98,6 +104,38 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent, #ifdef KICAD_PYTHON PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::LoadProject" ) ); #endif + +#if KICAD_AUIMANAGER + RecreateBaseHToolbar(); + + 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); + + m_auimgr.AddPane(m_HToolBar, + wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top()); + + m_auimgr.AddPane(m_DialogWin, + wxAuiPaneInfo(horiz).Name(wxT("m_DialogWin")).Center()); + + m_auimgr.AddPane(m_CommandWin, + wxAuiPaneInfo().Name(wxT("m_CommandWin")).CentrePane()); + + m_auimgr.AddPane(m_LeftWin, + wxAuiPaneInfo(horiz).Name(wxT("m_LeftWin")).Left().BestSize(clientsize.x/3,clientsize.y)); + m_auimgr.Update(); +#endif } @@ -105,6 +143,9 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent, WinEDA_MainFrame::~WinEDA_MainFrame() /*****************************************************************************/ { +#if KICAD_AUIMANAGER +m_auimgr.UnInit(); +#endif } @@ -195,7 +236,10 @@ void WinEDA_MainFrame::OnSize( wxSizeEvent& event ) layout.LayoutFrame( this ); if( m_CommandWin ) m_CommandWin->Refresh( TRUE ); - +#if KICAD_AUIMANAGER + if(m_auimgr.GetManagedWindow()) + m_auimgr.Update(); +#endif event.Skip(); } diff --git a/pcbnew/dialog_general_options.cpp b/pcbnew/dialog_general_options.cpp index 5482858cd3..5d1278d72e 100644 --- a/pcbnew/dialog_general_options.cpp +++ b/pcbnew/dialog_general_options.cpp @@ -277,6 +277,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) break; case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1: +#if !KICAD_AUIMANAGER if( m_OptionsToolBar->GetToolState( id ) ) // show aux V toolbar (Microwave tool) ReCreateAuxVToolbar(); else @@ -289,6 +290,10 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) OnSize( SizeEv ); } +#else + m_auimgr.GetPane(wxT("m_AuxVToolBar")).Show( m_OptionsToolBar->GetToolState( id ) ); + m_auimgr.Update(); +#endif break; default: @@ -298,4 +303,5 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) } SetToolbars(); + } diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 112c7f3ae6..238f6ba3e1 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -192,6 +192,43 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, if( DrawPanel ) DrawPanel->m_Block_Enable = TRUE; +#if KICAD_AUIMANAGER + 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); + + m_auimgr.AddPane(m_HToolBar, + wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0)); + + m_auimgr.AddPane(m_AuxiliaryToolBar, + wxAuiPaneInfo(horiz).Name(wxT("m_AuxiliaryToolBar")).Top().Row(1)); + + m_auimgr.AddPane(m_VToolBar, + wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right()); + + m_auimgr.AddPane(m_OptionsToolBar, + wxAuiPaneInfo(vert).Name(wxT("m_OptionsToolBar")).Left()); + + m_auimgr.AddPane(DrawPanel, + wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane()); + + m_auimgr.AddPane(MsgPanel, + wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom()); + + m_auimgr.Update(); +#endif + } @@ -370,6 +407,10 @@ void WinEDA_ModuleEditFrame::SetToolbars() } DisplayUnitsMsg(); +#if KICAD_AUIMANAGER + if(m_auimgr.GetManagedWindow()) + m_auimgr.Update(); +#endif } diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 12f0143217..396fae14db 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -263,6 +263,46 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, if( m_show_microwave_tools ) ReCreateAuxVToolbar(); + +#if KICAD_AUIMANAGER + 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); + + m_auimgr.AddPane(m_HToolBar, + wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0)); + + m_auimgr.AddPane(m_AuxiliaryToolBar, + wxAuiPaneInfo(horiz).Name(wxT("m_AuxiliaryToolBar")).Top().Row(1)); + + m_auimgr.AddPane(m_AuxVToolBar, + wxAuiPaneInfo(vert).Name(wxT("m_AuxVToolBar")).Right().Row(1).Hide()); + + m_auimgr.AddPane(m_VToolBar, + wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right()); + + m_auimgr.AddPane(m_OptionsToolBar, + wxAuiPaneInfo(vert).Name(wxT("m_OptionsToolBar")).Left()); + + m_auimgr.AddPane(DrawPanel, + wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane()); + + m_auimgr.AddPane(MsgPanel, + wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom()); + + m_auimgr.Update(); +#endif } diff --git a/pcbnew/tool_modedit.cpp b/pcbnew/tool_modedit.cpp index dcb70fca85..8e850b3083 100644 --- a/pcbnew/tool_modedit.cpp +++ b/pcbnew/tool_modedit.cpp @@ -33,9 +33,9 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar() wxString msg; m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); - - SetToolBar( m_HToolBar ); - +#if !KICAD_AUIMANAGER + SetToolBar( (wxToolBar*) m_HToolBar ); +#endif // Set up toolbar m_HToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString, wxBitmap( open_library_xpm ), diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 16ffdee6df..6c9b448ef0 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -196,9 +196,9 @@ void WinEDA_PcbFrame::ReCreateHToolbar() m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); m_HToolBar->SetRows( 1 ); - - SetToolBar( m_HToolBar ); - +#if !KICAD_AUIMANAGER + SetToolBar( (wxToolBar*)m_HToolBar ); +#endif // Set up toolbar m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, wxBitmap( new_xpm ), _( "New board" ) ); diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index f7a91f02f8..fa2c6c9b11 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -275,8 +275,13 @@ void WinEDA_PcbFrame::SetToolbars() _( "Hide invisible text" ) : _( "Show invisible text" ) ); +#if !KICAD_AUIMANAGER m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, m_AuxVToolBar ? true : false ); +#else + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, + m_auimgr.GetPane(wxT("m_AuxVToolBar")).IsShown() ); +#endif } if( m_AuxiliaryToolBar ) @@ -285,4 +290,8 @@ void WinEDA_PcbFrame::SetToolbars() UpdateToolbarLayerInfo(); PrepareLayerIndicator(); DisplayUnitsMsg(); +#if KICAD_AUIMANAGER + if(m_auimgr.GetManagedWindow()) + m_auimgr.Update(); +#endif }