KiCad PCB EDA Suite
DIALOG_NET_INSPECTOR Class Reference

#include <dialog_net_inspector.h>

Inheritance diagram for DIALOG_NET_INSPECTOR:
DIALOG_NET_INSPECTOR_BASE BOARD_LISTENER DIALOG_SHIM KIWAY_HOLDER

Classes

struct  COLUMN_DESC
 
class  DATA_MODEL
 
class  LIST_ITEM
 
struct  LIST_ITEM_NETCODE_CMP_LESS
 
struct  SETTINGS
 

Public Types

enum  HOLDER_TYPE { DIALOG , FRAME , PANEL }
 

Public Member Functions

 DIALOG_NET_INSPECTOR (PCB_EDIT_FRAME *aParent, const SETTINGS &aSettings)
 
 ~DIALOG_NET_INSPECTOR ()
 
SETTINGS Settings () const
 
virtual void OnBoardItemAdded (BOARD &aBoard, BOARD_ITEM *aBoardItem) override
 
virtual void OnBoardItemsAdded (BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems) override
 
virtual void OnBoardItemRemoved (BOARD &aBoard, BOARD_ITEM *aBoardItem) override
 
virtual void OnBoardItemsRemoved (BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems) override
 
virtual void OnBoardNetSettingsChanged (BOARD &aBoard) override
 
virtual void OnBoardItemChanged (BOARD &aBoard, BOARD_ITEM *aBoardItem) override
 
virtual void OnBoardItemsChanged (BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems) override
 
virtual void OnBoardHighlightNetChanged (BOARD &aBoard) override
 
void SetInitialFocus (wxWindow *aWindow)
 Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown. More...
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal () const
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
void OnModify ()
 
void SetPosition (const wxPoint &aNewPosition)
 Force the position of the dialog to a new position. More...
 
EDA_UNITS GetUserUnits () const
 
void SetupStandardButtons (std::map< int, wxString > aLabels={})
 
HOLDER_TYPE GetType () const
 
KIWAYKiway () const
 Return a reference to the KIWAY that this object has an opportunity to participate in. More...
 
bool HasKiway () const
 Safety check before asking for the Kiway reference. More...
 
PROJECTPrj () const
 Return a reference to the PROJECT associated with this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 It is only used for debugging, since "this" is not a wxWindow*. More...
 

Static Public Member Functions

static bool IsCtrl (int aChar, const wxKeyEvent &e)
 
static bool IsShiftCtrl (int aChar, const wxKeyEvent &e)
 

Protected Member Functions

void finishDialogSettings ()
 In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls. More...
 
void setSizeInDU (int x, int y)
 Set the dialog to the given dimensions in "dialog units". More...
 
int horizPixelsFromDU (int x) const
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int vertPixelsFromDU (int y) const
 Convert an integer number of dialog units to pixels, vertically. More...
 
void resetSize ()
 Clear the existing dialog size and position. More...
 
virtual void OnCharHook (wxKeyEvent &aEvt)
 

Protected Attributes

wxStaticText * m_staticTextFilter
 
wxTextCtrl * m_textCtrlFilter
 
wxCheckBox * m_cbShowZeroPad
 
wxCheckBox * m_groupBy
 
wxTextCtrl * m_groupByText
 
wxComboBox * m_groupByKind
 
wxDataViewCtrl * m_netsList
 
wxBitmapButton * m_addNet
 
wxBitmapButton * m_renameNet
 
wxBitmapButton * m_deleteNet
 
wxButton * m_ReportButt
 
wxStaticLine * m_staticline1
 
wxStdDialogButtonSizer * m_sdbSizer
 
wxButton * m_sdbSizerOK
 
EDA_UNITS m_units
 
std::string m_hash_key
 
bool m_useCalculatedSize
 
bool m_firstPaintEvent
 
wxWindow * m_initialFocusTarget
 
WX_EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 
EDA_BASE_FRAMEm_parentFrame
 
std::vector< wxWindow * > m_tabOrder
 
wxSize m_initialSize
 

Private Types

using LIST_ITEM_ITER = std::vector< std::unique_ptr< LIST_ITEM > >::iterator
 
using LIST_ITEM_CONST_ITER = std::vector< std::unique_ptr< LIST_ITEM > >::const_iterator
 

Private Member Functions

wxString formatNetCode (const NETINFO_ITEM *aNet) const
 
wxString formatNetName (const NETINFO_ITEM *aNet) const
 
wxString formatCount (unsigned int aValue) const
 
wxString formatLength (int64_t aValue) const
 
std::vector< CN_ITEM * > relevantConnectivityItems () const
 
bool netFilterMatches (NETINFO_ITEM *aNet) const
 
void updateNet (NETINFO_ITEM *aNet)
 
unsigned int calculateViaLength (const PCB_TRACK *) const
 
void onSelChanged (wxDataViewEvent &event) override
 
void onSelChanged ()
 
void onSortingChanged (wxDataViewEvent &event) override
 
void onFilterChange (wxCommandEvent &event) override
 
void onListSize (wxSizeEvent &event) override
 
void onAddNet (wxCommandEvent &event) override
 
void onRenameNet (wxCommandEvent &event) override
 
void onDeleteNet (wxCommandEvent &event) override
 
void onReport (wxCommandEvent &event) override
 
std::unique_ptr< LIST_ITEMbuildNewItem (NETINFO_ITEM *aNet, unsigned int aPadCount, const std::vector< CN_ITEM * > &aCNItems)
 
void buildNetsList ()
 
void adjustListColumns ()
 
void onParentWindowClosed (wxCommandEvent &event)
 
void onUnitsChanged (wxCommandEvent &event)
 
void onBoardChanged (wxCommandEvent &event)
 
void updateDisplayedRowValues (const OPT< LIST_ITEM_ITER > &aRow)
 
void OnCloseWindow (wxCloseEvent &aEvent)
 Properly handle the wxCloseEvent when in the quasimodal mode when not calling EndQuasiModal which is possible with any dialog derived from DIALOG_SHIM. More...
 
void OnButton (wxCommandEvent &aEvent)
 Properly handle the default button events when in the quasimodal mode when not calling EndQuasiModal which is possible with any dialog derived from DIALOG_SHIM. More...
 
void OnGridEditorShown (wxGridEvent &event)
 
void OnGridEditorHidden (wxGridEvent &event)
 
 DECLARE_EVENT_TABLE ()
 

Private Attributes

NETINFO_ITEMm_zero_netitem
 
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_netFilter
 
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_groupFilter
 
BOARDm_brd
 
PCB_EDIT_FRAMEm_frame
 
bool m_in_build_nets_list = false
 
bool m_filter_change_no_rebuild = false
 
wxSize m_size
 
std::vector< COLUMN_DESCm_columns
 
wxObjectDataPtr< DATA_MODELm_data_model
 
friend DATA_MODEL
 
KIWAYm_kiway
 
HOLDER_TYPE m_type
 

Detailed Description

Definition at line 37 of file dialog_net_inspector.h.

Member Typedef Documentation

◆ LIST_ITEM_CONST_ITER

using DIALOG_NET_INSPECTOR::LIST_ITEM_CONST_ITER = std::vector<std::unique_ptr<LIST_ITEM> >::const_iterator
private

Definition at line 73 of file dialog_net_inspector.h.

◆ LIST_ITEM_ITER

using DIALOG_NET_INSPECTOR::LIST_ITEM_ITER = std::vector<std::unique_ptr<LIST_ITEM> >::iterator
private

Definition at line 72 of file dialog_net_inspector.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 

Definition at line 39 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ DIALOG_NET_INSPECTOR()

DIALOG_NET_INSPECTOR::DIALOG_NET_INSPECTOR ( PCB_EDIT_FRAME aParent,
const SETTINGS aSettings 
)

Definition at line 957 of file dialog_net_inspector.cpp.

