40#include <wx/wupdlock.h>
41#include <wx/filedlg.h>
47 m_zero_netitem( nullptr ),
59 if(
m_brd !=
nullptr )
73 m_netsList->Bind( wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK,
75 m_netsList->Bind( wxEVT_DATAVIEW_ITEM_CONTEXT_MENU,
77 m_netsList->Bind( wxEVT_DATAVIEW_ITEM_ACTIVATED,
79 m_netsList->Bind( wxEVT_DATAVIEW_COLUMN_SORTED,
95 m_netsList->Unbind( wxEVT_DATAVIEW_ITEM_COLLAPSED,
97 m_netsList->Unbind( wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK,
99 m_netsList->Unbind( wxEVT_DATAVIEW_ITEM_CONTEXT_MENU,
101 m_netsList->Unbind( wxEVT_DATAVIEW_ITEM_ACTIVATED,
103 m_netsList->Unbind( wxEVT_DATAVIEW_COLUMN_SORTED,
137 std::vector<std::function<void(
void )>> add_col{
143 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE );
150 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE
151 | wxDATAVIEW_COL_SORTABLE );
158 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE
159 | wxDATAVIEW_COL_SORTABLE );
166 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE
167 | wxDATAVIEW_COL_SORTABLE );
174 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE
175 | wxDATAVIEW_COL_SORTABLE );
182 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE
183 | wxDATAVIEW_COL_SORTABLE );
190 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE
191 | wxDATAVIEW_COL_SORTABLE );
198 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE
199 | wxDATAVIEW_COL_SORTABLE );
230 if( (
int) cfg->
col_order.size() != totalNumColumns
231 || (
int) cfg->
col_hidden.size() != totalNumColumns )
233 cfg->
col_order.resize( totalNumColumns );
236 for(
int i = 0; i < totalNumColumns; ++i )
245 if( col_order_set.size() != cfg->
col_order.size() )
247 for( std::size_t i = 0; i < cfg->
col_order.size(); ++i )
262 for( std::size_t i = 0; i < cfg->
col_order.size(); ++i )
264 const int addModelColumn = cfg->
col_order[i];
266 if( addModelColumn >= (
int) add_col.size() )
269 m_columns[addModelColumn], wxDATAVIEW_CELL_INERT, -1,
271 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE
272 | wxDATAVIEW_COL_SORTABLE );
302 int minValueWidth = GetTextExtent( wxT(
"00000,000 mm" ) ).x;
303 int minNumberWidth = GetTextExtent( wxT(
"000" ) ).x;
304 int minNameWidth = GetTextExtent( wxT(
"MMMMMMMMMMMM" ) ).x;
310 const int margins = 15;
311 const int extra_width = 30;
313 auto getTargetWidth =
318 case COLUMN_NAME:
return minNameWidth + extra_width;
322 default:
return minValueWidth + margins;
328 for(
size_t i = 0; i <
m_columns.size(); ++i )
330 const int modelColumn = cfg->
col_order[i];
331 int titleSize = GetTextExtent(
m_columns[modelColumn].display_name ).x;
332 titleSize = modelColumn ==
COLUMN_NAME ? titleSize + extra_width : titleSize + margins;
333 const int valSize = getTargetWidth( modelColumn );
334 m_netsList->GetColumn( i )->SetWidth( std::max( titleSize, valSize ) );
342 for(
size_t ii = 0; ii <
m_columns.size(); ++ii )
346 m_netsList->GetColumn( ii )->SetWidth( std::max( newWidth, 10 ) );
357 if( sortingColumnId != -1 )
361 col->SetSortOrder( sortOrderAsc );
373 for(
unsigned int i = 0; i <
m_netsList->GetColumnCount(); ++i )
375 wxDataViewColumn* col =
m_netsList->GetColumn( i );
377 if( (
int) col->GetModelColumn() == columnId )
419 auto& [groupName, groupItem] : groupItems )
427 wxDataViewItemArray sel;
430 std::vector<int> prev_selected_netcodes;
431 prev_selected_netcodes.reserve( sel.GetCount() );
433 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
436 prev_selected_netcodes.push_back( item->
GetNetCode() );
442 if( wxDataViewColumn* sorting_column =
m_netsList->GetSortingColumn() )
446 sorting_column_id =
static_cast<int>( sorting_column->GetModelColumn() );
447 sort_order_asc = sorting_column->IsSortOrderAscending();
451 sorting_column->UnsetAsSortKey();
469 std::vector<std::unique_ptr<LIST_ITEM>> new_items;
477 unsigned int pad_count;
480 struct NET_INFO_CMP_LESS
482 bool operator()(
const NET_INFO& a,
const NET_INFO& b )
const
484 return a.netcode < b.netcode;
486 bool operator()(
const NET_INFO& a,
int b )
const {
return a.netcode < b; }
487 bool operator()(
int a,
const NET_INFO& b )
const {
return a < b.netcode; }
490 std::vector<NET_INFO> nets;
499 nets.emplace_back( NET_INFO{ ni.first, ni.second, 0 } );
506 for(
PAD*
pad : footprint->Pads() )
508 auto i = std::lower_bound( nets.begin(), nets.end(),
pad->GetNetCode(),
509 NET_INFO_CMP_LESS() );
511 if( i != nets.end() && i->netcode ==
pad->GetNetCode() )
516 for( NET_INFO& ni : nets )
519 new_items.emplace_back(
buildNewItem( ni.net, ni.pad_count, prefiltered_cn_items ) );
536 std::vector<std::pair<wxString, wxDataViewItem>> groupItems =
542 [&groupName](
const std::pair<wxString, wxDataViewItem>& item )
544 return groupName == item.first;
547 auto tableItem = std::find_if( groupItems.begin(), groupItems.end(), pred );
549 if( tableItem != groupItems.end() )
559 for(
int& nc : prev_selected_netcodes )
561 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem( nc );
565 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
566 sel.Add( wxDataViewItem( list_item.get() ) );
608 bool matched =
false;
611 if( filterString.Length() == 0 )
615 if( !matched && cfg->
filter_by_netclass && netClassName.Find( filterString ) != wxNOT_FOUND )
619 if( !matched && cfg->
filter_by_net_name && netName.Find( filterString ) != wxNOT_FOUND )
626 matched = !netName.StartsWith( wxT(
"UNCONNECTED-(" ) );
643std::unique_ptr<PCB_NET_INSPECTOR_PANEL::LIST_ITEM>
645 const std::vector<CN_ITEM*>& aCNItems )
647 std::unique_ptr<LIST_ITEM> new_item = std::make_unique<LIST_ITEM>( aNet );
649 new_item->SetPadCount( aPadCount );
652 const auto cn_items = std::equal_range( aCNItems.begin(), aCNItems.end(), aNet->
GetNetCode(),
655 for(
auto i = cn_items.first; i != cn_items.second; ++i )
661 new_item->AddPadDieLength(
static_cast<PAD*
>( item )->GetPadToDieLength() );
665 new_item->AddLayerWireLength( track->GetLength(), track->GetLayer() );
669 new_item->AddViaCount( 1 );
684 const auto type_bits = std::bitset<MAX_STRUCT_TYPE_ID>()
690 std::vector<CN_ITEM*> cn_items;
691 cn_items.reserve( 1024 );
695 if( cn_item->Valid() && type_bits[cn_item->Parent()->Type()] )
696 cn_items.push_back( cn_item );
738 top_layer =
via->TopLayer();
740 bottom_layer =
via->BottomLayer();
750 int effectiveBottomLayer;
752 if(
via->BottomLayer() ==
B_Cu )
753 effectiveBottomLayer =
F_Cu + dielectricLayers;
755 effectiveBottomLayer =
via->BottomLayer();
757 int layerCount = effectiveBottomLayer -
via->TopLayer();
759 return layerCount * layerThickness;
776 std::optional<LIST_ITEM_ITER> cur_net_row =
m_data_model->findItem( aNet );
786 std::unique_ptr<LIST_ITEM> new_list_item =
buildNewItem( aNet, node_count,
795 const std::unique_ptr<LIST_ITEM>& cur_list_item = *cur_net_row.value();
797 if( cur_list_item->GetNetName() != new_list_item->GetNetName() )
807 cur_list_item->SetPadCount( new_list_item->GetPadCount() );
808 cur_list_item->SetViaCount( new_list_item->GetViaCount() );
809 cur_list_item->SetLayerWireLength( new_list_item->GetLayerWireLength() );
810 cur_list_item->SetPadDieLength( new_list_item->GetPadDieLength() );
826 return wxString::Format( wxT(
"%.3d" ), aNet->
GetNetCode() );
838 return wxString::Format( wxT(
"%u" ), aValue );
855 wxDataViewItemArray sel;
896 if( !IsShownOnScreen() )
906 std::unique_ptr<LIST_ITEM> new_item = std::make_unique<LIST_ITEM>( net );
917 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem( i->GetNet() );
924 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
925 int len = track->GetLength();
927 list_item->AddLayerWireLength( len, track->GetLayer() );
931 list_item->AddViaCount( 1 );
945 for(
const PAD*
pad : footprint->Pads() )
947 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem(
pad->GetNet() );
957 r =
m_data_model->addItem( std::make_unique<LIST_ITEM>(
pad->GetNet() ) );
962 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
963 int len =
pad->GetPadToDieLength();
965 list_item->AddPadCount( 1 );
966 list_item->AddPadDieLength( len );
980 std::vector<BOARD_ITEM*>& aBoardItems )
982 if( !IsShownOnScreen() )
988 if( aBoardItems.size() > threshold )
1005 if( !IsShownOnScreen() )
1014 for(
const PAD*
pad : footprint->Pads() )
1016 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem(
pad->GetNet() );
1020 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
1021 int len =
pad->GetPadToDieLength();
1023 list_item->SubPadCount( 1 );
1024 list_item->SubPadDieLength( len );
1035 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem( i->GetNet() );
1042 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
1043 int len = track->GetLength();
1045 list_item->SubLayerWireLength( len, track->GetLayer() );
1049 list_item->SubViaCount( 1 );
1065 std::vector<BOARD_ITEM*>& aBoardItems )
1067 if( !IsShownOnScreen() )
1072 if( aBoardItems.size() > threshold )
1089 if( !IsShownOnScreen() )
1099 if( !IsShownOnScreen() )
1103 ||
dynamic_cast<FOOTPRINT*
>( aBoardItem ) !=
nullptr )
1112 std::vector<BOARD_ITEM*>& aBoardItems )
1114 if( !IsShownOnScreen() )
1123 std::vector<BOARD_ITEM*>& aAddedItems,
1124 std::vector<BOARD_ITEM*>& aRemovedItems,
1125 std::vector<BOARD_ITEM*>& aChangedItems )
1127 if( !IsShownOnScreen() )
1135 if( aChangedItems.size() > 0 || aAddedItems.size() > threshold
1136 || aRemovedItems.size() > threshold )
1163 wxDataViewItemArray new_selection;
1164 new_selection.Alloc( selected_codes.size() );
1166 for(
int code : selected_codes )
1168 if( std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem( code ) )
1169 new_selection.Add( wxDataViewItem( &***r ) );
1174 if( !new_selection.IsEmpty() )
1175 m_netsList->EnsureVisible( new_selection.Item( 0 ) );
1195 bool multipleSelections =
false;
1198 if(
m_netsList->GetSelectedItemsCount() == 1 )
1204 if(
m_netsList->GetSelectedItemsCount() > 1 )
1205 multipleSelections =
true;
1212 _(
"Highlight Selected Net" ),
1213 wxEmptyString, wxITEM_NORMAL );
1217 _(
"Clear Net Highlighting" ),
1218 wxEmptyString, wxITEM_NORMAL );
1219 menu.Append( clearHighlighting );
1224 if( selected_codes.size() == 0 )
1225 clearHighlighting->Enable(
false );
1227 menu.AppendSeparator();
1229 wxMenuItem* renameNet =
new wxMenuItem( &menu,
ID_RENAME_NET,
_(
"Rename Selected Net" ),
1230 wxEmptyString, wxITEM_NORMAL );
1231 menu.Append( renameNet );
1233 wxMenuItem* deleteNet =
new wxMenuItem( &menu,
ID_DELETE_NET,
_(
"Delete Selected Net" ),
1234 wxEmptyString, wxITEM_NORMAL );
1235 menu.Append( deleteNet );
1237 menu.AppendSeparator();
1239 wxMenuItem* addNet =
new wxMenuItem( &menu,
ID_ADD_NET,
_(
"Add Net" ),
1240 wxEmptyString, wxITEM_NORMAL );
1241 menu.Append( addNet );
1243 if( !selItem && !multipleSelections )
1246 deleteNet->Enable(
false );
1247 renameNet->Enable(
false );
1251 if( multipleSelections || selItem->
GetIsGroup() )
1253 highlightNet->SetItemLabel(
_(
"Highlight Selected Nets" ) );
1254 renameNet->Enable(
false );
1255 deleteNet->SetItemLabel(
_(
"Delete Selected Nets" ) );
1259 menu.AppendSeparator();
1262 _(
"Remove Selected Custom Group" ),
1263 wxEmptyString, wxITEM_NORMAL );
1264 menu.Append( removeSelectedGroup );
1267 removeSelectedGroup->Enable(
false );
1284 wxString newGroupName;
1288 wxStaticText*
help =
new wxStaticText( &dlg, wxID_ANY,
1289 _(
"(Use /.../ to indicate a regular expression.)" ) );
1293 dlg.GetSizer()->SetSizeHints( &dlg );
1300 if( newGroupName ==
"" )
1304 [&]( std::unique_ptr<EDA_COMBINED_MATCHER>& rule )
1306 return rule->GetPattern().Upper() == newGroupName.Upper();
1353 if(
m_netsList->GetSelectedItemsCount() == 1 )
1362 _(
"Filter by Net Name" ),
1363 wxEmptyString, wxITEM_CHECK );
1364 menu.Append( filterByNetName );
1365 filterByNetName->Check( cfg.filter_by_net_name );
1368 _(
"Filter by Netclass" ),
1369 wxEmptyString, wxITEM_CHECK );
1370 menu.Append( filterByNetclass );
1371 filterByNetclass->Check( cfg.filter_by_netclass );
1373 menu.AppendSeparator();
1383 _(
"Group by Netclass" ),
1384 wxEmptyString, wxITEM_CHECK );
1385 menu.Append( groupNetclass );
1388 menu.AppendSeparator();
1390 wxMenuItem* addGroup =
new wxMenuItem( &menu,
ID_ADD_GROUP,
_(
"Add Custom Group" ),
1391 wxEmptyString, wxITEM_NORMAL );
1392 menu.Append( addGroup );
1395 _(
"Remove Selected Custom Group" ),
1396 wxEmptyString, wxITEM_NORMAL );
1397 menu.Append( removeSelectedGroup );
1400 removeSelectedGroup->Enable(
false );
1403 _(
"Remove All Custom Groups" ),
1404 wxEmptyString, wxITEM_NORMAL );
1405 menu.Append( removeCustomGroups );
1408 menu.AppendSeparator();
1411 _(
"Show Zero Pad Nets" ),
1412 wxEmptyString, wxITEM_CHECK );
1413 menu.Append( showZeroNetPads );
1417 _(
"Show Unconnected Nets" ),
1418 wxEmptyString, wxITEM_CHECK );
1419 menu.Append( showUnconnectedNets );
1422 menu.AppendSeparator();
1426 _(
"Save Net Inspector Report" ),
1427 wxEmptyString, wxITEM_NORMAL );
1430 menu.AppendSeparator();
1433 wxMenu* colsMenu =
new wxMenu();
1435 menu.AppendSubMenu( colsMenu,
_(
"Show / Hide Columns" ) );
1448 wxEmptyString, wxITEM_CHECK );
1450 target->Append( opt );
1451 opt->Check( !col->IsHidden() );
1454 target->AppendSeparator();
1459 wxEmptyString, wxITEM_CHECK );
1461 target->Append( opt );
1462 opt->Check( !col->IsHidden() );
1469 bool saveAndRebuild =
true;
1471 switch( event.GetId() )
1523 saveAndRebuild =
false;
1528 saveAndRebuild =
false;
1533 saveAndRebuild =
false;
1542 col->SetWidth( std::max( col->GetWidth(), 10 ) );
1543 col->SetHidden( !col->IsHidden() );
1548 if( saveAndRebuild )
1558 if(
m_netsList->GetSelectedItemsCount() == 1 )
1562 if( selItem->GetIsGroup() )
1566 [&]( std::unique_ptr<EDA_COMBINED_MATCHER>& rule )
1568 return rule->GetPattern() == groupName;
1584 wxFileDialog dlg(
this,
_(
"Save Net Inspector Report File" ),
"",
"",
1586 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1588 if( dlg.ShowModal() == wxID_CANCEL )
1591 wxTextFile f( dlg.GetPath() );
1606 txt += wxString::Format(
_(
"%s (%s)" ),
1612 txt += col.csv_name;
1615 txt += wxT(
"\";" );
1621 const unsigned int num_rows =
m_data_model->itemCount();
1623 for(
unsigned int row = 0; row < num_rows; row++ )
1627 if( i.GetIsGroup() || i.GetNetCode() == 0 )
1635 txt +=
'"' +
m_data_model->valueAt( col.num, row ).GetString() + wxT(
"\";" );
1637 txt +=
m_data_model->valueAt( col.num, row ).GetString() +
';';
1668 wxDataViewItemArray sel;
1673 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
1680 renderSettings->
SetHighlight(
true, ( *c )->GetNetCode(), true );
1717 wxString newNetName;
1733 wxString::Format(
_(
"Net name '%s' is already in use." ), newNetName ) );
1734 newNetName = wxEmptyString;
1753 if(
m_netsList->GetSelectedItemsCount() == 1 )
1763 wxString shortNetName;
1765 if( fullNetName.Contains( wxT(
"/" ) ) )
1767 netPath = fullNetName.BeforeLast(
'/' ) +
'/';
1768 shortNetName = fullNetName.AfterLast(
'/' );
1772 shortNetName = fullNetName;
1786 unescapedShortName = dlg.
GetValue();
1788 if( unescapedShortName.IsEmpty() )
1790 DisplayError(
this, wxString::Format(
_(
"Net name cannot be empty." ),
1791 unescapedShortName ) );
1796 fullNetName = netPath + shortNetName;
1800 DisplayError(
this, wxString::Format(
_(
"Net name '%s' is already in use." ),
1801 unescapedShortName ) );
1802 unescapedShortName = wxEmptyString;
1812 if( boardItem->GetNet() == net )
1828 boardItem->SetNet( net );
1833 if( std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem( net ) )
1834 m_netsList->Select( wxDataViewItem( r.value()->get() ) );
1852 wxDataViewItemArray sel;
1855 auto delete_one = [
this](
const LIST_ITEM* i )
1857 if( i->GetPadCount() == 0
1858 ||
IsOK(
this, wxString::Format(
_(
"Net '%s' is in use. Delete anyway?" ),
1859 i->GetNetName() ) ) )
1863 int removedCode = i->GetNetCode();
1870 if( boardItem && boardItem->GetNetCode() == removedCode )
1877 text->ClearRenderCache();
1878 text->ClearBoundingBoxCache();
1892 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
1899 &&
IsOK(
this, wxString::Format(
_(
"Delete all nets in group '%s'?" ),
1904 std::vector<const LIST_ITEM*> children;
1968 wxDataViewColumn* sortingCol =
m_netsList->GetSortingColumn();
1969 cfg.sorting_column = sortingCol ?
static_cast<int>( sortingCol->GetModelColumn() ) : -1;
1970 cfg.sort_order_asc = sortingCol ? sortingCol->IsSortOrderAscending() :
true;
1977 for(
unsigned int ii = 0; ii <
m_data_model->columnCount(); ++ii )
1979 cfg.col_order[ii] = (int)
m_netsList->GetColumn( ii )->GetModelColumn();
1980 cfg.col_widths[ii] =
m_netsList->GetColumn( ii )->GetWidth();
1981 cfg.col_hidden[ii] =
m_netsList->GetColumn( ii )->IsHidden();
1985 cfg.expanded_rows.clear();
1986 std::vector<std::pair<wxString, wxDataViewItem>> groupItems =
1989 for( std::pair<wxString, wxDataViewItem>& item : groupItems )
1992 cfg.expanded_rows.push_back( item.first );
1996 cfg.custom_group_rules.clear();
1999 cfg.custom_group_rules.push_back( rule->GetPattern() );
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
Container for design settings for a BOARD object.
LSET GetEnabledLayers() const
Return a bit-mask of all the layers that are enabled.
int GetBoardThickness() const
The full thickness of the board including copper and masks.
BOARD_STACKUP & GetStackupDescriptor()
int GetCopperLayerCount() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Manage layers needed to make a physical board.
int GetLayerDistance(PCB_LAYER_ID aFirstLayer, PCB_LAYER_ID aSecondLayer) const
Calculate the distance (height) between the two given copper layers.
Information pertinent to a Pcbnew printed circuit board.
const NETINFO_LIST & GetNetInfo() const
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
const std::set< int > & GetHighLightNetCodes() const
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
void AddListener(BOARD_LISTENER *aListener)
Add a listener to the board to receive calls whenever something on the board has been modified.
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
int GetCopperLayerCount() const
const FOOTPRINTS & Footprints() const
unsigned GetNodesCount(int aNet=-1) const
bool IsHighLightNetON() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
CN_ITEM represents a BOARD_CONNETED_ITEM in the connectivity system (ie: a pad, track/arc/via,...
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
KICAD_T Type() const
Returns the type of object.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const std::set< int > & GetHighlightNetCodes() const
Return the netcode of currently highlighted net.
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
An abstract base class for deriving all objects that can be added to a VIEW.
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
LSET is a set of PCB_LAYER_IDs.
copper_layers_iterator copper_layers_end() const
copper_layers_iterator copper_layers_begin() const
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
A collection of nets and the parameters used to route or test these nets.
const wxString GetName() const
Gets the name of this (maybe aggregate) netclass in a format for internal usage or for export to exte...
Handle the data for a net.
void SetNetname(const wxString &aNewName)
Set the long netname to aNetName, the short netname to the last token in the long netname's path,...
const wxString & GetNetname() const
const NETCODES_MAP & NetsByNetcode() const
Return the netcode map, at least for python.
A base class used to implement docking net inspector panels.
wxDataViewCtrl * m_netsList
wxSearchCtrl * m_searchCtrl
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
The main frame for Pcbnew.
void OnModify() override
Must be called after a board change to set the modified flag.
Data model for display in the Net Inspector panel.
std::vector< std::pair< wxString, wxDataViewItem > > getGroupDataViewItems()
Primary data item for entries in the Net Inspector list.
auto ChildrenBegin() const
unsigned int ChildrenCount() const
const wxString & GetGroupName() const
NETINFO_ITEM * GetNet() const
virtual void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aBoardItem) override
virtual void OnBoardHighlightNetChanged(BOARD &aBoard) override
void generateReport()
Generates a CSV report from currently disaplyed data.
wxString formatCount(unsigned int aValue) const
PCB_NET_INSPECTOR_PANEL(wxWindow *parent, PCB_EDIT_FRAME *aFrame)
void onDeleteSelectedNet()
virtual void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems) override
virtual void OnSearchTextChanged(wxCommandEvent &event) override
virtual void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems) override
void onClearHighlighting()
bool m_in_build_nets_list
virtual void OnBoardChanged() override
Update panel when board is changed.
void generateShowHideColumnMenu(wxMenu *target)
Generates a sub-menu for the show / hide columns submenu.
wxString formatNetCode(const NETINFO_ITEM *aNet) const
bool m_filter_by_net_name
std::unique_ptr< LIST_ITEM > buildNewItem(NETINFO_ITEM *aNet, unsigned int aPadCount, const std::vector< CN_ITEM * > &aCNItems)
Constructs a LIST_ITEM for storage in the data model from a board net item.
std::vector< std::unique_ptr< EDA_COMBINED_MATCHER > > m_custom_group_rules
bool m_show_zero_pad_nets
wxString formatNetName(const NETINFO_ITEM *aNet) const
void onSettingsMenu(wxCommandEvent &event)
std::vector< CN_ITEM * > relevantConnectivityItems() const
Filters connectivity items from a board update to remove those not related to net / track metrics.
unsigned int calculateViaLength(const PCB_TRACK *) const
Calculates the length of a via from the board stackup.
void highlightSelectedNets()
Highlight the currently selected net.
NETINFO_ITEM * m_zero_netitem
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems) override
wxObjectDataPtr< DATA_MODEL > m_data_model
bool m_filter_by_netclass
bool m_group_by_constraint
void updateNet(NETINFO_ITEM *aNet)
Updates the stored LIST_ITEMs for a given updated board net item.
virtual void OnLanguageChangedImpl() override
Reloads strings on an application language change.
void OnNetsListContextMenu(wxDataViewEvent &event)
virtual void OnBoardNetSettingsChanged(BOARD &aBoard) override
virtual void OnBoardCompositeUpdate(BOARD &aBoard, std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aChangedItems) override
void OnNetsListItemActivated(wxDataViewEvent &event)
void OnColumnSorted(wxDataViewEvent &event)
void updateDisplayedRowValues(const std::optional< LIST_ITEM_ITER > &aRow)
void onRemoveSelectedGroup()
@ ID_SHOW_UNCONNECTED_NETS
@ ID_REMOVE_SELECTED_GROUP
@ ID_HIGHLIGHT_SELECTED_NETS
virtual ~PCB_NET_INSPECTOR_PANEL()
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem) override
virtual void OnParentSetupChanged() override
Updates the netlist based on global board changes (e.g.
void OnHeaderContextMenu(wxCommandEvent &event)
bool netFilterMatches(NETINFO_ITEM *aNet, PANEL_NET_INSPECTOR_SETTINGS *cfg=nullptr) const
Filter to determine whether a board net should be included in the net inspector.
virtual void OnConfigButton(wxCommandEvent &event) override
void buildNetsList(bool rebuildColumns=false)
bool restoreSortColumn(int sortingColumnId, bool sortOrderAsc)
Sets the sort column in the grid to that showing the given model ID column.
wxString formatLength(int64_t aValue) const
virtual void SaveSettings() override
Persist the net inspector configuration to project / global settings.
void onRenameSelectedNet()
void onUnitsChanged(wxCommandEvent &event)
void OnExpandCollapseRow(wxCommandEvent &event)
wxDataViewColumn * getDisplayedColumnForModelField(int columnId)
Fetches the displayed grid view column for the given model column ID.
void adjustListColumnSizes(PANEL_NET_INSPECTOR_SETTINGS *cfg)
Adjust the sizing of list columns.
virtual void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aBoardItem) override
std::vector< COLUMN_DESC > m_columns
All displayed (or hidden) columns.
bool m_show_unconnected_nets
virtual void OnShowPanel() override
Prepare the panel when shown in the editor.
virtual SETTINGS_MANAGER & GetSettingsManager() const
The project local settings are things that are attached to a particular project, but also might be pa...
PANEL_NET_INSPECTOR_SETTINGS m_NetInspectorPanel
The state of the net inspector panel.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
EDA_UNITS GetUserUnits() const
wxBoxSizer * m_ContentSizer
A KICAD version of wxTextEntryDialog which supports the various improvements/work-arounds from DIALOG...
wxString GetValue() const
void SetTextValidator(wxTextValidatorStyle style)
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
This file is part of the common library.
#define CANDIDATE
flag indicating that the structure is connected
Abstract pattern-matching tool and implementations.
int m_NetInspectorBulkUpdateOptimisationThreshold
When updating the net inspector, it either recalculates all nets or iterates through items one-by-one...
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
KICOMMON_API wxString GetLabel(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
@ REPAINT
Item needs to be redrawn.
@ GEOMETRY
Position or shape has changed.
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
void delete_matching(_Container &__c, _Value __value)
Covers for the horrifically named std::remove and std::remove_if (neither of which remove anything).
PGM_BASE & Pgm()
The global program "get" accessor.
static bool highlightNet(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
bool operator()(const CN_ITEM *a, const CN_ITEM *b) const
bool operator()(int a, const CN_ITEM *b) const
bool operator()(const CN_ITEM *a, int b) const
Persisted state for the net inspector panel.
std::vector< int > col_order
std::vector< bool > col_hidden
std::vector< wxString > expanded_rows
std::vector< int > col_widths
std::vector< wxString > custom_group_rules
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Custom text control validator definitions.
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.
Definition of file extensions used in Kicad.