Gerbview: update view items after reordering/modifying view layers.

Previously, after updating the gerber layer order, displayed D_codes where
not always those corresponding to the active layer.
This commit is contained in:
jean-pierre charras 2024-03-09 17:36:28 +01:00
parent b7a193dc3a
commit 2af35ac4f1
2 changed files with 12 additions and 1 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -168,8 +168,13 @@ bool GERBVIEW_FRAME::LoadFileOrShowDialog( const wxString& aFileName,
// Auto zoom / sort is only applied when no other files have been loaded
if( isFirstFile )
{
int ly = GetActiveLayer();
SortLayersByFileExtension();
Zoom_Automatique( false );
// Ensure the initial active graphic layer is updated after sorting.
SetActiveLayer( ly, true );
}
return success;

View File

@ -600,6 +600,12 @@ void GERBVIEW_FRAME::RemapLayers( const std::unordered_map<int, int>& remapping
ReFillLayerWidget();
syncLayerBox( true );
// Reordering draw layers need updating the view items
GetCanvas()->GetView()->RecacheAllItems();
GetCanvas()->GetView()->MarkDirty();
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
GetCanvas()->Refresh();
}