KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_setup_net_chains.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef PANEL_SETUP_NET_CHAINS_H
21#define PANEL_SETUP_NET_CHAINS_H
22
23#include <map>
24#include <set>
25#include <vector>
26#include <wx/string.h>
27#include <gal/color4d.h>
28
30
31class SCH_EDIT_FRAME;
32class SCH_NETCHAIN;
33
34
49{
50public:
51 PANEL_SETUP_NET_CHAINS( wxWindow* aParent, SCH_EDIT_FRAME* aFrame );
52
53 ~PANEL_SETUP_NET_CHAINS() override;
54
55 bool TransferDataToWindow() override;
56 bool TransferDataFromWindow() override;
57 bool Validate() override;
58
59 bool ApplyEdits();
60
61protected:
62 void OnDeleteChainClicked( wxCommandEvent& aEvent ) override;
63 void OnChainGridSelectionChanged( wxGridEvent& aEvent ) override;
64 void OnClassAddClicked( wxCommandEvent& aEvent ) override;
65 void OnClassRenameClicked( wxCommandEvent& aEvent ) override;
66 void OnClassDeleteClicked( wxCommandEvent& aEvent ) override;
67
68private:
77
83
84 struct CHAIN_ROW
85 {
86 bool deletePending = false;
87 wxString origName;
88 wxString newName;
89 wxString newChainClass;
90 wxString newNetClass;
93 std::set<wxString> memberNets;
94 };
95
96 struct CLASS_ROW
97 {
98 wxString origName;
99 wxString newName;
100 bool deletePending = false;
101 };
102
103 void loadFromModel();
104 void rebuildChainsGrid();
105 void rebuildClassesGrid();
108
109 int selectedChainRow() const;
110 int selectedClassRow() const;
111
112 bool nameInChainGridAlready( const wxString& aName, int aExceptRow ) const;
113 bool nameInClassGridAlready( const wxString& aName, int aExceptRow ) const;
114 void updateMembersDetail( int aRow );
115
117
118 std::vector<CHAIN_ROW> m_chainRows;
119 std::vector<int> m_gridToChainIdx;
120 std::vector<CLASS_ROW> m_classRows;
121};
122
123#endif // PANEL_SETUP_NET_CHAINS_H
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:105
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:402
PANEL_SETUP_NET_CHAINS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
PANEL_SETUP_NET_CHAINS(wxWindow *aParent, SCH_EDIT_FRAME *aFrame)
void OnClassDeleteClicked(wxCommandEvent &aEvent) override
std::vector< CHAIN_ROW > m_chainRows
void OnClassAddClicked(wxCommandEvent &aEvent) override
bool nameInChainGridAlready(const wxString &aName, int aExceptRow) const
void OnChainGridSelectionChanged(wxGridEvent &aEvent) override
std::vector< CLASS_ROW > m_classRows
void OnClassRenameClicked(wxCommandEvent &aEvent) override
void OnDeleteChainClicked(wxCommandEvent &aEvent) override
bool nameInClassGridAlready(const wxString &aName, int aExceptRow) const
std::vector< int > m_gridToChainIdx
Schematic editor (Eeschema) main window.
A net chain is a collection of nets that are connected together through passive components.