Gerbview: select first layer of opened archive

This commit is contained in:
Mike Williams 2021-08-04 14:47:50 -04:00
parent 2dd6b98b89
commit 5767a08008
1 changed files with 11 additions and 0 deletions

View File

@ -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;
}