KiCad PCB EDA Suite
DIALOG_SELECT_NET_FROM_LIST Class Reference

#include <dialog_select_net_from_list.h>

Inheritance diagram for DIALOG_SELECT_NET_FROM_LIST:
DIALOG_SELECT_NET_FROM_LIST_BASE BOARD_LISTENER DIALOG_SHIM KIWAY_HOLDER

Classes

struct  COLUMN_ID
 
struct  LIST_ITEM
 
struct  LIST_ITEM_NET_CMP_LESS
 
struct  ROW_DESC
 
struct  SETTINGS
 

Public Types

enum  HOLDER_TYPE { DIALOG, FRAME, PANEL }
 

Public Member Functions

 DIALOG_SELECT_NET_FROM_LIST (PCB_EDIT_FRAME *aParent, const SETTINGS &aSettings)
 
 ~DIALOG_SELECT_NET_FROM_LIST ()
 
SETTINGS Settings () const
 
bool GetNetName (wxString &aName) const
 
void HighlightNet (NETINFO_ITEM *aNet)
 Visually highlights a net in the list view. More...
 
virtual void OnBoardItemAdded (BOARD &aBoard, BOARD_ITEM *aBoardItem) override
 
virtual void OnBoardItemRemoved (BOARD &aBoard, BOARD_ITEM *aBoardItem) override
 
virtual void OnBoardNetSettingsChanged (BOARD &aBoard) override
 
virtual void OnBoardItemChanged (BOARD &aBoard, BOARD_ITEM *aBoardItem) 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 ()
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
EDA_UNITS GetUserUnits () const
 
HOLDER_TYPE GetType ()
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Static Public Member Functions

static bool IsCtrl (int aChar, const wxKeyEvent &e)
 
static bool IsShiftCtrl (int aChar, const wxKeyEvent &e)
 
static void FixOSXCancelButtonIssue (wxWindow *aWindow)
 

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)
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int VertPixelsFromDU (int y)
 Convert an integer number of dialog units to pixels, vertically. More...
 
void ResetSize ()
 Clear the existing dialog size and position. More...
 

Protected Attributes

wxStaticText * m_staticTextFilter
 
wxTextCtrl * m_textCtrlFilter
 
wxCheckBox * m_cbShowZeroPad
 
wxDataViewListCtrl * m_netsList
 
wxBitmapButton * m_addNet
 
wxBitmapButton * m_renameNet
 
wxBitmapButton * m_deleteNet
 
wxButton * m_ReportButt
 
wxStaticLine * m_staticline1
 
wxStdDialogButtonSizer * m_sdbSizer
 
wxButton * m_sdbSizerOK
 
wxButton * m_sdbSizerCancel
 
EDA_UNITS m_units
 
std::string m_hash_key
 
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
 

Private Member Functions

ROW_DESC findRow (NETINFO_ITEM *aNet)
 
ROW_DESC findRow (int aNetCode)
 
void deleteRow (const ROW_DESC &aRow)
 
void setValue (const ROW_DESC &aRow, const COLUMN_ID &aCol, wxString aVal)
 
wxString formatNetCode (const NETINFO_ITEM *aNet) const
 
wxString formatNetName (const NETINFO_ITEM *aNet) const
 
wxString formatCount (unsigned int aValue) const
 
wxString formatLength (int aValue) const
 
std::vector< CN_ITEM * > relevantConnectivityItems () const
 
bool netFilterMatches (NETINFO_ITEM *aNet) const
 
void updateNet (NETINFO_ITEM *aNet)
 
void highlightNetOnBoard (NETINFO_ITEM *aNet) const
 
void onSelChanged (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
 
void buildNetsList ()
 
void adjustListColumns ()
 
void onParentWindowClosed (wxCommandEvent &event)
 
void onUnitsChanged (wxCommandEvent &event)
 
void onBoardChanged (wxCommandEvent &event)
 

Private Attributes

std::vector< LIST_ITEMm_list_items
 
std::vector< unsigned int > m_list_items_by_net
 
EDA_PATTERN_MATCH_WILDCARD m_netFilter
 
wxString m_selection
 
bool m_wasSelected
 
BOARDm_brd
 
PCB_EDIT_FRAMEm_frame
 

Static Private Attributes

static const COLUMN_ID COLUMN_NET
 
static const COLUMN_ID COLUMN_NAME
 
static const COLUMN_ID COLUMN_PAD_COUNT
 
static const COLUMN_ID COLUMN_VIA_COUNT
 
static const COLUMN_ID COLUMN_BOARD_LENGTH
 
static const COLUMN_ID COLUMN_CHIP_LENGTH
 
static const COLUMN_ID COLUMN_TOTAL_LENGTH
 

Detailed Description

Definition at line 36 of file dialog_select_net_from_list.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 

Definition at line 42 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ DIALOG_SELECT_NET_FROM_LIST()

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

Definition at line 124 of file dialog_select_net_from_list.cpp.

125  :
127  m_frame( aParent )
128 {
129  m_brd = aParent->GetBoard();
130  m_wasSelected = false;
131 
132 #define ADD_COL( name, flag, align ) m_netsList->AppendTextColumn( name, flag, 0, align, 0 );
133 
134  ADD_COL( COLUMN_NET.display_name, wxDATAVIEW_CELL_INERT, wxALIGN_LEFT );
135  ADD_COL( COLUMN_NAME.display_name, wxDATAVIEW_CELL_INERT, wxALIGN_LEFT );
136  ADD_COL( COLUMN_PAD_COUNT.display_name, wxDATAVIEW_CELL_INERT, wxALIGN_CENTER );
137  ADD_COL( COLUMN_VIA_COUNT.display_name, wxDATAVIEW_CELL_INERT, wxALIGN_CENTER );
138  ADD_COL( COLUMN_BOARD_LENGTH.display_name, wxDATAVIEW_CELL_INERT, wxALIGN_CENTER );
139  ADD_COL( COLUMN_CHIP_LENGTH.display_name, wxDATAVIEW_CELL_INERT, wxALIGN_CENTER );
140  ADD_COL( COLUMN_TOTAL_LENGTH.display_name, wxDATAVIEW_CELL_INERT, wxALIGN_CENTER );
141 
142  // The fact that we're a list should keep the control from reserving space for the
143  // expander buttons... but it doesn't. Fix by forcing the indent to 0.
144  m_netsList->SetIndent( 0 );
145 
146  m_textCtrlFilter->SetValue( aSettings.filter_string );
147  m_cbShowZeroPad->SetValue( aSettings.show_zero_pad_nets );
148 
149  buildNetsList();
150 
152 
153  m_addNet->SetBitmap( KiBitmap( small_plus_xpm ) );
154  m_renameNet->SetBitmap( KiBitmap( small_edit_xpm ) );
155  m_deleteNet->SetBitmap( KiBitmap( trash_xpm ) );
156 
157  m_sdbSizerOK->SetDefault();
158 
160 
161 #define connect_event( e, f ) \
162  m_frame->Connect( e, wxCommandEventHandler( DIALOG_SELECT_NET_FROM_LIST::f ), nullptr, this )
163 
164  connect_event( wxEVT_CLOSE_WINDOW, onParentWindowClosed );
165  connect_event( UNITS_CHANGED, onUnitsChanged );
166  connect_event( BOARD_CHANGED, onBoardChanged );
167 
168 #undef connect_event
169 
170  if( m_brd != nullptr )
171  m_brd->AddListener( this );
172 }
#define connect_event(e, f)
const BITMAP_OPAQUE trash_xpm[1]
Definition: trash.cpp:46
void AddListener(BOARD_LISTENER *aListener)
Add a listener to the board to receive calls whenever something on the board has been modified.
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
DIALOG_SELECT_NET_FROM_LIST_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)
static const COLUMN_ID COLUMN_BOARD_LENGTH
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
void onBoardChanged(wxCommandEvent &event)
void onParentWindowClosed(wxCommandEvent &event)
static const COLUMN_ID COLUMN_TOTAL_LENGTH
#define ADD_COL(name, flag, align)
const BITMAP_OPAQUE small_edit_xpm[1]
Definition: small_edit.cpp:26
BOARD * GetBoard() const
void onUnitsChanged(wxCommandEvent &event)
static const COLUMN_ID COLUMN_CHIP_LENGTH
const BITMAP_OPAQUE small_plus_xpm[1]
Definition: small_plus.cpp:20

References ADD_COL, BOARD::AddListener(), adjustListColumns(), buildNetsList(), COLUMN_BOARD_LENGTH, COLUMN_CHIP_LENGTH, COLUMN_NAME, COLUMN_NET, COLUMN_PAD_COUNT, COLUMN_TOTAL_LENGTH, COLUMN_VIA_COUNT, connect_event, DIALOG_SELECT_NET_FROM_LIST::COLUMN_ID::display_name, DIALOG_SELECT_NET_FROM_LIST::SETTINGS::filter_string, DIALOG_SHIM::FinishDialogSettings(), PCB_BASE_FRAME::GetBoard(), KiBitmap(), DIALOG_SELECT_NET_FROM_LIST_BASE::m_addNet, m_brd, DIALOG_SELECT_NET_FROM_LIST_BASE::m_cbShowZeroPad, DIALOG_SELECT_NET_FROM_LIST_BASE::m_deleteNet, DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList, DIALOG_SELECT_NET_FROM_LIST_BASE::m_renameNet, DIALOG_SELECT_NET_FROM_LIST_BASE::m_sdbSizerOK, DIALOG_SELECT_NET_FROM_LIST_BASE::m_textCtrlFilter, m_wasSelected, onBoardChanged(), onParentWindowClosed(), onUnitsChanged(), DIALOG_SELECT_NET_FROM_LIST::SETTINGS::show_zero_pad_nets, small_edit_xpm, small_plus_xpm, and trash_xpm.

