KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_net_inspector.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 Oleg Endo <[email protected]>
5 * Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
6 * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#pragma once
27
28#include <board.h>
29#include <optional>
31
32class PCB_EDIT_FRAME;
33class NETINFO_ITEM;
34class BOARD;
35class BOARD_ITEM;
36class CN_ITEM;
38class PCB_TRACK;
39
43wxDECLARE_EVENT( EDA_EVT_CLOSE_NET_INSPECTOR_DIALOG, wxCommandEvent );
44
46{
47public:
48 struct SETTINGS
49 {
50 wxString filter_string;
51 bool show_zero_pad_nets = true;
52 bool group_by = false;
54 wxString group_by_text;
56 bool sort_order_asc = true;
57
58 std::vector<int> column_order;
59 };
60
63
64 virtual void OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
65 virtual void OnBoardItemsAdded( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) override;
66 virtual void OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
67 virtual void OnBoardItemsRemoved( BOARD& aBoard,
68 std::vector<BOARD_ITEM*>& aBoardItems ) override;
69 virtual void OnBoardNetSettingsChanged( BOARD& aBoard ) override;
70 virtual void OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
71 virtual void OnBoardItemsChanged( BOARD& aBoard,
72 std::vector<BOARD_ITEM*>& aBoardItems ) override;
73 virtual void OnBoardHighlightNetChanged( BOARD& aBoard ) override;
74
75protected:
76 virtual void onClose( wxCloseEvent& aEvent ) override;
77
78private:
79 struct COLUMN_DESC;
80 class LIST_ITEM;
82
83 using LIST_ITEM_ITER = std::vector<std::unique_ptr<LIST_ITEM>>::iterator;
84 using LIST_ITEM_CONST_ITER = std::vector<std::unique_ptr<LIST_ITEM>>::const_iterator;
85
86 wxString formatNetCode( const NETINFO_ITEM* aNet ) const;
87 wxString formatNetName( const NETINFO_ITEM* aNet ) const;
88 wxString formatCount( unsigned int aValue ) const;
89 wxString formatLength( int64_t aValue ) const;
90
91 std::vector<CN_ITEM*> relevantConnectivityItems() const;
92 bool netFilterMatches( NETINFO_ITEM* aNet ) const;
93 void updateNet( NETINFO_ITEM* aNet );
94 unsigned int calculateViaLength( const PCB_TRACK* ) const;
95
96 void onSelChanged( wxDataViewEvent& event ) override;
97 void onSelChanged();
98 void onSortingChanged( wxDataViewEvent& event ) override;
99 void onFilterChange( wxCommandEvent& event ) override;
100 void onListSize( wxSizeEvent& event ) override;
101 void onAddNet( wxCommandEvent& event ) override;
102 void onRenameNet( wxCommandEvent& event ) override;
103 void onDeleteNet( wxCommandEvent& event ) override;
104 void onReport( wxCommandEvent& event ) override;
105
106 std::unique_ptr<LIST_ITEM> buildNewItem( NETINFO_ITEM* aNet, unsigned int aPadCount,
107 const std::vector<CN_ITEM*>& aCNItems );
108
109 void buildNetsList();
110 void adjustListColumns();
111
112 void onUnitsChanged( wxCommandEvent& event );
113 void onBoardChanged( wxCommandEvent& event );
114
115 void updateDisplayedRowValues( const std::optional<LIST_ITEM_ITER>& aRow );
116
117 // special zero-netcode item. unconnected pads etc might use different
118 // (dummy) NETINFO_ITEM. redirect all of them to this item, which we get
119 // from the board object in buildNetsList.
121
122 std::vector<std::unique_ptr<EDA_PATTERN_MATCH>> m_netFilter;
123 std::vector<std::unique_ptr<EDA_PATTERN_MATCH>> m_groupFilter;
124
129 wxSize m_size;
130
131 std::vector<COLUMN_DESC> m_columns;
132
133 class DATA_MODEL;
134 wxObjectDataPtr<DATA_MODEL> m_data_model;
135
137};
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:77
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:271
CN_ITEM represents a BOARD_CONNETED_ITEM in the connectivity system (ie: a pad, track/arc/via,...
Class DIALOG_NET_INSPECTOR_BASE.
void onUnitsChanged(wxCommandEvent &event)
wxString formatNetName(const NETINFO_ITEM *aNet) const
void onDeleteNet(wxCommandEvent &event) override
virtual void OnBoardHighlightNetChanged(BOARD &aBoard) override
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem) override
virtual void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aBoardItem) override
void updateNet(NETINFO_ITEM *aNet)
virtual void OnBoardNetSettingsChanged(BOARD &aBoard) override
std::vector< std::unique_ptr< LIST_ITEM > >::const_iterator LIST_ITEM_CONST_ITER
virtual void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems) override
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_groupFilter
void onAddNet(wxCommandEvent &event) override
virtual void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aBoardItem) override
void onReport(wxCommandEvent &event) override
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems) override
void updateDisplayedRowValues(const std::optional< LIST_ITEM_ITER > &aRow)
virtual void onClose(wxCloseEvent &aEvent) override
virtual void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems) override
void onListSize(wxSizeEvent &event) override
std::vector< CN_ITEM * > relevantConnectivityItems() const
wxObjectDataPtr< DATA_MODEL > m_data_model
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_netFilter
void onRenameNet(wxCommandEvent &event) override
wxString formatLength(int64_t aValue) const
std::unique_ptr< LIST_ITEM > buildNewItem(NETINFO_ITEM *aNet, unsigned int aPadCount, const std::vector< CN_ITEM * > &aCNItems)
void onFilterChange(wxCommandEvent &event) override
bool netFilterMatches(NETINFO_ITEM *aNet) const
void onSortingChanged(wxDataViewEvent &event) override
unsigned int calculateViaLength(const PCB_TRACK *) const
wxString formatNetCode(const NETINFO_ITEM *aNet) const
std::vector< std::unique_ptr< LIST_ITEM > >::iterator LIST_ITEM_ITER
std::vector< COLUMN_DESC > m_columns
wxString formatCount(unsigned int aValue) const
void onBoardChanged(wxCommandEvent &event)
Handle the data for a net.
Definition: netinfo.h:67
The main frame for Pcbnew.
wxDECLARE_EVENT(EDA_EVT_CLOSE_NET_INSPECTOR_DIALOG, wxCommandEvent)
Event sent to parent when dialog is mode-less.