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  auto getAnnularRingSelection =
94  []( const PCB_VIA* via ) -> int
95  {
96  if( !via->GetRemoveUnconnected() )
97  return 0;
98  else if( via->GetKeepTopBottom() )
99  return 1;
100  else
101  return 2;
102  };
103 
104  // Look for values that are common for every item that is selected
105  for( EDA_ITEM* item : m_items )
106  {
107  if( !nets )
108  {
109  net = static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNetCode();
110  nets = true;
111  }
112  else if( net != static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNetCode() )
113  {
114  net = -1;
115  }
116 
117  switch( item->Type() )
118  {
119  case PCB_TRACE_T:
120  case PCB_ARC_T:
121  {
122  const PCB_TRACK* t = static_cast<const PCB_TRACK*>( item );
123 
124  if( !m_tracks ) // first track in the list
125  {
126  m_trackStartX.SetValue( t->GetStart().x );
127  m_trackStartY.SetValue( t->GetStart().y );
128  m_trackEndX.SetValue( t->GetEnd().x );
129  m_trackEndY.SetValue( t->GetEnd().y );
132  m_tracks = true;
133  }
134  else // check if values are the same for every selected track
135  {
136  if( m_trackStartX.GetValue() != t->GetStart().x )
138 
139  if( m_trackStartY.GetValue() != t->GetStart().y )
141 
142  if( m_trackEndX.GetValue() != t->GetEnd().x )
144 
145  if( m_trackEndY.GetValue() != t->GetEnd().y )
147 
148  if( m_trackWidth.GetValue() != t->GetWidth() )
150 
152  {
156  }
157  }
158 
159  if( t->IsLocked() )
160  hasLocked = true;
161  else
162  hasUnlocked = true;
163 
164  break;
165  }
166 
167  case PCB_VIA_T:
168  {
169  const PCB_VIA* v = static_cast<const PCB_VIA*>( item );
170 
171  if( !m_vias ) // first via in the list
172  {
173  m_viaX.SetValue( v->GetPosition().x );
174  m_viaY.SetValue( v->GetPosition().y );
177  m_vias = true;
178  viaType = v->GetViaType();
181  m_viaNotFree->SetValue( !v->GetIsFree() );
182  m_annularRingsCtrl->SetSelection( getAnnularRingSelection( v ) );
183  }
184  else // check if values are the same for every selected via
185  {
186  if( m_viaX.GetValue() != v->GetPosition().x )
188 
189  if( m_viaY.GetValue() != v->GetPosition().y )
191 
192  if( m_viaDiameter.GetValue() != v->GetWidth() )
194 
195  if( m_viaDrill.GetValue() != v->GetDrillValue() )
197 
198  if( viaType != v->GetViaType() )
199  viaType = VIATYPE::NOT_DEFINED;
200 
201  if( v->GetIsFree() != !m_viaNotFree->GetValue() )
202  m_viaNotFree->Set3StateValue( wxCHK_UNDETERMINED );
203 
205  {
209  }
210 
212  {
216  }
217 
218  if( m_annularRingsCtrl->GetSelection() != getAnnularRingSelection( v ) )
219  {
220  if( m_annularRingsCtrl->GetStrings().size() < 4 )
221  m_annularRingsCtrl->AppendString( INDETERMINATE_STATE );
222 
223  m_annularRingsCtrl->SetSelection( 3 );
224  }
225  }
226 
227  if( v->IsLocked() )
228  hasLocked = true;
229  else
230  hasUnlocked = true;
231 
232  break;
233  }
234 
235  default:
236  {
237  wxASSERT( false );
238  break;
239  }
240  }
241  }
242 
243  m_netSelector->SetBoard( aParent->GetBoard() );
244  m_netSelector->SetNetInfo( &aParent->GetBoard()->GetNetInfo() );
245 
246  if ( net >= 0 )
247  {
249  }
250  else
251  {
254  }
255 
256  wxASSERT( m_tracks || m_vias );
257 
258  if( m_vias )
259  {
260  if( m_viaNotFree->GetValue() )
261  {
262  m_netSelectorLabel->Disable();
263  m_netSelector->Disable();
264  }
265 
267 
268  int viaSelection = wxNOT_FOUND;
269 
270  // 0 is the netclass place-holder
271  for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
272  {
273  VIA_DIMENSION* viaDimension = &aParent->GetDesignSettings().m_ViasDimensionsList[ii];
274  wxString msg = StringFromValue( m_units, viaDimension->m_Diameter, false )
275  + " / " + StringFromValue( m_units, viaDimension->m_Drill, false );
276  m_DesignRuleViasCtrl->Append( msg, viaDimension );
277 
278  if( viaSelection == wxNOT_FOUND
279  && m_viaDiameter.GetValue() == viaDimension->m_Diameter
280  && m_viaDrill.GetValue() == viaDimension->m_Drill )
281  {
282  viaSelection = ii;
283  }
284  }
285 
286  m_DesignRuleViasCtrl->SetSelection( viaSelection );
287 
289 
290  m_ViaTypeChoice->Enable();
291 
292  switch( viaType )
293  {
294  case VIATYPE::THROUGH: m_ViaTypeChoice->SetSelection( 0 ); break;
295  case VIATYPE::MICROVIA: m_ViaTypeChoice->SetSelection( 1 ); break;
296  case VIATYPE::BLIND_BURIED: m_ViaTypeChoice->SetSelection( 2 ); break;
297  case VIATYPE::NOT_DEFINED: m_ViaTypeChoice->SetSelection( wxNOT_FOUND ); break;
298  }
299 
300  m_ViaStartLayer->Enable( viaType != VIATYPE::THROUGH );
301  m_ViaEndLayer->Enable( viaType != VIATYPE::THROUGH );
302  }
303  else
304  {
305  m_viaNotFree->Hide();
306  m_MainSizer->Hide( m_sbViaSizer, true );
307  }
308 
309  if( m_tracks )
310  {
312 
313  int widthSelection = wxNOT_FOUND;
314 
315  // 0 is the netclass place-holder
316  for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_TrackWidthList.size(); ii++ )
317  {
318  int width = aParent->GetDesignSettings().m_TrackWidthList[ii];
319  wxString msg = StringFromValue( m_units, width, false );
320  m_DesignRuleWidthsCtrl->Append( msg );
321 
322  if( widthSelection == wxNOT_FOUND && m_trackWidth.GetValue() == width )
323  widthSelection = ii - 1;
324  }
325 
326  m_DesignRuleWidthsCtrl->SetSelection( widthSelection );
327 
329  }
330  else
331  {
332  m_MainSizer->Hide( m_sbTrackSizer, true );
333  }
334 
335  if( hasLocked && hasUnlocked )
336  m_lockedCbox->Set3StateValue( wxCHK_UNDETERMINED );
337  else if( hasLocked )
338  m_lockedCbox->Set3StateValue( wxCHK_CHECKED );
339  else
340  m_lockedCbox->Set3StateValue( wxCHK_UNCHECKED );
341 
343 
344  m_StdButtonsOK->SetDefault();
345 
346  // Now all widgets have the size fixed, call FinishDialogSettings
348 }
349 
350 
351 bool DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange( const std::vector<PAD*>& changingPads )
352 {
353  wxString msg;
354 
355  if( changingPads.size() == 1 )
356  {
357  PAD* pad = *changingPads.begin();
358  msg.Printf( _( "Changing the net will also update %s pad %s to %s." ),
359  pad->GetParent()->GetReference(),
360  pad->GetNumber(),
361  m_netSelector->GetValue() );
362  }
363  else if( changingPads.size() == 2 )
364  {
365  PAD* pad1 = *changingPads.begin();
366  PAD* pad2 = *( ++changingPads.begin() );
367  msg.Printf( _( "Changing the net will also update %s pad %s and %s pad %s to %s." ),
368  pad1->GetParent()->GetReference(),
369  pad1->GetNumber(),
370  pad2->GetParent()->GetReference(),
371  pad2->GetNumber(),
372  m_netSelector->GetValue() );
373  }
374  else
375  {
376  msg.Printf( _( "Changing the net will also update %lu connected pads to %s." ),
377  static_cast<unsigned long>( changingPads.size() ),
378  m_netSelector->GetValue() );
379  }
380 
381  KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
382  dlg.SetOKCancelLabels( _( "Change Nets" ), _( "Leave Nets Unchanged" ) );
383  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
384 
385  return dlg.ShowModal() == wxID_OK;
386 }
387 
388 
390 {
391  // Run validations:
392 
393  if( m_vias )
394  {
395  if( !m_viaDiameter.Validate( GEOMETRY_MIN_SIZE, INT_MAX )
396  || !m_viaDrill.Validate( GEOMETRY_MIN_SIZE, INT_MAX ) )
397  return false;
398 
399  if( m_ViaDiameterCtrl->IsEnabled() && !m_viaDiameter.IsIndeterminate()
400  && m_ViaDrillCtrl->IsEnabled() && !m_viaDrill.IsIndeterminate()
402  {
403  DisplayError( GetParent(), _( "Via hole size must be smaller than via diameter" ) );
404  m_ViaDrillCtrl->SelectAll();
405  m_ViaDrillCtrl->SetFocus();
406  return false;
407  }
408 
411  {
412  DisplayError( GetParent(), _( "Via start layer and end layer cannot be the same" ) );
413  return false;
414  }
415  }
416 
417  if( m_tracks )
418  {
419  if( !m_trackWidth.Validate( GEOMETRY_MIN_SIZE, INT_MAX ) )
420  return false;
421  }
422 
423  // If we survived that, then save the changes:
424  //
425  // We don't bother with updating the nets at this point as it will be useless (any connected
426  // pads will simply drive their existing nets back onto the track segments and vias).
427 
428  bool changeLock = m_lockedCbox->Get3StateValue() != wxCHK_UNDETERMINED;
429  bool setLock = m_lockedCbox->Get3StateValue() == wxCHK_CHECKED;
430 
431  for( EDA_ITEM* item : m_items )
432  {
433  m_commit.Modify( item );
434 
435  switch( item->Type() )
436  {
437  case PCB_TRACE_T:
438  case PCB_ARC_T:
439  {
440  wxASSERT( m_tracks );
441  PCB_TRACK* t = static_cast<PCB_TRACK*>( item );
442 
444  t->SetStart( wxPoint( m_trackStartX.GetValue(), t->GetStart().y ) );
445 
447  t->SetStart( wxPoint( t->GetStart().x, m_trackStartY.GetValue() ) );
448 
450  t->SetEnd( wxPoint( m_trackEndX.GetValue(), t->GetEnd().y ) );
451 
453  t->SetEnd( wxPoint( t->GetEnd().x, m_trackEndY.GetValue() ) );
454 
455  if( m_trackNetclass->IsChecked() )
456  t->SetWidth( t->GetNetClass()->GetTrackWidth() );
457  else if( !m_trackWidth.IsIndeterminate() )
459 
461 
462  if( layer != UNDEFINED_LAYER )
463  t->SetLayer( (PCB_LAYER_ID) layer );
464 
465  if( changeLock )
466  t->SetLocked( setLock );
467 
468  break;
469  }
470 
471  case PCB_VIA_T:
472  {
473  wxASSERT( m_vias );
474  PCB_VIA* v = static_cast<PCB_VIA*>( item );
475 
476  if( !m_viaX.IsIndeterminate() )
477  v->SetPosition( wxPoint( m_viaX.GetValue(), v->GetPosition().y ) );
478 
479  if( !m_viaY.IsIndeterminate() )
480  v->SetPosition( wxPoint( v->GetPosition().x, m_viaY.GetValue() ) );
481 
482  if( m_viaNotFree->Get3StateValue() != wxCHK_UNDETERMINED )
483  v->SetIsFree( !m_viaNotFree->GetValue() );
484 
485  switch( m_ViaTypeChoice->GetSelection() )
486  {
487  case 0:
489  v->SanitizeLayers();
490  break;
491  case 1:
493  break;
494  case 2:
496  break;
497  default:
498  break;
499  }
500 
501  auto startLayer = static_cast<PCB_LAYER_ID>( m_ViaStartLayer->GetLayerSelection() );
502  auto endLayer = static_cast<PCB_LAYER_ID>( m_ViaEndLayer->GetLayerSelection() );
503 
504  if (startLayer != UNDEFINED_LAYER )
505  v->SetTopLayer( startLayer );
506 
507  if (endLayer != UNDEFINED_LAYER )
508  v->SetBottomLayer( endLayer );
509 
510  switch( m_annularRingsCtrl->GetSelection() )
511  {
512  case 0:
513  v->SetRemoveUnconnected( false );
514  break;
515  case 1:
516  v->SetRemoveUnconnected( true );
517  v->SetKeepTopBottom( true );
518  break;
519  case 2:
520  v->SetRemoveUnconnected( true );
521  v->SetKeepTopBottom( false );
522  break;
523  default:
524  break;
525  }
526 
527  v->SanitizeLayers();
528 
529  if( m_viaNetclass->IsChecked() )
530  {
531  switch( v->GetViaType() )
532  {
533  default:
534  wxFAIL_MSG( "Unhandled via type" );
536 
537  case VIATYPE::THROUGH:
539  v->SetWidth( v->GetNetClass()->GetViaDiameter() );
540  v->SetDrill( v->GetNetClass()->GetViaDrill() );
541  break;
542 
543  case VIATYPE::MICROVIA:
544  v->SetWidth( v->GetNetClass()->GetuViaDiameter() );
545  v->SetDrill( v->GetNetClass()->GetuViaDrill() );
546  break;
547  }
548  }
549  else
550  {
553 
554  if( !m_viaDrill.IsIndeterminate() )
555  v->SetDrill( m_viaDrill.GetValue() );
556  }
557 
558  if( changeLock )
559  v->SetLocked( setLock );
560 
561  break;
562  }
563 
564  default:
565  wxASSERT( false );
566  break;
567  }
568  }
569 
570  m_commit.Push( _( "Edit track/via properties" ) );
571 
572  // Pushing the commit will have updated the connectivity so we can now test to see if we
573  // need to update any pad nets.
574 
575  auto connectivity = m_frame->GetBoard()->GetConnectivity();
576  int newNetCode = m_netSelector->GetSelectedNetcode();
577  bool updateNets = false;
578  std::vector<PAD*> changingPads;
579 
580  if ( !m_netSelector->IsIndeterminate() )
581  {
582  updateNets = true;
583 
584  for( EDA_ITEM* item : m_items )
585  {
586  const KICAD_T ourTypes[] = { PCB_TRACE_T, PCB_PAD_T, PCB_VIA_T, PCB_FOOTPRINT_T, EOT };
587  BOARD_CONNECTED_ITEM* boardItem = static_cast<BOARD_CONNECTED_ITEM*>( item );
588  auto connectedItems = connectivity->GetConnectedItems( boardItem, ourTypes, true );
589 
590  for ( BOARD_CONNECTED_ITEM* citem : connectedItems )
591  {
592  if( citem->Type() == PCB_PAD_T )
593  {
594  PAD* pad = static_cast<PAD*>( citem );
595 
596  if( pad->GetNetCode() != newNetCode && !alg::contains( changingPads, citem ) )
597  changingPads.push_back( pad );
598  }
599  }
600  }
601  }
602 
603  if( changingPads.size() && !confirmPadChange( changingPads ) )
604  updateNets = false;
605 
606  if( updateNets )
607  {
608  for( EDA_ITEM* item : m_items )
609  {
610  m_commit.Modify( item );
611 
612  switch( item->Type() )
613  {
614  case PCB_TRACE_T:
615  case PCB_ARC_T:
616  static_cast<PCB_TRACK*>( item )->SetNetCode( newNetCode );
617  break;
618 
619  case PCB_VIA_T:
620  static_cast<PCB_VIA*>( item )->SetNetCode( newNetCode );
621  break;
622 
623  default:
624  wxASSERT( false );
625  break;
626  }
627  }
628 
629  for( PAD* pad : changingPads )
630  {
631  m_commit.Modify( pad );
632  pad->SetNetCode( newNetCode );
633  }
634 
635  m_commit.Push( _( "Updating nets" ) );
636  }
637 
638  return true;
639 }
640 
641 
643 {
644  m_netSelectorLabel->Enable( !m_viaNotFree->GetValue() );
645  m_netSelector->Enable( !m_viaNotFree->GetValue() );
646 }
647 
648 
650 {
651  bool enableNC = aEvent.IsChecked();
652 
653  m_DesignRuleWidths->Enable( !enableNC );
654  m_DesignRuleWidthsCtrl->Enable( !enableNC );
655  m_DesignRuleWidthsUnits->Enable( !enableNC );
656 
657  m_trackWidth.Enable( !enableNC );
658 }
659 
660 
661 void DIALOG_TRACK_VIA_PROPERTIES::onWidthSelect( wxCommandEvent& aEvent )
662 {
663  m_TrackWidthCtrl->ChangeValue( m_DesignRuleWidthsCtrl->GetStringSelection() );
664  m_TrackWidthCtrl->SelectAll();
665 }
666 
667 
668 void DIALOG_TRACK_VIA_PROPERTIES::onWidthEdit( wxCommandEvent& aEvent )
669 {
670  m_DesignRuleWidthsCtrl->SetStringSelection( m_TrackWidthCtrl->GetValue() );
671 }
672 
673 
675 {
676  bool enableNC = aEvent.IsChecked();
677 
678  m_DesignRuleVias->Enable( !enableNC );
679  m_DesignRuleViasCtrl->Enable( !enableNC );
680  m_DesignRuleViasUnit->Enable( !enableNC );
681 
682  m_viaDiameter.Enable( !enableNC );
683  m_viaDrill.Enable( !enableNC );
684 }
685 
686 
687 void DIALOG_TRACK_VIA_PROPERTIES::onViaSelect( wxCommandEvent& aEvent )
688 {
689  VIA_DIMENSION* viaDimension = static_cast<VIA_DIMENSION*> ( aEvent.GetClientData() );
690 
691  m_viaDiameter.ChangeValue( viaDimension->m_Diameter );
692  m_viaDrill.ChangeValue( viaDimension->m_Drill );
693 }
694 
695 
696 void DIALOG_TRACK_VIA_PROPERTIES::onViaEdit( wxCommandEvent& aEvent )
697 {
698  m_DesignRuleViasCtrl->SetSelection( wxNOT_FOUND );
699 
700  if( m_vias )
701  {
702  if( m_ViaTypeChoice->GetSelection() != 0 ) // check if selected type isn't through.
703  {
704  m_ViaStartLayer->Enable();
705  m_ViaEndLayer->Enable();
706  }
707  else
708  {
711 
712  m_ViaStartLayer->Enable( false );
713  m_ViaEndLayer->Enable( false );
714  }
715  }
716 }
#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:279
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
void SetRemoveUnconnected(bool aSet)
Sets the unconnected removal property.
Definition: pcb_track.h:427
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:161
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
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:41
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:679
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:221
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:64
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.
void SetKeepTopBottom(bool aSet)
Sets whether we keep the top and bottom connections even if they are not connected.
Definition: pcb_track.h:433
LAYER_NUM GetLayerSelection() const
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
bool IsIndeterminate()
const wxString & GetNumber() const
Definition: pad.h:129
void SetStart(const wxPoint &aStart)
Definition: pcb_track.h:107
const wxString & GetReference() const
Definition: footprint.h:463
#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:99
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:98
void SetUndefinedLayerName(const wxString &aName)
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
FOOTPRINT * GetParent() const
Definition: pad.cpp:1352
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
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
void onViaNetclassCheck(wxCommandEvent &aEvent) override
Definition: layer_ids.h:71
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:177
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:140
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)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...