KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_copper_zones.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) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
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 <wx/radiobut.h>
27#include <kiface_base.h>
28#include <confirm.h>
29#include <pcb_edit_frame.h>
30#include <pcbnew_settings.h>
31#include <zones.h>
32#include <widgets/unit_binder.h>
33#include <zone.h>
34#include <pad.h>
35#include <board.h>
36#include <trigo.h>
37#include <eda_pattern_match.h>
38
40#include <string_utils.h>
41
42
44{
45public:
47 CONVERT_SETTINGS* aConvertSettings );
48
50 { delete m_gap; }
51
52private:
53 using NET_FILTER = std::unique_ptr<EDA_PATTERN_MATCH>;
54 using NET_FILTER_LIST = std::vector<NET_FILTER>;
55
56 static constexpr int INVALID_NET_CODE{ 0 };
57
58 static constexpr int DEFAULT_SORT_CONFIG{ -1 };
59 static constexpr int NO_PERSISTENT_SORT_MODE{ 0 };
60 static constexpr int HIDE_ANONYMOUS_NETS{ 1 << 0 };
61 static constexpr int SORT_BY_PAD_COUNT{ 1 << 1 };
62
63 bool TransferDataToWindow() override;
64 bool TransferDataFromWindow() override;
65
69 bool AcceptOptions();
70
71 void OnStyleSelection( wxCommandEvent& event ) override;
72 void OnLayerSelection( wxDataViewEvent& event ) override;
73 void OnNetSortingOptionSelected( wxCommandEvent& event ) override;
74 void OnShowNetNameFilterChange( wxCommandEvent& event ) override;
75 void OnUpdateUI( wxUpdateUIEvent& ) override;
76 void OnNetSelectionUpdated( wxCommandEvent& event ) override;
77 void OnRemoveIslandsSelection( wxCommandEvent& event ) override;
78
79 void readNetInformation();
81 wxArrayString buildListOfNetsToDisplay();
82 void sortNetsByPadCount( std::vector<NETINFO_ITEM*>& nets, const int maxNetCode );
84 int ensureSelectedNetIsVisible( int selectedNetCode, wxArrayString& netsList );
85 void displayNetsList( const wxArrayString& netNamesList, int selectIndex );
87 wxString getUnescapedNetName( const NETINFO_ITEM* net );
88 void sortNetsIfRequired();
90 void updateInfoBar();
93
94private:
96
101
106
112
119
120 wxStaticText* m_gapLabel;
121 wxTextCtrl* m_gapCtrl;
122 wxStaticText* m_gapUnits;
124
125 std::map<wxString, int> m_netNameToNetCode;
126 std::vector<NETINFO_ITEM*> m_netInfoItemList;
127
129 wxRadioButton* m_rbCenterline;
130 wxRadioButton* m_rbEnvelope;
132};
133
134
136 CONVERT_SETTINGS* aConvertSettings )
137{
138 DIALOG_COPPER_ZONE dlg( aCaller, aSettings, aConvertSettings );
139
140 // TODO: why does this need QuasiModal?
141 return dlg.ShowQuasiModal();
142}
143
144
145// The pad count for each netcode, stored in a buffer for a fast access.
146// This is needed by the sort function sortNetsByNodes()
147static std::vector<int> padCountListByNet;
148
149
150// Sort nets by decreasing pad count.
151// For same pad count, sort by alphabetic names
152static bool sortNetsByNodes( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
153{
154 int countA = padCountListByNet[a->GetNetCode()];
155 int countB = padCountListByNet[b->GetNetCode()];
156
157 if( countA == countB )
158 return a->GetNetname() < b->GetNetname();
159 else
160 return countB < countA;
161}
162
163
164// Sort nets by alphabetic names
165static bool sortNetsByNames( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
166{
167 return a->GetNetname() < b->GetNetname();
168}
169
170
172 CONVERT_SETTINGS* aConvertSettings ) :
173 DIALOG_COPPER_ZONE_BASE( aParent ),
174 m_cornerSmoothingType( ZONE_SETTINGS::SMOOTHING_UNDEFINED ),
175 m_outlineHatchPitch( aParent, m_stBorderHatchPitchText,
176 m_outlineHatchPitchCtrl, m_outlineHatchUnits ),
177 m_cornerRadius( aParent, m_cornerRadiusLabel, m_cornerRadiusCtrl, m_cornerRadiusUnits ),
178 m_clearance( aParent, m_clearanceLabel, m_clearanceCtrl, m_clearanceUnits ),
179 m_minWidth( aParent, m_minWidthLabel, m_minWidthCtrl, m_minWidthUnits ),
180 m_antipadClearance( aParent, m_antipadLabel, m_antipadCtrl, m_antipadUnits ),
181 m_spokeWidth( aParent, m_spokeWidthLabel, m_spokeWidthCtrl, m_spokeWidthUnits ),
182 m_gridStyleRotation( aParent, m_staticTextGrindOrient, m_tcGridStyleOrientation,
183 m_staticTextRotUnits ),
184 m_gridStyleThickness( aParent, m_staticTextStyleThickness, m_tcGridStyleThickness,
185 m_GridStyleThicknessUnits ),
186 m_gridStyleGap( aParent, m_staticTextGridGap, m_tcGridStyleGap, m_GridStyleGapUnits ),
187 m_islandThreshold( aParent, m_islandThresholdLabel, m_tcIslandThreshold,
188 m_islandThresholdUnits ),
189 m_hideAutoGeneratedNets{ false },
190 m_convertSettings( aConvertSettings ),
191 m_rbCenterline( nullptr ),
192 m_rbEnvelope( nullptr ),
193 m_cbDeleteOriginals( nullptr )
194{
195 m_Parent = aParent;
196
197 m_ptr = aSettings;
198 m_settings = *aSettings;
201 false );
202 m_isTeardrop = m_settings.m_TeardropType != TEARDROP_TYPE::TD_NONE;
203
204 switch( m_settings.m_TeardropType )
205 {
206 case TEARDROP_TYPE::TD_NONE:
207 // standard copper zone
208 break;
209
210 case TEARDROP_TYPE::TD_VIAPAD:
211 SetTitle( _( "Teardrop on Vias/Pads Properties" ) );
212 break;
213
214 case TEARDROP_TYPE::TD_TRACKEND:
215 SetTitle( _( "Teardrop on Tracks Properties" ) );
216 break;
217
218 default:
219 SetTitle( _( "Teardrop Properties" ) );
220 break;
221 }
222
223 if( aConvertSettings )
224 {
225 wxStaticBox* bConvertBox = new wxStaticBox( this, wxID_ANY, _( "Conversion Settings" ) );
226 wxStaticBoxSizer* bConvertSizer = new wxStaticBoxSizer( bConvertBox, wxVERTICAL );
227
228 m_rbCenterline = new wxRadioButton( this, wxID_ANY, _( "Use centerlines" ) );
229 bConvertSizer->Add( m_rbCenterline, 0, wxLEFT|wxRIGHT, 5 );
230
231 bConvertSizer->AddSpacer( 2 );
232 m_rbEnvelope = new wxRadioButton( this, wxID_ANY, _( "Create bounding hull" ) );
233 bConvertSizer->Add( m_rbEnvelope, 0, wxLEFT|wxRIGHT, 5 );
234
235 m_gapLabel = new wxStaticText( this, wxID_ANY, _( "Gap:" ) );
236 m_gapCtrl = new wxTextCtrl( this, wxID_ANY );
237 m_gapUnits = new wxStaticText( this, wxID_ANY, _( "mm" ) );
240
241 wxBoxSizer* hullParamsSizer = new wxBoxSizer( wxHORIZONTAL );
242 hullParamsSizer->Add( m_gapLabel, 0, wxALIGN_CENTRE_VERTICAL|wxRIGHT, 5 );
243 hullParamsSizer->Add( m_gapCtrl, 1, wxALIGN_CENTRE_VERTICAL|wxLEFT|wxRIGHT, 5 );
244 hullParamsSizer->Add( m_gapUnits, 0, wxALIGN_CENTRE_VERTICAL|wxLEFT, 5 );
245 bConvertSizer->AddSpacer( 2 );
246 bConvertSizer->Add( hullParamsSizer, 0, wxLEFT, 26 );
247
248 bConvertSizer->AddSpacer( 6 );
249 m_cbDeleteOriginals = new wxCheckBox( this, wxID_ANY, _( "Delete source objects after conversion" ) );
250 bConvertSizer->Add( m_cbDeleteOriginals, 0, wxALL, 5 );
251
252 GetSizer()->Insert( 0, bConvertSizer, 0, wxALL|wxEXPAND, 10 );
253
254 wxStaticLine* line = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
255 wxLI_HORIZONTAL );
256 GetSizer()->Insert( 1, line, 0, wxLEFT|wxRIGHT|wxEXPAND, 10 );
257
258 SetTitle( _( "Convert to Copper Zone" ) );
259 }
260 else
261 {
262 m_gapLabel = nullptr;
263 m_gapCtrl = nullptr;
264 m_gapUnits = nullptr;
265 m_gap = nullptr;
266 }
267
270
271 m_netSortingByPadCount = true; // false = alphabetic sort, true = pad count sort
272
273 m_ShowNetNameFilter->SetHint( _( "Filter" ) );
274
275 m_cbRemoveIslands->Bind( wxEVT_CHOICE,
276 [&]( wxCommandEvent& )
277 {
278 // Area mode is index 2
279 m_islandThreshold.Enable( m_cbRemoveIslands->GetSelection() == 2 );
280 } );
281
283
285}
286
287
289{
291 {
293 m_rbEnvelope->SetValue( true );
294 else
295 m_rbCenterline->SetValue( true );
296
298 m_gap->Enable( m_rbEnvelope->GetValue() );
299 }
300
301 m_cbLocked->SetValue( m_settings.m_Locked );
305
306 if( m_isTeardrop ) // outlines are never smoothed: they have already the right shape
307 {
308 m_cornerSmoothingChoice->SetSelection( 0 );
309 m_cornerSmoothingChoice->Enable( false );
311 m_cornerRadius.Enable( false );
312 }
313
315 {
316 case ZONE_BORDER_DISPLAY_STYLE::NO_HATCH: m_OutlineDisplayCtrl->SetSelection( 0 ); break;
317 case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE: m_OutlineDisplayCtrl->SetSelection( 1 ); break;
318 case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL: m_OutlineDisplayCtrl->SetSelection( 2 ); break;
319 case ZONE_BORDER_DISPLAY_STYLE::INVISIBLE_BORDER: break; // Not used for standard zones
320 }
321
323
326
327 switch( m_settings.GetPadConnection() )
328 {
329 default:
330 case ZONE_CONNECTION::THERMAL: m_PadInZoneOpt->SetSelection( 1 ); break;
331 case ZONE_CONNECTION::THT_THERMAL: m_PadInZoneOpt->SetSelection( 2 ); break;
332 case ZONE_CONNECTION::NONE: m_PadInZoneOpt->SetSelection( 3 ); break;
333 case ZONE_CONNECTION::FULL: m_PadInZoneOpt->SetSelection( 0 ); break;
334 }
335
336 if( m_isTeardrop )
337 {
338 m_PadInZoneOpt->SetSelection( 0 );
339 m_PadInZoneOpt->Enable( false );
340 }
341
342 // Do not enable/disable antipad clearance and spoke width. They might be needed if
343 // a footprint or pad overrides the zone to specify a thermal connection.
346
347 m_islandThreshold.SetDataType( EDA_DATA_TYPE::AREA );
349
350 m_cbRemoveIslands->SetSelection( static_cast<int>( m_settings.GetIslandRemovalMode() ) );
351
352 m_islandThreshold.Enable( m_settings.GetIslandRemovalMode() == ISLAND_REMOVAL_MODE::AREA );
353
355
358
360
361 // Initialize information required to display nets list
363
364 if( !m_isTeardrop && m_settings.m_FillMode == ZONE_FILL_MODE::HATCH_PATTERN )
365 m_GridStyleCtrl->SetSelection( 1 );
366 else
367 m_GridStyleCtrl->SetSelection( 0 );
368
369 m_GridStyleCtrl->Enable( !m_isTeardrop );
370
371 m_gridStyleRotation.SetUnits( EDA_UNITS::DEGREES );
375
378
379 m_tcZoneName->SetValue( m_settings.m_Name );
380
382
383 // Enable/Disable some widgets
384 wxCommandEvent event;
385 OnStyleSelection( event );
386 OnNetSelectionUpdated( event );
387
388 Fit();
389
390 return true;
391}
392
393
395{
396 const NETINFO_LIST& netInfoList = m_Parent->GetBoard()->GetNetInfo();
397
398 m_netInfoItemList.clear();
399 m_netInfoItemList.reserve( netInfoList.GetNetCount() );
400
401 m_netNameToNetCode.clear();
402 m_netNameToNetCode[ _( "<no net>" ) ] = INVALID_NET_CODE;
403
405
406 for( NETINFO_ITEM* net : netInfoList )
407 {
408 const int netCode = net->GetNetCode();
409 const wxString& netName = getUnescapedNetName( net );
410
411 m_netNameToNetCode[netName] = netCode;
412
413 if( netCode > INVALID_NET_CODE && net->IsCurrent() )
414 {
415 m_netInfoItemList.push_back( net );
416 m_maxNetCode = std::max( netCode, m_maxNetCode );
417 }
418 }
419
421}
422
423
424void DIALOG_COPPER_ZONE::OnUpdateUI( wxUpdateUIEvent& )
425{
426 if( m_cornerSmoothingType != m_cornerSmoothingChoice->GetSelection() )
427 {
429
431 m_cornerRadiusLabel->SetLabel( _( "Chamfer distance:" ) );
432 else
433 m_cornerRadiusLabel->SetLabel( _( "Fillet radius:" ) );
434 }
435
437
438 if( m_gap )
439 m_gap->Enable( m_rbEnvelope->GetValue() );
440}
441
442
443void DIALOG_COPPER_ZONE::OnNetSelectionUpdated( wxCommandEvent& event )
444{
446
448
449 // When info bar is updated, the nets-list shrinks.
450 // Therefore, we need to reestablish the list and maintain the
451 // correct selection
453
454 // Zones with no net never have islands removed
456 {
457 if( m_cbRemoveIslands->IsEnabled() )
459
460 m_cbRemoveIslands->SetSelection( 1 );
461 m_staticText40->Enable( false );
462 m_cbRemoveIslands->Enable( false );
463 }
464 else if( !m_cbRemoveIslands->IsEnabled() )
465 {
466 m_cbRemoveIslands->SetSelection( static_cast<int>( m_settings.GetIslandRemovalMode() ) );
467 m_staticText40->Enable( true );
468 m_cbRemoveIslands->Enable( true );
469 }
470}
471
472
474{
475 m_islandThreshold.Enable( m_cbRemoveIslands->GetSelection() == 2 );
476}
477
478
480{
481 if( m_GridStyleCtrl->GetSelection() > 0 )
482 m_settings.m_FillMode = ZONE_FILL_MODE::HATCH_PATTERN;
483 else
484 m_settings.m_FillMode = ZONE_FILL_MODE::POLYGONS;
485
486 if( !AcceptOptions() )
487 return false;
488
490 {
491 if( m_rbEnvelope->GetValue() )
493 else
495
498 }
499
505
506 *m_ptr = m_settings;
507 return true;
508}
509
510
512{
514 return false;
515
517 return false;
518
519 if( !m_cornerRadius.Validate( 0, INT_MAX ) )
520 return false;
521
522 if( !m_spokeWidth.Validate( 0, INT_MAX ) )
523 return false;
524
526
527 if( m_settings.m_FillMode == ZONE_FILL_MODE::HATCH_PATTERN )
528 {
529 int minThickness = m_minWidth.GetIntValue();
530
531 if( !m_gridStyleThickness.Validate( minThickness, INT_MAX ) )
532 return false;
533
534 if( !m_gridStyleGap.Validate( minThickness, INT_MAX ) )
535 return false;
536 }
537
538 switch( m_PadInZoneOpt->GetSelection() )
539 {
540 case 3: m_settings.SetPadConnection( ZONE_CONNECTION::NONE ); break;
541 case 2: m_settings.SetPadConnection( ZONE_CONNECTION::THT_THERMAL ); break;
542 case 1: m_settings.SetPadConnection( ZONE_CONNECTION::THERMAL ); break;
543 case 0: m_settings.SetPadConnection( ZONE_CONNECTION::FULL ); break;
544 }
545
546 switch( m_OutlineDisplayCtrl->GetSelection() )
547 {
548 case 0: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH; break;
549 case 1: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE; break;
550 case 2: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL; break;
551 }
552
555 return false;
556
558
561
563
566 else
568
570
571 m_settings.m_Locked = m_cbLocked->GetValue();
572
575
577 {
578 DisplayError( this, _( "Thermal spoke width cannot be smaller than the minimum width." ) );
579 return false;
580 }
581
583
586
587 // Get the layer selection for this zone
588 int layers = 0;
589
590 for( int ii = 0; ii < m_layers->GetItemCount(); ++ii )
591 {
592 if( m_layers->GetToggleValue( (unsigned) ii, 0 ) )
593 layers++;
594 }
595
596 if( layers == 0 )
597 {
598 DisplayError( this, _( "No layer selected." ) );
599 return false;
600 }
601
603
604 m_settings.m_Name = m_tcZoneName->GetValue();
605
606 return true;
607}
608
609
611{
612 const int netSelection = m_ListNetNameSelection->GetSelection();
613
614 if( netSelection > 0 )
615 {
616 const wxString& selectedNetName = m_ListNetNameSelection->GetString( netSelection );
618 }
619 else
620 {
622 }
623}
624
625
626void DIALOG_COPPER_ZONE::OnStyleSelection( wxCommandEvent& event )
627{
628 bool enable = m_GridStyleCtrl->GetSelection() >= 1;
629 m_tcGridStyleThickness->Enable( enable );
630 m_tcGridStyleGap->Enable( enable );
631 m_tcGridStyleOrientation->Enable( enable );
632 m_spinCtrlSmoothLevel->Enable( enable );
633 m_spinCtrlSmoothValue->Enable( enable );
634}
635
636
637void DIALOG_COPPER_ZONE::OnLayerSelection( wxDataViewEvent& event )
638{
639 if( event.GetColumn() != 0 )
640 return;
641
642 int row = m_layers->ItemToRow( event.GetItem() );
643
644 bool checked = m_layers->GetToggleValue( row, 0 );
645
646 wxVariant layerID;
647 m_layers->GetValue( layerID, row, 2 );
648
649 m_settings.m_Layers.set( ToLAYER_ID( layerID.GetInteger() ), checked );
650}
651
652
654{
656}
657
658
660{
661 // These configurations are persistent across multiple invocations of
662 // this dialog
663 int newConfig = NO_PERSISTENT_SORT_MODE;
664
666 newConfig |= HIDE_ANONYMOUS_NETS;
667
669 newConfig |= SORT_BY_PAD_COUNT;
670
672 cfg->m_Zones.net_sort_mode = newConfig;
673}
674
675
677{
679 int sortMode = cfg->m_Zones.net_sort_mode;
680
681 if( sortMode == DEFAULT_SORT_CONFIG )
682 sortMode = HIDE_ANONYMOUS_NETS;
683
686}
687
688
690{
692}
693
694
696{
698
699 wxArrayString listOfNets = buildListOfNetsToDisplay();
700
701 const int selectedNet = ensureSelectedNetIsVisible( m_currentlySelectedNetcode, listOfNets );
702
703 displayNetsList( listOfNets, selectedNet );
704}
705
706
708{
710
711 // Hide nets filter criteria
713
714 // Nets sort criteria
716}
717
718
720{
721 wxString netNameShowFilter = m_ShowNetNameFilter->GetValue();
722
723 if( netNameShowFilter.Len() == 0 )
724 netNameShowFilter = wxT( "*" );
725
726 wxStringTokenizer showFilters( netNameShowFilter.Lower(), wxT( "," ) );
727
728 m_showNetsFilter.clear();
729
730 while( showFilters.HasMoreTokens() )
731 {
732 wxString filter = showFilters.GetNextToken();
733 filter.Trim( false );
734 filter.Trim( true );
735
736 if( !filter.IsEmpty() )
737 {
738 m_showNetsFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD>() );
739 m_showNetsFilter.back()->SetPattern( filter );
740 }
741 }
742}
743
744
746{
748
749 wxArrayString netNames;
750
751 for( NETINFO_ITEM* net : m_netInfoItemList )
752 {
753 if( m_hideAutoGeneratedNets && net->HasAutoGeneratedNetname() )
754 continue;
755
756 const wxString& netName = getUnescapedNetName( net );
757
758 for( const NET_FILTER& filter : m_showNetsFilter )
759 {
760 if( filter->Find( netName.Lower() ) )
761 {
762 netNames.Add( netName );
763 break;
764 }
765 }
766 }
767
768 netNames.Insert( _( "<no net>" ), INVALID_NET_CODE );
769
770 return netNames;
771}
772
773
775{
778 else
780}
781
782
783void DIALOG_COPPER_ZONE::sortNetsByPadCount( std::vector<NETINFO_ITEM*>& nets,
784 const int maxNetCode )
785{
786 const std::vector<PAD*> pads = m_Parent->GetBoard()->GetPads();
787
788 padCountListByNet.clear();
789
790 // +1 is required for <no-net> item
791 padCountListByNet.assign( maxNetCode + 1, 0 );
792
793 for( PAD* pad : pads )
794 {
795 const int netCode = pad->GetNetCode();
796
797 if( netCode > INVALID_NET_CODE )
798 padCountListByNet[netCode]++;
799 }
800
801 sort( nets.begin(), nets.end(), sortNetsByNodes );
802}
803
804
805void DIALOG_COPPER_ZONE::displayNetsList( const wxArrayString& netNamesList, int selectIndex )
806{
807 m_ListNetNameSelection->Clear();
808 m_ListNetNameSelection->InsertItems( netNamesList, 0 );
809 m_ListNetNameSelection->SetSelection( selectIndex );
810 m_ListNetNameSelection->EnsureVisible( selectIndex );
811}
812
813
814int DIALOG_COPPER_ZONE::ensureSelectedNetIsVisible( int selectedNetCode, wxArrayString& netsList )
815{
816 int selectedIndex = 0;
817
818 if( selectedNetCode > INVALID_NET_CODE )
819 {
820 NETINFO_ITEM* selectedNet = m_Parent->GetBoard()->FindNet( selectedNetCode );
821
822 if( selectedNet )
823 {
824 const wxString& netName = getUnescapedNetName( selectedNet );
825 selectedIndex = netsList.Index( netName );
826
827 if( wxNOT_FOUND == selectedIndex )
828 {
829 // the currently selected net must *always* be visible.
830 // <no net> is the zero'th index, so pick next lowest
831 netsList.Insert( netName, 1 );
832 selectedIndex = 1;
833 }
834 }
835 }
836
837 return selectedIndex;
838}
839
840
842{
843 return UnescapeString( net->GetNetname() );
844}
845
846
848{
850 && !m_copperZoneInfo->IsShown()
852 {
853 m_copperZoneInfo->ShowMessage( _( "<no net> will result in an isolated copper island." ),
854 wxICON_WARNING );
855 }
856 else if( m_copperZoneInfo->IsShown() )
857 {
858 m_copperZoneInfo->Dismiss();
859 }
860}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
BASE_SET & set(size_t pos)
Definition: base_set.h:115
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:871
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1922
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
Definition: board.cpp:2600
int GetCopperLayerCount() const
Definition: board.cpp:741
Class DIALOG_COPPER_ZONE_BASE.
wxSpinCtrlDouble * m_spinCtrlSmoothValue
bool TransferDataFromWindow() override
void OnStyleSelection(wxCommandEvent &event) override
std::map< wxString, int > m_netNameToNetCode
NET_FILTER_LIST m_showNetsFilter
void OnNetSortingOptionSelected(wxCommandEvent &event) override
DIALOG_COPPER_ZONE(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aSettings, CONVERT_SETTINGS *aConvertSettings)
wxArrayString buildListOfNetsToDisplay()
void sortNetsByPadCount(std::vector< NETINFO_ITEM * > &nets, const int maxNetCode)
int ensureSelectedNetIsVisible(int selectedNetCode, wxArrayString &netsList)
wxRadioButton * m_rbCenterline
bool TransferDataToWindow() override
wxString getUnescapedNetName(const NETINFO_ITEM *net)
void OnLayerSelection(wxDataViewEvent &event) override
CONVERT_SETTINGS * m_convertSettings
void OnShowNetNameFilterChange(wxCommandEvent &event) override
void OnRemoveIslandsSelection(wxCommandEvent &event) override
static constexpr int HIDE_ANONYMOUS_NETS
std::vector< NET_FILTER > NET_FILTER_LIST
wxCheckBox * m_cbDeleteOriginals
static constexpr int INVALID_NET_CODE
std::unique_ptr< EDA_PATTERN_MATCH > NET_FILTER
PCB_BASE_FRAME * m_Parent
static constexpr int SORT_BY_PAD_COUNT
static constexpr int DEFAULT_SORT_CONFIG
std::vector< NETINFO_ITEM * > m_netInfoItemList
void OnUpdateUI(wxUpdateUIEvent &) override
void displayNetsList(const wxArrayString &netNamesList, int selectIndex)
wxRadioButton * m_rbEnvelope
void OnNetSelectionUpdated(wxCommandEvent &event) override
static constexpr int NO_PERSISTENT_SORT_MODE
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:102
void SetupStandardButtons(std::map< int, wxString > aLabels={})
int ShowQuasiModal()
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:686
Handle the data for a net.
Definition: netinfo.h:56
const wxString & GetNetname() const
Definition: netinfo.h:114
int GetNetCode() const
Definition: netinfo.h:108
Container for NETINFO_ITEM elements, which are the nets.
Definition: netinfo.h:346
unsigned GetNetCount() const
Definition: netinfo.h:369
Definition: pad.h:54
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
PCBNEW_SETTINGS * GetPcbNewSettings() const
BOARD * GetBoard() const
int GetIntValue()
Definition: unit_binder.h:129
virtual long long int GetValue()
Return the current value in Internal Units.
void Enable(bool aEnable)
Enable/disable the label, widget and units label.
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
virtual EDA_ANGLE GetAngleValue()
void SetDataType(EDA_DATA_TYPE aDataType)
Used to override the datatype of the displayed property (default is DISTANCE)
virtual void SetAngleValue(const EDA_ANGLE &aValue)
virtual void SetDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
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 SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:78
EDA_ANGLE m_HatchOrientation
Definition: zone_settings.h:96
void SetIslandRemovalMode(ISLAND_REMOVAL_MODE aRemove)
double m_HatchSmoothingValue
Definition: zone_settings.h:99
void SetMinIslandArea(long long int aArea)
void SetPadConnection(ZONE_CONNECTION aPadConnection)
int m_ZoneMinThickness
Definition: zone_settings.h:93
long long int GetMinIslandArea() const
long m_ThermalReliefSpokeWidth
ZONE_CONNECTION GetPadConnection() const
TEARDROP_TYPE m_TeardropType
unsigned m_ZonePriority
Definition: zone_settings.h:89
void SetCornerRadius(int aRadius)
void SetupLayersList(wxDataViewListCtrl *aList, PCB_BASE_FRAME *aFrame, LSET aLayers, bool aFpEditorMode)
A helper routine for the various zone dialogs (copper, non-copper, keepout).
wxString m_Name
int GetCornerSmoothingType() const
ZONE_FILL_MODE m_FillMode
Definition: zone_settings.h:91
long m_ThermalReliefGap
void SetCornerSmoothingType(int aType)
int m_HatchSmoothingLevel
Definition: zone_settings.h:97
unsigned int GetCornerRadius() const
ISLAND_REMOVAL_MODE GetIslandRemovalMode() const
ZONE_BORDER_DISPLAY_STYLE m_ZoneBorderDisplayStyle
Option to show the zone area (outlines only, short hatches or full hatches.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:170
This file is part of the common library.
static bool sortNetsByNodes(const NETINFO_ITEM *a, const NETINFO_ITEM *b)
int InvokeCopperZonesEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings, CONVERT_SETTINGS *aConvertSettings)
Function InvokeCopperZonesEditor invokes up a modal dialog window for copper zone editing.
static bool sortNetsByNames(const NETINFO_ITEM *a, const NETINFO_ITEM *b)
static std::vector< int > padCountListByNet
#define _(s)
Abstract pattern-matching tool and implementations.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:820
@ CENTERLINE
@ BOUNDING_HULL
wxString UnescapeString(const wxString &aSource)
CONVERT_STRATEGY m_Strategy
constexpr int mmToIU(double mm) const
Definition: base_units.h:88
T NormalizeAngle180(T Angle)
Normalize angle to be in the -180.0 .
Definition: trigo.h:196
ISLAND_REMOVAL_MODE
Whether or not to remove isolated islands from a zone.
Definition: zone_settings.h:59
#define ZONE_CLEARANCE_MAX_VALUE_MM
Definition: zones.h:38
#define ZONE_BORDER_HATCH_MINDIST_MM
Definition: zones.h:40
#define ZONE_THICKNESS_MIN_VALUE_MM
Definition: zones.h:36
#define ZONE_BORDER_HATCH_MAXDIST_MM
Definition: zones.h:41