Commit 0306ec7e authored by Maciej Suminski's avatar Maciej Suminski

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

parent 5a428e19
......@@ -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
......
......@@ -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
......
......@@ -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();
......
......@@ -217,7 +217,6 @@ public:
BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 );
/* Undo and redo functions */
public:
/**
* Function SaveCopyInUndoList.
......
......@@ -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 )
......
......@@ -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();
......
......@@ -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();
......
......@@ -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;
......
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