KiCad PCB EDA Suite
DIALOG_TRACK_VIA_PROPERTIES Class Reference

#include <dialog_track_via_properties.h>

Inheritance diagram for DIALOG_TRACK_VIA_PROPERTIES:
DIALOG_TRACK_VIA_PROPERTIES_BASE DIALOG_SHIM KIWAY_HOLDER

Public Member Functions

 DIALOG_TRACK_VIA_PROPERTIES (PCB_BASE_FRAME *aParent, const SELECTION &aItems, COMMIT &aCommit)
 
bool TransferDataFromWindow () 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_T GetUserUnits () const override
 
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 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

wxBoxSizer * m_MainSizer
 
wxStaticBoxSizer * m_sbCommonSizer
 
wxStaticText * m_netSelectorLabel
 
NET_SELECTORm_netSelector
 
wxCheckBox * m_lockedCbox
 
wxStaticBoxSizer * m_sbTrackSizer
 
wxStaticText * m_TrackStartXLabel
 
wxTextCtrl * m_TrackStartXCtrl
 
wxStaticText * m_TrackStartXUnit
 
wxStaticText * m_TrackStartYLabel
 
wxTextCtrl * m_TrackStartYCtrl
 
wxStaticText * m_TrackStartYUnit
 
wxStaticText * m_TrackEndXLabel
 
wxTextCtrl * m_TrackEndXCtrl
 
wxStaticText * m_TrackEndXUnit
 
wxStaticText * m_TrackEndYLabel
 
wxTextCtrl * m_TrackEndYCtrl
 
wxStaticText * m_TrackEndYUnit
 
wxStaticText * m_DesignRuleWidths
 
wxChoice * m_DesignRuleWidthsCtrl
 
wxStaticText * m_DesignRuleWidthsUnits
 
wxStaticText * m_TrackWidthLabel
 
wxTextCtrl * m_TrackWidthCtrl
 
wxStaticText * m_TrackWidthUnit
 
wxCheckBox * m_trackNetclass
 
wxStaticText * m_TrackLayerLabel
 
PCB_LAYER_BOX_SELECTORm_TrackLayerCtrl
 
wxStaticBoxSizer * m_sbViaSizer
 
wxStaticText * m_ViaXLabel
 
wxTextCtrl * m_ViaXCtrl
 
wxStaticText * m_ViaXUnit
 
wxStaticText * m_ViaYLabel
 
wxTextCtrl * m_ViaYCtrl
 
wxStaticText * m_ViaYUnit
 
wxStaticText * m_DesignRuleVias
 
wxChoice * m_DesignRuleViasCtrl
 
wxStaticText * m_DesignRuleViasUnit
 
wxStaticText * m_ViaDiameterLabel
 
wxTextCtrl * m_ViaDiameterCtrl
 
wxStaticText * m_ViaDiameterUnit
 
wxStaticText * m_ViaDrillLabel
 
wxTextCtrl * m_ViaDrillCtrl
 
wxStaticText * m_ViaDrillUnit
 
wxCheckBox * m_viaNetclass
 
wxStaticText * m_ViaTypeLabel
 
wxChoice * m_ViaTypeChoice
 
wxStaticText * m_ViaStartLayerLabel
 
PCB_LAYER_BOX_SELECTORm_ViaStartLayer
 
wxStaticText * m_ViaEndLayerLabel1
 
PCB_LAYER_BOX_SELECTORm_ViaEndLayer
 
wxStdDialogButtonSizer * m_StdButtons
 
wxButton * m_StdButtonsOK
 
wxButton * m_StdButtonsCancel
 
EDA_UNITS_T 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
 

Private Member Functions

void onTrackNetclassCheck (wxCommandEvent &aEvent) override
 
void onWidthSelect (wxCommandEvent &aEvent)
 
void onWidthEdit (wxCommandEvent &aEvent)
 
void onViaNetclassCheck (wxCommandEvent &aEvent) override
 
void onViaSelect (wxCommandEvent &aEvent)
 
void onViaEdit (wxCommandEvent &aEvent)
 
bool confirmPadChange (const std::vector< D_PAD *> &connectedPads)
 

Private Attributes

PCB_BASE_FRAMEm_frame
 
const SELECTIONm_items
 
COMMITm_commit
 
UNIT_BINDER m_trackStartX
 
UNIT_BINDER m_trackStartY
 
UNIT_BINDER m_trackEndX
 
UNIT_BINDER m_trackEndY
 
UNIT_BINDER m_trackWidth
 
UNIT_BINDER m_viaX
 
UNIT_BINDER m_viaY
 
UNIT_BINDER m_viaDiameter
 
UNIT_BINDER m_viaDrill
 
bool m_tracks
 
bool m_vias
 

Detailed Description

Definition at line 36 of file dialog_track_via_properties.h.

Constructor & Destructor Documentation

◆ DIALOG_TRACK_VIA_PROPERTIES()

DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES ( PCB_BASE_FRAME aParent,
const SELECTION aItems,
COMMIT aCommit 
)

Definition at line 37 of file dialog_track_via_properties.cpp.

