Add Gerber filename to 'Select Layer:' dialog

The 'Select Layer:' dialog pops up directly over the dialog with the loaded
Gerbers and hides all Gerber file names.  This is just an aid so users remember
exactly which Gerber layer they're working on without having to move the dialog.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4893
This commit is contained in:
Peter Montgomery 2020-07-22 02:03:43 +00:00 committed by Jon Evans
parent 450107e453
commit 5fd7064f76
3 changed files with 18 additions and 9 deletions

View File

@ -55,7 +55,8 @@ private:
public: public:
// Constructor and destructor // Constructor and destructor
SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, int aDefaultLayer, int aCopperLayerCount ); SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, int aDefaultLayer, int aCopperLayerCount,
wxString aGerberName );
~SELECT_LAYER_DIALOG() { }; ~SELECT_LAYER_DIALOG() { };
private: private:
@ -88,9 +89,10 @@ END_EVENT_TABLE()
* different radiobutton is clicked on) prior to then clicking on the "Deselect" * different radiobutton is clicked on) prior to then clicking on the "Deselect"
* button provided within the "Layer selection:" dialog box). * button provided within the "Layer selection:" dialog box).
*/ */
int GERBVIEW_FRAME::SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount ) int GERBVIEW_FRAME::SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, wxString aGerberName )
{ {
SELECT_LAYER_DIALOG* frame = new SELECT_LAYER_DIALOG( this, aDefaultLayer, aCopperLayerCount ); SELECT_LAYER_DIALOG* frame =
new SELECT_LAYER_DIALOG( this, aDefaultLayer, aCopperLayerCount, aGerberName );
int layer = frame->ShowModal(); int layer = frame->ShowModal();
frame->Destroy(); frame->Destroy();
@ -104,10 +106,10 @@ int GERBVIEW_FRAME::SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount )
* radiobuttons, in which case they are positioned (in a vertical line) * radiobuttons, in which case they are positioned (in a vertical line)
* to the right of that radiobox. * to the right of that radiobox.
*/ */
SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, int aDefaultLayer, SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG(
int aCopperLayerCount ) : GERBVIEW_FRAME* parent, int aDefaultLayer, int aCopperLayerCount, wxString aGerberName )
DIALOG_SHIM( parent, -1, _( "Select Layer:" ), wxDefaultPosition, wxDefaultSize, : DIALOG_SHIM( parent, -1, wxString::Format( _( "Select Layer: %s" ), aGerberName ),
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ) wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
{ {
wxButton* button; wxButton* button;
int ii; int ii;

View File

@ -116,6 +116,7 @@ public:
/** Install the dialog box for layer selection /** Install the dialog box for layer selection
* @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer) * @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer)
* @param aCopperLayerCount = number of copper layers * @param aCopperLayerCount = number of copper layers
* @param aGerberName = Name of Gerber file to select KiCad layer for
* @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected), * @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected),
* or -1 if canceled * or -1 if canceled
* *
@ -127,7 +128,7 @@ public:
* different radiobutton is clicked on) prior to then clicking on the "Deselect" * different radiobutton is clicked on) prior to then clicking on the "Deselect"
* button provided within the "Layer selection:" dialog box). * button provided within the "Layer selection:" dialog box).
*/ */
int SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount ); int SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, wxString aGerberName );
/** /**
* @return the color of the grid * @return the color of the grid

View File

@ -362,7 +362,13 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
if( jj != UNSELECTED_LAYER && jj != UNDEFINED_LAYER && !IsValidLayer( jj ) ) if( jj != UNSELECTED_LAYER && jj != UNDEFINED_LAYER && !IsValidLayer( jj ) )
jj = B_Cu; // (Defaults to "Copper" layer.) jj = B_Cu; // (Defaults to "Copper" layer.)
jj = m_Parent->SelectPCBLayer( jj, m_exportBoardCopperLayersCount ); // Get file name of Gerber loaded on this layer
wxFileName fn( m_Parent->GetGerberLayout()->GetImagesList()->GetGbrImage( ii )->m_FileName );
// Surround it with quotes to make it stand out on the dialog title bar
wxString layerName = "\"" + fn.GetFullName() + "\"";
// Display dialog to let user select a layer for the Gerber
jj = m_Parent->SelectPCBLayer( jj, m_exportBoardCopperLayersCount, layerName );
if( jj != UNSELECTED_LAYER && jj != UNDEFINED_LAYER && !IsValidLayer( jj ) ) if( jj != UNSELECTED_LAYER && jj != UNDEFINED_LAYER && !IsValidLayer( jj ) )
return; return;