44#include <wx/tokenzr.h>
45#include <wx/filedlg.h>
46#include <wx/dcclient.h>
47#include <wx/wupdlock.h>
71 operator unsigned int()
const
118 LIST_ITEM(
unsigned int aGroupNumber,
const wxString& aGroupName ) :
420 template <
typename T>
423 return a->GetNetCode() < b->GetNetCode();
426 template <
typename T>
429 return a->GetNetCode() < b;
432 template <
typename T>
435 return a < b->GetNetCode();
449 std::vector<std::unique_ptr<LIST_ITEM>>
m_items;
467 wxVariant
valueAt(
unsigned int aCol,
unsigned int aRow )
const
479 std::optional<LIST_ITEM_ITER>
findItem(
int aNetCode )
481 auto i = std::lower_bound(
484 if( i ==
m_items.end() || ( *i )->GetNetCode() != aNetCode )
492 if( aNet !=
nullptr )
498 std::optional<LIST_ITEM_ITER>
addItem( std::unique_ptr<LIST_ITEM> aItem )
500 if( aItem ==
nullptr )
508 auto new_iter = std::lower_bound(
m_items.begin(),
m_items.end(), aItem->GetNetCode(),
511 new_iter =
m_items.insert( new_iter, std::move( aItem ) );
512 const std::unique_ptr<LIST_ITEM>& new_item = *new_iter;
522 new_item->SetParent( &*
m_items[j] );
531 auto groups_begin =
m_items.begin();
532 auto groups_end = std::find_if_not(
m_items.begin(),
m_items.end(),
533 [](
const std::unique_ptr<LIST_ITEM>& x )
535 return x->GetIsGroup();
544 wxString match_str = new_item->GetNetName().substr( match.
start, match.
length );
546 auto group = std::find_if( groups_begin, groups_end,
547 [&](
const std::unique_ptr<LIST_ITEM>& x )
549 return x->GetNetName() == match_str;
552 if(
group == groups_end )
556 std::make_unique<LIST_ITEM>( dist, match_str ) );
558 groups_end =
group + 1;
560 ItemAdded( wxDataViewItem(( *group )->Parent() ),
561 wxDataViewItem( &**
group ) );
564 new_item->SetParent( &**
group );
570 ItemAdded( wxDataViewItem( new_item->Parent() ), wxDataViewItem( new_item.get() ) );
575 void addItems( std::vector<std::unique_ptr<LIST_ITEM>>&& aItems )
607 std::vector<std::unique_ptr<LIST_ITEM>> groups;
609 for( std::unique_ptr<LIST_ITEM>& i :
m_items )
617 wxString match_str = i->GetNetName().substr( match.
start, match.
length );
619 auto group = std::find_if( groups.begin(), groups.end(),
620 [&](
const std::unique_ptr<LIST_ITEM>& x )
622 return x->GetNetName() == match_str;
625 if(
group == groups.end() )
627 groups.emplace_back( std::make_unique<LIST_ITEM>( groups.size(),
629 group = groups.end() - 1;
632 i->SetParent( &**
group );
639 for( std::unique_ptr<LIST_ITEM>& g : groups )
640 m_items.emplace_back( std::move( g ) );
645 for( std::unique_ptr<LIST_ITEM>& i :
m_items )
646 ItemAdded( wxDataViewItem( i->Parent() ), wxDataViewItem( &*i ) );
652 for( std::unique_ptr<LIST_ITEM>& i : aItems )
657 std::unique_ptr<LIST_ITEM>
deleteItem(
const std::optional<LIST_ITEM_ITER>& aRow )
662 std::unique_ptr<LIST_ITEM> i = std::move( **aRow );
669 ItemDeleted( wxDataViewItem( parent ), wxDataViewItem( &*i ) );
673 ItemChanged( wxDataViewItem( parent ) );
681 [&]( std::unique_ptr<LIST_ITEM>& x )
683 return x.get() == parent;
686 wxASSERT( p !=
m_items.end() );
689 ItemDeleted( wxDataViewItem( parent->
Parent() ), wxDataViewItem( parent ) );
708 const std::unique_ptr<LIST_ITEM>& listItem = *aRow.value();
710 if( listItem->Parent() )
711 ItemChanged( wxDataViewItem( listItem->Parent() ) );
713 ItemChanged( wxDataViewItem( listItem.get() ) );
720 for( std::unique_ptr<LIST_ITEM>& i :
m_items )
721 ItemChanged( wxDataViewItem( i.get() ) );
728 bool changed =
false;
734 i->ResetColumnChangedBits();
782 void GetValue( wxVariant& aOutValue,
const wxDataViewItem& aItem,
783 unsigned int aCol )
const override
790 else if( aCol ==
COLUMN_NET && i->GetIsGroup() )
794 aOutValue = i->GetNetName();
819 static int compareUInt( uint64_t aValue1, uint64_t aValue2,
bool aAsc )
822 return aValue1 < aValue2 ? -1 : 1;
824 return aValue2 < aValue1 ? -1 : 1;
827 int Compare(
const wxDataViewItem& aItem1,
const wxDataViewItem& aItem2,
828 unsigned int aCol,
bool aAsc )
const override
849 int res = aAsc ? s1.Cmp( s2 ) : s2.Cmp( s1 );
883 wxUIntPtr id1 = wxPtrToUInt( aItem1.GetID() );
884 wxUIntPtr id2 = wxPtrToUInt( aItem2.GetID() );
886 return aAsc ? id1 - id2 : id2 - id1;
889 bool SetValue(
const wxVariant& aInValue,
const wxDataViewItem& aItem,
890 unsigned int aCol )
override
895 wxDataViewItem
GetParent(
const wxDataViewItem& aItem )
const override
898 return wxDataViewItem();
900 return wxDataViewItem(
static_cast<const LIST_ITEM*
>( aItem.GetID() )->
Parent() );
908 return static_cast<const LIST_ITEM*
>( aItem.GetID() )->GetIsGroup();
917 wxDataViewItemArray& aChildren )
const override
921 if( !aParent.IsOk() )
923 aChildren.Alloc(
m_items.size() );
925 for(
const std::unique_ptr<LIST_ITEM>& i :
m_items )
927 if( i->Parent() == nullptr )
928 aChildren.Add( wxDataViewItem( &*i ) );
931 return aChildren.GetCount();
940 aChildren.Alloc( count );
943 aChildren.Add( wxDataViewItem( *i ) );
945 return aChildren.GetCount();
953 return wxS(
"string" );
961 m_zero_netitem( nullptr ),
978 std::vector<std::function<void(
void )>> add_col{
982 wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT,
983 wxDATAVIEW_COL_SORTABLE );
988 wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT,
989 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE |
990 wxDATAVIEW_COL_SORTABLE );
995 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
996 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1001 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1002 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1007 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1008 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1013 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1014 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1019 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1020 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1025 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1026 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1032 if( col_order.size() != add_col.size() )
1034 col_order.resize( add_col.size() );
1036 for(
unsigned int i = 0; i < add_col.size(); ++i )
1040 for(
unsigned int i : col_order )
1052 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1053 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1093 m_frame->Connect( wxEVT_CLOSE_WINDOW,
1096 m_frame->Connect( UNITS_CHANGED,
1099 m_frame->Connect( BOARD_CHANGED,
1103 if(
m_brd !=
nullptr )
1120 m_frame->Disconnect( wxEVT_CLOSE_WINDOW,
1123 m_frame->Disconnect( UNITS_CHANGED,
1126 m_frame->Disconnect( BOARD_CHANGED,
1130 if(
m_brd !=
nullptr )
1139 std::vector<int> column_order(
m_data_model->columnCount() );
1141 for(
unsigned int i = 0; i < column_order.size(); ++i )
1142 column_order[i] =
m_netsList->GetColumn( i )->GetModelColumn();
1144 wxDataViewColumn* sorting_column =
m_netsList->GetSortingColumn();
1152 r.
sorting_column = sorting_column ?
static_cast<int>( sorting_column->GetModelColumn() ) : -1;
1153 r.
sort_order_asc = sorting_column ? sorting_column->IsSortOrderAscending() :
true;
1181 if(
m_brd !=
nullptr )
1201 return !aNet->
GetNetname().StartsWith( wxT(
"unconnected-(" ) );
1205 for(
const std::unique_ptr<EDA_PATTERN_MATCH>& f :
m_netFilter )
1207 if( f->Find( net_str ) )
1219 return a->
Net() < b->
Net();
1224 return a->
Net() < b;
1229 return a < b->
Net();
1240 const auto type_bits = std::bitset<MAX_STRUCT_TYPE_ID>()
1246 std::vector<CN_ITEM*> cn_items;
1247 cn_items.reserve( 1024 );
1251 if( cn_item->Valid() && type_bits[cn_item->Parent()->Type()] )
1252 cn_items.push_back( cn_item );
1266 wxDataViewItemArray sel;
1271 if( !sel.IsEmpty() )
1312 std::unique_ptr<LIST_ITEM> new_item = std::make_unique<LIST_ITEM>( net );
1322 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem( i->GetNet() );
1329 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
1330 int len = track->GetLength();
1332 list_item->AddLayerWireLength( len,
static_cast<int>( track->GetLayer() ) );
1336 list_item->AddViaCount( 1 );
1350 for(
const PAD*
pad : footprint->Pads() )
1352 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem(
pad->GetNet() );
1362 r =
m_data_model->addItem( std::make_unique<LIST_ITEM>(
pad->GetNet() ) );
1367 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
1368 int len =
pad->GetPadToDieLength();
1370 list_item->AddPadCount( 1 );
1371 list_item->AddChipWireLength( len );
1400 for(
const PAD*
pad : footprint->Pads() )
1402 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem(
pad->GetNet() );
1406 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
1407 int len =
pad->GetPadToDieLength();
1409 list_item->SubPadCount( 1 );
1410 list_item->SubChipWireLength( len );
1421 std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem( i->GetNet() );
1428 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
1429 int len = track->GetLength();
1431 list_item->SubLayerWireLength( len,
static_cast<int>( track->GetLayer() ) );
1435 list_item->SubViaCount( 1 );
1451 std::vector<BOARD_ITEM*>& aBoardItems )
1463 ||
dynamic_cast<FOOTPRINT*
>( aBoardItem ) !=
nullptr )
1472 std::vector<BOARD_ITEM*>& aBoardItems )
1489 wxDataViewItemArray new_selection;
1490 new_selection.Alloc( selected_codes.size() );
1492 for(
int code : selected_codes )
1494 if( std::optional<LIST_ITEM_ITER> r =
m_data_model->findItem( code ) )
1495 new_selection.Add( wxDataViewItem( &***r ) );
1500 if( !new_selection.IsEmpty() )
1501 m_netsList->EnsureVisible( new_selection.Item( 0 ) );
1527 std::optional<LIST_ITEM_ITER> cur_net_row =
m_data_model->findItem( aNet );
1537 std::unique_ptr<LIST_ITEM> new_list_item =
buildNewItem( aNet, node_count,
1546 const std::unique_ptr<LIST_ITEM>& cur_list_item = *cur_net_row.value();
1548 if( cur_list_item->GetNetName() != new_list_item->GetNetName() )
1558 cur_list_item->SetPadCount( new_list_item->GetPadCount() );
1559 cur_list_item->SetViaCount( new_list_item->GetViaCount() );
1562 cur_list_item->SetLayerWireLength( new_list_item->GetLayerWireLength( ii ), ii );
1564 cur_list_item->SetChipWireLength( new_list_item->GetChipWireLength() );
1589 for(
int layer =
via->TopLayer(); layer <=
via->BottomLayer(); ++layer )
1601 top_layer =
via->TopLayer();
1603 bottom_layer =
via->BottomLayer();
1613 int effectiveBottomLayer;
1615 if(
via->BottomLayer() ==
B_Cu )
1616 effectiveBottomLayer =
F_Cu + dielectricLayers;
1618 effectiveBottomLayer =
via->BottomLayer();
1620 int layerCount = effectiveBottomLayer -
via->TopLayer();
1622 return layerCount * layerThickness;
1627std::unique_ptr<DIALOG_NET_INSPECTOR::LIST_ITEM>
1629 const std::vector<CN_ITEM*>& aCNItems )
1631 std::unique_ptr<LIST_ITEM> new_item = std::make_unique<LIST_ITEM>( aNet );
1633 new_item->SetPadCount( aPadCount );
1635 const auto cn_items = std::equal_range( aCNItems.begin(), aCNItems.end(), aNet->
GetNetCode(),
1638 for(
auto i = cn_items.first; i != cn_items.second; ++i )
1643 new_item->AddChipWireLength(
static_cast<PAD*
>( item )->GetPadToDieLength() );
1647 new_item->AddLayerWireLength( track->GetLength(),
static_cast<int>( track->GetLayer() ) );
1651 new_item->AddViaCount( 1 );
1671 wxDataViewItemArray sel;
1674 std::vector<int> prev_selected_netcodes;
1675 prev_selected_netcodes.reserve( sel.GetCount() );
1677 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
1680 prev_selected_netcodes.push_back( item->
GetNetCode() );
1685 std::vector<std::unique_ptr<LIST_ITEM>> new_items;
1695 new_items.emplace_back( std::make_unique<LIST_ITEM>( i,
filter->GetPattern() ) );
1708 unsigned int pad_count;
1711 struct NET_INFO_CMP_LESS
1713 bool operator()(
const NET_INFO& a,
const NET_INFO& b )
const
1715 return a.netcode < b.netcode;
1717 bool operator()(
const NET_INFO& a,
int b )
const
1719 return a.netcode < b;
1721 bool operator()(
int a,
const NET_INFO& b )
const
1723 return a < b.netcode;
1727 std::vector<NET_INFO> nets;
1736 nets.emplace_back( NET_INFO{ ni.first, ni.second, 0 } );
1744 for(
PAD*
pad : footprint->Pads() )
1746 auto i = std::lower_bound( nets.begin(), nets.end(),
pad->GetNetCode(),
1747 NET_INFO_CMP_LESS() );
1749 if( i != nets.end() && i->netcode ==
pad->GetNetCode() )
1754 for( NET_INFO& ni : nets )
1757 new_items.emplace_back(
buildNewItem( ni.net, ni.pad_count, prefiltered_cn_items ) );
1766 for(
int& nc : prev_selected_netcodes )
1772 const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
1773 sel.Add( wxDataViewItem( list_item.get() ) );
1781 if( !sel.IsEmpty() )
1795 for(
int& i : prev_selected_netcodes )
1807 wxStringTokenizer filters(
m_textCtrlFilter->GetValue().Upper(), wxT(
"," ) );
1810 while( filters.HasMoreTokens() )
1812 wxString t = filters.GetNextToken();
1818 m_netFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD>() );
1823 wxStringTokenizer group_filters(
m_groupByText->GetValue(), wxT(
"," ) );
1826 while( group_filters.HasMoreTokens() )
1828 wxString t = group_filters.GetNextToken();
1839 m_groupFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD>() );
1847 m_groupFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_REGEX>() );
1872 bool enable_rename_button =
false;
1873 bool enable_delete_button =
false;
1877 wxDataViewItemArray sel;
1882 enable_rename_button = sel.GetCount() == 1;
1883 enable_delete_button =
true;
1885 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
1891 enable_rename_button =
false;
1929 std::vector<int> widths;
1933 for(
size_t ii = 0; ii <
m_columns.size(); ++ii )
1934 widths.push_back( GetTextExtent(
m_columns[ii].display_name ).x );
1936 int minValueWidth = GetTextExtent( wxT(
"00000,000 mm" ) ).x;
1937 int minNumberWidth = GetTextExtent( wxT(
"000" ) ).x;
1938 int minNameWidth = GetTextExtent( wxT(
"MMMMMM" ) ).x;
1944 const int margins = 15;
1945 const int extra_width = 30;
1947 widths[0] = std::max( widths[0], minNumberWidth ) + extra_width;
1948 widths[1] = std::max( widths[1], minNameWidth ) + margins;
1949 widths[2] = std::max( widths[2], minNumberWidth ) + margins;
1950 widths[3] = std::max( widths[3], minNumberWidth ) + margins;
1952 for(
size_t ii = 4; ii < widths.size(); ++ii )
1954 widths[ii] = std::max( widths[ii], minValueWidth ) + margins;
1958 std::vector<int> column_order(
m_data_model->columnCount() );
1960 for(
size_t i = 0; i < column_order.size(); ++i )
1962 column_order[
m_netsList->GetColumn( i )->GetModelColumn()] = i;
1963 m_netsList->GetColumn( column_order[i] )->SetMinWidth( widths[i] );
1964 m_netsList->GetColumn( column_order[i] )->SetWidth( widths[i] );
1968 int width =
m_netsList->GetClientSize().x - 24;
1969 int remaining = width - std::accumulate( widths.begin() + 2, widths.end(), widths[0] );
1971 if( remaining > widths[1] )
1972 m_netsList->GetColumn( column_order[1] )->SetWidth( remaining );
1987 auto new_size = aEvent.GetSize();
2001 wxString newNetName;
2009 if( dlg.ShowModal() != wxID_OK || dlg.
GetValue().IsEmpty() )
2018 newNetName = wxEmptyString;
2037 if(
m_netsList->GetSelectedItemsCount() == 1 )
2047 wxString shortNetName;
2049 if( fullNetName.Contains( wxT(
"/" ) ) )
2051 netPath = fullNetName.BeforeLast(
'/' ) +
'/';
2052 shortNetName = fullNetName.AfterLast(
'/' );
2056 shortNetName = fullNetName;
2067 if( dlg.ShowModal() != wxID_OK || dlg.
GetValue() == unescapedShortName )
2070 unescapedShortName = dlg.
GetValue();
2072 if( unescapedShortName.IsEmpty() )
2075 unescapedShortName ) );
2080 fullNetName = netPath + shortNetName;
2085 unescapedShortName ) );
2086 unescapedShortName = wxEmptyString;
2105 std::unique_ptr<LIST_ITEM> new_item = std::make_unique<LIST_ITEM>( net );
2106 new_item->SetPadCount( removed_item->GetPadCount() );
2107 new_item->SetViaCount( removed_item->GetViaCount() );
2110 new_item->SetLayerWireLength( removed_item->GetLayerWireLength( ii ), ii );
2112 new_item->SetChipWireLength( removed_item->GetChipWireLength() );
2114 std::optional<LIST_ITEM_ITER> added_row =
m_data_model->addItem( std::move( new_item ) );
2116 wxDataViewItemArray new_sel;
2117 new_sel.Add( wxDataViewItem( &***added_row ) );
2136 wxDataViewItemArray sel;
2142 if( i->GetPadCount() == 0
2144 i->GetNetName() ) ) )
2148 int removedCode = i->GetNetCode();
2155 if( boardItem && boardItem->GetNetCode() == removedCode )
2162 text->ClearRenderCache();
2163 text->ClearBoundingBoxCache();
2177 for(
unsigned int i = 0; i < sel.GetCount(); ++i )
2189 std::vector<const LIST_ITEM*> children;
2207 wxFileDialog dlg(
this,
_(
"Report file" ),
"",
"",
2211 if( dlg.ShowModal() == wxID_CANCEL )
2214 wxTextFile f( dlg.GetPath() );
2222 txt +=
'"' + col.csv_name + wxT(
"\";" );
2227 const unsigned int num_rows =
m_data_model->itemCount();
2229 for(
unsigned int row = 0; row < num_rows; row++ )
2233 if( i.GetIsGroup() || i.GetNetCode() == 0 )
2241 txt +=
'"' +
m_data_model->valueAt( col.num, row ).GetString() + wxT(
"\";" );
2243 txt +=
m_data_model->valueAt( col.num, row ).GetString() +
';';
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
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
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,...
int Net() const
allow parallel connection threads
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
void addItems(std::vector< std::unique_ptr< LIST_ITEM > > &&aItems)
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
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
void SetViaCount(const decltype(m_via_count) &aValue)
unsigned long long int GetTotalLength() const
void SubViaLength(const decltype(m_via_length) &aValue)
uint64_t m_chip_wire_length
void SetChipWireLength(const decltype(m_chip_wire_length) &aValue)
void SubLayerWireLength(const uint64_t aValue, size_t aLayer)
bool ViaLengthChanged() const
LIST_ITEM * Parent() const
unsigned int m_group_number
LIST_ITEM & operator=(const LIST_ITEM &)=delete
void ResetColumnChangedBits()
uint64_t GetViaLength() const
std::array< uint64_t, MAX_CU_LAYERS > m_layer_wire_length
bool ViaCountChanged() const
const wxString & GetNetName() const
uint64_t GetLayerWireLength(size_t aLayer) const
void SetViaLength(const decltype(m_via_length) &aValue)
void AddViaCount(const decltype(m_via_count) &aValue)
NETINFO_ITEM * GetNet() const
void SubViaCount(const decltype(m_via_count) &aValue)
void SetLayerWireLength(const uint64_t aValue, size_t aLayer)
unsigned int ChildrenCount() const
void AddChipWireLength(const decltype(m_chip_wire_length) &aValue)
auto ChildrenBegin() const
std::vector< LIST_ITEM * > m_children
uint64_t GetChipWireLength() const
unsigned GetViaCount() const
bool BoardWireLengthChanged() const
LIST_ITEM(unsigned int aGroupNumber, const wxString &aGroupName)
void SubPadCount(const decltype(m_pad_count) &aValue)
bool TotalLengthChanged() const
void SetParent(LIST_ITEM *aParent)
void SubChipWireLength(const decltype(m_chip_wire_length) &aValue)
uint64_t GetBoardWireLength() const
LIST_ITEM(NETINFO_ITEM *aNet)
std::vector< char > m_column_changed
void AddPadCount(const decltype(m_pad_count) &aValue)
const wxString & GetGroupName() const
void AddLayerWireLength(const uint64_t aValue, size_t aLayer)
bool PadCountChanged() const
void AddViaLength(const decltype(m_via_length) &aValue)
bool ChipWireLengthChanged() const
void SetPadCount(const decltype(m_pad_count) &aValue)
decltype(m_pad_count) GetPadCount() const
Class DIALOG_NET_INSPECTOR_BASE.
STD_BITMAP_BUTTON * m_renameNet
wxDataViewCtrl * m_netsList
wxComboBox * m_groupByKind
wxCheckBox * m_cbShowZeroPad
wxTextCtrl * m_groupByText
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, const SETTINGS &aSettings)
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 OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems) override
void onListSize(wxSizeEvent &event) override
void onParentWindowClosed(wxCommandEvent &event)
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)
SETTINGS Settings() const
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={})
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
Update the board display after modifying it by a python script (note: it is automatically called by a...
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
void RemoveNet(NETINFO_ITEM *aNet)
Remove a net from the net list.
const NETCODES_MAP & NetsByNetcode() const
Return the netcode map, at least for python.
void AppendNet(NETINFO_ITEM *aNewElement)
Add aNewElement to the end of the net list.
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)
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.
Abstract pattern-matching tool and implementations.
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
@ 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).
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
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:...
CSV_COLUMN_DESC csv_flags
COLUMN_DESC(unsigned aNum, PCB_LAYER_ID aLayer, const wxString &aDisp, const wxString &aCsv, CSV_COLUMN_DESC aFlags)
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
std::vector< int > column_order
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
@ 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.
Definition of file extensions used in Kicad.