47#include <wx/tokenzr.h>
48#include <wx/filedlg.h>
49#include <wx/dcclient.h>
50#include <wx/wupdlock.h>
88 operator unsigned int()
const
111 LIST_ITEM(
unsigned int aGroupNumber,
const wxString& aGroupName ) :
437 template <
typename T>
440 return a->GetNetCode() < b->GetNetCode();
443 template <
typename T>
446 return a->GetNetCode() < b;
449 template <
typename T>
452 return a < b->GetNetCode();
475 wxVariant
valueAt(
unsigned int aCol,
unsigned int aRow )
const
487 std::optional<LIST_ITEM_ITER>
findItem(
int aNetCode )
489 auto i = std::lower_bound(
492 if( i ==
m_items.end() || ( *i )->GetNetCode() != aNetCode )
500 if( aNet !=
nullptr )
506 std::optional<LIST_ITEM_ITER>
addItem( std::unique_ptr<LIST_ITEM> aItem )
508 if( aItem ==
nullptr )
516 auto new_iter = std::lower_bound(
m_items.begin(),
m_items.end(), aItem->GetNetCode(),
519 new_iter =
m_items.insert( new_iter, std::move( aItem ) );
520 const std::unique_ptr<LIST_ITEM>& new_item = *new_iter;
530 new_item->SetParent( &*
m_items[j] );
539 auto groups_begin =
m_items.begin();
540 auto groups_end = std::find_if_not(
m_items.begin(),
m_items.end(),
541 [](
const std::unique_ptr<LIST_ITEM>& x )
543 return x->GetIsGroup();
552 wxString match_str = new_item->GetNetName().substr( match.
start, match.
length );
554 auto group = std::find_if( groups_begin, groups_end,
555 [&](
const std::unique_ptr<LIST_ITEM>& x )
557 return x->GetNetName() == match_str;
560 if(
group == groups_end )
562 int dist = std::distance( groups_end, groups_begin );
564 std::make_unique<LIST_ITEM>( dist, match_str ) );
566 groups_end =
group + 1;
568 ItemAdded( wxDataViewItem(( *group )->Parent() ),
569 wxDataViewItem( &**
group ) );
572 new_item->SetParent( &**
group );
578 ItemAdded( wxDataViewItem( new_item->Parent() ), wxDataViewItem( new_item.get() ) );
583 void addItems( std::vector<std::unique_ptr<LIST_ITEM>> aItems )
615 std::vector<std::unique_ptr<LIST_ITEM>> groups;
617 for( std::unique_ptr<LIST_ITEM>& i :
m_items )
625 wxString match_str = i->GetNetName().substr( match.
start,
628 auto group = std::find_if( groups.begin(), groups.end(),
629 [&](
const std::unique_ptr<LIST_ITEM>& x )
631 return x->GetNetName() == match_str;
634 if(
group == groups.end() )
636 groups.emplace_back( std::make_unique<LIST_ITEM>( groups.size(),
638 group = groups.end() - 1;
641 i->SetParent( &**
group );
648 for( std::unique_ptr<LIST_ITEM>& g : groups )
649 m_items.emplace_back( std::move( g ) );
654 for( std::unique_ptr<LIST_ITEM>& i :
m_items )
655 ItemAdded( wxDataViewItem( i->Parent() ), wxDataViewItem( &*i ) );
661 for( std::unique_ptr<LIST_ITEM>& i : aItems )
666 std::unique_ptr<LIST_ITEM>
deleteItem(
const std::optional<LIST_ITEM_ITER>& aRow )
671 std::unique_ptr<LIST_ITEM> i = std::move( **aRow );
678 ItemDeleted( wxDataViewItem( parent ), wxDataViewItem( &*i ) );
682 ItemChanged( wxDataViewItem( parent ) );
690 [&]( std::unique_ptr<LIST_ITEM>& x )
692 return x.get() == parent;
695 wxASSERT( p !=
m_items.end() );
698 ItemDeleted( wxDataViewItem( parent->
Parent() ), wxDataViewItem( parent ) );
717 const std::unique_ptr<LIST_ITEM>& listItem = *aRow.value();
719 if( listItem->Parent() )
720 ItemChanged( wxDataViewItem( listItem->Parent() ) );
722 ItemChanged( wxDataViewItem( listItem.get() ) );
729 for( std::unique_ptr<LIST_ITEM>& i :
m_items )
730 ItemChanged( wxDataViewItem( i.get() ) );
737 bool changed =
false;
743 i->ResetColumnChangedBits();
791 void GetValue( wxVariant& aOutValue,
const wxDataViewItem& aItem,
792 unsigned int aCol )
const override
799 else if( aCol ==
COLUMN_NET && i->GetIsGroup() )
803 aOutValue = i->GetNetName();
831 static int compareUInt( uint64_t aValue1, uint64_t aValue2,
bool aAsc )
834 return aValue1 < aValue2 ? -1 : 1;
836 return aValue2 < aValue1 ? -1 : 1;
839 int Compare(
const wxDataViewItem& aItem1,
const wxDataViewItem& aItem2,
840 unsigned int aCol,
bool aAsc )
const override
895 wxUIntPtr id1 = wxPtrToUInt( aItem1.GetID() );
896 wxUIntPtr id2 = wxPtrToUInt( aItem2.GetID() );
898 return aAsc ? id1 - id2 : id2 - id1;
901 bool SetValue(
const wxVariant& aInValue,
const wxDataViewItem& aItem,
902 unsigned int aCol )
override
907 wxDataViewItem
GetParent(
const wxDataViewItem& aItem )
const override
910 return wxDataViewItem();
912 return wxDataViewItem(
static_cast<const LIST_ITEM*
>( aItem.GetID() )->
Parent() );
920 return static_cast<const LIST_ITEM*
>( aItem.GetID() )->GetIsGroup();
929 wxDataViewItemArray& aChildren )
const override
933 if( !aParent.IsOk() )
935 aChildren.Alloc(
m_items.size() );
937 for(
const std::unique_ptr<LIST_ITEM>& i :
m_items )
939 if( i->Parent() == nullptr )
940 aChildren.Add( wxDataViewItem( &*i ) );
943 return aChildren.GetCount();
952 aChildren.Alloc( count );
955 aChildren.Add( wxDataViewItem( *i ) );
957 return aChildren.GetCount();
965 return wxS(
"string" );
975 std::vector<std::unique_ptr<LIST_ITEM>>
m_items;
981 m_zero_netitem( nullptr ),
985 CSV_COLUMN_DESC::CSV_NONE,
false );
987 CSV_COLUMN_DESC::CSV_QUOTE,
false );
989 CSV_COLUMN_DESC::CSV_NONE,
false );
991 CSV_COLUMN_DESC::CSV_NONE,
false );
993 CSV_COLUMN_DESC::CSV_NONE,
true );
995 CSV_COLUMN_DESC::CSV_NONE,
true );
997 CSV_COLUMN_DESC::CSV_NONE,
true );
999 CSV_COLUMN_DESC::CSV_NONE,
true );
1006 std::vector<std::function<void(
void )>> add_col{
1011 wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT,
1012 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE );
1018 wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT,
1019 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE |
1020 wxDATAVIEW_COL_SORTABLE );
1026 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1027 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE |
1028 wxDATAVIEW_COL_SORTABLE );
1034 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1035 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE |
1036 wxDATAVIEW_COL_SORTABLE );
1042 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1043 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE |
1044 wxDATAVIEW_COL_SORTABLE );
1050 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1051 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE |
1052 wxDATAVIEW_COL_SORTABLE );
1058 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1059 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE |
1060 wxDATAVIEW_COL_SORTABLE );
1066 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1067 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE |
1068 wxDATAVIEW_COL_SORTABLE );
1072 auto& cfg =
Pgm().GetSettingsManager().GetAppSettings<
PCBNEW_SETTINGS>()->m_NetInspector;
1074 if( cfg.col_order.size() != add_col.size() )
1076 cfg.col_order.resize( add_col.size() );
1078 for(
int i = 0; i < (int) add_col.size(); ++i )
1079 cfg.col_order[i] = i;
1082 for(
int i : cfg.col_order )
1094 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1095 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE |
1096 wxDATAVIEW_COL_SORTABLE );
1132 if( cfg.sorting_column != -1 )
1134 if( wxDataViewColumn* c =
m_netsList->GetColumn( cfg.sorting_column ) )
1136 c->SetSortOrder( cfg.sort_order_asc );
1143 if( cfg.dlg_width > 0 && cfg.dlg_height > 0 )
1145 SetSize( cfg.dlg_width, cfg.dlg_height );
1152 if(
m_brd !=
nullptr )
1172 catch(
const std::runtime_error& err )
1174 wxLogWarning( wxS(
"%s" ), err.what() );
1180 wxDataViewColumn* sortingCol =
m_netsList->GetSortingColumn();
1188 cfg.
sorting_column = sortingCol ?
static_cast<int>( sortingCol->GetModelColumn() )
1190 cfg.
sort_order_asc = sortingCol ? sortingCol->IsSortOrderAscending()
1196 for(
unsigned int ii = 0; ii <
m_data_model->columnCount(); ++ii )
1214 if(
m_brd !=
nullptr )
1233 if(
m_brd !=
nullptr )
1253 return !aNet->
GetNetname().StartsWith( wxT(
"unconnected-(" ) );
1257 for(
const std::unique_ptr<EDA_PATTERN_MATCH>& f :
m_netFilter )
1259 if( f->Find( net_str ) )
1271 return a->
Net() < b->
Net();
1276 return a->
Net() < b;
1281 return a < b->
Net();
1292 const auto type_bits = std::bitset<MAX_STRUCT_TYPE_ID>()
1298 std::vector<CN_ITEM*> cn_items;
1299 cn_items.reserve( 1024 );
1303 if( cn_item->Valid() && type_bits[cn_item->Parent()->Type()] )
1304 cn_items.push_back( cn_item );
1318 wxDataViewItemArray sel;
1323 if( !sel.IsEmpty() )
1333 return wxString::Format( wxT(
"%.3d" ), aNet->
GetNetCode() );
1345 return wxString::Format( wxT(
"%u" ), aValue );
1365 std::unique_ptr<LIST_ITEM> new_item = std::make_unique<LIST_ITEM>( net );
1375 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem( i->GetNet() );
1382 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
1383 int len = track->GetLength();
1385 list_item->AddLayerWireLength( len,
static_cast<int>( track->GetLayer() ) );
1389 list_item->AddViaCount( 1 );
1403 for(
const PAD*
pad : footprint->Pads() )
1405 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem(
pad->GetNet() );
1415 r =
m_data_model->addItem( std::make_unique<LIST_ITEM>(
pad->GetNet() ) );
1420 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
1421 int len =
pad->GetPadToDieLength();
1423 list_item->AddPadCount( 1 );
1424 list_item->AddChipWireLength( len );
1453 for(
const PAD*
pad : footprint->Pads() )
1455 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem(
pad->GetNet() );
1459 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
1460 int len =
pad->GetPadToDieLength();
1462 list_item->SubPadCount( 1 );
1463 list_item->SubChipWireLength( len );
1474 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem( i->GetNet() );
1481 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
1482 int len = track->GetLength();
1484 list_item->SubLayerWireLength( len,
static_cast<int>( track->GetLayer() ) );
1488 list_item->SubViaCount( 1 );
1504 std::vector<BOARD_ITEM*>& aBoardItems )
1516 ||
dynamic_cast<FOOTPRINT*
>( aBoardItem ) !=
nullptr )
1525 std::vector<BOARD_ITEM*>& aBoardItems )
1542 wxDataViewItemArray new_selection;
1543 new_selection.Alloc( selected_codes.size() );
1545 for(
int code : selected_codes )
1547 if( std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem( code ) )
1548 new_selection.Add( wxDataViewItem( &***r ) );
1553 if( !new_selection.IsEmpty() )
1554 m_netsList->EnsureVisible( new_selection.Item( 0 ) );
1580 std::optional<LIST_ITEM_ITER> cur_net_row =
m_data_model->findItem( aNet );
1590 std::unique_ptr<LIST_ITEM> new_list_item =
buildNewItem( aNet, node_count,
1599 const std::unique_ptr<LIST_ITEM>& cur_list_item = *cur_net_row.value();
1601 if( cur_list_item->GetNetName() != new_list_item->GetNetName() )
1611 cur_list_item->SetPadCount( new_list_item->GetPadCount() );
1612 cur_list_item->SetViaCount( new_list_item->GetViaCount() );
1615 cur_list_item->SetLayerWireLength( new_list_item->GetLayerWireLength( ii ), ii );
1617 cur_list_item->SetChipWireLength( new_list_item->GetChipWireLength() );
1642 for(
int layer =
via->TopLayer(); layer <=
via->BottomLayer(); ++layer )
1654 top_layer =
via->TopLayer();
1656 bottom_layer =
via->BottomLayer();
1666 int effectiveBottomLayer;
1668 if(
via->BottomLayer() ==
B_Cu )
1669 effectiveBottomLayer =
F_Cu + dielectricLayers;
1671 effectiveBottomLayer =
via->BottomLayer();
1673 int layerCount = effectiveBottomLayer -
via->TopLayer();
1675 return layerCount * layerThickness;
1680std::unique_ptr<DIALOG_NET_INSPECTOR::LIST_ITEM>
1682 const std::vector<CN_ITEM*>& aCNItems )
1684 std::unique_ptr<LIST_ITEM> new_item = std::make_unique<LIST_ITEM>( aNet );
1686 new_item->SetPadCount( aPadCount );
1688 const auto cn_items = std::equal_range( aCNItems.begin(), aCNItems.end(), aNet->
GetNetCode(),
1691 for(
auto i = cn_items.first; i != cn_items.second; ++i )
1696 new_item->AddChipWireLength(
static_cast<PAD*
>( item )->GetPadToDieLength() );
1700 new_item->AddLayerWireLength( track->GetLength(),
1701 static_cast<int>( track->GetLayer() ) );
1705 new_item->AddViaCount( 1 );
1723 catch(
const std::runtime_error& err )
1725 wxLogWarning( wxS(
"%s" ), err.what() );
1729 if( !
m_brd || !app_settings )
1738 wxDataViewItemArray sel;
1741 std::vector<int> prev_selected_netcodes;
1742 prev_selected_netcodes.reserve( sel.GetCount() );
1744 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
1747 prev_selected_netcodes.push_back( item->
GetNetCode() );
1751 if( wxDataViewColumn* sorting_column =
m_netsList->GetSortingColumn() )
1753 cfg.
sorting_column =
static_cast<int>( sorting_column->GetModelColumn() ) ;
1755 sorting_column->UnsetAsSortKey();
1760 std::vector<std::unique_ptr<LIST_ITEM>> new_items;
1770 new_items.emplace_back( std::make_unique<LIST_ITEM>( i,
filter->GetPattern() ) );
1783 unsigned int pad_count;
1786 struct NET_INFO_CMP_LESS
1788 bool operator()(
const NET_INFO& a,
const NET_INFO& b )
const
1790 return a.netcode < b.netcode;
1792 bool operator()(
const NET_INFO& a,
int b )
const
1794 return a.netcode < b;
1796 bool operator()(
int a,
const NET_INFO& b )
const
1798 return a < b.netcode;
1802 std::vector<NET_INFO> nets;
1811 nets.emplace_back( NET_INFO{ ni.first, ni.second, 0 } );
1819 for(
PAD*
pad : footprint->Pads() )
1821 auto i = std::lower_bound( nets.begin(), nets.end(),
pad->GetNetCode(),
1822 NET_INFO_CMP_LESS() );
1824 if( i != nets.end() && i->netcode ==
pad->GetNetCode() )
1829 for( NET_INFO& ni : nets )
1832 new_items.emplace_back(
buildNewItem( ni.net, ni.pad_count, prefiltered_cn_items ) );
1850 for(
int& nc : prev_selected_netcodes )
1852 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem( nc );
1856 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
1857 sel.Add( wxDataViewItem( list_item.get() ) );
1865 if( !sel.IsEmpty() )
1879 for(
int& i : prev_selected_netcodes )
1891 wxStringTokenizer filters(
m_textCtrlFilter->GetValue().Upper(), wxT(
"," ) );
1894 while( filters.HasMoreTokens() )
1896 wxString t = filters.GetNextToken();
1902 m_netFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD>() );
1907 wxStringTokenizer group_filters(
m_groupByText->GetValue(), wxT(
"," ) );
1910 while( group_filters.HasMoreTokens() )
1912 wxString t = group_filters.GetNextToken();
1923 m_groupFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD>() );
1931 m_groupFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_REGEX>() );
1956 bool enable_rename_button =
false;
1957 bool enable_delete_button =
false;
1961 wxDataViewItemArray sel;
1966 enable_rename_button = sel.GetCount() == 1;
1967 enable_delete_button =
true;
1969 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
1975 enable_rename_button =
false;
1978 renderSettings->
SetHighlight(
true, ( *c )->GetNetCode(), true );
2022 catch(
const std::runtime_error& err )
2024 wxLogWarning( wxS(
"%s" ), err.what() );
2037 cfg.
col_widths.push_back( GetTextExtent( m_column.display_name ).x );
2039 int minValueWidth = GetTextExtent( wxT(
"00000,000 mm" ) ).x;
2040 int minNumberWidth = GetTextExtent( wxT(
"000" ) ).x;
2041 int minNameWidth = GetTextExtent( wxT(
"MMMMMM" ) ).x;
2047 const int margins = 15;
2048 const int extra_width = 30;
2055 for(
size_t ii = 4; ii < cfg.
col_widths.size(); ++ii )
2059 for(
size_t ii = 0; ii <
m_data_model->columnCount(); ++ii )
2076 wxString newNetName;
2084 if( dlg.ShowModal() != wxID_OK || dlg.
GetValue().IsEmpty() )
2091 DisplayError(
this, wxString::Format(
_(
"Net name '%s' is already in use." ),
2093 newNetName = wxEmptyString;
2112 if(
m_netsList->GetSelectedItemsCount() == 1 )
2122 wxString shortNetName;
2124 if( fullNetName.Contains( wxT(
"/" ) ) )
2126 netPath = fullNetName.BeforeLast(
'/' ) +
'/';
2127 shortNetName = fullNetName.AfterLast(
'/' );
2131 shortNetName = fullNetName;
2142 if( dlg.ShowModal() != wxID_OK || dlg.
GetValue() == unescapedShortName )
2145 unescapedShortName = dlg.
GetValue();
2147 if( unescapedShortName.IsEmpty() )
2149 DisplayError(
this, wxString::Format(
_(
"Net name cannot be empty." ),
2150 unescapedShortName ) );
2155 fullNetName = netPath + shortNetName;
2159 DisplayError(
this, wxString::Format(
_(
"Net name '%s' is already in use." ),
2160 unescapedShortName ) );
2161 unescapedShortName = wxEmptyString;
2171 if( boardItem->GetNet() == net )
2187 boardItem->SetNet( net );
2192 if( std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem( net ) )
2193 m_netsList->Select( wxDataViewItem( r.value()->get() ) );
2211 wxDataViewItemArray sel;
2217 if( i->GetPadCount() == 0
2218 ||
IsOK(
this, wxString::Format(
_(
"Net '%s' is in use. Delete anyway?" ),
2219 i->GetNetName() ) ) )
2223 int removedCode = i->GetNetCode();
2230 if( boardItem && boardItem->GetNetCode() == removedCode )
2237 text->ClearRenderCache();
2238 text->ClearBoundingBoxCache();
2252 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
2259 &&
IsOK(
this, wxString::Format(
_(
"Delete all nets in group '%s'?" ),
2264 std::vector<const LIST_ITEM*> children;
2282 wxFileDialog dlg(
this,
_(
"Save Report File" ),
"",
"",
2284 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
2286 if( dlg.ShowModal() == wxID_CANCEL )
2289 wxTextFile f( dlg.GetPath() );
2304 txt += wxString::Format(
_(
"%s (%s)" ), col.csv_name,
2309 txt += col.csv_name;
2311 txt += wxT(
"\";" );
2317 const unsigned int num_rows =
m_data_model->itemCount();
2319 for(
unsigned int row = 0; row < num_rows; row++ )
2323 if( i.GetIsGroup() || i.GetNetCode() == 0 )
2330 if(
static_cast<int>( col.csv_flags ) &
static_cast<int>( CSV_COLUMN_DESC::CSV_QUOTE ) )
2331 txt +=
'"' +
m_data_model->valueAt( col.num, row ).GetString() + wxT(
"\";" );
2333 txt +=
m_data_model->valueAt( col.num, row ).GetString() +
';';
2351 wxCommandEvent* evt =
new wxCommandEvent( EDA_EVT_CLOSE_NET_INSPECTOR_DIALOG, wxID_ANY );
2353 evt->SetEventObject(
this );
2354 wxWindow* parent = GetParent();
2357 wxQueueEvent( parent, evt );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
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.
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.
FOOTPRINTS & Footprints()
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 RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
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,...
std::optional< LIST_ITEM_ITER > findItem(int aNetCode)
unsigned int GetColumnCount() const override
void resortIfChanged(LIST_ITEM *aItem)
wxDataViewItem GetParent(const wxDataViewItem &aItem) const override
bool SetValue(const wxVariant &aInValue, const wxDataViewItem &aItem, unsigned int aCol) override
static int compareUInt(uint64_t aValue1, uint64_t aValue2, bool aAsc)
void GetValue(wxVariant &aOutValue, const wxDataViewItem &aItem, unsigned int aCol) const override
int Compare(const wxDataViewItem &aItem1, const wxDataViewItem &aItem2, unsigned int aCol, bool aAsc) const override
void addItems(std::vector< std::unique_ptr< LIST_ITEM > > aItems)
bool HasContainerColumns(const wxDataViewItem &aItem) const override
std::vector< std::unique_ptr< LIST_ITEM > > m_items
bool IsContainer(const wxDataViewItem &aItem) const override
const LIST_ITEM & itemAt(unsigned int aRow) const
wxString GetColumnType(unsigned int) const override
DATA_MODEL(DIALOG_NET_INSPECTOR &parent)
void updateItem(const std::optional< LIST_ITEM_ITER > &aRow)
std::optional< LIST_ITEM_ITER > addItem(std::unique_ptr< LIST_ITEM > aItem)
unsigned int columnCount() const
std::optional< LIST_ITEM_ITER > findItem(NETINFO_ITEM *aNet)
unsigned int GetChildren(const wxDataViewItem &aParent, wxDataViewItemArray &aChildren) const override
std::unique_ptr< LIST_ITEM > deleteItem(const std::optional< LIST_ITEM_ITER > &aRow)
unsigned int itemCount() const
DIALOG_NET_INSPECTOR & m_parent
wxVariant valueAt(unsigned int aCol, unsigned int aRow) const
bool itemColumnChanged(const LIST_ITEM *aItem, unsigned int aCol) const
unsigned long long int GetTotalLength() const
uint64_t m_chip_wire_length
void SetPadCount(unsigned int aValue)
unsigned int GetPadCount() const
void SubLayerWireLength(const uint64_t aValue, size_t aLayer)
bool ViaLengthChanged() const
LIST_ITEM * Parent() const
unsigned int m_group_number
void SetChipWireLength(uint64_t aValue)
LIST_ITEM & operator=(const LIST_ITEM &)=delete
void ResetColumnChangedBits()
uint64_t GetViaLength() const
void SubChipWireLength(uint64_t aValue)
std::array< uint64_t, MAX_CU_LAYERS > m_layer_wire_length
bool ViaCountChanged() const
void AddPadCount(unsigned int aValue)
const wxString & GetNetName() const
uint64_t GetLayerWireLength(size_t aLayer) const
void SetViaLength(unsigned int aValue)
NETINFO_ITEM * GetNet() const
void SubViaLength(uint64_t aValue)
void AddViaLength(unsigned int aValue)
void SetLayerWireLength(const uint64_t aValue, size_t aLayer)
unsigned int ChildrenCount() const
void AddChipWireLength(uint64_t aValue)
void AddViaCount(unsigned int aValue)
auto ChildrenBegin() const
std::vector< LIST_ITEM * > m_children
uint64_t GetChipWireLength() const
std::vector< int > m_column_changed
unsigned GetViaCount() const
bool BoardWireLengthChanged() const
LIST_ITEM(unsigned int aGroupNumber, const wxString &aGroupName)
bool TotalLengthChanged() const
void SetParent(LIST_ITEM *aParent)
uint64_t GetBoardWireLength() const
LIST_ITEM(NETINFO_ITEM *aNet)
void SubPadCount(unsigned int aValue)
const wxString & GetGroupName() const
void AddLayerWireLength(const uint64_t aValue, size_t aLayer)
bool PadCountChanged() const
bool ChipWireLengthChanged() const
void SubViaCount(unsigned int aValue)
void SetViaCount(unsigned int aValue)
Class DIALOG_NET_INSPECTOR_BASE.
STD_BITMAP_BUTTON * m_renameNet
wxDataViewCtrl * m_netsList
wxComboBox * m_groupByKind
wxCheckBox * m_cbShowZeroPad
wxTextCtrl * m_groupByText
wxButton * m_sdbSizerCancel
wxTextCtrl * m_textCtrlFilter
STD_BITMAP_BUTTON * m_deleteNet
STD_BITMAP_BUTTON * m_addNet
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
DIALOG_NET_INSPECTOR(PCB_EDIT_FRAME *aParent)
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
bool m_filter_change_no_rebuild
void onSortingChanged(wxDataViewEvent &event) override
unsigned int calculateViaLength(const PCB_TRACK *) const
wxString formatNetCode(const NETINFO_ITEM *aNet) const
NETINFO_ITEM * m_zero_netitem
std::vector< COLUMN_DESC > m_columns
bool m_in_build_nets_list
wxString formatCount(unsigned int aValue) const
void onBoardChanged(wxCommandEvent &event)
void SetupStandardButtons(std::map< int, wxString > aLabels={})
bool IsQuasiModal() const
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
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.
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.
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
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.
DIALOG_NET_INSPECTOR m_NetInspector
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.
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
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.
static wxString g_filter_string
wxDEFINE_EVENT(EDA_EVT_CLOSE_NET_INSPECTOR_DIALOG, wxCommandEvent)
#define CANDIDATE
flag indicating that the structure is connected
Abstract pattern-matching tool and implementations.
bool IsCopperLayer(int aLayerId)
Tests 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.
void delete_matching(_Container &__c, _Value __value)
Covers for the horrifically named std::remove and std::remove_if (neither of which remove anything).
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
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:...
int ValueStringCompare(const wxString &strFWord, const wxString &strSWord)
Compare strings like the strcmp function but handle numbers and modifiers within the string text corr...
COLUMN_DESC(unsigned aNum, PCB_LAYER_ID aLayer, const wxString &aDisp, const wxString &aCsv, CSV_COLUMN_DESC aFlags, bool aHasUnits)
CSV_COLUMN_DESC csv_flags
bool operator()(const T &a, const T &b) const
bool operator()(const T &a, int b) const
bool operator()(int a, const T &b) const
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
std::vector< int > col_widths
std::vector< int > col_order
@ 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.