From 7944803f8cea03ced3e7d2546b341f8d8761b82b Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 8 Mar 2024 17:03:11 +0100 Subject: [PATCH] GERBVIEW_FRAME::RemapLayers(), fix incorrect handling of layers visibility When modifying the gerber layers visibility, other (non gerber) layers must be not modified. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17282 --- gerbview/gerbview_frame.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 2149b82135..d241007d51 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -552,6 +552,8 @@ void GERBVIEW_FRAME::RemapLayers( const std::unordered_map& remapping { // Save the visibility of each existing gerber layer, in order to be able // to restore this visibility after layer reorder. + // Note: the visibility of other objects (D_CODE, negative objects ... ) + // must be not modified for( int currlayer = GERBER_DRAWLAYERS_COUNT-1; currlayer >= 0; --currlayer ) { GERBER_FILE_IMAGE* gerber = GetImagesList()->GetGbrImage( currlayer ); @@ -576,8 +578,8 @@ void GERBVIEW_FRAME::RemapLayers( const std::unordered_map& remapping GetCanvas()->GetView()->ReorderLayerData( view_remapping ); - // Restore visibility options - LSET newVisibility; + // Restore visibility of gerber layers + LSET newVisibility = GetVisibleLayers(); for( int currlayer = GERBER_DRAWLAYERS_COUNT-1; currlayer >= 0; --currlayer ) { @@ -587,6 +589,8 @@ void GERBVIEW_FRAME::RemapLayers( const std::unordered_map& remapping { if( gerber->HasFlag( CANDIDATE ) ) newVisibility.set( currlayer ); + else + newVisibility.set( currlayer, false ); gerber->ClearFlags( CANDIDATE ); }