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
49private:
50 using NET_FILTER = std::unique_ptr<EDA_PATTERN_MATCH>;
51 using NET_FILTER_LIST = std::vector<NET_FILTER>;
52
53 static constexpr int INVALID_NET_CODE{ 0 };
54
55 static constexpr int DEFAULT_SORT_CONFIG{ -1 };
56 static constexpr int NO_PERSISTENT_SORT_MODE{ 0 };
57 static constexpr int HIDE_ANONYMOUS_NETS{ 1 << 0 };
58 static constexpr int SORT_BY_PAD_COUNT{ 1 << 1 };
59
60 bool TransferDataToWindow() override;
61 bool TransferDataFromWindow() override;
62
66 bool AcceptOptions();
67
68 void OnStyleSelection( wxCommandEvent& event ) override;
69 void OnLayerSelection( wxDataViewEvent& event ) override;
70 void OnNetSortingOptionSelected( wxCommandEvent& event ) override;
71 void OnShowNetNameFilterChange( wxCommandEvent& event ) override;
72 void OnUpdateUI( wxUpdateUIEvent& ) override;
73 void OnNetSelectionUpdated( wxCommandEvent& event ) override;
74 void OnRemoveIslandsSelection( wxCommandEvent& event ) override;
75
76 void readNetInformation();
78 wxArrayString buildListOfNetsToDisplay();
79 void sortNetsByPadCount( std::vector<NETINFO_ITEM*>& nets, const int maxNetCode );
81 int ensureSelectedNetIsVisible( int selectedNetCode, wxArrayString& netsList );
82 void displayNetsList( const wxArrayString& netNamesList, int selectIndex );
84 wxString getUnescapedNetName( const NETINFO_ITEM* net );
85 void sortNetsIfRequired();
87 void updateInfoBar();
90
91private:
93
98
103
109
116
117 std::map<wxString, int> m_netNameToNetCode;
118 std::vector<NETINFO_ITEM*> m_netInfoItemList;
119
121 wxRadioButton* m_rbCenterline;
122 wxRadioButton* m_rbEnvelope;
124};
125
126
128 CONVERT_SETTINGS* aConvertSettings )
129{
130 DIALOG_COPPER_ZONE dlg( aCaller, aSettings, aConvertSettings );
131
132 // TODO: why does this need QuasiModal?
133 return dlg.ShowQuasiModal();
134}
135
136
137// The pad count for each netcode, stored in a buffer for a fast access.
138// This is needed by the sort function sortNetsByNodes()
139static std::vector<int> padCountListByNet;
140
141
142// Sort nets by decreasing pad count.
143// For same pad count, sort by alphabetic names
144static bool sortNetsByNodes( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
145{
146 int countA = padCountListByNet[a->GetNetCode()];
147 int countB = padCountListByNet[b->GetNetCode()];
148
149 if( countA == countB )
150 return a->GetNetname() < b->GetNetname();
151 else
152 return countB < countA;
153}
154
155
156// Sort nets by alphabetic names
157static bool sortNetsByNames( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
158{
159 return a->GetNetname() < b->GetNetname();
160}
161
162
164 CONVERT_SETTINGS* aConvertSettings ) :
165 DIALOG_COPPER_ZONE_BASE( aParent ),
166 m_cornerSmoothingType( ZONE_SETTINGS::SMOOTHING_UNDEFINED ),
167 m_outlineHatchPitch( aParent, m_stBorderHatchPitchText,
168 m_outlineHatchPitchCtrl, m_outlineHatchUnits ),
169 m_cornerRadius( aParent, m_cornerRadiusLabel, m_cornerRadiusCtrl, m_cornerRadiusUnits ),
170 m_clearance( aParent, m_clearanceLabel, m_clearanceCtrl, m_clearanceUnits ),
171 m_minWidth( aParent, m_minWidthLabel, m_minWidthCtrl, m_minWidthUnits ),
172 m_antipadClearance( aParent, m_antipadLabel, m_antipadCtrl, m_antipadUnits ),
173 m_spokeWidth( aParent, m_spokeWidthLabel, m_spokeWidthCtrl, m_spokeWidthUnits ),
174 m_gridStyleRotation( aParent, m_staticTextGrindOrient, m_tcGridStyleOrientation,
175 m_staticTextRotUnits ),
176 m_gridStyleThickness( aParent, m_staticTextStyleThickness, m_tcGridStyleThickness,
177 m_GridStyleThicknessUnits ),
178 m_gridStyleGap( aParent, m_staticTextGridGap, m_tcGridStyleGap, m_GridStyleGapUnits ),
179 m_islandThreshold( aParent, m_islandThresholdLabel, m_tcIslandThreshold,
180 m_islandThresholdUnits ),
181 m_hideAutoGeneratedNets{ false },
182 m_convertSettings( aConvertSettings ),
183 m_rbCenterline( nullptr ),
184 m_rbEnvelope( nullptr ),
185 m_cbDeleteOriginals( nullptr )
186{
187 m_Parent = aParent;
188
189 m_ptr = aSettings;
190 m_settings = *aSettings;
193 false );
194 m_isTeardrop = m_settings.m_TeardropType != TEARDROP_TYPE::TD_NONE;
195
196 switch( m_settings.m_TeardropType )
197 {
198 case TEARDROP_TYPE::TD_NONE:
199 // standard copper zone
200 break;
201
202 case TEARDROP_TYPE::TD_VIAPAD:
203 SetTitle( _( "Teardrop on Vias/Pads Properties" ) );
204 break;
205
206 case TEARDROP_TYPE::TD_TRACKEND:
207 SetTitle( _( "Teardrop on Tracks Properties" ) );
208 break;
209
210 default:
211 SetTitle( _( "Teardrop Properties" ) );
212 break;
213 }
214
215 if( aConvertSettings )
216 {
217 wxStaticBox* bConvertBox = new wxStaticBox( this, wxID_ANY, _( "Conversion Settings" ) );
218 wxStaticBoxSizer* bConvertSizer = new wxStaticBoxSizer( bConvertBox, wxVERTICAL );
219
220 m_rbCenterline = new wxRadioButton( this, wxID_ANY, _( "Use centerlines" ) );
221 bConvertSizer->Add( m_rbCenterline, 0, wxLEFT|wxRIGHT, 5 );
222
223 bConvertSizer->AddSpacer( 2 );
224 m_rbEnvelope = new wxRadioButton( this, wxID_ANY, _( "Create bounding hull" ) );
225 bConvertSizer->Add( m_rbEnvelope, 0, wxLEFT|wxRIGHT, 5 );
226
227 bConvertSizer->AddSpacer( 6 );
228 m_cbDeleteOriginals = new wxCheckBox( this, wxID_ANY, _( "Delete source objects after conversion" ) );
229 bConvertSizer->Add( m_cbDeleteOriginals, 0, wxALL, 5 );
230
231 GetSizer()->Insert( 0, bConvertSizer, 0, wxALL|wxEXPAND, 10 );
232
233 wxStaticLine* line = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
234 wxLI_HORIZONTAL );
235 GetSizer()->Insert( 1, line, 0, wxLEFT|wxRIGHT|wxEXPAND, 10 );
236
237 SetTitle( _( "Convert to Copper Zone" ) );
238 }
239
242
243 m_netSortingByPadCount = true; // false = alphabetic sort, true = pad count sort
244
245 m_ShowNetNameFilter->SetHint( _( "Filter" ) );
246
247 m_cbRemoveIslands->Bind( wxEVT_CHOICE,
248 [&]( wxCommandEvent& )
249 {
250 // Area mode is index 2
251 m_islandThreshold.Enable( m_cbRemoveIslands->GetSelection() == 2 );
252 } );
253
255
257}
258
259
261{
263 {
265 m_rbEnvelope->SetValue( true );
266 else
267 m_rbCenterline->SetValue( true );
268
270 }
271
272 m_cbLocked->SetValue( m_settings.m_Locked );
276
277 if( m_isTeardrop ) // outlines are never smoothed: they have already the right shape
278 {
279 m_cornerSmoothingChoice->SetSelection( 0 );
280 m_cornerSmoothingChoice->Enable( false );
282 m_cornerRadius.Enable( false );
283 }
284
286 {
287 case ZONE_BORDER_DISPLAY_STYLE::NO_HATCH: m_OutlineDisplayCtrl->SetSelection( 0 ); break;
288 case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE: m_OutlineDisplayCtrl->SetSelection( 1 ); break;
289 case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL: m_OutlineDisplayCtrl->SetSelection( 2 ); break;
290 case ZONE_BORDER_DISPLAY_STYLE::INVISIBLE_BORDER: break; // Not used for standard zones
291 }
292
294
297
298 switch( m_settings.GetPadConnection() )
299 {
300 default:
301 case ZONE_CONNECTION::THERMAL: m_PadInZoneOpt->SetSelection( 1 ); break;
302 case ZONE_CONNECTION::THT_THERMAL: m_PadInZoneOpt->SetSelection( 2 ); break;
303 case ZONE_CONNECTION::NONE: m_PadInZoneOpt->SetSelection( 3 ); break;
304 case ZONE_CONNECTION::FULL: m_PadInZoneOpt->SetSelection( 0 ); break;
305 }
306
307 if( m_isTeardrop )
308 {
309 m_PadInZoneOpt->SetSelection( 0 );
310 m_PadInZoneOpt->Enable( false );
311 }
312
313 // Do not enable/disable antipad clearance and spoke width. They might be needed if
314 // a footprint or pad overrides the zone to specify a thermal connection.
317
318 m_islandThreshold.SetDataType( EDA_DATA_TYPE::AREA );
320
321 m_cbRemoveIslands->SetSelection( static_cast<int>( m_settings.GetIslandRemovalMode() ) );
322
323 m_islandThreshold.Enable( m_settings.GetIslandRemovalMode() == ISLAND_REMOVAL_MODE::AREA );
324
326
329
331
332 // Initialize information required to display nets list
334
335 if( !m_isTeardrop && m_settings.m_FillMode == ZONE_FILL_MODE::HATCH_PATTERN )
336 m_GridStyleCtrl->SetSelection( 1 );
337 else
338 m_GridStyleCtrl->SetSelection( 0 );
339
340 m_GridStyleCtrl->Enable( !m_isTeardrop );
341
342 m_gridStyleRotation.SetUnits( EDA_UNITS::DEGREES );
346
349
350 m_tcZoneName->SetValue( m_settings.m_Name );
351
353
354 // Enable/Disable some widgets
355 wxCommandEvent event;
356 OnStyleSelection( event );
357 OnNetSelectionUpdated( event );
358
359 Fit();
360
361 return true;
362}
363
364
366{
367 const NETINFO_LIST& netInfoList = m_Parent->GetBoard()->GetNetInfo();
368
369 m_netInfoItemList.clear();
370 m_netInfoItemList.reserve( netInfoList.GetNetCount() );
371
372 m_netNameToNetCode.clear();
373 m_netNameToNetCode[ _( "<no net>" ) ] = INVALID_NET_CODE;
374
376
377 for( NETINFO_ITEM* net : netInfoList )
378 {
379 const int netCode = net->GetNetCode();
380 const wxString& netName = getUnescapedNetName( net );
381
382 m_netNameToNetCode[netName] = netCode;
383
384 if( netCode > INVALID_NET_CODE && net->IsCurrent() )
385 {
386 m_netInfoItemList.push_back( net );
387 m_maxNetCode = std::max( netCode, m_maxNetCode );
388 }
389 }
390
392}
393
394
395void DIALOG_COPPER_ZONE::OnUpdateUI( wxUpdateUIEvent& )
396{
397 if( m_cornerSmoothingType != m_cornerSmoothingChoice->GetSelection() )
398 {
400
402 m_cornerRadiusLabel->SetLabel( _( "Chamfer distance:" ) );
403 else
404 m_cornerRadiusLabel->SetLabel( _( "Fillet radius:" ) );
405 }
406
408}
409
410
411void DIALOG_COPPER_ZONE::OnNetSelectionUpdated( wxCommandEvent& event )
412{
414
416
417 // When info bar is updated, the nets-list shrinks.
418 // Therefore, we need to reestablish the list and maintain the
419 // correct selection
421
422 // Zones with no net never have islands removed
424 {
425 if( m_cbRemoveIslands->IsEnabled() )
427
428 m_cbRemoveIslands->SetSelection( 1 );
429 m_staticText40->Enable( false );
430 m_cbRemoveIslands->Enable( false );
431 }
432 else if( !m_cbRemoveIslands->IsEnabled() )
433 {
434 m_cbRemoveIslands->SetSelection( static_cast<int>( m_settings.GetIslandRemovalMode() ) );
435 m_staticText40->Enable( true );
436 m_cbRemoveIslands->Enable( true );
437 }
438}
439
440
442{
443 m_islandThreshold.Enable( m_cbRemoveIslands->GetSelection() == 2 );
444}
445
446
448{
449 if( m_GridStyleCtrl->GetSelection() > 0 )
450 m_settings.m_FillMode = ZONE_FILL_MODE::HATCH_PATTERN;
451 else
452 m_settings.m_FillMode = ZONE_FILL_MODE::POLYGONS;
453
454 if( !AcceptOptions() )
455 return false;
456
458 {
459 if( m_rbEnvelope->GetValue() )
461 else
463
465 }
466
472
473 *m_ptr = m_settings;
474 return true;
475}
476
477
479{
481 return false;
482
484 return false;
485
486 if( !m_cornerRadius.Validate( 0, INT_MAX ) )
487 return false;
488
489 if( !m_spokeWidth.Validate( 0, INT_MAX ) )
490 return false;
491
493
494 if( m_settings.m_FillMode == ZONE_FILL_MODE::HATCH_PATTERN )
495 {
496 int minThickness = m_minWidth.GetIntValue();
497
498 if( !m_gridStyleThickness.Validate( minThickness, INT_MAX ) )
499 return false;
500
501 if( !m_gridStyleGap.Validate( minThickness, INT_MAX ) )
502 return false;
503 }
504
505 switch( m_PadInZoneOpt->GetSelection() )
506 {
507 case 3: m_settings.SetPadConnection( ZONE_CONNECTION::NONE ); break;
508 case 2: m_settings.SetPadConnection( ZONE_CONNECTION::THT_THERMAL ); break;
509 case 1: m_settings.SetPadConnection( ZONE_CONNECTION::THERMAL ); break;
510 case 0: m_settings.SetPadConnection( ZONE_CONNECTION::FULL ); break;
511 }
512
513 switch( m_OutlineDisplayCtrl->GetSelection() )
514 {
515 case 0: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH; break;
516 case 1: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE; break;
517 case 2: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL; break;
518 }
519
522 return false;
523
525
528
530
533 else
535
537
538 m_settings.m_Locked = m_cbLocked->GetValue();
539
542
544 {
545 DisplayError( this, _( "Thermal spoke width cannot be smaller than the minimum width." ) );
546 return false;
547 }
548
550
553
554 // Get the layer selection for this zone
555 int layers = 0;
556
557 for( int ii = 0; ii < m_layers->GetItemCount(); ++ii )
558 {
559 if( m_layers->GetToggleValue( (unsigned) ii, 0 ) )
560 layers++;
561 }
562
563 if( layers == 0 )
564 {
565 DisplayError( this, _( "No layer selected." ) );
566 return false;
567 }
568
570
571 m_settings.m_Name = m_tcZoneName->GetValue();
572
573 return true;
574}
575
576
578{
579 const int netSelection = m_ListNetNameSelection->GetSelection();
580
581 if( netSelection > 0 )
582 {
583 const wxString& selectedNetName = m_ListNetNameSelection->GetString( netSelection );
585 }
586 else
587 {
589 }
590}
591
592
593void DIALOG_COPPER_ZONE::OnStyleSelection( wxCommandEvent& event )
594{
595 bool enable = m_GridStyleCtrl->GetSelection() >= 1;
596 m_tcGridStyleThickness->Enable( enable );
597 m_tcGridStyleGap->Enable( enable );
598 m_tcGridStyleOrientation->Enable( enable );
599 m_spinCtrlSmoothLevel->Enable( enable );
600 m_spinCtrlSmoothValue->Enable( enable );
601}
602
603
604void DIALOG_COPPER_ZONE::OnLayerSelection( wxDataViewEvent& event )
605{
606 if( event.GetColumn() != 0 )
607 return;
608
609 int row = m_layers->ItemToRow( event.GetItem() );
610
611 bool checked = m_layers->GetToggleValue( row, 0 );
612
613 wxVariant layerID;
614 m_layers->GetValue( layerID, row, 2 );
615
616 m_settings.m_Layers.set( ToLAYER_ID( layerID.GetInteger() ), checked );
617}
618
619
621{
623}
624
625
627{
628 // These configurations are persistent across multiple invocations of
629 // this dialog
630 int newConfig = NO_PERSISTENT_SORT_MODE;
631
633 newConfig |= HIDE_ANONYMOUS_NETS;
634
636 newConfig |= SORT_BY_PAD_COUNT;
637
639 cfg->m_Zones.net_sort_mode = newConfig;
640}
641
642
644{
646 int sortMode = cfg->m_Zones.net_sort_mode;
647
648 if( sortMode == DEFAULT_SORT_CONFIG )
649 sortMode = HIDE_ANONYMOUS_NETS;
650
653}
654
655
657{
659}
660
661
663{
665
666 wxArrayString listOfNets = buildListOfNetsToDisplay();
667
668 const int selectedNet = ensureSelectedNetIsVisible( m_currentlySelectedNetcode, listOfNets );
669
670 displayNetsList( listOfNets, selectedNet );
671}
672
673
675{
677
678 // Hide nets filter criteria
680
681 // Nets sort criteria
683}
684
685
687{
688 wxString netNameShowFilter = m_ShowNetNameFilter->GetValue();
689
690 if( netNameShowFilter.Len() == 0 )
691 netNameShowFilter = wxT( "*" );
692
693 wxStringTokenizer showFilters( netNameShowFilter.Lower(), wxT( "," ) );
694
695 m_showNetsFilter.clear();
696
697 while( showFilters.HasMoreTokens() )
698 {
699 wxString filter = showFilters.GetNextToken();
700 filter.Trim( false );
701 filter.Trim( true );
702
703 if( !filter.IsEmpty() )
704 {
705 m_showNetsFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD>() );
706 m_showNetsFilter.back()->SetPattern( filter );
707 }
708 }
709}
710
711
713{
715
716 wxArrayString netNames;
717
718 for( NETINFO_ITEM* net : m_netInfoItemList )
719 {
720 if( m_hideAutoGeneratedNets && net->HasAutoGeneratedNetname() )
721 continue;
722
723 const wxString& netName = getUnescapedNetName( net );
724
725 for( const NET_FILTER& filter : m_showNetsFilter )
726 {
727 if( filter->Find( netName.Lower() ) )
728 {
729 netNames.Add( netName );
730 break;
731 }
732 }
733 }
734
735 netNames.Insert( _( "<no net>" ), INVALID_NET_CODE );
736
737 return netNames;
738}
739
740
742{
745 else
747}
748
749
750void DIALOG_COPPER_ZONE::sortNetsByPadCount( std::vector<NETINFO_ITEM*>& nets,
751 const int maxNetCode )
752{
753 const std::vector<PAD*> pads = m_Parent->GetBoard()->GetPads();
754
755 padCountListByNet.clear();
756
757 // +1 is required for <no-net> item
758 padCountListByNet.assign( maxNetCode + 1, 0 );
759
760 for( PAD* pad : pads )
761 {
762 const int netCode = pad->GetNetCode();
763
764 if( netCode > INVALID_NET_CODE )
765 padCountListByNet[netCode]++;
766 }
767
768 sort( nets.begin(), nets.end(), sortNetsByNodes );
769}
770
771
772void DIALOG_COPPER_ZONE::displayNetsList( const wxArrayString& netNamesList, int selectIndex )
773{
774 m_ListNetNameSelection->Clear();
775 m_ListNetNameSelection->InsertItems( netNamesList, 0 );
776 m_ListNetNameSelection->SetSelection( selectIndex );
777 m_ListNetNameSelection->EnsureVisible( selectIndex );
778}
779
780
781int DIALOG_COPPER_ZONE::ensureSelectedNetIsVisible( int selectedNetCode, wxArrayString& netsList )
782{
783 int selectedIndex = 0;
784
785 if( selectedNetCode > INVALID_NET_CODE )
786 {
787 NETINFO_ITEM* selectedNet = m_Parent->GetBoard()->FindNet( selectedNetCode );
788
789 if( selectedNet )
790 {
791 const wxString& netName = getUnescapedNetName( selectedNet );
792 selectedIndex = netsList.Index( netName );
793
794 if( wxNOT_FOUND == selectedIndex )
795 {
796 // the currently selected net must *always* be visible.
797 // <no net> is the zero'th index, so pick next lowest
798 netsList.Insert( netName, 1 );
799 selectedIndex = 1;
800 }
801 }
802 }
803
804 return selectedIndex;
805}
806
807
809{
810 return UnescapeString( net->GetNetname() );
811}
812
813
815{
817 && !m_copperZoneInfo->IsShown()
819 {
820 m_copperZoneInfo->ShowMessage( _( "<no net> will result in an isolated copper island." ),
821 wxICON_WARNING );
822 }
823 else if( m_copperZoneInfo->IsShown() )
824 {
825 m_copperZoneInfo->Dismiss();
826 }
827}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
BASE_SET & set(size_t pos=std::numeric_limits< size_t >::max(), bool value=true)
Definition: base_set.h:62
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:864
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1901
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
Definition: board.cpp:2574
int GetCopperLayerCount() const
Definition: board.cpp:734
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:733
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:127
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:72
EDA_ANGLE m_HatchOrientation
Definition: zone_settings.h:90
int m_NetcodeSelection
Definition: zone_settings.h:97
void SetIslandRemovalMode(ISLAND_REMOVAL_MODE aRemove)
double m_HatchSmoothingValue
Definition: zone_settings.h:93
void SetMinIslandArea(long long int aArea)
void SetPadConnection(ZONE_CONNECTION aPadConnection)
int m_ZoneMinThickness
Definition: zone_settings.h:87
long long int GetMinIslandArea() const
long m_ThermalReliefSpokeWidth
ZONE_CONNECTION GetPadConnection() const
TEARDROP_TYPE m_TeardropType
unsigned m_ZonePriority
Definition: zone_settings.h:83
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
Definition: zone_settings.h:99
int GetCornerSmoothingType() const
ZONE_FILL_MODE m_FillMode
Definition: zone_settings.h:85
long m_ThermalReliefGap
void SetCornerSmoothingType(int aType)
int m_HatchSmoothingLevel
Definition: zone_settings.h:91
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:876
@ 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:170
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