958 :
959 DIALOG_NET_INSPECTOR_BASE( aParent ),
960 m_zero_netitem( nullptr ),
961 m_frame( aParent )
962{
963 m_columns.emplace_back( 0u, UNDEFINED_LAYER, _( "Net" ), _( "Net Code" ), CSV_COLUMN_DESC::CSV_NONE );
964 m_columns.emplace_back( 1u, UNDEFINED_LAYER, _( "Name" ), _( "Net Name" ), CSV_COLUMN_DESC::CSV_QUOTE );
965 m_columns.emplace_back( 2u, UNDEFINED_LAYER, _( "Pad Count" ), _( "Pad Count" ), CSV_COLUMN_DESC::CSV_NONE );
966 m_columns.emplace_back( 3u, UNDEFINED_LAYER, _( "Via Count" ), _( "Via Count" ), CSV_COLUMN_DESC::CSV_NONE );
967 m_columns.emplace_back( 4u, UNDEFINED_LAYER, _( "Via Length" ), _( "Via Length" ), CSV_COLUMN_DESC::CSV_NONE );
968 m_columns.emplace_back( 5u, UNDEFINED_LAYER, _( "Track Length" ), _( "Track Length" ), CSV_COLUMN_DESC::CSV_NONE );
969 m_columns.emplace_back( 6u, UNDEFINED_LAYER, _( "Die Length" ), _( "Die Length" ), CSV_COLUMN_DESC::CSV_NONE );
970 m_columns.emplace_back( 7u, UNDEFINED_LAYER, _( "Total Length" ), _( "Net Length" ), CSV_COLUMN_DESC::CSV_NONE );
971
972 m_brd = aParent->GetBoard();
973
974 m_data_model = new DATA_MODEL( *this );
975 m_netsList->AssociateModel( &*m_data_model );
976
977 std::vector<std::function<void( void )>> add_col{
978 [&]()
979 {
980 m_netsList->AppendTextColumn( m_columns[COLUMN_NET].display_name, m_columns[COLUMN_NET],
981 wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT,
982 wxDATAVIEW_COL_SORTABLE );
983 },
984 [&]()
985 {
986 m_netsList->AppendTextColumn( m_columns[COLUMN_NAME].display_name, m_columns[COLUMN_NAME],
987 wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT,
988 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE |
989 wxDATAVIEW_COL_SORTABLE );
990 },
991 [&]()
992 {
993 m_netsList->AppendTextColumn( m_columns[COLUMN_PAD_COUNT].display_name, m_columns[COLUMN_PAD_COUNT],
994 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
995 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
996 },
997 [&]()
998 {
999 m_netsList->AppendTextColumn( m_columns[COLUMN_VIA_COUNT].display_name, m_columns[COLUMN_VIA_COUNT],
1000 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1001 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1002 },
1003 [&]()
1004 {
1005 m_netsList->AppendTextColumn( m_columns[COLUMN_VIA_LENGTH].display_name, m_columns[COLUMN_VIA_LENGTH],
1006 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1007 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1008 },
1009 [&]()
1010 {
1011 m_netsList->AppendTextColumn( m_columns[COLUMN_BOARD_LENGTH].display_name, m_columns[COLUMN_BOARD_LENGTH],
1012 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1013 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1014 },
1015 [&]()
1016 {
1017 m_netsList->AppendTextColumn( m_columns[COLUMN_CHIP_LENGTH].display_name, m_columns[COLUMN_CHIP_LENGTH],
1018 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1019 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1020 },
1021 [&]()
1022 {
1023 m_netsList->AppendTextColumn( m_columns[COLUMN_TOTAL_LENGTH].display_name, m_columns[COLUMN_TOTAL_LENGTH],
1024 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1025 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1026 }
1027 };
1028
1029 std::vector<int> col_order = aSettings.column_order;
1030
1031 if( col_order.size() != add_col.size() )
1032 {
1033 col_order.resize( add_col.size() );
1034
1035 for( unsigned int i = 0; i < add_col.size(); ++i )
1036 col_order[i] = i;
1037 }
1038
1039 for( unsigned int i : col_order )
1040 add_col.at( i )();
1041
1042 for( PCB_LAYER_ID layer : m_brd->GetEnabledLayers().Seq() )
1043 {
1044 if( !IsCopperLayer( layer ) )
1045 continue;
1046
1047 m_columns.emplace_back( m_columns.size(), layer, m_brd->GetLayerName( layer ),
1049
1050 m_netsList->AppendTextColumn( m_brd->GetLayerName( layer ), m_columns.back(),
1051 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1052 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1053 }
1054
1055 m_netsList->SetExpanderColumn( m_netsList->GetColumn( 0 ) );
1056
1057 // avoid onFilterChange for each of the settings as it will re-build the
1058 // list over and over again.
1060
1061 m_textCtrlFilter->SetValue( aSettings.filter_string );
1062 m_cbShowZeroPad->SetValue( aSettings.show_zero_pad_nets );
1063 m_groupBy->SetValue( aSettings.group_by );
1064 m_groupByKind->SetSelection( aSettings.group_by_kind );
1065 m_groupByText->SetValue( aSettings.group_by_text );
1066
1068 buildNetsList();
1069
1071
1072 m_addNet->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
1073 m_renameNet->SetBitmap( KiBitmap( BITMAPS::small_edit ) );
1074 m_deleteNet->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
1075
1077
1078 m_renameNet->Disable();
1079 m_deleteNet->Disable();
1080
1081 if( aSettings.sorting_column != -1 )
1082 {
1083 if( wxDataViewColumn* c = m_netsList->GetColumn( aSettings.sorting_column ) )
1084 {
1085 c->SetSortOrder( aSettings.sort_order_asc );
1086 m_data_model->Resort();
1087 }
1088 }
1089
1091
1092 m_frame->Connect( wxEVT_CLOSE_WINDOW,
1093 wxCommandEventHandler( DIALOG_NET_INSPECTOR::onParentWindowClosed ),
1094 nullptr, this );
1095 m_frame->Connect( UNITS_CHANGED,
1096 wxCommandEventHandler( DIALOG_NET_INSPECTOR::onUnitsChanged ),
1097 nullptr, this );
1098 m_frame->Connect( BOARD_CHANGED,
1099 wxCommandEventHandler( DIALOG_NET_INSPECTOR::onBoardChanged ),
1100 nullptr, this );
1101
1102 if( m_brd != nullptr )
1103 {
1104 // if the dialog is opened while something is highlighted on the board ...
1106
1107 m_brd->AddListener( this );
1108 }
1109}
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:498
void AddListener(BOARD_LISTENER *aListener)
Add a listener to the board to receive calls whenever something on the board has been modified.
Definition: board.cpp:2019
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:397
DIALOG_NET_INSPECTOR_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Net Inspector"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(579, 503), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
void onUnitsChanged(wxCommandEvent &event)
virtual void OnBoardHighlightNetChanged(BOARD &aBoard) override
void onParentWindowClosed(wxCommandEvent &event)
wxObjectDataPtr< DATA_MODEL > m_data_model
std::vector< COLUMN_DESC > m_columns
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...
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
BOARD * GetBoard() const
@ COLUMN_VIA_COUNT
@ COLUMN_PAD_COUNT
@ COLUMN_TOTAL_LENGTH
@ COLUMN_VIA_LENGTH
@ COLUMN_BOARD_LENGTH
@ COLUMN_CHIP_LENGTH
#define _(s)
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:822
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ UNDEFINED_LAYER
Definition: layer_ids.h:60

References _, BOARD::AddListener(), adjustListColumns(), buildNetsList(), COLUMN_BOARD_LENGTH, COLUMN_CHIP_LENGTH, COLUMN_NAME, COLUMN_NET, DIALOG_NET_INSPECTOR::SETTINGS::column_order, COLUMN_PAD_COUNT, COLUMN_TOTAL_LENGTH, COLUMN_VIA_COUNT, COLUMN_VIA_LENGTH, CSV_NONE, CSV_QUOTE, DATA_MODEL, DIALOG_NET_INSPECTOR::SETTINGS::filter_string, DIALOG_SHIM::finishDialogSettings(), PCB_BASE_FRAME::GetBoard(), BOARD::GetEnabledLayers(), BOARD::GetLayerName(), DIALOG_NET_INSPECTOR::SETTINGS::group_by, DIALOG_NET_INSPECTOR::SETTINGS::group_by_kind, DIALOG_NET_INSPECTOR::SETTINGS::group_by_text, IsCopperLayer(), KiBitmap(), DIALOG_NET_INSPECTOR_BASE::m_addNet, m_brd, DIALOG_NET_INSPECTOR_BASE::m_cbShowZeroPad, m_columns, m_data_model, DIALOG_NET_INSPECTOR_BASE::m_deleteNet, m_filter_change_no_rebuild, m_frame, DIALOG_NET_INSPECTOR_BASE::m_groupBy, DIALOG_NET_INSPECTOR_BASE::m_groupByKind, DIALOG_NET_INSPECTOR_BASE::m_groupByText, DIALOG_NET_INSPECTOR_BASE::m_netsList, DIALOG_NET_INSPECTOR_BASE::m_renameNet, DIALOG_NET_INSPECTOR_BASE::m_textCtrlFilter, onBoardChanged(), OnBoardHighlightNetChanged(), onParentWindowClosed(), onUnitsChanged(), LSET::Seq(), DIALOG_SHIM::SetupStandardButtons(), DIALOG_NET_INSPECTOR::SETTINGS::show_zero_pad_nets, small_edit, small_plus, small_trash, DIALOG_NET_INSPECTOR::SETTINGS::sort_order_asc, DIALOG_NET_INSPECTOR::SETTINGS::sorting_column, and UNDEFINED_LAYER.

◆ ~DIALOG_NET_INSPECTOR()

DIALOG_NET_INSPECTOR::~DIALOG_NET_INSPECTOR ( )

Definition at line 1112 of file dialog_net_inspector.cpp.

1113{
1114 // the displayed list elements are going to be deleted before the list view itself.
1115 // in some cases it might still do queries on the data model, which would crash
1116 // from now on. so just disassociate it.
1117 m_netsList->AssociateModel( nullptr );
1118
1119 m_frame->Disconnect( wxEVT_CLOSE_WINDOW,
1120 wxCommandEventHandler( DIALOG_NET_INSPECTOR::onParentWindowClosed ),
1121 nullptr, this );
1122 m_frame->Disconnect( UNITS_CHANGED,
1123 wxCommandEventHandler( DIALOG_NET_INSPECTOR::onUnitsChanged ),
1124 nullptr, this );
1125 m_frame->Disconnect( BOARD_CHANGED,
1126 wxCommandEventHandler( DIALOG_NET_INSPECTOR::onBoardChanged ),
1127 nullptr, this );
1128
1129 if( m_brd != nullptr )
1130 m_brd->RemoveListener( this );
1131
1133}
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
Definition: board.cpp:2026
virtual void SetFocus() override
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.

References PCB_BASE_FRAME::GetCanvas(), m_brd, m_frame, DIALOG_NET_INSPECTOR_BASE::m_netsList, onBoardChanged(), onParentWindowClosed(), onUnitsChanged(), BOARD::RemoveListener(), and EDA_DRAW_PANEL_GAL::SetFocus().

Member Function Documentation

◆ adjustListColumns()

void DIALOG_NET_INSPECTOR::adjustListColumns ( )
private

Definition at line 1923 of file dialog_net_inspector.cpp.

1924{
1925 wxWindowUpdateLocker locker( m_netsList );
1926 std::vector<int> widths;
1927
1928 widths.reserve( m_columns.size() );
1929
1930 for( size_t ii = 0; ii < m_columns.size(); ++ii )
1931 widths.push_back( GetTextExtent( m_columns[ii].display_name ).x );
1932
1933 int minValueWidth = GetTextExtent( wxT( "00000,000 mm" ) ).x;
1934 int minNumberWidth = GetTextExtent( wxT( "000" ) ).x;
1935 int minNameWidth = GetTextExtent( wxT( "MMMMMM" ) ).x;
1936
1937 // Considering left and right margins.
1938 // For wxRenderGeneric it is 5px.
1939 // Also account for the sorting arrow in the column header.
1940 // Column 0 also needs space for any potential expander icons.
1941 const int margins = 15;
1942 const int extra_width = 30;
1943
1944 widths[0] = std::max( widths[0], minNumberWidth ) + extra_width;
1945 widths[1] = std::max( widths[1], minNameWidth ) + margins;
1946 widths[2] = std::max( widths[2], minNumberWidth ) + margins;
1947 widths[3] = std::max( widths[3], minNumberWidth ) + margins;
1948
1949 for( size_t ii = 4; ii < widths.size(); ++ii )
1950 {
1951 widths[ii] = std::max( widths[ii], minValueWidth ) + margins;
1952 }
1953
1954 // the columns might have been reordered. we work on the column model numbers though.
1955 std::vector<int> column_order( m_data_model->columnCount() );
1956
1957 for( size_t i = 0; i < column_order.size(); ++i )
1958 {
1959 column_order[m_netsList->GetColumn( i )->GetModelColumn()] = i;
1960 m_netsList->GetColumn( column_order[i] )->SetMinWidth( widths[i] );
1961 m_netsList->GetColumn( column_order[i] )->SetWidth( widths[i] );
1962 }
1963
1964 // At resizing of the list the width of middle column (Net Names) changes only.
1965 int width = m_netsList->GetClientSize().x - 24;
1966 int remaining = width - std::accumulate( widths.begin() + 2, widths.end(), widths[0] );
1967
1968 if( remaining > widths[1] )
1969 m_netsList->GetColumn( column_order[1] )->SetWidth( remaining );
1970
1971 m_netsList->Refresh();
1972
1973 // Force refresh on GTK so that horizontal scroll bar won't appear
1974#ifdef __WXGTK__
1975 wxPoint pos = m_netsList->GetPosition();
1976 m_netsList->Move( pos.x, pos.y + 1 );
1977 m_netsList->Move( pos.x, pos.y );
1978#endif
1979}

References m_columns, m_data_model, and DIALOG_NET_INSPECTOR_BASE::m_netsList.

Referenced by DIALOG_NET_INSPECTOR(), and onListSize().

◆ buildNetsList()

void DIALOG_NET_INSPECTOR::buildNetsList ( )
private

Definition at line 1658 of file dialog_net_inspector.cpp.

1659{
1660 // Only build the list of nets if there is a board present
1661 if( !m_brd )
1662 return;
1663
1664 m_in_build_nets_list = true;
1665
1666 // when rebuilding the netlist, try to keep the row selection
1667 // FIXME: handle group selections, preserve expanded/collapsed group states
1668 wxDataViewItemArray sel;
1669 m_netsList->GetSelections( sel );
1670
1671 std::vector<int> prev_selected_netcodes;
1672 prev_selected_netcodes.reserve( sel.GetCount() );
1673
1674 for( unsigned int i = 0; i < sel.GetCount(); ++i )
1675 {
1676 const LIST_ITEM* item = static_cast<const LIST_ITEM*>( sel.Item( i ).GetID() );
1677 prev_selected_netcodes.push_back( item->GetNetCode() );
1678 }
1679
1680 m_data_model->deleteAllItems();
1681
1682 std::vector<std::unique_ptr<LIST_ITEM>> new_items;
1683
1684 // for group mode 0,1 each group filter string represents one displayed group,
1685 // so just add them first. for group mode 2,3 the groups are generated dynamically.
1686 if( m_groupBy->IsChecked()
1687 && ( m_groupByKind->GetSelection() == 0 || m_groupByKind->GetSelection() == 1 ) )
1688 {
1689 for( unsigned int i = 0; i < m_groupFilter.size(); ++i )
1690 {
1691 const std::unique_ptr<EDA_PATTERN_MATCH>& filter = m_groupFilter[i];
1692 new_items.emplace_back( std::make_unique<LIST_ITEM>( i, filter->GetPattern() ) );
1693 }
1694 }
1695
1696 std::vector<CN_ITEM*> prefiltered_cn_items = relevantConnectivityItems();
1697
1698
1699 // collect all nets which pass the filter string and also remember the
1700 // suffix after the filter match, if any.
1701 struct NET_INFO
1702 {
1703 int netcode;
1704 NETINFO_ITEM* net;
1705 unsigned int pad_count;
1706 };
1707
1708 struct NET_INFO_CMP_LESS
1709 {
1710 bool operator()( const NET_INFO& a, const NET_INFO& b ) const
1711 {
1712 return a.netcode < b.netcode;
1713 }
1714 bool operator()( const NET_INFO& a, int b ) const
1715 {
1716 return a.netcode < b;
1717 }
1718 bool operator()( int a, const NET_INFO& b ) const
1719 {
1720 return a < b.netcode;
1721 }
1722 };
1723
1724 std::vector<NET_INFO> nets;
1725 nets.reserve( m_brd->GetNetInfo().NetsByNetcode().size() );
1726
1727 for( const std::pair<int, NETINFO_ITEM*> ni : m_brd->GetNetInfo().NetsByNetcode() )
1728 {
1729 if( ni.first == 0 )
1730 m_zero_netitem = ni.second;
1731
1732 if( netFilterMatches( ni.second ) )
1733 nets.emplace_back( NET_INFO{ ni.first, ni.second, 0 } );
1734 }
1735
1736 // count the pads for each net. since the nets are sorted by netcode
1737 // iterating over the footprints' pads is faster.
1738
1739 for( FOOTPRINT* footprint : m_brd->Footprints() )
1740 {
1741 for( PAD* pad : footprint->Pads() )
1742 {
1743 auto i = std::lower_bound( nets.begin(), nets.end(), pad->GetNetCode(),
1744 NET_INFO_CMP_LESS() );
1745
1746 if( i != nets.end() && i->netcode == pad->GetNetCode() )
1747 i->pad_count += 1;
1748 }
1749 }
1750
1751 for( NET_INFO& ni : nets )
1752 {
1753 if( m_cbShowZeroPad->IsChecked() || ni.pad_count > 0 )
1754 new_items.emplace_back( buildNewItem( ni.net, ni.pad_count, prefiltered_cn_items ) );
1755 }
1756
1757
1758 m_data_model->addItems( std::move( new_items ) );
1759
1760 // try to restore the selected rows. set the ones that we can't find anymore to -1.
1761 sel.Clear();
1762
1763 for( int& nc : prev_selected_netcodes )
1764 {
1765 auto r = m_data_model->findItem( nc );
1766
1767 if( r )
1768 {
1769 const std::unique_ptr<LIST_ITEM>& list_item = *r.get();
1770 sel.Add( wxDataViewItem( list_item.get() ) );
1771 }
1772 else
1773 {
1774 nc = -1;
1775 }
1776 }
1777
1778 if( !sel.IsEmpty() )
1779 {
1780 m_netsList->SetSelections( sel );
1781 m_netsList->EnsureVisible( sel.Item( 0 ) );
1782 }
1783 else
1784 {
1785 m_netsList->UnselectAll();
1786 }
1787
1788 alg::delete_matching( prev_selected_netcodes, -1 );
1789
1791
1792 for( int& i : prev_selected_netcodes )
1793 m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings()->SetHighlight( true, i, true );
1794
1797
1798 m_in_build_nets_list = false;
1799}
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:737
FOOTPRINTS & Footprints()
Definition: board.h:282
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_groupFilter
std::vector< CN_ITEM * > relevantConnectivityItems() const
std::unique_ptr< LIST_ITEM > buildNewItem(NETINFO_ITEM *aNet, unsigned int aPadCount, const std::vector< CN_ITEM * > &aCNItems)
bool netFilterMatches(NETINFO_ITEM *aNet) const
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...
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:758
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
Handle the data for a net.
Definition: netinfo.h:66
const NETCODES_MAP & NetsByNetcode() const
Return the netcode map, at least for python.
Definition: netinfo.h:371
Definition: pad.h:59
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
E_SERIE r
Definition: eserie.cpp:41
void delete_matching(_Container &__c, _Value __value)
Covers for the horrifically named std::remove and std::remove_if (neither of which remove anything).
Definition: kicad_algo.h:164

References buildNewItem(), alg::delete_matching(), filter, BOARD::Footprints(), PCB_BASE_FRAME::GetCanvas(), DIALOG_NET_INSPECTOR::LIST_ITEM::GetNetCode(), BOARD::GetNetInfo(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), m_brd, DIALOG_NET_INSPECTOR_BASE::m_cbShowZeroPad, m_data_model, m_frame, DIALOG_NET_INSPECTOR_BASE::m_groupBy, DIALOG_NET_INSPECTOR_BASE::m_groupByKind, m_groupFilter, m_in_build_nets_list, DIALOG_NET_INSPECTOR_BASE::m_netsList, m_zero_netitem, netFilterMatches(), NETINFO_LIST::NetsByNetcode(), pad, r, EDA_DRAW_PANEL_GAL::Refresh(), relevantConnectivityItems(), KIGFX::RENDER_SETTINGS::SetHighlight(), and KIGFX::VIEW::UpdateAllLayersColor().

Referenced by DIALOG_NET_INSPECTOR(), onBoardChanged(), OnBoardItemChanged(), OnBoardItemsChanged(), OnBoardNetSettingsChanged(), and onFilterChange().

◆ buildNewItem()

std::unique_ptr< DIALOG_NET_INSPECTOR::LIST_ITEM > DIALOG_NET_INSPECTOR::buildNewItem ( NETINFO_ITEM aNet,
unsigned int  aPadCount,
const std::vector< CN_ITEM * > &  aCNItems 
)
private

Definition at line 1625 of file dialog_net_inspector.cpp.

1627{
1628 std::unique_ptr<LIST_ITEM> new_item = std::make_unique<LIST_ITEM>( aNet );
1629
1630 new_item->SetPadCount( aPadCount );
1631
1632 const auto cn_items = std::equal_range( aCNItems.begin(), aCNItems.end(), aNet->GetNetCode(),
1633 NETCODE_CMP_LESS() );
1634
1635 for( auto i = cn_items.first; i != cn_items.second; ++i )
1636 {
1637 BOARD_CONNECTED_ITEM* item = ( *i )->Parent();
1638
1639 if( item->Type() == PCB_PAD_T )
1640 new_item->AddChipWireLength( static_cast<PAD*>( item )->GetPadToDieLength() );
1641
1642 else if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
1643 {
1644 new_item->AddLayerWireLength( track->GetLength(), static_cast<int>( track->GetLayer() ) );
1645
1646 if( item->Type() == PCB_VIA_T )
1647 {
1648 new_item->AddViaCount( 1 );
1649 new_item->AddViaLength( calculateViaLength( track ) );
1650 }
1651 }
1652 }
1653
1654 return new_item;
1655}
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
unsigned int calculateViaLength(const PCB_TRACK *) const
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
int GetNetCode() const
Definition: netinfo.h:121
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:104
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:89

References calculateViaLength(), NETINFO_ITEM::GetNetCode(), PCB_PAD_T, PCB_VIA_T, and EDA_ITEM::Type().

Referenced by buildNetsList(), and updateNet().

◆ calculateViaLength()

unsigned int DIALOG_NET_INSPECTOR::calculateViaLength ( const PCB_TRACK aTrack) const
private

Definition at line 1570 of file dialog_net_inspector.cpp.

1571{
1572 const PCB_VIA* via = dynamic_cast<const PCB_VIA*>( aTrack );
1573
1574 if( !via )
1575 return 0;
1576
1578
1579 // calculate the via length individually from the board stackup and via's start and end layer.
1580 if( bds.m_HasStackup )
1581 {
1582 PCB_LAYER_ID top_layer = UNDEFINED_LAYER;
1583 PCB_LAYER_ID bottom_layer = UNDEFINED_LAYER;
1584
1585 for( int layer = via->TopLayer(); layer <= via->BottomLayer(); ++layer )
1586 {
1587 if( m_brd->GetConnectivity()->IsConnectedOnLayer( via, layer,
1588 { PCB_TRACE_T, PCB_ARC_T, PCB_PAD_T }, true ) )
1589 {
1590 if( top_layer == UNDEFINED_LAYER )
1591 top_layer = PCB_LAYER_ID( layer );
1592 else
1593 bottom_layer = PCB_LAYER_ID( layer );
1594 }
1595 }
1596
1597 if( top_layer == UNDEFINED_LAYER )
1598 top_layer = via->TopLayer();
1599 if( bottom_layer == UNDEFINED_LAYER )
1600 bottom_layer = via->BottomLayer();
1601
1602 const BOARD_STACKUP& stackup = bds.GetStackupDescriptor();
1603 return stackup.GetLayerDistance( top_layer, bottom_layer );
1604 }
1605 else
1606 {
1607 int dielectricLayers = bds.GetCopperLayerCount() - 1;
1608 // FIXME: not all dielectric layers are the same thickness!
1609 int layerThickness = bds.GetBoardThickness() / dielectricLayers;
1610 int effectiveBottomLayer;
1611
1612 if( via->BottomLayer() == B_Cu )
1613 effectiveBottomLayer = F_Cu + dielectricLayers;
1614 else
1615 effectiveBottomLayer = via->BottomLayer();
1616
1617 int layerCount = effectiveBottomLayer - via->TopLayer();
1618
1619 return layerCount * layerThickness;
1620 }
1621}
Container for design settings for a BOARD object.
int GetBoardThickness() const
The full thickness of the board including copper and masks.
BOARD_STACKUP & GetStackupDescriptor()
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.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:615
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:399
@ B_Cu
Definition: layer_ids.h:95
@ F_Cu
Definition: layer_ids.h:64
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:105
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:103

References B_Cu, F_Cu, BOARD_DESIGN_SETTINGS::GetBoardThickness(), BOARD::GetConnectivity(), BOARD_DESIGN_SETTINGS::GetCopperLayerCount(), BOARD::GetDesignSettings(), BOARD_STACKUP::GetLayerDistance(), BOARD_DESIGN_SETTINGS::GetStackupDescriptor(), m_brd, BOARD_DESIGN_SETTINGS::m_HasStackup, PCB_ARC_T, PCB_PAD_T, PCB_TRACE_T, UNDEFINED_LAYER, and via.

Referenced by buildNewItem(), OnBoardItemAdded(), and OnBoardItemRemoved().

◆ DECLARE_EVENT_TABLE()

DIALOG_SHIM::DECLARE_EVENT_TABLE ( )
privateinherited

◆ Enable()

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 319 of file dialog_shim.cpp.

320{
321 // so we can do logging of this state change:
322 return wxDialog::Enable( enable );
323}

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 487 of file dialog_shim.cpp.

488{
489 // Hook up validator and transfer data from controls handling so quasi-modal dialogs
490 // handle validation in the same way as other dialogs.
491 if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
492 return;
493
494 SetReturnCode( retCode );
495
496 if( !IsQuasiModal() )
497 {
498 wxFAIL_MSG( wxT( "Either DIALOG_SHIM::EndQuasiModal was called twice, or ShowQuasiModal"
499 "wasn't called" ) );
500 return;
501 }
502
503 if( m_qmodal_loop )
504 {
505 if( m_qmodal_loop->IsRunning() )
506 m_qmodal_loop->Exit( 0 );
507 else
508 m_qmodal_loop->ScheduleExit( 0 );
509
510 m_qmodal_loop = nullptr;
511 }
512
514 m_qmodal_parent_disabler = nullptr;
515
516 Show( false );
517}
bool Show(bool show) override
bool IsQuasiModal() const
Definition: dialog_shim.h:106
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:218
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:215

References DIALOG_SHIM::IsQuasiModal(), DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, and DIALOG_SHIM::Show().

Referenced by EDA_3D_CONTROLLER::Main(), NETLIST_DIALOG::OnAddGenerator(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_SYMBOLS_LIBID::onCancel(), DIALOG_LIB_SYMBOL_PROPERTIES::OnCancelButtonClick(), DIALOG_SYMBOL_PROPERTIES::OnCancelButtonClick(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), NETLIST_DIALOG::OnDelGenerator(), DIALOG_SYMBOL_PROPERTIES::OnEditLibrarySymbol(), DIALOG_SYMBOL_PROPERTIES::OnEditSymbol(), DIALOG_SYMBOL_PROPERTIES::OnExchangeSymbol(), PCB_ONE_LAYER_SELECTOR::OnLeftGridCellClick(), PCB_ONE_LAYER_SELECTOR::OnRightGridCellClick(), DIALOG_SYMBOL_PROPERTIES::OnUpdateSymbol(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_PUSH_PAD_PROPERTIES::PadPropertiesAccept(), and DIALOG_SHIM::~DIALOG_SHIM().

◆ finishDialogSettings()

void DIALOG_SHIM::finishDialogSettings ( )
protectedinherited

In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls.

finishDialogSettings must be called from derived classes after all widgets have been initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at the end of TransferDataToWindow, or better yet, at end of a wxInitDialogEvent handler.

Definition at line 158 of file dialog_shim.cpp.

159{
160 // must be called from the constructor of derived classes,
161 // when all widgets are initialized, and therefore their size fixed
162
163 // SetSizeHints fixes the minimal size of sizers in the dialog
164 // (SetSizeHints calls Fit(), so no need to call it)
165 GetSizer()->SetSizeHints( this );
166}

Referenced by CONVERT_SETTINGS_DIALOG::CONVERT_SETTINGS_DIALOG(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOM::DIALOG_BOM(), DIALOG_BUS_MANAGER::DIALOG_BUS_MANAGER(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_DRC::DIALOG_DRC(), DIALOG_EDIT_SYMBOLS_LIBID::DIALOG_EDIT_SYMBOLS_LIBID(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_ERC::DIALOG_ERC(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FOOTPRINT_CHECKER::DIALOG_FOOTPRINT_CHECKER(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_OPTIONS(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_GLOBAL_LIB_TABLE_CONFIG::DIALOG_GLOBAL_LIB_TABLE_CONFIG(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_IMAGE_PROPERTIES::DIALOG_IMAGE_PROPERTIES(), DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS(), DIALOG_INSPECTOR::DIALOG_INSPECTOR(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_LIB_NEW_SYMBOL::DIALOG_LIB_NEW_SYMBOL(), DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES(), DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES(), DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES(), DIALOG_LINE_PROPERTIES::DIALOG_LINE_PROPERTIES(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY(), DIALOG_MANAGE_REPOSITORIES::DIALOG_MANAGE_REPOSITORIES(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NET_INSPECTOR(), DIALOG_NETLIST_IMPORT::DIALOG_NETLIST_IMPORT(), DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::DIALOG_PAD_PRIMITIVE_POLY_PROPS(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL(), DIALOG_PCM::DIALOG_PCM(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_REGULATOR_FORM::DIALOG_REGULATOR_FORM(), DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SELECT_3DMODEL::DIALOG_SELECT_3DMODEL(), DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES(), DIALOG_SIM_MODEL< T >::DIALOG_SIM_MODEL(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE(), DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_UNUSED_PAD_LAYERS::DIALOG_UNUSED_PAD_LAYERS(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS(), DIALOG_WIRE_BUS_PROPERTIES::DIALOG_WIRE_BUS_PROPERTIES(), PAGED_DIALOG::finishInitialization(), DIALOG_CONSTRAINTS_REPORTER::FinishInitialization(), DIALOG_FIELD_PROPERTIES::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_SHEET_PROPERTIES::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SYMBOL_PROPERTIES::OnInitDlg(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), TEARDROP_DIALOG::TEARDROP_DIALOG(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_COLOR_PICKER::TransferDataToWindow(), and DIALOG_BOARD_STATISTICS::TransferDataToWindow().

◆ formatCount()

wxString DIALOG_NET_INSPECTOR::formatCount ( unsigned int  aValue) const
private

Definition at line 1290 of file dialog_net_inspector.cpp.

1291{
1292 return wxString::Format( wxT( "%u" ), aValue );
1293}
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References Format().

Referenced by DIALOG_NET_INSPECTOR::DATA_MODEL::GetValue().

◆ formatLength()

wxString DIALOG_NET_INSPECTOR::formatLength ( int64_t  aValue) const
private

Definition at line 1296 of file dialog_net_inspector.cpp.

1297{
1298 return MessageTextFromValue( GetUserUnits(), static_cast<long long int>( aValue ) );
1299}
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:103
EDA_UNITS GetUserUnits() const
Definition: dialog_shim.h:121

References DIALOG_SHIM::GetUserUnits(), and MessageTextFromValue().

Referenced by DIALOG_NET_INSPECTOR::DATA_MODEL::GetValue().

◆ formatNetCode()

wxString DIALOG_NET_INSPECTOR::formatNetCode ( const NETINFO_ITEM aNet) const
private

Definition at line 1278 of file dialog_net_inspector.cpp.

1279{
1280 return wxString::Format( wxT( "%.3d" ), aNet->GetNetCode() );
1281}

References Format(), and NETINFO_ITEM::GetNetCode().

Referenced by DIALOG_NET_INSPECTOR::DATA_MODEL::GetValue().

◆ formatNetName()

wxString DIALOG_NET_INSPECTOR::formatNetName ( const NETINFO_ITEM aNet) const
private

Definition at line 1284 of file dialog_net_inspector.cpp.

1285{
1286 return UnescapeString( aNet->GetNetname() );
1287}
const wxString & GetNetname() const
Definition: netinfo.h:127
wxString UnescapeString(const wxString &aSource)

References NETINFO_ITEM::GetNetname(), and UnescapeString().

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( ) const
inlineinherited

Definition at line 46 of file kiway_holder.h.

46{ return m_type; }
HOLDER_TYPE m_type
Definition: kiway_holder.h:85

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ GetUserUnits()

◆ HasKiway()

bool KIWAY_HOLDER::HasKiway ( ) const
inlineinherited

Safety check before asking for the Kiway reference.

Returns
true if kiway is non-null

Definition at line 63 of file kiway_holder.h.

64 {
65 return m_kiway != nullptr;
66 }
KIWAY * m_kiway
Definition: kiway_holder.h:84

References KIWAY_HOLDER::m_kiway.

Referenced by DIALOG_SHIM::~DIALOG_SHIM().

◆ horizPixelsFromDU()

int DIALOG_SHIM::horizPixelsFromDU ( int  x) const
protectedinherited

Convert an integer number of dialog units to pixels, horizontally.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 176 of file dialog_shim.cpp.

177{
178 wxSize sz( x, 0 );
179 return ConvertDialogToPixels( sz ).x;
180}

Referenced by DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), and DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL().

◆ IsCtrl()

static bool DIALOG_SHIM::IsCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 128 of file dialog_shim.h.

129 {
130 return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
131 !e.ShiftDown() && !e.MetaDown();
132 }

◆ IsQuasiModal()

◆ IsShiftCtrl()

static bool DIALOG_SHIM::IsShiftCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 134 of file dialog_shim.h.

135 {
136 return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
137 e.ShiftDown() && !e.MetaDown();
138 }

◆ Kiway()

KIWAY & KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Return a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 53 of file kiway_holder.h.

54 {
55 wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
56 return *m_kiway;
57 }

References KIWAY_HOLDER::m_kiway.

Referenced by PROJECT_TREE_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_EDIT_FRAME::AddLibraryFile(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), SCH_EDIT_FRAME::AskToSaveChanges(), CVPCB_MAINFRAME::BuildLibrariesListBox(), FOOTPRINT_EDIT_FRAME::buildSaveAsDialog(), SYMBOL_EDIT_FRAME::buildSaveAsDialog(), SYMBOL_EDIT_FRAME::CanCloseSymbolFromSchematic(), SCH_EDIT_FRAME::canCloseWindow(), PCB_EDIT_FRAME::canCloseWindow(), KICAD_MANAGER_FRAME::CloseProject(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_SYMBOL::ConstructRightPanel(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), SCH_EDIT_FRAME::doCloseWindow(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), FIELDS_GRID_TRICKS::doPopupSelection(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), BACK_ANNOTATE::FetchNetlistFromPCB(), PCB_EDIT_FRAME::FetchNetlistFromSchematic(), KICAD_MANAGER_FRAME::ImportNonKiCadProject(), SCRIPTING_TOOL::Init(), EDA_DRAW_FRAME::IsScriptingConsoleVisible(), KIWAY_PLAYER::language_change(), KICAD_MANAGER_FRAME::language_change(), DIALOG_CHANGE_SYMBOLS::launchMatchIdSymbolBrowser(), DIALOG_CHANGE_SYMBOLS::launchNewIdSymbolBrowser(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), PGM_SINGLE_TOP::MacOpenFile(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), PL_EDITOR_FRAME::OnExit(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), SYMBOL_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), DIALOG_CHOOSE_SYMBOL::OnInitDialog(), PCB_EDIT_FRAME::OnNetlistChanged(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), EDA_BASE_FRAME::OnPreferences(), SIM_PLOT_FRAME::onProbe(), PCB_EDIT_FRAME::OnQuit(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_FIELD_PROPERTIES::OnTextValueSelectButtonClick(), SIM_PLOT_FRAME::onTune(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard(), SCH_BASE_FRAME::PickSymbolFromLibBrowser(), KIWAY_HOLDER::Prj(), SCH_EDIT_TOOL::Properties(), BACK_ANNOTATE::PushNewLinksToPCB(), FOOTPRINT_WIZARD_FRAME::PythonPluginsReload(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), SCH_EDITOR_CONTROL::rescueProject(), PCB_EDIT_FRAME::RunEeschema(), EE_INSPECTION_TOOL::RunSimulation(), SYMBOL_EDIT_FRAME::Save(), SYMBOL_EDIT_FRAME::saveCurrentSymbol(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), EDA_DRAW_FRAME::ScriptingConsoleEnableDisable(), PCB_BASE_FRAME::SelectFootprintFromLibBrowser(), PCB_BASE_FRAME::SelectLibrary(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), SCH_EDIT_FRAME::SendSelectItems(), SCH_EDIT_FRAME::SetCrossProbeConnection(), SYMBOL_EDIT_FRAME::SetCurSymbol(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), PCB_EDIT_FRAME::ShowFootprintPropertiesDialog(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), PCB_EDIT_FRAME::TestStandalone(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint(), and DIALOG_SHIM::~DIALOG_SHIM().

◆ netFilterMatches()

bool DIALOG_NET_INSPECTOR::netFilterMatches ( NETINFO_ITEM aNet) const
private

Definition at line 1190 of file dialog_net_inspector.cpp.

1191{
1192 // Note: the filtering is case insensitive.
1193
1194 // Never show the unconnected net
1195 if( aNet->GetNetCode() <= 0 )
1196 return false;
1197
1198 // Show unconnected nets only if specifically asked for by filter
1199 if( m_netFilter.empty() )
1200 return !aNet->GetNetname().StartsWith( wxT( "unconnected-(" ) );
1201
1202 wxString net_str = UnescapeString( aNet->GetNetname() ).Upper();
1203
1204 for( const std::unique_ptr<EDA_PATTERN_MATCH>& f : m_netFilter )
1205 {
1206 if( f->Find( net_str ) )
1207 return true;
1208 }
1209
1210 return false;
1211}
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_netFilter

References NETINFO_ITEM::GetNetCode(), NETINFO_ITEM::GetNetname(), m_netFilter, and UnescapeString().

Referenced by buildNetsList(), OnBoardItemAdded(), onRenameNet(), and updateNet().

◆ onAddNet()

void DIALOG_NET_INSPECTOR::onAddNet ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_NET_INSPECTOR_BASE.

Definition at line 1996 of file dialog_net_inspector.cpp.

1997{
1998 wxString newNetName;
1999 NETNAME_VALIDATOR validator( &newNetName );
2000
2001 WX_TEXT_ENTRY_DIALOG dlg( this, _( "Net name:" ), _( "New Net" ), newNetName );
2002 dlg.SetTextValidator( validator );
2003
2004 while( true )
2005 {
2006 if( dlg.ShowModal() != wxID_OK || dlg.GetValue().IsEmpty() )
2007 return; //Aborted by user
2008
2009 newNetName = dlg.GetValue();
2010
2011 if( m_brd->FindNet( newNetName ) )
2012 {
2013 DisplayError( this, wxString::Format( _( "Net name '%s' is already in use." ),
2014 newNetName ) );
2015 newNetName = wxEmptyString;
2016 }
2017 else
2018 {
2019 break;
2020 }
2021 }
2022
2023 NETINFO_ITEM *newnet = new NETINFO_ITEM( m_brd, dlg.GetValue(), 0 );
2024
2025 m_brd->Add( newnet );
2026 m_frame->OnModify();
2027
2028 // We'll get an OnBoardItemAdded callback from this to update our listbox
2029}
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:684
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1432
void OnModify() override
Must be called after a board change to set the modified flag.
A KICAD version of wxTextEntryDialog which supports the various improvements/work-arounds from DIALOG...
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:280

References _, BOARD::Add(), DisplayError(), BOARD::FindNet(), Format(), WX_TEXT_ENTRY_DIALOG::GetValue(), m_brd, m_frame, PCB_EDIT_FRAME::OnModify(), and WX_TEXT_ENTRY_DIALOG::SetTextValidator().

◆ onBoardChanged()

void DIALOG_NET_INSPECTOR::onBoardChanged ( wxCommandEvent &  event)
private

Definition at line 1176 of file dialog_net_inspector.cpp.

1177{
1178 m_brd = m_frame->GetBoard();
1179
1180 if( m_brd != nullptr )
1181 m_brd->AddListener( this );
1182
1183 buildNetsList();
1184 m_netsList->Refresh();
1185
1186 event.Skip();
1187}

References BOARD::AddListener(), buildNetsList(), PCB_BASE_FRAME::GetBoard(), m_brd, m_frame, and DIALOG_NET_INSPECTOR_BASE::m_netsList.

Referenced by DIALOG_NET_INSPECTOR(), and ~DIALOG_NET_INSPECTOR().

◆ OnBoardHighlightNetChanged()

void DIALOG_NET_INSPECTOR::OnBoardHighlightNetChanged ( BOARD aBoard)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1478 of file dialog_net_inspector.cpp.

1479{
1480 if( !m_brd->IsHighLightNetON() )
1481 {
1482 m_netsList->UnselectAll();
1483 }
1484 else
1485 {
1486 const std::set<int>& selected_codes = m_brd->GetHighLightNetCodes();
1487
1488 wxDataViewItemArray new_selection;
1489 new_selection.Alloc( selected_codes.size() );
1490
1491 for( int code : selected_codes )
1492 {
1493 if( OPT<LIST_ITEM_ITER> r = m_data_model->findItem( code ) )
1494 new_selection.Add( wxDataViewItem( &***r ) );
1495 }
1496
1497 m_netsList->SetSelections( new_selection );
1498
1499 if( !new_selection.IsEmpty() )
1500 m_netsList->EnsureVisible( new_selection.Item( 0 ) );
1501 }
1502}
const std::set< int > & GetHighLightNetCodes() const
Definition: board.h:441
bool IsHighLightNetON() const
Definition: board.h:457
boost::optional< T > OPT
Definition: optional.h:7

References BOARD::GetHighLightNetCodes(), BOARD::IsHighLightNetON(), m_brd, m_data_model, DIALOG_NET_INSPECTOR_BASE::m_netsList, and r.

Referenced by DIALOG_NET_INSPECTOR().

◆ OnBoardItemAdded()

void DIALOG_NET_INSPECTOR::OnBoardItemAdded ( BOARD aBoard,
BOARD_ITEM aBoardItem 
)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1302 of file dialog_net_inspector.cpp.

1303{
1304 if( NETINFO_ITEM* net = dynamic_cast<NETINFO_ITEM*>( aBoardItem ) )
1305 {
1306 // a new net has been added to the board. add it to our list if it
1307 // passes the netname filter test.
1308
1309 if( netFilterMatches( net ) )
1310 {
1311 std::unique_ptr<LIST_ITEM> new_item = std::make_unique<LIST_ITEM>( net );
1312
1313 // the new net could have some pads already assigned, count them.
1314 new_item->SetPadCount( m_brd->GetNodesCount( net->GetNetCode() ) );
1315
1316 m_data_model->addItem( std::move( new_item ) );
1317 }
1318 }
1319 else if( BOARD_CONNECTED_ITEM* i = dynamic_cast<BOARD_CONNECTED_ITEM*>( aBoardItem ) )
1320 {
1321 OPT<LIST_ITEM_ITER> r = m_data_model->findItem( i->GetNet() );
1322
1323 if( r )
1324 {
1325 // try to handle frequent operations quickly.
1326 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( i ) )
1327 {
1328 const std::unique_ptr<LIST_ITEM>& list_item = *r.get();
1329 int len = track->GetLength();
1330
1331 list_item->AddLayerWireLength( len, static_cast<int>( track->GetLayer() ) );
1332
1333 if( track->Type() == PCB_VIA_T )
1334 {
1335 list_item->AddViaCount( 1 );
1336 list_item->AddViaLength( calculateViaLength( track ) );
1337 }
1338
1340 return;
1341 }
1342 }
1343
1344 // resort to generic slower net update otherwise.
1345 updateNet( i->GetNet() );
1346 }
1347 else if( FOOTPRINT* footprint = dynamic_cast<FOOTPRINT*>( aBoardItem ) )
1348 {
1349 for( const PAD* pad : footprint->Pads() )
1350 {
1351 OPT<LIST_ITEM_ITER> r = m_data_model->findItem( pad->GetNet() );
1352
1353 if( !r )
1354 {
1355 // if show-zero-pads is off, we might not have this net
1356 // in our list yet, so add it first.
1357 // notice that at this point we are very certain that this net
1358 // will have at least one pad.
1359
1360 if( netFilterMatches( pad->GetNet() ) )
1361 r = m_data_model->addItem( std::make_unique<LIST_ITEM>( pad->GetNet() ) );
1362 }
1363
1364 if( r )
1365 {
1366 const std::unique_ptr<LIST_ITEM>& list_item = *r.get();
1367 int len = pad->GetPadToDieLength();
1368
1369 list_item->AddPadCount( 1 );
1370 list_item->AddChipWireLength( len );
1371
1372 if( list_item->GetPadCount() == 0 && !m_cbShowZeroPad->IsChecked() )
1373 m_data_model->deleteItem( r );
1374 else
1376 }
1377 }
1378 }
1379}
unsigned GetNodesCount(int aNet=-1) const
Definition: board.cpp:1148
void updateNet(NETINFO_ITEM *aNet)
void updateDisplayedRowValues(const OPT< LIST_ITEM_ITER > &aRow)

References calculateViaLength(), BOARD::GetNodesCount(), m_brd, DIALOG_NET_INSPECTOR_BASE::m_cbShowZeroPad, m_data_model, netFilterMatches(), pad, PCB_VIA_T, r, updateDisplayedRowValues(), and updateNet().

Referenced by OnBoardItemsAdded().

◆ OnBoardItemChanged()

void DIALOG_NET_INSPECTOR::OnBoardItemChanged ( BOARD aBoard,
BOARD_ITEM aBoardItem 
)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1459 of file dialog_net_inspector.cpp.

1460{
1461 if( dynamic_cast<BOARD_CONNECTED_ITEM*>( aBoardItem ) != nullptr
1462 || dynamic_cast<FOOTPRINT*>( aBoardItem ) != nullptr )
1463 {
1464 buildNetsList();
1465 m_netsList->Refresh();
1466 }
1467}

References buildNetsList(), and DIALOG_NET_INSPECTOR_BASE::m_netsList.

◆ OnBoardItemRemoved()

void DIALOG_NET_INSPECTOR::OnBoardItemRemoved ( BOARD aBoard,
BOARD_ITEM aBoardItem 
)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1391 of file dialog_net_inspector.cpp.

1392{
1393 if( NETINFO_ITEM* net = dynamic_cast<NETINFO_ITEM*>( aBoardItem ) )
1394 {
1395 m_data_model->deleteItem( m_data_model->findItem( net ) );
1396 }
1397 else if( FOOTPRINT* footprint = dynamic_cast<FOOTPRINT*>( aBoardItem ) )
1398 {
1399 for( const PAD* pad : footprint->Pads() )
1400 {
1401 OPT<LIST_ITEM_ITER> r = m_data_model->findItem( pad->GetNet() );
1402
1403 if( r )
1404 {
1405 const std::unique_ptr<LIST_ITEM>& list_item = *r.get();
1406 int len = pad->GetPadToDieLength();
1407
1408 list_item->SubPadCount( 1 );
1409 list_item->SubChipWireLength( len );
1410
1411 if( list_item->GetPadCount() == 0 && !m_cbShowZeroPad->IsChecked() )
1412 m_data_model->deleteItem( r );
1413 else
1415 }
1416 }
1417 }
1418 else if( BOARD_CONNECTED_ITEM* i = dynamic_cast<BOARD_CONNECTED_ITEM*>( aBoardItem ) )
1419 {
1420 OPT<LIST_ITEM_ITER> r = m_data_model->findItem( i->GetNet() );
1421
1422 if( r )
1423 {
1424 // try to handle frequent operations quickly.
1425 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( i ) )
1426 {
1427 const std::unique_ptr<LIST_ITEM>& list_item = *r.get();
1428 int len = track->GetLength();
1429
1430 list_item->SubLayerWireLength( len, static_cast<int>( track->GetLayer() ) );
1431
1432 if( track->Type() == PCB_VIA_T )
1433 {
1434 list_item->SubViaCount( 1 );
1435 list_item->SubViaLength( calculateViaLength( track ) );
1436 }
1437
1439 return;
1440 }
1441
1442 // resort to generic slower net update otherwise.
1443 updateNet( i->GetNet() );
1444 }
1445 }
1446}

References calculateViaLength(), DIALOG_NET_INSPECTOR_BASE::m_cbShowZeroPad, m_data_model, pad, PCB_VIA_T, r, updateDisplayedRowValues(), and updateNet().

Referenced by OnBoardItemsRemoved().

◆ OnBoardItemsAdded()

void DIALOG_NET_INSPECTOR::OnBoardItemsAdded ( BOARD aBoard,
std::vector< BOARD_ITEM * > &  aBoardItems 
)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1382 of file dialog_net_inspector.cpp.

1383{
1384 for( BOARD_ITEM* item : aBoardItem )
1385 {
1386 OnBoardItemAdded( aBoard, item );
1387 }
1388}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:53
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem) override

References OnBoardItemAdded().

◆ OnBoardItemsChanged()

void DIALOG_NET_INSPECTOR::OnBoardItemsChanged ( BOARD aBoard,
std::vector< BOARD_ITEM * > &  aBoardItems 
)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1470 of file dialog_net_inspector.cpp.

1472{
1473 buildNetsList();
1474 m_netsList->Refresh();
1475}

References buildNetsList(), and DIALOG_NET_INSPECTOR_BASE::m_netsList.

◆ OnBoardItemsRemoved()

void DIALOG_NET_INSPECTOR::OnBoardItemsRemoved ( BOARD aBoard,
std::vector< BOARD_ITEM * > &  aBoardItems 
)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1449 of file dialog_net_inspector.cpp.

1451{
1452 for( BOARD_ITEM* item : aBoardItems )
1453 {
1454 OnBoardItemRemoved( aBoard, item );
1455 }
1456}
virtual void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aBoardItem) override

References OnBoardItemRemoved().

◆ OnBoardNetSettingsChanged()

void DIALOG_NET_INSPECTOR::OnBoardNetSettingsChanged ( BOARD aBoard)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 1505 of file dialog_net_inspector.cpp.

1506{
1507 buildNetsList();
1508 m_netsList->Refresh();
1509}

References buildNetsList(), and DIALOG_NET_INSPECTOR_BASE::m_netsList.

◆ OnButton()

void DIALOG_SHIM::OnButton ( wxCommandEvent &  aEvent)
privateinherited

Properly handle the default button events when in the quasimodal mode when not calling EndQuasiModal which is possible with any dialog derived from DIALOG_SHIM.

Definition at line 533 of file dialog_shim.cpp.

534{
535 const int id = aEvent.GetId();
536
537 // If we are pressing a button to exit, we need to enable the escapeID
538 // otherwise the dialog does not process cancel
539 if( id == wxID_CANCEL )
540 SetEscapeId( wxID_ANY );
541
542 if( IsQuasiModal() )
543 {
544 if( id == GetAffirmativeId() )
545 {
546 EndQuasiModal( id );
547 }
548 else if( id == wxID_APPLY )
549 {
550 // Dialogs that provide Apply buttons should make sure data is valid before
551 // allowing a transfer, as there is no other way to indicate failure
552 // (i.e. the dialog can't refuse to close as it might with OK, because it
553 // isn't closing anyway)
554 if( Validate() )
555 {
556 ignore_unused( TransferDataFromWindow() );
557 }
558 }
559 else if( id == GetEscapeId() || (id == wxID_CANCEL && GetEscapeId() == wxID_ANY) )
560 {
561 EndQuasiModal( wxID_CANCEL );
562 }
563 else // not a standard button
564 {
565 aEvent.Skip();
566 }
567
568 return;
569 }
570
571 // This is mandatory to allow wxDialogBase::OnButton() to be called.
572 aEvent.Skip();
573}
void EndQuasiModal(int retCode)
void ignore_unused(const T &)
Definition: ignore.h:24

References DIALOG_SHIM::EndQuasiModal(), ignore_unused(), and DIALOG_SHIM::IsQuasiModal().

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ OnCharHook()

void DIALOG_SHIM::OnCharHook ( wxKeyEvent &  aEvt)
protectedvirtualinherited

Reimplemented in HK_PROMPT_DIALOG, DIALOG_CHOOSE_SYMBOL, and HTML_MESSAGE_BOX.

Definition at line 576 of file dialog_shim.cpp.

577{
578 if( aEvt.GetKeyCode() == 'U' && aEvt.GetModifiers() == wxMOD_CONTROL )
579 {
580 if( m_parentFrame )
581 {
583 return;
584 }
585 }
586 // shift-return (Mac default) or Ctrl-Return (GTK) for OK
587 else if( aEvt.GetKeyCode() == WXK_RETURN && ( aEvt.ShiftDown() || aEvt.ControlDown() ) )
588 {
589 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
590 return;
591 }
592 else if( aEvt.GetKeyCode() == WXK_TAB && !aEvt.ControlDown() )
593 {
594 wxWindow* currentWindow = wxWindow::FindFocus();
595 int currentIdx = -1;
596 int delta = aEvt.ShiftDown() ? -1 : 1;
597
598 auto advance =
599 [&]( int& idx )
600 {
601 // Wrap-around modulus
602 int size = m_tabOrder.size();
603 idx = ( ( idx + delta ) % size + size ) % size;
604 };
605
606 for( size_t i = 0; i < m_tabOrder.size(); ++i )
607 {
608 if( m_tabOrder[i] == currentWindow )
609 {
610 currentIdx = (int) i;
611 break;
612 }
613 }
614
615 if( currentIdx >= 0 )
616 {
617 advance( currentIdx );
618
619 //todo: We don't currently have non-textentry dialog boxes but this will break if
620 // we add them.
621#ifdef __APPLE__
622 while( dynamic_cast<wxTextEntry*>( m_tabOrder[ currentIdx ] ) == nullptr )
623 advance( currentIdx );
624#endif
625
626 m_tabOrder[ currentIdx ]->SetFocus();
627 return;
628 }
629 }
630
631 aEvt.Skip();
632}
std::vector< wxWindow * > m_tabOrder
Definition: dialog_shim.h:222
EDA_BASE_FRAME * m_parentFrame
Definition: dialog_shim.h:220
virtual void ToggleUserUnits()
constexpr int delta

References delta, DIALOG_SHIM::m_parentFrame, DIALOG_SHIM::m_tabOrder, and EDA_BASE_FRAME::ToggleUserUnits().

Referenced by DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), and DIALOG_TEXTBOX_PROPERTIES::~DIALOG_TEXTBOX_PROPERTIES().

◆ OnCloseWindow()

void DIALOG_SHIM::OnCloseWindow ( wxCloseEvent &  aEvent)
privateinherited

Properly handle the wxCloseEvent when in the quasimodal mode when not calling EndQuasiModal which is possible with any dialog derived from DIALOG_SHIM.

Definition at line 520 of file dialog_shim.cpp.

521{
522 if( IsQuasiModal() )
523 {
524 EndQuasiModal( wxID_CANCEL );
525 return;
526 }
527
528 // This is mandatory to allow wxDialogBase::OnCloseWindow() to be called.
529 aEvent.Skip();
530}

References DIALOG_SHIM::EndQuasiModal(), and DIALOG_SHIM::IsQuasiModal().

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ onDeleteNet()

void DIALOG_NET_INSPECTOR::onDeleteNet ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_NET_INSPECTOR_BASE.

Definition at line 2128 of file dialog_net_inspector.cpp.

2129{
2130 if( !m_netsList->HasSelection() )
2131 return;
2132
2133 wxDataViewItemArray sel;
2134 m_netsList->GetSelections( sel );
2135
2136 auto delete_one =
2137 [this]( const LIST_ITEM* i )
2138 {
2139 if( i->GetPadCount() == 0
2140 || IsOK( this, wxString::Format( _( "Net '%s' is in use. Delete anyway?" ),
2141 i->GetNetName() ) ) )
2142 {
2143 // This is a bit hacky, but it will do for now, since this is the only path
2144 // outside the netlist updater where you can remove a net from a BOARD.
2145 int removedCode = i->GetNetCode();
2146
2148 [removedCode]( KIGFX::VIEW_ITEM* aItem ) -> bool
2149 {
2150 if( auto bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( aItem ) )
2151 return bci->GetNetCode() == removedCode;
2152
2153 return false;
2154 } );
2155
2156 m_brd->Remove( i->GetNet() );
2157 m_frame->OnModify();
2158
2159 // We'll get an OnBoardItemRemoved callback from this to update our listbox
2160 }
2161 };
2162
2163 for( unsigned int i = 0; i < sel.GetCount(); ++i )
2164 {
2165 const LIST_ITEM* ii = static_cast<const LIST_ITEM*>( sel.Item( i ).GetID() );
2166
2167 if( ii->GetIsGroup() )
2168 {
2169 if( ii->ChildrenCount() != 0
2170 && IsOK( this, wxString::Format( _( "Delete all nets in group '%s'?" ),
2171 ii->GetGroupName() ) ) )
2172 {
2173 // we can't be iterating the children container and deleting items from
2174 // it at the same time. thus take a copy of it first.
2175 std::vector<const LIST_ITEM*> children;
2176 children.reserve( ii->ChildrenCount() );
2177 std::copy( ii->ChildrenBegin(), ii->ChildrenEnd(), std::back_inserter( children ) );
2178
2179 for( const LIST_ITEM* c : children )
2180 delete_one( c );
2181 }
2182 }
2183 else
2184 {
2185 delete_one( ii );
2186 }
2187 }
2188}
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: board.cpp:793
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:77
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition: view.cpp:1488
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:342
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:52

References _, DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenBegin(), DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenCount(), DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenEnd(), Format(), PCB_BASE_FRAME::GetCanvas(), DIALOG_NET_INSPECTOR::LIST_ITEM::GetGroupName(), DIALOG_NET_INSPECTOR::LIST_ITEM::GetIsGroup(), PCB_DRAW_PANEL_GAL::GetView(), IsOK(), m_brd, m_frame, DIALOG_NET_INSPECTOR_BASE::m_netsList, PCB_EDIT_FRAME::OnModify(), BOARD::Remove(), KIGFX::REPAINT, and KIGFX::VIEW::UpdateAllItemsConditionally().

◆ onFilterChange()

void DIALOG_NET_INSPECTOR::onFilterChange ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_NET_INSPECTOR_BASE.

Definition at line 1802 of file dialog_net_inspector.cpp.

1803{
1804 wxStringTokenizer filters( m_textCtrlFilter->GetValue().Upper(), wxT( "," ) );
1805 m_netFilter.clear();
1806
1807 while( filters.HasMoreTokens() )
1808 {
1809 wxString t = filters.GetNextToken();
1810 t.Trim( false );
1811 t.Trim( true );
1812
1813 if( !t.IsEmpty() )
1814 {
1815 m_netFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD>() );
1816 m_netFilter.back()->SetPattern( t );
1817 }
1818 }
1819
1820 wxStringTokenizer group_filters( m_groupByText->GetValue(), wxT( "," ) );
1821 m_groupFilter.clear();
1822
1823 while( group_filters.HasMoreTokens() )
1824 {
1825 wxString t = group_filters.GetNextToken();
1826 t.Trim( false );
1827 t.Trim( true );
1828
1829 if( !t.IsEmpty() )
1830 {
1831 if( m_groupByKind->GetSelection() == 0 || m_groupByKind->GetSelection() == 2 )
1832 {
1833 // type 2: wildcard match, use the matching substring as a group key.
1834 // the number of groups is determined dynamically by the number of
1835 // resulting matches in the whole set.
1836 m_groupFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD>() );
1837 m_groupFilter.back()->SetPattern( t );
1838 }
1839 else if( m_groupByKind->GetSelection() == 1 || m_groupByKind->GetSelection() == 3 )
1840 {
1841 // type 3: regex match, use the matching substring as a group key.
1842 // the number of groups is determined dynamically by the number of
1843 // resulting matches in the whole set.
1844 m_groupFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_REGEX>() );
1845 m_groupFilter.back()->SetPattern( t );
1846 }
1847 }
1848 }
1849
1851 buildNetsList();
1852}

References buildNetsList(), m_filter_change_no_rebuild, DIALOG_NET_INSPECTOR_BASE::m_groupByKind, DIALOG_NET_INSPECTOR_BASE::m_groupByText, m_groupFilter, m_netFilter, and DIALOG_NET_INSPECTOR_BASE::m_textCtrlFilter.

◆ OnGridEditorHidden()

void DIALOG_SHIM::OnGridEditorHidden ( wxGridEvent &  event)
privateinherited

Definition at line 642 of file dialog_shim.cpp.

643{
644 SetEscapeId( wxID_ANY );
645 event.Skip();
646}

◆ OnGridEditorShown()

void DIALOG_SHIM::OnGridEditorShown ( wxGridEvent &  event)
privateinherited

Definition at line 635 of file dialog_shim.cpp.

636{
637 SetEscapeId( wxID_NONE );
638 event.Skip();
639}

◆ onListSize()

void DIALOG_NET_INSPECTOR::onListSize ( wxSizeEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_NET_INSPECTOR_BASE.

Definition at line 1982 of file dialog_net_inspector.cpp.

1983{
1984 auto new_size = aEvent.GetSize();
1985
1986 if( new_size != m_size )
1987 {
1988 m_size = new_size;
1990 }
1991
1992 aEvent.Skip();
1993}

References adjustListColumns(), and m_size.

◆ OnModify()

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 387 of file dialog_shim.cpp.

388{
390 {
392
393 selectAllInTextCtrls( GetChildren() );
394
397 else
398 KIPLATFORM::UI::ForceFocus( this ); // Focus the dialog itself
399
400 m_firstPaintEvent = false;
401 }
402
403 event.Skip();
404}
bool m_firstPaintEvent
Definition: dialog_shim.h:212
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:213
static void selectAllInTextCtrls(wxWindowList &children)
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: gtk/ui.cpp:71
void ForceFocus(wxWindow *aWindow)
Pass the current focus to the window.
Definition: gtk/ui.cpp:44

References KIPLATFORM::UI::FixupCancelButtonCmdKeyCollision(), KIPLATFORM::UI::ForceFocus(), DIALOG_SHIM::m_firstPaintEvent, DIALOG_SHIM::m_initialFocusTarget, and selectAllInTextCtrls().

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ onParentWindowClosed()

void DIALOG_NET_INSPECTOR::onParentWindowClosed ( wxCommandEvent &  event)
private

Definition at line 1159 of file dialog_net_inspector.cpp.

1160{
1161 Close();
1162 event.Skip();
1163}

Referenced by DIALOG_NET_INSPECTOR(), and ~DIALOG_NET_INSPECTOR().

◆ onRenameNet()

void DIALOG_NET_INSPECTOR::onRenameNet ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_NET_INSPECTOR_BASE.

Definition at line 2032 of file dialog_net_inspector.cpp.

2033{
2034 if( m_netsList->GetSelectedItemsCount() == 1 )
2035 {
2036 const LIST_ITEM* sel = static_cast<const LIST_ITEM*>( m_netsList->GetSelection().GetID() );
2037
2038 if( sel->GetIsGroup() )
2039 return;
2040
2041 NETINFO_ITEM* net = sel->GetNet();
2042 wxString fullNetName = net->GetNetname();
2043 wxString netPath;
2044 wxString shortNetName;
2045
2046 if( fullNetName.Contains( wxT( "/" ) ) )
2047 {
2048 netPath = fullNetName.BeforeLast( '/' ) + '/';
2049 shortNetName = fullNetName.AfterLast( '/' );
2050 }
2051 else
2052 {
2053 shortNetName = fullNetName;
2054 }
2055
2056 wxString unescapedShortName = UnescapeString( shortNetName );
2057
2058 WX_TEXT_ENTRY_DIALOG dlg( this, _( "Net name:" ), _( "Rename Net" ), unescapedShortName );
2059 NETNAME_VALIDATOR validator( &unescapedShortName );
2060 dlg.SetTextValidator( validator );
2061
2062 while( true )
2063 {
2064 if( dlg.ShowModal() != wxID_OK || dlg.GetValue() == unescapedShortName )
2065 return;
2066
2067 unescapedShortName = dlg.GetValue();
2068
2069 if( unescapedShortName.IsEmpty() )
2070 {
2071 DisplayError( this, wxString::Format( _( "Net name cannot be empty." ),
2072 unescapedShortName ) );
2073 continue;
2074 }
2075
2076 shortNetName = EscapeString( unescapedShortName, CTX_NETNAME );
2077 fullNetName = netPath + shortNetName;
2078
2079 if( m_brd->FindNet( shortNetName ) || m_brd->FindNet( fullNetName ) )
2080 {
2081 DisplayError( this, wxString::Format( _( "Net name '%s' is already in use." ),
2082 unescapedShortName ) );
2083 unescapedShortName = wxEmptyString;
2084 }
2085 else
2086 {
2087 break;
2088 }
2089 }
2090
2091 // the changed name might require re-grouping. remove and re-insert
2092 // is easier.
2093 auto removed_item = m_data_model->deleteItem( m_data_model->findItem( net ) );
2094
2095 m_brd->GetNetInfo().RemoveNet( net );
2096 net->SetNetname( fullNetName );
2097 m_brd->GetNetInfo().AppendNet( net );
2098 m_frame->OnModify();
2099
2100 if( netFilterMatches( net ) )
2101 {
2102 std::unique_ptr<LIST_ITEM> new_item = std::make_unique<LIST_ITEM>( net );
2103 new_item->SetPadCount( removed_item->GetPadCount() );
2104 new_item->SetViaCount( removed_item->GetViaCount() );
2105
2106 for( int ii = 0; ii < MAX_CU_LAYERS; ++ii )
2107 new_item->SetLayerWireLength( removed_item->GetLayerWireLength( ii ), ii );
2108
2109 new_item->SetChipWireLength( removed_item->GetChipWireLength() );
2110
2111 OPT<LIST_ITEM_ITER> added_row = m_data_model->addItem( std::move( new_item ) );
2112
2113 wxDataViewItemArray new_sel;
2114 new_sel.Add( wxDataViewItem( &***added_row ) );
2115 m_netsList->SetSelections( new_sel );
2116 onSelChanged();
2117 }
2118
2119 // Currently only tracks and pads have netname annotations and need to be redrawn,
2120 // but zones are likely to follow. Since we don't have a way to ask what is current,
2121 // just refresh all items.
2124 }
2125}
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1478
void SetNetname(const wxString &aNewName)
Set the long netname to aNetName, and the short netname to the last token in the long netname's path.
Definition: netinfo.h:138
void RemoveNet(NETINFO_ITEM *aNet)
Remove a net from the net list.
void AppendNet(NETINFO_ITEM *aNewElement)
Add aNewElement to the end of the net list.
#define MAX_CU_LAYERS
Definition: layer_ids.h:140
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_NETNAME
Definition: string_utils.h:54

References _, NETINFO_LIST::AppendNet(), CTX_NETNAME, DisplayError(), EscapeString(), BOARD::FindNet(), Format(), PCB_BASE_FRAME::GetCanvas(), DIALOG_NET_INSPECTOR::LIST_ITEM::GetIsGroup(), DIALOG_NET_INSPECTOR::LIST_ITEM::GetNet(), BOARD::GetNetInfo(), NETINFO_ITEM::GetNetname(), WX_TEXT_ENTRY_DIALOG::GetValue(), PCB_DRAW_PANEL_GAL::GetView(), m_brd, m_data_model, m_frame, DIALOG_NET_INSPECTOR_BASE::m_netsList, MAX_CU_LAYERS, netFilterMatches(), PCB_EDIT_FRAME::OnModify(), onSelChanged(), EDA_DRAW_PANEL_GAL::Refresh(), NETINFO_LIST::RemoveNet(), KIGFX::REPAINT, NETINFO_ITEM::SetNetname(), WX_TEXT_ENTRY_DIALOG::SetTextValidator(), UnescapeString(), and KIGFX::VIEW::UpdateAllItems().

◆ onReport()

void DIALOG_NET_INSPECTOR::onReport ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_NET_INSPECTOR_BASE.

Definition at line 2191 of file dialog_net_inspector.cpp.

2192{
2193 wxFileDialog dlg( this, _( "Report file" ), "", "",
2194 _( "Report file" ) + AddFileExtListToFilter( { "csv" } ),
2195 wxFD_SAVE );
2196
2197 if( dlg.ShowModal() == wxID_CANCEL )
2198 return;
2199
2200 wxTextFile f( dlg.GetPath() );
2201
2202 f.Create();
2203
2204 wxString txt;
2205
2206 // Print Header:
2207 for( auto&& col : m_columns )
2208 txt += '"' + col.csv_name + wxT( "\";" );
2209
2210 f.AddLine( txt );
2211
2212 // Print list of nets:
2213 const unsigned int num_rows = m_data_model->itemCount();
2214
2215 for( unsigned int row = 0; row < num_rows; row++ )
2216 {
2217 auto& i = m_data_model->itemAt( row );
2218
2219 if( i.GetIsGroup() || i.GetNetCode() == 0 )
2220 continue;
2221
2222 txt = "";
2223
2224 for( auto&& col : m_columns )
2225 {
2226 if( static_cast<int>( col.csv_flags ) & static_cast<int>( CSV_COLUMN_DESC::CSV_QUOTE ) )
2227 txt += '"' + m_data_model->valueAt( col.num, row ).GetString() + wxT( "\";" );
2228 else
2229 txt += m_data_model->valueAt( col.num, row ).GetString() + ';';
2230 }
2231
2232 f.AddLine( txt );
2233 }
2234
2235 f.Write();
2236 f.Close();
2237}
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.

References _, AddFileExtListToFilter(), CSV_QUOTE, m_columns, and m_data_model.

◆ onSelChanged() [1/2]

void DIALOG_NET_INSPECTOR::onSelChanged ( )
private

Definition at line 1861 of file dialog_net_inspector.cpp.

1862{
1863 // ignore selection changes while the whole list is being rebuilt.
1865 return;
1866
1868
1869 bool enable_rename_button = false;
1870 bool enable_delete_button = false;
1871
1872 if( m_netsList->HasSelection() )
1873 {
1874 wxDataViewItemArray sel;
1875 m_netsList->GetSelections( sel );
1876
1877 ps->SetHighlight( false );
1878
1879 enable_rename_button = sel.GetCount() == 1;
1880 enable_delete_button = true;
1881
1882 for( unsigned int i = 0; i < sel.GetCount(); ++i )
1883 {
1884 const LIST_ITEM* ii = static_cast<const LIST_ITEM*>( sel.Item( i ).GetID() );
1885
1886 if( ii->GetIsGroup() )
1887 {
1888 enable_rename_button = false;
1889
1890 for( auto c = ii->ChildrenBegin(), end = ii->ChildrenEnd(); c != end; ++c )
1891 ps->SetHighlight( true, ( *c )->GetNetCode(), true );
1892 }
1893 else
1894 ps->SetHighlight( true, ii->GetNetCode(), true );
1895 }
1896 }
1897 else
1898 ps->SetHighlight( false );
1899
1902
1903 m_renameNet->Enable( enable_rename_button );
1904 m_deleteNet->Enable( enable_delete_button );
1905}
Container for all the knowledge about how graphical objects are drawn on any output surface/device.

References DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenBegin(), DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenEnd(), PCB_BASE_FRAME::GetCanvas(), DIALOG_NET_INSPECTOR::LIST_ITEM::GetIsGroup(), DIALOG_NET_INSPECTOR::LIST_ITEM::GetNetCode(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), DIALOG_NET_INSPECTOR_BASE::m_deleteNet, m_frame, m_in_build_nets_list, DIALOG_NET_INSPECTOR_BASE::m_netsList, DIALOG_NET_INSPECTOR_BASE::m_renameNet, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::RENDER_SETTINGS::SetHighlight(), and KIGFX::VIEW::UpdateAllLayersColor().

Referenced by onRenameNet(), and onSelChanged().

◆ onSelChanged() [2/2]

void DIALOG_NET_INSPECTOR::onSelChanged ( wxDataViewEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_NET_INSPECTOR_BASE.

Definition at line 1855 of file dialog_net_inspector.cpp.

1856{
1857 onSelChanged();
1858}

References onSelChanged().

◆ onSortingChanged()

void DIALOG_NET_INSPECTOR::onSortingChanged ( wxDataViewEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_NET_INSPECTOR_BASE.

Definition at line 1908 of file dialog_net_inspector.cpp.

1909{
1910 // FIXME: Whenever the sort criteria changes (sorting column)
1911 // the visible row-numers of the selection get preserved, not the actual
1912 // elements. Don't know at the moment how to preserve the selection,
1913 // so just clear it for now.
1914
1915 m_netsList->UnselectAll();
1916
1920}

References PCB_BASE_FRAME::GetCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), m_frame, DIALOG_NET_INSPECTOR_BASE::m_netsList, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::RENDER_SETTINGS::SetHighlight(), and KIGFX::VIEW::UpdateAllLayersColor().

◆ onUnitsChanged()

void DIALOG_NET_INSPECTOR::onUnitsChanged ( wxCommandEvent &  event)
private

Definition at line 1166 of file dialog_net_inspector.cpp.

1167{
1168 this->m_units = m_frame->GetUserUnits();
1169
1170 m_data_model->updateAllItems();
1171
1172 event.Skip();
1173}
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References EDA_BASE_FRAME::GetUserUnits(), m_data_model, m_frame, and DIALOG_SHIM::m_units.

Referenced by DIALOG_NET_INSPECTOR(), and ~DIALOG_NET_INSPECTOR().

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Return a reference to the PROJECT associated with this KIWAY.

Definition at line 36 of file kiway_holder.cpp.

37{
38 return Kiway().Prj();
39}
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:192

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), FP_TREE_MODEL_ADAPTER::AddLibraries(), SYMBOL_LIBRARY_MANAGER::addLibrary(), PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_EDIT_FRAME::addLibTableEntry(), SCH_EDIT_FRAME::AppendSchematic(), AskSaveBoardFileName(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::buildEquivalenceList(), CVPCB_MAINFRAME::BuildLibrariesListBox(), FOOTPRINT_EDIT_FRAME::buildSaveAsDialog(), SYMBOL_EDIT_FRAME::buildSaveAsDialog(), SIM_PLOT_FRAME::canCloseWindow(), PANEL_FP_PROPERTIES_3D_MODEL::Cfg3DPath(), KICAD_MANAGER_FRAME::CloseProject(), PCB_BASE_EDIT_FRAME::createNewLibrary(), PCB_BASE_EDIT_FRAME::CreateNewProjectLibrary(), DIALOG_PLOT_SCHEMATIC::createPDFFile(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), SCH_EDIT_FRAME::CreateScreens(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION(), DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_NETLIST_IMPORT::DIALOG_NETLIST_IMPORT(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_PLOT::DIALOG_PLOT(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), PL_DRAW_PANEL_GAL::DisplayDrawingSheet(), FOOTPRINT_PREVIEW_PANEL::DisplayFootprint(), SYMBOL_VIEWER_FRAME::DisplayLibInfos(), CVPCB_MAINFRAME::DisplayStatus(), SCH_EDIT_FRAME::doAutoSave(), PCB_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::doCloseWindow(), FOOTPRINT_EDIT_FRAME::doCloseWindow(), PCB_BASE_EDIT_FRAME::doCloseWindow(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), FIELDS_GRID_TRICKS::doPopupSelection(), FOOTPRINT_EDIT_FRAME::DuplicateFootprint(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportFootprintsToLibrary(), BOARD_EDITOR_CONTROL::ExportNetlist(), SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG(), SYMBOL_EDITOR_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), BACK_ANNOTATE::FetchNetlistFromPCB(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), SYMBOL_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SIM_PLOT_FRAME::getDefaultFilename(), SIM_PLOT_FRAME::getDefaultPath(), PCB_BASE_EDIT_FRAME::GetDesignRulesPath(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), PCB_EDIT_FRAME::GetLastPath(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), SCH_BASE_FRAME::GetLibSymbol(), DIALOG_PLOT_SCHEMATIC::getOutputPath(), KICAD_MANAGER_FRAME::GetProjectFileName(), SCH_EDIT_FRAME::GetSchematicJunctionSize(), SYMBOL_VIEWER_FRAME::GetSelectedSymbol(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), DIALOG_CONFIG_EQUFILES::Init(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), SCH_EDIT_FRAME::KiwayMailIn(), SYMBOL_EDIT_FRAME::KiwayMailIn(), FOOTPRINT_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), PCB_BASE_FRAME::loadFootprint(), CVPCB_MAINFRAME::LoadFootprintFiles(), PCB_EDIT_FRAME::LoadFootprints(), SCH_EDIT_FRAME::LoadProject(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectSettings(), PCB_EDIT_FRAME::LoadProjectSettings(), SIM_PLOT_FRAME::LoadSettings(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib(), EDA_BASE_FRAME::LoadWindowState(), SIM_PLOT_FRAME::loadWorkbook(), SIM_PLOT_FRAME::menuSaveWorkbook(), SIM_PLOT_FRAME::menuSaveWorkbookAs(), PANEL_FP_PROPERTIES_3D_MODEL::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), PANEL_FP_PROPERTIES_3D_MODEL::OnAdd3DModel(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), PCB_EDIT_FRAME::onBoardLoaded(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_NETLIST_IMPORT::onBrowseNetlistFiles(), WX_HTML_REPORT_PANEL::onBtnSaveToFile(), TEXT_BUTTON_URL::OnButtonClick(), TEXT_BUTTON_FILE_BROWSER::OnButtonClick(), DIALOG_EDIT_SYMBOLS_LIBID::onClickOrphansButton(), DIALOG_SYMBOL_FIELDS_TABLE::OnExport(), DIALOG_EXPORT_STEP::onExportButton(), DIALOG_GENDRILL::OnGenReportFile(), KICAD_MANAGER_FRAME::OnIdle(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_SYMBOL::OnInitDialog(), DIALOG_CONFIG_EQUFILES::OnOkClick(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_SCHEMATIC_SETUP::OnPageChanged(), DIALOG_BOARD_SETUP::OnPageChanged(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), DIALOG_ERC::OnSaveReport(), DIALOG_DRC::OnSaveReport(), DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded(), DIALOG_TEXT_PROPERTIES::onScintillaCharAdded(), PROPERTIES_FRAME::onScintillaCharAdded(), SYMBOL_VIEWER_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_FP_PROPERTIES_3D_MODEL::PANEL_FP_PROPERTIES_3D_MODEL(), PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL(), SCH_EDITOR_CONTROL::Paste(), FOOTPRINT_EDITOR_CONTROL::PasteFootprint(), SCH_BASE_FRAME::PickSymbolFromLibTree(), SYMBOL_EDITOR_CONTROL::PinLibrary(), FOOTPRINT_EDITOR_CONTROL::PinLibrary(), DIALOG_PLOT_SCHEMATIC::plotOneSheetDXF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetHpgl(), DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector(), SCH_EDITOR_CONTROL::Print(), EDA_DRAW_FRAME::PrintDrawingSheet(), SCH_EDIT_FRAME::PrintPage(), KICAD_MANAGER_FRAME::PrintPrjInfo(), CVPCB_MAINFRAME::readNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), SYMBOL_VIEWER_FRAME::ReCreateSymbolList(), PANEL_FP_PROPERTIES_3D_MODEL::ReloadModelsFromFootprint(), EDA_3D_VIEWER_FRAME::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDITOR_CONTROL::RenameFootprint(), SYMBOL_EDIT_FRAME::replaceLibTableEntry(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), PCB_EDIT_FRAME::RunEeschema(), FOOTPRINT_EDITOR_CONTROL::SaveAs(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), SYMBOL_EDIT_FRAME::saveLibrary(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::SaveProject(), PCB_EDIT_FRAME::SaveProjectSettings(), DIALOG_BOARD_STATISTICS::saveReportClicked(), SCH_EDIT_FRAME::saveSchematicFile(), EDA_BASE_FRAME::SaveSettings(), SIM_PLOT_FRAME::SaveSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), SIM_PLOT_FRAME::saveWorkbook(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), SYMBOL_EDIT_FRAME::SelectLibraryFromList(), PCB_BASE_EDIT_FRAME::selectLibTable(), SYMBOL_EDIT_FRAME::selectSymLibTable(), PCB_EDIT_FRAME::SetBoard(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), SYMBOL_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), SYMBOL_EDIT_FRAME::SetCurSymbol(), PCB_EDIT_FRAME::SetLastPath(), GERBVIEW_FRAME::SetPageSettings(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_SYMBOL::ShowFootprintFor(), COMMON_CONTROL::ShowHelp(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SYMBOL_VIEWER_FRAME::ShowModal(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SYMBOL_LIBRARY_MANAGER::symTable(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER_FRAME::takeScreenshot(), PCB_EDIT_FRAME::TestStandalone(), DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataToWindow(), SYMBOL_EDITOR_CONTROL::UnpinLibrary(), FOOTPRINT_EDITOR_CONTROL::UnpinLibrary(), SCH_EDIT_FRAME::updateAutoSaveFile(), DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample(), SCH_EDIT_FRAME::UpdateTitle(), SIM_PLOT_FRAME::updateTitle(), FOOTPRINT_EDIT_FRAME::UpdateTitle(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), PANEL_FP_PROPERTIES_3D_MODEL::validateModelExists(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES(), EDA_3D_VIEWER_FRAME::~EDA_3D_VIEWER_FRAME(), PANEL_FP_PROPERTIES_3D_MODEL::~PANEL_FP_PROPERTIES_3D_MODEL(), and SCH_EDIT_FRAME::~SCH_EDIT_FRAME().

◆ relevantConnectivityItems()

std::vector< CN_ITEM * > DIALOG_NET_INSPECTOR::relevantConnectivityItems ( ) const
private

Definition at line 1233 of file dialog_net_inspector.cpp.

1234{
1235 // pre-filter the connectivity items and sort them by netcode.
1236 // this avoids quadratic runtime when building the whole net list and
1237 // calculating the total length for each net.
1238
1239 const auto type_bits = std::bitset<MAX_STRUCT_TYPE_ID>()
1240 .set( PCB_TRACE_T )
1241 .set( PCB_ARC_T )
1242 .set( PCB_VIA_T )
1243 .set( PCB_PAD_T );
1244
1245 std::vector<CN_ITEM*> cn_items;
1246 cn_items.reserve( 1024 );
1247
1248 for( CN_ITEM* cn_item : m_brd->GetConnectivity()->GetConnectivityAlgo()->ItemList() )
1249 {
1250 if( cn_item->Valid() && type_bits[cn_item->Parent()->Type()] )
1251 cn_items.push_back( cn_item );
1252 }
1253
1254 std::sort( cn_items.begin(), cn_items.end(), NETCODE_CMP_LESS() );
1255
1256 return cn_items;
1257}
CN_ITEM represents a BOARD_CONNETED_ITEM in the connectivity system (ie: a pad, track/arc/via,...

References BOARD::GetConnectivity(), m_brd, PCB_ARC_T, PCB_PAD_T, PCB_TRACE_T, and PCB_VIA_T.

Referenced by buildNetsList(), and updateNet().

◆ resetSize()

void DIALOG_SHIM::resetSize ( )
protectedinherited

Clear the existing dialog size and position.

This will cause the dialog size to be clear so the next time the dialog is shown the sizers will layout the dialog accordingly. This useful when there are dialog windows that size changes due to layout dependency hidden controls.

Definition at line 294 of file dialog_shim.cpp.

295{
296 const char* hash_key;
297
298 if( m_hash_key.size() )
299 {
300 // a special case like EDA_LIST_DIALOG, which has multiple uses.
301 hash_key = m_hash_key.c_str();
302 }
303 else
304 {
305 hash_key = typeid(*this).name();
306 }
307
308 std::unordered_map<std::string, wxRect>::iterator it = class_map.find( hash_key );
309
310 if( it == class_map.end() )
311 return;
312
313 wxRect rect = it->second;
314 rect.SetSize( wxSize( 0, 0 ) );
315 class_map[ hash_key ] = rect;
316}
std::string m_hash_key
Definition: dialog_shim.h:203
static std::unordered_map< std::string, wxRect > class_map

References class_map, and DIALOG_SHIM::m_hash_key.

Referenced by DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES().

◆ SetInitialFocus()

void DIALOG_SHIM::SetInitialFocus ( wxWindow *  aWindow)
inlineinherited

Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.

Definition at line 97 of file dialog_shim.h.

98 {
99 m_initialFocusTarget = aWindow;
100 }

References DIALOG_SHIM::m_initialFocusTarget.

Referenced by FOOTPRINT_EDIT_FRAME::buildSaveAsDialog(), SYMBOL_EDIT_FRAME::buildSaveAsDialog(), DIALOG_BOM::DIALOG_BOM(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL(), DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS(), DIALOG_FIND::DIALOG_FIND(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GET_FOOTPRINT_BY_NAME::DIALOG_GET_FOOTPRINT_BY_NAME(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES(), DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES(), DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES(), DIALOG_LINE_PROPERTIES::DIALOG_LINE_PROPERTIES(), DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_SCH_FIND::DIALOG_SCH_FIND(), DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_WIRE_BUS_PROPERTIES::DIALOG_WIRE_BUS_PROPERTIES(), EDA_VIEW_SWITCHER::EDA_VIEW_SWITCHER(), HK_PROMPT_DIALOG::HK_PROMPT_DIALOG(), DIALOG_FIELD_PROPERTIES::init(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchAllClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchRefClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchSelectedClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchValueClicked(), PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE(), PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE(), DIALOG_COPPER_ZONE::TransferDataToWindow(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow(), DIALOG_RULE_AREA_PROPERTIES::TransferDataToWindow(), and WX_TEXT_ENTRY_DIALOG::WX_TEXT_ENTRY_DIALOG().

◆ SetKiway()

void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

It is only used for debugging, since "this" is not a wxWindow*.

"this" is a KIWAY_HOLDER mix-in.

Parameters
aDestis the recipient of aKiway pointer.
aKiwayis often from a parent window or from KIFACE::CreateWindow().

Definition at line 43 of file kiway_holder.cpp.

44{
45#if defined(DEBUG)
46 // offer a trap point for debugging most any window
47 wxASSERT( aDest );
48 if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
49 {
50 int breakhere=1;
51 ignore_unused( breakhere );
52 }
53#endif
54
55 ignore_unused( aDest );
56
57 m_kiway = aKiway;
58}
const char * name
Definition: DXF_plotter.cpp:56

References ignore_unused(), KIWAY_HOLDER::m_kiway, and name.

Referenced by BM2CMP_FRAME::BM2CMP_FRAME(), PCB::IFACE::CreateWindow(), InvokePcbLibTableEditor(), InvokeSchEditSymbolLibTable(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

◆ SetPosition()

void DIALOG_SHIM::SetPosition ( const wxPoint &  aNewPosition)
inherited

Force the position of the dialog to a new position.

Parameters
aNewPositionis the new forced position

Definition at line 197 of file dialog_shim.cpp.

198{
199 wxDialog::SetPosition( aNewPosition );
200
201 // Now update the stored position:
202 const char* hash_key;
203
204 if( m_hash_key.size() )
205 {
206 // a special case like EDA_LIST_DIALOG, which has multiple uses.
207 hash_key = m_hash_key.c_str();
208 }
209 else
210 {
211 hash_key = typeid(*this).name();
212 }
213
214 std::unordered_map<std::string, wxRect>::iterator it = class_map.find( hash_key );
215
216 if( it == class_map.end() )
217 return;
218
219 wxRect rect = it->second;
220 rect.SetPosition( aNewPosition );
221
222 class_map[ hash_key ] = rect;
223}
void SetPosition(const wxString &aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)

References class_map, DIALOG_SHIM::m_hash_key, and PCAD2KICAD::SetPosition().

Referenced by PCB_BASE_FRAME::SelectOneLayer().

◆ setSizeInDU()

void DIALOG_SHIM::setSizeInDU ( int  x,
int  y 
)
protectedinherited

Set the dialog to the given dimensions in "dialog units".

These are units equivalent to 4* the average character width and 8* the average character height, allowing a dialog to be sized in a way that scales it with the system font.

Definition at line 169 of file dialog_shim.cpp.

170{
171 wxSize sz( x, y );
172 SetSize( ConvertDialogToPixels( sz ) );
173}

Referenced by DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), and HTML_MESSAGE_BOX::SetDialogSizeInDU().

◆ Settings()

DIALOG_NET_INSPECTOR::SETTINGS DIALOG_NET_INSPECTOR::Settings ( ) const

Definition at line 1136 of file dialog_net_inspector.cpp.

1137{
1138 std::vector<int> column_order( m_data_model->columnCount() );
1139
1140 for( unsigned int i = 0; i < column_order.size(); ++i )
1141 column_order[i] = m_netsList->GetColumn( i )->GetModelColumn();
1142
1143 wxDataViewColumn* sorting_column = m_netsList->GetSortingColumn();
1144
1145 SETTINGS r;
1146 r.filter_string = m_textCtrlFilter->GetValue();
1147 r.show_zero_pad_nets = m_cbShowZeroPad->IsChecked();
1148 r.group_by = m_groupBy->IsChecked();
1149 r.group_by_kind = m_groupByKind->GetSelection();
1150 r.group_by_text = m_groupByText->GetValue();
1151 r.sorting_column = sorting_column ? static_cast<int>( sorting_column->GetModelColumn() ) : -1;
1152 r.sort_order_asc = sorting_column ? sorting_column->IsSortOrderAscending() : true;
1153 r.column_order = column_order;
1154
1155 return r;
1156}

References DIALOG_NET_INSPECTOR_BASE::m_cbShowZeroPad, m_data_model, DIALOG_NET_INSPECTOR_BASE::m_groupBy, DIALOG_NET_INSPECTOR_BASE::m_groupByKind, DIALOG_NET_INSPECTOR_BASE::m_groupByText, DIALOG_NET_INSPECTOR_BASE::m_netsList, DIALOG_NET_INSPECTOR_BASE::m_textCtrlFilter, and r.

◆ SetupStandardButtons()

void DIALOG_SHIM::SetupStandardButtons ( std::map< int, wxString >  aLabels = {})
inherited

Definition at line 709 of file dialog_shim.cpp.

710{
711 recursiveDescent( GetSizer(), aLabels );
712}
static void recursiveDescent(wxSizer *aSizer, std::map< int, wxString > &aLabels)

References recursiveDescent().

Referenced by CONVERT_SETTINGS_DIALOG::CONVERT_SETTINGS_DIALOG(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOM::DIALOG_BOM(), DIALOG_BUS_MANAGER::DIALOG_BUS_MANAGER(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL(), DIALOG_CLEANUP_GRAPHICS::DIALOG_CLEANUP_GRAPHICS(), DIALOG_COLOR_PICKER::DIALOG_COLOR_PICKER(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY(), DIALOG_DIELECTRIC_MATERIAL::DIALOG_DIELECTRIC_MATERIAL(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_DRC::DIALOG_DRC(), DIALOG_ERC::DIALOG_ERC(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FILTER_SELECTION::DIALOG_FILTER_SELECTION(), DIALOG_FOOTPRINT_CHECKER::DIALOG_FOOTPRINT_CHECKER(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION(), DIALOG_GENDRILL::DIALOG_GENDRILL(), DIALOG_GET_FOOTPRINT_BY_NAME::DIALOG_GET_FOOTPRINT_BY_NAME(), DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_GLOBAL_LIB_TABLE_CONFIG::DIALOG_GLOBAL_LIB_TABLE_CONFIG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_IMAGE_PROPERTIES::DIALOG_IMAGE_PROPERTIES(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_IMPORT_SETTINGS::DIALOG_IMPORT_SETTINGS(), DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), DIALOG_LIB_NEW_SYMBOL::DIALOG_LIB_NEW_SYMBOL(), DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES(), DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES(), DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES(), DIALOG_LINE_PROPERTIES::DIALOG_LINE_PROPERTIES(), DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY(), DIALOG_MIGRATE_SETTINGS::DIALOG_MIGRATE_SETTINGS(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NET_INSPECTOR(), DIALOG_NETLIST_IMPORT::DIALOG_NETLIST_IMPORT(), DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::DIALOG_PAD_PRIMITIVE_POLY_PROPS(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PRIMITIVES_TRANSFORM::DIALOG_PAD_PRIMITIVES_TRANSFORM(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_PCM::DIALOG_PCM(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), DIALOG_PLOT::DIALOG_PLOT(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS(), DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_REGULATOR_FORM::DIALOG_REGULATOR_FORM(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES(), DIALOG_SCH_IMPORT_SETTINGS::DIALOG_SCH_IMPORT_SETTINGS(), DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES(), DIALOG_SIM_SETTINGS::DIALOG_SIM_SETTINGS(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE(), DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_UNUSED_PAD_LAYERS::DIALOG_UNUSED_PAD_LAYERS(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS(), DIALOG_WIRE_BUS_PROPERTIES::DIALOG_WIRE_BUS_PROPERTIES(), EDA_LIST_DIALOG::EDA_LIST_DIALOG(), DIALOG_CONSTRAINTS_REPORTER::FinishInitialization(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), DIALOG_FIELD_PROPERTIES::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), NETLIST_DIALOG_ADD_GENERATOR::NETLIST_DIALOG_ADD_GENERATOR(), PAGED_DIALOG::PAGED_DIALOG(), DIALOG_CLEANUP_TRACKS_AND_VIAS::setupOKButtonLabel(), WX_TEXT_ENTRY_DIALOG::WX_TEXT_ENTRY_DIALOG(), and WX_UNIT_ENTRY_DIALOG::WX_UNIT_ENTRY_DIALOG().

◆ Show()

bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 226 of file dialog_shim.cpp.

227{
228 bool ret;
229 const char* hash_key;
230
231 if( m_hash_key.size() )
232 {
233 // a special case like EDA_LIST_DIALOG, which has multiple uses.
234 hash_key = m_hash_key.c_str();
235 }
236 else
237 {
238 hash_key = typeid(*this).name();
239 }
240
241 // Show or hide the window. If hiding, save current position and size.
242 // If showing, use previous position and size.
243 if( show )
244 {
245#ifndef __WINDOWS__
246 wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
247#endif
248 ret = wxDialog::Show( show );
249
250 // classname is key, returns a zeroed out default EDA_RECT if none existed before.
251 wxRect savedDialogRect = class_map[ hash_key ];
252
253 if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
254 {
256 {
257 SetSize( savedDialogRect.GetPosition().x, savedDialogRect.GetPosition().y,
258 wxDialog::GetSize().x, wxDialog::GetSize().y, 0 );
259 }
260 else
261 {
262 SetSize( savedDialogRect.GetPosition().x, savedDialogRect.GetPosition().y,
263 std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
264 std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
265 0 );
266 }
267 }
268 else if( m_initialSize != wxDefaultSize )
269 SetSize( m_initialSize );
270
271 // Be sure that the dialog appears in a visible area
272 // (the dialog position might have been stored at the time when it was
273 // shown on another display)
274 if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
275 Centre();
276 }
277 else
278 {
279 // Save the dialog's position & size before hiding, using classname as key
280 class_map[ hash_key ] = wxRect( wxDialog::GetPosition(), wxDialog::GetSize() );
281
282#ifdef __WXMAC__
283 if ( m_eventLoop )
284 m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
285#endif
286
287 ret = wxDialog::Show( show );
288 }
289
290 return ret;
291}
bool m_useCalculatedSize
Definition: dialog_shim.h:207
wxSize m_initialSize
Definition: dialog_shim.h:225

References class_map, DIALOG_SHIM::m_hash_key, DIALOG_SHIM::m_initialSize, and DIALOG_SHIM::m_useCalculatedSize.

Referenced by FOOTPRINT_EDITOR_CONTROL::CheckFootprint(), EE_INSPECTION_TOOL::CrossProbe(), DRC_TOOL::CrossProbe(), DIALOG_SHIM::EndQuasiModal(), GROUP_TOOL::GroupProperties(), EE_INSPECTION_TOOL::NextMarker(), DRC_TOOL::NextMarker(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_DRC::OnDRCItemDClick(), DIALOG_ERC::OnERCItemDClick(), DIALOG_CLEANUP_GRAPHICS::OnLeftDClickItem(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem(), DIALOG_FOOTPRINT_CHECKER::OnLeftDClickItem(), GROUP_TOOL::PickNewMember(), EE_INSPECTION_TOOL::PrevMarker(), DRC_TOOL::PrevMarker(), CVPCB_MAINFRAME::readNetListAndFpFiles(), DIALOG_PAD_PROPERTIES::Show(), EDA_VIEW_SWITCHER::Show(), DIALOG_FIND::Show(), DRC_TOOL::ShowDRCDialog(), EE_INSPECTION_TOOL::ShowERCDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), HTML_MESSAGE_BOX::ShowModeless(), DIALOG_SHIM::ShowQuasiModal(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

◆ ShowQuasiModal()

int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 437 of file dialog_shim.cpp.

438{
439 // This is an exception safe way to zero a pointer before returning.
440 // Yes, even though DismissModal() clears this first normally, this is
441 // here in case there's an exception before the dialog is dismissed.
442 struct NULLER
443 {
444 void*& m_what;
445 NULLER( void*& aPtr ) : m_what( aPtr ) {}
446 ~NULLER() { m_what = nullptr; } // indeed, set it to NULL on destruction
447 } clear_this( (void*&) m_qmodal_loop );
448
449 // release the mouse if it's currently captured as the window having it
450 // will be disabled when this dialog is shown -- but will still keep the
451 // capture making it impossible to do anything in the modal dialog itself
452 wxWindow* win = wxWindow::GetCapture();
453 if( win )
454 win->ReleaseMouse();
455
456 // Get the optimal parent
457 wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
458
459 wxASSERT_MSG( !m_qmodal_parent_disabler, wxT( "Caller using ShowQuasiModal() twice on same "
460 "window?" ) );
461
462 // quasi-modal: disable only my "optimal" parent
464
465 // Apple in its infinite wisdom will raise a disabled window before even passing
466 // us the event, so we have no way to stop it. Instead, we must set an order on
467 // the windows so that the quasi-modal will be pushed in front of the disabled
468 // window when it is raised.
470
471 Show( true );
472
473 m_qmodal_showing = true;
474
475 WX_EVENT_LOOP event_loop;
476
477 m_qmodal_loop = &event_loop;
478
479 event_loop.Run();
480
481 m_qmodal_showing = false;
482
483 return GetReturnCode();
484}
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:46
#define WX_EVENT_LOOP
Definition: kiway_player.h:41
void ReparentQuasiModal(wxNonOwnedWindow *aWindow)
Move a window's parent to be the top-level window and force the window to be on top.
Definition: gtk/ui.cpp:65

References DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, KIPLATFORM::UI::ReparentQuasiModal(), DIALOG_SHIM::Show(), and WX_EVENT_LOOP.

Referenced by SCH_EDIT_TOOL::ChangeSymbols(), S3D::Configure3DPaths(), MICROWAVE_TOOL::createFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), SCH_DRAWING_TOOLS::createNewText(), PCB::IFACE::CreateWindow(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties(), SCH_EDIT_TOOL::editFieldText(), SCH_EDITOR_CONTROL::EditSymbolFields(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), GLOBAL_EDIT_TOOL::EditTracksAndVias(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), InvokeCopperZonesEditor(), InvokeDialogCreateBOM(), InvokeDialogEditSymbolsLibId(), InvokeDialogRescueEach(), InvokeNonCopperZonesEditor(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), SYMBOL_VIEWER_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_EDITOR_CONTROL::RemapSymbols(), S3D::Select3DModel(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), PCB_EDIT_FRAME::ShowExchangeFootprintsDialog(), PCB_EDIT_FRAME::ShowFootprintPropertiesDialog(), PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog(), PCB_BASE_FRAME::ShowPadPropertiesDialog(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), PCB_BASE_EDIT_FRAME::ShowTextBoxPropertiesDialog(), PCB_BASE_EDIT_FRAME::ShowTextPropertiesDialog(), and PCB_EDIT_FRAME::ToPlotter().

◆ updateDisplayedRowValues()

void DIALOG_NET_INSPECTOR::updateDisplayedRowValues ( const OPT< LIST_ITEM_ITER > &  aRow)
private

Definition at line 1260 of file dialog_net_inspector.cpp.

1261{
1262 if( !aRow )
1263 return;
1264
1265 wxDataViewItemArray sel;
1266 m_netsList->GetSelections( sel );
1267
1268 m_data_model->updateItem( aRow );
1269
1270 if( !sel.IsEmpty() )
1271 {
1272 m_netsList->SetSelections( sel );
1273 m_netsList->EnsureVisible( sel.Item( 0 ) );
1274 }
1275}

References m_data_model, and DIALOG_NET_INSPECTOR_BASE::m_netsList.

Referenced by OnBoardItemAdded(), OnBoardItemRemoved(), and updateNet().

◆ updateNet()

void DIALOG_NET_INSPECTOR::updateNet ( NETINFO_ITEM aNet)
private

Definition at line 1512 of file dialog_net_inspector.cpp.

1513{
1514 // something for the specified net has changed, update that row.
1515 // ignore nets that are not in our list because the filter doesn't match.
1516
1517 if( !netFilterMatches( aNet ) )
1518 {
1519 m_data_model->deleteItem( m_data_model->findItem( aNet ) );
1520 return;
1521 }
1522
1523 // if the net had no pads before, it might not be in the displayed list yet.
1524 // if it had pads and now doesn't anymore, we might need to remove it from the list.
1525
1526 OPT<LIST_ITEM_ITER> cur_net_row = m_data_model->findItem( aNet );
1527
1528 const unsigned int node_count = m_brd->GetNodesCount( aNet->GetNetCode() );
1529
1530 if( node_count == 0 && !m_cbShowZeroPad->IsChecked() )
1531 {
1532 m_data_model->deleteItem( cur_net_row );
1533 return;
1534 }
1535
1536 std::unique_ptr<LIST_ITEM> new_list_item = buildNewItem( aNet, node_count,
1538
1539 if( !cur_net_row )
1540 {
1541 m_data_model->addItem( std::move( new_list_item ) );
1542 return;
1543 }
1544
1545 const std::unique_ptr<LIST_ITEM>& cur_list_item = *cur_net_row.get();
1546
1547 if( cur_list_item->GetNetName() != new_list_item->GetNetName() )
1548 {
1549 // if the name has changed, it might require re-grouping.
1550 // it's easier to remove and re-insert it
1551 m_data_model->deleteItem( cur_net_row );
1552 m_data_model->addItem( std::move( new_list_item ) );
1553 }
1554 else
1555 {
1556 // update fields only
1557 cur_list_item->SetPadCount( new_list_item->GetPadCount() );
1558 cur_list_item->SetViaCount( new_list_item->GetViaCount() );
1559
1560 for( size_t ii = 0; ii < MAX_CU_LAYERS; ++ii )
1561 cur_list_item->SetLayerWireLength( new_list_item->GetLayerWireLength( ii ), ii );
1562
1563 cur_list_item->SetChipWireLength( new_list_item->GetChipWireLength() );
1564
1565 updateDisplayedRowValues( cur_net_row );
1566 }
1567}

References buildNewItem(), NETINFO_ITEM::GetNetCode(), BOARD::GetNodesCount(), m_brd, DIALOG_NET_INSPECTOR_BASE::m_cbShowZeroPad, m_data_model, MAX_CU_LAYERS, netFilterMatches(), relevantConnectivityItems(), and updateDisplayedRowValues().

Referenced by OnBoardItemAdded(), and OnBoardItemRemoved().

◆ vertPixelsFromDU()

int DIALOG_SHIM::vertPixelsFromDU ( int  y) const
protectedinherited

Convert an integer number of dialog units to pixels, vertically.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 183 of file dialog_shim.cpp.

184{
185 wxSize sz( 0, y );
186 return ConvertDialogToPixels( sz ).y;
187}

Referenced by DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL().

Member Data Documentation

◆ DATA_MODEL

Definition at line 126 of file dialog_net_inspector.h.

Referenced by DIALOG_NET_INSPECTOR().

◆ m_addNet

wxBitmapButton* DIALOG_NET_INSPECTOR_BASE::m_addNet
protectedinherited

◆ m_brd

◆ m_cbShowZeroPad

◆ m_columns

◆ m_data_model

◆ m_deleteNet

wxBitmapButton* DIALOG_NET_INSPECTOR_BASE::m_deleteNet
protectedinherited

◆ m_filter_change_no_rebuild

bool DIALOG_NET_INSPECTOR::m_filter_change_no_rebuild = false
private

Definition at line 118 of file dialog_net_inspector.h.

Referenced by DIALOG_NET_INSPECTOR(), and onFilterChange().

◆ m_firstPaintEvent

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 212 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

◆ m_frame

◆ m_groupBy

◆ m_groupByKind

◆ m_groupByText

wxTextCtrl* DIALOG_NET_INSPECTOR_BASE::m_groupByText
protectedinherited

◆ m_groupFilter

std::vector<std::unique_ptr<EDA_PATTERN_MATCH> > DIALOG_NET_INSPECTOR::m_groupFilter
private

◆ m_hash_key

◆ m_in_build_nets_list

bool DIALOG_NET_INSPECTOR::m_in_build_nets_list = false
private

Definition at line 117 of file dialog_net_inspector.h.

Referenced by buildNetsList(), and onSelChanged().

◆ m_initialFocusTarget

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 213 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint(), and DIALOG_SHIM::SetInitialFocus().

◆ m_initialSize

wxSize DIALOG_SHIM::m_initialSize
protectedinherited

Definition at line 225 of file dialog_shim.h.

Referenced by DIALOG_SHIM::Show().

◆ m_kiway

KIWAY* KIWAY_HOLDER::m_kiway
privateinherited

◆ m_netFilter

std::vector<std::unique_ptr<EDA_PATTERN_MATCH> > DIALOG_NET_INSPECTOR::m_netFilter
private

Definition at line 112 of file dialog_net_inspector.h.

Referenced by netFilterMatches(), and onFilterChange().

◆ m_netsList

◆ m_parentFrame

EDA_BASE_FRAME* DIALOG_SHIM::m_parentFrame
protectedinherited

◆ m_qmodal_loop

WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 215 of file dialog_shim.h.

Referenced by DIALOG_SHIM::EndQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

◆ m_qmodal_parent_disabler

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited

◆ m_qmodal_showing

bool DIALOG_SHIM::m_qmodal_showing
protectedinherited

Definition at line 217 of file dialog_shim.h.

Referenced by DIALOG_SHIM::IsQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

◆ m_renameNet

wxBitmapButton* DIALOG_NET_INSPECTOR_BASE::m_renameNet
protectedinherited

◆ m_ReportButt

wxButton* DIALOG_NET_INSPECTOR_BASE::m_ReportButt
protectedinherited

◆ m_sdbSizer

wxStdDialogButtonSizer* DIALOG_NET_INSPECTOR_BASE::m_sdbSizer
protectedinherited

◆ m_sdbSizerOK

wxButton* DIALOG_NET_INSPECTOR_BASE::m_sdbSizerOK
protectedinherited

◆ m_size

wxSize DIALOG_NET_INSPECTOR::m_size
private

Definition at line 119 of file dialog_net_inspector.h.

Referenced by onListSize().

◆ m_staticline1

wxStaticLine* DIALOG_NET_INSPECTOR_BASE::m_staticline1
protectedinherited

◆ m_staticTextFilter

wxStaticText* DIALOG_NET_INSPECTOR_BASE::m_staticTextFilter
protectedinherited

◆ m_tabOrder

◆ m_textCtrlFilter

wxTextCtrl* DIALOG_NET_INSPECTOR_BASE::m_textCtrlFilter
protectedinherited

◆ m_type

HOLDER_TYPE KIWAY_HOLDER::m_type
privateinherited

Definition at line 85 of file kiway_holder.h.

Referenced by KIWAY_HOLDER::GetType(), and SIM_PLOT_FRAME::onSimFinished().

◆ m_units

◆ m_useCalculatedSize

bool DIALOG_SHIM::m_useCalculatedSize
protectedinherited

◆ m_zero_netitem

NETINFO_ITEM* DIALOG_NET_INSPECTOR::m_zero_netitem
private

Definition at line 110 of file dialog_net_inspector.h.

Referenced by buildNetsList().


The documentation for this class was generated from the following files: