Added loading layer visibility settings when loading a board. Minor code cleaning.

This commit is contained in:
Maciej Suminski 2013-04-03 11:19:08 +02:00
parent 4e4776c370
commit 39086ffb3f
2 changed files with 24 additions and 13 deletions

View File

@ -226,6 +226,17 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
{
view->SetLayerOrder( m_galLayerOrder[i], i );
}
// Load layer & elements visibility settings
for( unsigned int i = 0; i < LAYER_COUNT; ++i )
{
view->SetLayerVisible( i, m_Pcb->IsLayerVisible( i ) );
}
for( unsigned int i = 0; i < END_PCB_VISIBLE_LIST; ++i )
{
view->SetLayerVisible( ITEM_GAL_LAYER( i ), m_Pcb->IsElementVisible( i ) );
}
}
#endif
}

View File

@ -368,16 +368,18 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal
{
KiGfx::VIEW* view = galCanvas->GetView();
view->SetLayerVisible( aLayer, isVisible );
if( myframe->IsGalCanvasActive() )
{
galCanvas->Refresh();
}
}
#endif /* KICAD_GAL */
if( isFinal )
myframe->GetCanvas()->Refresh();
{
#ifdef KICAD_GAL
if( myframe->IsGalCanvasActive() )
galCanvas->Refresh();
else
#endif /* KICAD_GAL */
myframe->GetCanvas()->Refresh();
}
}
void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, EDA_COLOR_T aColor )
@ -418,15 +420,13 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{
KiGfx::VIEW* view = galCanvas->GetView();
view->SetLayerVisible( ITEM_GAL_LAYER( aId ), isEnabled );
if( myframe->IsGalCanvasActive() )
{
galCanvas->Refresh();
}
}
#endif /* KICAD_GAL */
myframe->GetCanvas()->Refresh();
if( myframe->IsGalCanvasActive() )
galCanvas->Refresh();
else
#endif /* KICAD_GAL */
myframe->GetCanvas()->Refresh();
}
//-----</LAYER_WIDGET callbacks>------------------------------------------