KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_imported_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 (C) 2020-2021 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 along
18 * with this program. If not, see <http://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_IMPORTED_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> GetMapModal( 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
60 static wxString WrapRequired( const wxString& aLayerName );
61 static wxString UnwrapRequired( const wxString& aLayerName );
62
63 //Event Handlers
64 void OnAutoMatchLayersClicked( wxCommandEvent& event ) override;
65
66 void OnUnMatchedDoubleClick( wxListEvent& event ) override { AddMappings(); }
67 void OnAddClicked( wxCommandEvent& event ) override { AddMappings(); }
68 void OnMatchedDoubleClick( wxListEvent& event ) override { RemoveMappings( selected ); }
69 void OnRemoveClicked( wxCommandEvent& event ) override { RemoveMappings( selected ); }
70 void OnRemoveAllClicked( wxCommandEvent& event ) override { RemoveMappings( allitems ); }
71
72 const int selected = wxLIST_STATE_SELECTED;
73 const int allitems = wxLIST_STATE_DONTCARE;
74
75 std::vector<INPUT_LAYER_DESC> m_input_layers;
76 std::vector<wxString> m_unmatched_layer_names;
77 std::map<wxString, PCB_LAYER_ID> m_matched_layers_map;
78};
79
80#endif // DIALOG_IMPORTED_LAYERS_H
Class DIALOG_IMPORTED_LAYERS_BASE.
std::map< wxString, PCB_LAYER_ID > m_matched_layers_map
static wxString WrapRequired(const wxString &aLayerName)
static wxString UnwrapRequired(const wxString &aLayerName)
std::vector< INPUT_LAYER_DESC > m_input_layers
const INPUT_LAYER_DESC * GetLayerDescription(const wxString &aLayerName) const
void OnMatchedDoubleClick(wxListEvent &event) override
void OnRemoveAllClicked(wxCommandEvent &event) override
void OnUnMatchedDoubleClick(wxListEvent &event) override
PCB_LAYER_ID GetAutoMatchLayerID(const wxString &aInputLayerName)
void OnAddClicked(wxCommandEvent &event) override
void OnAutoMatchLayersClicked(wxCommandEvent &event) override
std::vector< wxString > GetUnmappedRequiredLayers() const
Return a list of layers names that are required, but they are not mapped.
void OnRemoveClicked(wxCommandEvent &event) override
void DeleteListItems(const wxArrayInt &aRowsToDelete, wxListCtrl *aListCtrl)
static std::map< wxString, PCB_LAYER_ID > GetMapModal(wxWindow *aParent, const std::vector< INPUT_LAYER_DESC > &aLayerDesc)
Create and show a dialog (modal) and returns the data from it after completion.
std::vector< wxString > m_unmatched_layer_names
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
Describes an imported layer and how it could be mapped to KiCad Layers.