KiCad PCB EDA Suite
DIALOG_DESIGN_RULES Class Reference

#include <dialog_design_rules.h>

Inheritance diagram for DIALOG_DESIGN_RULES:
DIALOG_DESIGN_RULES_BASE DIALOG_SHIM KIWAY_HOLDER

Public Member Functions

 DIALOG_DESIGN_RULES (PCB_EDIT_FRAME *parent)
 
 ~DIALOG_DESIGN_RULES ()
 
virtual bool TransferDataFromWindow () override
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal ()
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
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...
 

Protected Types

enum  { wxID_ADD_NETCLASS = 1000, wxID_REMOVE_NETCLASS, ID_LEFT_TO_RIGHT_COPY, ID_RIGHT_TO_LEFT_COPY }
 

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...
 

Protected Attributes

wxNotebook * m_DRnotebook
 
wxPanel * m_panelNetClassesEditor
 
wxGrid * m_grid
 
wxButton * m_addButton
 
wxButton * m_removeButton
 
wxButton * m_moveUpButton
 
wxComboBox * m_leftClassChoice
 
wxStaticLine * m_staticline21
 
wxButton * m_buttonLeftSelAll
 
NETS_LIST_CTRLm_leftListCtrl
 
wxButton * m_buttonRightToLeft
 
wxButton * m_buttonLeftToRight
 
wxComboBox * m_rightClassChoice
 
wxStaticLine * m_staticline3
 
wxButton * m_buttonRightSelAll
 
NETS_LIST_CTRLm_rightListCtrl
 
wxPanel * m_panelGolbalDesignRules
 
wxStaticText * m_TrackMinWidthTitle
 
wxTextCtrl * m_SetTrackMinWidthCtrl
 
wxStaticText * m_TrackMinWidthUnits
 
wxStaticText * m_ViaMinTitle
 
wxTextCtrl * m_SetViasMinSizeCtrl
 
wxStaticText * m_ViaMinUnits
 
wxStaticText * m_ViaMinDrillTitle
 
wxTextCtrl * m_SetViasMinDrillCtrl
 
wxStaticText * m_ViaMinDrillUnits
 
wxCheckBox * m_OptAllowBlindBuriedVias
 
wxCheckBox * m_OptAllowMicroVias
 
wxStaticText * m_MicroViaMinSizeTitle
 
wxTextCtrl * m_SetMicroViasMinSizeCtrl
 
wxStaticText * m_MicroViaMinSizeUnits
 
wxStaticText * m_MicroViaMinDrillTitle
 
wxTextCtrl * m_SetMicroViasMinDrillCtrl
 
wxStaticText * m_MicroViaMinDrillUnits
 
wxStaticText * m_staticTextInfo
 
wxStaticText * m_staticText7
 
wxGrid * m_gridViaSizeList
 
wxStaticText * m_staticText8
 
wxGrid * m_gridTrackWidthList
 
wxStaticLine * m_staticline2
 
wxStdDialogButtonSizer * m_sdbSizer1
 
wxButton * m_sdbSizer1OK
 
wxButton * m_sdbSizer1Cancel
 
bool m_fixupsRun
 
std::string m_hash_key
 
EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 

Private Member Functions

void OnNetClassesNameLeftClick (wxGridEvent &event) override
 
void OnNetClassesNameRightClick (wxGridEvent &event) override
 
void OnAddNetclassClick (wxCommandEvent &event) override
 
void OnRemoveNetclassClick (wxCommandEvent &event) override
 
void CheckAllowMicroVias ()
 
void OnAllowMicroVias (wxCommandEvent &event) override
 Function OnAllowMicroVias is called whenever the AllowMicroVias checkbox is toggled. More...
 
void OnMoveUpSelectedNetClass (wxCommandEvent &event) override
 
void OnLeftCBSelection (wxCommandEvent &event) override
 
void OnRightCBSelection (wxCommandEvent &event) override
 
void OnRightToLeftCopyButton (wxCommandEvent &event) override
 
void OnLeftToRightCopyButton (wxCommandEvent &event) override
 
void OnNotebookPageChanged (wxNotebookEvent &event) override
 
void OnLeftSelectAllButton (wxCommandEvent &event) override
 
void OnRightSelectAllButton (wxCommandEvent &event) override
 
void SetDataValidators (void)
 
bool TestDataValidity (wxString *aErrorMsg=NULL)
 
void InitDialogRules ()
 
void InitGlobalRules ()
 
void InitRulesList ()
 Function InitRulesList Fill the grid showing current rules with values. More...
 
void InitDimensionsLists ()
 
void InitializeRulesSelectionBoxes ()
 
void CopyRulesListToBoard ()
 
void CopyGlobalRulesToBoard ()
 
void CopyDimensionsListsToBoard ()
 
void SetRoutableLayerStatus ()
 
void FillListBoxWithNetNames (NETS_LIST_CTRL *aListCtrl, const wxString &aNetClass)
 Function FillListBoxWithNetNames populates aListCtrl with net names and class names from m_AllNets in a two column display. More...
 
void swapNetClass (const wxString &oldClass, const wxString &newClass)
 Function swapNetClass replaces one net class name with another in the master list, m_AllNets. More...
 
void makePointers (PNETCUPS *aList, const wxString &aNetClassName)
 
void setNetClass (const wxString &aNetName, const wxString &aClassName)
 
void moveSelectedItems (NETS_LIST_CTRL *src, const wxString &newClassName)
 

Private Attributes

PCB_EDIT_FRAMEm_Parent
 
BOARDm_Pcb
 
BOARD_DESIGN_SETTINGSm_BrdSettings
 
NETCLASSPTR m_SelectedNetClass
 
int m_initialRowLabelsSize
 the initial width given by wxFormBuilder More...
 
wxFloatingPointValidator< double > m_validator
 
NETCUPS m_AllNets
 A two column table which gets filled once and never loses any elements, so it is basically constant, except that the NETCUP::clazz member can change for any given row a NET is moved in and out of a class. More...
 
std::vector< VIA_DIMENSIONm_ViasDimensionsList
 
std::vector< int > m_TracksWidthList
 

Static Private Attributes

static const wxString wildCard = _( "* (Any)" )
 the name of a fictitious netclass which includes all NETs More...
 
static int s_LastTabSelection = -1
 which tab user had open last More...
 

Detailed Description

Definition at line 63 of file dialog_design_rules.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES ( PCB_EDIT_FRAME parent)

Definition at line 167 of file dialog_design_rules.cpp.

References CLASS_TITLE, EnsureGridColumnWidths(), EnsureGridRowTitleWidth(), DIALOG_SHIM::FinishDialogSettings(), InitDialogRules(), DIALOG_DESIGN_RULES_BASE::m_DRnotebook, DIALOG_DESIGN_RULES_BASE::m_grid, DIALOG_DESIGN_RULES_BASE::m_gridTrackWidthList, DIALOG_DESIGN_RULES_BASE::m_gridViaSizeList, m_initialRowLabelsSize, DIALOG_DESIGN_RULES_BASE::m_leftListCtrl, m_Parent, DIALOG_DESIGN_RULES_BASE::m_rightListCtrl, DIALOG_DESIGN_RULES_BASE::m_sdbSizer1OK, NET_TITLE, s_LastTabSelection, and SetDataValidators().

167  :
168  DIALOG_DESIGN_RULES_BASE( parent )
169 {
170  m_Parent = parent;
171  SetAutoLayout( true );
172 
173  m_initialRowLabelsSize = m_grid->GetRowLabelSize();
174  EnsureGridColumnWidths( this, m_grid ); // override any column widths set by wxformbuilder.
175 
176  wxListItem column0;
177  wxListItem column1;
178 
179  column0.Clear();
180  column1.Clear();
181 
182  column0.SetMask( wxLIST_MASK_TEXT );
183  column1.SetMask( wxLIST_MASK_TEXT );
184 
185  column0.SetText( NET_TITLE );
186  column1.SetText( CLASS_TITLE );
187 
189 
190  m_leftListCtrl->InsertColumn( 0, column0 );
191  m_leftListCtrl->InsertColumn( 1, column1 );
192  m_leftListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
193  m_leftListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE );
194 
195  m_rightListCtrl->InsertColumn( 0, column0 );
196  m_rightListCtrl->InsertColumn( 1, column1 );
197  m_rightListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
198  m_rightListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE );
199 
200  // if user has been into the dialog before, go back to same tab
201  if( s_LastTabSelection != -1 )
202  {
203  m_DRnotebook->SetSelection( s_LastTabSelection );
204  }
205 
206  InitDialogRules();
208 
209  m_sdbSizer1OK->SetDefault();
210 
211  // Allow tabbing out of grid controls.
212  m_grid->SetTabBehaviour( wxGrid::Tab_Leave );
213  m_gridViaSizeList->SetTabBehaviour( wxGrid::Tab_Leave );
214  m_gridTrackWidthList->SetTabBehaviour( wxGrid::Tab_Leave );
215 
216  Layout();
217 
218  // Now all widgets have the size fixed, call FinishDialogSettings
220 }
DIALOG_DESIGN_RULES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Design Rules Editor"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
static void EnsureGridRowTitleWidth(wxWindow *aShower, wxGrid *aGrid, int aMinWidth)
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
#define NET_TITLE
PCB_EDIT_FRAME * m_Parent
int m_initialRowLabelsSize
the initial width given by wxFormBuilder
#define CLASS_TITLE
static void EnsureGridColumnWidths(wxWindow *aShower, wxGrid *aGrid)
Function EnsureGridColumnWidths resizes all the columns in a wxGrid based only on the requirements of...
static int s_LastTabSelection
which tab user had open last
DIALOG_DESIGN_RULES::~DIALOG_DESIGN_RULES ( )
inline

Definition at line 201 of file dialog_design_rules.h.

201 { }

Member Function Documentation

void DIALOG_DESIGN_RULES::CheckAllowMicroVias ( )
private
void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard ( )
private

Definition at line 623 of file dialog_design_rules.cpp.

References g_UserUnit, m_BrdSettings, VIA_DIMENSION::m_Diameter, VIA_DIMENSION::m_Drill, DIALOG_DESIGN_RULES_BASE::m_gridTrackWidthList, DIALOG_DESIGN_RULES_BASE::m_gridViaSizeList, m_TracksWidthList, BOARD_DESIGN_SETTINGS::m_TrackWidthList, m_ViasDimensionsList, BOARD_DESIGN_SETTINGS::m_ViasDimensionsList, and ValueFromString().

Referenced by TransferDataFromWindow().

