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

This commit is contained in:
Maciej Suminski 2014-07-09 11:24:56 +02:00
parent a24576f3ce
commit 5a428e1957
3 changed files with 33 additions and 23 deletions

View File

@ -321,3 +321,28 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( LAYER_ID aLayer )
m_view->UpdateAllLayersOrder(); 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 );
}

View File

@ -70,6 +70,13 @@ public:
///> @copydoc EDA_DRAW_PANEL_GAL::SetTopLayer() ///> @copydoc EDA_DRAW_PANEL_GAL::SetTopLayer()
virtual void SetTopLayer( LAYER_ID aLayer ); 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: protected:
///> Currently used worksheet ///> Currently used worksheet
KIGFX::WORKSHEET_VIEWITEM* m_worksheet; KIGFX::WORKSHEET_VIEWITEM* m_worksheet;

View File

@ -813,29 +813,7 @@ void PCB_EDIT_FRAME::syncRenderStates()
void PCB_EDIT_FRAME::syncLayerVisibilities() void PCB_EDIT_FRAME::syncLayerVisibilities()
{ {
m_Layers->SyncLayerVisibilities(); m_Layers->SyncLayerVisibilities();
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( m_Pcb );
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 );
} }