References LSET::AllNonCuMask(), VIA::BottomLayer(), SELECTION::Empty(), DIALOG_SHIM::FinishDialogSettings(), GetAbbreviatedUnitsLabel(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetDesignSettings(), VIA::GetDrillValue(), TRACK::GetEnd(), BOARD_ITEM::GetLayer(), LAYER_BOX_SELECTOR::GetLayerSelection(), BOARD::GetNetInfo(), VIA::GetPosition(), TRACK::GetStart(), UNIT_BINDER::GetValue(), VIA::GetViaType(), TRACK::GetWidth(), INDETERMINATE, TRACK::IsLocked(), DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleViasCtrl, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleViasUnit, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleWidthsCtrl, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleWidthsUnits, VIA_DIMENSION::m_Diameter, VIA_DIMENSION::m_Drill, m_items, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_lockedCbox, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_MainSizer, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_netSelector, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_sbTrackSizer, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_sbViaSizer, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_StdButtonsOK, m_trackEndX, m_trackEndY, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackLayerCtrl, m_tracks, m_trackStartX, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackStartXCtrl, m_trackStartY, m_trackWidth, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackWidthCtrl, BOARD_DESIGN_SETTINGS::m_TrackWidthList, DIALOG_SHIM::m_units, m_viaDiameter, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaDiameterCtrl, m_viaDrill, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaDrillCtrl, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaEndLayer, m_vias, BOARD_DESIGN_SETTINGS::m_ViasDimensionsList, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaStartLayer, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaTypeChoice, m_viaX, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaXCtrl, m_viaY, onViaEdit(), onViaSelect(), onWidthEdit(), onWidthSelect(), PCB_TRACE_T, PCB_VIA_T, PCB_LAYER_BOX_SELECTOR::Resync(), PCB_LAYER_BOX_SELECTOR::SetBoardFrame(), NET_SELECTOR::SetIndeterminate(), DIALOG_SHIM::SetInitialFocus(), LAYER_BOX_SELECTOR::SetLayerSelection(), LAYER_SELECTOR::SetLayersHotkeys(), NET_SELECTOR::SetNetInfo(), PCB_LAYER_BOX_SELECTOR::SetNotAllowedLayerSet(), NET_SELECTOR::SetSelectedNetcode(), UNIT_BINDER::SetValue(), StringFromValue(), VIA::TopLayer(), UNDEFINED_LAYER, VIA_BLIND_BURIED, VIA_MICROVIA, VIA_NOT_DEFINED, and VIA_THROUGH.

39  :
41  m_frame( aParent ),
42  m_items( aItems ),
43  m_commit( aCommit ),
53  m_tracks( false ),
54  m_vias( false )
55 {
56  wxASSERT( !m_items.Empty() );
57 
58  VIATYPE_T viaType = VIA_NOT_DEFINED;
59 
60  m_netSelector->SetNetInfo( &aParent->GetBoard()->GetNetInfo() );
61 
64  m_TrackLayerCtrl->SetBoardFrame( aParent );
66 
69  m_ViaStartLayer->SetBoardFrame( aParent );
71 
74  m_ViaEndLayer->SetBoardFrame( aParent );
76 
77  bool nets = false;
78  int net = 0;
79  bool hasLocked = false;
80  bool hasUnlocked = false;
81 
82  // Look for values that are common for every item that is selected
83  for( auto& item : m_items )
84  {
85  if( !nets )
86  {
87  net = static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNetCode();
88  nets = true;
89  }
90  else if( net != static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNetCode() )
91  {
92  net = -1;
93  }
94 
95  switch( item->Type() )
96  {
97  case PCB_TRACE_T:
98  {
99  const TRACK* t = static_cast<const TRACK*>( item );
100 
101  if( !m_tracks ) // first track in the list
102  {
103  m_trackStartX.SetValue( t->GetStart().x );
104  m_trackStartY.SetValue( t->GetStart().y );
105  m_trackEndX.SetValue( t->GetEnd().x );
106  m_trackEndY.SetValue( t->GetEnd().y );
109  m_tracks = true;
110  }
111  else // check if values are the same for every selected track
112  {
113  if( m_trackStartX.GetValue() != t->GetStart().x )
115 
116  if( m_trackStartY.GetValue() != t->GetStart().y )
118 
119  if( m_trackEndX.GetValue() != t->GetEnd().x )
121 
122  if( m_trackEndY.GetValue() != t->GetEnd().y )
124 
125  if( m_trackWidth.GetValue() != t->GetWidth() )
127 
130  }
131 
132  if( t->IsLocked() )
133  hasLocked = true;
134  else
135  hasUnlocked = true;
136 
137  break;
138  }
139 
140  case PCB_VIA_T:
141  {
142  const VIA* v = static_cast<const VIA*>( item );
143 
144  if( !m_vias ) // first via in the list
145  {
146  m_viaX.SetValue( v->GetPosition().x );
147  m_viaY.SetValue( v->GetPosition().y );
150  m_vias = true;
151  viaType = v->GetViaType();
154  }
155  else // check if values are the same for every selected via
156  {
157  if( m_viaX.GetValue() != v->GetPosition().x )
159 
160  if( m_viaY.GetValue() != v->GetPosition().y )
162 
163  if( m_viaDiameter.GetValue() != v->GetWidth() )
165 
166  if( m_viaDrill.GetValue() != v->GetDrillValue() )
168 
169  if( viaType != v->GetViaType() )
170  viaType = VIA_NOT_DEFINED;
171 
174 
177  }
178 
179  if( v->IsLocked() )
180  hasLocked = true;
181  else
182  hasUnlocked = true;
183 
184  break;
185  }
186 
187  default:
188  {
189  wxASSERT( false );
190  break;
191  }
192  }
193  }
194 
195  if ( net >= 0 )
197  else
199 
200  wxASSERT( m_tracks || m_vias );
201 
202  if( m_vias )
203  {
205 
206  int viaSelection = wxNOT_FOUND;
207 
208  for( unsigned ii = 0; ii < aParent->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
209  {
210  VIA_DIMENSION* viaDimension = &aParent->GetDesignSettings().m_ViasDimensionsList[ii];
211  wxString msg = StringFromValue( m_units, viaDimension->m_Diameter, false, true )
212  + " / " + StringFromValue( m_units, viaDimension->m_Drill, false, true );
213  m_DesignRuleViasCtrl->Append( msg, viaDimension );
214 
215  if( viaSelection == wxNOT_FOUND
216  && m_viaDiameter.GetValue() == viaDimension->m_Diameter
217  && m_viaDrill.GetValue() == viaDimension->m_Drill )
218  {
219  viaSelection = ii;
220  }
221  }
222 
223  m_DesignRuleViasCtrl->SetSelection( viaSelection );
224 
225  m_DesignRuleViasCtrl->Connect( wxEVT_CHOICE, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onViaSelect ), NULL, this );
226  m_ViaDiameterCtrl->Connect( wxEVT_TEXT, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onViaEdit ), NULL, this );
227  m_ViaDrillCtrl->Connect( wxEVT_TEXT, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onViaEdit ), NULL, this );
228  m_ViaTypeChoice->Connect( wxEVT_CHOICE, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onViaEdit ), NULL, this );
229 
231 
232  m_ViaTypeChoice->Enable();
233 
234  switch( viaType )
235  {
236  case VIA_THROUGH: m_ViaTypeChoice->SetSelection( 0 ); break;
237  case VIA_MICROVIA: m_ViaTypeChoice->SetSelection( 1 ); break;
238  case VIA_BLIND_BURIED: m_ViaTypeChoice->SetSelection( 2 ); break;
239  case VIA_NOT_DEFINED: m_ViaTypeChoice->SetSelection( 3 ); break;
240  }
241 
242  m_ViaStartLayer->Enable( viaType != VIA_THROUGH );
243  m_ViaEndLayer->Enable( viaType != VIA_THROUGH );
244  }
245  else
246  {
247  m_MainSizer->Hide( m_sbViaSizer, true );
248  }
249 
250  if( m_tracks )
251  {
253 
254  int widthSelection = wxNOT_FOUND;
255 
256  for( unsigned ii = 0; ii < aParent->GetDesignSettings().m_TrackWidthList.size(); ii++ )
257  {
258  int width = aParent->GetDesignSettings().m_TrackWidthList[ii];
259  wxString msg = StringFromValue( m_units, width, false, true );
260  m_DesignRuleWidthsCtrl->Append( msg );
261 
262  if( widthSelection == wxNOT_FOUND && m_trackWidth.GetValue() == width )
263  widthSelection = ii;
264  }
265 
266  m_DesignRuleWidthsCtrl->SetSelection( widthSelection );
267 
268  m_DesignRuleWidthsCtrl->Connect( wxEVT_CHOICE, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onWidthSelect ), NULL, this );
269  m_TrackWidthCtrl->Connect( wxEVT_TEXT, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onWidthEdit ), NULL, this );
270 
272  }
273  else
274  {
275  m_MainSizer->Hide( m_sbTrackSizer, true );
276  }
277 
278  if( hasLocked && hasUnlocked )
279  m_lockedCbox->Set3StateValue( wxCHK_UNDETERMINED );
280  else if( hasLocked )
281  m_lockedCbox->Set3StateValue( wxCHK_CHECKED );
282  else
283  m_lockedCbox->Set3StateValue( wxCHK_UNCHECKED );
284 
286 
287  m_StdButtonsOK->SetDefault();
288 
289  // Now all widgets have the size fixed, call FinishDialogSettings
291 }
bool IsLocked() const override
Function IsLocked.
Definition: class_track.h:141
Struct VIA_DIMENSION is a small helper container to handle a stock of specific vias each with unique ...
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
std::vector< int > m_TrackWidthList
void SetNotAllowedLayerSet(LSET aMask)
const wxPoint & GetStart() const
Definition: class_track.h:126
static LSET AllNonCuMask()
Function AllNonCuMask returns a mask holding all layer minus CU layers.
Definition: lset.cpp:699
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
void onWidthSelect(wxCommandEvent &aEvent)
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
VIATYPE_T
Definition: class_track.h:50
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
DIALOG_TRACK_VIA_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Track & Via Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU)
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:116
void onWidthEdit(wxCommandEvent &aEvent)
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
LAYER_NUM GetLayerSelection() const
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
#define INDETERMINATE
void SetSelectedNetcode(int aNetcode)
VIATYPE_T GetViaType() const
Definition: class_track.h:461
int SetLayerSelection(LAYER_NUM layer)
void SetNetInfo(NETINFO_LIST *aNetInfoList)
bool SetLayersHotkeys(bool value)
NETINFO_LIST & GetNetInfo()
Definition: class_board.h:756
const wxPoint GetPosition() const override
Definition: class_track.h:433
void onViaSelect(wxCommandEvent &aEvent)
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:116
void onViaEdit(wxCommandEvent &aEvent)
void SetIndeterminate()
int GetWidth() const
Definition: class_track.h:120
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
PCB_LAYER_ID TopLayer() const
const wxPoint & GetEnd() const
Definition: class_track.h:123
std::vector< VIA_DIMENSION > m_ViasDimensionsList
wxString StringFromValue(EDA_UNITS_T aUnits, int aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:210
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
BOARD * GetBoard() const
EDA_UNITS_T m_units
Definition: dialog_shim.h:173
PCB_LAYER_ID BottomLayer() const
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit, bool aUseMils)
Get the units string for a given units type.
Definition: base_units.cpp:432

