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:
50
51 virtual void OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
52 virtual void OnBoardItemsAdded( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) override;
53 virtual void OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
54 virtual void OnBoardItemsRemoved( BOARD& aBoard,
55 std::vector<BOARD_ITEM*>& aBoardItems ) override;
56 virtual void OnBoardNetSettingsChanged( BOARD& aBoard ) override;
57 virtual void OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
58 virtual void OnBoardItemsChanged( BOARD& aBoard,
59 std::vector<BOARD_ITEM*>& aBoardItems ) override;
60 virtual void OnBoardHighlightNetChanged( BOARD& aBoard ) override;
61
62protected:
63 virtual void onClose( wxCloseEvent& aEvent ) override;
64
65private:
66 struct COLUMN_DESC;
67 class LIST_ITEM;
69
70 using LIST_ITEM_ITER = std::vector<std::unique_ptr<LIST_ITEM>>::iterator;
71 using LIST_ITEM_CONST_ITER = std::vector<std::unique_ptr<LIST_ITEM>>::const_iterator;
72
73 wxString formatNetCode( const NETINFO_ITEM* aNet ) const;
74 wxString formatNetName( const NETINFO_ITEM* aNet ) const;
75 wxString formatCount( unsigned int aValue ) const;
76 wxString formatLength( int64_t aValue ) const;
77
78 std::vector<CN_ITEM*> relevantConnectivityItems() const;
79 bool netFilterMatches( NETINFO_ITEM* aNet ) const;
80 void updateNet( NETINFO_ITEM* aNet );
81 unsigned int calculateViaLength( const PCB_TRACK* ) const;
82
83 void onSelChanged( wxDataViewEvent& event ) override;
84 void onSelChanged();
85 void onSortingChanged( wxDataViewEvent& event ) override;
86 void onFilterChange( wxCommandEvent& event ) override;
87 void onAddNet( wxCommandEvent& event ) override;
88 void onRenameNet( wxCommandEvent& event ) override;
89 void onDeleteNet( wxCommandEvent& event ) override;
90 void onReport( wxCommandEvent& event ) override;
91
92 std::unique_ptr<LIST_ITEM> buildNewItem( NETINFO_ITEM* aNet, unsigned int aPadCount,
93 const std::vector<CN_ITEM*>& aCNItems );
94
95 void buildNetsList();
97 void adjustListColumns();
98
99 void onUnitsChanged( wxCommandEvent& event );
100 void onBoardChanged( wxCommandEvent& event );
101
102 void updateDisplayedRowValues( const std::optional<LIST_ITEM_ITER>& aRow );
103
104 // special zero-netcode item. unconnected pads etc might use different
105 // (dummy) NETINFO_ITEM. redirect all of them to this item, which we get
106 // from the board object in buildNetsList.
108
109 std::vector<std::unique_ptr<EDA_PATTERN_MATCH>> m_netFilter;
110 std::vector<std::unique_ptr<EDA_PATTERN_MATCH>> m_groupFilter;
111
114 bool m_in_reporting = false;
117 wxSize m_size;
118
119 std::vector<COLUMN_DESC> m_columns;
120
121 class DATA_MODEL;
122 wxObjectDataPtr<DATA_MODEL> m_data_model;
123
125};
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:276
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
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:56
The main frame for Pcbnew.
wxDECLARE_EVENT(EDA_EVT_CLOSE_NET_INSPECTOR_DIALOG, wxCommandEvent)
Event sent to parent when dialog is mode-less.