40#include <wx/wupdlock.h>
41#include <wx/filedlg.h>
145 const std::vector<std::function<void(
void )>> add_col{
149 wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT,
150 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
155 wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT,
156 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
161 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
162 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
167 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
168 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
173 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
174 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
179 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
180 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
186 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
191 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
192 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
214 if( (
int) cfg->
col_order.size() != totalNumColumns
215 || (int) cfg->
col_hidden.size() != totalNumColumns )
217 cfg->
col_order.resize( totalNumColumns );
220 for(
int i = 0; i < totalNumColumns; ++i )
229 if( col_order_set.size() != cfg->
col_order.size() )
231 for( std::size_t i = 0; i < cfg->
col_order.size(); ++i )
232 cfg->
col_order[i] =
static_cast<int>( i );
248 const int addModelColumn = i;
250 if( addModelColumn >= (
int) add_col.size() )
253 m_columns[addModelColumn], wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
254 wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_REORDERABLE|wxDATAVIEW_COL_SORTABLE );
282 int minValueWidth = GetTextExtent( wxT(
"00000,000 mm" ) ).x;
283 int minNumberWidth = GetTextExtent( wxT(
"000" ) ).x;
284 int minNameWidth = GetTextExtent( wxT(
"MMMMMMMMMMMM" ) ).x;
290 constexpr int margins = 15;
291 constexpr int extra_width = 30;
293 auto getTargetWidth =
298 case COLUMN_NAME:
return minNameWidth + extra_width;
302 default:
return minValueWidth + margins;
308 for(
size_t i = 0; i <
m_columns.size(); ++i )
310 const int modelColumn = cfg->
col_order[i];
311 int titleSize = GetTextExtent(
m_columns[modelColumn].display_name ).x;
312 titleSize = modelColumn ==
COLUMN_NAME ? titleSize + extra_width : titleSize + margins;
313 const int valSize = getTargetWidth( modelColumn );
314 m_netsList->GetColumn( i )->SetWidth( std::max( titleSize, valSize ) );
322 for(
size_t ii = 0; ii <
m_columns.size(); ++ii )
326 m_netsList->GetColumn( ii )->SetWidth( std::max( newWidth, 10 ) );
337 if( sortingColumnId != -1 )
341 col->SetSortOrder( sortOrderAsc );
353 for(
unsigned int i = 0; i <
m_netsList->GetColumnCount(); ++i )
355 wxDataViewColumn* col =
m_netsList->GetColumn( i );
357 if(
static_cast<int>( col->GetModelColumn() ) == columnId )
402 auto& [groupName, groupItem] : groupItems )
410 wxDataViewItemArray sel;
413 std::vector<int> prev_selected_netcodes;
414 prev_selected_netcodes.reserve( sel.GetCount() );
416 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
419 prev_selected_netcodes.push_back( item->
GetNetCode() );
425 if( wxDataViewColumn* sorting_column =
m_netsList->GetSortingColumn() )
429 sorting_column_id =
static_cast<int>( sorting_column->GetModelColumn() );
430 sort_order_asc = sorting_column->IsSortOrderAscending();
434 sorting_column->UnsetAsSortKey();
451 std::vector<NETINFO_ITEM*> netCodes;
456 netCodes.emplace_back( ni );
459 std::ranges::sort( netCodes,
481 std::vector<std::pair<wxString, wxDataViewItem>> groupItems =
m_dataModel->getGroupDataViewItems();
486 [&groupName](
const std::pair<wxString, wxDataViewItem>& item )
488 return groupName == item.first;
491 auto tableItem = std::ranges::find_if( groupItems, pred );
493 if( tableItem != groupItems.end() )
503 for(
const int& nc : prev_selected_netcodes )
505 if( std::optional<LIST_ITEM_ITER> r =
m_dataModel->findItem( nc ) )
507 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
508 sel.Add( wxDataViewItem( list_item.get() ) );
546 bool matched =
false;
549 if( filterString.Length() == 0 )
553 if( !matched && cfg->
filter_by_netclass && netClassName.Find( filterString ) != wxNOT_FOUND )
557 if( !matched && cfg->
filter_by_net_name && netName.Find( filterString ) != wxNOT_FOUND )
564 matched = !netName.StartsWith( wxT(
"UNCONNECTED-(" ) );
585 const auto type_bits = std::bitset<MAX_STRUCT_TYPE_ID>().set(
PCB_TRACE_T )
590 std::vector<CN_ITEM*> cn_items;
591 cn_items.reserve( 1024 );
595 if( cn_item->Valid() && type_bits[cn_item->Parent()->Type()] )
596 cn_items.push_back( cn_item );
605std::vector<std::unique_ptr<PCB_NET_INSPECTOR_PANEL::LIST_ITEM>>
608 std::vector<std::unique_ptr<LIST_ITEM>> results;
616 std::unordered_map<int, std::vector<LENGTH_DELAY_CALCULATION_ITEM>> netItemsMap;
617 std::vector<NETINFO_ITEM*> foundNets;
619 auto itemItr = conItems.begin();
620 auto netCodeItr = aNetCodes.begin();
622 while( itemItr != conItems.end() && netCodeItr != aNetCodes.end() )
624 const int curNetCode = ( *netCodeItr )->GetNetCode();
625 const int curItemNetCode = ( *itemItr )->Net();
627 if( curItemNetCode == curNetCode )
629 if( foundNets.empty() || foundNets.back() != *netCodeItr )
630 foundNets.emplace_back( *netCodeItr );
634 netItemsMap[curItemNetCode].emplace_back( std::move( lengthItem ) );
637 else if( curItemNetCode < curNetCode )
640 while( itemItr != conItems.end() && ( *itemItr )->Net() < curNetCode )
643 else if( curItemNetCode > curNetCode )
646 while( netCodeItr != aNetCodes.end() && curItemNetCode > ( *netCodeItr )->GetNetCode() )
653 std::mutex resultsMutex;
656 auto resultsFuture =
tp.parallelize_loop(
658 [&,
this, calc](
const int start,
const int end )
660 for( int i = start; i < end; ++i )
662 int netCode = foundNets[i]->GetNetCode();
664 constexpr PATH_OPTIMISATIONS opts = { .OptimiseViaLayers = true,
666 .OptimiseTracesInPads = true,
667 .InferViaInPad = false };
669 LENGTH_DELAY_STATS lengthDetails = calc->CalculateLengthDetails(
670 netItemsMap[netCode],
674 LENGTH_DELAY_LAYER_OPT::WITH_LAYER_DETAIL,
675 m_showTimeDomainDetails ? LENGTH_DELAY_DOMAIN_OPT::WITH_DELAY_DETAIL
676 : LENGTH_DELAY_DOMAIN_OPT::NO_DELAY_DETAIL );
678 if( aIncludeZeroPadNets || lengthDetails.NumPads > 0 )
680 std::unique_ptr<LIST_ITEM> new_item = std::make_unique<LIST_ITEM>( foundNets[i] );
682 new_item->SetPadCount( lengthDetails.NumPads );
683 new_item->SetLayerCount( m_board->GetCopperLayerCount() );
684 new_item->SetPadDieLength( lengthDetails.PadToDieLength );
685 new_item->SetPadDieDelay( lengthDetails.PadToDieDelay );
686 new_item->SetViaCount( lengthDetails.NumVias );
687 new_item->SetViaLength( lengthDetails.ViaLength );
688 new_item->SetViaDelay( lengthDetails.ViaDelay );
689 new_item->SetLayerWireLengths( *lengthDetails.LayerLengths );
691 if( m_showTimeDomainDetails )
692 new_item->SetLayerWireDelays( *lengthDetails.LayerDelays );
694 std::scoped_lock lock( resultsMutex );
695 results.emplace_back( std::move( new_item ) );
715 return wxString::Format( wxT(
"%.3d" ), aNet->
GetNetCode() );
727 return wxString::Format( wxT(
"%u" ), aValue );
751 wxDataViewItemArray sel;
793 const std::vector<BOARD_ITEM*> item{ aBoardItem };
806 if( !IsShownOnScreen() )
810 if( aBoardItems.size()
817 std::vector<NETINFO_ITEM*> changedNets;
825 changedNets.emplace_back( net );
829 changedNets.emplace_back( i->GetNet() );
833 for(
const PAD*
pad : footprint->Pads() )
836 changedNets.emplace_back(
pad->GetNet() );
841 std::ranges::sort( changedNets,
856 std::vector<NETINFO_ITEM*> netsToUpdate;
857 std::unordered_set<NETINFO_ITEM*> netsToDelete;
862 netsToDelete.insert( net );
866 netsToUpdate.emplace_back( net );
869 wxWindowUpdateLocker updateLocker(
m_netsList );
871 std::vector<std::unique_ptr<LIST_ITEM>> newListItems =
calculateNets( aNets,
true );
873 for( std::unique_ptr<LIST_ITEM>& newListItem : newListItems )
876 netsToDelete.erase( newListItem->GetNet() );
878 std::optional<LIST_ITEM_ITER> curNetRow =
m_dataModel->findItem( newListItem->GetNetCode() );
892 const std::unique_ptr<LIST_ITEM>& curListItem = *curNetRow.value();
894 if( curListItem->GetNetName() != newListItem->GetNetName() )
902 curListItem->SetPadCount( newListItem->GetPadCount() );
903 curListItem->SetPadDieLength( newListItem->GetPadDieLength() );
904 curListItem->SetPadDieDelay( newListItem->GetPadDieDelay() );
905 curListItem->SetViaCount( newListItem->GetViaCount() );
906 curListItem->SetViaLength( newListItem->GetViaLength() );
907 curListItem->SetViaDelay( newListItem->GetViaDelay() );
908 curListItem->SetLayerWireLengths( newListItem->GetLayerWireLengths() );
911 curListItem->SetLayerWireDelays( newListItem->GetLayerWireDelays() );
925 const std::vector<BOARD_ITEM*> item{ aBoardItem };
938 if( !IsShownOnScreen() )
947 const std::vector<BOARD_ITEM*> item{ aBoardItem };
959 std::vector<BOARD_ITEM*>& aAddedItems,
960 std::vector<BOARD_ITEM*>& aRemovedItems,
961 std::vector<BOARD_ITEM*>& aChangedItems )
963 if( !IsShownOnScreen() )
966 std::vector<BOARD_ITEM*> allItems{ aAddedItems.begin(), aAddedItems.end() };
967 allItems.insert( allItems.end(), aRemovedItems.begin(), aRemovedItems.end() );
968 allItems.insert( allItems.end(), aChangedItems.begin(), aChangedItems.end() );
986 wxDataViewItemArray new_selection;
987 new_selection.Alloc( selected_codes.size() );
989 for(
const int code : selected_codes )
991 if( std::optional<LIST_ITEM_ITER> r =
m_dataModel->findItem( code ) )
992 new_selection.Add( wxDataViewItem( &***r ) );
997 if( !new_selection.IsEmpty() )
998 m_netsList->EnsureVisible( new_selection.Item( 0 ) );
1018 bool multipleSelections =
false;
1021 if(
m_netsList->GetSelectedItemsCount() == 1 )
1027 if(
m_netsList->GetSelectedItemsCount() > 1 )
1028 multipleSelections =
true;
1035 wxEmptyString, wxITEM_NORMAL );
1038 wxMenuItem* clearHighlighting =
new wxMenuItem( &menu,
ID_CLEAR_HIGHLIGHTING,
_(
"Clear Net Highlighting" ),
1039 wxEmptyString, wxITEM_NORMAL );
1040 menu.Append( clearHighlighting );
1045 if( selected_codes.size() == 0 )
1046 clearHighlighting->Enable(
false );
1048 menu.AppendSeparator();
1050 wxMenuItem* renameNet =
new wxMenuItem( &menu,
ID_RENAME_NET,
_(
"Rename Selected Net..." ), wxEmptyString,
1052 menu.Append( renameNet );
1054 wxMenuItem* deleteNet =
new wxMenuItem( &menu,
ID_DELETE_NET,
_(
"Delete Selected Net" ), wxEmptyString,
1056 menu.Append( deleteNet );
1058 menu.AppendSeparator();
1060 wxMenuItem* addNet =
new wxMenuItem( &menu,
ID_ADD_NET,
_(
"Add Net..." ), wxEmptyString, wxITEM_NORMAL );
1061 menu.Append( addNet );
1063 if( !selItem && !multipleSelections )
1066 deleteNet->Enable(
false );
1067 renameNet->Enable(
false );
1071 if( multipleSelections || selItem->
GetIsGroup() )
1073 highlightNet->SetItemLabel(
_(
"Highlight Selected Nets" ) );
1074 renameNet->Enable(
false );
1075 deleteNet->SetItemLabel(
_(
"Delete Selected Nets" ) );
1079 menu.AppendSeparator();
1082 _(
"Remove Selected Custom Group" ),
1083 wxEmptyString, wxITEM_NORMAL );
1084 menu.Append( removeSelectedGroup );
1087 removeSelectedGroup->Enable(
false );
1104 wxString newGroupName;
1108 wxStaticText*
help =
new wxStaticText( &dlg, wxID_ANY,
_(
"(Use /.../ to indicate a regular expression.)" ) );
1112 dlg.GetSizer()->SetSizeHints( &dlg );
1119 if( newGroupName ==
"" )
1123 [&]( std::unique_ptr<EDA_COMBINED_MATCHER>& rule )
1125 return rule->GetPattern() == newGroupName;
1172 if(
m_netsList->GetSelectedItemsCount() == 1 )
1181 _(
"Filter by Net Name" ),
1182 wxEmptyString, wxITEM_CHECK );
1183 menu.Append( filterByNetName );
1184 filterByNetName->Check( cfg.filter_by_net_name );
1187 _(
"Filter by Netclass" ),
1188 wxEmptyString, wxITEM_CHECK );
1189 menu.Append( filterByNetclass );
1190 filterByNetclass->Check( cfg.filter_by_netclass );
1192 menu.AppendSeparator();
1202 _(
"Group by Netclass" ),
1203 wxEmptyString, wxITEM_CHECK );
1204 menu.Append( groupNetclass );
1207 menu.AppendSeparator();
1209 wxMenuItem* addGroup =
new wxMenuItem( &menu,
ID_ADD_GROUP,
_(
"Add Custom Group..." ),
1210 wxEmptyString, wxITEM_NORMAL );
1211 menu.Append( addGroup );
1214 _(
"Remove Selected Custom Group" ),
1215 wxEmptyString, wxITEM_NORMAL );
1216 menu.Append( removeSelectedGroup );
1219 removeSelectedGroup->Enable(
false );
1222 _(
"Remove All Custom Groups" ),
1223 wxEmptyString, wxITEM_NORMAL );
1224 menu.Append( removeCustomGroups );
1227 menu.AppendSeparator();
1230 _(
"Show Zero Pad Nets" ),
1231 wxEmptyString, wxITEM_CHECK );
1232 menu.Append( showZeroNetPads );
1236 _(
"Show Unconnected Nets" ),
1237 wxEmptyString, wxITEM_CHECK );
1238 menu.Append( showUnconnectedNets );
1241 menu.AppendSeparator();
1244 _(
"Show Time Domain Details" ), wxEmptyString, wxITEM_CHECK );
1245 menu.Append( showTimeDomainDetails );
1248 menu.AppendSeparator();
1252 _(
"Save Net Inspector Report..." ),
1253 wxEmptyString, wxITEM_NORMAL );
1256 menu.AppendSeparator();
1259 wxMenu* colsMenu =
new wxMenu();
1261 menu.AppendSubMenu( colsMenu,
_(
"Show / Hide Columns" ) );
1274 wxEmptyString, wxITEM_CHECK );
1276 target->Append( opt );
1277 opt->Check( !col->IsHidden() );
1280 target->AppendSeparator();
1285 wxEmptyString, wxITEM_CHECK );
1287 target->Append( opt );
1288 opt->Check( !col->IsHidden() );
1295 bool saveAndRebuild =
true;
1297 switch( event.GetId() )
1339 saveAndRebuild =
false;
1344 saveAndRebuild =
false;
1349 saveAndRebuild =
false;
1358 col->SetWidth( std::max( col->GetWidth(), 10 ) );
1359 col->SetHidden( !col->IsHidden() );
1364 if( saveAndRebuild )
1374 if(
m_netsList->GetSelectedItemsCount() == 1 )
1378 if( selItem->GetIsGroup() )
1382 [&]( std::unique_ptr<EDA_COMBINED_MATCHER>& rule )
1384 return rule->GetPattern() == groupName;
1400 wxFileDialog dlg(
this,
_(
"Save Net Inspector Report File" ),
"",
"",
1402 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1404 if( dlg.ShowModal() == wxID_CANCEL )
1407 wxTextFile f( dlg.GetPath() );
1422 txt += wxString::Format(
_(
"%s (%s)" ),
1428 txt += col.csv_name;
1431 txt += wxT(
"\";" );
1437 const unsigned int num_rows =
m_dataModel->itemCount();
1439 for(
unsigned int row = 0; row < num_rows; row++ )
1443 if( i.GetIsGroup() || i.GetNetCode() == 0 )
1451 txt +=
'"' +
m_dataModel->valueAt( col.num, row ).GetString() + wxT(
"\";" );
1453 txt +=
m_dataModel->valueAt( col.num, row ).GetString() +
';';
1484 wxDataViewItemArray sel;
1489 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
1496 renderSettings->
SetHighlight(
true, ( *c )->GetNetCode(), true );
1532 wxString newNetName;
1548 wxString::Format(
_(
"Net name '%s' is already in use." ), newNetName ) );
1549 newNetName = wxEmptyString;
1568 if(
m_netsList->GetSelectedItemsCount() == 1 )
1578 wxString shortNetName;
1580 if( fullNetName.Contains( wxT(
"/" ) ) )
1582 netPath = fullNetName.BeforeLast(
'/' ) +
'/';
1583 shortNetName = fullNetName.AfterLast(
'/' );
1587 shortNetName = fullNetName;
1601 unescapedShortName = dlg.
GetValue();
1603 if( unescapedShortName.IsEmpty() )
1605 DisplayError(
this, wxString::Format(
_(
"Net name cannot be empty." ),
1606 unescapedShortName ) );
1611 fullNetName = netPath + shortNetName;
1615 DisplayError(
this, wxString::Format(
_(
"Net name '%s' is already in use." ),
1616 unescapedShortName ) );
1617 unescapedShortName = wxEmptyString;
1627 if( boardItem->GetNet() == net )
1643 boardItem->SetNet( net );
1648 if( std::optional<LIST_ITEM_ITER> r =
m_dataModel->findItem( net ) )
1649 m_netsList->Select( wxDataViewItem( r.value()->get() ) );
1667 wxDataViewItemArray sel;
1670 auto delete_one = [
this](
const LIST_ITEM* i )
1672 if( i->GetPadCount() == 0
1673 ||
IsOK(
this, wxString::Format(
_(
"Net '%s' is in use. Delete anyway?" ),
1674 i->GetNetName() ) ) )
1678 int removedCode = i->GetNetCode();
1685 if( boardItem && boardItem->GetNetCode() == removedCode )
1692 text->ClearRenderCache();
1693 text->ClearBoundingBoxCache();
1707 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
1714 &&
IsOK(
this, wxString::Format(
_(
"Delete all nets in group '%s'?" ),
1719 std::vector<const LIST_ITEM*> children;
1767 bool displayed =
false;
1769 for(
unsigned int ii = 0; ii <
m_dataModel->columnCount() && !displayed; ++ii )
1771 if(
m_netsList->GetColumn( ii )->GetWidth() > 0 )
1792 wxDataViewColumn* sortingCol =
m_netsList->GetSortingColumn();
1793 cfg.sorting_column = sortingCol ?
static_cast<int>( sortingCol->GetModelColumn() ) : -1;
1794 cfg.sort_order_asc = sortingCol ? sortingCol->IsSortOrderAscending() :
true;
1797 cfg.col_order.resize(
m_dataModel->columnCount() );
1798 cfg.col_widths.resize(
m_dataModel->columnCount() );
1799 cfg.col_hidden.resize(
m_dataModel->columnCount() );
1801 for(
unsigned int ii = 0; ii <
m_dataModel->columnCount(); ++ii )
1803 cfg.col_order[ii] = (int)
m_netsList->GetColumn( ii )->GetModelColumn();
1804 cfg.col_widths[ii] =
m_netsList->GetColumn( ii )->GetWidth();
1805 cfg.col_hidden[ii] =
m_netsList->GetColumn( ii )->IsHidden();
1809 cfg.expanded_rows.clear();
1810 std::vector<std::pair<wxString, wxDataViewItem>> groupItems =
m_dataModel->getGroupDataViewItems();
1812 for( std::pair<wxString, wxDataViewItem>& item : groupItems )
1815 cfg.expanded_rows.push_back( item.first );
1819 cfg.custom_group_rules.clear();
1822 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.
const NETINFO_LIST & GetNetInfo() const
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
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
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
bool IsHighLightNetON() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
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
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.
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.
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
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
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.
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(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.
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)
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
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 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.