624 {
625  wxString msg;
626 
627  // Commit any pending in-place edits from grid controls
628  m_gridTrackWidthList->SaveEditControlValue();
629  m_gridViaSizeList->SaveEditControlValue();
630 
631  // Reinitialize m_TrackWidthList
632  m_TracksWidthList.clear();
633 
634  for( int row = 0; row < m_gridTrackWidthList->GetNumberRows(); ++row )
635  {
636  msg = m_gridTrackWidthList->GetCellValue( row, 0 );
637 
638  if( msg.IsEmpty() )
639  continue;
640 
641  int value = ValueFromString( g_UserUnit, msg );
642  m_TracksWidthList.push_back( value );
643  }
644 
645  // Sort new list by by increasing value
646  sort( m_TracksWidthList.begin(), m_TracksWidthList.end() );
647 
648  // Reinitialize m_ViasDimensionsList
649  m_ViasDimensionsList.clear();
650 
651  for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row )
652  {
653  msg = m_gridViaSizeList->GetCellValue( row, 0 );
654 
655  if( msg.IsEmpty() )
656  continue;
657 
658  int value = ValueFromString( g_UserUnit, msg );
659  VIA_DIMENSION via_dim;
660  via_dim.m_Diameter = value;
661  msg = m_gridViaSizeList->GetCellValue( row, 1 );
662 
663  if( !msg.IsEmpty() )
664  {
665  value = ValueFromString( g_UserUnit, msg );
666  via_dim.m_Drill = value;
667  }
668 
669  m_ViasDimensionsList.push_back( via_dim );
670  }
671 
672  // Sort new list by by increasing value
673  sort( m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() );
674 
675  std::vector<int>* tlist = &m_BrdSettings->m_TrackWidthList;
676 
677  // Remove old "custom" sizes
678  tlist->erase( tlist->begin() + 1, tlist->end() );
679 
680  // Add new "custom" sizes
681  tlist->insert( tlist->end(), m_TracksWidthList.begin(), m_TracksWidthList.end() );
682 
683  // Reinitialize m_ViaSizeList
684  std::vector<VIA_DIMENSION>* vialist = &m_BrdSettings->m_ViasDimensionsList;
685  vialist->erase( vialist->begin() + 1, vialist->end() );
686  vialist->insert( vialist->end(), m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() );
687 }
std::vector< int > m_TracksWidthList
Struct VIA_DIMENSION is a small helper container to handle a stock of specific vias each with unique ...
std::vector< int > m_TrackWidthList
Track width list.
std::vector< VIA_DIMENSION > m_ViasDimensionsList
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application...
Definition: base_units.cpp:370
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
BOARD_DESIGN_SETTINGS * m_BrdSettings
std::vector< VIA_DIMENSION > m_ViasDimensionsList
Vias size and drill list.
void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard ( )
private

Definition at line 604 of file dialog_design_rules.cpp.

References BOARD_DESIGN_SETTINGS::m_BlindBuriedViaAllowed, m_BrdSettings, BOARD_DESIGN_SETTINGS::m_MicroViasAllowed, BOARD_DESIGN_SETTINGS::m_MicroViasMinDrill, BOARD_DESIGN_SETTINGS::m_MicroViasMinSize, DIALOG_DESIGN_RULES_BASE::m_OptAllowBlindBuriedVias, DIALOG_DESIGN_RULES_BASE::m_OptAllowMicroVias, DIALOG_DESIGN_RULES_BASE::m_SetMicroViasMinDrillCtrl, DIALOG_DESIGN_RULES_BASE::m_SetMicroViasMinSizeCtrl, DIALOG_DESIGN_RULES_BASE::m_SetTrackMinWidthCtrl, DIALOG_DESIGN_RULES_BASE::m_SetViasMinDrillCtrl, DIALOG_DESIGN_RULES_BASE::m_SetViasMinSizeCtrl, BOARD_DESIGN_SETTINGS::m_TrackMinWidth, BOARD_DESIGN_SETTINGS::m_ViasMinDrill, BOARD_DESIGN_SETTINGS::m_ViasMinSize, and ValueFromTextCtrl().

Referenced by TransferDataFromWindow().

