KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_map_layers.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020 Roberto Fernandez Bautista <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef DIALOG_IMPORTED_LAYERS_H
22#define DIALOG_IMPORTED_LAYERS_H
23
26
27
29{
30public:
31 DIALOG_MAP_LAYERS( wxWindow* aParent, const std::vector<INPUT_LAYER_DESC>& aLayerDesc );
32
36 std::vector<wxString> GetUnmappedRequiredLayers() const;
37
46 static std::map<wxString, PCB_LAYER_ID> RunModal( wxWindow* aParent,
47 const std::vector<INPUT_LAYER_DESC>& aLayerDesc );
48
49private:
50 //Helper functions
52 PCB_LAYER_ID GetAutoMatchLayerID( const wxString& aInputLayerName );
53
54 void AddMappings();
55 void RemoveMappings( int aStatus );
56 void DeleteListItems( const wxArrayInt& aRowsToDelete, wxListCtrl* aListCtrl );
57
58 const INPUT_LAYER_DESC* GetLayerDescription( const wxString& aLayerName ) const;
59
61 wxString KiCadLayerName( PCB_LAYER_ID aLayer ) const;
62
63 static wxString WrapRequired( const wxString& aLayerName );
64 static wxString UnwrapRequired( const wxString& aLayerName );
65
66 //Event Handlers
67 void OnAutoMatchLayersClicked( wxCommandEvent& event ) override;
68
69 void OnUnMatchedDoubleClick( wxListEvent& event ) override { AddMappings(); }
70 void OnAddClicked( wxCommandEvent& event ) override { AddMappings(); }
71 void OnMatchedDoubleClick( wxListEvent& event ) override { RemoveMappings( selected ); }
72 void OnRemoveClicked( wxCommandEvent& event ) override { RemoveMappings( selected ); }
73 void OnRemoveAllClicked( wxCommandEvent& event ) override { RemoveMappings( allitems ); }
74
75 const int selected = wxLIST_STATE_SELECTED;
76 const int allitems = wxLIST_STATE_DONTCARE;
77
78 BOARD* m_board = nullptr;
79 std::vector<INPUT_LAYER_DESC> m_input_layers;
80 std::vector<wxString> m_unmatched_layer_names;
81 std::map<wxString, PCB_LAYER_ID> m_matched_layers_map;
82
83};
84
85#endif // DIALOG_IMPORTED_LAYERS_H
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
DIALOG_IMPORTED_LAYERS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Edit Mapping of Imported Layers"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
std::vector< wxString > GetUnmappedRequiredLayers() const
Return a list of layers names that are required, but they are not mapped.
const INPUT_LAYER_DESC * GetLayerDescription(const wxString &aLayerName) const
void RemoveMappings(int aStatus)
void OnAutoMatchLayersClicked(wxCommandEvent &event) override
std::vector< INPUT_LAYER_DESC > m_input_layers
void OnRemoveAllClicked(wxCommandEvent &event) override
std::vector< wxString > m_unmatched_layer_names
static wxString UnwrapRequired(const wxString &aLayerName)
void OnUnMatchedDoubleClick(wxListEvent &event) override
std::map< wxString, PCB_LAYER_ID > m_matched_layers_map
void OnAddClicked(wxCommandEvent &event) override
PCB_LAYER_ID GetSelectedLayerID()
static std::map< wxString, PCB_LAYER_ID > RunModal(wxWindow *aParent, const std::vector< INPUT_LAYER_DESC > &aLayerDesc)
Create and show a dialog (modal) and returns the data from it after completion.
wxString KiCadLayerName(PCB_LAYER_ID aLayer) const
KiCad layer name to display, using the destination board's names when available.
DIALOG_MAP_LAYERS(wxWindow *aParent, const std::vector< INPUT_LAYER_DESC > &aLayerDesc)
void OnMatchedDoubleClick(wxListEvent &event) override
PCB_LAYER_ID GetAutoMatchLayerID(const wxString &aInputLayerName)
void OnRemoveClicked(wxCommandEvent &event) override
static wxString WrapRequired(const wxString &aLayerName)
void DeleteListItems(const wxArrayInt &aRowsToDelete, wxListCtrl *aListCtrl)
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
Describes an imported layer and how it could be mapped to KiCad Layers.