25 #include <wx/msgdlg.h> 29 return aLayerName +
" *";
34 if( !aLayerName.EndsWith(
" *" ) )
36 return aLayerName.Left( aLayerName.Length() - 2 );
40 const wxString& aLayerName )
const 45 if( layerDescription.Name == layerName )
46 return &layerDescription;
55 wxString selectedKiCadLayerName;
59 wxLIST_STATE_SELECTED ) ) != wxNOT_FOUND )
70 wxLIST_STATE_SELECTED ) ) == wxNOT_FOUND,
71 "There are more than one KiCad layer selected (unexpected)" );
88 if( inputLayerDesc.Name == pureInputLayerName
91 return inputLayerDesc.AutoMapLayer;
108 wxArrayInt rowsToDelete;
111 wxLIST_STATE_SELECTED ) )
115 wxString kiName =
LayerName( selectedKiCadLayerID );
128 if( *iter == selectedLayerName )
135 rowsToDelete.Add( itemIndex );
147 wxArrayInt rowsToDelete;
154 wxString pureSelectedLayerName =
UnwrapRequired( selectedLayerName );
160 rowsToDelete.Add( itemIndex );
171 wxListCtrl* aListCtrl )
173 for(
long n = ( aRowsToDelete.GetCount() - 1 ); 0 <= n; n-- )
175 aListCtrl->DeleteItem( aRowsToDelete[n] );
184 wxArrayInt rowsToDelete;
187 wxLIST_STATE_DONTCARE ) )
196 wxString kiName =
LayerName( autoMatchLayer );
208 if( *iter == layerName )
215 rowsToDelete.Add( itemIndex );
223 const std::vector<INPUT_LAYER_DESC>& aLayerDesc ) :
232 wxString layerName = inLayer.Required ?
WrapRequired( inLayer.Name ) : inLayer.Name;
234 kiCadLayers |= inLayer.PermittedLayers;
237 int maxTextWidth = GetTextExtent(
_(
"Imported Layer" ) ).x;
240 maxTextWidth = std::max( maxTextWidth, GetTextExtent( layer.Name ).x );
243 wxListItem importedLayersHeader;
244 importedLayersHeader.SetId( 0 );
245 importedLayersHeader.SetText(
_(
"Imported Layer" ) );
246 importedLayersHeader.SetWidth( maxTextWidth + 15 );
249 int kicadMaxTextWidth = GetTextExtent( wxT(
"User.Drawings" ) ).x;
251 wxListItem kicadLayersHeader;
252 kicadLayersHeader.SetId( 0 );
253 kicadLayersHeader.SetText(
_(
"KiCad Layer" ) );
254 kicadLayersHeader.SetWidth( kicadMaxTextWidth + 5 );
257 kicadLayersHeader.SetId( 1 );
258 importedLayersHeader.SetWidth( maxTextWidth + 15 );
259 kicadLayersHeader.SetWidth( kicadMaxTextWidth + 5 );
270 item.SetText( importedLayerName );
280 LSEQ kicadLayersSeq = kiCadLayers.
Seq();
288 item.SetText( kiName );
304 std::vector<wxString> unmappedLayers;
308 wxASSERT_MSG( layerDesc !=
nullptr,
"Expected to find layer decription" );
310 unmappedLayers.push_back( layerDesc->
Name );
312 return unmappedLayers;
317 const std::vector<INPUT_LAYER_DESC>& aLayerDesc )
328 wxMessageBox(
_(
"All required layers (marked with '*') must be matched. " 329 "Please click on 'Auto-Match Layers' to " 330 "automatically match the remaining layers" ),
331 _(
"Unmatched Layers" ), wxICON_ERROR | wxOK );
void DeleteListItems(const wxArrayInt &aRowsToDelete, wxListCtrl *aListCtrl)
Class DIALOG_IMPORTED_LAYERS_BASE.
std::vector< wxString > m_unmatched_layer_names
PCB_LAYER_ID GetAutoMatchLayerID(wxString aInputLayerName)
static wxString WrapRequired(const wxString &aLayerName)
wxListCtrl * m_unmatched_layers_list
void RemoveMappings(int aStatus)
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
PCB_LAYER_ID
A quick note on layer IDs:
LSET is a set of PCB_LAYER_IDs.
static wxString UnwrapRequired(const wxString &aLayerName)
std::vector< wxString > GetUnmappedRequiredLayers() const
Return a list of layers names that are required, but they are not mapped.
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
int LAYER_NUM
This can be replaced with int and removed.
DIALOG_IMPORTED_LAYERS(wxWindow *aParent, const std::vector< INPUT_LAYER_DESC > &aLayerDesc)
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
static std::map< wxString, PCB_LAYER_ID > GetMapModal(wxWindow *aParent, const std::vector< INPUT_LAYER_DESC > &aLayerDesc)
Creates and shows a dialog (modal) and returns the data from it after completion.
Board layer functions and definitions.
const INPUT_LAYER_DESC * GetLayerDescription(const wxString &aLayerName) const
wxListCtrl * m_kicad_layers_list
std::vector< INPUT_LAYER_DESC > m_input_layers
void OnAutoMatchLayersClicked(wxCommandEvent &event) override
std::map< wxString, PCB_LAYER_ID > m_matched_layers_map
PCB_LAYER_ID GetSelectedLayerID()
PCB_LAYER_ID ToLAYER_ID(int aLayer)
wxListCtrl * m_matched_layers_list