Pcbnew, footprint editor: make switching layers visibility on/off working.
In footprint editor the board is a dummy board not managed by project settings, so using its settings to manage layers visibility does not work. Fixes #4924 https://gitlab.com/kicad/code/kicad/issues/4024
This commit is contained in:
parent
cc688a3e1d
commit
a25f7cc0a4
|
@ -621,19 +621,26 @@ bool PCB_LAYER_WIDGET::OnLayerSelected()
|
|||
|
||||
void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
|
||||
{
|
||||
BOARD* brd = myframe->GetBoard();
|
||||
|
||||
LSET visibleLayers = brd->GetVisibleLayers();
|
||||
|
||||
if( visibleLayers.test( aLayer ) != isVisible )
|
||||
// In other frames than board editor, the board is a dummy board.
|
||||
// so changing board settings makes sense (and works) only for the board editor frame
|
||||
if( myframe->IsType( FRAME_PCB_EDITOR ) )
|
||||
{
|
||||
visibleLayers.set( aLayer, isVisible );
|
||||
BOARD* brd = myframe->GetBoard();
|
||||
|
||||
brd->SetVisibleLayers( visibleLayers );
|
||||
LSET visibleLayers = brd->GetVisibleLayers();
|
||||
|
||||
if( visibleLayers.test( aLayer ) != isVisible )
|
||||
{
|
||||
visibleLayers.set( aLayer, isVisible );
|
||||
brd->SetVisibleLayers( visibleLayers );
|
||||
|
||||
if( myframe->GetCanvas() )
|
||||
myframe->GetCanvas()->GetView()->SetLayerVisible( aLayer, isVisible );
|
||||
}
|
||||
}
|
||||
else
|
||||
if( myframe->GetCanvas() )
|
||||
myframe->GetCanvas()->GetView()->SetLayerVisible( aLayer, isVisible );
|
||||
}
|
||||
|
||||
if( isFinal )
|
||||
myframe->GetCanvas()->Refresh();
|
||||
|
|
Loading…
Reference in New Issue