Reset active layer if it gets deleted in board setup.

Fixes https://gitlab.com/kicad/code/kicad/issues/5118
This commit is contained in:
Jeff Young 2020-08-13 20:35:04 +01:00
parent 0bb175a028
commit 7a6a6c2272
1 changed files with 8 additions and 2 deletions

View File

@ -32,7 +32,7 @@
#include <pcbnew_id.h>
#include <drc/drc.h>
#include <pcbnew_settings.h>
//#include <layer_widget.h>
#include <pcb_layer_box_selector.h>
#include <pcb_layer_widget.h>
#include <footprint_edit_frame.h>
#include <dialog_plot.h>
@ -40,7 +40,6 @@
#include <dialogs/dialog_exchange_footprints.h>
#include <dialog_board_setup.h>
#include <convert_to_biu.h>
//#include <pcb_painter.h>
#include <invoke_pcb_dialog.h>
#include <class_board.h>
#include <class_module.h>
@ -959,6 +958,13 @@ void PCB_EDIT_FRAME::UpdateUserInterface()
// Update info shown by the horizontal toolbars
ReCreateLayerBox();
LSET activeLayers = GetBoard()->GetEnabledLayers();
if( !activeLayers.test( GetActiveLayer() ) )
SetActiveLayer( activeLayers.Seq().front() );
m_SelLayerBox->SetLayerSelection( GetActiveLayer() );
// Update the layer manager
m_Layers->Freeze();
ReFillLayerWidget();