One follow-on patch attached after I realized that a fix hadn't made its way in. -Jon
On Sun, Sep 17, 2017 at 6:47 PM, Jon Evans <[email protected]> wrote: > Hi all, > > The day has finally come! I have distilled my GerbView GAL branch into a > patchset attached to this email. Hopefully with this merged into master we > can identify any remaining bugs and clean it up for 5.0. > > Note that this set is split into 5 patches to make review easier, but they > are not intended to compile and work independently. > > Best, > Jon >
From b78848c9faaa58f57857d7039bca0775deba9e9e Mon Sep 17 00:00:00 2001 From: Jon Evans <[email protected]> Date: Sun, 17 Sep 2017 21:03:58 -0400 Subject: [PATCH] Fix some layer visibility behavior --- gerbview/class_gerbview_layer_widget.cpp | 4 ++-- gerbview/gerbview_frame.cpp | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index 4b95e20c9..8023b8072 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -315,9 +315,9 @@ void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFin long visibleLayers = myframe->GetVisibleLayers(); if( isVisible ) - visibleLayers |= 1 << aLayer; + visibleLayers |= 1 << ( aLayer - GERBVIEW_LAYER_ID_START ); else - visibleLayers &= ~( 1 << aLayer ); + visibleLayers &= ~( 1 << ( aLayer - GERBVIEW_LAYER_ID_START ) ); myframe->SetVisibleLayers( visibleLayers ); diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 9f1539267..a4123a433 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -677,7 +677,23 @@ bool GERBVIEW_FRAME::IsElementVisible( GERBVIEW_LAYER_ID aItemIdVisible ) 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; + } } -- 2.11.0
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