605 {
607 
608  // Update vias minimum values for DRC
611 
613 
614  // Update microvias minimum values for DRC
617 
618  // Update tracks minimum values for DRC
620 }
int m_TrackMinWidth
track min value for width ((min copper size value
int m_ViasMinSize
vias (not micro vias) min diameter
int m_ViasMinDrill
vias (not micro vias) min drill diameter
bool m_BlindBuriedViaAllowed
true to allow blind/buried vias
int m_MicroViasMinSize
micro vias (not vias) min diameter
int ValueFromTextCtrl(const wxTextCtrl &aTextCtr)
Convert the number Value in a string according to the internal units and the selected unit (g_UserUni...
Definition: base_units.cpp:386
BOARD_DESIGN_SETTINGS * m_BrdSettings
bool m_MicroViasAllowed
true to allow micro vias
int m_MicroViasMinDrill
micro vias (not vias) min drill diameter
void DIALOG_DESIGN_RULES::CopyRulesListToBoard ( )
private

Definition at line 559 of file dialog_design_rules.cpp.

References NETCLASSES::Add(), NETCLASSES::Clear(), NETCLASSES::Find(), GetChars(), NETCLASSES::GetDefault(), gridRow2class(), m_AllNets, m_BrdSettings, DIALOG_DESIGN_RULES_BASE::m_grid, BOARD_DESIGN_SETTINGS::m_NetClasses, m_Pcb, and BOARD::SynchronizeNetsAndNetClasses().

Referenced by TransferDataFromWindow().

560 {
561  // Commit any pending in-place edits first
562  m_grid->SaveEditControlValue();
563 
564  NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
565 
566  // Remove all netclasses from board. We'll copy new list after
567  netclasses.Clear();
568 
569  // Copy the default NetClass:
570  gridRow2class( m_grid, 0, netclasses.GetDefault() );
571 
572  // Copy other NetClasses :
573  for( int row = 1; row < m_grid->GetNumberRows(); ++row )
574  {
575  NETCLASSPTR nc = std::make_shared<NETCLASS>( m_grid->GetRowLabelValue( row ) );
576 
577  if( !m_BrdSettings->m_NetClasses.Add( nc ) )
578  {
579  // this netclass cannot be added because another netclass with the same name exists
580  // Should not occur because OnAddNetclassClick() tests for existing NetClass names
581  wxString msg;
582  msg.Printf( wxT( "CopyRulesListToBoard(): The NetClass \"%s\" already exists. Skip" ),
583  GetChars( m_grid->GetRowLabelValue( row ) ) );
584  wxMessageBox( msg );
585 
586  continue;
587  }
588 
589  gridRow2class( m_grid, row, nc );
590  }
591 
592  // Now read all nets and push them in the corresponding netclass net buffer
593  for( NETCUPS::const_iterator netcup = m_AllNets.begin(); netcup != m_AllNets.end(); ++netcup )
594  {
595  NETCLASSPTR nc = netclasses.Find( netcup->clazz );
596  wxASSERT( nc );
597  nc->Add( netcup->net );
598  }
599 
601 }
NETCLASSPTR Find(const wxString &aName) const
Function Find searches this container for a NETCLASS given by aName.
Definition: netclass.cpp:144
static void gridRow2class(wxGrid *grid, int row, const NETCLASSPTR &nc)
void SynchronizeNetsAndNetClasses()
Function SynchronizeNetsAndNetClasses copies NETCLASS info to each NET, based on NET membership in a ...
Definition: netclass.cpp:158
Class NETCLASSES is a container for NETCLASS instances.
Definition: netclass.h:231
bool Add(const NETCLASSPTR &aNetclass)
Function Add takes aNetclass and puts it into this NETCLASSES container.
Definition: netclass.cpp:102
BOARD_DESIGN_SETTINGS * m_BrdSettings
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Clear()
Function Clear destroys any contained NETCLASS instances except the Default one.
Definition: netclass.h:249
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:275
NETCUPS m_AllNets
A two column table which gets filled once and never loses any elements, so it is basically constant...
NETCLASSES m_NetClasses
List of current netclasses. There is always the default netclass.
bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 205 of file dialog_shim.cpp.

Referenced by DIALOG_PRINT_USING_PRINTER::InitValues(), and DIALOG_SHIM::IsQuasiModal().

206 {
207  // so we can do logging of this state change:
208 
209 #if defined(DEBUG)
210  const char* type_id = typeid( *this ).name();
211  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
212 #endif
213 
214  return wxDialog::Enable( enable );
215 }
void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 610 of file dialog_shim.cpp.

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

Referenced by DIALOG_SHIM::OnButton(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCancelButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick(), DIALOG_EDIT_ONE_FIELD::OnCancelClick(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCloseDialog(), DIALOG_EDIT_ONE_FIELD::OnCloseDialog(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCloseDialog(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_EDIT_ONE_FIELD::OnOkClick(), DIALOG_EXCHANGE_FOOTPRINTS::OnQuit(), DIALOG_CHOOSE_COMPONENT::OnSchViewDClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), and DIALOG_SHIM::~DIALOG_SHIM().

611 {
612  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
613  // handle validation in the same way as other dialogs.
614  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
615  return;
616 
617  SetReturnCode( retCode );
618 
619  if( !IsQuasiModal() )
620  {
621  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
622  return;
623  }
624 
625  m_qmodal_showing = false;
626 
627  if( m_qmodal_loop )
628  {
629  if( m_qmodal_loop->IsRunning() )
630  m_qmodal_loop->Exit( 0 );
631  else
632  m_qmodal_loop->ScheduleExit( 0 );
633 
634  m_qmodal_loop = NULL;
635  }
636 
639 
640  Show( false );
641 }
bool m_qmodal_showing
Definition: dialog_shim.h:155
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:154
bool IsQuasiModal()
Definition: dialog_shim.h:103
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:156
void DIALOG_DESIGN_RULES::FillListBoxWithNetNames ( NETS_LIST_CTRL aListCtrl,
const wxString &  aNetClass 
)
private

Function FillListBoxWithNetNames populates aListCtrl with net names and class names from m_AllNets in a two column display.

Definition at line 410 of file dialog_design_rules.cpp.

References CLASS_TITLE, NETS_LIST_CTRL::ClearList(), i, makePointers(), max, NET_TITLE, NETS_LIST_CTRL::SetRowItems(), and TO_UTF8.

Referenced by InitializeRulesSelectionBoxes(), OnLeftCBSelection(), OnLeftToRightCopyButton(), OnRightCBSelection(), and OnRightToLeftCopyButton().

412 {
413  aListCtrl->ClearList();
414 
415  PNETCUPS ptrList;
416 
417  // get a subset of m_AllNets in pointer form, sorted as desired.
418  makePointers( &ptrList, aNetClass );
419 
420 #if 0 && defined(DEBUG)
421  int r = 0;
422  for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++r )
423  {
424  printf( "[%d]: %s %s\n", r, TO_UTF8( (*i)->net ), TO_UTF8( (*i)->clazz ) );
425  }
426 
427 #endif
428 
429  // Add netclass info to m_Netnames and m_Classnames wxArrayString buffers
430  // aListCtrl uses wxLC_VIRTUAL option, so this is fast
431  wxClientDC sDC( aListCtrl );
432  int row = 0;
433  // recompute the column widths here, after setting texts
434  int net_colsize = sDC.GetTextExtent( NET_TITLE ).x;
435  int class_colsize = sDC.GetTextExtent( CLASS_TITLE ).x;
436 
437  for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++row )
438  {
439  wxSize net_needed = sDC.GetTextExtent( (*i)->net );
440  wxSize class_needed = sDC.GetTextExtent( (*i)->clazz );
441  net_colsize = std::max( net_colsize, net_needed.x );
442  class_colsize = std::max( class_colsize, class_needed.x );
443  aListCtrl->SetRowItems( row, (*i)->net, (*i)->clazz );
444  }
445 
446  int margin = sDC.GetTextExtent( wxT( "XX" ) ).x;
447  aListCtrl->SetColumnWidth( 0, net_colsize + margin );
448  aListCtrl->SetColumnWidth( 1, class_colsize + margin );
449  aListCtrl->Refresh();
450 }
std::vector< NETCUP * > PNETCUPS
#define NET_TITLE
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
void makePointers(PNETCUPS *aList, const wxString &aNetClassName)
#define CLASS_TITLE
void SetRowItems(unsigned aRow, const wxString &aNetname, const wxString &aNetclassName)
Function SetRowItems sets the net name and the net class name at aRow.
#define max(a, b)
Definition: auxiliary.h:86
size_t i
Definition: json11.cpp:597
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 104 of file dialog_shim.cpp.

References PCAD2KICAD::Center.

Referenced by COLOR4D_PICKER_DLG::COLOR4D_PICKER_DLG(), DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DESIGN_RULES(), DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), 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_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG(), 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_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_PRETTY_LIB::DIALOG_SELECT_PRETTY_LIB(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_SHIM::IsQuasiModal(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_LIB_EDIT_PIN::OnInitDialog(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog(), DIALOG_TRACK_VIA_PROPERTIES::OnInitDlg(), DIALOG_GRAPHIC_ITEMS_OPTIONS::OnInitDlg(), DIALOG_EDIT_FPTEXT::OnInitDlg(), DIALOG_SET_GRID::OnInitDlg(), DIALOG_PCB_TEXT_PROPERTIES::OnInitDlg(), DIALOG_PRINT_FOR_MODEDIT::OnInitDlg(), DIALOG_FOOTPRINT_FP_EDITOR::OnInitDlg(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnInitDlg(), DIALOG_PRINT_USING_PRINTER::OnInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), and DIALOG_UPDATE_FIELDS::TransferDataToWindow().

105 {
106  // must be called from the constructor of derived classes,
107  // when all widgets are initialized, and therefore their size fixed
108 
109  // SetSizeHints fixes the minimal size of sizers in the dialog
110  // (SetSizeHints calls Fit(), so no need to call it)
111  GetSizer()->SetSizeHints( this );
112 
113  // the default position, when calling the first time the dlg
114  Center();
115 }
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 125 of file dialog_shim.cpp.

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

126 {
127  wxSize sz( x, 0 );
128  return ConvertDialogToPixels( sz ).x;
129 }
void DIALOG_DESIGN_RULES::InitDialogRules ( )
private

Definition at line 240 of file dialog_design_rules.cpp.

References NETCLASSES::begin(), BOARD::BuildListOfNets(), NETCLASSES::end(), PCB_BASE_FRAME::GetBoard(), NETCLASSES::GetDefault(), BOARD::GetDesignSettings(), InitGlobalRules(), InitializeRulesSelectionBoxes(), InitRulesList(), m_AllNets, m_BrdSettings, BOARD_DESIGN_SETTINGS::m_NetClasses, m_Parent, m_Pcb, and name.

Referenced by DIALOG_DESIGN_RULES().

241 {
242  // @todo: Move the initialization code into TransferDataToWindow() to follow wxWidgets
243  // dialog data transfer convention.
244  SetFocus();
245  SetReturnCode( 0 );
246 
247  m_Pcb = m_Parent->GetBoard();
249 
250  // Initialize the Rules List
251  InitRulesList();
252 
253  // Reassure that all nets have net classes assigned
255 
256  // copy all NETs into m_AllNets by adding them as NETCUPs.
257 
258  // @todo go fix m_Pcb->SynchronizeNetsAndNetClasses() so that the netcode==0 is not
259  // present in the BOARD::m_NetClasses
260  NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
261  NETCLASSPTR netclass = netclasses.GetDefault();
262 
263  // Initialize list of nets for Default Net Class
264  for( NETCLASS::iterator name = netclass->begin(); name != netclass->end(); ++name )
265  {
266  m_AllNets.push_back( NETCUP( *name, netclass->GetName() ) );
267  }
268 
269  // Initialize list of nets for others (custom) Net Classes
270  for( NETCLASSES::const_iterator nc = netclasses.begin(); nc != netclasses.end(); ++nc )
271  {
272  netclass = nc->second;
273 
274  for( NETCLASS::const_iterator name = netclass->begin(); name != netclass->end(); ++name )
275  {
276  m_AllNets.push_back( NETCUP( *name, netclass->GetName() ) );
277  }
278  }
279 
281  InitGlobalRules();
282 }
void BuildListOfNets()
Definition: class_board.h:722
void InitRulesList()
Function InitRulesList Fill the grid showing current rules with values.
BOARD * GetBoard() const
iterator end()
Definition: netclass.h:256
NETCLASS_MAP::const_iterator const_iterator
Definition: netclass.h:258
PCB_EDIT_FRAME * m_Parent
STRINGSET::iterator iterator
Definition: netclass.h:141
iterator begin()
Definition: netclass.h:255
Class NETCLASSES is a container for NETCLASS instances.
Definition: netclass.h:231
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:532
BOARD_DESIGN_SETTINGS * m_BrdSettings
const char * name
Definition: DXF_plotter.cpp:61
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:275
STRINGSET::const_iterator const_iterator
Definition: netclass.h:145
NETCUPS m_AllNets
A two column table which gets filled once and never loses any elements, so it is basically constant...
NETCLASSES m_NetClasses
List of current netclasses. There is always the default netclass.
void DIALOG_DESIGN_RULES::InitDimensionsLists ( )
private

Definition at line 318 of file dialog_design_rules.cpp.

References g_UserUnit, DIALOG_DESIGN_RULES_BASE::m_gridTrackWidthList, DIALOG_DESIGN_RULES_BASE::m_gridViaSizeList, m_TracksWidthList, m_ViasDimensionsList, and StringFromValue().

Referenced by InitGlobalRules().

319 {
320  wxString msg;
321 
322  // Compute the column widths here, after setting texts
323  msg = wxT("000000.000000"); // This is a very long text to display values.
324  // Actual values are shorter.
325  m_gridViaSizeList->SetCellValue( 0, 0, msg );
326  m_gridViaSizeList->SetCellValue( 0, 1, msg );
327  m_gridTrackWidthList->SetCellValue( 0, 0, msg );
328  m_gridViaSizeList->SetColMinimalWidth( 0, 150 );
329  m_gridViaSizeList->SetColMinimalWidth( 1, 150 );
330  m_gridViaSizeList->AutoSizeColumns( true );
331  m_gridTrackWidthList->SetColMinimalWidth( 0, 150 );
332  m_gridTrackWidthList->AutoSizeColumns( true );
333  m_gridViaSizeList->SetColMinimalWidth( 1, 150 );
334 
335  // Fill cells with actual values:
336  m_gridViaSizeList->SetCellValue( 0, 0, wxEmptyString );
337  m_gridViaSizeList->SetCellValue( 0, 1, wxEmptyString );
338  m_gridTrackWidthList->SetCellValue( 0, 0, wxEmptyString );
339 
340  // Give a correct size to row labels column
341  m_gridViaSizeList->SetRowLabelSize( wxGRID_AUTOSIZE );
342  m_gridTrackWidthList->SetRowLabelSize( wxGRID_AUTOSIZE );
343 
344  for( unsigned ii = 0; ii < m_TracksWidthList.size(); ii++ )
345  {
346  msg = StringFromValue( g_UserUnit, m_TracksWidthList[ii], false );
347  m_gridTrackWidthList->SetCellValue( ii, 0, msg );
348  }
349 
350  for( unsigned ii = 0; ii < m_ViasDimensionsList.size(); ii++ )
351  {
352  msg = StringFromValue( g_UserUnit, m_ViasDimensionsList[ii].m_Diameter, false );
353  m_gridViaSizeList->SetCellValue( ii, 0, msg );
354 
355  if( m_ViasDimensionsList[ii].m_Drill > 0 )
356  {
357  msg = StringFromValue( g_UserUnit, m_ViasDimensionsList[ii].m_Drill, false );
358  m_gridViaSizeList->SetCellValue( ii, 1, msg );
359  }
360  }
361 }
std::vector< int > m_TracksWidthList
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:205
std::vector< VIA_DIMENSION > m_ViasDimensionsList
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
void DIALOG_DESIGN_RULES::InitGlobalRules ( )
private

Definition at line 285 of file dialog_design_rules.cpp.

References CheckAllowMicroVias(), g_UserUnit, GetAbbreviatedUnitsLabel(), InitDimensionsLists(), BOARD_DESIGN_SETTINGS::m_BlindBuriedViaAllowed, m_BrdSettings, DIALOG_DESIGN_RULES_BASE::m_MicroViaMinDrillUnits, DIALOG_DESIGN_RULES_BASE::m_MicroViaMinSizeUnits, BOARD_DESIGN_SETTINGS::m_MicroViasAllowed, BOARD_DESIGN_SETTINGS::m_MicroViasMinDrill, BOARD_DESIGN_SETTINGS::m_MicroViasMinSize, DIALOG_DESIGN_RULES_BASE::m_OptAllowBlindBuriedVias, DIALOG_DESIGN_RULES_BASE::m_OptAllowMicroVias, DIALOG_DESIGN_RULES_BASE::m_SetMicroViasMinDrillCtrl, DIALOG_DESIGN_RULES_BASE::m_SetMicroViasMinSizeCtrl, DIALOG_DESIGN_RULES_BASE::m_SetTrackMinWidthCtrl, DIALOG_DESIGN_RULES_BASE::m_SetViasMinDrillCtrl, DIALOG_DESIGN_RULES_BASE::m_SetViasMinSizeCtrl, BOARD_DESIGN_SETTINGS::m_TrackMinWidth, DIALOG_DESIGN_RULES_BASE::m_TrackMinWidthUnits, m_TracksWidthList, BOARD_DESIGN_SETTINGS::m_TrackWidthList, DIALOG_DESIGN_RULES_BASE::m_ViaMinDrillUnits, DIALOG_DESIGN_RULES_BASE::m_ViaMinUnits, m_ViasDimensionsList, BOARD_DESIGN_SETTINGS::m_ViasDimensionsList, BOARD_DESIGN_SETTINGS::m_ViasMinDrill, BOARD_DESIGN_SETTINGS::m_ViasMinSize, and PutValueInLocalUnits().

Referenced by InitDialogRules().

286 {
287  // Set unit labels
288  const wxString units = GetAbbreviatedUnitsLabel( g_UserUnit );
289 
290  m_ViaMinUnits->SetLabel( units );
291  m_ViaMinDrillUnits->SetLabel( units );
292  m_MicroViaMinSizeUnits->SetLabel( units );
293  m_MicroViaMinDrillUnits->SetLabel( units );
294  m_TrackMinWidthUnits->SetLabel( units );
295 
298 
302 
306 
307  // Initialize Vias and Tracks sizes lists.
308  // note we display only extra values, never the current netclass value.
309  // (the first value in history list)
311  m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value
313  m_ViasDimensionsList.erase( m_ViasDimensionsList.begin() ); // remove the netclass value
315 }
std::vector< int > m_TracksWidthList
std::vector< int > m_TrackWidthList
Track width list.
std::vector< VIA_DIMENSION > m_ViasDimensionsList
int m_TrackMinWidth
track min value for width ((min copper size value
int m_ViasMinSize
vias (not micro vias) min diameter
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:485
int m_ViasMinDrill
vias (not micro vias) min drill diameter
bool m_BlindBuriedViaAllowed
true to allow blind/buried vias
int m_MicroViasMinSize
micro vias (not vias) min diameter
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
void PutValueInLocalUnits(wxTextCtrl &aTextCtr, int aValue)
Function PutValueInLocalUnits converts aValue from internal units to user units and append the units ...
Definition: base_units.cpp:267
BOARD_DESIGN_SETTINGS * m_BrdSettings
std::vector< VIA_DIMENSION > m_ViasDimensionsList
Vias size and drill list.
bool m_MicroViasAllowed
true to allow micro vias
int m_MicroViasMinDrill
micro vias (not vias) min drill diameter
void DIALOG_DESIGN_RULES::InitializeRulesSelectionBoxes ( )
private

Definition at line 455 of file dialog_design_rules.cpp.

References FillListBoxWithNetNames(), DIALOG_DESIGN_RULES_BASE::m_buttonLeftToRight, DIALOG_DESIGN_RULES_BASE::m_buttonRightToLeft, DIALOG_DESIGN_RULES_BASE::m_grid, DIALOG_DESIGN_RULES_BASE::m_leftClassChoice, DIALOG_DESIGN_RULES_BASE::m_leftListCtrl, DIALOG_DESIGN_RULES_BASE::m_rightClassChoice, DIALOG_DESIGN_RULES_BASE::m_rightListCtrl, and wildCard.

Referenced by InitDialogRules(), OnAddNetclassClick(), OnMoveUpSelectedNetClass(), and OnRemoveNetclassClick().

456 {
457  m_rightClassChoice->Clear();
458  m_leftClassChoice->Clear();
459 
460  m_rightClassChoice->Append( wildCard );
461  m_leftClassChoice->Append( wildCard );
462 
463  for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
464  {
465  m_rightClassChoice->Append( m_grid->GetRowLabelValue( ii ) );
466  m_leftClassChoice->Append( m_grid->GetRowLabelValue( ii ) );
467  }
468 
469  m_rightClassChoice->Select( 0 );
470  m_leftClassChoice->Select( 0 );
471 
472  m_buttonRightToLeft->Enable( false );
473  m_buttonLeftToRight->Enable( false );
474 
475  FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
477 }
static const wxString wildCard
the name of a fictitious netclass which includes all NETs
void FillListBoxWithNetNames(NETS_LIST_CTRL *aListCtrl, const wxString &aNetClass)
Function FillListBoxWithNetNames populates aListCtrl with net names and class names from m_AllNets in...
void DIALOG_DESIGN_RULES::InitRulesList ( )
private

Function InitRulesList Fill the grid showing current rules with values.

Definition at line 517 of file dialog_design_rules.cpp.

References NETCLASSES::begin(), class2gridRow(), NETCLASSES::end(), NETCLASSES::GetCount(), NETCLASSES::GetDefault(), i, m_BrdSettings, DIALOG_DESIGN_RULES_BASE::m_grid, and BOARD_DESIGN_SETTINGS::m_NetClasses.

Referenced by InitDialogRules().

518 {
519  NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
520 
521  // the +1 is for the Default NETCLASS.
522  if( netclasses.GetCount() + 1 > (unsigned) m_grid->GetNumberRows() )
523  {
524  m_grid->AppendRows( netclasses.GetCount() + 1 - m_grid->GetNumberRows() );
525  }
526 
527  // enter the Default NETCLASS.
528  class2gridRow( m_grid, 0, netclasses.GetDefault() );
529 
530  // enter others netclasses
531  int row = 1;
532 
533  for( NETCLASSES::iterator i = netclasses.begin(); i!=netclasses.end(); ++i, ++row )
534  {
535  NETCLASSPTR netclass = i->second;
536 
537  class2gridRow( m_grid, row, netclass );
538  }
539 }
iterator end()
Definition: netclass.h:256
static void class2gridRow(wxGrid *grid, int row, const NETCLASSPTR &nc)
NETCLASS_MAP::iterator iterator
Definition: netclass.h:254
iterator begin()
Definition: netclass.h:255
Class NETCLASSES is a container for NETCLASS instances.
Definition: netclass.h:231
unsigned GetCount() const
Function GetCount.
Definition: netclass.h:266
BOARD_DESIGN_SETTINGS * m_BrdSettings
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:275
size_t i
Definition: json11.cpp:597
NETCLASSES m_NetClasses
List of current netclasses. There is always the default netclass.
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 60 of file kiway_player.h.

References KIWAY_HOLDER::m_kiway, KIWAY_HOLDER::Prj(), and KIWAY_HOLDER::SetKiway().

Referenced by SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_SHIM::DIALOG_SHIM(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), FOOTPRINT_EDIT_FRAME::GetIconScale(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), SCH_EDIT_FRAME::KiwayMailIn(), KIWAY_PLAYER::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_CHOOSE_COMPONENT::OnIdle(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame(), FOOTPRINT_EDIT_FRAME::Show3D_Frame(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:85
void DIALOG_DESIGN_RULES::makePointers ( PNETCUPS aList,
const wxString &  aNetClassName 
)
private

Definition at line 382 of file dialog_design_rules.cpp.

References m_AllNets, sortByClassThenName(), and wildCard.

Referenced by FillListBoxWithNetNames().

383 {
384  aList->clear();
385 
386  if( wildCard == aNetClassName )
387  {
388  for( NETCUPS::iterator n = m_AllNets.begin(); n != m_AllNets.end(); ++n )
389  {
390  aList->push_back( &*n );
391  }
392 
393  sort( aList->begin(), aList->end(), sortByClassThenName );
394 
395  // could use a different sort order for wildCard case.
396  }
397  else
398  {
399  for( NETCUPS::iterator n = m_AllNets.begin(); n != m_AllNets.end(); ++n )
400  {
401  if( n->clazz == aNetClassName )
402  aList->push_back( &*n );
403  }
404 
405  sort( aList->begin(), aList->end(), sortByClassThenName );
406  }
407 }
static bool sortByClassThenName(NETCUP *a, NETCUP *b)
static const wxString wildCard
the name of a fictitious netclass which includes all NETs
NETCUPS m_AllNets
A two column table which gets filled once and never loses any elements, so it is basically constant...
void DIALOG_DESIGN_RULES::moveSelectedItems ( NETS_LIST_CTRL src,
const wxString &  newClassName 
)
private

Definition at line 921 of file dialog_design_rules.cpp.

References NETCLASS::Default, setNetClass(), and wildCard.

Referenced by OnLeftToRightCopyButton(), and OnRightToLeftCopyButton().

922 {
923  wxListItem item;
924  wxString netName;
925 
926  item.m_mask |= wxLIST_MASK_TEXT; // Validate the member m_text of the wxListItem item
927 
928  for( int row = 0; row < src->GetItemCount(); ++row )
929  {
930  if( !src->GetItemState( row, wxLIST_STATE_SELECTED ) )
931  continue;
932 
933  item.SetColumn( 0 );
934  item.SetId( row );
935 
936  src->GetItem( item );
937  netName = item.GetText();
938 
939  setNetClass( netName, newClassName == wildCard ? NETCLASS::Default : newClassName );
940  }
941 }
static const char Default[]
the name of the default NETCLASS
Definition: netclass.h:90
static const wxString wildCard
the name of a fictitious netclass which includes all NETs
void setNetClass(const wxString &aNetName, const wxString &aClassName)
void DIALOG_DESIGN_RULES::OnAddNetclassClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_DESIGN_RULES_BASE.

Definition at line 729 of file dialog_design_rules.cpp.

References DisplayError(), EnsureGridRowTitleWidth(), WX_TEXT_ENTRY_DIALOG::GetValue(), InitializeRulesSelectionBoxes(), DIALOG_DESIGN_RULES_BASE::m_grid, and m_initialRowLabelsSize.

730 {
731  wxString class_name;
732 
733  // @todo set validator to ensure net class name is valid rather than all of the checks
734  // after the OK button has been selected.
735  WX_TEXT_ENTRY_DIALOG dlg( this, _( "New Net Class Name:" ), wxEmptyString, class_name );
736 
737  if( dlg.ShowModal() != wxID_OK )
738  return; // canceled by user
739 
740  class_name = dlg.GetValue();
741  class_name.Trim( true );
742  class_name.Trim( false );
743 
744  if( class_name.IsEmpty() )
745  return; // empty name not allowed
746 
747  // The name must dot exists:
748  for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
749  {
750  wxString value;
751  value = m_grid->GetRowLabelValue( ii );
752 
753  if( class_name.CmpNoCase( value ) == 0 ) // Already exists!
754  {
755  DisplayError( this, _( "Duplicate net class names are not allowed." ) );
756  return;
757  }
758  }
759 
760  m_grid->AppendRows();
761  m_grid->SetRowLabelValue( m_grid->GetNumberRows() - 1, class_name );
762 
763  // Copy values of the default class:
764  int irow = m_grid->GetNumberRows() - 1;
765 
766  for( int icol = 0; icol < m_grid->GetNumberCols(); icol++ )
767  {
768  wxString value;
769  value = m_grid->GetCellValue( 0, icol );
770  m_grid->SetCellValue( irow, icol, value );
771  }
772 
774 
776 }
static void EnsureGridRowTitleWidth(wxWindow *aShower, wxGrid *aGrid, int aMinWidth)
int m_initialRowLabelsSize
the initial width given by wxFormBuilder
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
void DIALOG_DESIGN_RULES::OnAllowMicroVias ( wxCommandEvent &  event)
overrideprivatevirtual

Function OnAllowMicroVias is called whenever the AllowMicroVias checkbox is toggled.

Reimplemented from DIALOG_DESIGN_RULES_BASE.

Definition at line 844 of file dialog_design_rules.cpp.

References CheckAllowMicroVias().

845 {
847 }
void DIALOG_DESIGN_RULES::OnLeftCBSelection ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_DESIGN_RULES_BASE.

Definition at line 887 of file dialog_design_rules.cpp.

References FillListBoxWithNetNames(), DIALOG_DESIGN_RULES_BASE::m_buttonLeftToRight, DIALOG_DESIGN_RULES_BASE::m_buttonRightToLeft, DIALOG_DESIGN_RULES_BASE::m_leftClassChoice, DIALOG_DESIGN_RULES_BASE::m_leftListCtrl, and DIALOG_DESIGN_RULES_BASE::m_rightClassChoice.

888 {
889  FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
890 
891  if( m_leftClassChoice->GetStringSelection() == m_rightClassChoice->GetStringSelection() )
892  {
893  m_buttonRightToLeft->Enable( false );
894  m_buttonLeftToRight->Enable( false );
895  }
896  else
897  {
898  m_buttonRightToLeft->Enable( true );
899  m_buttonLeftToRight->Enable( true );
900  }
901 }
void FillListBoxWithNetNames(NETS_LIST_CTRL *aListCtrl, const wxString &aNetClass)
Function FillListBoxWithNetNames populates aListCtrl with net names and class names from m_AllNets in...
void DIALOG_DESIGN_RULES::OnLeftSelectAllButton ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_DESIGN_RULES_BASE.

Definition at line 966 of file dialog_design_rules.cpp.

References DIALOG_DESIGN_RULES_BASE::m_leftListCtrl.

967 {
968  for( int ii = 0; ii < m_leftListCtrl->GetItemCount(); ii++ )
969  m_leftListCtrl->SetItemState( ii, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
970 }
void DIALOG_DESIGN_RULES::OnLeftToRightCopyButton ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_DESIGN_RULES_BASE.

Definition at line 955 of file dialog_design_rules.cpp.

References FillListBoxWithNetNames(), DIALOG_DESIGN_RULES_BASE::m_leftClassChoice, DIALOG_DESIGN_RULES_BASE::m_leftListCtrl, DIALOG_DESIGN_RULES_BASE::m_rightClassChoice, DIALOG_DESIGN_RULES_BASE::m_rightListCtrl, and moveSelectedItems().

956 {
957  wxString newClassName = m_rightClassChoice->GetStringSelection();
958 
959  moveSelectedItems( m_leftListCtrl, newClassName );
960 
961  FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
963 }
void moveSelectedItems(NETS_LIST_CTRL *src, const wxString &newClassName)
void FillListBoxWithNetNames(NETS_LIST_CTRL *aListCtrl, const wxString &aNetClass)
Function FillListBoxWithNetNames populates aListCtrl with net names and class names from m_AllNets in...
void DIALOG_DESIGN_RULES::OnMoveUpSelectedNetClass ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_DESIGN_RULES_BASE.

Definition at line 849 of file dialog_design_rules.cpp.

References InitializeRulesSelectionBoxes(), and DIALOG_DESIGN_RULES_BASE::m_grid.

850 {
851  // Cannot move up rules if we have 1 or 2 rules only
852  if( m_grid->GetNumberRows() < 3 )
853  return;
854 
855  wxArrayInt select = m_grid->GetSelectedRows();
856  bool reinit = false;
857 
858  for( unsigned irow = 0; irow < select.GetCount(); irow++ )
859  {
860  int ii = select[irow];
861  if( ii < 2 ) // The default netclass *must* be the first netclass
862  continue; // so we cannot move up line 0 and 1
863 
864  // Swap the rule and the previous rule
865  wxString curr_value, previous_value;
866 
867  for( int icol = 0; icol < m_grid->GetNumberCols(); icol++ )
868  {
869  reinit = true;
870  curr_value = m_grid->GetCellValue( ii, icol );
871  previous_value = m_grid->GetCellValue( ii - 1, icol );
872  m_grid->SetCellValue( ii, icol, previous_value );
873  m_grid->SetCellValue( ii - 1, icol, curr_value );
874  }
875 
876  curr_value = m_grid->GetRowLabelValue( ii );
877  previous_value = m_grid->GetRowLabelValue( ii - 1 );
878  m_grid->SetRowLabelValue( ii, previous_value );
879  m_grid->SetRowLabelValue( ii - 1, curr_value );
880  }
881 
882  if( reinit )
884 }
void DIALOG_DESIGN_RULES::OnNetClassesNameLeftClick ( wxGridEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from DIALOG_DESIGN_RULES_BASE.

Definition at line 94 of file dialog_design_rules.h.

94 { event.Skip(); }
void DIALOG_DESIGN_RULES::OnNetClassesNameRightClick ( wxGridEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from DIALOG_DESIGN_RULES_BASE.

Definition at line 95 of file dialog_design_rules.h.

95 { event.Skip(); }
void DIALOG_DESIGN_RULES::OnNotebookPageChanged ( wxNotebookEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_DESIGN_RULES_BASE.

Definition at line 690 of file dialog_design_rules.cpp.

References s_LastTabSelection.

691 {
692  s_LastTabSelection = event.GetSelection();
693 
694  // Skip() allows OSX to properly refresh controls.
695  event.Skip();
696 }
static int s_LastTabSelection
which tab user had open last
void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 271 of file dialog_shim.cpp.

References DIALOG_SHIM::m_fixupsRun, and recursiveDescent().

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

272 {
273  if( !m_fixupsRun )
274  {
275 #if DLGSHIM_SELECT_ALL_IN_TEXT_CONTROLS
276  const bool selectAllInTextCtrls = true;
277 #else
278  const bool selectAllInTextCtrls = false;
279 #endif
280  wxWindow* firstTextCtrl = NULL;
281  wxWindow* windowWithFocus = NULL;
282 
283  recursiveDescent( GetChildren(), selectAllInTextCtrls, firstTextCtrl,
284  windowWithFocus );
285 
286 #if DLGSHIM_USE_SETFOCUS
287  // While it would be nice to honour any focus already set (which was
288  // recorded in windowWithFocus), the reality is that it's currently wrong
289  // far more often than it's right.
290  // So just focus on the first text control if we have one; otherwise the
291  // focus on the dialog itself, which will at least allow esc, return, etc.
292  // to function.
293  if( firstTextCtrl )
294  firstTextCtrl->SetFocus();
295  else
296  SetFocus();
297 #endif
298 
299 #ifdef __WXMAC__
300  fixOSXCancelButtonIssue( this );
301 #endif
302 
303  m_fixupsRun = true;
304  }
305 
306  event.Skip();
307 }
static void recursiveDescent(wxWindowList &children, const bool selectTextInTextCtrls, wxWindow *&firstTextCtrl, wxWindow *&windowWithFocus)
bool m_fixupsRun
Definition: dialog_shim.h:149
void DIALOG_DESIGN_RULES::OnRemoveNetclassClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_DESIGN_RULES_BASE.

Definition at line 787 of file dialog_design_rules.cpp.

References NETCLASS::Default, EnsureGridRowTitleWidth(), InitializeRulesSelectionBoxes(), DIALOG_DESIGN_RULES_BASE::m_grid, m_initialRowLabelsSize, sort_int(), and swapNetClass().

788 {
789  wxArrayInt select = m_grid->GetSelectedRows();
790 
791  // Sort selection by decreasing index order:
792  select.Sort( sort_int );
793  bool reinit = false;
794 
795  // rows labels are not removed when deleting rows: they are not deleted.
796  // So we must store them, remove corresponding labels and reinit them
797  wxArrayString labels;
798 
799  for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
800  labels.Add( m_grid->GetRowLabelValue( ii ) );
801 
802  // Delete rows from last to first (this is the order wxArrayInt select after sorting) )
803  // This order is Ok when removing rows
804  for( unsigned ii = 0; ii < select.GetCount(); ii++ )
805  {
806  int grid_row = select[ii];
807 
808  if( grid_row != 0 ) // Do not remove the default class
809  {
810  wxString classname = m_grid->GetRowLabelValue( grid_row );
811  m_grid->DeleteRows( grid_row );
812  labels.RemoveAt( grid_row ); // Remove corresponding row label
813  reinit = true;
814 
815  // reset the net class to default for members of the removed class
816  swapNetClass( classname, NETCLASS::Default );
817  }
818  else
819  wxMessageBox( _( "The default net class cannot be removed" ) );
820  }
821 
822  if( reinit )
823  {
824  // Reinit labels :
825  for( unsigned ii = 1; ii < labels.GetCount(); ii++ )
826  m_grid->SetRowLabelValue( ii, labels[ii] );
827 
830  }
831 }
static void EnsureGridRowTitleWidth(wxWindow *aShower, wxGrid *aGrid, int aMinWidth)
void swapNetClass(const wxString &oldClass, const wxString &newClass)
Function swapNetClass replaces one net class name with another in the master list, m_AllNets.
int sort_int(int *first, int *second)
static const char Default[]
the name of the default NETCLASS
Definition: netclass.h:90
int m_initialRowLabelsSize
the initial width given by wxFormBuilder
void DIALOG_DESIGN_RULES::OnRightCBSelection ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_DESIGN_RULES_BASE.

Definition at line 904 of file dialog_design_rules.cpp.

References FillListBoxWithNetNames(), DIALOG_DESIGN_RULES_BASE::m_buttonLeftToRight, DIALOG_DESIGN_RULES_BASE::m_buttonRightToLeft, DIALOG_DESIGN_RULES_BASE::m_leftClassChoice, DIALOG_DESIGN_RULES_BASE::m_rightClassChoice, and DIALOG_DESIGN_RULES_BASE::m_rightListCtrl.

905 {
907 
908  if( m_leftClassChoice->GetStringSelection() == m_rightClassChoice->GetStringSelection() )
909  {
910  m_buttonRightToLeft->Enable( false );
911  m_buttonLeftToRight->Enable( false );
912  }
913  else
914  {
915  m_buttonRightToLeft->Enable( true );
916  m_buttonLeftToRight->Enable( true );
917  }
918 }
void FillListBoxWithNetNames(NETS_LIST_CTRL *aListCtrl, const wxString &aNetClass)
Function FillListBoxWithNetNames populates aListCtrl with net names and class names from m_AllNets in...
void DIALOG_DESIGN_RULES::OnRightSelectAllButton ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_DESIGN_RULES_BASE.

Definition at line 973 of file dialog_design_rules.cpp.

References DIALOG_DESIGN_RULES_BASE::m_rightListCtrl.

974 {
975  for( int ii = 0; ii < m_rightListCtrl->GetItemCount(); ii++ )
976  m_rightListCtrl->SetItemState( ii, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
977 }
void DIALOG_DESIGN_RULES::OnRightToLeftCopyButton ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_DESIGN_RULES_BASE.

Definition at line 944 of file dialog_design_rules.cpp.

References FillListBoxWithNetNames(), DIALOG_DESIGN_RULES_BASE::m_leftClassChoice, DIALOG_DESIGN_RULES_BASE::m_leftListCtrl, DIALOG_DESIGN_RULES_BASE::m_rightClassChoice, DIALOG_DESIGN_RULES_BASE::m_rightListCtrl, and moveSelectedItems().

945 {
946  wxString newClassName = m_leftClassChoice->GetStringSelection();
947 
948  moveSelectedItems( m_rightListCtrl, newClassName );
949 
950  FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
952 }
void moveSelectedItems(NETS_LIST_CTRL *src, const wxString &newClassName)
void FillListBoxWithNetNames(NETS_LIST_CTRL *aListCtrl, const wxString &aNetClass)
Function FillListBoxWithNetNames populates aListCtrl with net names and class names from m_AllNets in...
PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

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

Definition at line 34 of file kiway_holder.cpp.

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

Referenced by SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), DIALOG_FOOTPRINT_FP_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile(), DIALOG_SYMBOL_LIB_TABLE::browseLibrariesHandler(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkNewAlias(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), 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_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), LIB_EDIT_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), DIALOG_FOOTPRINT_FP_EDITOR::Edit3DShapeFileName(), DIALOG_FOOTPRINT_BOARD_EDITOR::Edit3DShapeFileName(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::Files_io_from_id(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), FOOTPRINT_EDIT_FRAME::GetCurrentLib(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), FOOTPRINT_EDIT_FRAME::getLibPath(), LIB_EDIT_FRAME::getLibraryFileName(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DIALOG_BOM::getPluginFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), DIALOG_FOOTPRINT_FP_EDITOR::initModeditProperties(), DIALOG_FOOTPRINT_BOARD_EDITOR::InitModeditProperties(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), KIWAY_HOLDER::Kiway(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_GENDRILL::OnGenReportFile(), DIALOG_CHOOSE_COMPONENT::OnIdle(), SCH_EDIT_FRAME::OnImportProject(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), DIALOG_BOM::OnRunPlugin(), SCH_EDIT_FRAME::OnSaveProject(), DIALOG_CHOOSE_COMPONENT::OnSchViewPaint(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::PasteListOfItems(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_VIEW_FRAME::ReCreateHToolbar(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), LIB_VIEW_FRAME::RedrawActiveWindow(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibrary(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), EDA_3D_VIEWER::takeScreenshot(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), and DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR().

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:142
void DIALOG_DESIGN_RULES::SetDataValidators ( void  )
private

Definition at line 222 of file dialog_design_rules.cpp.

References g_UserUnit, DIALOG_DESIGN_RULES_BASE::m_SetMicroViasMinDrillCtrl, DIALOG_DESIGN_RULES_BASE::m_SetMicroViasMinSizeCtrl, DIALOG_DESIGN_RULES_BASE::m_SetTrackMinWidthCtrl, DIALOG_DESIGN_RULES_BASE::m_SetViasMinDrillCtrl, DIALOG_DESIGN_RULES_BASE::m_SetViasMinSizeCtrl, and To_User_Unit().

Referenced by DIALOG_DESIGN_RULES().

223 {
224  // Set floating-point validators for numerical inputs
225  wxFloatingPointValidator< double > fpValidator( NULL, wxNUM_VAL_ZERO_AS_BLANK | wxNUM_VAL_NO_TRAILING_ZEROES );
226 
227  int maxDimension = 1000 * IU_PER_MILS; // One-inch
228 
229  fpValidator.SetRange( 0, To_User_Unit( g_UserUnit, maxDimension ) );
230  fpValidator.SetPrecision( 10 );
231 
232  m_SetViasMinSizeCtrl->SetValidator( fpValidator );
233  m_SetViasMinDrillCtrl->SetValidator( fpValidator );
234  m_SetMicroViasMinSizeCtrl->SetValidator( fpValidator );
235  m_SetMicroViasMinDrillCtrl->SetValidator( fpValidator );
236  m_SetTrackMinWidthCtrl->SetValidator( fpValidator );
237 }
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
double To_User_Unit(EDA_UNITS_T aUnit, double aValue)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: base_units.cpp:91
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 41 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), KIWAY_HOLDER::Kiway(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

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

Definition at line 980 of file dialog_design_rules.cpp.

References i, and m_AllNets.

Referenced by moveSelectedItems().

981 {
982  for( NETCUPS::iterator i = m_AllNets.begin(); i != m_AllNets.end(); ++i )
983  {
984  if( i->net == aNetName )
985  {
986  i->clazz = aClassName;
987  break;
988  }
989  }
990 }
size_t i
Definition: json11.cpp:597
NETCUPS m_AllNets
A two column table which gets filled once and never loses any elements, so it is basically constant...
void DIALOG_DESIGN_RULES::SetRoutableLayerStatus ( )
private
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 118 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE(), HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), DIALOG_SHIM::IsQuasiModal(), DIALOG_LAYERS_SETUP::OnInitDialog(), and HTML_MESSAGE_BOX::SetDialogSizeInDU().

119 {
120  wxSize sz( x, y );
121  SetSize( ConvertDialogToPixels( sz ) );
122 }
bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 146 of file dialog_shim.cpp.

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

Referenced by DisplayHotkeyList(), DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), DIALOG_SHIM::IsQuasiModal(), DIALOG_SCH_FIND::OnCancel(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnPopupMenu(), DIALOG_EXCHANGE_FOOTPRINTS::OnQuit(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), SCH_COMPONENT::SetPosition(), DRC::ShowDRCDialog(), and DIALOG_SHIM::ShowQuasiModal().

147 {
148  bool ret;
149  const char* hash_key;
150 
151  if( m_hash_key.size() )
152  {
153  // a special case like EDA_LIST_DIALOG, which has multiple uses.
154  hash_key = m_hash_key.c_str();
155  }
156  else
157  {
158  hash_key = typeid(*this).name();
159  }
160 
161  // Show or hide the window. If hiding, save current position and size.
162  // If showing, use previous position and size.
163  if( show )
164  {
165 #ifndef __WINDOWS__
166  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
167 #endif
168  ret = wxDialog::Show( show );
169 
170  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
171  EDA_RECT savedDialogRect = class_map[ hash_key ];
172 
173  if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
174  {
175  SetSize( savedDialogRect.GetPosition().x,
176  savedDialogRect.GetPosition().y,
177  std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
178  std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
179  0 );
180  }
181 
182  // Be sure that the dialog appears in a visible area
183  // (the dialog position might have been stored at the time when it was
184  // shown on another display)
185  if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
186  Centre();
187  }
188  else
189  {
190  // Save the dialog's position & size before hiding, using classname as key
191  class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() );
192 
193 #ifdef __WXMAC__
194  if ( m_eventLoop )
195  m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
196 #endif
197 
198  ret = wxDialog::Show( show );
199  }
200 
201  return ret;
202 }
const wxSize GetSize() const
Definition: eda_rect.h:101
std::string m_hash_key
Definition: dialog_shim.h:151
static RECT_MAP class_map
const wxPoint GetPosition() const
Definition: eda_rect.h:113
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 558 of file dialog_shim.cpp.

References DBG, DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, and DIALOG_SHIM::Show().

Referenced by SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), LIB_EDIT_FRAME::InstallFieldsEditorDialog(), SCH_EDIT_FRAME::InstallHierarchyFrame(), InvokeDialogCreateBOMEditor(), InvokeDialogEditComponentsLibId(), InvokeDialogUpdateFields(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), and SCH_BASE_FRAME::SelectComponentFromLibrary().

559 {
560  // This is an exception safe way to zero a pointer before returning.
561  // Yes, even though DismissModal() clears this first normally, this is
562  // here in case there's an exception before the dialog is dismissed.
563  struct NULLER
564  {
565  void*& m_what;
566  NULLER( void*& aPtr ) : m_what( aPtr ) {}
567  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
568  } clear_this( (void*&) m_qmodal_loop );
569 
570  // release the mouse if it's currently captured as the window having it
571  // will be disabled when this dialog is shown -- but will still keep the
572  // capture making it impossible to do anything in the modal dialog itself
573  wxWindow* win = wxWindow::GetCapture();
574  if( win )
575  win->ReleaseMouse();
576 
577  // Get the optimal parent
578  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
579 
580  // Show the optimal parent
581  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
582 
583  wxASSERT_MSG( !m_qmodal_parent_disabler,
584  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
585 
586  // quasi-modal: disable only my "optimal" parent
588 
589 #ifdef __WXMAC__
590  // Apple in its infinite wisdom will raise a disabled window before even passing
591  // us the event, so we have no way to stop it. Instead, we must set an order on
592  // the windows so that the quasi-modal will be pushed in front of the disabled
593  // window when it is raised.
594  ReparentQuasiModal();
595 #endif
596  Show( true );
597 
598  m_qmodal_showing = true;
599 
600  EVENT_LOOP event_loop;
601 
602  m_qmodal_loop = &event_loop;
603 
604  event_loop.Run();
605 
606  return GetReturnCode();
607 }
bool m_qmodal_showing
Definition: dialog_shim.h:155
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:154
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:156
Toggle a window&#39;s "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:33
#define DBG(x)
Definition: fctsys.h:33
void DIALOG_DESIGN_RULES::swapNetClass ( const wxString &  oldClass,
const wxString &  newClass 
)
inlineprivate

Function swapNetClass replaces one net class name with another in the master list, m_AllNets.

Definition at line 183 of file dialog_design_rules.h.

References i.

Referenced by OnRemoveNetclassClick().

184  {
185  for( NETCUPS::iterator i = m_AllNets.begin(); i!=m_AllNets.end(); ++i )
186  {
187  if( i->clazz == oldClass )
188  i->clazz = newClass;
189  }
190  }
size_t i
Definition: json11.cpp:597
NETCUPS m_AllNets
A two column table which gets filled once and never loses any elements, so it is basically constant...
bool DIALOG_DESIGN_RULES::TestDataValidity ( wxString *  aErrorMsg = NULL)
private

Definition at line 993 of file dialog_design_rules.cpp.

References g_UserUnit, GetChars(), GRID_DIFF_PAIR_WIDTH, GRID_TRACKSIZE, GRID_uVIADRILL, GRID_uVIASIZE, GRID_VIADRILL, GRID_VIASIZE, DIALOG_DESIGN_RULES_BASE::m_grid, DIALOG_DESIGN_RULES_BASE::m_gridTrackWidthList, DIALOG_DESIGN_RULES_BASE::m_gridViaSizeList, DIALOG_DESIGN_RULES_BASE::m_SetMicroViasMinDrillCtrl, DIALOG_DESIGN_RULES_BASE::m_SetMicroViasMinSizeCtrl, DIALOG_DESIGN_RULES_BASE::m_SetTrackMinWidthCtrl, DIALOG_DESIGN_RULES_BASE::m_SetViasMinDrillCtrl, DIALOG_DESIGN_RULES_BASE::m_SetViasMinSizeCtrl, ReturnUnitSymbol(), To_User_Unit(), ValueFromString(), and ValueFromTextCtrl().

Referenced by TransferDataFromWindow().

994 {
995  bool result = true;
996 
997  wxString msg;
998  wxString errorMsg;
999 
1000  wxString netclassLabel; // Name of a given netclass
1001  wxString netclassError; // Error message particular to a given netclass
1002 
1003  wxString units = ReturnUnitSymbol( g_UserUnit, "%s" );
1004 
1005  int minViaDia = ValueFromTextCtrl( *m_SetViasMinSizeCtrl );
1006  int minViaDrill = ValueFromTextCtrl( *m_SetViasMinDrillCtrl );
1007  int minUViaDia = ValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl );
1008  int minUViaDrill = ValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl );
1009  int minTrackWidth = ValueFromTextCtrl( *m_SetTrackMinWidthCtrl );
1010  int maxval = 1000 * IU_PER_MILS; // a max value for tracks and vias sizes (1 inch)
1011 
1012  // @todo Change this code to set the focus to the control where the first error occurs
1013  // so the user doesn't have to figure out where the issue is.
1014 
1015  // Test net class parameters.
1016  for( int row = 0; row < m_grid->GetNumberRows(); row++ )
1017  {
1018  netclassLabel = GetChars( m_grid->GetRowLabelValue( row ) );
1019  netclassError.Clear(); // Clear the error for this netclass
1020 
1021  int tracksize = ValueFromString( g_UserUnit,
1022  m_grid->GetCellValue( row, GRID_TRACKSIZE ) );
1023  if( tracksize < minTrackWidth )
1024  {
1025  result = false;
1026  msg.Printf( _( " - <b>Track Size</b> (%f %s) &lt; <b>Min Track Size</b> (%f %s)<br>" ),
1027  To_User_Unit( g_UserUnit, tracksize ), units,
1028  To_User_Unit( g_UserUnit, minTrackWidth ), units );
1029 
1030  netclassError += msg;
1031  }
1032 
1033  int dpsize = ValueFromString( g_UserUnit,
1034  m_grid->GetCellValue( row, GRID_DIFF_PAIR_WIDTH ) );
1035 
1036  if( dpsize < minTrackWidth )
1037  {
1038  result = false;
1039  msg.Printf( _( " - <b>Differential Pair Size</b> (%f %s) &lt; <b>Min Track Size</b> (%f %s)<br>" ),
1040  To_User_Unit( g_UserUnit, dpsize ), units,
1041  To_User_Unit( g_UserUnit, minTrackWidth ), units );
1042  netclassError += msg;
1043  }
1044 
1045 
1046  // Test vias
1047  int viadia = ValueFromString( g_UserUnit,
1048  m_grid->GetCellValue( row, GRID_VIASIZE ) );
1049 
1050  if( viadia < minViaDia )
1051  {
1052  result = false;
1053  msg.Printf( _( " - <b>Via Diameter</b> (%f %s) &lt; <b>Minimum Via Diameter</b> (%f %s)<br>" ),
1054  To_User_Unit( g_UserUnit, viadia ), units,
1055  To_User_Unit( g_UserUnit, minViaDia ), units );
1056  netclassError += msg;
1057  }
1058 
1059  int viadrill = ValueFromString( g_UserUnit,
1060  m_grid->GetCellValue( row, GRID_VIADRILL ) );
1061 
1062  if( viadrill >= viadia )
1063  {
1064  result = false;
1065  msg.Printf( _( " - <b>Via Drill</b> (%f %s) &ge; <b>Via Dia</b> (%f %s)<br>" ),
1066  To_User_Unit( g_UserUnit, viadrill ), units,
1067  To_User_Unit( g_UserUnit, viadia ), units );
1068  netclassError += msg;
1069  }
1070 
1071  if( viadrill < minViaDrill )
1072  {
1073  result = false;
1074  msg.Printf( _( " - <b>Via Drill</b> (%f %s) &lt; <b>Min Via Drill</b> (%f %s)<br>" ),
1075  To_User_Unit( g_UserUnit, viadrill ), units,
1076  To_User_Unit( g_UserUnit, minViaDrill ), units );
1077  netclassError += msg;
1078  }
1079 
1080  // Test Micro vias
1081  int muviadia = ValueFromString( g_UserUnit,
1082  m_grid->GetCellValue( row, GRID_uVIASIZE ) );
1083 
1084  if( muviadia < minUViaDia )
1085  {
1086  result = false;
1087  msg.Printf( _( " - <b>MicroVia Diameter</b> (%f %s) &lt; <b>MicroVia Min Diameter</b> (%f %s)<br>" ),
1088  To_User_Unit( g_UserUnit, muviadia ), units,
1089  To_User_Unit( g_UserUnit, minUViaDia ), units );
1090  netclassError += msg;
1091  }
1092 
1093  int muviadrill = ValueFromString( g_UserUnit,
1094  m_grid->GetCellValue( row, GRID_uVIADRILL ) );
1095 
1096  if( muviadrill >= muviadia )
1097  {
1098  result = false;
1099  msg.Printf( _( " - <b>MicroVia Drill</b> (%f %s) &ge; <b>MicroVia Dia</b> (%f %s)<br>" ),
1100  To_User_Unit( g_UserUnit, muviadrill ), units,
1101  To_User_Unit( g_UserUnit, muviadia ), units );
1102  netclassError += msg;
1103  }
1104 
1105  if( muviadrill < minUViaDrill )
1106  {
1107  result = false;
1108  msg.Printf( _( " - <b>MicroVia Drill</b> (%f %s) &lt; <b>MicroVia Min Drill</b> (%f %s)<br>" ),
1109  To_User_Unit( g_UserUnit, muviadrill ), units,
1110  To_User_Unit( g_UserUnit, minUViaDrill ), units );
1111  netclassError += msg;
1112  }
1113 
1114  // If this netclass contains errors, add it to the error message
1115  if ( !netclassError.IsEmpty() )
1116  {
1117  msg.Printf( _( "Netclass: <b>%s</b><br>" ), netclassLabel );
1118  errorMsg += msg;
1119  errorMsg += netclassError;
1120  errorMsg += "<br>";
1121  }
1122  }
1123 
1124  // Test custom tracks
1125  for( int row = 0; row < m_gridTrackWidthList->GetNumberRows(); ++row )
1126  {
1127  wxString tvalue = m_gridTrackWidthList->GetCellValue( row, 0 );
1128 
1129  if( tvalue.IsEmpty() )
1130  continue;
1131 
1132  int tracksize = ValueFromString( g_UserUnit, tvalue );
1133 
1134  if( tracksize < minTrackWidth )
1135  {
1136  result = false;
1137  msg.Printf( _( "<b>Extra Track %d Size</b> %s &lt; <b>Min Track Size</b><br>" ),
1138  row + 1, GetChars( tvalue ) );
1139 
1140  errorMsg += msg;
1141  }
1142 
1143  if( tracksize > maxval )
1144  {
1145  result = false;
1146  msg.Printf( _( "<b>Extra Track %d Size</b> %s &gt; <b>1 inch!</b><br>" ),
1147  row + 1, GetChars( tvalue ) );
1148 
1149  errorMsg += msg;
1150  }
1151  }
1152 
1153  // Test custom vias
1154  for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row )
1155  {
1156  wxString tvalue = m_gridViaSizeList->GetCellValue( row, 0 );
1157 
1158  if( tvalue.IsEmpty() )
1159  continue;
1160 
1161  int viadia = ValueFromString( g_UserUnit, tvalue );
1162 
1163  if( viadia < minViaDia )
1164  {
1165  result = false;
1166  msg.Printf( _( "<b>Extra Via %d Size</b> %s &lt; <b>Min Via Size</b><br>" ),
1167  row + 1, GetChars( tvalue ) );
1168  errorMsg += msg;
1169  }
1170 
1171  wxString drlvalue = m_gridViaSizeList->GetCellValue( row, 1 );
1172 
1173  if( drlvalue.IsEmpty() )
1174  {
1175  result = false;
1176  msg.Printf( _( "<b>No via drill size define in row %d</b><br>" ), row + 1 );
1177  errorMsg += msg;
1178  continue;
1179  }
1180 
1181  int viadrill = ValueFromString( g_UserUnit, drlvalue );
1182 
1183  if( viadrill < minViaDrill )
1184  {
1185  result = false;
1186  msg.Printf( _( "<b>Extra Via %d Drill</b> %s &lt; <b>Min Via Drill %s</b><br>" ),
1187  row + 1, GetChars( drlvalue ),
1188  GetChars( m_SetViasMinDrillCtrl->GetValue() ) );
1189  errorMsg += msg;
1190  }
1191 
1192  if( viadia <= viadrill )
1193  {
1194  result = false;
1195  msg.Printf( _( "<b>Extra Via %d Size</b> %s &le; <b> Drill Size</b> %s<br>" ),
1196  row + 1, GetChars( tvalue ), GetChars( drlvalue ) );
1197  errorMsg += msg;
1198  }
1199 
1200  // Test for a reasonable via size:
1201  if( viadia > maxval ) // 1 inch!
1202  {
1203  result = false;
1204  msg.Printf( _( "<b>Extra Via %d Size</b>%s &gt; <b>1 inch!</b><br>" ),
1205  row + 1, GetChars( tvalue ) );
1206  errorMsg += msg;
1207  }
1208  }
1209 
1210  if( !result && aErrorMsg )
1211  *aErrorMsg = errorMsg;
1212 
1213  return result;
1214 }
wxString ReturnUnitSymbol(EDA_UNITS_T aUnit, const wxString &formatString)
Returns the units symbol.
Definition: base_units.cpp:426
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application...
Definition: base_units.cpp:370
int ValueFromTextCtrl(const wxTextCtrl &aTextCtr)
Convert the number Value in a string according to the internal units and the selected unit (g_UserUni...
Definition: base_units.cpp:386
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
double To_User_Unit(EDA_UNITS_T aUnit, double aValue)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: base_units.cpp:91
bool DIALOG_DESIGN_RULES::TransferDataFromWindow ( )
overridevirtual

Definition at line 699 of file dialog_design_rules.cpp.

References AS_ACTIVE, CopyDimensionsListsToBoard(), CopyGlobalRulesToBoard(), CopyRulesListToBoard(), NETCLASS::Default, EDA_DRAW_FRAME::GetToolManager(), m_BrdSettings, m_Parent, HTML_MESSAGE_BOX::MessageSet(), TOOL_MANAGER::ProcessEvent(), BOARD_DESIGN_SETTINGS::SetCurrentNetClass(), TA_MODEL_CHANGE, TC_COMMAND, and TestDataValidity().

700 {
701  if( !wxDialog::TransferDataFromWindow() )
702  return false;
703 
704  wxString errorMsg;
705 
706  if( !TestDataValidity( &errorMsg ) )
707  {
708  HTML_MESSAGE_BOX dlg( this, _( "Design Rule Setting Error" ) );
709  dlg.MessageSet( errorMsg );
710  dlg.ShowModal();
711  return false;
712  }
713 
718 
719  //this event causes the routing tool to reload its design rules information
720  TOOL_MANAGER* toolManager = m_Parent->GetToolManager();
722  toolManager->ProcessEvent( event );
723 
724 
725  return true;
726 }
PCB_EDIT_FRAME * m_Parent
Class TOOL_MANAGER.
Definition: tool_manager.h:49
Action belongs to a particular tool (i.e. a part of a pop-up menu)
Definition: tool_event.h:137
bool TestDataValidity(wxString *aErrorMsg=NULL)
static const char Default[]
the name of the default NETCLASS
Definition: netclass.h:90
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
Class TOOL_EVENT.
Definition: tool_event.h:162
Class HTML_MESSAGE_BOX.
TOOL_MANAGER * GetToolManager() const
Function GetToolManager returns the tool manager instance, if any.
Definition: draw_frame.h:902
BOARD_DESIGN_SETTINGS * m_BrdSettings
bool SetCurrentNetClass(const wxString &aNetClassName)
Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter ...
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 132 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_SHIM::IsQuasiModal(), and DIALOG_LAYERS_SETUP::OnInitDialog().

133 {
134  wxSize sz( 0, y );
135  return ConvertDialogToPixels( sz ).y;
136 }

Member Data Documentation

wxButton* DIALOG_DESIGN_RULES_BASE::m_addButton
protectedinherited
NETCUPS DIALOG_DESIGN_RULES::m_AllNets
private

A two column table which gets filled once and never loses any elements, so it is basically constant, except that the NETCUP::clazz member can change for any given row a NET is moved in and out of a class.

class reflects the respective NET's current net class.

Definition at line 87 of file dialog_design_rules.h.

Referenced by CopyRulesListToBoard(), InitDialogRules(), makePointers(), and setNetClass().

wxButton* DIALOG_DESIGN_RULES_BASE::m_buttonLeftSelAll
protectedinherited
wxButton* DIALOG_DESIGN_RULES_BASE::m_buttonRightSelAll
protectedinherited
wxNotebook* DIALOG_DESIGN_RULES_BASE::m_DRnotebook
protectedinherited
bool DIALOG_SHIM::m_fixupsRun
protectedinherited

Definition at line 149 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

wxGrid* DIALOG_DESIGN_RULES_BASE::m_gridTrackWidthList
protectedinherited
wxGrid* DIALOG_DESIGN_RULES_BASE::m_gridViaSizeList
protectedinherited
std::string DIALOG_SHIM::m_hash_key
protectedinherited
int DIALOG_DESIGN_RULES::m_initialRowLabelsSize
private

the initial width given by wxFormBuilder

Definition at line 77 of file dialog_design_rules.h.

Referenced by DIALOG_DESIGN_RULES(), OnAddNetclassClick(), and OnRemoveNetclassClick().

wxStaticText* DIALOG_DESIGN_RULES_BASE::m_MicroViaMinDrillTitle
protectedinherited
wxStaticText* DIALOG_DESIGN_RULES_BASE::m_MicroViaMinDrillUnits
protectedinherited
wxStaticText* DIALOG_DESIGN_RULES_BASE::m_MicroViaMinSizeTitle
protectedinherited
wxStaticText* DIALOG_DESIGN_RULES_BASE::m_MicroViaMinSizeUnits
protectedinherited
wxButton* DIALOG_DESIGN_RULES_BASE::m_moveUpButton
protectedinherited
wxCheckBox* DIALOG_DESIGN_RULES_BASE::m_OptAllowBlindBuriedVias
protectedinherited
wxCheckBox* DIALOG_DESIGN_RULES_BASE::m_OptAllowMicroVias
protectedinherited
wxPanel* DIALOG_DESIGN_RULES_BASE::m_panelGolbalDesignRules
protectedinherited
wxPanel* DIALOG_DESIGN_RULES_BASE::m_panelNetClassesEditor
protectedinherited
PCB_EDIT_FRAME* DIALOG_DESIGN_RULES::m_Parent
private
BOARD* DIALOG_DESIGN_RULES::m_Pcb
private

Definition at line 71 of file dialog_design_rules.h.

Referenced by CopyRulesListToBoard(), and InitDialogRules().

EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 154 of file dialog_shim.h.

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

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited
bool DIALOG_SHIM::m_qmodal_showing
protectedinherited
wxButton* DIALOG_DESIGN_RULES_BASE::m_removeButton
protectedinherited
wxStdDialogButtonSizer* DIALOG_DESIGN_RULES_BASE::m_sdbSizer1
protectedinherited
wxButton* DIALOG_DESIGN_RULES_BASE::m_sdbSizer1Cancel
protectedinherited
wxButton* DIALOG_DESIGN_RULES_BASE::m_sdbSizer1OK
protectedinherited
NETCLASSPTR DIALOG_DESIGN_RULES::m_SelectedNetClass
private

Definition at line 74 of file dialog_design_rules.h.

wxTextCtrl* DIALOG_DESIGN_RULES_BASE::m_SetMicroViasMinDrillCtrl
protectedinherited
wxTextCtrl* DIALOG_DESIGN_RULES_BASE::m_SetMicroViasMinSizeCtrl
protectedinherited
wxTextCtrl* DIALOG_DESIGN_RULES_BASE::m_SetTrackMinWidthCtrl
protectedinherited
wxTextCtrl* DIALOG_DESIGN_RULES_BASE::m_SetViasMinDrillCtrl
protectedinherited
wxTextCtrl* DIALOG_DESIGN_RULES_BASE::m_SetViasMinSizeCtrl
protectedinherited
wxStaticLine* DIALOG_DESIGN_RULES_BASE::m_staticline2
protectedinherited
wxStaticLine* DIALOG_DESIGN_RULES_BASE::m_staticline21
protectedinherited
wxStaticLine* DIALOG_DESIGN_RULES_BASE::m_staticline3
protectedinherited
wxStaticText* DIALOG_DESIGN_RULES_BASE::m_staticText7
protectedinherited
wxStaticText* DIALOG_DESIGN_RULES_BASE::m_staticText8
protectedinherited
wxStaticText* DIALOG_DESIGN_RULES_BASE::m_staticTextInfo
protectedinherited
wxStaticText* DIALOG_DESIGN_RULES_BASE::m_TrackMinWidthTitle
protectedinherited
wxStaticText* DIALOG_DESIGN_RULES_BASE::m_TrackMinWidthUnits
protectedinherited
std::vector<int> DIALOG_DESIGN_RULES::m_TracksWidthList
private
wxFloatingPointValidator< double > DIALOG_DESIGN_RULES::m_validator
private

Definition at line 79 of file dialog_design_rules.h.

wxStaticText* DIALOG_DESIGN_RULES_BASE::m_ViaMinDrillTitle
protectedinherited
wxStaticText* DIALOG_DESIGN_RULES_BASE::m_ViaMinDrillUnits
protectedinherited
wxStaticText* DIALOG_DESIGN_RULES_BASE::m_ViaMinTitle
protectedinherited
wxStaticText* DIALOG_DESIGN_RULES_BASE::m_ViaMinUnits
protectedinherited
std::vector<VIA_DIMENSION> DIALOG_DESIGN_RULES::m_ViasDimensionsList
private
int DIALOG_DESIGN_RULES::s_LastTabSelection = -1
staticprivate

which tab user had open last

Definition at line 76 of file dialog_design_rules.h.

Referenced by DIALOG_DESIGN_RULES(), and OnNotebookPageChanged().

const wxString DIALOG_DESIGN_RULES::wildCard = _( "* (Any)" )
staticprivate

the name of a fictitious netclass which includes all NETs

Definition at line 68 of file dialog_design_rules.h.

Referenced by InitializeRulesSelectionBoxes(), makePointers(), and moveSelectedItems().


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