◆ ~DIALOG_SELECT_NET_FROM_LIST()

DIALOG_SELECT_NET_FROM_LIST::~DIALOG_SELECT_NET_FROM_LIST ( )

Definition at line 175 of file dialog_select_net_from_list.cpp.

176 {
177 #define disconnect_event( e, f ) \
178  m_frame->Disconnect( e, wxCommandEventHandler( DIALOG_SELECT_NET_FROM_LIST::f ), nullptr, this )
179 
180  disconnect_event( wxEVT_CLOSE_WINDOW, onParentWindowClosed );
181  disconnect_event( UNITS_CHANGED, onUnitsChanged );
182  disconnect_event( BOARD_CHANGED, onBoardChanged );
183 
184 #undef disconnect_event
185 
186  if( m_brd != nullptr )
187  m_brd->RemoveListener( this );
188 }
void onBoardChanged(wxCommandEvent &event)
void onParentWindowClosed(wxCommandEvent &event)
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
#define disconnect_event(e, f)
void onUnitsChanged(wxCommandEvent &event)

References disconnect_event, m_brd, onBoardChanged(), onParentWindowClosed(), onUnitsChanged(), and BOARD::RemoveListener().

Member Function Documentation

◆ adjustListColumns()

void DIALOG_SELECT_NET_FROM_LIST::adjustListColumns ( )
private

Calculating optimal width of the first (Net) and the last (Pad Count) columns. That width must be enough to fit column header label and be not less than width of four chars (0000).

Definition at line 768 of file dialog_select_net_from_list.cpp.

769 {
770  int w0, w1, w2, w3, w4, w5, w6;
771 
778  wxClientDC dc( GetParent() );
779  int h, minw, minw_col0;
780 
781  dc.GetTextExtent( COLUMN_NET.display_name + "MM", &w0, &h );
782  dc.GetTextExtent( COLUMN_PAD_COUNT.display_name + "MM", &w2, &h );
783  dc.GetTextExtent( COLUMN_VIA_COUNT.display_name + "MM", &w3, &h );
784  dc.GetTextExtent( COLUMN_BOARD_LENGTH.display_name + "MM", &w4, &h );
785  dc.GetTextExtent( COLUMN_CHIP_LENGTH.display_name + "MM", &w5, &h );
786  dc.GetTextExtent( COLUMN_TOTAL_LENGTH.display_name + "MM", &w6, &h );
787  dc.GetTextExtent( "M00000,000 mmM", &minw, &h );
788  dc.GetTextExtent( "M00000M", &minw_col0, &h );
789 
790  // Considering left and right margins.
791  // For wxRenderGeneric it is 5px.
792  m_netsList->GetColumn( 0 )->SetWidth( std::max( w0 + 10, minw_col0 ) );
793  m_netsList->GetColumn( 2 )->SetWidth( w2 + 10 );
794  m_netsList->GetColumn( 3 )->SetWidth( w3 + 10 );
795  m_netsList->GetColumn( 4 )->SetWidth( std::max( w4 + 10, minw ) );
796  m_netsList->GetColumn( 5 )->SetWidth( std::max( w5 + 10, minw ) );
797  m_netsList->GetColumn( 6 )->SetWidth( std::max( w6 + 10, minw ) );
798 
799  // At resizing of the list the width of middle column (Net Names) changes only.
800  int width = m_netsList->GetClientSize().x;
801  w1 = width - w0 - w2 - w3 - w4 - w5 - w6;
802 
803  // Column 1 (net names) need a minimal width to display net names
804  dc.GetTextExtent( "MMMMMMMMMMMMMMMMMM", &minw, &h );
805  w1 = std::max( w1, minw );
806 
807  m_netsList->GetColumn( 1 )->SetWidth( w1 );
808 
809  m_netsList->Refresh();
810 }
static const COLUMN_ID COLUMN_BOARD_LENGTH
static const COLUMN_ID COLUMN_TOTAL_LENGTH
static const COLUMN_ID COLUMN_CHIP_LENGTH

References COLUMN_BOARD_LENGTH, COLUMN_CHIP_LENGTH, COLUMN_NET, COLUMN_PAD_COUNT, COLUMN_TOTAL_LENGTH, COLUMN_VIA_COUNT, DIALOG_SELECT_NET_FROM_LIST::COLUMN_ID::display_name, and DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList.

Referenced by DIALOG_SELECT_NET_FROM_LIST(), and onListSize().

◆ buildNetsList()

void DIALOG_SELECT_NET_FROM_LIST::buildNetsList ( )
private

Definition at line 579 of file dialog_select_net_from_list.cpp.

580 {
581  // when rebuilding the netlist, try to keep the row selection
582  const int prev_selected_row = m_netsList->GetSelectedRow();
583  const int prev_selected_netcode =
584  prev_selected_row >= 0 ? m_list_items[prev_selected_row].m_net->GetNet() : -1;
585 
586  m_netsList->DeleteAllItems();
587  m_list_items.clear();
588 
589  std::vector<CN_ITEM*> prefiltered_cn_items = relevantConnectivityItems();
590 
591  // collect all nets which pass the filter string.
592 
593  struct NET_INFO
594  {
595  int netcode;
596  NETINFO_ITEM* net;
597  unsigned int pad_count;
598  };
599 
600  struct NET_INFO_CMP_LESS
601  {
602  bool operator()( const NET_INFO& a, const NET_INFO& b ) const
603  {
604  return a.netcode < b.netcode;
605  }
606  bool operator()( const NET_INFO& a, int b ) const
607  {
608  return a.netcode < b;
609  }
610  bool operator()( int a, const NET_INFO& b ) const
611  {
612  return a < b.netcode;
613  }
614  };
615 
616  std::vector<NET_INFO> nets;
617  nets.reserve( m_brd->GetNetInfo().NetsByNetcode().size() );
618 
619  for( const std::pair<const int, NETINFO_ITEM*>& ni : m_brd->GetNetInfo().NetsByNetcode() )
620  {
621  if( netFilterMatches( ni.second ) )
622  nets.emplace_back( NET_INFO{ ni.first, ni.second, 0 } );
623  }
624 
625  // count the pads for each net. since the nets are sorted by netcode
626  // this way around is faster than using counting pads for each net.
627 
628  for( MODULE* mod : m_brd->Modules() )
629  {
630  for( D_PAD* pad : mod->Pads() )
631  {
632  auto i = std::lower_bound( nets.begin(), nets.end(), pad->GetNetCode(),
633  NET_INFO_CMP_LESS() );
634 
635  if( i != nets.end() && i->netcode == pad->GetNetCode() )
636  i->pad_count += 1;
637  }
638  }
639 
640  for( NET_INFO& ni : nets )
641  {
642  if( !m_cbShowZeroPad->IsChecked() && ni.pad_count == 0 )
643  continue;
644 
645  m_list_items.emplace_back( ni.net );
646  LIST_ITEM& list_item = m_list_items.back();
647 
648  const auto cn_items = std::equal_range( prefiltered_cn_items.begin(),
649  prefiltered_cn_items.end(), ni.netcode, NETCODE_CMP_LESS() );
650 
651  for( auto i = cn_items.first; i != cn_items.second; ++i )
652  {
653  BOARD_CONNECTED_ITEM* item = ( *i )->Parent();
654 
655  if( item->Type() == PCB_PAD_T )
656  list_item.m_chip_wire_length += static_cast<D_PAD*>( item )->GetPadToDieLength();
657 
658  else if( TRACK* track = dynamic_cast<TRACK*>( item ) )
659  {
660  list_item.m_board_wire_length += track->GetLength();
661 
662  if( track->Type() == PCB_VIA_T )
663  list_item.m_via_count += 1;
664  }
665  }
666 
667  list_item.m_pad_count = ni.pad_count;
668  list_item.m_total_length = list_item.m_board_wire_length + list_item.m_chip_wire_length;
669  }
670 
671  wxVector<wxVariant> dataLine;
672  dataLine.resize( 7 );
673 
674  for( LIST_ITEM& i : m_list_items )
675  {
676  dataLine[COLUMN_NET] = formatNetCode( i.m_net );
677  dataLine[COLUMN_NAME] = formatNetName( i.m_net );
678  dataLine[COLUMN_PAD_COUNT] = formatCount( i.m_pad_count );
679  dataLine[COLUMN_VIA_COUNT] = formatCount( i.m_via_count );
680  dataLine[COLUMN_BOARD_LENGTH] = formatLength( i.m_board_wire_length );
681  dataLine[COLUMN_CHIP_LENGTH] = formatLength( i.m_chip_wire_length );
682  dataLine[COLUMN_TOTAL_LENGTH] = formatLength( i.m_total_length );
683 
684  m_netsList->AppendItem( dataLine );
685  }
686 
687  m_list_items_by_net.clear();
688  m_list_items_by_net.reserve( m_list_items.size() );
689 
690  for( unsigned int i = 0; i < m_list_items.size(); ++i )
691  m_list_items_by_net.push_back( i );
692 
693  std::sort( m_list_items_by_net.begin(), m_list_items_by_net.end(),
694  LIST_ITEM_NET_CMP_LESS( m_list_items ) );
695 
696  if( prev_selected_netcode == -1 )
697  m_wasSelected = false;
698  else
699  {
700  const ROW_DESC& r = findRow( prev_selected_netcode );
701 
702  if( r )
703  {
704  m_selection = r.by_row->m_net->GetNetname();
705  m_wasSelected = true;
706 
707  wxDataViewItem i = m_netsList->RowToItem( r.row_num );
708  m_netsList->Select( i );
709  m_netsList->EnsureVisible( i );
710  }
711  }
712 }
const NETCODES_MAP & NetsByNetcode() const
Return the netcode map, at least for python.
Definition: netinfo.h:472
std::vector< unsigned int > m_list_items_by_net
const NETINFO_LIST & GetNetInfo() const
Definition: class_board.h:739
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
static const COLUMN_ID COLUMN_BOARD_LENGTH
wxString formatCount(unsigned int aValue) const
std::vector< CN_ITEM * > relevantConnectivityItems() const
wxString formatNetName(const NETINFO_ITEM *aNet) const
MODULES & Modules()
Definition: class_board.h:266
wxString formatNetCode(const NETINFO_ITEM *aNet) const
bool netFilterMatches(NETINFO_ITEM *aNet) const
wxString formatLength(int aValue) const
static const COLUMN_ID COLUMN_TOTAL_LENGTH
ROW_DESC findRow(NETINFO_ITEM *aNet)
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
static const COLUMN_ID COLUMN_CHIP_LENGTH
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References DIALOG_SELECT_NET_FROM_LIST::ROW_DESC::by_row, COLUMN_BOARD_LENGTH, COLUMN_CHIP_LENGTH, COLUMN_NAME, COLUMN_NET, COLUMN_PAD_COUNT, COLUMN_TOTAL_LENGTH, COLUMN_VIA_COUNT, findRow(), formatCount(), formatLength(), formatNetCode(), formatNetName(), BOARD::GetNetInfo(), DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM::m_board_wire_length, m_brd, DIALOG_SELECT_NET_FROM_LIST_BASE::m_cbShowZeroPad, DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM::m_chip_wire_length, m_list_items, m_list_items_by_net, DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList, DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM::m_pad_count, m_selection, DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM::m_total_length, DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM::m_via_count, m_wasSelected, BOARD::Modules(), netFilterMatches(), NETINFO_LIST::NetsByNetcode(), PCB_PAD_T, PCB_VIA_T, relevantConnectivityItems(), DIALOG_SELECT_NET_FROM_LIST::ROW_DESC::row_num, and EDA_ITEM::Type().

