Gerbview: Keep existing layer selected if user clicks Cancel on 'Select Layer' dialog
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4752
This commit is contained in:
parent
a1a8eca844
commit
73168a9405
|
@ -49,6 +49,7 @@ enum layer_sel_id {
|
|||
class SELECT_LAYER_DIALOG : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
int m_PassedDefaultLayer; // Remember this in case user hits Cancel
|
||||
wxRadioBox* m_layerRadioBox;
|
||||
std::vector <int> m_layerId;
|
||||
|
||||
|
@ -113,6 +114,9 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, int aDefaultLa
|
|||
wxArrayString layerList;
|
||||
int selected = -1;
|
||||
|
||||
// Store the passed default layer in case the user hits Cancel
|
||||
m_PassedDefaultLayer = aDefaultLayer;
|
||||
|
||||
// Build the layer list; first build copper layers list
|
||||
int layerCount = 0;
|
||||
|
||||
|
@ -203,7 +207,7 @@ void SELECT_LAYER_DIALOG::OnLayerSelected( wxCommandEvent& event )
|
|||
|
||||
void SELECT_LAYER_DIALOG::OnCancelClick( wxCommandEvent& event )
|
||||
{
|
||||
EndModal( -1 );
|
||||
EndModal( m_PassedDefaultLayer );
|
||||
}
|
||||
|
||||
// This function is a duplicate of
|
||||
|
@ -266,7 +270,7 @@ const wxString GetPCBDefaultLayerName( int aLayerId )
|
|||
case Eco2_User: txt = wxT( "Eco2.User" ); break;
|
||||
case Edge_Cuts: txt = wxT( "Edge.Cuts" ); break;
|
||||
|
||||
// Pcbnew konws some oter layers. But any other layer is not suitable for export.
|
||||
// Pcbnew knows some other layers, but any other layer is not suitable for export.
|
||||
|
||||
default: // Sentinel
|
||||
txt = wxT( "" ); break;
|
||||
|
|
Loading…
Reference in New Issue