Member Function Documentation

◆ confirmPadChange()

bool DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange ( const std::vector< D_PAD *> &  connectedPads)
private

Definition at line 294 of file dialog_track_via_properties.cpp.

References KIDIALOG::DoNotShowCheckbox(), D_PAD::GetName(), D_PAD::GetParent(), MODULE::GetReference(), DIALOG_TRACK_VIA_PROPERTIES_BASE::m_netSelector, and KIDIALOG::ShowModal().

Referenced by TransferDataFromWindow().

295 {
296  wxString msg;
297 
298  if( changingPads.size() == 1 )
299  {
300  D_PAD* pad = *changingPads.begin();
301  msg.Printf( _( "This will change the net assigned to %s pad %s to %s.\n"
302  "Do you wish to continue?" ),
303  pad->GetParent()->GetReference(),
304  pad->GetName(),
305  m_netSelector->GetValue() );
306  }
307  else if( changingPads.size() == 2 )
308  {
309  D_PAD* pad1 = *changingPads.begin();
310  D_PAD* pad2 = *( ++changingPads.begin() );
311  msg.Printf( _( "This will change the net assigned to %s pad %s and %s pad %s to %s.\n"
312  "Do you wish to continue?" ),
313  pad1->GetParent()->GetReference(),
314  pad1->GetName(),
315  pad2->GetParent()->GetReference(),
316  pad2->GetName(),
317  m_netSelector->GetValue() );
318  }
319  else
320  {
321  msg.Printf( _( "This will change the net assigned to %d connected pads to %s.\n"
322  "Do you wish to continue?" ),
323  changingPads.size(),
324  m_netSelector->GetValue() );
325  }
326 
327  KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
328  dlg.SetOKLabel( _( "Continue" ) );
329  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
330 
331  return dlg.ShowModal() == wxID_OK;
332 }
Helper class to create more flexible dialogs, including &#39;do not show again&#39; checkbox handling...
Definition: confirm.h:44
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:462
const wxString & GetName() const
Definition: class_pad.h:190
MODULE * GetParent() const
Definition: class_pad.h:162