Referenced by DIALOG_SELECT_NET_FROM_LIST(), onBoardChanged(), OnBoardItemChanged(), OnBoardNetSettingsChanged(), onFilterChange(), onRenameNet(), and onUnitsChanged().

◆ deleteRow()

void DIALOG_SELECT_NET_FROM_LIST::deleteRow ( const ROW_DESC aRow)
private

Definition at line 309 of file dialog_select_net_from_list.cpp.

310 {
311  if( !aRow )
312  return;
313 
314  m_netsList->DeleteItem( aRow.row_num );
315  m_list_items.erase( aRow.by_row );
316 
317  std::iter_swap( aRow.by_net, m_list_items_by_net.end() - 1 );
318  m_list_items_by_net.pop_back();
319 
320  std::sort( m_list_items_by_net.begin(), m_list_items_by_net.end(),
321  LIST_ITEM_NET_CMP_LESS( m_list_items ) );
322 }
std::vector< unsigned int > m_list_items_by_net

References DIALOG_SELECT_NET_FROM_LIST::ROW_DESC::by_net, DIALOG_SELECT_NET_FROM_LIST::ROW_DESC::by_row, m_list_items, m_list_items_by_net, DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList, and DIALOG_SELECT_NET_FROM_LIST::ROW_DESC::row_num.

Referenced by OnBoardItemRemoved(), and updateNet().

◆ Enable()

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 269 of file dialog_shim.cpp.

270 {
271  // so we can do logging of this state change:
272 
273 #if 0 && defined(DEBUG)
274  const char* type_id = typeid( *this ).name();
275  printf( "DIALOG_SHIM %s: %s\n", type_id, enable ? "enabled" : "disabled" );
276  fflush(0); //Needed on msys2 to immediately print the message
277 #endif
278 
279  return wxDialog::Enable( enable );
280 }

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 399 of file dialog_shim.cpp.

400 {
401  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
402  // handle validation in the same way as other dialogs.
403  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
404  return;
405 
406  SetReturnCode( retCode );
407 
408  if( !IsQuasiModal() )
409  {
410  wxFAIL_MSG( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal"
411  "wasn't called" );
412  return;
413  }
414 
415  if( m_qmodal_loop )
416  {
417  if( m_qmodal_loop->IsRunning() )
418  m_qmodal_loop->Exit( 0 );
419  else
420  m_qmodal_loop->ScheduleExit( 0 );
421 
423  }
424 
427 
428  Show( false );
429 }
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:206
#define NULL
bool IsQuasiModal()
Definition: dialog_shim.h:123
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:209

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

