{Set,Get}ActiveLayer moved from PCB_EDIT_FRAME to PCB_BASE_FRAME.

This commit is contained in:
Maciej Suminski 2014-07-09 11:50:27 +02:00
parent 5a428e1957
commit 0306ec7efe
8 changed files with 29 additions and 22 deletions

View File

@ -613,6 +613,24 @@ public:
virtual void SwitchLayer( wxDC* DC, LAYER_ID layer );
/**
* Function SetActiveLayer
* will change the currently active layer to \a aLayer.
*/
virtual void SetActiveLayer( LAYER_ID aLayer )
{
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
}
/**
* Function GetActiveLayer
* returns the active layer
*/
virtual LAYER_ID GetActiveLayer() const
{
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
}
void LoadSettings( wxConfigBase* aCfg ); // override virtual
void SaveSettings( wxConfigBase* aCfg ); // override virtual

View File

@ -536,16 +536,7 @@ public:
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
void SetActiveLayer( LAYER_ID aLayer, bool doLayerWidgetUpdate = true );
/**
* Function GetActiveLayer
* returns the active layer
*/
LAYER_ID GetActiveLayer() const
{
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
}
virtual void SetActiveLayer( LAYER_ID aLayer );
/**
* Function IsElementVisible

View File

@ -373,7 +373,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
{
// the layer change from the PCB_LAYER_WIDGET can be denied by returning
// false from this function.
myframe->SetActiveLayer( ToLAYER_ID( aLayer ), false );
myframe->SetActiveLayer( ToLAYER_ID( aLayer ) );
if( m_alwaysShowActiveCopperLayer )
OnLayerSelected();

View File

@ -217,7 +217,6 @@ public:
BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 );
/* Undo and redo functions */
public:
/**
* Function SaveCopyInUndoList.

View File

@ -326,13 +326,13 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( LAYER_ID aLayer )
void PCB_DRAW_PANEL_GAL::SyncLayersVisibility( const BOARD* aBoard )
{
// Load layer & elements visibility settings
for( LAYER_NUM i = 0; i < NB_LAYERS; ++i )
for( LAYER_NUM i = 0; i < LAYER_ID_COUNT; ++i )
{
m_view->SetLayerVisible( i, aBoard->IsLayerVisible( i ) );
m_view->SetLayerVisible( i, aBoard->IsLayerVisible( LAYER_ID( i ) ) );
// Synchronize netname layers as well
if( IsCopperLayer( i ) )
m_view->SetLayerVisible( GetNetnameLayer( i ), aBoard->IsLayerVisible( i ) );
m_view->SetLayerVisible( GetNetnameLayer( i ), aBoard->IsLayerVisible( LAYER_ID( i ) ) );
}
for( LAYER_NUM i = 0; i < END_PCB_VISIBLE_LIST; ++i )

View File

@ -783,14 +783,13 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable()
}
void PCB_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer, bool doLayerWidgetUpdate )
void PCB_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer )
{
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
PCB_BASE_FRAME::SetActiveLayer( aLayer );
GetGalCanvas()->SetHighContrastLayer( aLayer );
if( doLayerWidgetUpdate )
syncLayerWidgetLayer();
syncLayerWidgetLayer();
if( IsGalCanvasActive() )
GetGalCanvas()->Refresh();

View File

@ -99,7 +99,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
if( !GetBoard()->GetEnabledLayers()[ cur_layer ] )
cur_layer = F_Cu;
SetActiveLayer( cur_layer, true );
SetActiveLayer( cur_layer );
OnModify();
ReCreateLayerBox();

View File

@ -289,7 +289,7 @@ int PCBNEW_CONTROL::LayerInner6( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::LayerBottom( TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->SetActiveLayer( B_Cu, true );
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, B_Cu );
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
setTransitions();
@ -311,7 +311,7 @@ int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
if( getModel<BOARD>()->GetCopperLayerCount() < 2 ) // Single layer
layer = B_Cu;
else if( layer >= getModel<BOARD>()->GetCopperLayerCount() - 2 )
layer = B_Cu;
layer = F_Cu;
else
++layer;