◆ Enable()

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 230 of file dialog_shim.cpp.

231 {
232  // so we can do logging of this state change:
233 
234 #if defined(DEBUG)
235  const char* type_id = typeid( *this ).name();
236  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
237 #endif
238 
239  return wxDialog::Enable( enable );
240 }

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 390 of file dialog_shim.cpp.

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

Referenced by HK_PROMPT_DIALOG::EndFlexible(), DIALOG_SHIM::OnButton(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_COMPONENT::OnUseBrowser(), and DIALOG_SHIM::~DIALOG_SHIM().

391 {
392  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
393  // handle validation in the same way as other dialogs.
394  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
395  return;
396 
397  SetReturnCode( retCode );
398 
399  if( !IsQuasiModal() )
400  {
401  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
402  return;
403  }
404 
405  if( m_qmodal_loop )
406  {
407  if( m_qmodal_loop->IsRunning() )
408  m_qmodal_loop->Exit( 0 );
409  else
410  m_qmodal_loop->ScheduleExit( 0 );
411 
412  m_qmodal_loop = NULL;
413  }
414 
417 
418  Show( false );
419 }
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:183
bool IsQuasiModal()
Definition: dialog_shim.h:125
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:185

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

References PCAD2KICAD::Center.

Referenced by DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), 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_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXIT::DIALOG_EXIT(), 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_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS(), DIALOG_FP_BROWSER_DISPLAY_OPTIONS::DIALOG_FP_BROWSER_DISPLAY_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_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), 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_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_NET_FROM_LIST::DIALOG_SELECT_NET_FROM_LIST(), DIALOG_SET_GRID::DIALOG_SET_GRID(), 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_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), PAGED_DIALOG::finishInitialization(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), and DIALOG_COLOR_PICKER::TransferDataToWindow().

130 {
131  // must be called from the constructor of derived classes,
132  // when all widgets are initialized, and therefore their size fixed
133 
134  // SetSizeHints fixes the minimal size of sizers in the dialog
135  // (SetSizeHints calls Fit(), so no need to call it)
136  GetSizer()->SetSizeHints( this );
137 
138  // the default position, when calling the first time the dlg
139  Center();
140 }

◆ GetUserUnits()

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

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

151 {
152  wxSize sz( x, 0 );
153  return ConvertDialogToPixels( sz ).x;
154 }

◆ IsQuasiModal()

◆ 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 60 of file kiway_player.h.

References KIWAY_HOLDER::m_kiway.

