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
 
STD_BITMAP_BUTTONm_addNet
 
STD_BITMAP_BUTTONm_renameNet
 
STD_BITMAP_BUTTONm_deleteNet
 
wxButton * m_ReportButt
 
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 std::optional< 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 40 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 76 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 75 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 958 of file dialog_net_inspector.cpp.

959 :
960 DIALOG_NET_INSPECTOR_BASE( aParent ),
961 m_zero_netitem( nullptr ),
962 m_frame( aParent )
963{
964 m_columns.emplace_back( 0u, UNDEFINED_LAYER, _( "Net" ), _( "Net Code" ), CSV_COLUMN_DESC::CSV_NONE );
965 m_columns.emplace_back( 1u, UNDEFINED_LAYER, _( "Name" ), _( "Net Name" ), CSV_COLUMN_DESC::CSV_QUOTE );
966 m_columns.emplace_back( 2u, UNDEFINED_LAYER, _( "Pad Count" ), _( "Pad Count" ), CSV_COLUMN_DESC::CSV_NONE );
967 m_columns.emplace_back( 3u, UNDEFINED_LAYER, _( "Via Count" ), _( "Via Count" ), CSV_COLUMN_DESC::CSV_NONE );
968 m_columns.emplace_back( 4u, UNDEFINED_LAYER, _( "Via Length" ), _( "Via Length" ), CSV_COLUMN_DESC::CSV_NONE );
969 m_columns.emplace_back( 5u, UNDEFINED_LAYER, _( "Track Length" ), _( "Track Length" ), CSV_COLUMN_DESC::CSV_NONE );
970 m_columns.emplace_back( 6u, UNDEFINED_LAYER, _( "Die Length" ), _( "Die Length" ), CSV_COLUMN_DESC::CSV_NONE );
971 m_columns.emplace_back( 7u, UNDEFINED_LAYER, _( "Total Length" ), _( "Net Length" ), CSV_COLUMN_DESC::CSV_NONE );
972
973 m_brd = aParent->GetBoard();
974
975 m_data_model = new DATA_MODEL( *this );
976 m_netsList->AssociateModel( &*m_data_model );
977
978 std::vector<std::function<void( void )>> add_col{
979 [&]()
980 {
981 m_netsList->AppendTextColumn( m_columns[COLUMN_NET].display_name, m_columns[COLUMN_NET],
982 wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT,
983 wxDATAVIEW_COL_SORTABLE );
984 },
985 [&]()
986 {
987 m_netsList->AppendTextColumn( m_columns[COLUMN_NAME].display_name, m_columns[COLUMN_NAME],
988 wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT,
989 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_REORDERABLE |
990 wxDATAVIEW_COL_SORTABLE );
991 },
992 [&]()
993 {
994 m_netsList->AppendTextColumn( m_columns[COLUMN_PAD_COUNT].display_name, m_columns[COLUMN_PAD_COUNT],
995 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
996 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
997 },
998 [&]()
999 {
1000 m_netsList->AppendTextColumn( m_columns[COLUMN_VIA_COUNT].display_name, m_columns[COLUMN_VIA_COUNT],
1001 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1002 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1003 },
1004 [&]()
1005 {
1006 m_netsList->AppendTextColumn( m_columns[COLUMN_VIA_LENGTH].display_name, m_columns[COLUMN_VIA_LENGTH],
1007 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1008 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1009 },
1010 [&]()
1011 {
1012 m_netsList->AppendTextColumn( m_columns[COLUMN_BOARD_LENGTH].display_name, m_columns[COLUMN_BOARD_LENGTH],
1013 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1014 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1015 },
1016 [&]()
1017 {
1018 m_netsList->AppendTextColumn( m_columns[COLUMN_CHIP_LENGTH].display_name, m_columns[COLUMN_CHIP_LENGTH],
1019 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1020 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1021 },
1022 [&]()
1023 {
1024 m_netsList->AppendTextColumn( m_columns[COLUMN_TOTAL_LENGTH].display_name, m_columns[COLUMN_TOTAL_LENGTH],
1025 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1026 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1027 }
1028 };
1029
1030 std::vector<int> col_order = aSettings.column_order;
1031
1032 if( col_order.size() != add_col.size() )
1033 {
1034 col_order.resize( add_col.size() );
1035
1036 for( unsigned int i = 0; i < add_col.size(); ++i )
1037 col_order[i] = i;
1038 }
1039
1040 for( unsigned int i : col_order )
1041 add_col.at( i )();
1042
1043 for( PCB_LAYER_ID layer : m_brd->GetEnabledLayers().Seq() )
1044 {
1045 if( !IsCopperLayer( layer ) )
1046 continue;
1047
1048 m_columns.emplace_back( m_columns.size(), layer, m_brd->GetLayerName( layer ),
1050
1051 m_netsList->AppendTextColumn( m_brd->GetLayerName( layer ), m_columns.back(),
1052 wxDATAVIEW_CELL_INERT, -1, wxALIGN_CENTER,
1053 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE );
1054 }
1055
1056 m_netsList->SetExpanderColumn( m_netsList->GetColumn( 0 ) );
1057
1058 // avoid onFilterChange for each of the settings as it will re-build the
1059 // list over and over again.
1061
1062 m_textCtrlFilter->SetValue( aSettings.filter_string );
1063 m_cbShowZeroPad->SetValue( aSettings.show_zero_pad_nets );
1064 m_groupBy->SetValue( aSettings.group_by );
1065 m_groupByKind->SetSelection( aSettings.group_by_kind );
1066 m_groupByText->SetValue( aSettings.group_by_text );
1067
1069 buildNetsList();
1070
1072
1076
1078
1079 m_renameNet->Disable();
1080 m_deleteNet->Disable();
1081
1082 if( aSettings.sorting_column != -1 )
1083 {
1084 if( wxDataViewColumn* c = m_netsList->GetColumn( aSettings.sorting_column ) )
1085 {
1086 c->SetSortOrder( aSettings.sort_order_asc );
1087 m_data_model->Resort();
1088 }
1089 }
1090
1092
1093 m_frame->Connect( wxEVT_CLOSE_WINDOW,
1094 wxCommandEventHandler( DIALOG_NET_INSPECTOR::onParentWindowClosed ),
1095 nullptr, this );
1096 m_frame->Connect( UNITS_CHANGED,
1097 wxCommandEventHandler( DIALOG_NET_INSPECTOR::onUnitsChanged ),
1098 nullptr, this );
1099 m_frame->Connect( BOARD_CHANGED,
1100 wxCommandEventHandler( DIALOG_NET_INSPECTOR::onBoardChanged ),
1101 nullptr, this );
1102
1103 if( m_brd != nullptr )
1104 {
1105 // if the dialog is opened while something is highlighted on the board ...
1107
1108 m_brd->AddListener( this );
1109 }
1110}
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:565
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:2023
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:452
DIALOG_NET_INSPECTOR_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Net Inspector"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), 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
void SetBitmap(const wxBitmap &aBmp)
@ 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:825
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(), STD_BITMAP_BUTTON::SetBitmap(), 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 1113 of file dialog_net_inspector.cpp.

1114{
1115 // the displayed list elements are going to be deleted before the list view itself.
1116 // in some cases it might still do queries on the data model, which would crash
1117 // from now on. so just disassociate it.
1118 m_netsList->AssociateModel( nullptr );
1119
1120 m_frame->Disconnect( wxEVT_CLOSE_WINDOW,
1121 wxCommandEventHandler( DIALOG_NET_INSPECTOR::onParentWindowClosed ),
1122 nullptr, this );
1123 m_frame->Disconnect( UNITS_CHANGED,
1124 wxCommandEventHandler( DIALOG_NET_INSPECTOR::onUnitsChanged ),
1125 nullptr, this );
1126 m_frame->Disconnect( BOARD_CHANGED,
1127 wxCommandEventHandler( DIALOG_NET_INSPECTOR::onBoardChanged ),
1128 nullptr, this );
1129
1130 if( m_brd != nullptr )
1131 m_brd->RemoveListener( this );
1132
1134}
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
Definition: board.cpp:2030
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 1926 of file dialog_net_inspector.cpp.

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

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 1661 of file dialog_net_inspector.cpp.

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

1630{
1631 std::unique_ptr<LIST_ITEM> new_item = std::make_unique<LIST_ITEM>( aNet );
1632
1633 new_item->SetPadCount( aPadCount );
1634
1635 const auto cn_items = std::equal_range( aCNItems.begin(), aCNItems.end(), aNet->GetNetCode(),
1636 NETCODE_CMP_LESS() );
1637
1638 for( auto i = cn_items.first; i != cn_items.second; ++i )
1639 {
1640 BOARD_CONNECTED_ITEM* item = ( *i )->Parent();
1641
1642 if( item->Type() == PCB_PAD_T )
1643 new_item->AddChipWireLength( static_cast<PAD*>( item )->GetPadToDieLength() );
1644
1645 else if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
1646 {
1647 new_item->AddLayerWireLength( track->GetLength(), static_cast<int>( track->GetLayer() ) );
1648
1649 if( item->Type() == PCB_VIA_T )
1650 {
1651 new_item->AddViaCount( 1 );
1652 new_item->AddViaLength( calculateViaLength( track ) );
1653 }
1654 }
1655 }
1656
1657 return new_item;
1658}
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:97
int GetNetCode() const
Definition: netinfo.h:114
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87

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 1571 of file dialog_net_inspector.cpp.

1572{
1573 const PCB_VIA* via = dynamic_cast<const PCB_VIA*>( aTrack );
1574
1575 if( !via )
1576 return 0;
1577
1579
1580 // Must be static to keep from raising its ugly head in performance profiles
1581 static std::initializer_list<KICAD_T> traceAndPadTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_PAD_T };
1582
1583 // calculate the via length individually from the board stackup and via's start and end layer.
1584 if( bds.m_HasStackup )
1585 {
1586 PCB_LAYER_ID top_layer = UNDEFINED_LAYER;
1587 PCB_LAYER_ID bottom_layer = UNDEFINED_LAYER;
1588
1589 for( int layer = via->TopLayer(); layer <= via->BottomLayer(); ++layer )
1590 {
1591 if( m_brd->GetConnectivity()->IsConnectedOnLayer( via, layer, traceAndPadTypes ) )
1592 {
1593 if( top_layer == UNDEFINED_LAYER )
1594 top_layer = PCB_LAYER_ID( layer );
1595 else
1596 bottom_layer = PCB_LAYER_ID( layer );
1597 }
1598 }
1599
1600 if( top_layer == UNDEFINED_LAYER )
1601 top_layer = via->TopLayer();
1602 if( bottom_layer == UNDEFINED_LAYER )
1603 bottom_layer = via->BottomLayer();
1604
1605 const BOARD_STACKUP& stackup = bds.GetStackupDescriptor();
1606 return stackup.GetLayerDistance( top_layer, bottom_layer );
1607 }
1608 else
1609 {
1610 int dielectricLayers = bds.GetCopperLayerCount() - 1;
1611 // FIXME: not all dielectric layers are the same thickness!
1612 int layerThickness = bds.GetBoardThickness() / dielectricLayers;
1613 int effectiveBottomLayer;
1614
1615 if( via->BottomLayer() == B_Cu )
1616 effectiveBottomLayer = F_Cu + dielectricLayers;
1617 else
1618 effectiveBottomLayer = via->BottomLayer();
1619
1620 int layerCount = effectiveBottomLayer - via->TopLayer();
1621
1622 return layerCount * layerThickness;
1623 }
1624}
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:682
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:424
@ 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:103
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101

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 318 of file dialog_shim.cpp.

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

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 486 of file dialog_shim.cpp.

487{
488 // Hook up validator and transfer data from controls handling so quasi-modal dialogs
489 // handle validation in the same way as other dialogs.
490 if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
491 return;
492
493 SetReturnCode( retCode );
494
495 if( !IsQuasiModal() )
496 {
497 wxFAIL_MSG( wxT( "Either DIALOG_SHIM::EndQuasiModal was called twice, or ShowQuasiModal"
498 "wasn't called" ) );
499 return;
500 }
501
502 if( m_qmodal_loop )
503 {
504 if( m_qmodal_loop->IsRunning() )
505 m_qmodal_loop->Exit( 0 );
506 else
507 m_qmodal_loop->ScheduleExit( 0 );
508
509 m_qmodal_loop = nullptr;
510 }
511
513 m_qmodal_parent_disabler = nullptr;
514
515 Show( false );
516}
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(), DIALOG_EXPORT_NETLIST::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(), DIALOG_EXPORT_NETLIST::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 157 of file dialog_shim.cpp.

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

Referenced by CONVERT_SETTINGS_DIALOG::CONVERT_SETTINGS_DIALOG(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_ASSIGN_NETCLASS::DIALOG_ASSIGN_NETCLASS(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOM::DIALOG_BOM(), 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_NETLIST::DIALOG_EXPORT_NETLIST(), 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_IBIS_PARSER_REPORTER::DIALOG_IBIS_PARSER_REPORTER(), DIALOG_IMAGE_PROPERTIES::DIALOG_IMAGE_PROPERTIES(), DIALOG_IMPORT_NETLIST::DIALOG_IMPORT_NETLIST(), 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_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_PNS_SETTINGS::DIALOG_PNS_SETTINGS(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_PCBNEW::DIALOG_PRINT_PCBNEW(), 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_SIM_MODEL< T_symbol, T_field >::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_VIEW_DIALOG::NETLIST_VIEW_DIALOG(), DIALOG_SHEET_PROPERTIES::OnInitDlg(), DIALOG_SIM_COMMAND::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 1291 of file dialog_net_inspector.cpp.

1292{
1293 return wxString::Format( wxT( "%u" ), aValue );
1294}
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 1297 of file dialog_net_inspector.cpp.

1298{
1299 return m_frame->MessageTextFromValue( static_cast<long long int>( aValue ) );
1300}
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().

References m_frame, and UNITS_PROVIDER::MessageTextFromValue().

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

◆ formatNetCode()

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

Definition at line 1279 of file dialog_net_inspector.cpp.

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

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 1285 of file dialog_net_inspector.cpp.

1286{
1287 return UnescapeString( aNet->GetNetname() );
1288}
const wxString & GetNetname() const
Definition: netinfo.h:120
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 175 of file dialog_shim.cpp.

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

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(), IMPORT_PROJ_HELPER::AssociateFileWithProj(), 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(), SYMBOL_EDIT_FRAME::DdAddLibrary(), 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(), 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(), SIM_PLOT_FRAME::menuExit(), 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(), KIGFX::WX_VIEW_CONTROLS::onMotion(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), 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(), CVPCB_MAINFRAME::SendComponentSelectionToSch(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), PCB_EDIT_FRAME::SendCrossProbeItem(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), SCH_EDIT_FRAME::SendSelectItemsToPcb(), PCB_EDIT_FRAME::SendSelectItemsToSch(), 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(), EDA_BASE_FRAME::ShowPreferences(), 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 1191 of file dialog_net_inspector.cpp.

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

2000{
2001 wxString newNetName;
2002 NETNAME_VALIDATOR validator( &newNetName );
2003
2004 WX_TEXT_ENTRY_DIALOG dlg( this, _( "Net name:" ), _( "New Net" ), newNetName );
2005 dlg.SetTextValidator( validator );
2006
2007 while( true )
2008 {
2009 if( dlg.ShowModal() != wxID_OK || dlg.GetValue().IsEmpty() )
2010 return; //Aborted by user
2011
2012 newNetName = dlg.GetValue();
2013
2014 if( m_brd->FindNet( newNetName ) )
2015 {
2016 DisplayError( this, wxString::Format( _( "Net name '%s' is already in use." ),
2017 newNetName ) );
2018 newNetName = wxEmptyString;
2019 }
2020 else
2021 {
2022 break;
2023 }
2024 }
2025
2026 NETINFO_ITEM *newnet = new NETINFO_ITEM( m_brd, dlg.GetValue(), 0 );
2027
2028 m_brd->Add( newnet );
2029 m_frame->OnModify();
2030
2031 // We'll get an OnBoardItemAdded callback from this to update our listbox
2032}
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:750
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1456
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:300

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 1177 of file dialog_net_inspector.cpp.

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

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 1479 of file dialog_net_inspector.cpp.

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

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

Referenced by DIALOG_NET_INSPECTOR().

◆ OnBoardItemAdded()

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

Reimplemented from BOARD_LISTENER.

Definition at line 1303 of file dialog_net_inspector.cpp.

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

References calculateViaLength(), BOARD::GetNodesCount(), m_brd, DIALOG_NET_INSPECTOR_BASE::m_cbShowZeroPad, m_data_model, netFilterMatches(), pad, PCB_VIA_T, 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 1460 of file dialog_net_inspector.cpp.

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

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 1392 of file dialog_net_inspector.cpp.

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

References calculateViaLength(), DIALOG_NET_INSPECTOR_BASE::m_cbShowZeroPad, m_data_model, pad, PCB_VIA_T, 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 1383 of file dialog_net_inspector.cpp.

1384{
1385 for( BOARD_ITEM* item : aBoardItem )
1386 {
1387 OnBoardItemAdded( aBoard, item );
1388 }
1389}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:58
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 1471 of file dialog_net_inspector.cpp.

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

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 1450 of file dialog_net_inspector.cpp.

1452{
1453 for( BOARD_ITEM* item : aBoardItems )
1454 {
1455 OnBoardItemRemoved( aBoard, item );
1456 }
1457}
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 1506 of file dialog_net_inspector.cpp.

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

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 532 of file dialog_shim.cpp.

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

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

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

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 2131 of file dialog_net_inspector.cpp.

2132{
2133 if( !m_netsList->HasSelection() )
2134 return;
2135
2136 wxDataViewItemArray sel;
2137 m_netsList->GetSelections( sel );
2138
2139 auto delete_one =
2140 [this]( const LIST_ITEM* i )
2141 {
2142 if( i->GetPadCount() == 0
2143 || IsOK( this, wxString::Format( _( "Net '%s' is in use. Delete anyway?" ),
2144 i->GetNetName() ) ) )
2145 {
2146 // This is a bit hacky, but it will do for now, since this is the only path
2147 // outside the netlist updater where you can remove a net from a BOARD.
2148 int removedCode = i->GetNetCode();
2149
2151 [removedCode]( KIGFX::VIEW_ITEM* aItem ) -> int
2152 {
2153 auto boardItem = dynamic_cast<BOARD_CONNECTED_ITEM*>( aItem );
2154
2155 if( boardItem && boardItem->GetNetCode() == removedCode )
2156 return KIGFX::REPAINT;
2157
2158 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
2159
2160 if( text && text->HasTextVars() )
2161 {
2162 text->ClearRenderCache();
2163 text->ClearBoundingBoxCache();
2165 }
2166
2167 return 0;
2168 } );
2169
2170 m_brd->Remove( i->GetNet() );
2171 m_frame->OnModify();
2172
2173 // We'll get an OnBoardItemRemoved callback from this to update our listbox
2174 }
2175 };
2176
2177 for( unsigned int i = 0; i < sel.GetCount(); ++i )
2178 {
2179 const LIST_ITEM* ii = static_cast<const LIST_ITEM*>( sel.Item( i ).GetID() );
2180
2181 if( ii->GetIsGroup() )
2182 {
2183 if( ii->ChildrenCount() != 0
2184 && IsOK( this, wxString::Format( _( "Delete all nets in group '%s'?" ),
2185 ii->GetGroupName() ) ) )
2186 {
2187 // we can't be iterating the children container and deleting items from
2188 // it at the same time. thus take a copy of it first.
2189 std::vector<const LIST_ITEM*> children;
2190 children.reserve( ii->ChildrenCount() );
2191 std::copy( ii->ChildrenBegin(), ii->ChildrenEnd(), std::back_inserter( children ) );
2192
2193 for( const LIST_ITEM* c : children )
2194 delete_one( c );
2195 }
2196 }
2197 else
2198 {
2199 delete_one( ii );
2200 }
2201 }
2202}
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: board.cpp:859
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
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:1494
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:380
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:52
@ GEOMETRY
Position or shape has changed.
Definition: view_item.h:49

References _, DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenBegin(), DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenCount(), DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenEnd(), Format(), KIGFX::GEOMETRY, 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, text, and KIGFX::VIEW::UpdateAllItemsConditionally().

◆ onFilterChange()

void DIALOG_NET_INSPECTOR::onFilterChange ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_NET_INSPECTOR_BASE.

Definition at line 1805 of file dialog_net_inspector.cpp.

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

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 641 of file dialog_shim.cpp.

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

◆ OnGridEditorShown()

void DIALOG_SHIM::OnGridEditorShown ( wxGridEvent &  event)
privateinherited

Definition at line 634 of file dialog_shim.cpp.

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

◆ onListSize()

void DIALOG_NET_INSPECTOR::onListSize ( wxSizeEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_NET_INSPECTOR_BASE.

Definition at line 1985 of file dialog_net_inspector.cpp.

1986{
1987 auto new_size = aEvent.GetSize();
1988
1989 if( new_size != m_size )
1990 {
1991 m_size = new_size;
1993 }
1994
1995 aEvent.Skip();
1996}

References adjustListColumns(), and m_size.

◆ OnModify()

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 386 of file dialog_shim.cpp.

387{
389 {
391
392 selectAllInTextCtrls( GetChildren() );
393
396 else
397 KIPLATFORM::UI::ForceFocus( this ); // Focus the dialog itself
398
399 m_firstPaintEvent = false;
400 }
401
402 event.Skip();
403}
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 1160 of file dialog_net_inspector.cpp.

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

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 2035 of file dialog_net_inspector.cpp.

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

2206{
2207 wxFileDialog dlg( this, _( "Report file" ), "", "",
2208 _( "Report file" ) + AddFileExtListToFilter( { "csv" } ),
2209 wxFD_SAVE );
2210
2211 if( dlg.ShowModal() == wxID_CANCEL )
2212 return;
2213
2214 wxTextFile f( dlg.GetPath() );
2215
2216 f.Create();
2217
2218 wxString txt;
2219
2220 // Print Header:
2221 for( auto&& col : m_columns )
2222 txt += '"' + col.csv_name + wxT( "\";" );
2223
2224 f.AddLine( txt );
2225
2226 // Print list of nets:
2227 const unsigned int num_rows = m_data_model->itemCount();
2228
2229 for( unsigned int row = 0; row < num_rows; row++ )
2230 {
2231 auto& i = m_data_model->itemAt( row );
2232
2233 if( i.GetIsGroup() || i.GetNetCode() == 0 )
2234 continue;
2235
2236 txt = "";
2237
2238 for( auto&& col : m_columns )
2239 {
2240 if( static_cast<int>( col.csv_flags ) & static_cast<int>( CSV_COLUMN_DESC::CSV_QUOTE ) )
2241 txt += '"' + m_data_model->valueAt( col.num, row ).GetString() + wxT( "\";" );
2242 else
2243 txt += m_data_model->valueAt( col.num, row ).GetString() + ';';
2244 }
2245
2246 f.AddLine( txt );
2247 }
2248
2249 f.Write();
2250 f.Close();
2251}
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 1864 of file dialog_net_inspector.cpp.

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

References DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenBegin(), DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenEnd(), STD_BITMAP_BUTTON::Enable(), 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 1858 of file dialog_net_inspector.cpp.

1859{
1860 onSelChanged();
1861}

References onSelChanged().

◆ onSortingChanged()

void DIALOG_NET_INSPECTOR::onSortingChanged ( wxDataViewEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_NET_INSPECTOR_BASE.

Definition at line 1911 of file dialog_net_inspector.cpp.

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

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 1167 of file dialog_net_inspector.cpp.

1168{
1169 this->m_units = m_frame->GetUserUnits();
1170
1171 m_data_model->updateAllItems();
1172
1173 event.Skip();
1174}
EDA_UNITS GetUserUnits() const

References UNITS_PROVIDER::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(), PCB_BASE_FRAME::canCloseWindow(), SIM_PLOT_FRAME::canCloseWindow(), PANEL_FP_PROPERTIES_3D_MODEL::Cfg3DPath(), SYMBOL_VIEWER_FRAME::ClickOnLibList(), KICAD_MANAGER_FRAME::CloseProject(), PCB_BASE_EDIT_FRAME::createNewLibrary(), PCB_BASE_EDIT_FRAME::CreateNewProjectLibrary(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), SCH_EDIT_FRAME::CreateScreens(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_ASSIGN_NETCLASS::DIALOG_ASSIGN_NETCLASS(), 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_IBIS_PARSER_REPORTER::DIALOG_IBIS_PARSER_REPORTER(), DIALOG_IMPORT_NETLIST::DIALOG_IMPORT_NETLIST(), DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES(), 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_NAVIGATE_TOOL::HypertextCommand(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), DIALOG_CONFIG_EQUFILES::Init(), FIELDS_GRID_TABLE< T >::initGrid(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), SYMBOL_EDIT_FRAME::KiwayMailIn(), FOOTPRINT_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), SYMBOL_VIEWER_FRAME::loadAllLibraries(), 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::LoadSymbol(), 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_IMPORT_NETLIST::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_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_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::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(), DIALOG_PAGES_SETTINGS::OnWksFileSelection(), 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(), LIB_TREE_MODEL_ADAPTER::PinLibrary(), DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector(), SCH_EDITOR_CONTROL::Print(), EDA_DRAW_FRAME::PrintDrawingSheet(), SCH_EDIT_FRAME::PrintPage(), KICAD_MANAGER_FRAME::PrintPrjInfo(), CVPCB_MAINFRAME::readNetListAndFpFiles(), APPEARANCE_CONTROLS::rebuildNets(), 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(), SCH_EDIT_FRAME::SaveProjectSettings(), 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(), SCH_BASE_FRAME::SelectLibraryFromList(), PCB_BASE_EDIT_FRAME::selectLibTable(), SCH_BASE_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(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_SYMBOL::ShowFootprintFor(), COMMON_CONTROL::ShowHelp(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SYMBOL_VIEWER_FRAME::ShowModal(), APPEARANCE_CONTROLS::showNetclass(), 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(), DIALOG_EXPORT_NETLIST::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), DIALOG_ASSIGN_NETCLASS::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataToWindow(), SYMBOL_EDITOR_CONTROL::UnpinLibrary(), FOOTPRINT_EDITOR_CONTROL::UnpinLibrary(), LIB_TREE_MODEL_ADAPTER::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(), SIM_PLOT_FRAME::UpdateTunerValue(), 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 1234 of file dialog_net_inspector.cpp.

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

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

197{
198 wxDialog::SetPosition( aNewPosition );
199
200 // Now update the stored position:
201 const char* hash_key;
202
203 if( m_hash_key.size() )
204 {
205 // a special case like EDA_LIST_DIALOG, which has multiple uses.
206 hash_key = m_hash_key.c_str();
207 }
208 else
209 {
210 hash_key = typeid(*this).name();
211 }
212
213 std::unordered_map<std::string, wxRect>::iterator it = class_map.find( hash_key );
214
215 if( it == class_map.end() )
216 return;
217
218 wxRect rect = it->second;
219 rect.SetPosition( aNewPosition );
220
221 class_map[ hash_key ] = rect;
222}
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 168 of file dialog_shim.cpp.

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

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

◆ Settings()

DIALOG_NET_INSPECTOR::SETTINGS DIALOG_NET_INSPECTOR::Settings ( ) const

Definition at line 1137 of file dialog_net_inspector.cpp.

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

References DIALOG_NET_INSPECTOR::SETTINGS::column_order, DIALOG_NET_INSPECTOR::SETTINGS::filter_string, DIALOG_NET_INSPECTOR::SETTINGS::group_by, DIALOG_NET_INSPECTOR::SETTINGS::group_by_kind, DIALOG_NET_INSPECTOR::SETTINGS::group_by_text, 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, DIALOG_NET_INSPECTOR::SETTINGS::show_zero_pad_nets, DIALOG_NET_INSPECTOR::SETTINGS::sort_order_asc, and DIALOG_NET_INSPECTOR::SETTINGS::sorting_column.

◆ SetupStandardButtons()

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

Definition at line 708 of file dialog_shim.cpp.

709{
710 recursiveDescent( GetSizer(), aLabels );
711}
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_ASSIGN_NETCLASS::DIALOG_ASSIGN_NETCLASS(), DIALOG_BOM::DIALOG_BOM(), 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_NETLIST::DIALOG_EXPORT_NETLIST(), 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_IBIS_PARSER_REPORTER::DIALOG_IBIS_PARSER_REPORTER(), DIALOG_IMAGE_PROPERTIES::DIALOG_IMAGE_PROPERTIES(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_IMPORT_NETLIST::DIALOG_IMPORT_NETLIST(), 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_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_PNS_SETTINGS::DIALOG_PNS_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_COMMAND::DIALOG_SIM_COMMAND(), 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(), EDA_REORDERABLE_LIST_DIALOG::EDA_REORDERABLE_LIST_DIALOG(), DIALOG_CONSTRAINTS_REPORTER::FinishInitialization(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), DIALOG_FIELD_PROPERTIES::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), 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 225 of file dialog_shim.cpp.

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

437{
438 // This is an exception safe way to zero a pointer before returning.
439 // Yes, even though DismissModal() clears this first normally, this is
440 // here in case there's an exception before the dialog is dismissed.
441 struct NULLER
442 {
443 void*& m_what;
444 NULLER( void*& aPtr ) : m_what( aPtr ) {}
445 ~NULLER() { m_what = nullptr; } // indeed, set it to NULL on destruction
446 } clear_this( (void*&) m_qmodal_loop );
447
448 // release the mouse if it's currently captured as the window having it
449 // will be disabled when this dialog is shown -- but will still keep the
450 // capture making it impossible to do anything in the modal dialog itself
451 wxWindow* win = wxWindow::GetCapture();
452 if( win )
453 win->ReleaseMouse();
454
455 // Get the optimal parent
456 wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
457
458 wxASSERT_MSG( !m_qmodal_parent_disabler, wxT( "Caller using ShowQuasiModal() twice on same "
459 "window?" ) );
460
461 // quasi-modal: disable only my "optimal" parent
463
464 // Apple in its infinite wisdom will raise a disabled window before even passing
465 // us the event, so we have no way to stop it. Instead, we must set an order on
466 // the windows so that the quasi-modal will be pushed in front of the disabled
467 // window when it is raised.
469
470 Show( true );
471
472 m_qmodal_showing = true;
473
474 WX_EVENT_LOOP event_loop;
475
476 m_qmodal_loop = &event_loop;
477
478 event_loop.Run();
479
480 m_qmodal_showing = false;
481
482 return GetReturnCode();
483}
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(), PCB::IFACE::CreateKiWindow(), MICROWAVE_TOOL::createMicrowaveInductor(), SCH_DRAWING_TOOLS::createNewText(), 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_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 std::optional< LIST_ITEM_ITER > &  aRow)
private

Definition at line 1261 of file dialog_net_inspector.cpp.

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

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 1513 of file dialog_net_inspector.cpp.

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

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 182 of file dialog_shim.cpp.

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

Referenced by DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL().

Member Data Documentation

◆ DATA_MODEL

Definition at line 129 of file dialog_net_inspector.h.

Referenced by DIALOG_NET_INSPECTOR().

◆ m_addNet

◆ m_brd

◆ m_cbShowZeroPad

◆ m_columns

◆ m_data_model

◆ m_deleteNet

◆ m_filter_change_no_rebuild

bool DIALOG_NET_INSPECTOR::m_filter_change_no_rebuild = false
private

Definition at line 121 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 120 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 115 of file dialog_net_inspector.h.

Referenced by netFilterMatches(), and onFilterChange().

◆ m_netsList

◆ m_parentFrame

◆ 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

◆ m_ReportButt

wxButton* DIALOG_NET_INSPECTOR_BASE::m_ReportButt
protectedinherited

◆ m_size

wxSize DIALOG_NET_INSPECTOR::m_size
private

Definition at line 122 of file dialog_net_inspector.h.

Referenced by onListSize().

◆ 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 113 of file dialog_net_inspector.h.

Referenced by buildNetsList().


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