diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 748b47917f..47a4728e92 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -56,6 +56,7 @@ #include #include #include +#include static void DisplayCmpDoc( wxString& Name ); diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index c3bae138a9..8d643b4a67 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -916,6 +916,17 @@ EDA_COLOR_T FOOTPRINT_EDIT_FRAME::GetGridColor() const } +void FOOTPRINT_EDIT_FRAME::SetActiveLayer( LAYER_NUM aLayer ) +{ + PCB_BASE_FRAME::SetActiveLayer( aLayer ); + + GetGalCanvas()->SetHighContrastLayer( aLayer ); + + if( IsGalCanvasActive() ) + GetGalCanvas()->Refresh(); +} + + void FOOTPRINT_EDIT_FRAME::UseGalCanvas( bool aEnable ) { EDA_DRAW_FRAME::UseGalCanvas( aEnable ); diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index c733e922e0..ef9687a6a3 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -398,6 +398,9 @@ public: virtual EDA_COLOR_T GetGridColor() const; + ///> @copydoc PCB_BASE_FRAME::SetActiveLayer() + void SetActiveLayer( LAYER_NUM aLayer ); + ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas() virtual void UseGalCanvas( bool aEnable ); @@ -408,6 +411,7 @@ protected: /// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory. FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ); + PCB_LAYER_WIDGET* m_Layers; /** * Function GetComponentFromUndoList diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 9cf223a256..b1253fc870 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -191,6 +192,9 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : // Ensure all layers and items are visible: GetBoard()->SetVisibleAlls(); + wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); + m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), font.GetPointSize() ); + SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) ); GetScreen()->SetCurItem( NULL ); @@ -224,6 +228,14 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : EDA_PANEINFO mesg_pane; mesg_pane.MessageToolbarPane(); + // Create a wxAuiPaneInfo for the Layers Manager, not derived from the template. + // LAYER_WIDGET is floatable, but initially docked at far right + EDA_PANEINFO lyrs; + lyrs.LayersToolbarPane(); + lyrs.MinSize( m_Layers->GetBestSize() ); // updated in ReFillLayerWidget + lyrs.BestSize( m_Layers->GetBestSize() ); + lyrs.Caption( _( "Visibles" ) ); + m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top(). Row( 0 ) ); @@ -234,6 +246,11 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Layer(1) ); + // Add the layer manager ( most right side of pcbframe ) + m_auimgr.AddPane( m_Layers, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 2 ) ); + // Layers manager is visible and served only in GAL canvas mode. + m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( drawFrame->IsGalCanvasActive() ); + // The left vertical toolbar (fast acces to display options) m_auimgr.AddPane( m_optionsToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ). Left().Layer(1) ); @@ -246,12 +263,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg_pane ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); - m_auimgr.Update(); - if( drawFrame->IsGalCanvasActive() ) { - drawPanel->DisplayBoard( GetBoard() ); - // Create the manager and dispatcher & route draw panel events to the dispatcher m_toolManager = new TOOL_MANAGER; m_toolManager->SetEnvironment( GetBoard(), drawPanel->GetView(), @@ -271,6 +284,11 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : UseGalCanvas( true ); } + + m_Layers->ReFill(); + m_Layers->ReFillRender(); + + m_auimgr.Update(); } @@ -278,6 +296,8 @@ FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME() { // save the footprint in the PROJECT retainLastFootprint(); + + delete m_Layers; }