Referenced by TREEPROJECT_ITEM::Activate(), PCB_BASE_EDIT_FRAME::AddLibrary(), SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), CVPCB_MAINFRAME::CreateScreenCmp(), SCH_EDIT_FRAME::CreateScreens(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), SCH_EDIT_FRAME::doUpdatePcb(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::KiwayMailIn(), KIWAY_PLAYER::language_change(), KICAD_MANAGER_FRAME::language_change(), 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(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), KICAD_MANAGER_FRAME::OnEditFpLibTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnEditSymLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnOpenPcbModuleEditor(), SCH_EDIT_FRAME::OnOpenPcbnew(), KICAD_MANAGER_FRAME::OnRunPcbFpEditor(), KICAD_MANAGER_FRAME::OnRunSchLibEditor(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), 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(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::rescueProject(), KICAD_MANAGER_FRAME::RunEeschema(), KICAD_MANAGER_FRAME::RunPcbNew(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), 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(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), EDA_BASE_FRAME::ShowPreferences(), 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:94

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 292 of file dialog_shim.cpp.

References DIALOG_SHIM::m_firstPaintEvent, and DIALOG_SHIM::m_initialFocusTarget.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

293 {
294  if( m_firstPaintEvent )
295  {
296 #ifdef __WXMAC__
297  fixOSXCancelButtonIssue( this );
298  selectAllInTextCtrls( GetChildren() );
299 #endif
300 
302  m_initialFocusTarget->SetFocus();
303  else
304  SetFocus(); // Focus the dialog itself
305 
306  m_firstPaintEvent = false;
307  }
308 
309  event.Skip();
310 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:180
bool m_firstPaintEvent
Definition: dialog_shim.h:179

◆ onTrackNetclassCheck()

void DIALOG_TRACK_VIA_PROPERTIES::onTrackNetclassCheck ( wxCommandEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_TRACK_VIA_PROPERTIES_BASE.

Definition at line 545 of file dialog_track_via_properties.cpp.

References UNIT_BINDER::Enable(), DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleWidths, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleWidthsCtrl, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleWidthsUnits, and m_trackWidth.

546 {
547  bool enableNC = aEvent.IsChecked();
548 
549  m_DesignRuleWidths->Enable( !enableNC );
550  m_DesignRuleWidthsCtrl->Enable( !enableNC );
551  m_DesignRuleWidthsUnits->Enable( !enableNC );
552 
553  m_trackWidth.Enable( !enableNC );
554 }
void Enable(bool aEnable)
Function Enable Enables/diasables the label, widget and units label.

◆ onViaEdit()

void DIALOG_TRACK_VIA_PROPERTIES::onViaEdit ( wxCommandEvent &  aEvent)
private

Definition at line 591 of file dialog_track_via_properties.cpp.

References B_Cu, F_Cu, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleViasCtrl, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaEndLayer, m_vias, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaStartLayer, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaTypeChoice, and LAYER_BOX_SELECTOR::SetLayerSelection().

Referenced by DIALOG_TRACK_VIA_PROPERTIES().

592 {
593  m_DesignRuleViasCtrl->SetSelection( wxNOT_FOUND );
594 
595  if( m_vias )
596  {
597  if( m_ViaTypeChoice->GetSelection() != 0 ) // check if selected type isnt through.
598  {
599  m_ViaStartLayer->Enable();
600  m_ViaEndLayer->Enable();
601  }
602  else
603  {
606 
607  m_ViaStartLayer->Enable( false );
608  m_ViaEndLayer->Enable( false );
609  }
610  }
611 }
int SetLayerSelection(LAYER_NUM layer)

◆ onViaNetclassCheck()

void DIALOG_TRACK_VIA_PROPERTIES::onViaNetclassCheck ( wxCommandEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_TRACK_VIA_PROPERTIES_BASE.

Definition at line 569 of file dialog_track_via_properties.cpp.

References UNIT_BINDER::Enable(), DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleVias, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleViasCtrl, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleViasUnit, m_viaDiameter, and m_viaDrill.

570 {
571  bool enableNC = aEvent.IsChecked();
572 
573  m_DesignRuleVias->Enable( !enableNC );
574  m_DesignRuleViasCtrl->Enable( !enableNC );
575  m_DesignRuleViasUnit->Enable( !enableNC );
576 
577  m_viaDiameter.Enable( !enableNC );
578  m_viaDrill.Enable( !enableNC );
579 }
void Enable(bool aEnable)
Function Enable Enables/diasables the label, widget and units label.

◆ onViaSelect()

void DIALOG_TRACK_VIA_PROPERTIES::onViaSelect ( wxCommandEvent &  aEvent)
private

Definition at line 582 of file dialog_track_via_properties.cpp.

References UNIT_BINDER::ChangeValue(), VIA_DIMENSION::m_Diameter, VIA_DIMENSION::m_Drill, m_viaDiameter, and m_viaDrill.

Referenced by DIALOG_TRACK_VIA_PROPERTIES().

583 {
584  VIA_DIMENSION* viaDimension = static_cast<VIA_DIMENSION*> ( aEvent.GetClientData() );
585 
586  m_viaDiameter.ChangeValue( viaDimension->m_Diameter );
587  m_viaDrill.ChangeValue( viaDimension->m_Drill );
588 }
Struct VIA_DIMENSION is a small helper container to handle a stock of specific vias each with unique ...
virtual void ChangeValue(int aValue)
Function ChangeValue Changes the value (in Internal Units) for the text field, taking care of units c...

◆ onWidthEdit()

void DIALOG_TRACK_VIA_PROPERTIES::onWidthEdit ( wxCommandEvent &  aEvent)
private

Definition at line 563 of file dialog_track_via_properties.cpp.

References DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleWidthsCtrl.

Referenced by DIALOG_TRACK_VIA_PROPERTIES().

564 {
565  m_DesignRuleWidthsCtrl->SetSelection( wxNOT_FOUND );
566 }

◆ onWidthSelect()

void DIALOG_TRACK_VIA_PROPERTIES::onWidthSelect ( wxCommandEvent &  aEvent)
private

◆ Prj()

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 PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), 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_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::doUpdatePcb(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), SCH_EDIT_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnConfigurePaths(), FOOTPRINT_EDIT_FRAME::OnConfigurePaths(), KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLoadProject(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), SCH_EDIT_FRAME::OnOpenPcbModuleEditor(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), SCH_EDIT_FRAME::OnPrint(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), KICAD_MANAGER_FRAME::OnRunGerbview(), DIALOG_BOM::OnRunPlugin(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), KICAD_MANAGER_FRAME::OnSaveProject(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::PrintPage(), SCH_EDIT_FRAME::Process_Config(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SCH_EDIT_FRAME::RescueLegacyProject(), SCH_EDIT_FRAME::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), 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(), SCH_EDIT_FRAME::SaveProject(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), KICAD_MANAGER_FRAME::SetProjectFileName(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), 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().

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

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

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_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), 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_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_SET_GRID::DIALOG_SET_GRID(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_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(), and LIB_EDIT_FRAME::savePartAs().

117  {
118  m_initialFocusTarget = aWindow;
119  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:180

◆ 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 47 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by InvokePcbLibTableEditor(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

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

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

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

144 {
145  wxSize sz( x, y );
146  SetSize( ConvertDialogToPixels( sz ) );
147 }

◆ Show()

bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 171 of file dialog_shim.cpp.

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

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_SCH_FIND::OnCancel(), SCH_EDIT_FRAME::OnFindItems(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), DIALOG_SHIM::ShowQuasiModal(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

172 {
173  bool ret;
174  const char* hash_key;
175 
176  if( m_hash_key.size() )
177  {
178  // a special case like EDA_LIST_DIALOG, which has multiple uses.
179  hash_key = m_hash_key.c_str();
180  }
181  else
182  {
183  hash_key = typeid(*this).name();
184  }
185 
186  // Show or hide the window. If hiding, save current position and size.
187  // If showing, use previous position and size.
188  if( show )
189  {
190 #ifndef __WINDOWS__
191  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
192 #endif
193  ret = wxDialog::Show( show );
194 
195  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
196  EDA_RECT savedDialogRect = class_map[ hash_key ];
197 
198  if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
199  {
200  SetSize( savedDialogRect.GetPosition().x,
201  savedDialogRect.GetPosition().y,
202  std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
203  std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
204  0 );
205  }
206 
207  // Be sure that the dialog appears in a visible area
208  // (the dialog position might have been stored at the time when it was
209  // shown on another display)
210  if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
211  Centre();
212  }
213  else
214  {
215  // Save the dialog's position & size before hiding, using classname as key
216  class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() );
217 
218 #ifdef __WXMAC__
219  if ( m_eventLoop )
220  m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
221 #endif
222 
223  ret = wxDialog::Show( show );
224  }
225 
226  return ret;
227 }
std::string m_hash_key
Definition: dialog_shim.h:174
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
const wxSize GetSize() const
Definition: eda_rect.h:101

◆ ShowQuasiModal()

int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 336 of file dialog_shim.cpp.

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

Referenced by SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), SCH_EDIT_FRAME::InstallHierarchyFrame(), PCB_BASE_FRAME::InstallPadOptionsFrame(), InvokeDialogEditComponentsLibId(), InvokeDialogUpdateFields(), LIB_EDIT_FRAME::OnEditComponentProperties(), PCB_EDIT_FRAME::OnEditTracksAndVias(), SCH_EDIT_FRAME::OnLaunchBomManager(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), EDIT_TOOL::Properties(), SCH_BASE_FRAME::SelectComponentFromLibTree(), and PCB_BASE_FRAME::SelectFootprintFromLibTree().

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

◆ TransferDataFromWindow()

bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow ( )
override

Definition at line 335 of file dialog_track_via_properties.cpp.

References confirmPadChange(), DisplayError(), EOT, GEOMETRY_MIN_SIZE, PCB_BASE_FRAME::GetBoard(), BOARD::GetConnectivity(), TRACK::GetEnd(), LAYER_BOX_SELECTOR::GetLayerSelection(), BOARD_CONNECTED_ITEM::GetNetClass(), VIA::GetPosition(), NET_SELECTOR::GetSelectedNetcode(), TRACK::GetStart(), UNIT_BINDER::GetValue(), VIA::GetViaType(), NET_SELECTOR::IsIndeterminate(), UNIT_BINDER::IsIndeterminate(), m_commit, m_frame, m_items, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_lockedCbox, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_netSelector, m_trackEndX, m_trackEndY, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackLayerCtrl, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_trackNetclass, m_tracks, m_trackStartX, m_trackStartY, m_trackWidth, m_viaDiameter, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaDiameterCtrl, m_viaDrill, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaDrillCtrl, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaEndLayer, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_viaNetclass, m_vias, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaStartLayer, DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaTypeChoice, m_viaX, m_viaY, COMMIT::Modify(), PCB_MODULE_T, PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, COMMIT::Push(), VIA::SanitizeLayers(), VIA::SetBottomLayer(), VIA::SetDrill(), TRACK::SetEnd(), BOARD_ITEM::SetLayer(), TRACK::SetLocked(), BOARD_CONNECTED_ITEM::SetNetCode(), VIA::SetPosition(), TRACK::SetStart(), VIA::SetTopLayer(), VIA::SetViaType(), TRACK::SetWidth(), UNDEFINED_LAYER, UNIT_BINDER::Validate(), VIA_BLIND_BURIED, VIA_MICROVIA, and VIA_THROUGH.

336 {
337  auto connectivity = m_frame->GetBoard()->GetConnectivity();
338  int newNetCode = m_netSelector->GetSelectedNetcode();
339  std::vector<D_PAD*> changingPads;
340 
341  if ( !m_netSelector->IsIndeterminate() )
342  {
343  std::set<D_PAD*> connectedPads;
344 
345  for( auto& item : m_items )
346  {
347  const KICAD_T ourTypes[] = { PCB_TRACE_T, PCB_PAD_T, PCB_VIA_T, PCB_MODULE_T, EOT };
348  auto connectedItems = connectivity->GetConnectedItems( static_cast<BOARD_CONNECTED_ITEM*>( item ), ourTypes, true );
349  for ( auto citem : connectedItems )
350  {
351  if( citem->Type() == PCB_PAD_T )
352  {
353  connectedPads.insert( static_cast<D_PAD*>( citem ) );
354  }
355  }
356  }
357 
358  for( D_PAD* pad : connectedPads )
359  {
360  if( pad->GetNetCode() != newNetCode )
361  changingPads.push_back( pad );
362  }
363  }
364 
365  // Run validations:
366 
367  if( changingPads.size() )
368  {
369  if( !confirmPadChange( changingPads ) )
370  return false;
371  }
372 
373  if( m_vias )
374  {
375  if( !m_viaDiameter.Validate( GEOMETRY_MIN_SIZE, INT_MAX )
376  || !m_viaDrill.Validate( GEOMETRY_MIN_SIZE, INT_MAX ) )
377  return false;
378 
379  if( m_ViaDiameterCtrl->IsEnabled() && !m_viaDiameter.IsIndeterminate()
380  && m_ViaDrillCtrl->IsEnabled() && !m_viaDrill.IsIndeterminate()
382  {
383  DisplayError( GetParent(), _( "Via drill size must be smaller than via diameter" ) );
384  m_ViaDrillCtrl->SelectAll();
385  m_ViaDrillCtrl->SetFocus();
386  return false;
387  }
388 
391  {
392  DisplayError( GetParent(), _( "Via start layer and end layer cannot be the same" ) );
393  return false;
394  }
395  }
396 
397  if( m_tracks )
398  {
399  if( !m_trackWidth.Validate( GEOMETRY_MIN_SIZE, INT_MAX ) )
400  return false;
401  }
402 
403  // If we survived that, then save the changes:
404 
405  bool changeLock = m_lockedCbox->Get3StateValue() != wxCHK_UNDETERMINED;
406  bool setLock = m_lockedCbox->Get3StateValue() == wxCHK_CHECKED;
407 
408  for( auto item : m_items )
409  {
410  m_commit.Modify( item );
411 
412  switch( item->Type() )
413  {
414  case PCB_TRACE_T:
415  {
416  wxASSERT( m_tracks );
417  TRACK* t = static_cast<TRACK*>( item );
418 
420  t->SetStart( wxPoint( m_trackStartX.GetValue(), t->GetStart().y ) );
421 
423  t->SetStart( wxPoint( t->GetStart().x, m_trackStartY.GetValue() ) );
424 
426  t->SetEnd( wxPoint( m_trackEndX.GetValue(), t->GetEnd().y ) );
427 
429  t->SetEnd( wxPoint( t->GetEnd().x, m_trackEndY.GetValue() ) );
430 
431  if( m_trackNetclass->IsChecked() )
432  t->SetWidth( t->GetNetClass()->GetTrackWidth() );
433  else if( !m_trackWidth.IsIndeterminate() )
435 
437 
438  if( layer != UNDEFINED_LAYER )
439  t->SetLayer( (PCB_LAYER_ID) layer );
440 
441  if( changeLock )
442  t->SetLocked( setLock );
443 
444  if ( !m_netSelector->IsIndeterminate() )
446 
447  break;
448  }
449 
450  case PCB_VIA_T:
451  {
452  wxASSERT( m_vias );
453  VIA* v = static_cast<VIA*>( item );
454 
455  if( !m_viaX.IsIndeterminate() )
456  v->SetPosition( wxPoint( m_viaX.GetValue(), v->GetPosition().y ) );
457 
458  if( !m_viaY.IsIndeterminate() )
459  v->SetPosition( wxPoint( v->GetPosition().x, m_viaY.GetValue() ) );
460 
461  if( m_ViaTypeChoice->GetSelection() != 3)
462  {
463  switch( m_ViaTypeChoice->GetSelection() )
464  {
465  default:
466  case 0: v->SetViaType( VIA_THROUGH ); v->SanitizeLayers(); break;
467  case 1: v->SetViaType( VIA_MICROVIA ); break;
468  case 2: v->SetViaType( VIA_BLIND_BURIED ); break;
469  }
470  }
471 
472  auto startLayer = static_cast<PCB_LAYER_ID>( m_ViaStartLayer->GetLayerSelection() );
473  auto endLayer = static_cast<PCB_LAYER_ID>( m_ViaEndLayer->GetLayerSelection() );
474 
475  if (startLayer != UNDEFINED_LAYER )
476  v->SetTopLayer( startLayer );
477 
478  if (endLayer != UNDEFINED_LAYER )
479  v->SetBottomLayer( endLayer );
480 
481  v->SanitizeLayers();
482 
483  if( m_viaNetclass->IsChecked() )
484  {
485  switch( v->GetViaType() )
486  {
487  default:
488  wxFAIL_MSG("Unhandled via type");
489  // fall through
490 
491  case VIA_THROUGH:
492  case VIA_BLIND_BURIED:
493  v->SetWidth( v->GetNetClass()->GetViaDiameter() );
494  v->SetDrill( v->GetNetClass()->GetViaDrill() );
495  break;
496 
497  case VIA_MICROVIA:
498  v->SetWidth( v->GetNetClass()->GetuViaDiameter() );
499  v->SetDrill( v->GetNetClass()->GetuViaDrill() );
500  break;
501  }
502  }
503  else
504  {
507 
508  if( !m_viaDrill.IsIndeterminate() )
509  v->SetDrill( m_viaDrill.GetValue() );
510  }
511 
512  if ( !m_netSelector->IsIndeterminate() )
514 
515  if( changeLock )
516  v->SetLocked( setLock );
517 
518  break;
519  }
520 
521  default:
522  wxASSERT( false );
523  break;
524  }
525  }
526 
527  if ( !m_netSelector->IsIndeterminate() )
528  {
529  // Commit::Push() will rebuild connectivitiy propagating nets from connected pads
530  // outwards. We therefore have to update the connected pads in order for the net
531  // change to "stick".
532  for( D_PAD* pad : changingPads )
533  {
534  m_commit.Modify( pad );
535  pad->SetNetCode( m_netSelector->GetSelectedNetcode() );
536  }
537  }
538 
539  m_commit.Push( _( "Edit track/via properties" ) );
540 
541  return true;
542 }
COMMIT & Modify(EDA_ITEM *aItem)
Modifies a given item in the model.
Definition: commit.h:103
void SetViaType(VIATYPE_T aViaType)
Definition: class_track.h:462
void SetPosition(const wxPoint &aPoint) override
Definition: class_track.h:434
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void SetEnd(const wxPoint &aEnd)
Definition: class_track.h:122
const wxPoint & GetStart() const
Definition: class_track.h:126
virtual bool Validate(int aMin, int aMax, bool setFocusOnError=true)
Function Validate Validates the control against the given range, informing the user of any errors fou...
int GetSelectedNetcode()
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
bool IsIndeterminate() const
Function IsIndeterminate Returns true if the control holds the indeterminate value (for instance...
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
void SetWidth(int aWidth)
Definition: class_track.h:119
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
LAYER_NUM GetLayerSelection() const
class MODULE, a footprint
Definition: typeinfo.h:89
void SetLocked(bool aLocked) override
Function SetLocked modifies &#39;lock&#39; status for of the item.
Definition: class_track.h:146
PCB_LAYER_ID
A quick note on layer IDs:
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:297
bool IsIndeterminate()
VIATYPE_T GetViaType() const
Definition: class_track.h:461
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
const wxPoint GetPosition() const override
Definition: class_track.h:433
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true)=0
Executes the changes.
bool confirmPadChange(const std::vector< D_PAD *> &connectedPads)
void SetTopLayer(PCB_LAYER_ID aLayer)
std::shared_ptr< NETCLASS > GetNetClass() const
Function GetNetClass returns the NETCLASS for this item.
void SetDrill(int aDrill)
Function SetDrill sets the drill value for vias.
Definition: class_track.h:469
const wxPoint & GetEnd() const
Definition: class_track.h:123
void SetBottomLayer(PCB_LAYER_ID aLayer)
void SetStart(const wxPoint &aStart)
Definition: class_track.h:125
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
BOARD * GetBoard() const
#define GEOMETRY_MIN_SIZE
Definition: class_track.h:64
void SanitizeLayers()
Function SanitizeLayers Check so that the layers are correct dependin on the type of via...
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245

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

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

158 {
159  wxSize sz( 0, y );
160  return ConvertDialogToPixels( sz ).y;
161 }

Member Data Documentation

◆ m_commit

COMMIT& DIALOG_TRACK_VIA_PROPERTIES::m_commit
private

Definition at line 56 of file dialog_track_via_properties.h.

Referenced by TransferDataFromWindow().

◆ m_DesignRuleVias

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleVias
protectedinherited

◆ m_DesignRuleViasCtrl

wxChoice* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleViasCtrl
protectedinherited

◆ m_DesignRuleViasUnit

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleViasUnit
protectedinherited

◆ m_DesignRuleWidths

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleWidths
protectedinherited

◆ m_DesignRuleWidthsCtrl

wxChoice* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleWidthsCtrl
protectedinherited

◆ m_DesignRuleWidthsUnits

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_DesignRuleWidthsUnits
protectedinherited

◆ m_firstPaintEvent

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 179 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

◆ m_frame

PCB_BASE_FRAME* DIALOG_TRACK_VIA_PROPERTIES::m_frame
private

Definition at line 54 of file dialog_track_via_properties.h.

Referenced by TransferDataFromWindow().

◆ m_hash_key

◆ m_initialFocusTarget

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 180 of file dialog_shim.h.

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

◆ m_items

const SELECTION& DIALOG_TRACK_VIA_PROPERTIES::m_items
private

◆ m_lockedCbox

wxCheckBox* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_lockedCbox
protectedinherited

◆ m_MainSizer

wxBoxSizer* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_MainSizer
protectedinherited

◆ m_netSelector

NET_SELECTOR* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_netSelector
protectedinherited

◆ m_netSelectorLabel

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_netSelectorLabel
protectedinherited

◆ m_qmodal_loop

WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

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

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

◆ m_sbCommonSizer

wxStaticBoxSizer* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_sbCommonSizer
protectedinherited

◆ m_sbTrackSizer

wxStaticBoxSizer* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_sbTrackSizer
protectedinherited

◆ m_sbViaSizer

wxStaticBoxSizer* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_sbViaSizer
protectedinherited

◆ m_StdButtons

wxStdDialogButtonSizer* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_StdButtons
protectedinherited

◆ m_StdButtonsCancel

wxButton* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_StdButtonsCancel
protectedinherited

◆ m_StdButtonsOK

wxButton* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_StdButtonsOK
protectedinherited

◆ m_trackEndX

UNIT_BINDER DIALOG_TRACK_VIA_PROPERTIES::m_trackEndX
private

◆ m_TrackEndXCtrl

wxTextCtrl* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackEndXCtrl
protectedinherited

◆ m_TrackEndXLabel

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackEndXLabel
protectedinherited

◆ m_TrackEndXUnit

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackEndXUnit
protectedinherited

◆ m_trackEndY

UNIT_BINDER DIALOG_TRACK_VIA_PROPERTIES::m_trackEndY
private

◆ m_TrackEndYCtrl

wxTextCtrl* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackEndYCtrl
protectedinherited

◆ m_TrackEndYLabel

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackEndYLabel
protectedinherited

◆ m_TrackEndYUnit

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackEndYUnit
protectedinherited

◆ m_TrackLayerCtrl

PCB_LAYER_BOX_SELECTOR* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackLayerCtrl
protectedinherited

◆ m_TrackLayerLabel

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackLayerLabel
protectedinherited

◆ m_trackNetclass

wxCheckBox* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_trackNetclass
protectedinherited

◆ m_tracks

bool DIALOG_TRACK_VIA_PROPERTIES::m_tracks
private

◆ m_trackStartX

UNIT_BINDER DIALOG_TRACK_VIA_PROPERTIES::m_trackStartX
private

◆ m_TrackStartXCtrl

wxTextCtrl* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackStartXCtrl
protectedinherited

◆ m_TrackStartXLabel

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackStartXLabel
protectedinherited

◆ m_TrackStartXUnit

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackStartXUnit
protectedinherited

◆ m_trackStartY

UNIT_BINDER DIALOG_TRACK_VIA_PROPERTIES::m_trackStartY
private

◆ m_TrackStartYCtrl

wxTextCtrl* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackStartYCtrl
protectedinherited

◆ m_TrackStartYLabel

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackStartYLabel
protectedinherited

◆ m_TrackStartYUnit

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackStartYUnit
protectedinherited

◆ m_trackWidth

UNIT_BINDER DIALOG_TRACK_VIA_PROPERTIES::m_trackWidth
private

◆ m_TrackWidthCtrl

wxTextCtrl* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackWidthCtrl
protectedinherited

◆ m_TrackWidthLabel

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackWidthLabel
protectedinherited

◆ m_TrackWidthUnit

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_TrackWidthUnit
protectedinherited

◆ m_units

◆ m_viaDiameter

UNIT_BINDER DIALOG_TRACK_VIA_PROPERTIES::m_viaDiameter
private

◆ m_ViaDiameterCtrl

wxTextCtrl* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaDiameterCtrl
protectedinherited

◆ m_ViaDiameterLabel

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaDiameterLabel
protectedinherited

◆ m_ViaDiameterUnit

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaDiameterUnit
protectedinherited

◆ m_viaDrill

UNIT_BINDER DIALOG_TRACK_VIA_PROPERTIES::m_viaDrill
private

◆ m_ViaDrillCtrl

wxTextCtrl* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaDrillCtrl
protectedinherited

◆ m_ViaDrillLabel

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaDrillLabel
protectedinherited

◆ m_ViaDrillUnit

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaDrillUnit
protectedinherited

◆ m_ViaEndLayer

◆ m_ViaEndLayerLabel1

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaEndLayerLabel1
protectedinherited

◆ m_viaNetclass

wxCheckBox* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_viaNetclass
protectedinherited

◆ m_vias

bool DIALOG_TRACK_VIA_PROPERTIES::m_vias
private

◆ m_ViaStartLayer

PCB_LAYER_BOX_SELECTOR* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaStartLayer
protectedinherited

◆ m_ViaStartLayerLabel

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaStartLayerLabel
protectedinherited

◆ m_ViaTypeChoice

wxChoice* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaTypeChoice
protectedinherited

◆ m_ViaTypeLabel

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaTypeLabel
protectedinherited

◆ m_viaX

UNIT_BINDER DIALOG_TRACK_VIA_PROPERTIES::m_viaX
private

◆ m_ViaXCtrl

wxTextCtrl* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaXCtrl
protectedinherited

◆ m_ViaXLabel

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaXLabel
protectedinherited

◆ m_ViaXUnit

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaXUnit
protectedinherited

◆ m_viaY

UNIT_BINDER DIALOG_TRACK_VIA_PROPERTIES::m_viaY
private

◆ m_ViaYCtrl

wxTextCtrl* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaYCtrl
protectedinherited

◆ m_ViaYLabel

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaYLabel
protectedinherited

◆ m_ViaYUnit

wxStaticText* DIALOG_TRACK_VIA_PROPERTIES_BASE::m_ViaYUnit
protectedinherited

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