Added layer widget to the module editor.

This commit is contained in:
Maciej Suminski 2014-07-09 11:59:23 +02:00
parent dca4667e66
commit b5b20ef4bd
4 changed files with 40 additions and 4 deletions

View File

@ -56,6 +56,7 @@
#include <dialog_get_component.h> #include <dialog_get_component.h>
#include <modview_frame.h> #include <modview_frame.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <class_pcb_layer_widget.h>
static void DisplayCmpDoc( wxString& Name ); static void DisplayCmpDoc( wxString& Name );

View File

@ -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 ) void FOOTPRINT_EDIT_FRAME::UseGalCanvas( bool aEnable )
{ {
EDA_DRAW_FRAME::UseGalCanvas( aEnable ); EDA_DRAW_FRAME::UseGalCanvas( aEnable );

View File

@ -398,6 +398,9 @@ public:
virtual EDA_COLOR_T GetGridColor() const; virtual EDA_COLOR_T GetGridColor() const;
///> @copydoc PCB_BASE_FRAME::SetActiveLayer()
void SetActiveLayer( LAYER_NUM aLayer );
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas() ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
virtual void UseGalCanvas( bool aEnable ); virtual void UseGalCanvas( bool aEnable );
@ -408,6 +411,7 @@ protected:
/// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory. /// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.
FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ); FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
PCB_LAYER_WIDGET* m_Layers;
/** /**
* Function GetComponentFromUndoList * Function GetComponentFromUndoList

View File

@ -52,6 +52,7 @@
#include <hotkeys.h> #include <hotkeys.h>
#include <module_editor_frame.h> #include <module_editor_frame.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <class_pcb_layer_widget.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h> #include <tool/tool_dispatcher.h>
@ -191,6 +192,9 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// Ensure all layers and items are visible: // Ensure all layers and items are visible:
GetBoard()->SetVisibleAlls(); 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() ) ); SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
@ -224,6 +228,14 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
EDA_PANEINFO mesg_pane; EDA_PANEINFO mesg_pane;
mesg_pane.MessageToolbarPane(); 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, m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top(). Row( 0 ) ); 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, m_auimgr.AddPane( m_drawToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Layer(1) ); 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) // The left vertical toolbar (fast acces to display options)
m_auimgr.AddPane( m_optionsToolBar, m_auimgr.AddPane( m_optionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ). Left().Layer(1) ); 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, m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg_pane ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); wxAuiPaneInfo( mesg_pane ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
m_auimgr.Update();
if( drawFrame->IsGalCanvasActive() ) if( drawFrame->IsGalCanvasActive() )
{ {
drawPanel->DisplayBoard( GetBoard() );
// Create the manager and dispatcher & route draw panel events to the dispatcher // Create the manager and dispatcher & route draw panel events to the dispatcher
m_toolManager = new TOOL_MANAGER; m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( GetBoard(), drawPanel->GetView(), m_toolManager->SetEnvironment( GetBoard(), drawPanel->GetView(),
@ -271,6 +284,11 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
UseGalCanvas( true ); 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 // save the footprint in the PROJECT
retainLastFootprint(); retainLastFootprint();
delete m_Layers;
} }