41#include <wx/wupdlock.h>
42#include <wx/filedlg.h>
146 const std::vector<std::function<void(
void )>> add_col{
150 wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT,
151 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
156 wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT,
157 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
162 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
163 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
168 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
169 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
174 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
175 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
180 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
181 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
187 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
192 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
193 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
213 const int totalNumColumns = (int) add_col.size() +
m_board->GetCopperLayerCount();
215 if( (
int) cfg->
col_order.size() != totalNumColumns
216 || (
int) cfg->
col_hidden.size() != totalNumColumns )
218 cfg->
col_order.resize( totalNumColumns );
221 for(
int i = 0; i < totalNumColumns; ++i )
230 if( col_order_set.size() != cfg->
col_order.size() )
232 for( std::size_t i = 0; i < cfg->
col_order.size(); ++i )
233 cfg->
col_order[i] =
static_cast<int>( i );
249 const int addModelColumn = i;
251 if( addModelColumn >= (
int) add_col.size() )
254 m_columns[addModelColumn], wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
255 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
283 int minValueWidth = GetTextExtent( wxT(
"00000,000 mm" ) ).x;
284 int minNumberWidth = GetTextExtent( wxT(
"000" ) ).x;
285 int minNameWidth = GetTextExtent( wxT(
"MMMMMMMMMMMM" ) ).x;
291 constexpr int margins = 15;
292 constexpr int extra_width = 30;
294 auto getTargetWidth =
299 case COLUMN_NAME:
return minNameWidth + extra_width;
303 default:
return minValueWidth + margins;
309 for(
size_t i = 0; i <
m_columns.size(); ++i )
311 const int modelColumn = cfg->
col_order[i];
312 int titleSize = GetTextExtent(
m_columns[modelColumn].display_name ).x;
313 titleSize = modelColumn ==
COLUMN_NAME ? titleSize + extra_width : titleSize + margins;
314 const int valSize = getTargetWidth( modelColumn );
315 m_netsList->GetColumn( i )->SetWidth( std::max( titleSize, valSize ) );
323 for(
size_t ii = 0; ii <
m_columns.size(); ++ii )
327 m_netsList->GetColumn( ii )->SetWidth( std::max( newWidth, 10 ) );
338 if( sortingColumnId != -1 )
342 col->SetSortOrder( sortOrderAsc );
354 for(
unsigned int i = 0; i <
m_netsList->GetColumnCount(); ++i )
356 wxDataViewColumn* col =
m_netsList->GetColumn( i );
358 if(
static_cast<int>( col->GetModelColumn() ) == columnId )
403 auto& [groupName, groupItem] : groupItems )
411 wxDataViewItemArray sel;
414 std::vector<int> prev_selected_netcodes;
415 prev_selected_netcodes.reserve( sel.GetCount() );
417 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
420 prev_selected_netcodes.push_back( item->
GetNetCode() );
426 if( wxDataViewColumn* sorting_column =
m_netsList->GetSortingColumn() )
430 sorting_column_id =
static_cast<int>( sorting_column->GetModelColumn() );
431 sort_order_asc = sorting_column->IsSortOrderAscending();
435 sorting_column->UnsetAsSortKey();
452 std::vector<NETINFO_ITEM*> netCodes;
457 netCodes.emplace_back( ni );
460 std::ranges::sort( netCodes,
482 std::vector<std::pair<wxString, wxDataViewItem>> groupItems =
m_dataModel->getGroupDataViewItems();
487 [&groupName](
const std::pair<wxString, wxDataViewItem>& item )
489 return groupName == item.first;
492 auto tableItem = std::ranges::find_if( groupItems, pred );
494 if( tableItem != groupItems.end() )
504 for(
const int& nc : prev_selected_netcodes )
506 if( std::optional<LIST_ITEM_ITER> r =
m_dataModel->findItem( nc ) )
508 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
509 sel.Add( wxDataViewItem( list_item.get() ) );
547 bool matched =
false;
550 if( filterString.Length() == 0 )
554 if( !matched && cfg->
filter_by_netclass && netClassName.Find( filterString ) != wxNOT_FOUND )
558 if( !matched && cfg->
filter_by_net_name && netName.Find( filterString ) != wxNOT_FOUND )
565 matched = !netName.StartsWith( wxT(
"UNCONNECTED-(" ) );
586 const auto type_bits = std::bitset<MAX_STRUCT_TYPE_ID>().set(
PCB_TRACE_T )
591 std::vector<CN_ITEM*> cn_items;
592 cn_items.reserve( 1024 );
594 for(
CN_ITEM* cn_item :
m_board->GetConnectivity()->GetConnectivityAlgo()->ItemList() )
596 if( cn_item->Valid() && type_bits[cn_item->Parent()->Type()] )
597 cn_items.push_back( cn_item );
606std::vector<std::unique_ptr<PCB_NET_INSPECTOR_PANEL::LIST_ITEM>>
609 std::vector<std::unique_ptr<LIST_ITEM>> results;
617 std::unordered_map<int, std::vector<LENGTH_DELAY_CALCULATION_ITEM>> netItemsMap;
618 std::vector<NETINFO_ITEM*> foundNets;
620 auto itemItr = conItems.begin();
621 auto netCodeItr = aNetCodes.begin();
623 while( itemItr != conItems.end() && netCodeItr != aNetCodes.end() )
625 const int curNetCode = ( *netCodeItr )->GetNetCode();
626 const int curItemNetCode = ( *itemItr )->Net();
628 if( curItemNetCode == curNetCode )
630 if( foundNets.empty() || foundNets.back() != *netCodeItr )
631 foundNets.emplace_back( *netCodeItr );
635 netItemsMap[curItemNetCode].emplace_back( std::move( lengthItem ) );
638 else if( curItemNetCode < curNetCode )
641 while( itemItr != conItems.end() && ( *itemItr )->Net() < curNetCode )
644 else if( curItemNetCode > curNetCode )
647 while( netCodeItr != aNetCodes.end() && curItemNetCode > ( *netCodeItr )->GetNetCode() )
654 std::mutex resultsMutex;
657 auto resultsFuture =
tp.submit_loop(
659 [&,
this, calc](
const int i )
661 int netCode = foundNets[i]->GetNetCode();
663 constexpr PATH_OPTIMISATIONS opts = { .OptimiseViaLayers = true,
665 .OptimiseTracesInPads = true,
666 .InferViaInPad = false };
669 netItemsMap[netCode],
677 if( aIncludeZeroPadNets || lengthDetails.NumPads > 0 )
679 std::unique_ptr<LIST_ITEM> new_item = std::make_unique<LIST_ITEM>( foundNets[i] );
681 new_item->SetPadCount( lengthDetails.NumPads );
682 new_item->SetLayerCount( m_board->GetCopperLayerCount() );
683 new_item->SetPadDieLength( lengthDetails.PadToDieLength );
684 new_item->SetPadDieDelay( lengthDetails.PadToDieDelay );
685 new_item->SetViaCount( lengthDetails.NumVias );
686 new_item->SetViaLength( lengthDetails.ViaLength );
687 new_item->SetViaDelay( lengthDetails.ViaDelay );
688 new_item->SetLayerWireLengths( *lengthDetails.LayerLengths );
690 if( m_showTimeDomainDetails )
691 new_item->SetLayerWireDelays( *lengthDetails.LayerDelays );
693 std::scoped_lock lock( resultsMutex );
694 results.emplace_back( std::move( new_item ) );
713 return wxString::Format( wxT(
"%.3d" ), aNet->
GetNetCode() );
725 return wxString::Format( wxT(
"%u" ), aValue );
731 return m_frame->MessageTextFromValue( aValue,
738 return m_frame->MessageTextFromValue( aValue,
749 wxDataViewItemArray sel;
791 const std::vector<BOARD_ITEM*> item{ aBoardItem };
804 if( !IsShownOnScreen() )
808 if( aBoardItems.size()
815 std::vector<NETINFO_ITEM*> changedNets;
823 changedNets.emplace_back( net );
827 changedNets.emplace_back( i->GetNet() );
831 for(
const PAD*
pad : footprint->Pads() )
834 changedNets.emplace_back(
pad->GetNet() );
839 std::ranges::sort( changedNets,
854 std::vector<NETINFO_ITEM*> netsToUpdate;
855 std::unordered_set<NETINFO_ITEM*> netsToDelete;
860 netsToDelete.insert( net );
864 netsToUpdate.emplace_back( net );
867 wxWindowUpdateLocker updateLocker(
m_netsList );
869 std::vector<std::unique_ptr<LIST_ITEM>> newListItems =
calculateNets( aNets,
true );
871 for( std::unique_ptr<LIST_ITEM>& newListItem : newListItems )
874 netsToDelete.erase( newListItem->GetNet() );
876 std::optional<LIST_ITEM_ITER> curNetRow =
m_dataModel->findItem( newListItem->GetNetCode() );
890 const std::unique_ptr<LIST_ITEM>& curListItem = *curNetRow.value();
892 if( curListItem->GetNetName() != newListItem->GetNetName() )
900 curListItem->SetPadCount( newListItem->GetPadCount() );
901 curListItem->SetPadDieLength( newListItem->GetPadDieLength() );
902 curListItem->SetPadDieDelay( newListItem->GetPadDieDelay() );
903 curListItem->SetViaCount( newListItem->GetViaCount() );
904 curListItem->SetViaLength( newListItem->GetViaLength() );
905 curListItem->SetViaDelay( newListItem->GetViaDelay() );
906 curListItem->SetLayerWireLengths( newListItem->GetLayerWireLengths() );
909 curListItem->SetLayerWireDelays( newListItem->GetLayerWireDelays() );
923 const std::vector<BOARD_ITEM*> item{ aBoardItem };
936 if( !IsShownOnScreen() )
945 const std::vector<BOARD_ITEM*> item{ aBoardItem };
957 std::vector<BOARD_ITEM*>& aAddedItems,
958 std::vector<BOARD_ITEM*>& aRemovedItems,
959 std::vector<BOARD_ITEM*>& aChangedItems )
961 if( !IsShownOnScreen() )
964 std::vector<BOARD_ITEM*> allItems{ aAddedItems.begin(), aAddedItems.end() };
965 allItems.insert( allItems.end(), aRemovedItems.begin(), aRemovedItems.end() );
966 allItems.insert( allItems.end(), aChangedItems.begin(), aChangedItems.end() );
976 if( !
m_board->IsHighLightNetON() )
982 const std::set<int>& selected_codes =
m_board->GetHighLightNetCodes();
984 wxDataViewItemArray new_selection;
985 new_selection.Alloc( selected_codes.size() );
987 for(
const int code : selected_codes )
989 if( std::optional<LIST_ITEM_ITER> r =
m_dataModel->findItem( code ) )
990 new_selection.Add( wxDataViewItem( &***r ) );
995 if( !new_selection.IsEmpty() )
996 m_netsList->EnsureVisible( new_selection.Item( 0 ) );
1016 bool multipleSelections =
false;
1019 if(
m_netsList->GetSelectedItemsCount() == 1 )
1025 if(
m_netsList->GetSelectedItemsCount() > 1 )
1026 multipleSelections =
true;
1033 wxEmptyString, wxITEM_NORMAL );
1036 wxMenuItem* clearHighlighting =
new wxMenuItem( &menu,
ID_CLEAR_HIGHLIGHTING,
_(
"Clear Net Highlighting" ),
1037 wxEmptyString, wxITEM_NORMAL );
1038 menu.Append( clearHighlighting );
1043 if( selected_codes.size() == 0 )
1044 clearHighlighting->Enable(
false );
1046 menu.AppendSeparator();
1048 wxMenuItem* renameNet =
new wxMenuItem( &menu,
ID_RENAME_NET,
_(
"Rename Selected Net..." ), wxEmptyString,
1050 menu.Append( renameNet );
1052 wxMenuItem* deleteNet =
new wxMenuItem( &menu,
ID_DELETE_NET,
_(
"Delete Selected Net" ), wxEmptyString,
1054 menu.Append( deleteNet );
1056 menu.AppendSeparator();
1058 wxMenuItem* addNet =
new wxMenuItem( &menu,
ID_ADD_NET,
_(
"Add Net..." ), wxEmptyString, wxITEM_NORMAL );
1059 menu.Append( addNet );
1061 if( !selItem && !multipleSelections )
1064 deleteNet->Enable(
false );
1065 renameNet->Enable(
false );
1069 if( multipleSelections || selItem->
GetIsGroup() )
1071 highlightNet->SetItemLabel(
_(
"Highlight Selected Nets" ) );
1072 renameNet->Enable(
false );
1073 deleteNet->SetItemLabel(
_(
"Delete Selected Nets" ) );
1077 menu.AppendSeparator();
1080 _(
"Remove Selected Custom Group" ),
1081 wxEmptyString, wxITEM_NORMAL );
1082 menu.Append( removeSelectedGroup );
1085 removeSelectedGroup->Enable(
false );
1102 wxString newGroupName;
1106 wxStaticText*
help =
new wxStaticText( &dlg, wxID_ANY,
_(
"(Use /.../ to indicate a regular expression.)" ) );
1110 dlg.GetSizer()->SetSizeHints( &dlg );
1117 if( newGroupName ==
"" )
1121 [&]( std::unique_ptr<EDA_COMBINED_MATCHER>& rule )
1123 return rule->GetPattern() == newGroupName;
1139 m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings()->SetHighlight(
false );
1140 m_frame->GetCanvas()->GetView()->UpdateAllLayersColor();
1141 m_frame->GetCanvas()->Refresh();
1170 if(
m_netsList->GetSelectedItemsCount() == 1 )
1179 _(
"Filter by Net Name" ),
1180 wxEmptyString, wxITEM_CHECK );
1181 menu.Append( filterByNetName );
1182 filterByNetName->Check( cfg.filter_by_net_name );
1185 _(
"Filter by Netclass" ),
1186 wxEmptyString, wxITEM_CHECK );
1187 menu.Append( filterByNetclass );
1188 filterByNetclass->Check( cfg.filter_by_netclass );
1190 menu.AppendSeparator();
1200 _(
"Group by Netclass" ),
1201 wxEmptyString, wxITEM_CHECK );
1202 menu.Append( groupNetclass );
1205 menu.AppendSeparator();
1207 wxMenuItem* addGroup =
new wxMenuItem( &menu,
ID_ADD_GROUP,
_(
"Add Custom Group..." ),
1208 wxEmptyString, wxITEM_NORMAL );
1209 menu.Append( addGroup );
1212 _(
"Remove Selected Custom Group" ),
1213 wxEmptyString, wxITEM_NORMAL );
1214 menu.Append( removeSelectedGroup );
1217 removeSelectedGroup->Enable(
false );
1220 _(
"Remove All Custom Groups" ),
1221 wxEmptyString, wxITEM_NORMAL );
1222 menu.Append( removeCustomGroups );
1225 menu.AppendSeparator();
1228 _(
"Show Zero Pad Nets" ),
1229 wxEmptyString, wxITEM_CHECK );
1230 menu.Append( showZeroNetPads );
1234 _(
"Show Unconnected Nets" ),
1235 wxEmptyString, wxITEM_CHECK );
1236 menu.Append( showUnconnectedNets );
1239 menu.AppendSeparator();
1242 _(
"Show Time Domain Details" ), wxEmptyString, wxITEM_CHECK );
1243 menu.Append( showTimeDomainDetails );
1246 menu.AppendSeparator();
1250 _(
"Save Net Inspector Report..." ),
1251 wxEmptyString, wxITEM_NORMAL );
1254 menu.AppendSeparator();
1257 wxMenu* colsMenu =
new wxMenu();
1259 menu.AppendSubMenu( colsMenu,
_(
"Show / Hide Columns" ) );
1272 wxEmptyString, wxITEM_CHECK );
1274 target->Append( opt );
1275 opt->Check( !col->IsHidden() );
1278 target->AppendSeparator();
1283 wxEmptyString, wxITEM_CHECK );
1285 target->Append( opt );
1286 opt->Check( !col->IsHidden() );
1293 bool saveAndRebuild =
true;
1295 switch( event.GetId() )
1337 saveAndRebuild =
false;
1342 saveAndRebuild =
false;
1347 saveAndRebuild =
false;
1356 col->SetWidth( std::max( col->GetWidth(), 10 ) );
1357 col->SetHidden( !col->IsHidden() );
1362 if( saveAndRebuild )
1372 if(
m_netsList->GetSelectedItemsCount() == 1 )
1376 if( selItem->GetIsGroup() )
1378 const wxString groupName = selItem->GetGroupName();
1380 [&]( std::unique_ptr<EDA_COMBINED_MATCHER>& rule )
1382 return rule->GetPattern() == groupName;
1398 wxFileDialog dlg(
this,
_(
"Save Net Inspector Report File" ),
"",
"",
1400 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1402 if( dlg.ShowModal() == wxID_CANCEL )
1405 wxTextFile f( dlg.GetPath() );
1420 txt += wxString::Format(
_(
"%s (%s)" ),
1426 txt += col.csv_name;
1429 txt += wxT(
"\";" );
1435 const unsigned int num_rows =
m_dataModel->itemCount();
1437 for(
unsigned int row = 0; row < num_rows; row++ )
1441 if( i.GetIsGroup() || i.GetNetCode() == 0 )
1449 txt +=
'"' +
m_dataModel->valueAt( col.num, row ).GetString() + wxT(
"\";" );
1451 txt +=
m_dataModel->valueAt( col.num, row ).GetString() +
';';
1482 wxDataViewItemArray sel;
1487 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
1494 renderSettings->
SetHighlight(
true, ( *c )->GetNetCode(),
true );
1507 m_frame->GetCanvas()->GetView()->UpdateAllLayersColor();
1508 m_frame->GetCanvas()->Refresh();
1530 wxString newNetName;
1543 if(
m_board->FindNet( newNetName ) )
1546 wxString::Format(
_(
"Net name '%s' is already in use." ), newNetName ) );
1547 newNetName = wxEmptyString;
1566 if(
m_netsList->GetSelectedItemsCount() == 1 )
1576 wxString shortNetName;
1578 if( fullNetName.Contains( wxT(
"/" ) ) )
1580 netPath = fullNetName.BeforeLast(
'/' ) +
'/';
1581 shortNetName = fullNetName.AfterLast(
'/' );
1585 shortNetName = fullNetName;
1599 unescapedShortName = dlg.
GetValue();
1601 if( unescapedShortName.IsEmpty() )
1603 DisplayError(
this, wxString::Format(
_(
"Net name cannot be empty." ),
1604 unescapedShortName ) );
1609 fullNetName = netPath + shortNetName;
1611 if(
m_board->FindNet( shortNetName ) ||
m_board->FindNet( fullNetName ) )
1613 DisplayError(
this, wxString::Format(
_(
"Net name '%s' is already in use." ),
1614 unescapedShortName ) );
1615 unescapedShortName = wxEmptyString;
1625 if( boardItem->GetNet() == net )
1641 boardItem->SetNet( net );
1646 if( std::optional<LIST_ITEM_ITER> r =
m_dataModel->findItem( net ) )
1647 m_netsList->Select( wxDataViewItem( r.value()->get() ) );
1655 m_frame->GetCanvas()->Refresh();
1665 wxDataViewItemArray sel;
1668 auto delete_one = [
this](
const LIST_ITEM* i )
1670 if( i->GetPadCount() == 0
1671 ||
IsOK(
this, wxString::Format(
_(
"Net '%s' is in use. Delete anyway?" ),
1672 i->GetNetName() ) ) )
1676 int removedCode = i->GetNetCode();
1678 m_frame->GetCanvas()->GetView()->UpdateAllItemsConditionally(
1683 if( boardItem && boardItem->GetNetCode() == removedCode )
1690 text->ClearRenderCache();
1691 text->ClearBoundingBoxCache();
1698 m_board->Remove( i->GetNet() );
1705 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
1712 &&
IsOK(
this, wxString::Format(
_(
"Delete all nets in group '%s'?" ),
1717 std::vector<const LIST_ITEM*> children;
1765 bool displayed =
false;
1767 for(
unsigned int ii = 0; ii <
m_dataModel->columnCount() && !displayed; ++ii )
1769 if(
m_netsList->GetColumn( ii )->GetWidth() > 0 )
1790 wxDataViewColumn* sortingCol =
m_netsList->GetSortingColumn();
1791 cfg.sorting_column = sortingCol ?
static_cast<int>( sortingCol->GetModelColumn() ) : -1;
1792 cfg.sort_order_asc = sortingCol ? sortingCol->IsSortOrderAscending() :
true;
1795 cfg.col_order.resize(
m_dataModel->columnCount() );
1796 cfg.col_widths.resize(
m_dataModel->columnCount() );
1797 cfg.col_hidden.resize(
m_dataModel->columnCount() );
1799 for(
unsigned int ii = 0; ii <
m_dataModel->columnCount(); ++ii )
1801 cfg.col_order[ii] = (int)
m_netsList->GetColumn( ii )->GetModelColumn();
1802 cfg.col_widths[ii] =
m_netsList->GetColumn( ii )->GetWidth();
1803 cfg.col_hidden[ii] =
m_netsList->GetColumn( ii )->IsHidden();
1807 cfg.expanded_rows.clear();
1808 std::vector<std::pair<wxString, wxDataViewItem>> groupItems =
m_dataModel->getGroupDataViewItems();
1810 for( std::pair<wxString, wxDataViewItem>& item : groupItems )
1813 cfg.expanded_rows.push_back( item.first );
1817 cfg.custom_group_rules.clear();
1820 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,...
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
CN_ITEM represents a BOARD_CONNETED_ITEM in the connectivity system (ie: a pad, track/arc/via,...
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
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.
Lightweight class which holds a pad, via, or a routed trace outline.
Class which calculates lengths (and associated routing statistics) in a BOARD context.
LENGTH_DELAY_CALCULATION_ITEM GetLengthCalculationItem(const BOARD_CONNECTED_ITEM *aBoardItem) const
Return a LENGTH_CALCULATION_ITEM constructed from the given BOARD_CONNECTED_ITEM.
LENGTH_DELAY_STATS CalculateLengthDetails(std::vector< LENGTH_DELAY_CALCULATION_ITEM > &aItems, PATH_OPTIMISATIONS aOptimisations, const PAD *aStartPad=nullptr, const PAD *aEndPad=nullptr, LENGTH_DELAY_LAYER_OPT aLayerOpt=LENGTH_DELAY_LAYER_OPT::NO_LAYER_DETAIL, LENGTH_DELAY_DOMAIN_OPT aDomain=LENGTH_DELAY_DOMAIN_OPT::NO_DELAY_DETAIL) const
Calculates the electrical length of the given items.
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
NET_INSPECTOR_PANEL(wxWindow *parent, EDA_BASE_FRAME *aFrame, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1, -1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
wxDataViewCtrl * m_netsList
wxSearchCtrl * m_searchCtrl
The main frame for Pcbnew.
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
void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aBoardItem) override
void OnBoardHighlightNetChanged(BOARD &aBoard) override
void generateReport()
Generates a CSV report from currently disaplyed data.
PCB_NET_INSPECTOR_PANEL(wxWindow *parent, PCB_EDIT_FRAME *aFrame)
void onDeleteSelectedNet()
Deletes a selected net.
bool restoreSortColumn(int sortingColumnId, bool sortOrderAsc) const
Sets the sort column in the grid to that showing the given model ID column.
void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems) override
void adjustListColumnSizes(PANEL_NET_INSPECTOR_SETTINGS *cfg) const
Adjust the sizing of list columns.
BOARD * m_board
Parent BOARD.
void OnSearchTextChanged(wxCommandEvent &event) override
void updateDisplayedRowValues(const std::optional< LIST_ITEM_ITER > &aRow) const
Refreshes displayed data for the given rows.
void onAddNet()
Adds a new user-specified net to the board.
PCB_EDIT_FRAME * m_frame
Owning edit frame.
void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems) override
void onClearHighlighting()
Clears highlighting from nets.
void onContextMenuSelection(wxCommandEvent &event)
Handle a net row(s) context menu selection.
static wxString formatNetCode(const NETINFO_ITEM *aNet)
void OnBoardChanged() override
Update panel when board is changed.
void generateShowHideColumnMenu(wxMenu *target)
Generates a sub-menu for the show / hide columns submenu.
std::vector< std::unique_ptr< LIST_ITEM > > calculateNets(const std::vector< NETINFO_ITEM * > &aNetCodes, bool aIncludeZeroPadNets) const
Calculates the length statistics for each given netcode.
bool m_showTimeDomainDetails
static wxString formatCount(unsigned int aValue)
std::vector< std::unique_ptr< EDA_COMBINED_MATCHER > > m_custom_group_rules
Custom net grouping rules.
std::vector< CN_ITEM * > relevantConnectivityItems() const
Fetches an ordered (by NetCode) list of all board connectivity items.
bool m_showUnconnectedNets
void highlightSelectedNets()
Highlight the currently selected net.
void updateNets(const std::vector< NETINFO_ITEM * > &aNets) const
Updates displayed statistics for the given nets.
void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems) override
void OnLanguageChangedImpl() override
Reloads strings on an application language change.
void onAddGroup()
Adds a custom display grouping of nets.
void OnNetsListContextMenu(wxDataViewEvent &event)
void OnBoardNetSettingsChanged(BOARD &aBoard) override
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 onRemoveSelectedGroup()
Removes a custom display grouping.
@ ID_SHOW_UNCONNECTED_NETS
@ ID_REMOVE_SELECTED_GROUP
@ ID_HIGHLIGHT_SELECTED_NETS
@ ID_SHOW_TIME_DOMAIN_DETAILS
virtual ~PCB_NET_INSPECTOR_PANEL()
void buildColumns()
Build the required columns in the net inspector grid.
void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem) override
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.
void OnConfigButton(wxCommandEvent &event) override
void buildNetsList(bool rebuildColumns=false)
Rebuilds the net inspector list, removing all previous entries.
wxString formatLength(int64_t aValue) const
void SaveSettings() override
Persist the net inspector configuration to project / global settings.
void onRenameSelectedNet()
Renames a selected net.
void onUnitsChanged(wxCommandEvent &event)
Handle an application-level change of units.
void OnExpandCollapseRow(wxCommandEvent &event)
void updateBoardItems(const std::vector< BOARD_ITEM * > &aBoardItems)
Unified handling of added / deleted / modified board items.
wxString formatDelay(int64_t aValue) const
wxObjectDataPtr< DATA_MODEL > m_dataModel
The bound data model to display.
wxDataViewColumn * getDisplayedColumnForModelField(int columnId) const
Fetches the displayed grid view column for the given model column ID.
static wxString formatNetName(const NETINFO_ITEM *aNet)
void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aBoardItem) override
std::vector< COLUMN_DESC > m_columns
All displayed (or hidden) columns.
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.
wxBoxSizer * m_ContentSizer
A KICAD version of wxTextEntryDialog which supports the various improvements/work-arounds from DIALOG...
wxString GetValue() const
void SetTextValidator(const wxTextValidator &validator)
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)
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.
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)
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:...
Holds length measurement result details and statistics.
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
bool show_time_domain_details
std::vector< wxString > custom_group_rules
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
BS::thread_pool< 0 > thread_pool
@ 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.