Commit 5a428e19 authored by Maciej Suminski's avatar Maciej Suminski

Moved layers visibility synchronization to PCB_DRAW_PANEL_GAL::SyncLayersVisibility().

parent a24576f3
......@@ -321,3 +321,28 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( LAYER_ID aLayer )
m_view->UpdateAllLayersOrder();
}
void PCB_DRAW_PANEL_GAL::SyncLayersVisibility( const BOARD* aBoard )
{
// Load layer & elements visibility settings
for( LAYER_NUM i = 0; i < NB_LAYERS; ++i )
{
m_view->SetLayerVisible( i, aBoard->IsLayerVisible( i ) );
// Synchronize netname layers as well
if( IsCopperLayer( i ) )
m_view->SetLayerVisible( GetNetnameLayer( i ), aBoard->IsLayerVisible( i ) );
}
for( LAYER_NUM i = 0; i < END_PCB_VISIBLE_LIST; ++i )
{
m_view->SetLayerVisible( ITEM_GAL_LAYER( i ), aBoard->IsElementVisible( i ) );
}
// Enable some layers that are GAL specific
m_view->SetLayerVisible( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), true );
m_view->SetLayerVisible( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), true );
m_view->SetLayerVisible( ITEM_GAL_LAYER( WORKSHEET ), true );
m_view->SetLayerVisible( ITEM_GAL_LAYER( GP_OVERLAY ), true );
}
......@@ -70,6 +70,13 @@ public:
///> @copydoc EDA_DRAW_PANEL_GAL::SetTopLayer()
virtual void SetTopLayer( LAYER_ID aLayer );
/**
* Function SyncLayersVisibility
* Updates "visibility" property of each layer of a given BOARD.
* @param aBoard contains layers visibility settings to be applied.
*/
void SyncLayersVisibility( const BOARD* aBoard );
protected:
///> Currently used worksheet
KIGFX::WORKSHEET_VIEWITEM* m_worksheet;
......
......@@ -813,29 +813,7 @@ void PCB_EDIT_FRAME::syncRenderStates()
void PCB_EDIT_FRAME::syncLayerVisibilities()
{
m_Layers->SyncLayerVisibilities();
KIGFX::VIEW* view = GetGalCanvas()->GetView();
// Load layer & elements visibility settings
for( LAYER_NUM i = 0; i < LAYER_ID_COUNT; ++i )
{
view->SetLayerVisible( i, m_Pcb->IsLayerVisible( LAYER_ID( i ) ) );
// Synchronize netname layers as well
if( IsCopperLayer( i ) )
view->SetLayerVisible( GetNetnameLayer( i ), m_Pcb->IsLayerVisible( LAYER_ID( i ) ) );
}
for( LAYER_NUM i = 0; i < END_PCB_VISIBLE_LIST; ++i )
{
view->SetLayerVisible( ITEM_GAL_LAYER( i ), m_Pcb->IsElementVisible( i ) );
}
// Enable some layers that are GAL specific
view->SetLayerVisible( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), true );
view->SetLayerVisible( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), true );
view->SetLayerVisible( ITEM_GAL_LAYER( WORKSHEET ), true );
view->SetLayerVisible( ITEM_GAL_LAYER( GP_OVERLAY ), true );
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( m_Pcb );
}
......
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