Referenced by HK_PROMPT_DIALOG::EndFlexible(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_COMPONENTS_LIBID::onCancel(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnCancelButtonClick(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), HTML_MESSAGE_BOX::OnOKButtonClick(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_COMPONENT::OnUseBrowser(), and DIALOG_SHIM::~DIALOG_SHIM().

◆ findRow() [1/2]

DIALOG_SELECT_NET_FROM_LIST::ROW_DESC DIALOG_SELECT_NET_FROM_LIST::findRow ( NETINFO_ITEM aNet)
private

Definition at line 297 of file dialog_select_net_from_list.cpp.

298 {
299  auto i = std::lower_bound( m_list_items_by_net.begin(), m_list_items_by_net.end(), aNet,
300  LIST_ITEM_NET_CMP_LESS( m_list_items ) );
301 
302  if( i != m_list_items_by_net.end() && m_list_items[*i].m_net == aNet )
303  return { static_cast<int>( *i ), m_list_items.begin() + *i, i };
304  else
305  return {};
306 }
std::vector< unsigned int > m_list_items_by_net

References m_list_items, and m_list_items_by_net.

Referenced by buildNetsList(), findRow(), HighlightNet(), OnBoardItemAdded(), OnBoardItemRemoved(), and updateNet().

◆ findRow() [2/2]

DIALOG_SELECT_NET_FROM_LIST::ROW_DESC DIALOG_SELECT_NET_FROM_LIST::findRow ( int  aNetCode)
private

Definition at line 291 of file dialog_select_net_from_list.cpp.

292 {
293  return findRow( m_brd->FindNet( aNetCode ) );
294 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
ROW_DESC findRow(NETINFO_ITEM *aNet)

References BOARD::FindNet(), findRow(), and m_brd.

◆ 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, when all widgets are initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at end of TransferDataToWindow, or better at end of a wxInitDialogEvent handler

In any case, the best way is to call it in a wxInitDialogEvent handler after calling TransfertDataToWindow(), which is the default wxInitDialogEvent handler wxDialog

Definition at line 144 of file dialog_shim.cpp.

145 {
146  // must be called from the constructor of derived classes,
147  // when all widgets are initialized, and therefore their size fixed
148 
149  // SetSizeHints fixes the minimal size of sizers in the dialog
150  // (SetSizeHints calls Fit(), so no need to call it)
151  GetSizer()->SetSizeHints( this );
152 
153  // the default position, when calling the first time the dlg
154  Center();
155 }

References PCAD2KICAD::Center.

Referenced by DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DRC::DIALOG_DRC(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_EDIT_SHEET_PIN::DIALOG_EDIT_SHEET_PIN(), DIALOG_EDITOR_DATA::DIALOG_EDITOR_DATA(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_ERC::DIALOG_ERC(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_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_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), DIALOG_INSPECTOR::DIALOG_INSPECTOR(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NETLIST::DIALOG_NETLIST(), 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_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SELECT_NET_FROM_LIST(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), DLG_SELECT_3DMODEL::DLG_SELECT_3DMODEL(), PAGED_DIALOG::finishInitialization(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SCH_SHEET_PROPS::OnInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), DIALOG_COLOR_PICKER::TransferDataToWindow(), and DIALOG_BOARD_STATISTICS::TransferDataToWindow().

◆ FixOSXCancelButtonIssue()

static void DIALOG_SHIM::FixOSXCancelButtonIssue ( wxWindow *  aWindow)
staticinherited

◆ formatCount()

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

Definition at line 345 of file dialog_select_net_from_list.cpp.

346 {
347  return wxString::Format( "%u", aValue );
348 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205

References Format().

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

◆ formatLength()

wxString DIALOG_SELECT_NET_FROM_LIST::formatLength ( int  aValue) const
private

Definition at line 351 of file dialog_select_net_from_list.cpp.

352 {
353  return MessageTextFromValue( GetUserUnits(), aValue );
354 }
EDA_UNITS GetUserUnits() const
Definition: dialog_shim.h:131
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:124

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

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

◆ formatNetCode()

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

Definition at line 333 of file dialog_select_net_from_list.cpp.

334 {
335  return wxString::Format( "%.3d", aNet->GetNet() );
336 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
int GetNet() const
Function GetNet.
Definition: netinfo.h:223

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

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

◆ formatNetName()

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

Definition at line 339 of file dialog_select_net_from_list.cpp.

340 {
341  return UnescapeString( aNet->GetNetname() );
342 }
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:231
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:131

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

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

◆ GetNetName()

bool DIALOG_SELECT_NET_FROM_LIST::GetNetName ( wxString &  aName) const

Definition at line 820 of file dialog_select_net_from_list.cpp.

References m_selection, and m_wasSelected.

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( )
inlineinherited

Definition at line 49 of file kiway_holder.h.

49 { return m_type; }
HOLDER_TYPE m_type
Definition: kiway_holder.h:82

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ GetUserUnits()

◆ HighlightNet()

void DIALOG_SELECT_NET_FROM_LIST::HighlightNet ( NETINFO_ITEM aNet)

Visually highlights a net in the list view.

Parameters
aNetis the net item to be highlighted. Nullptr will unhighlight any currently highlighted net.

Definition at line 715 of file dialog_select_net_from_list.cpp.

716 {
717  const ROW_DESC& r = findRow( aNet );
718 
719  if( r )
720  {
721  wxDataViewItem i = m_netsList->RowToItem( r.row_num );
722  m_netsList->Select( i );
723  m_netsList->EnsureVisible( i );
724  }
725  else
726  m_netsList->UnselectAll();
727 }
ROW_DESC findRow(NETINFO_ITEM *aNet)

References findRow(), DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList, and DIALOG_SELECT_NET_FROM_LIST::ROW_DESC::row_num.

Referenced by OnBoardHighlightNetChanged().

◆ highlightNetOnBoard()

void DIALOG_SELECT_NET_FROM_LIST::highlightNetOnBoard ( NETINFO_ITEM aNet) const
private

Definition at line 730 of file dialog_select_net_from_list.cpp.

731 {
732  int netCode = aNet != nullptr ? aNet->GetNet() : -1;
733 
735  render->SetHighlight( netCode >= 0, netCode );
736 
738  m_frame->GetCanvas()->Refresh();
739 }
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
virtual RENDER_SETTINGS * GetSettings()=0
Function GetAdapter Returns pointer to current settings that are going to be used when drawing items.
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Function SetHighlight Turns on/off highlighting - it may be done for the active layer or the specifie...
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
void UpdateAllLayersColor()
Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.
Definition: view.cpp:798

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

Referenced by onSelChanged().

◆ HorizPixelsFromDU()

int DIALOG_SHIM::HorizPixelsFromDU ( int  x)
protectedinherited

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

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 165 of file dialog_shim.cpp.

166 {
167  wxSize sz( x, 0 );
168  return ConvertDialogToPixels( sz ).x;
169 }

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

◆ IsCtrl()

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

Definition at line 136 of file dialog_shim.h.

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

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook().

◆ IsQuasiModal()

◆ IsShiftCtrl()

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

Definition at line 142 of file dialog_shim.h.

143  {
144  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
145  e.ShiftDown() && !e.MetaDown();
146  }

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook().

◆ Kiway()

KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns 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 56 of file kiway_holder.h.

57  {
58  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
59  return *m_kiway;
60  }
KIWAY * m_kiway
Definition: kiway_holder.h:81

References KIWAY_HOLDER::m_kiway.

Referenced by TREEPROJECT_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_CONTROL::AddSymbolToSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), CVPCB_MAINFRAME::DisplayStatus(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), SCH_EDITOR_CONTROL::EditWithLibEdit(), BACK_ANNOTATE::FetchNetlistFromPCB(), DISPLAY_FOOTPRINTS_FRAME::GetModule(), PCB_EDIT_FRAME::importFile(), KICAD_MANAGER_FRAME::language_change(), KIWAY_PLAYER::language_change(), LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), PL_EDITOR_FRAME::OnExit(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), LIB_EDIT_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), EDA_BASE_FRAME::OnPreferences(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), KIWAY_HOLDER::Prj(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDITOR_CONTROL::rescueProject(), EE_INSPECTION_TOOL::RunSimulation(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), LIB_TREE_MODEL_ADAPTER::SavePinnedItems(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), SCH_EDIT_FRAME::SetCrossProbeConnection(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), PCB_EDITOR_CONTROL::UpdateSchematicFromPCB(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ netFilterMatches()

bool DIALOG_SELECT_NET_FROM_LIST::netFilterMatches ( NETINFO_ITEM aNet) const
private

Definition at line 234 of file dialog_select_net_from_list.cpp.

235 {
236  // Note: the filtering is case insensitive.
237 
238  if( m_netFilter.GetPattern().IsEmpty() )
239  return true;
240 
241  return m_netFilter.Find( UnescapeString( aNet->GetNetname() ).Upper() )
243 }
virtual wxString const & GetPattern() const override
Return the pattern passed to SetPattern().
EDA_PATTERN_MATCH_WILDCARD m_netFilter
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:231
static const int EDA_PATTERN_NOT_FOUND
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:131
virtual int Find(const wxString &aCandidate) const override
Return the location of a match iff a given candidate string matches the set pattern.

References EDA_PATTERN_NOT_FOUND, EDA_PATTERN_MATCH_WILDCARD::Find(), NETINFO_ITEM::GetNetname(), EDA_PATTERN_MATCH_WILDCARD::GetPattern(), m_netFilter, and UnescapeString().

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

◆ onAddNet()

void DIALOG_SELECT_NET_FROM_LIST::onAddNet ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SELECT_NET_FROM_LIST_BASE.

Definition at line 827 of file dialog_select_net_from_list.cpp.

828 {
829  wxString newNetName;
830  NETNAME_VALIDATOR validator( &newNetName );
831 
832  WX_TEXT_ENTRY_DIALOG dlg( this, _( "Net name:" ), _( "New Net" ), newNetName );
833  dlg.SetTextValidator( validator );
834 
835  while( true )
836  {
837  if( dlg.ShowModal() != wxID_OK || dlg.GetValue().IsEmpty() )
838  return; //Aborted by user
839 
840  newNetName = dlg.GetValue();
841 
842  if( m_brd->FindNet( newNetName ) )
843  {
844  DisplayError( this, wxString::Format( _( "Net name '%s' is already in use." ),
845  newNetName ) );
846  newNetName = wxEmptyString;
847  }
848  else
849  {
850  break;
851  }
852  }
853 
854  NETINFO_ITEM *newnet = new NETINFO_ITEM( m_brd, dlg.GetValue(), 0 );
855 
856  m_brd->Add( newnet );
857  m_frame->OnModify();
858 
859  // We'll get an OnBoardItemChanged callback from this to update our listbox
860 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33

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_SELECT_NET_FROM_LIST::onBoardChanged ( wxCommandEvent &  event)
private

Definition at line 215 of file dialog_select_net_from_list.cpp.

216 {
217  if( m_brd != nullptr )
218  m_brd->RemoveListener( this );
219 
220  m_brd = m_frame->GetBoard();
221 
222  if( m_brd != nullptr )
223  m_brd->AddListener( this );
224 
225  m_wasSelected = false;
226 
227  buildNetsList();
228  m_netsList->Refresh();
229 
230  event.Skip();
231 }
void AddListener(BOARD_LISTENER *aListener)
Add a listener to the board to receive calls whenever something on the board has been modified.
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
BOARD * GetBoard() const

References BOARD::AddListener(), buildNetsList(), PCB_BASE_FRAME::GetBoard(), m_brd, m_frame, DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList, m_wasSelected, and BOARD::RemoveListener().

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

◆ OnBoardHighlightNetChanged()

void DIALOG_SELECT_NET_FROM_LIST::OnBoardHighlightNetChanged ( BOARD aBoard)
overridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 487 of file dialog_select_net_from_list.cpp.

488 {
489  if( !m_brd->IsHighLightNetON() )
490  m_netsList->UnselectAll();
491  else if( !m_brd->GetHighLightNetCodes().empty() )
493 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
bool IsHighLightNetON() const
Function IsHighLightNetON.
Definition: class_board.h:414
void HighlightNet(NETINFO_ITEM *aNet)
Visually highlights a net in the list view.
const std::set< int > & GetHighLightNetCodes() const
Function GetHighLightNetCode.
Definition: class_board.h:397

References BOARD::FindNet(), BOARD::GetHighLightNetCodes(), HighlightNet(), BOARD::IsHighLightNetON(), m_brd, and DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList.

◆ OnBoardItemAdded()

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

Reimplemented from BOARD_LISTENER.

Definition at line 357 of file dialog_select_net_from_list.cpp.

358 {
359  if( NETINFO_ITEM* net = dynamic_cast<NETINFO_ITEM*>( aBoardItem ) )
360  {
361  // a new net has been added to the board. add it to our list if it
362  // passes the netname filter test.
363  if( netFilterMatches( net ) )
364  {
365  m_list_items.emplace_back( net );
366  m_list_items_by_net.push_back( m_list_items.size() - 1 );
367 
368  std::sort( m_list_items_by_net.begin(), m_list_items_by_net.end(),
369  LIST_ITEM_NET_CMP_LESS( m_list_items ) );
370 
371  LIST_ITEM& new_i = m_list_items.back();
372  new_i.m_pad_count = m_brd->GetNodesCount( net->GetNet() );
373 
374  wxVector<wxVariant> new_row( 7 );
375  new_row[COLUMN_NET] = formatNetCode( net );
376  new_row[COLUMN_NAME] = formatNetName( net );
377  new_row[COLUMN_PAD_COUNT] = formatCount( new_i.m_pad_count );
378  new_row[COLUMN_VIA_COUNT] = formatCount( new_i.m_via_count );
379  new_row[COLUMN_BOARD_LENGTH] = formatLength( new_i.m_board_wire_length );
380  new_row[COLUMN_CHIP_LENGTH] = formatLength( new_i.m_chip_wire_length );
381  new_row[COLUMN_TOTAL_LENGTH] = formatLength( new_i.m_total_length );
382 
383  m_netsList->AppendItem( new_row );
384  }
385 
386  return;
387  }
388  else if( BOARD_CONNECTED_ITEM* i = dynamic_cast<BOARD_CONNECTED_ITEM*>( aBoardItem ) )
389  {
390  const ROW_DESC& r = findRow( i->GetNet() );
391 
392  if( r )
393  {
394  // try to handle frequent operations quickly.
395  if( TRACK* track = dynamic_cast<TRACK*>( i ) )
396  {
397  int len = track->GetLength();
398  r.by_row->m_board_wire_length += len;
399  r.by_row->m_total_length += len;
400 
401  setValue( r, COLUMN_BOARD_LENGTH, formatLength( r.by_row->m_board_wire_length ) );
402  setValue( r, COLUMN_TOTAL_LENGTH, formatLength( r.by_row->m_total_length ) );
403 
404  if( track->Type() == PCB_VIA_T )
405  {
406  r.by_row->m_via_count += 1;
407  setValue( r, COLUMN_VIA_COUNT, formatCount( r.by_row->m_via_count ) );
408  }
409 
410  return;
411  }
412  }
413 
414  // resort to generic slower net update otherwise.
415  updateNet( i->GetNet() );
416  }
417 }
decltype(DIALOG_SELECT_NET_FROM_LIST::m_list_items) ::iterator by_row
std::vector< unsigned int > m_list_items_by_net
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
static const COLUMN_ID COLUMN_BOARD_LENGTH
wxString formatCount(unsigned int aValue) const
void setValue(const ROW_DESC &aRow, const COLUMN_ID &aCol, wxString aVal)
wxString formatNetName(const NETINFO_ITEM *aNet) const
unsigned GetNodesCount(int aNet=-1)
Function GetNodesCount.
wxString formatNetCode(const NETINFO_ITEM *aNet) const
bool netFilterMatches(NETINFO_ITEM *aNet) const
wxString formatLength(int aValue) const
static const COLUMN_ID COLUMN_TOTAL_LENGTH
ROW_DESC findRow(NETINFO_ITEM *aNet)
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
static const COLUMN_ID COLUMN_CHIP_LENGTH

References DIALOG_SELECT_NET_FROM_LIST::ROW_DESC::by_row, COLUMN_BOARD_LENGTH, COLUMN_CHIP_LENGTH, COLUMN_NAME, COLUMN_NET, COLUMN_PAD_COUNT, COLUMN_TOTAL_LENGTH, COLUMN_VIA_COUNT, findRow(), formatCount(), formatLength(), formatNetCode(), formatNetName(), BOARD::GetNodesCount(), m_brd, m_list_items, m_list_items_by_net, DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList, netFilterMatches(), PCB_VIA_T, setValue(), and updateNet().

◆ OnBoardItemChanged()

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

Reimplemented from BOARD_LISTENER.

Definition at line 476 of file dialog_select_net_from_list.cpp.

477 {
478  if( dynamic_cast<BOARD_CONNECTED_ITEM*>( aBoardItem ) != nullptr
479  || dynamic_cast<MODULE*>( aBoardItem ) != nullptr )
480  {
481  buildNetsList();
482  m_netsList->Refresh();
483  }
484 }

References buildNetsList(), and DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList.

◆ OnBoardItemRemoved()

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

Reimplemented from BOARD_LISTENER.

Definition at line 420 of file dialog_select_net_from_list.cpp.

421 {
422  if( NETINFO_ITEM* net = dynamic_cast<NETINFO_ITEM*>( aBoardItem ) )
423  {
424  deleteRow( findRow( net ) );
425  return;
426  }
427  else if( MODULE* mod = dynamic_cast<MODULE*>( aBoardItem ) )
428  {
429  for( const D_PAD* pad : mod->Pads() )
430  {
431  const ROW_DESC& r = findRow( pad->GetNet() );
432 
433  if( r )
434  {
435  r.by_row->m_pad_count -= 1;
436 
437  if( r.by_row->m_pad_count == 0 && !m_cbShowZeroPad->IsChecked() )
438  deleteRow( r );
439  else
440  setValue( r, COLUMN_PAD_COUNT, formatCount( r.by_row->m_pad_count ) );
441  }
442  }
443  }
444  else if( BOARD_CONNECTED_ITEM* i = dynamic_cast<BOARD_CONNECTED_ITEM*>( aBoardItem ) )
445  {
446  const ROW_DESC& r = findRow( i->GetNet() );
447 
448  if( r )
449  {
450  // try to handle frequent operations quickly.
451  if( TRACK* track = dynamic_cast<TRACK*>( i ) )
452  {
453  int len = track->GetLength();
454  r.by_row->m_board_wire_length -= len;
455  r.by_row->m_total_length -= len;
456 
457  setValue( r, COLUMN_BOARD_LENGTH, formatLength( r.by_row->m_board_wire_length ) );
458  setValue( r, COLUMN_TOTAL_LENGTH, formatLength( r.by_row->m_total_length ) );
459 
460  if( track->Type() == PCB_VIA_T )
461  {
462  r.by_row->m_via_count -= 1;
463  setValue( r, COLUMN_VIA_COUNT, formatCount( r.by_row->m_via_count ) );
464  }
465 
466  return;
467  }
468 
469  // resort to generic slower net update otherwise.
470  updateNet( i->GetNet() );
471  }
472  }
473 }
decltype(DIALOG_SELECT_NET_FROM_LIST::m_list_items) ::iterator by_row
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
static const COLUMN_ID COLUMN_BOARD_LENGTH
wxString formatCount(unsigned int aValue) const
void setValue(const ROW_DESC &aRow, const COLUMN_ID &aCol, wxString aVal)
wxString formatLength(int aValue) const
static const COLUMN_ID COLUMN_TOTAL_LENGTH
ROW_DESC findRow(NETINFO_ITEM *aNet)
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97

References DIALOG_SELECT_NET_FROM_LIST::ROW_DESC::by_row, COLUMN_BOARD_LENGTH, COLUMN_PAD_COUNT, COLUMN_TOTAL_LENGTH, COLUMN_VIA_COUNT, deleteRow(), findRow(), formatCount(), formatLength(), DIALOG_SELECT_NET_FROM_LIST_BASE::m_cbShowZeroPad, PCB_VIA_T, setValue(), and updateNet().

◆ OnBoardNetSettingsChanged()

void DIALOG_SELECT_NET_FROM_LIST::OnBoardNetSettingsChanged ( BOARD aBoard)
overridevirtual

◆ onDeleteNet()

void DIALOG_SELECT_NET_FROM_LIST::onDeleteNet ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SELECT_NET_FROM_LIST_BASE.

Definition at line 928 of file dialog_select_net_from_list.cpp.

929 {
930  int selected_row = m_netsList->GetSelectedRow();
931 
932  if( selected_row >= 0 && selected_row < static_cast<int>( m_list_items.size() ) )
933  {
934  NETINFO_ITEM* net = m_list_items[selected_row].m_net;
935 
936  if( m_list_items[selected_row].m_pad_count > 0 )
937  {
938  if( !IsOK( this, _( "Net is in use. Delete anyway?" ) ) )
939  return;
940  }
941 
942  m_brd->Remove( net );
943  m_frame->OnModify();
944 
945  // We'll get an OnBoardItemChanged callback from this to update our listbox
946  }
947 }
void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
#define _(s)
Definition: 3d_actions.cpp:33
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:283
void Remove(BOARD_ITEM *aBoardItem) override
Removes an item from the container.

References _, IsOK(), m_brd, m_frame, m_list_items, DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList, PCB_EDIT_FRAME::OnModify(), and BOARD::Remove().

◆ onFilterChange()

void DIALOG_SELECT_NET_FROM_LIST::onFilterChange ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SELECT_NET_FROM_LIST_BASE.

Definition at line 742 of file dialog_select_net_from_list.cpp.

743 {
744  m_netFilter.SetPattern( m_textCtrlFilter->GetValue().Upper() );
745  buildNetsList();
746 }
virtual bool SetPattern(const wxString &aPattern) override
Set the pattern against which candidates will be matched.
EDA_PATTERN_MATCH_WILDCARD m_netFilter

References buildNetsList(), m_netFilter, DIALOG_SELECT_NET_FROM_LIST_BASE::m_textCtrlFilter, and EDA_PATTERN_MATCH_WILDCARD::SetPattern().

◆ onListSize()

void DIALOG_SELECT_NET_FROM_LIST::onListSize ( wxSizeEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SELECT_NET_FROM_LIST_BASE.

Definition at line 813 of file dialog_select_net_from_list.cpp.

814 {
815  aEvent.Skip();
817 }

References adjustListColumns().

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 302 of file dialog_shim.cpp.

303 {
304  if( m_firstPaintEvent )
305  {
307 
308  selectAllInTextCtrls( GetChildren() );
309 
311  m_initialFocusTarget->SetFocus();
312  else
313  SetFocus(); // Focus the dialog itself
314 
315  m_firstPaintEvent = false;
316  }
317 
318  event.Skip();
319 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:204
bool m_firstPaintEvent
Definition: dialog_shim.h:203
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: gtk/ui.cpp:38
static void selectAllInTextCtrls(wxWindowList &children)

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

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ onParentWindowClosed()

void DIALOG_SELECT_NET_FROM_LIST::onParentWindowClosed ( wxCommandEvent &  event)
private

Definition at line 197 of file dialog_select_net_from_list.cpp.

198 {
199  Close();
200  event.Skip();
201 }

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

◆ onRenameNet()

void DIALOG_SELECT_NET_FROM_LIST::onRenameNet ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SELECT_NET_FROM_LIST_BASE.

Definition at line 863 of file dialog_select_net_from_list.cpp.

864 {
865  int selected_row = m_netsList->GetSelectedRow();
866 
867  if( selected_row >= 0 && selected_row < static_cast<int>( m_list_items.size() ) )
868  {
869  NETINFO_ITEM* net = m_list_items[selected_row].m_net;
870  wxString fullNetName = net->GetNetname();
871  wxString netPath;
872  wxString shortNetName;
873 
874  if( fullNetName.Contains( "/" ) )
875  {
876  netPath = fullNetName.BeforeLast( '/' ) + '/';
877  shortNetName = fullNetName.AfterLast( '/' );
878  }
879  else
880  {
881  shortNetName = fullNetName;
882  }
883 
884  wxString unescapedShortName = UnescapeString( shortNetName );
885 
886  WX_TEXT_ENTRY_DIALOG dlg( this, _( "Net name:" ), _( "Rename Net" ), unescapedShortName );
887  NETNAME_VALIDATOR validator( &unescapedShortName );
888  dlg.SetTextValidator( validator );
889 
890  while( true )
891  {
892  if( dlg.ShowModal() != wxID_OK )
893  return; //Aborted by user
894 
895  unescapedShortName = dlg.GetValue();
896 
897  if( unescapedShortName.IsEmpty() )
898  {
899  DisplayError( this, wxString::Format( _( "Net name cannot be empty." ),
900  unescapedShortName ) );
901  continue;
902  }
903 
904  shortNetName = EscapeString( unescapedShortName, CTX_NETNAME );
905  fullNetName = netPath + shortNetName;
906 
907  if( m_brd->FindNet( shortNetName ) || m_brd->FindNet( fullNetName ) )
908  {
909  DisplayError( this, wxString::Format( _( "Net name '%s' is already in use." ),
910  unescapedShortName ) );
911  unescapedShortName = wxEmptyString;
912  }
913  else
914  {
915  break;
916  }
917  }
918 
919  net->SetNetname( fullNetName );
920  m_frame->OnModify();
921 
922  buildNetsList();
923  m_netsList->Refresh();
924  }
925 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:231
void SetNetname(const wxString &aNewName)
Function SetNetname Sets the long netname to aNetName, and the short netname to the last token in the...
Definition: netinfo.h:244
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:131
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
These Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which ar...
Definition: string.cpp:50

References _, buildNetsList(), CTX_NETNAME, DisplayError(), EscapeString(), BOARD::FindNet(), Format(), NETINFO_ITEM::GetNetname(), WX_TEXT_ENTRY_DIALOG::GetValue(), m_brd, m_frame, m_list_items, DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList, PCB_EDIT_FRAME::OnModify(), NETINFO_ITEM::SetNetname(), WX_TEXT_ENTRY_DIALOG::SetTextValidator(), and UnescapeString().

◆ onReport()

void DIALOG_SELECT_NET_FROM_LIST::onReport ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SELECT_NET_FROM_LIST_BASE.

Definition at line 950 of file dialog_select_net_from_list.cpp.

951 {
952  wxFileDialog dlg( this, _( "Report file" ), "", "",
953  _( "Report file" ) + AddFileExtListToFilter( { "csv" } ),
954  wxFD_SAVE );
955 
956  if( dlg.ShowModal() == wxID_CANCEL )
957  return;
958 
959  wxTextFile f( dlg.GetPath() );
960 
961  f.Create();
962 
963  int rows = m_netsList->GetItemCount();
964  wxString txt;
965 
966  // Print Header:
967  txt.Printf( "\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";",
968  _( "Net Id" ), _( "Net name" ),
969  _( "Pad count" ), _( "Via count" ),
970  _( "Board length" ), _( "Die length" ), _( "Net length" ) );
971  f.AddLine( txt );
972 
973  // Print list of nets:
974  for( int row = 1; row < rows; row++ )
975  {
976  txt.Printf( "%s;\"%s\";%s;%s;%s;%s;%s;",
977  m_netsList->GetTextValue( row, COLUMN_NET ),
978  m_netsList->GetTextValue( row, COLUMN_NAME ),
979  m_netsList->GetTextValue( row, COLUMN_PAD_COUNT ),
980  m_netsList->GetTextValue( row, COLUMN_VIA_COUNT ),
981  m_netsList->GetTextValue( row, COLUMN_BOARD_LENGTH ),
982  m_netsList->GetTextValue( row, COLUMN_CHIP_LENGTH ),
983  m_netsList->GetTextValue( row, COLUMN_TOTAL_LENGTH ) );
984 
985  f.AddLine( txt );
986  }
987 
988  f.Write();
989  f.Close();
990 }
static const COLUMN_ID COLUMN_BOARD_LENGTH
static const COLUMN_ID COLUMN_TOTAL_LENGTH
#define _(s)
Definition: 3d_actions.cpp:33
static const COLUMN_ID COLUMN_CHIP_LENGTH
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(), COLUMN_BOARD_LENGTH, COLUMN_CHIP_LENGTH, COLUMN_NAME, COLUMN_NET, COLUMN_PAD_COUNT, COLUMN_TOTAL_LENGTH, COLUMN_VIA_COUNT, and DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList.

◆ onSelChanged()

void DIALOG_SELECT_NET_FROM_LIST::onSelChanged ( wxDataViewEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SELECT_NET_FROM_LIST_BASE.

Definition at line 749 of file dialog_select_net_from_list.cpp.

750 {
751  int selected_row = m_netsList->GetSelectedRow();
752 
753  if( selected_row >= 0 && selected_row < static_cast<int>( m_list_items.size() ) )
754  {
755  NETINFO_ITEM* net = m_list_items[selected_row].m_net;
756 
757  m_selection = net->GetNetname();
758  m_wasSelected = true;
759  highlightNetOnBoard( net );
760  return;
761  }
762 
763  highlightNetOnBoard( nullptr );
764  m_wasSelected = false;
765 }
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:231
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
void highlightNetOnBoard(NETINFO_ITEM *aNet) const

References NETINFO_ITEM::GetNetname(), highlightNetOnBoard(), m_list_items, DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList, m_selection, and m_wasSelected.

◆ onUnitsChanged()

void DIALOG_SELECT_NET_FROM_LIST::onUnitsChanged ( wxCommandEvent &  event)
private

Definition at line 204 of file dialog_select_net_from_list.cpp.

205 {
206  this->m_units = m_frame->GetUserUnits();
207 
208  buildNetsList();
209  m_netsList->Refresh();
210 
211  event.Skip();
212 }
EDA_UNITS m_units
Definition: dialog_shim.h:197
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References buildNetsList(), EDA_BASE_FRAME::GetUserUnits(), m_frame, DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList, and DIALOG_SHIM::m_units.

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

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

Definition at line 35 of file kiway_holder.cpp.

36 {
37  return Kiway().Prj();
38 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:172

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

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::buildEquivalenceList(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), SCH_EDIT_FRAME::CreateScreens(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), CVPCB_MAINFRAME::DisplayStatus(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), PCB_EDIT_FRAME::doAutoSave(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), DIALOG_EXPORT_SVG::ExportSVGFile(), LIB_CONTROL::ExportSymbolAsSVG(), LIB_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), BACK_ANNOTATE::FetchNetlistFromPCB(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DISPLAY_FOOTPRINTS_FRAME::GetModule(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::GetSelectedSymbol(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), DIALOG_CONFIG_EQUFILES::Init(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), SCH_EDIT_FRAME::KiwayMailIn(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectSettings(), PCB_EDIT_FRAME::LoadProjectSettings(), DRC::LoadRules(), SCH_EDIT_FRAME::LoadSheetFromFile(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), TEXT_BUTTON_URL::OnButtonClick(), TEXT_BUTTON_FILE_BROWSER::OnButtonClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), SCH_EDIT_FRAME::OnCloseWindow(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), DIALOG_CONFIG_EQUFILES::OnOkClick(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_BOM::OnRunGenerator(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), DIALOG_ERC::OnSaveReport(), DIALOG_DRC::OnSaveReport(), PROPERTIES_FRAME::onScintillaCharAdded(), DIALOG_LABEL_EDITOR::onScintillaCharAdded(), DIALOG_SCH_EDIT_ONE_FIELD::onScintillaCharAdded(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDITOR_CONTROL::Paste(), FOOTPRINT_EDITOR_TOOLS::PasteFootprint(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), DIALOG_PLOT::Plot(), DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL(), DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDITOR_CONTROL::Print(), SCH_EDIT_FRAME::PrintPage(), EDA_DRAW_FRAME::PrintWorkSheet(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), SCH_EDIT_TOOL::RefreshSymbolFromLibrary(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), DIALOG_EDIT_COMPONENTS_LIBID::revertChanges(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), LIB_EDIT_FRAME::savePartAs(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::SaveProject(), PCB_EDIT_FRAME::SaveProjectSettings(), DIALOG_BOARD_STATISTICS::saveReportClicked(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectCompFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), LIB_EDIT_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), GERBVIEW_FRAME::SetPageSettings(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), COMMON_CONTROL::ShowHelp(), LIB_VIEW_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), PANEL_SETUP_RULES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataToWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary(), DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::UpdateTitle(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

◆ relevantConnectivityItems()

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

Definition at line 265 of file dialog_select_net_from_list.cpp.

266 {
267  // pre-filter the connectivity items and sort them by netcode.
268  // this avoids quadratic runtime when building the whole net list and
269  // calculating the total length for each net.
270 
271  const auto type_bits = std::bitset<MAX_STRUCT_TYPE_ID>()
272  .set( PCB_TRACE_T )
273  .set( PCB_VIA_T )
274  .set( PCB_PAD_T );
275 
276  std::vector<CN_ITEM*> cn_items;
277  cn_items.reserve( 1024 );
278 
279  for( CN_ITEM* cn_item : m_brd->GetConnectivity()->GetConnectivityAlgo()->ItemList() )
280  {
281  if( cn_item->Valid() && type_bits[cn_item->Parent()->Type()] )
282  cn_items.push_back( cn_item );
283  }
284 
285  std::sort( cn_items.begin(), cn_items.end(), NETCODE_CMP_LESS() );
286 
287  return cn_items;
288 }
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:355
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97

References BOARD::GetConnectivity(), m_brd, 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 244 of file dialog_shim.cpp.

245 {
246  const char* hash_key;
247 
248  if( m_hash_key.size() )
249  {
250  // a special case like EDA_LIST_DIALOG, which has multiple uses.
251  hash_key = m_hash_key.c_str();
252  }
253  else
254  {
255  hash_key = typeid(*this).name();
256  }
257 
258  RECT_MAP::iterator it = class_map.find( hash_key );
259 
260  if( it == class_map.end() )
261  return;
262 
263  EDA_RECT rect = it->second;
264  rect.SetSize( 0, 0 );
265  class_map[ hash_key ] = rect;
266 }
std::string m_hash_key
Definition: dialog_shim.h:198
static RECT_MAP class_map
void SetSize(const wxSize &size)
Definition: eda_rect.h:144
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

References class_map, DIALOG_SHIM::m_hash_key, and EDA_RECT::SetSize().

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY().

◆ 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 114 of file dialog_shim.h.

115  {
116  m_initialFocusTarget = aWindow;
117  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:204

References DIALOG_SHIM::m_initialFocusTarget.

Referenced by DIALOG_BOM::DIALOG_BOM(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_EDIT_SHEET_PIN::DIALOG_EDIT_SHEET_PIN(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FIND::DIALOG_FIND(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_SCH_FIND::DIALOG_SCH_FIND(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_EDIT_ONE_FIELD::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(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), LIB_EDIT_FRAME::savePartAs(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow(), DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataToWindow(), and DIALOG_COPPER_ZONE::TransferDataToWindow().

◆ SetKiway()

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

Function SetKiway.

Parameters
aDestis the recipient of aKiway pointer. It is only used for debugging, since "this" is not a wxWindow*. "this" is a KIWAY_HOLDER mix-in.
aKiwayis often from a parent window, or from KIFACE::CreateWindow().

Definition at line 42 of file kiway_holder.cpp.

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

References KIWAY_HOLDER::m_kiway, and name.

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

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

159 {
160  wxSize sz( x, y );
161  SetSize( ConvertDialogToPixels( sz ) );
162 }

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

◆ Settings()

◆ setValue()

void DIALOG_SELECT_NET_FROM_LIST::setValue ( const ROW_DESC aRow,
const COLUMN_ID aCol,
wxString  aVal 
)
private

◆ Show()

bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 185 of file dialog_shim.cpp.

186 {
187  bool ret;
188  const char* hash_key;
189 
190  if( m_hash_key.size() )
191  {
192  // a special case like EDA_LIST_DIALOG, which has multiple uses.
193  hash_key = m_hash_key.c_str();
194  }
195  else
196  {
197  hash_key = typeid(*this).name();
198  }
199 
200  // Show or hide the window. If hiding, save current position and size.
201  // If showing, use previous position and size.
202  if( show )
203  {
204 #ifndef __WINDOWS__
205  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
206 #endif
207  ret = wxDialog::Show( show );
208 
209  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
210  EDA_RECT savedDialogRect = class_map[ hash_key ];
211 
212  if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
213  {
214  SetSize( savedDialogRect.GetPosition().x,
215  savedDialogRect.GetPosition().y,
216  std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
217  std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
218  0 );
219  }
220 
221  // Be sure that the dialog appears in a visible area
222  // (the dialog position might have been stored at the time when it was
223  // shown on another display)
224  if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
225  Centre();
226  }
227  else
228  {
229  // Save the dialog's position & size before hiding, using classname as key
230  class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() );
231 
232 #ifdef __WXMAC__
233  if ( m_eventLoop )
234  m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
235 #endif
236 
237  ret = wxDialog::Show( show );
238  }
239 
240  return ret;
241 }
std::string m_hash_key
Definition: dialog_shim.h:198
static RECT_MAP class_map
const wxPoint GetPosition() const
Definition: eda_rect.h:115
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
const wxSize GetSize() const
Definition: eda_rect.h:103

References class_map, EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, wxPoint::x, and wxPoint::y.

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_DRC::OnDRCItemDClick(), DIALOG_ERC::OnERCItemDClick(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem(), DIALOG_CLEANUP_GRAPHICS::OnLeftDClickItem(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), DIALOG_SHIM::ShowQuasiModal(), DIALOG_POSITION_RELATIVE::UpdateAnchor(), and SCH_EDIT_FRAME::UpdateHierarchyNavigator().

◆ ShowQuasiModal()

int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 345 of file dialog_shim.cpp.

346 {
347  // This is an exception safe way to zero a pointer before returning.
348  // Yes, even though DismissModal() clears this first normally, this is
349  // here in case there's an exception before the dialog is dismissed.
350  struct NULLER
351  {
352  void*& m_what;
353  NULLER( void*& aPtr ) : m_what( aPtr ) {}
354  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
355  } clear_this( (void*&) m_qmodal_loop );
356 
357  // release the mouse if it's currently captured as the window having it
358  // will be disabled when this dialog is shown -- but will still keep the
359  // capture making it impossible to do anything in the modal dialog itself
360  wxWindow* win = wxWindow::GetCapture();
361  if( win )
362  win->ReleaseMouse();
363 
364  // Get the optimal parent
365  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
366 
367  // Show the optimal parent
368  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
369 
370  wxASSERT_MSG( !m_qmodal_parent_disabler,
371  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
372 
373  // quasi-modal: disable only my "optimal" parent
375 
376 
377  // Apple in its infinite wisdom will raise a disabled window before even passing
378  // us the event, so we have no way to stop it. Instead, we must set an order on
379  // the windows so that the quasi-modal will be pushed in front of the disabled
380  // window when it is raised.
382 
383  Show( true );
384 
385  m_qmodal_showing = true;
386 
387  WX_EVENT_LOOP event_loop;
388 
389  m_qmodal_loop = &event_loop;
390 
391  event_loop.Run();
392 
393  m_qmodal_showing = false;
394 
395  return GetReturnCode();
396 }
bool m_qmodal_showing
Definition: dialog_shim.h:208
#define WX_EVENT_LOOP
Definition: kiway_player.h:41
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:206
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:209
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:40
#define DBG(x)
Definition: fctsys.h:33
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:32

References DBG, 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 LIB_EDIT_TOOL::editFieldProperties(), SCH_EDITOR_CONTROL::EditSymbolFields(), LIB_EDIT_TOOL::editSymbolProperties(), GLOBAL_EDIT_TOOL::EditTracksAndVias(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), PCB_BASE_FRAME::InstallPadOptionsFrame(), InvokeDialogEditComponentsLibId(), InvokeDialogRescueEach(), InvokeDialogUpdateFields(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_EDITOR_CONTROL::RemapSymbols(), SCH_BASE_FRAME::SelectCompFromLibTree(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), and SCH_EDIT_FRAME::ShowSchematicSetupDialog().

◆ updateNet()

void DIALOG_SELECT_NET_FROM_LIST::updateNet ( NETINFO_ITEM aNet)
private

Definition at line 503 of file dialog_select_net_from_list.cpp.

504 {
505  // something for the specified net has changed, update that row.
506  if( !netFilterMatches( aNet ) )
507  return;
508 
509  // if the net had no pads before, it might not be in the displayed list yet.
510  // if it had pads and now doesn't anymore, we might need to remove it from the list.
511 
512  auto cur_net_row = findRow( aNet );
513 
514  const unsigned int node_count = m_brd->GetNodesCount( aNet->GetNet() );
515 
516  if( node_count == 0 && !m_cbShowZeroPad->IsChecked() )
517  {
518  deleteRow( cur_net_row );
519  return;
520  }
521 
522  std::vector<CN_ITEM*> all_cn_items = relevantConnectivityItems();
523 
524  LIST_ITEM list_item( aNet );
525  list_item.m_pad_count = node_count;
526 
527  const auto cn_items = std::equal_range( all_cn_items.begin(), all_cn_items.end(),
528  aNet->GetNet(), NETCODE_CMP_LESS() );
529 
530  for( auto i = cn_items.first; i != cn_items.second; ++i )
531  {
532  BOARD_CONNECTED_ITEM* item = ( *i )->Parent();
533 
534  if( item->Type() == PCB_PAD_T )
535  list_item.m_chip_wire_length += static_cast<D_PAD*>( item )->GetPadToDieLength();
536 
537  else if( TRACK* track = dynamic_cast<TRACK*>( item ) )
538  {
539  list_item.m_board_wire_length += track->GetLength();
540 
541  if( item->Type() == PCB_VIA_T )
542  list_item.m_via_count += 1;
543  }
544  }
545 
546  list_item.m_total_length = list_item.m_board_wire_length + list_item.m_chip_wire_length;
547 
548  if( !cur_net_row )
549  {
550  m_list_items.push_back( list_item );
551  m_list_items_by_net.push_back( m_list_items.size() - 1 );
552  std::sort( m_list_items_by_net.begin(), m_list_items_by_net.end(),
553  LIST_ITEM_NET_CMP_LESS( m_list_items ) );
554 
555  wxVector<wxVariant> new_row( 7 );
556  new_row[COLUMN_NET] = formatNetCode( aNet );
557  new_row[COLUMN_NAME] = formatNetName( aNet );
558  new_row[COLUMN_PAD_COUNT] = formatCount( list_item.m_pad_count );
559  new_row[COLUMN_VIA_COUNT] = formatCount( list_item.m_via_count );
560  new_row[COLUMN_BOARD_LENGTH] = formatLength( list_item.m_board_wire_length );
561  new_row[COLUMN_CHIP_LENGTH] = formatLength( list_item.m_chip_wire_length );
562  new_row[COLUMN_TOTAL_LENGTH] = formatLength( list_item.m_total_length );
563 
564  m_netsList->AppendItem( new_row );
565  }
566  else
567  {
568  *cur_net_row.by_row = list_item;
569 
570  setValue( cur_net_row, COLUMN_PAD_COUNT, formatCount( list_item.m_pad_count ) );
571  setValue( cur_net_row, COLUMN_VIA_COUNT, formatCount( list_item.m_via_count ) );
572  setValue( cur_net_row, COLUMN_BOARD_LENGTH, formatLength( list_item.m_board_wire_length ) );
573  setValue( cur_net_row, COLUMN_CHIP_LENGTH, formatLength( list_item.m_chip_wire_length ) );
574  setValue( cur_net_row, COLUMN_TOTAL_LENGTH, formatLength( list_item.m_total_length ) );
575  }
576 }
std::vector< unsigned int > m_list_items_by_net
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
static const COLUMN_ID COLUMN_BOARD_LENGTH
wxString formatCount(unsigned int aValue) const
std::vector< CN_ITEM * > relevantConnectivityItems() const
void setValue(const ROW_DESC &aRow, const COLUMN_ID &aCol, wxString aVal)
wxString formatNetName(const NETINFO_ITEM *aNet) const
unsigned GetNodesCount(int aNet=-1)
Function GetNodesCount.
wxString formatNetCode(const NETINFO_ITEM *aNet) const
bool netFilterMatches(NETINFO_ITEM *aNet) const
wxString formatLength(int aValue) const
static const COLUMN_ID COLUMN_TOTAL_LENGTH
ROW_DESC findRow(NETINFO_ITEM *aNet)
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
static const COLUMN_ID COLUMN_CHIP_LENGTH
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References COLUMN_BOARD_LENGTH, COLUMN_CHIP_LENGTH, COLUMN_NAME, COLUMN_NET, COLUMN_PAD_COUNT, COLUMN_TOTAL_LENGTH, COLUMN_VIA_COUNT, deleteRow(), findRow(), formatCount(), formatLength(), formatNetCode(), formatNetName(), NETINFO_ITEM::GetNet(), BOARD::GetNodesCount(), DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM::m_board_wire_length, m_brd, DIALOG_SELECT_NET_FROM_LIST_BASE::m_cbShowZeroPad, DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM::m_chip_wire_length, m_list_items, m_list_items_by_net, DIALOG_SELECT_NET_FROM_LIST_BASE::m_netsList, DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM::m_pad_count, DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM::m_total_length, DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM::m_via_count, netFilterMatches(), PCB_PAD_T, PCB_VIA_T, relevantConnectivityItems(), setValue(), and EDA_ITEM::Type().

Referenced by OnBoardItemAdded(), and OnBoardItemRemoved().

◆ VertPixelsFromDU()

int DIALOG_SHIM::VertPixelsFromDU ( int  y)
protectedinherited

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

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 172 of file dialog_shim.cpp.

173 {
174  wxSize sz( 0, y );
175  return ConvertDialogToPixels( sz ).y;
176 }

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT().

Member Data Documentation

◆ COLUMN_BOARD_LENGTH

const COLUMN_ID DIALOG_SELECT_NET_FROM_LIST::COLUMN_BOARD_LENGTH
staticprivate

◆ COLUMN_CHIP_LENGTH

const COLUMN_ID DIALOG_SELECT_NET_FROM_LIST::COLUMN_CHIP_LENGTH
staticprivate

◆ COLUMN_NAME

const COLUMN_ID DIALOG_SELECT_NET_FROM_LIST::COLUMN_NAME
staticprivate

◆ COLUMN_NET

const COLUMN_ID DIALOG_SELECT_NET_FROM_LIST::COLUMN_NET
staticprivate

◆ COLUMN_PAD_COUNT

const COLUMN_ID DIALOG_SELECT_NET_FROM_LIST::COLUMN_PAD_COUNT
staticprivate

◆ COLUMN_TOTAL_LENGTH

const COLUMN_ID DIALOG_SELECT_NET_FROM_LIST::COLUMN_TOTAL_LENGTH
staticprivate

◆ COLUMN_VIA_COUNT

const COLUMN_ID DIALOG_SELECT_NET_FROM_LIST::COLUMN_VIA_COUNT
staticprivate

◆ m_addNet

◆ m_brd

◆ m_cbShowZeroPad

◆ m_deleteNet

wxBitmapButton* DIALOG_SELECT_NET_FROM_LIST_BASE::m_deleteNet
protectedinherited

◆ m_firstPaintEvent

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 203 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

◆ m_frame

PCB_EDIT_FRAME* DIALOG_SELECT_NET_FROM_LIST::m_frame
private

◆ m_hash_key

◆ m_initialFocusTarget

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 204 of file dialog_shim.h.

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

◆ m_list_items

std::vector<LIST_ITEM> DIALOG_SELECT_NET_FROM_LIST::m_list_items
private

◆ m_list_items_by_net

std::vector<unsigned int> DIALOG_SELECT_NET_FROM_LIST::m_list_items_by_net
private

◆ m_netFilter

EDA_PATTERN_MATCH_WILDCARD DIALOG_SELECT_NET_FROM_LIST::m_netFilter
private

Definition at line 123 of file dialog_select_net_from_list.h.

Referenced by netFilterMatches(), and onFilterChange().

◆ m_netsList

◆ m_parentFrame

EDA_BASE_FRAME* DIALOG_SHIM::m_parentFrame
protectedinherited

Definition at line 211 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnCharHook(), and DIALOG_DRC::OnDRCItemRClick().

◆ m_qmodal_loop

WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 206 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 208 of file dialog_shim.h.

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

◆ m_renameNet

wxBitmapButton* DIALOG_SELECT_NET_FROM_LIST_BASE::m_renameNet
protectedinherited

◆ m_ReportButt

wxButton* DIALOG_SELECT_NET_FROM_LIST_BASE::m_ReportButt
protectedinherited

◆ m_sdbSizer

wxStdDialogButtonSizer* DIALOG_SELECT_NET_FROM_LIST_BASE::m_sdbSizer
protectedinherited

◆ m_sdbSizerCancel

wxButton* DIALOG_SELECT_NET_FROM_LIST_BASE::m_sdbSizerCancel
protectedinherited

◆ m_sdbSizerOK

wxButton* DIALOG_SELECT_NET_FROM_LIST_BASE::m_sdbSizerOK
protectedinherited

◆ m_selection

wxString DIALOG_SELECT_NET_FROM_LIST::m_selection
private

Definition at line 125 of file dialog_select_net_from_list.h.

Referenced by buildNetsList(), GetNetName(), and onSelChanged().

◆ m_staticline1

wxStaticLine* DIALOG_SELECT_NET_FROM_LIST_BASE::m_staticline1
protectedinherited

◆ m_staticTextFilter

wxStaticText* DIALOG_SELECT_NET_FROM_LIST_BASE::m_staticTextFilter
protectedinherited

◆ m_tabOrder

◆ m_textCtrlFilter

◆ m_units

◆ m_wasSelected

bool DIALOG_SELECT_NET_FROM_LIST::m_wasSelected
private

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