Fix some layer visibility behavior

This commit is contained in:
Jon Evans 2017-09-17 21:03:58 -04:00 committed by Maciej Suminski
parent 050489d719
commit cc5c5010f0
2 changed files with 19 additions and 3 deletions

View File

@ -305,9 +305,9 @@ void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFin
long visibleLayers = myframe->GetVisibleLayers(); long visibleLayers = myframe->GetVisibleLayers();
if( isVisible ) if( isVisible )
visibleLayers |= 1 << aLayer; visibleLayers |= 1 << ( aLayer - GERBVIEW_LAYER_ID_START );
else else
visibleLayers &= ~( 1 << aLayer ); visibleLayers &= ~( 1 << ( aLayer - GERBVIEW_LAYER_ID_START ) );
myframe->SetVisibleLayers( visibleLayers ); myframe->SetVisibleLayers( visibleLayers );

View File

@ -677,7 +677,23 @@ bool GERBVIEW_FRAME::IsElementVisible( GERBVIEW_LAYER_ID aItemIdVisible ) const
long GERBVIEW_FRAME::GetVisibleLayers() const long GERBVIEW_FRAME::GetVisibleLayers() const
{ {
return -1; // TODO long layerMask = 0;
if( auto canvas = GetGalCanvas() )
{
// NOTE: This assumes max 32 drawlayers!
for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
{
if( canvas->GetView()->IsLayerVisible( GERBER_DRAW_LAYER( i ) ) )
layerMask |= ( 1 << i );
}
return layerMask;
}
else
{
return -1;
}
} }