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-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Maciej Suminski <[email protected]>
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>
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
40#include <wx/log.h>
41
43 const PCB_SELECTION& aItems,
44 COMMIT& aCommit ) :
46 m_frame( aParent ),
47 m_items( aItems ),
48 m_commit( aCommit ),
49 m_trackStartX( aParent, m_TrackStartXLabel, m_TrackStartXCtrl, m_TrackStartXUnit ),
50 m_trackStartY( aParent, m_TrackStartYLabel, m_TrackStartYCtrl, m_TrackStartYUnit ),
51 m_trackEndX( aParent, m_TrackEndXLabel, m_TrackEndXCtrl, m_TrackEndXUnit ),
52 m_trackEndY( aParent, m_TrackEndYLabel, m_TrackEndYCtrl, m_TrackEndYUnit ),
53 m_trackWidth( aParent, m_TrackWidthLabel, m_TrackWidthCtrl, m_TrackWidthUnit ),
54 m_viaX( aParent, m_ViaXLabel, m_ViaXCtrl, m_ViaXUnit ),
55 m_viaY( aParent, m_ViaYLabel, m_ViaYCtrl, m_ViaYUnit ),
56 m_viaDiameter( aParent, m_ViaDiameterLabel, m_ViaDiameterCtrl, m_ViaDiameterUnit ),
57 m_viaDrill( aParent, m_ViaDrillLabel, m_ViaDrillCtrl, m_ViaDrillUnit ),
58 m_tracks( false ),
59 m_vias( false )
60{
62
63 wxASSERT( !m_items.Empty() );
64
65 // Configure display origin transforms
72
74
79
84
87 m_ViaEndLayer->SetBoardFrame( aParent );
89
90 bool nets = false;
91 int net = 0;
92 bool hasLocked = false;
93 bool hasUnlocked = false;
94
95 // Start and end layers of vias
96 // if at least 2 vias do not have the same start or the same end layer
97 // the layers will be set as undefined
98 int selection_first_layer = -1;
99 int selection_last_layer = -1;
100
101 // The selection layer for tracks
102 int track_selection_layer = -1;
103
104 auto getAnnularRingSelection =
105 []( const PCB_VIA* via ) -> int
106 {
107 if( !via->GetRemoveUnconnected() )
108 return 0;
109 else if( via->GetKeepTopBottom() )
110 return 1;
111 else
112 return 2;
113 };
114
115 // Look for values that are common for every item that is selected
116 for( EDA_ITEM* item : m_items )
117 {
118 if( !nets )
119 {
120 net = static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNetCode();
121 nets = true;
122 }
123 else if( net != static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNetCode() )
124 {
125 net = -1;
126 }
127
128 switch( item->Type() )
129 {
130 case PCB_TRACE_T:
131 case PCB_ARC_T:
132 {
133 const PCB_TRACK* t = static_cast<const PCB_TRACK*>( item );
134
135 if( !m_tracks ) // first track in the list
136 {
142 track_selection_layer = t->GetLayer();
143 m_tracks = true;
144 }
145 else // check if values are the same for every selected track
146 {
147 if( m_trackStartX.GetValue() != t->GetStart().x )
149
150 if( m_trackStartY.GetValue() != t->GetStart().y )
152
153 if( m_trackEndX.GetValue() != t->GetEnd().x )
155
156 if( m_trackEndY.GetValue() != t->GetEnd().y )
158
159 if( m_trackWidth.GetValue() != t->GetWidth() )
161
162 if( track_selection_layer != t->GetLayer() )
163 {
164 track_selection_layer = UNDEFINED_LAYER;
165 }
166 }
167
168 if( t->IsLocked() )
169 hasLocked = true;
170 else
171 hasUnlocked = true;
172
173 break;
174 }
175
176 case PCB_VIA_T:
177 {
178 const PCB_VIA* v = static_cast<const PCB_VIA*>( item );
179
180 if( !m_vias ) // first via in the list
181 {
186 m_vias = true;
187 viaType = v->GetViaType();
188 m_viaNotFree->SetValue( !v->GetIsFree() );
189 m_annularRingsCtrl->SetSelection( getAnnularRingSelection( v ) );
190 selection_first_layer = v->TopLayer();
191 selection_last_layer = v->BottomLayer();
192 }
193 else // check if values are the same for every selected via
194 {
195 if( m_viaX.GetValue() != v->GetPosition().x )
197
198 if( m_viaY.GetValue() != v->GetPosition().y )
200
201 if( m_viaDiameter.GetValue() != v->GetWidth() )
203
204 if( m_viaDrill.GetValue() != v->GetDrillValue() )
206
207 if( viaType != v->GetViaType() )
208 viaType = VIATYPE::NOT_DEFINED;
209
210 if( v->GetIsFree() != !m_viaNotFree->GetValue() )
211 m_viaNotFree->Set3StateValue( wxCHK_UNDETERMINED );
212
213 if( selection_first_layer != v->TopLayer() )
214 {
215 selection_first_layer = UNDEFINED_LAYER;
216 }
217
218 if( selection_last_layer != v->BottomLayer() )
219 {
220 selection_last_layer = UNDEFINED_LAYER;
221 }
222
223 if( m_annularRingsCtrl->GetSelection() != getAnnularRingSelection( v ) )
224 {
225 if( m_annularRingsCtrl->GetStrings().size() < 4 )
227
228 m_annularRingsCtrl->SetSelection( 3 );
229 }
230 }
231
232 if( v->IsLocked() )
233 hasLocked = true;
234 else
235 hasUnlocked = true;
236
237 break;
238 }
239
240 default:
241 {
242 wxASSERT( false );
243 break;
244 }
245 }
246 }
247
248 if( m_tracks )
249 {
250 // Set the track layer selection state:
251 if( track_selection_layer == UNDEFINED_LAYER )
252 {
255 }
256
257 m_TrackLayerCtrl->SetLayerSelection( track_selection_layer );
258 }
259
260 // Set the vias layers selections state:
261 if( m_vias )
262 {
263 if( selection_first_layer == UNDEFINED_LAYER )
264 {
267 }
268 m_ViaStartLayer->SetLayerSelection( selection_first_layer );
269
270 if( selection_last_layer == UNDEFINED_LAYER )
271 {
274 }
275 m_ViaEndLayer->SetLayerSelection( selection_last_layer );
276 }
277
278 m_netSelector->SetBoard( aParent->GetBoard() );
279 m_netSelector->SetNetInfo( &aParent->GetBoard()->GetNetInfo() );
280
281 if ( net >= 0 )
282 {
284 }
285 else
286 {
289 }
290
291 wxASSERT( m_tracks || m_vias );
292
293 if( m_vias )
294 {
295 if( m_viaNotFree->GetValue() && !m_tracks )
296 {
297 // Disable net selector to re-inforce meaning of "Automatically update via nets",
298 // but not when tracks are also selected as then things get harder if you want to
299 // update all the nets to match.
300 m_netSelectorLabel->Disable();
301 m_netSelector->Disable();
302 }
303
305
306 int viaSelection = wxNOT_FOUND;
307
308 // 0 is the netclass place-holder
309 for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
310 {
311 VIA_DIMENSION* viaDimension = &aParent->GetDesignSettings().m_ViasDimensionsList[ii];
312 wxString msg = m_frame->StringFromValue( viaDimension->m_Diameter )
313 + wxT( " / " )
314 + m_frame->StringFromValue( viaDimension->m_Drill );
315 m_DesignRuleViasCtrl->Append( msg, viaDimension );
316
317 if( viaSelection == wxNOT_FOUND
318 && m_viaDiameter.GetValue() == viaDimension->m_Diameter
319 && m_viaDrill.GetValue() == viaDimension->m_Drill )
320 {
321 viaSelection = ii - 1;
322 }
323 }
324
325 m_DesignRuleViasCtrl->SetSelection( viaSelection );
326
327 m_ViaTypeChoice->Enable();
328
329 switch( viaType )
330 {
331 case VIATYPE::THROUGH: m_ViaTypeChoice->SetSelection( 0 ); break;
332 case VIATYPE::MICROVIA: m_ViaTypeChoice->SetSelection( 1 ); break;
333 case VIATYPE::BLIND_BURIED: m_ViaTypeChoice->SetSelection( 2 ); break;
334 case VIATYPE::NOT_DEFINED: m_ViaTypeChoice->SetSelection( wxNOT_FOUND ); break;
335 }
336
337 m_ViaStartLayer->Enable( viaType != VIATYPE::THROUGH );
338 m_ViaEndLayer->Enable( viaType != VIATYPE::THROUGH );
339 }
340 else
341 {
342 m_viaNotFree->Hide();
343 m_MainSizer->Hide( m_sbViaSizer, true );
344 }
345
346 if( m_tracks )
347 {
349
350 int widthSelection = wxNOT_FOUND;
351
352 // 0 is the netclass place-holder
353 for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_TrackWidthList.size(); ii++ )
354 {
355 int width = aParent->GetDesignSettings().m_TrackWidthList[ii];
356 wxString msg = m_frame->StringFromValue( width );
357 m_DesignRuleWidthsCtrl->Append( msg );
358
359 if( widthSelection == wxNOT_FOUND && m_trackWidth.GetValue() == width )
360 widthSelection = ii - 1;
361 }
362
363 m_DesignRuleWidthsCtrl->SetSelection( widthSelection );
364 }
365 else
366 {
367 m_MainSizer->Hide( m_sbTrackSizer, true );
368 }
369
370 if( hasLocked && hasUnlocked )
371 m_lockedCbox->Set3StateValue( wxCHK_UNDETERMINED );
372 else if( hasLocked )
373 m_lockedCbox->Set3StateValue( wxCHK_CHECKED );
374 else
375 m_lockedCbox->Set3StateValue( wxCHK_UNCHECKED );
376
377 if( m_tracks )
379 else if( m_netSelector->IsEnabled() )
381 else
383
385
386 m_frame->Bind( UNITS_CHANGED, &DIALOG_TRACK_VIA_PROPERTIES::onUnitsChanged, this );
387 m_netSelector->Bind( NET_SELECTED, &DIALOG_TRACK_VIA_PROPERTIES::onNetSelector, this );
388
389 // Now all widgets have the size fixed, call FinishDialogSettings
391}
392
393
395{
396 m_frame->Unbind( UNITS_CHANGED, &DIALOG_TRACK_VIA_PROPERTIES::onUnitsChanged, this );
397}
398
399
401{
402 if( m_vias )
403 {
404 int viaSel = m_DesignRuleViasCtrl->GetSelection();
405
406 m_DesignRuleViasCtrl->Clear();
407
408 // 0 is the netclass place-holder
409 for( unsigned ii = 1; ii < m_frame->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
410 {
412 wxString msg = m_frame->StringFromValue( viaDimension->m_Diameter )
413 + wxT( " / " )
414 + m_frame->StringFromValue( viaDimension->m_Drill );
415 m_DesignRuleViasCtrl->Append( msg, viaDimension );
416 }
417
418 m_DesignRuleViasCtrl->SetSelection( viaSel );
420 }
421
422 if( m_tracks )
423 {
424 int trackSel = m_DesignRuleWidthsCtrl->GetSelection();
425
426 m_DesignRuleWidthsCtrl->Clear();
427
428 // 0 is the netclass place-holder
429 for( unsigned ii = 1; ii < m_frame->GetDesignSettings().m_TrackWidthList.size(); ii++ )
430 {
431 int width = m_frame->GetDesignSettings().m_TrackWidthList[ii];
432 wxString msg = m_frame->StringFromValue( width );
433 m_DesignRuleWidthsCtrl->Append( msg );
434 }
435
436 m_DesignRuleWidthsCtrl->SetSelection( trackSel );
438 }
439
440 aEvent.Skip();
441}
442
443
444bool DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange( const std::vector<PAD*>& changingPads )
445{
446 wxString msg;
447
448 if( changingPads.size() == 1 )
449 {
450 PAD* pad = *changingPads.begin();
451 msg.Printf( _( "Changing the net will also update %s pad %s to %s." ),
452 pad->GetParent()->GetReference(),
453 pad->GetNumber(),
454 m_netSelector->GetValue() );
455 }
456 else if( changingPads.size() == 2 )
457 {
458 PAD* pad1 = *changingPads.begin();
459 PAD* pad2 = *( ++changingPads.begin() );
460 msg.Printf( _( "Changing the net will also update %s pad %s and %s pad %s to %s." ),
461 pad1->GetParent()->GetReference(),
462 pad1->GetNumber(),
463 pad2->GetParent()->GetReference(),
464 pad2->GetNumber(),
465 m_netSelector->GetValue() );
466 }
467 else
468 {
469 msg.Printf( _( "Changing the net will also update %lu connected pads to %s." ),
470 static_cast<unsigned long>( changingPads.size() ),
471 m_netSelector->GetValue() );
472 }
473
474 KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
475 dlg.SetOKCancelLabels( _( "Change Nets" ), _( "Leave Nets Unchanged" ) );
476 dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
477
478 return dlg.ShowModal() == wxID_OK;
479}
480
481
483{
484 // Run validations:
485
486 if( m_vias )
487 {
489 || !m_viaDrill.Validate( GEOMETRY_MIN_SIZE, INT_MAX ) )
490 return false;
491
492 if( m_ViaDiameterCtrl->IsEnabled() && !m_viaDiameter.IsIndeterminate()
493 && m_ViaDrillCtrl->IsEnabled() && !m_viaDrill.IsIndeterminate()
495 {
496 DisplayError( GetParent(), _( "Via hole size must be smaller than via diameter" ) );
497 m_ViaDrillCtrl->SelectAll();
498 m_ViaDrillCtrl->SetFocus();
499 return false;
500 }
501
504 {
505 DisplayError( GetParent(), _( "Via start layer and end layer cannot be the same" ) );
506 return false;
507 }
508 }
509
510 if( m_tracks )
511 {
512 if( !m_trackWidth.Validate( GEOMETRY_MIN_SIZE, INT_MAX ) )
513 return false;
514 }
515
516 // If we survived that, then save the changes:
517 //
518 // We don't bother with updating the nets at this point as it will be useless (any connected
519 // pads will simply drive their existing nets back onto the track segments and vias).
520
521 bool changeLock = m_lockedCbox->Get3StateValue() != wxCHK_UNDETERMINED;
522 bool setLock = m_lockedCbox->Get3StateValue() == wxCHK_CHECKED;
523
524 for( EDA_ITEM* item : m_items )
525 {
526 m_commit.Modify( item );
527
528 switch( item->Type() )
529 {
530 case PCB_TRACE_T:
531 case PCB_ARC_T:
532 {
533 wxASSERT( m_tracks );
534 PCB_TRACK* t = static_cast<PCB_TRACK*>( item );
535
537 t->SetStart( wxPoint( m_trackStartX.GetValue(), t->GetStart().y ) );
538
540 t->SetStart( wxPoint( t->GetStart().x, m_trackStartY.GetValue() ) );
541
543 t->SetEnd( wxPoint( m_trackEndX.GetValue(), t->GetEnd().y ) );
544
546 t->SetEnd( wxPoint( t->GetEnd().x, m_trackEndY.GetValue() ) );
547
548 if( m_trackNetclass->IsChecked() )
550 else if( !m_trackWidth.IsIndeterminate() )
552
553 int layer = m_TrackLayerCtrl->GetLayerSelection();
554
555 if( layer != UNDEFINED_LAYER )
556 t->SetLayer( (PCB_LAYER_ID) layer );
557
558 if( changeLock )
559 t->SetLocked( setLock );
560
561 break;
562 }
563
564 case PCB_VIA_T:
565 {
566 wxASSERT( m_vias );
567 PCB_VIA* v = static_cast<PCB_VIA*>( item );
568
569 if( !m_viaX.IsIndeterminate() )
570 v->SetPosition( wxPoint( m_viaX.GetValue(), v->GetPosition().y ) );
571
572 if( !m_viaY.IsIndeterminate() )
573 v->SetPosition( wxPoint( v->GetPosition().x, m_viaY.GetValue() ) );
574
575 if( m_viaNotFree->Get3StateValue() != wxCHK_UNDETERMINED )
576 v->SetIsFree( !m_viaNotFree->GetValue() );
577
578 switch( m_ViaTypeChoice->GetSelection() )
579 {
580 case 0:
582 v->SanitizeLayers();
583 break;
584 case 1:
586 break;
587 case 2:
589 break;
590 default:
591 break;
592 }
593
594 auto startLayer = static_cast<PCB_LAYER_ID>( m_ViaStartLayer->GetLayerSelection() );
595 auto endLayer = static_cast<PCB_LAYER_ID>( m_ViaEndLayer->GetLayerSelection() );
596
597 if (startLayer != UNDEFINED_LAYER )
598 v->SetTopLayer( startLayer );
599
600 if (endLayer != UNDEFINED_LAYER )
601 v->SetBottomLayer( endLayer );
602
603 switch( m_annularRingsCtrl->GetSelection() )
604 {
605 case 0:
606 v->SetRemoveUnconnected( false );
607 break;
608 case 1:
609 v->SetRemoveUnconnected( true );
610 v->SetKeepTopBottom( true );
611 break;
612 case 2:
613 v->SetRemoveUnconnected( true );
614 v->SetKeepTopBottom( false );
615 break;
616 default:
617 break;
618 }
619
620 v->SanitizeLayers();
621
622 if( m_viaNetclass->IsChecked() )
623 {
624 NETCLASS* netclass = v->GetEffectiveNetClass();
625
626 switch( v->GetViaType() )
627 {
628 default:
629 wxFAIL_MSG( wxT( "Unhandled via type" ) );
631
632 case VIATYPE::THROUGH:
634 v->SetWidth( netclass->GetViaDiameter() );
635 v->SetDrill( netclass->GetViaDrill() );
636 break;
637
639 v->SetWidth( netclass->GetuViaDiameter() );
640 v->SetDrill( netclass->GetuViaDrill() );
641 break;
642 }
643 }
644 else
645 {
648
651 }
652
653 if( changeLock )
654 v->SetLocked( setLock );
655
656 break;
657 }
658
659 default:
660 wxASSERT( false );
661 break;
662 }
663 }
664
665 m_commit.Push( _( "Edit track/via properties" ) );
666
667 // Pushing the commit will have updated the connectivity so we can now test to see if we
668 // need to update any pad nets.
669
670 auto connectivity = m_frame->GetBoard()->GetConnectivity();
671 int newNetCode = m_netSelector->GetSelectedNetcode();
672 bool updateNets = false;
673 std::vector<PAD*> changingPads;
674
676 {
677 updateNets = true;
678
679 for( EDA_ITEM* item : m_items )
680 {
681 BOARD_CONNECTED_ITEM* boardItem = static_cast<BOARD_CONNECTED_ITEM*>( item );
682 auto connectedItems = connectivity->GetConnectedItems( boardItem,
684
685 for ( BOARD_CONNECTED_ITEM* citem : connectedItems )
686 {
687 if( citem->Type() == PCB_PAD_T )
688 {
689 PAD* pad = static_cast<PAD*>( citem );
690
691 if( pad->GetNetCode() != newNetCode && !alg::contains( changingPads, citem ) )
692 changingPads.push_back( pad );
693 }
694 }
695 }
696 }
697
698 if( changingPads.size() && !confirmPadChange( changingPads ) )
699 updateNets = false;
700
701 if( updateNets )
702 {
703 for( EDA_ITEM* item : m_items )
704 {
705 m_commit.Modify( item );
706
707 switch( item->Type() )
708 {
709 case PCB_TRACE_T:
710 case PCB_ARC_T:
711 static_cast<PCB_TRACK*>( item )->SetNetCode( newNetCode );
712 break;
713
714 case PCB_VIA_T:
715 static_cast<PCB_VIA*>( item )->SetNetCode( newNetCode );
716 break;
717
718 default:
719 wxASSERT( false );
720 break;
721 }
722 }
723
724 for( PAD* pad : changingPads )
725 {
727 pad->SetNetCode( newNetCode );
728 }
729
730 m_commit.Push( _( "Updating nets" ) );
731 }
732
733 return true;
734}
735
736
737void DIALOG_TRACK_VIA_PROPERTIES::onNetSelector( wxCommandEvent& aEvent )
738{
739 m_viaNotFree->SetValue( false );
740}
741
742
744{
745 if( !m_tracks )
746 {
747 m_netSelectorLabel->Enable( !m_viaNotFree->GetValue() );
748 m_netSelector->Enable( !m_viaNotFree->GetValue() );
749 }
750}
751
752
754{
755 bool enableNC = aEvent.IsChecked();
756
757 m_DesignRuleWidths->Enable( !enableNC );
758 m_DesignRuleWidthsCtrl->Enable( !enableNC );
759 m_DesignRuleWidthsUnits->Enable( !enableNC );
760
761 m_trackWidth.Enable( !enableNC );
762}
763
764
765void DIALOG_TRACK_VIA_PROPERTIES::onWidthSelect( wxCommandEvent& aEvent )
766{
767 m_TrackWidthCtrl->ChangeValue( m_DesignRuleWidthsCtrl->GetStringSelection() );
768 m_TrackWidthCtrl->SelectAll();
769}
770
771
772void DIALOG_TRACK_VIA_PROPERTIES::onWidthEdit( wxCommandEvent& aEvent )
773{
774 m_DesignRuleWidthsCtrl->SetStringSelection( m_TrackWidthCtrl->GetValue() );
775}
776
777
779{
780 bool enableNC = aEvent.IsChecked();
781
782 m_DesignRuleVias->Enable( !enableNC );
783 m_DesignRuleViasCtrl->Enable( !enableNC );
784 m_DesignRuleViasUnit->Enable( !enableNC );
785
786 m_viaDiameter.Enable( !enableNC );
787 m_viaDrill.Enable( !enableNC );
788}
789
790
791void DIALOG_TRACK_VIA_PROPERTIES::onViaSelect( wxCommandEvent& aEvent )
792{
793 VIA_DIMENSION* viaDimension = static_cast<VIA_DIMENSION*> ( aEvent.GetClientData() );
794
795 m_viaDiameter.ChangeValue( viaDimension->m_Diameter );
796 m_viaDrill.ChangeValue( viaDimension->m_Drill );
797}
798
799
800void DIALOG_TRACK_VIA_PROPERTIES::onViaEdit( wxCommandEvent& aEvent )
801{
802 m_DesignRuleViasCtrl->SetSelection( wxNOT_FOUND );
803
804 if( m_vias )
805 {
806 if( m_ViaTypeChoice->GetSelection() != 0 ) // check if selected type isn't through.
807 {
808 m_ViaStartLayer->Enable();
809 m_ViaEndLayer->Enable();
810 }
811 else
812 {
815
816 m_ViaStartLayer->Enable( false );
817 m_ViaEndLayer->Enable( false );
818 }
819 }
820}
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
virtual NETCLASS * GetEffectiveNetClass() const
Return the NETCLASS for this item.
std::vector< int > m_TrackWidthList
std::vector< VIA_DIMENSION > m_ViasDimensionsList
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:167
virtual void SetLocked(bool aLocked)
Definition: board_item.h:241
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:201
virtual bool IsLocked() const
Definition: board_item.cpp:65
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:763
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:424
Represent a set of changes (additions, deletions or modifications) of a data model (e....
Definition: commit.h:72
COMMIT & Modify(EDA_ITEM *aItem)
Create an undo entry for an item that has been already modified.
Definition: commit.h:103
virtual void Push(const wxString &aMessage=wxT("A commit"), int aFlags=0)=0
Revert the commit by restoring the modified items state.
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:97
void SetupStandardButtons(std::map< int, wxString > aLabels={})
bool m_useCalculatedSize
Definition: dialog_shim.h:207
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Class DIALOG_TRACK_VIA_PROPERTIES_BASE.
void onWidthEdit(wxCommandEvent &aEvent) override
void onUnitsChanged(wxCommandEvent &aEvent)
void onNetSelector(wxCommandEvent &aEvent)
void onWidthSelect(wxCommandEvent &aEvent) override
DIALOG_TRACK_VIA_PROPERTIES(PCB_BASE_FRAME *aParent, const PCB_SELECTION &aItems, COMMIT &aCommit)
void onViaEdit(wxCommandEvent &aEvent) override
bool confirmPadChange(const std::vector< PAD * > &connectedPads)
void onViaSelect(wxCommandEvent &aEvent) override
void onViaNotFreeClicked(wxCommandEvent &aEvent) override
void onTrackNetclassCheck(wxCommandEvent &aEvent) override
void onViaNetclassCheck(wxCommandEvent &aEvent) override
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
const wxString & GetReference() const
Definition: footprint.h:519
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: confirm.h:46
void DoNotShowCheckbox(wxString file, int line)
Checks the 'do not show again' setting for the dialog.
Definition: confirm.cpp:56
bool SetOKCancelLabels(const ButtonLabel &ok, const ButtonLabel &cancel) override
Shows the 'do not show again' checkbox.
Definition: confirm.h:56
int ShowModal() override
Definition: confirm.cpp:100
int SetLayerSelection(int layer)
bool SetLayersHotkeys(bool value)
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
Definition: lset.cpp:794
A collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:47
int GetViaDiameter() const
Definition: netclass.h:80
int GetViaDrill() const
Definition: netclass.h:84
int GetuViaDrill() const
Definition: netclass.h:92
int GetuViaDiameter() const
Definition: netclass.h:88
int GetTrackWidth() const
Definition: netclass.h:76
bool IsIndeterminate()
void SetBoard(BOARD *aBoard)
int GetSelectedNetcode()
void SetIndeterminateString(const wxString &aString)
void SetSelectedNetcode(int aNetcode)
void SetIndeterminate()
void SetNetInfo(NETINFO_LIST *aNetInfoList)
Definition: pad.h:58
const wxString & GetNumber() const
Definition: pad.h:134
FOOTPRINT * GetParent() const
Definition: pad.cpp:1464
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
BOARD * GetBoard() const
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
void SetNotAllowedLayerSet(LSET aMask)
void SetUndefinedLayerName(const wxString &aName)
void SetWidth(int aWidth)
Definition: pcb_track.h:104
int GetWidth() const
Definition: pcb_track.h:105
void SetEnd(const VECTOR2I &aEnd)
Definition: pcb_track.h:107
void SetStart(const VECTOR2I &aStart)
Definition: pcb_track.h:110
const VECTOR2I & GetStart() const
Definition: pcb_track.h:111
const VECTOR2I & GetEnd() const
Definition: pcb_track.h:108
void SetRemoveUnconnected(bool aSet)
Sets the unconnected removal property.
Definition: pcb_track.h:436
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:492
PCB_LAYER_ID BottomLayer() const
Definition: pcb_track.cpp:563
VECTOR2I GetPosition() const override
Definition: pcb_track.h:401
void SetBottomLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:529
void SetKeepTopBottom(bool aSet)
Sets whether we keep the top and bottom connections even if they are not connected.
Definition: pcb_track.h:442
void SetDrill(int aDrill)
Function SetDrill sets the drill value for vias.
Definition: pcb_track.h:464
void SetIsFree(bool aFree=true)
Definition: pcb_track.h:493
void SetTopLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:523
void SetPosition(const VECTOR2I &aPoint) override
Definition: pcb_track.h:402
void SanitizeLayers()
Function SanitizeLayers Check so that the layers are correct dependin on the type of via,...
Definition: pcb_track.cpp:569
void SetViaType(VIATYPE aViaType)
Definition: pcb_track.h:354
PCB_LAYER_ID TopLayer() const
Definition: pcb_track.cpp:557
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
Definition: pcb_track.cpp:185
VIATYPE GetViaType() const
Definition: pcb_track.h:353
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:107
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Converts aValue in internal units into a united string.
EDA_UNITS GetUserUnits() const
virtual long long int GetValue()
Return the current value in Internal Units.
void Enable(bool aEnable)
Enable/disable the label, widget and units label.
bool IsIndeterminate() const
Return true if the control holds the indeterminate value (for instance, if it represents a multiple s...
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.
virtual void ChangeValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
Definition: unit_binder.h:186
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:280
This file is part of the common library.
#define _(s)
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ B_Cu
Definition: layer_ids.h:95
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
@ F_Cu
Definition: layer_ids.h:64
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
wxString GetLabel(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
Definition: eda_units.cpp:129
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
#define GEOMETRY_MIN_SIZE
Definition: pcb_track.h:73
VIATYPE
Definition: pcb_track.h:62
@ BLIND_BURIED
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
Definition: ui_common.h:42