From 5767a08008b903fd0e12a7ac73f6381609b858b1 Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Wed, 4 Aug 2021 14:47:50 -0400 Subject: [PATCH] Gerbview: select first layer of opened archive --- gerbview/files.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gerbview/files.cpp b/gerbview/files.cpp index 06d40b933b..d62a1d4ad6 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -477,6 +477,7 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR { bool foundX2Gerbers = false; wxString msg; + int firstLoadedLayer = NO_AVAILABLE_LAYERS; // Extract the path of aFullFileName. We use it to store temporary files wxFileName fn( aFullFileName ); @@ -616,6 +617,12 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR GERBER_DRAW_LAYER( layer ), GetGbrImage( layer )->HasNegativeItems() ); } + // Select the first added layer by default when done loading + if( read_ok && firstLoadedLayer == NO_AVAILABLE_LAYERS ) + { + firstLoadedLayer = layer; + } + delete entry; // The unzipped file is only a temporary file, delete it. @@ -652,6 +659,10 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR else SortLayersByFileExtension(); + // Select the first layer loaded so we don't show another layer on top after + if( firstLoadedLayer != NO_AVAILABLE_LAYERS ) + SetActiveLayer( firstLoadedLayer, true ); + return success; }