KiCad PCB EDA Suite
dialog_track_via_properties.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015 CERN
5  * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
6  * @author Maciej Suminski <maciej.suminski@cern.ch>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #include <core/kicad_algo.h>
28 #include <pcb_layer_box_selector.h>
30 #include <board_design_settings.h>
31 #include <footprint.h>
32 #include <pad.h>
33 #include <pcb_track.h>
34 #include <pcb_edit_frame.h>
35 #include <confirm.h>
37 #include <board_commit.h>
38 #include <macros.h>
39 
41  const PCB_SELECTION& aItems,
42  COMMIT& aCommit ) :
44  m_frame( aParent ),
45  m_items( aItems ),
46  m_commit( aCommit ),
47  m_trackStartX( aParent, m_TrackStartXLabel, m_TrackStartXCtrl, m_TrackStartXUnit ),
48  m_trackStartY( aParent, m_TrackStartYLabel, m_TrackStartYCtrl, m_TrackStartYUnit ),
49  m_trackEndX( aParent, m_TrackEndXLabel, m_TrackEndXCtrl, m_TrackEndXUnit ),
50  m_trackEndY( aParent, m_TrackEndYLabel, m_TrackEndYCtrl, m_TrackEndYUnit ),
51  m_trackWidth( aParent, m_TrackWidthLabel, m_TrackWidthCtrl, m_TrackWidthUnit ),
52  m_viaX( aParent, m_ViaXLabel, m_ViaXCtrl, m_ViaXUnit ),
53  m_viaY( aParent, m_ViaYLabel, m_ViaYCtrl, m_ViaYUnit ),
54  m_viaDiameter( aParent, m_ViaDiameterLabel, m_ViaDiameterCtrl, m_ViaDiameterUnit ),
55  m_viaDrill( aParent, m_ViaDrillLabel, m_ViaDrillCtrl, m_ViaDrillUnit ),
56  m_tracks( false ),
57  m_vias( false )
58 {
59  m_useCalculatedSize = true;
60 
61  wxASSERT( !m_items.Empty() );
62 
63  // Configure display origin transforms
70 
71  VIATYPE viaType = VIATYPE::NOT_DEFINED;
72 
75  m_TrackLayerCtrl->SetBoardFrame( aParent );
77 
80  m_ViaStartLayer->SetBoardFrame( aParent );
82 
85  m_ViaEndLayer->SetBoardFrame( aParent );
87 
88  bool nets = false;
89  int net = 0;
90  bool hasLocked = false;
91  bool hasUnlocked = false;
92 
93  // Look for values that are common for every item that is selected
94  for( EDA_ITEM* item : m_items )
95  {
96  if( !nets )
97  {
98  net = static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNetCode();
99  nets = true;
100  }
101  else if( net != static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNetCode() )
102  {
103  net = -1;
104  }
105 
106  switch( item->Type() )
107  {
108  case PCB_TRACE_T:
109  case PCB_ARC_T:
110  {
111  const PCB_TRACK* t = static_cast<const PCB_TRACK*>( item );
112 
113  if( !m_tracks ) // first track in the list
114  {
115  m_trackStartX.SetValue( t->GetStart().x );
116  m_trackStartY.SetValue( t->GetStart().y );
117  m_trackEndX.SetValue( t->GetEnd().x );
118  m_trackEndY.SetValue( t->GetEnd().y );
121  m_tracks = true;
122  }
123  else // check if values are the same for every selected track
124  {
125  if( m_trackStartX.GetValue() != t->GetStart().x )
127 
128  if( m_trackStartY.GetValue() != t->GetStart().y )
130 
131  if( m_trackEndX.GetValue() != t->GetEnd().x )
133 
134  if( m_trackEndY.GetValue() != t->GetEnd().y )
136 
137  if( m_trackWidth.GetValue() != t->GetWidth() )
139 
141  {
145  }
146  }
147 
148  if( t->IsLocked() )
149  hasLocked = true;
150  else
151  hasUnlocked = true;
152 
153  break;
154  }
155 
156  case PCB_VIA_T:
157  {
158  const PCB_VIA* v = static_cast<const PCB_VIA*>( item );
159 
160  if( !m_vias ) // first via in the list
161  {
162  m_viaX.SetValue( v->GetPosition().x );
163  m_viaY.SetValue( v->GetPosition().y );
166  m_vias = true;
167  viaType = v->GetViaType();
170  m_viaNotFree->SetValue( !v->GetIsFree() );
171  }
172  else // check if values are the same for every selected via
173  {
174  if( m_viaX.GetValue() != v->GetPosition().x )
176 
177  if( m_viaY.GetValue() != v->GetPosition().y )
179 
180  if( m_viaDiameter.GetValue() != v->GetWidth() )
182 
183  if( m_viaDrill.GetValue() != v->GetDrillValue() )
185 
186  if( viaType != v->GetViaType() )
187  viaType = VIATYPE::NOT_DEFINED;
188 
189  if( v->GetIsFree() != !m_viaNotFree->GetValue() )
190  m_viaNotFree->Set3StateValue( wxCHK_UNDETERMINED );
191 
193  {
197  }
198 
200  {
204  }
205  }
206 
207  if( v->IsLocked() )
208  hasLocked = true;
209  else
210  hasUnlocked = true;
211 
212  break;
213  }
214 
215  default:
216  {
217  wxASSERT( false );
218  break;
219  }
220  }
221  }
222 
223  m_netSelector->SetBoard( aParent->GetBoard() );
224  m_netSelector->SetNetInfo( &aParent->GetBoard()->GetNetInfo() );
225 
226  if ( net >= 0 )
227  {
229  }
230  else
231  {
234  }
235 
236  wxASSERT( m_tracks || m_vias );
237 
238  if( m_vias )
239  {
240  if( m_viaNotFree->GetValue() )
241  {
242  m_netSelectorLabel->Disable();
243  m_netSelector->Disable();
244  }
245 
247 
248  int viaSelection = wxNOT_FOUND;
249 
250  // 0 is the netclass place-holder
251  for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
252  {
253  VIA_DIMENSION* viaDimension = &aParent->GetDesignSettings().m_ViasDimensionsList[ii];
254  wxString msg = StringFromValue( m_units, viaDimension->m_Diameter, false )
255  + " / " + StringFromValue( m_units, viaDimension->m_Drill, false );
256  m_DesignRuleViasCtrl->Append( msg, viaDimension );
257 
258  if( viaSelection == wxNOT_FOUND
259  && m_viaDiameter.GetValue() == viaDimension->m_Diameter
260  && m_viaDrill.GetValue() == viaDimension->m_Drill )
261  {
262  viaSelection = ii;
263  }
264  }
265 
266  m_DesignRuleViasCtrl->SetSelection( viaSelection );
267 
269 
270  m_ViaTypeChoice->Enable();
271 
272  switch( viaType )
273  {
274  case VIATYPE::THROUGH:
275  m_ViaTypeChoice->SetSelection( 0 );
276  break;
277  case VIATYPE::MICROVIA:
278  m_ViaTypeChoice->SetSelection( 1 );
279  break;
281  m_ViaTypeChoice->SetSelection( 2 );
282  break;
284  m_ViaTypeChoice->SetSelection( wxNOT_FOUND );
285  break;
286  }
287 
288  m_ViaStartLayer->Enable( viaType != VIATYPE::THROUGH );
289  m_ViaEndLayer->Enable( viaType != VIATYPE::THROUGH );
290  }
291  else
292  {
293  m_viaNotFree->Hide();
294  m_MainSizer->Hide( m_sbViaSizer, true );
295  }
296 
297  if( m_tracks )
298  {
300 
301  int widthSelection = wxNOT_FOUND;
302 
303  // 0 is the netclass place-holder
304  for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_TrackWidthList.size(); ii++ )
305  {
306  int width = aParent->GetDesignSettings().m_TrackWidthList[ii];
307  wxString msg = StringFromValue( m_units, width, false );
308  m_DesignRuleWidthsCtrl->Append( msg );
309 
310  if( widthSelection == wxNOT_FOUND && m_trackWidth.GetValue() == width )
311  widthSelection = ii - 1;
312  }
313 
314  m_DesignRuleWidthsCtrl->SetSelection( widthSelection );
315 
317  }
318  else
319  {
320  m_MainSizer->Hide( m_sbTrackSizer, true );
321  }
322 
323  if( hasLocked && hasUnlocked )
324  m_lockedCbox->Set3StateValue( wxCHK_UNDETERMINED );
325  else if( hasLocked )
326  m_lockedCbox->Set3StateValue( wxCHK_CHECKED );
327  else
328  m_lockedCbox->Set3StateValue( wxCHK_UNCHECKED );
329 
331 
332  m_StdButtonsOK->SetDefault();
333 
334  // Now all widgets have the size fixed, call FinishDialogSettings
336 }
337 
338 
339 bool DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange( const std::vector<PAD*>& changingPads )
340 {
341  wxString msg;
342 
343  if( changingPads.size() == 1 )
344  {
345  PAD* pad = *changingPads.begin();
346  msg.Printf( _( "Changing the net will also update %s pad %s to %s." ),
347  pad->GetParent()->GetReference(),
348  pad->GetName(),
349  m_netSelector->GetValue() );
350  }
351  else if( changingPads.size() == 2 )
352  {
353  PAD* pad1 = *changingPads.begin();
354  PAD* pad2 = *( ++changingPads.begin() );
355  msg.Printf( _( "Changing the net will also update %s pad %s and %s pad %s to %s." ),
356  pad1->GetParent()->GetReference(),
357  pad1->GetName(),
358  pad2->GetParent()->GetReference(),
359  pad2->GetName(),
360  m_netSelector->GetValue() );
361  }
362  else
363  {
364  msg.Printf( _( "Changing the net will also update %lu connected pads to %s." ),
365  static_cast<unsigned long>( changingPads.size() ),
366  m_netSelector->GetValue() );
367  }
368 
369  KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
370  dlg.SetOKCancelLabels( _( "Change Nets" ), _( "Leave Nets Unchanged" ) );
371  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
372 
373  return dlg.ShowModal() == wxID_OK;
374 }
375 
376 
378 {
379  // Run validations:
380 
381  if( m_vias )
382  {
383  if( !m_viaDiameter.Validate( GEOMETRY_MIN_SIZE, INT_MAX )
384  || !m_viaDrill.Validate( GEOMETRY_MIN_SIZE, INT_MAX ) )
385  return false;
386 
387  if( m_ViaDiameterCtrl->IsEnabled() && !m_viaDiameter.IsIndeterminate()
388  && m_ViaDrillCtrl->IsEnabled() && !m_viaDrill.IsIndeterminate()
390  {
391  DisplayError( GetParent(), _( "Via hole size must be smaller than via diameter" ) );
392  m_ViaDrillCtrl->SelectAll();
393  m_ViaDrillCtrl->SetFocus();
394  return false;
395  }
396 
399  {
400  DisplayError( GetParent(), _( "Via start layer and end layer cannot be the same" ) );
401  return false;
402  }
403  }
404 
405  if( m_tracks )
406  {
407  if( !m_trackWidth.Validate( GEOMETRY_MIN_SIZE, INT_MAX ) )
408  return false;
409  }
410 
411  // If we survived that, then save the changes:
412  //
413  // We don't bother with updating the nets at this point as it will be useless (any connected
414  // pads will simply drive their existing nets back onto the track segments and vias).
415 
416  bool changeLock = m_lockedCbox->Get3StateValue() != wxCHK_UNDETERMINED;
417  bool setLock = m_lockedCbox->Get3StateValue() == wxCHK_CHECKED;
418 
419  for( EDA_ITEM* item : m_items )
420  {
421  m_commit.Modify( item );
422 
423  switch( item->Type() )
424  {
425  case PCB_TRACE_T:
426  case PCB_ARC_T:
427  {
428  wxASSERT( m_tracks );
429  PCB_TRACK* t = static_cast<PCB_TRACK*>( item );
430 
432  t->SetStart( wxPoint( m_trackStartX.GetValue(), t->GetStart().y ) );
433 
435  t->SetStart( wxPoint( t->GetStart().x, m_trackStartY.GetValue() ) );
436 
438  t->SetEnd( wxPoint( m_trackEndX.GetValue(), t->GetEnd().y ) );
439 
441  t->SetEnd( wxPoint( t->GetEnd().x, m_trackEndY.GetValue() ) );
442 
443  if( m_trackNetclass->IsChecked() )
444  t->SetWidth( t->GetNetClass()->GetTrackWidth() );
445  else if( !m_trackWidth.IsIndeterminate() )
447 
449 
450  if( layer != UNDEFINED_LAYER )
451  t->SetLayer( (PCB_LAYER_ID) layer );
452 
453  if( changeLock )
454  t->SetLocked( setLock );
455 
456  break;
457  }
458 
459  case PCB_VIA_T:
460  {
461  wxASSERT( m_vias );
462  PCB_VIA* v = static_cast<PCB_VIA*>( item );
463 
464  if( !m_viaX.IsIndeterminate() )
465  v->SetPosition( wxPoint( m_viaX.GetValue(), v->GetPosition().y ) );
466 
467  if( !m_viaY.IsIndeterminate() )
468  v->SetPosition( wxPoint( v->GetPosition().x, m_viaY.GetValue() ) );
469 
470  if( m_viaNotFree->Get3StateValue() != wxCHK_UNDETERMINED )
471  v->SetIsFree( !m_viaNotFree->GetValue() );
472 
473  switch( m_ViaTypeChoice->GetSelection() )
474  {
475  case 0:
477  v->SanitizeLayers();
478  break;
479  case 1:
481  break;
482  case 2:
484  break;
485  default:
486  break;
487  }
488 
489  auto startLayer = static_cast<PCB_LAYER_ID>( m_ViaStartLayer->GetLayerSelection() );
490  auto endLayer = static_cast<PCB_LAYER_ID>( m_ViaEndLayer->GetLayerSelection() );
491 
492  if (startLayer != UNDEFINED_LAYER )
493  v->SetTopLayer( startLayer );
494 
495  if (endLayer != UNDEFINED_LAYER )
496  v->SetBottomLayer( endLayer );
497 
498  v->SanitizeLayers();
499 
500  if( m_viaNetclass->IsChecked() )
501  {
502  switch( v->GetViaType() )
503  {
504  default:
505  wxFAIL_MSG( "Unhandled via type" );
507 
508  case VIATYPE::THROUGH:
510  v->SetWidth( v->GetNetClass()->GetViaDiameter() );
511  v->SetDrill( v->GetNetClass()->GetViaDrill() );
512  break;
513 
514  case VIATYPE::MICROVIA:
515  v->SetWidth( v->GetNetClass()->GetuViaDiameter() );
516  v->SetDrill( v->GetNetClass()->GetuViaDrill() );
517  break;
518  }
519  }
520  else
521  {
524 
525  if( !m_viaDrill.IsIndeterminate() )
526  v->SetDrill( m_viaDrill.GetValue() );
527  }
528 
529  if( changeLock )
530  v->SetLocked( setLock );
531 
532  break;
533  }
534 
535  default:
536  wxASSERT( false );
537  break;
538  }
539  }
540 
541  m_commit.Push( _( "Edit track/via properties" ) );
542 
543  // Pushing the commit will have updated the connectivity so we can now test to see if we
544  // need to update any pad nets.
545 
546  auto connectivity = m_frame->GetBoard()->GetConnectivity();
547  int newNetCode = m_netSelector->GetSelectedNetcode();
548  bool updateNets = false;
549  std::vector<PAD*> changingPads;
550 
551  if ( !m_netSelector->IsIndeterminate() )
552  {
553  updateNets = true;
554 
555  for( EDA_ITEM* item : m_items )
556  {
557  const KICAD_T ourTypes[] = { PCB_TRACE_T, PCB_PAD_T, PCB_VIA_T, PCB_FOOTPRINT_T, EOT };
558  BOARD_CONNECTED_ITEM* boardItem = static_cast<BOARD_CONNECTED_ITEM*>( item );
559  auto connectedItems = connectivity->GetConnectedItems( boardItem, ourTypes, true );
560 
561  for ( BOARD_CONNECTED_ITEM* citem : connectedItems )
562  {
563  if( citem->Type() == PCB_PAD_T )
564  {
565  PAD* pad = static_cast<PAD*>( citem );
566 
567  if( pad->GetNetCode() != newNetCode && !alg::contains( changingPads, citem ) )
568  changingPads.push_back( pad );
569  }
570  }
571  }
572  }
573 
574  if( changingPads.size() && !confirmPadChange( changingPads ) )
575  updateNets = false;
576 
577  if( updateNets )
578  {
579  for( EDA_ITEM* item : m_items )
580  {
581  m_commit.Modify( item );
582 
583  switch( item->Type() )
584  {
585  case PCB_TRACE_T:
586  case PCB_ARC_T:
587  static_cast<PCB_TRACK*>( item )->SetNetCode( newNetCode );
588  break;
589 
590  case PCB_VIA_T:
591  static_cast<PCB_VIA*>( item )->SetNetCode( newNetCode );
592  break;
593 
594  default:
595  wxASSERT( false );
596  break;
597  }
598  }
599 
600  for( PAD* pad : changingPads )
601  {
602  m_commit.Modify( pad );
603  pad->SetNetCode( newNetCode );
604  }
605 
606  m_commit.Push( _( "Updating nets" ) );
607  }
608 
609  return true;
610 }
611 
612 
614 {
615  m_netSelectorLabel->Enable( !m_viaNotFree->GetValue() );
616  m_netSelector->Enable( !m_viaNotFree->GetValue() );
617 }
618 
619 
621 {
622  bool enableNC = aEvent.IsChecked();
623 
624  m_DesignRuleWidths->Enable( !enableNC );
625  m_DesignRuleWidthsCtrl->Enable( !enableNC );
626  m_DesignRuleWidthsUnits->Enable( !enableNC );
627 
628  m_trackWidth.Enable( !enableNC );
629 }
630 
631 
632 void DIALOG_TRACK_VIA_PROPERTIES::onWidthSelect( wxCommandEvent& aEvent )
633 {
634  m_TrackWidthCtrl->ChangeValue( m_DesignRuleWidthsCtrl->GetStringSelection() );
635  m_TrackWidthCtrl->SelectAll();
636 }
637 
638 
639 void DIALOG_TRACK_VIA_PROPERTIES::onWidthEdit( wxCommandEvent& aEvent )
640 {
641  m_DesignRuleWidthsCtrl->SetStringSelection( m_TrackWidthCtrl->GetValue() );
642 }
643 
644 
646 {
647  bool enableNC = aEvent.IsChecked();
648 
649  m_DesignRuleVias->Enable( !enableNC );
650  m_DesignRuleViasCtrl->Enable( !enableNC );
651  m_DesignRuleViasUnit->Enable( !enableNC );
652 
653  m_viaDiameter.Enable( !enableNC );
654  m_viaDrill.Enable( !enableNC );
655 }
656 
657 
658 void DIALOG_TRACK_VIA_PROPERTIES::onViaSelect( wxCommandEvent& aEvent )
659 {
660  VIA_DIMENSION* viaDimension = static_cast<VIA_DIMENSION*> ( aEvent.GetClientData() );
661 
662  m_viaDiameter.ChangeValue( viaDimension->m_Diameter );
663  m_viaDrill.ChangeValue( viaDimension->m_Drill );
664 }
665 
666 
667 void DIALOG_TRACK_VIA_PROPERTIES::onViaEdit( wxCommandEvent& aEvent )
668 {
669  m_DesignRuleViasCtrl->SetSelection( wxNOT_FOUND );
670 
671  if( m_vias )
672  {
673  if( m_ViaTypeChoice->GetSelection() != 0 ) // check if selected type isn't through.
674  {
675  m_ViaStartLayer->Enable();
676  m_ViaEndLayer->Enable();
677  }
678  else
679  {
682 
683  m_ViaStartLayer->Enable( false );
684  m_ViaEndLayer->Enable( false );
685  }
686  }
687 }
#define GEOMETRY_MIN_SIZE
Definition: pcb_track.h:72
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:247
void SetIndeterminateString(const wxString &aString)
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
COMMIT & Modify(EDA_ITEM *aItem)
Create an undo entry for an item that has been already modified.
Definition: commit.h:103
void DoNotShowCheckbox(wxString file, int line)
Checks the 'do not show again' setting for the dialog.
Definition: confirm.cpp:55
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
void SetBottomLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:455
void onTrackNetclassCheck(wxCommandEvent &aEvent) override
wxPoint GetPosition() const override
Definition: pcb_track.h:392
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: confirm.h:45
const wxPoint & GetEnd() const
Definition: pcb_track.h:105
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:192
This file is part of the common library.
void onWidthSelect(wxCommandEvent &aEvent) override
std::vector< int > m_TrackWidthList
void SetDrill(int aDrill)
Function SetDrill sets the drill value for vias.
Definition: pcb_track.h:455
void SetNotAllowedLayerSet(LSET aMask)
void SetEnd(const wxPoint &aEnd)
Definition: pcb_track.h:104
VIATYPE GetViaType() const
Definition: pcb_track.h:354
void SetBoard(BOARD *aBoard)
virtual NETCLASS * GetNetClass() const
Return the NETCLASS for this item.
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
Definition: lset.cpp:773
void onViaEdit(wxCommandEvent &aEvent) override
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
void SetPosition(const wxPoint &aPoint) override
Definition: pcb_track.h:393
Represent a set of changes (additions, deletions or modifications) of a data model (e....
Definition: commit.h:71
int GetSelectedNetcode()
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:684
class PAD, a pad in a footprint
Definition: typeinfo.h:89
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
wxString GetAbbreviatedUnitsLabel(EDA_UNITS aUnit, EDA_DATA_TYPE aType)
Get the units string for a given units type.
Definition: base_units.cpp:424
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
Definition: board_item.h:252
int GetWidth() const
Definition: pcb_track.h:102
bool IsIndeterminate() const
Return true if the control holds the indeterminate value (for instance, if it represents a multiple s...
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
bool confirmPadChange(const std::vector< PAD * > &connectedPads)
PCB_LAYER_ID BottomLayer() const
Definition: pcb_track.cpp:489
virtual bool IsLocked() const
Definition: board_item.cpp:65
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:97
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
This file contains miscellaneous commonly used macros and functions.
LAYER_NUM GetLayerSelection() const
PCB_LAYER_ID
A quick note on layer IDs:
int GetTrackWidth() const
Definition: netclass.h:128
PCB_LAYER_ID TopLayer() const
Definition: pcb_track.cpp:483
void onWidthEdit(wxCommandEvent &aEvent) override
void SetSelectedNetcode(int aNetcode)
int GetViaDrill() const
Definition: netclass.h:136
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:344
void onViaSelect(wxCommandEvent &aEvent) override
const wxString & GetName() const
Definition: pad.h:130
bool IsIndeterminate()
void SetStart(const wxPoint &aStart)
Definition: pcb_track.h:107
const wxString & GetReference() const
Definition: footprint.h:421
#define _(s)
int SetLayerSelection(LAYER_NUM layer)
int GetuViaDiameter() const
Definition: netclass.h:140
void SetNetInfo(NETINFO_LIST *aNetInfoList)
void SetViaType(VIATYPE aViaType)
Definition: pcb_track.h:355
bool SetLayersHotkeys(bool value)
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:98
DIALOG_TRACK_VIA_PROPERTIES(PCB_BASE_FRAME *aParent, const PCB_SELECTION &aItems, COMMIT &aCommit)
void SetTopLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:449
void onViaNotFreeClicked(wxCommandEvent &event) override
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:97
int LAYER_NUM
This can be replaced with int and removed.
void SetUndefinedLayerName(const wxString &aName)
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
FOOTPRINT * GetParent() const
Definition: pad.cpp:1340
EDA_UNITS m_units
Definition: dialog_shim.h:198
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
void SetWidth(int aWidth)
Definition: pcb_track.h:101
void SetIndeterminate()
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true)=0
Revert the commit by restoring the modified items state.
void SetIsFree(bool aFree=true)
Definition: pcb_track.h:484
VIATYPE
Definition: pcb_track.h:60
virtual bool Validate(double aMin, double aMax, EDA_UNITS aUnits=EDA_UNITS::UNSCALED)
Validate the control against the given range, informing the user of any errors found.
bool SetOKCancelLabels(const ButtonLabel &ok, const ButtonLabel &cancel) override
Shows the 'do not show again' checkbox.
Definition: confirm.h:56
bool GetIsFree() const
Checks if the via is a free via (as opposed to one created on a track by the router).
Definition: pcb_track.h:483
void onViaNetclassCheck(wxCommandEvent &aEvent) override
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
int GetViaDiameter() const
Definition: netclass.h:132
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
std::vector< VIA_DIMENSION > m_ViasDimensionsList
virtual long long int GetValue()
Return the current value in Internal Units.
int ShowModal() override
Definition: confirm.cpp:99
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:204
int GetuViaDrill() const
Definition: netclass.h:144
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
Definition: pcb_track.cpp:193
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
Definition: unit_binder.h:173
BOARD * GetBoard() const
Class DIALOG_TRACK_VIA_PROPERTIES_BASE.
void SanitizeLayers()
Function SanitizeLayers Check so that the layers are correct dependin on the type of via,...
Definition: pcb_track.cpp:495
Definition: pad.h:57
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
Definition: base_units.h:47
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171
bool m_useCalculatedSize
Definition: dialog_shim.h:203
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void Enable(bool aEnable)
Enable/disable the label, widget and units label.
const wxPoint & GetStart() const
Definition: pcb_track.h:108
virtual void ChangeValue(int aValue)
Change the value (in Internal Units) for the text field, taking care of units conversion but does not...