KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_create_net_chain.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 DIALOG_CREATE_NET_CHAIN_H
21#define DIALOG_CREATE_NET_CHAIN_H
22
24
25#include <set>
26#include <vector>
27#include <wx/string.h>
28#include <kiid.h>
29#include <math/box2.h>
30#include <sch_sheet_path.h>
31
32class SCH_EDIT_FRAME;
33class SCH_NETCHAIN;
34class SCH_SCREEN;
35class SCH_SYMBOL;
36
37
39{
40public:
45 {
46 wxString fromRef;
47 wxString toRef;
48 wxString netName;
49 };
50
51 DIALOG_CREATE_NET_CHAIN( SCH_EDIT_FRAME* aParent, const FOCUS_HINT& aHint = {} );
52
53 ~DIALOG_CREATE_NET_CHAIN() override;
54
55 bool TransferDataToWindow() override;
56 bool TransferDataFromWindow() override;
57
58protected:
59 void OnChainSelected( wxGridEvent& aEvent ) override;
60 void OnFilterChanged( wxCommandEvent& aEvent ) override;
61 void OnRefreshClicked( wxCommandEvent& aEvent ) override;
62 void OnFindPathClicked( wxCommandEvent& aEvent ) override;
63
64private:
98
99 void loadPotentials();
100 void rebuildGrid();
101 void updateMemberDetail( int aRow );
103
115 BOX2I highlightChainNets( const std::set<wxString>& aNets, SCH_SCREEN* aScreen );
116
125
129
133 void applyFocusHint();
134
135 int selectedRow() const;
136
142 void recalculateAndReload( bool aRunRecalculate );
143
144 bool validateAndCreate();
145
149 void autoSelectFirstRow();
150
153 std::vector<POTENTIAL_ROW> m_rows;
154 std::vector<int> m_filteredIndices;
156 bool m_rebuilding = false;
158};
159
160#endif // DIALOG_CREATE_NET_CHAIN_H
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
DIALOG_CREATE_NET_CHAIN_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Create Net Chain"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
void navigateAndHighlightChain(POTENTIAL_ROW &aRow)
Switch to the sheet owning aRow (if different from the current sheet), brighten the chain's nets ther...
BOX2I highlightChainNets(const std::set< wxString > &aNets, SCH_SCREEN *aScreen)
Walk aScreen and brighten/un-brighten items whose connection name is in aNets.
void applyFocusHint()
Apply the focus hint after rows are loaded — set the filter input, optionally trigger the existing tw...
std::vector< POTENTIAL_ROW > m_rows
void recalculateAndReload(bool aRunRecalculate)
Tear down row state, optionally trigger a connectivity recalculation, then reload rows and refresh th...
void autoSelectFirstRow()
Position the grid cursor on the first filtered row, sync the name input, run the member-detail update...
SCH_SHEET_PATH m_lastHighlightedSheet
empty when no prior highlight
void OnChainSelected(wxGridEvent &aEvent) override
void OnRefreshClicked(wxCommandEvent &aEvent) override
std::vector< int > m_filteredIndices
indices into m_rows shown in grid
void OnFindPathClicked(wxCommandEvent &aEvent) override
DIALOG_CREATE_NET_CHAIN(SCH_EDIT_FRAME *aParent, const FOCUS_HINT &aHint={})
void OnFilterChanged(wxCommandEvent &aEvent) override
const SCH_SHEET_PATH & findSheetForRow(POTENTIAL_ROW &aRow)
Resolve and cache the sheet path to navigate to for aRow.
Definition kiid.h:48
Schematic editor (Eeschema) main window.
A net chain is a collection of nets that are connected together through passive components.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Schematic symbol object.
Definition sch_symbol.h:76
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
Optional context derived from the user selection that opened the dialog.
wxString toRef
Second selected symbol reference, if any.
wxString fromRef
Selected symbol reference (or first of two)
wxString netName
Net name from a selected pin or wire/bus.
Row backing data for the chains grid.
SCH_SHEET_PATH cachedSheet
Lazily-resolved sheet to navigate to when this row is selected.
KIID forceFromUuid
For force-created rows without a livePtr.
SCH_NETCHAIN * livePtr
null for force-created manual rows