KiCad PCB EDA Suite
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-2022 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 <kiface_base.h>
27#include <confirm.h>
28#include <pcb_edit_frame.h>
29#include <pcbnew_settings.h>
30#include <zones.h>
31#include <widgets/unit_binder.h>
32#include <zone.h>
33#include <pad.h>
34#include <board.h>
35#include <trigo.h>
36#include <eda_pattern_match.h>
37
39#include <string_utils.h>
40
41
43{
44public:
46 CONVERT_SETTINGS* aConvertSettings );
47
48private:
49 using NET_FILTER = std::unique_ptr<EDA_PATTERN_MATCH>;
50 using NET_FILTER_LIST = std::vector<NET_FILTER>;
51
52 static constexpr int INVALID_NET_CODE{ 0 };
53
54 static constexpr int DEFAULT_SORT_CONFIG{ -1 };
55 static constexpr int NO_PERSISTENT_SORT_MODE{ 0 };
56 static constexpr int HIDE_ANONYMOUS_NETS{ 1 << 0 };
57 static constexpr int SORT_BY_PAD_COUNT{ 1 << 1 };
58
59 bool TransferDataToWindow() override;
60 bool TransferDataFromWindow() override;
61
67 bool AcceptOptions( bool aUseExportableSetupOnly = false );
68
69 void OnStyleSelection( wxCommandEvent& event ) override;
70 void OnLayerSelection( wxDataViewEvent& event ) override;
71 void OnNetSortingOptionSelected( wxCommandEvent& event ) override;
72 void ExportSetupToOtherCopperZones( wxCommandEvent& event ) override;
73 void OnShowNetNameFilterChange( wxCommandEvent& event ) override;
74 void OnUpdateUI( wxUpdateUIEvent& ) override;
75 void OnButtonCancelClick( wxCommandEvent& event ) override;
76 void OnClose( wxCloseEvent& event ) override;
77 void OnNetSelectionUpdated( wxCommandEvent& event ) override;
78 void OnRemoveIslandsSelection( wxCommandEvent& event ) override;
79
80 void readNetInformation();
82 wxArrayString buildListOfNetsToDisplay();
83 void sortNetsByPadCount( std::vector<NETINFO_ITEM*>& nets, const int maxNetCode );
85 int ensureSelectedNetIsVisible( int selectedNetCode, wxArrayString& netsList );
86 void displayNetsList( const wxArrayString& netNamesList, int selectIndex );
88 wxString getUnescapedNetName( const NETINFO_ITEM* net );
89 void sortNetsIfRequired();
91 void updateInfoBar();
94
95private:
97
98 bool m_settingsExported; // settings will be written to all other zones
99
104
109
115
122
123 std::map<wxString, int> m_netNameToNetCode;
124 std::vector<NETINFO_ITEM*> m_netInfoItemList;
125
129};
130
131
133 CONVERT_SETTINGS* aConvertSettings )
134{
135 DIALOG_COPPER_ZONE dlg( aCaller, aSettings, aConvertSettings );
136
137 return dlg.ShowQuasiModal();
138}
139
140
141// The pad count for each netcode, stored in a buffer for a fast access.
142// This is needed by the sort function sortNetsByNodes()
143static std::vector<int> padCountListByNet;
144
145
146// Sort nets by decreasing pad count.
147// For same pad count, sort by alphabetic names
148static bool sortNetsByNodes( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
149{
150 int countA = padCountListByNet[a->GetNetCode()];
151 int countB = padCountListByNet[b->GetNetCode()];
152
153 if( countA == countB )
154 return a->GetNetname() < b->GetNetname();
155 else
156 return countB < countA;
157}
158
159
160// Sort nets by alphabetic names
161static bool sortNetsByNames( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
162{
163 return a->GetNetname() < b->GetNetname();
164}
165
166
168 CONVERT_SETTINGS* aConvertSettings ) :
169 DIALOG_COPPER_ZONE_BASE( aParent ),
170 m_cornerSmoothingType( ZONE_SETTINGS::SMOOTHING_UNDEFINED ),
171 m_outlineHatchPitch( aParent, m_stBorderHatchPitchText,
172 m_outlineHatchPitchCtrl, m_outlineHatchUnits ),
173 m_cornerRadius( aParent, m_cornerRadiusLabel, m_cornerRadiusCtrl, m_cornerRadiusUnits ),
174 m_clearance( aParent, m_clearanceLabel, m_clearanceCtrl, m_clearanceUnits ),
175 m_minWidth( aParent, m_minWidthLabel, m_minWidthCtrl, m_minWidthUnits ),
176 m_antipadClearance( aParent, m_antipadLabel, m_antipadCtrl, m_antipadUnits ),
177 m_spokeWidth( aParent, m_spokeWidthLabel, m_spokeWidthCtrl, m_spokeWidthUnits ),
178 m_gridStyleRotation( aParent, m_staticTextGrindOrient, m_tcGridStyleOrientation,
179 m_staticTextRotUnits ),
180 m_gridStyleThickness( aParent, m_staticTextStyleThickness, m_tcGridStyleThickness,
181 m_GridStyleThicknessUnits ),
182 m_gridStyleGap( aParent, m_staticTextGridGap, m_tcGridStyleGap, m_GridStyleGapUnits ),
183 m_islandThreshold( aParent, m_islandThresholdLabel, m_tcIslandThreshold,
184 m_islandThresholdUnits ),
185 m_hideAutoGeneratedNets{ false },
186 m_convertSettings( aConvertSettings ),
187 m_cbIgnoreLineWidths( nullptr ),
188 m_cbDeleteOriginals( nullptr )
189{
190 m_Parent = aParent;
191
192 m_ptr = aSettings;
193 m_settings = *aSettings;
196 false );
198
199 switch( m_settings.m_TeardropType )
200 {
202 // standard copper zone
203 break;
204
206 SetTitle( _( "Teardrop on Vias/Pads Properties" ) );
207 break;
208
210 SetTitle( _( "Teardrop on Tracks Properties" ) );
211 break;
212
213 default:
214 SetTitle( _( "Teardrop Properties" ) );
215 break;
216 }
217
218 if( aConvertSettings )
219 {
220 wxStaticBox* bConvertBox = new wxStaticBox( this, wxID_ANY,
221 _( "Conversion Settings" ) );
222 wxStaticBoxSizer* bConvertSizer = new wxStaticBoxSizer( bConvertBox, wxVERTICAL );
223
224 m_cbIgnoreLineWidths = new wxCheckBox( this, wxID_ANY,
225 _( "Ignore source object line widths" ) );
226 bConvertSizer->Add( m_cbIgnoreLineWidths, 0, wxLEFT|wxRIGHT, 5 );
227
228 m_cbDeleteOriginals = new wxCheckBox( this, wxID_ANY,
229 _( "Delete source objects after conversion" ) );
230 bConvertSizer->Add( m_cbDeleteOriginals, 0, wxALL, 5 );
231
232 GetSizer()->Insert( 0, bConvertSizer, 0, wxALL|wxEXPAND, 10 );
233
234 wxStaticLine* line = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
235 wxLI_HORIZONTAL );
236 GetSizer()->Insert( 1, line, 0, wxLEFT|wxRIGHT|wxEXPAND, 10 );
237
238 SetTitle( _( "Convert to Copper Zone" ) );
239 }
240
241 m_settingsExported = false;
244
245 m_netSortingByPadCount = true; // false = alphabetic sort, true = pad count sort
246
247 m_ShowNetNameFilter->SetHint( _( "Filter" ) );
248
249 m_cbRemoveIslands->Bind( wxEVT_CHOICE,
250 [&]( wxCommandEvent& )
251 {
252 // Area mode is index 2
253 m_islandThreshold.Enable( m_cbRemoveIslands->GetSelection() == 2 );
254 } );
255
257
259}
260
261
263{
265 {
268 }
269
270 m_cbLocked->SetValue( m_settings.m_Locked );
274
275 if( m_isTeardrop ) // outlines are never smoothed: they have already the right shape
276 {
277 m_cornerSmoothingChoice->SetSelection( 0 );
278 m_cornerSmoothingChoice->Enable( false );
280 m_cornerRadius.Enable( false );
281 }
282
284 {
285 case ZONE_BORDER_DISPLAY_STYLE::NO_HATCH: m_OutlineDisplayCtrl->SetSelection( 0 ); break;
288 }
289
291
294
295 switch( m_settings.GetPadConnection() )
296 {
297 default:
298 case ZONE_CONNECTION::THERMAL: m_PadInZoneOpt->SetSelection( 1 ); break;
299 case ZONE_CONNECTION::THT_THERMAL: m_PadInZoneOpt->SetSelection( 2 ); break;
300 case ZONE_CONNECTION::NONE: m_PadInZoneOpt->SetSelection( 3 ); break;
301 case ZONE_CONNECTION::FULL: m_PadInZoneOpt->SetSelection( 0 ); break;
302 }
303
304 if( m_isTeardrop )
305 {
306 m_PadInZoneOpt->SetSelection( 0 );
307 m_PadInZoneOpt->Enable( false );
308 }
309
310 // Do not enable/disable antipad clearance and spoke width. They might be needed if
311 // a footprint or pad overrides the zone to specify a thermal connection.
314
317
318 m_cbRemoveIslands->SetSelection( static_cast<int>( m_settings.GetIslandRemovalMode() ) );
319
321
323
326
328
329 // Initialize information required to display nets list
331
333 m_GridStyleCtrl->SetSelection( 1 );
334 else
335 m_GridStyleCtrl->SetSelection( 0 );
336
337 m_GridStyleCtrl->Enable( !m_isTeardrop );
338
341
342 // Gives a reasonable value to grid style parameters, if currently there are no defined
343 // parameters for grid pattern thickness and gap (if the value is 0)
344 // the grid pattern thickness default value is (arbitrary) m_ZoneMinThickness * 4
345 // or 1mm
346 // the grid pattern gap default value is (arbitrary) m_ZoneMinThickness * 6
347 // or 1.5 mm
348 int bestvalue = m_settings.m_HatchThickness;
349
350 if( bestvalue <= 0 ) // No defined value for m_HatchThickness
351 bestvalue = std::max( m_settings.m_ZoneMinThickness * 4, pcbIUScale.mmToIU( 1.0 ) );
352
354
355 bestvalue = m_settings.m_HatchGap;
356
357 if( bestvalue <= 0 ) // No defined value for m_HatchGap
358 bestvalue = std::max( m_settings.m_ZoneMinThickness * 6, pcbIUScale.mmToIU( 1.5 ) );
359
360 m_gridStyleGap.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
361
364
365 m_tcZoneName->SetValue( m_settings.m_Name );
366
368
369 // Enable/Disable some widgets
370 wxCommandEvent event;
371 OnStyleSelection( event );
372 OnNetSelectionUpdated( event );
373
374 Fit();
375
376 return true;
377}
378
379
381{
382 NETINFO_LIST& netInfoList = m_Parent->GetBoard()->GetNetInfo();
383
384 m_netInfoItemList.clear();
385 m_netInfoItemList.reserve( netInfoList.GetNetCount() );
386
387 m_netNameToNetCode.clear();
388 m_netNameToNetCode[wxT( "<no net>" )] = INVALID_NET_CODE;
389
391
392 for( NETINFO_ITEM* net : netInfoList )
393 {
394 const int& netCode = net->GetNetCode();
395 const wxString& netName = getUnescapedNetName( net );
396
397 m_netNameToNetCode[netName] = netCode;
398
399 if( netCode > INVALID_NET_CODE && net->IsCurrent() )
400 {
401 m_netInfoItemList.push_back( net );
402 m_maxNetCode = std::max( netCode, m_maxNetCode );
403 }
404 }
405
407}
408
409
410void DIALOG_COPPER_ZONE::OnUpdateUI( wxUpdateUIEvent& )
411{
412 if( m_cornerSmoothingType != m_cornerSmoothingChoice->GetSelection() )
413 {
415
417 m_cornerRadiusLabel->SetLabel( _( "Chamfer distance:" ) );
418 else
419 m_cornerRadiusLabel->SetLabel( _( "Fillet radius:" ) );
420 }
421
423}
424
425
426void DIALOG_COPPER_ZONE::OnButtonCancelClick( wxCommandEvent& event )
427{
428 // After an "Export Settings to Other Zones" cancel and close must return
429 // ZONE_EXPORT_VALUES instead of wxID_CANCEL.
430 Close( true );
431}
432
433
434void DIALOG_COPPER_ZONE::OnNetSelectionUpdated( wxCommandEvent& event )
435{
437
439
440 // When info bar is updated, the nets-list shrinks.
441 // Therefore, we need to reestablish the list and maintain the
442 // correct selection
444
445 // Zones with no net never have islands removed
447 {
448 if( m_cbRemoveIslands->IsEnabled() )
450
451 m_cbRemoveIslands->SetSelection( 1 );
452 m_staticText40->Enable( false );
453 m_cbRemoveIslands->Enable( false );
454 }
455 else if( !m_cbRemoveIslands->IsEnabled() )
456 {
457 m_cbRemoveIslands->SetSelection( static_cast<int>( m_settings.GetIslandRemovalMode() ) );
458 m_staticText40->Enable( true );
459 m_cbRemoveIslands->Enable( true );
460 }
461}
462
463
465{
466 m_islandThreshold.Enable( m_cbRemoveIslands->GetSelection() == 2 );
467}
468
469
471{
472 if( m_GridStyleCtrl->GetSelection() > 0 )
474 else
476
477 if( !AcceptOptions() )
478 return false;
479
481 {
484 }
485
491
492 *m_ptr = m_settings;
493 return true;
494}
495
496
497void DIALOG_COPPER_ZONE::OnClose( wxCloseEvent& event )
498{
499 SetReturnCode( m_settingsExported ? ZONE_EXPORT_VALUES : wxID_CANCEL );
500 event.Skip();
501}
502
503
504bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
505{
507 return false;
508
510 INT_MAX ) )
511 return false;
512
513 if( !m_cornerRadius.Validate( 0, INT_MAX ) )
514 return false;
515
516 if( !m_spokeWidth.Validate( 0, INT_MAX ) )
517 return false;
518
520
522 {
523 int minThickness = m_minWidth.GetValue();
524
525 if( !m_gridStyleThickness.Validate( minThickness, INT_MAX ) )
526 return false;
527
528 if( !m_gridStyleGap.Validate( minThickness, INT_MAX ) )
529 return false;
530 }
531
532 switch( m_PadInZoneOpt->GetSelection() )
533 {
538 }
539
540 switch( m_OutlineDisplayCtrl->GetSelection() )
541 {
545 }
546
549 return false;
550
552
555
557
559 ? 0 : m_cornerRadius.GetValue() );
560
562
563 m_settings.m_Locked = m_cbLocked->GetValue();
564
567
569 {
570 DisplayError( this, _( "Thermal spoke width cannot be smaller than the minimum width." ) );
571 return false;
572 }
573
575
578
579 // If we use only exportable to others zones parameters, exit here:
580 if( aUseExportableSetupOnly )
581 return true;
582
583 // Get the layer selection for this zone
584 int layers = 0;
585
586 for( int ii = 0; ii < m_layers->GetItemCount(); ++ii )
587 {
588 if( m_layers->GetToggleValue( (unsigned) ii, 0 ) )
589 layers++;
590 }
591
592 if( layers == 0 )
593 {
594 DisplayError( this, _( "No layer selected." ) );
595 return false;
596 }
597
599
600 m_settings.m_Name = m_tcZoneName->GetValue();
601
602 return true;
603}
604
605
607{
608 const int netSelection = m_ListNetNameSelection->GetSelection();
609
610 if( netSelection > 0 )
611 {
612 const wxString& selectedNetName = m_ListNetNameSelection->GetString( netSelection );
614 }
615 else
616 {
618 }
619}
620
621
622void DIALOG_COPPER_ZONE::OnStyleSelection( wxCommandEvent& event )
623{
624 bool enable = m_GridStyleCtrl->GetSelection() >= 1;
625 m_tcGridStyleThickness->Enable( enable );
626 m_tcGridStyleGap->Enable( enable );
627 m_tcGridStyleOrientation->Enable( enable );
628 m_spinCtrlSmoothLevel->Enable( enable );
629 m_spinCtrlSmoothValue->Enable( enable );
630}
631
632
633void DIALOG_COPPER_ZONE::OnLayerSelection( wxDataViewEvent& event )
634{
635 if( event.GetColumn() != 0 )
636 return;
637
638 int row = m_layers->ItemToRow( event.GetItem() );
639
640 bool checked = m_layers->GetToggleValue( row, 0 );
641
642 wxVariant layerID;
643 m_layers->GetValue( layerID, row, 2 );
644
645 m_settings.m_Layers.set( ToLAYER_ID( layerID.GetInteger() ), checked );
646}
647
648
650{
652}
653
654
656{
657 // These configurations are persistent across multiple invocations of
658 // this dialog
659 int newConfig = NO_PERSISTENT_SORT_MODE;
660
662 newConfig |= HIDE_ANONYMOUS_NETS;
663
665 newConfig |= SORT_BY_PAD_COUNT;
666
668 cfg->m_Zones.net_sort_mode = newConfig;
669}
670
671
673{
675 int sortMode = cfg->m_Zones.net_sort_mode;
676
677 if( sortMode == DEFAULT_SORT_CONFIG )
678 sortMode = HIDE_ANONYMOUS_NETS;
679
682}
683
684
686{
687 if( !AcceptOptions( true ) )
688 return;
689
690 // Export settings ( but layer and netcode ) to others copper zones
691 BOARD* pcb = m_Parent->GetBoard();
692
693 for( ZONE* zone : pcb->Zones() )
694 {
695 // Cannot export settings from a copper zone
696 // to a zone keepout:
697 if( zone->GetIsRuleArea() )
698 continue;
699
700 // Export only to similar zones:
701 // Teardrop area -> teardrop area of same type
702 // copper zone -> copper zone
703 // Exporting current settings to a different zone type make no sense
704 if( m_settings.m_TeardropType != zone->GetTeardropAreaType() )
705 continue;
706
707 m_settings.ExportSetting( *zone, false ); // false = partial export
708 m_settingsExported = true;
710 }
711}
712
713
715{
717}
718
719
721{
723
724 wxArrayString listOfNets = buildListOfNetsToDisplay();
725
726 const int selectedNet = ensureSelectedNetIsVisible( m_currentlySelectedNetcode, listOfNets );
727
728 displayNetsList( listOfNets, selectedNet );
729}
730
731
733{
735
736 // Hide nets filter criteria
738
739 // Nets sort criteria
741}
742
743
745{
746 wxString netNameShowFilter = m_ShowNetNameFilter->GetValue();
747
748 if( netNameShowFilter.Len() == 0 )
749 netNameShowFilter = wxT( "*" );
750
751 wxStringTokenizer showFilters( netNameShowFilter.Lower(), wxT( "," ) );
752
753 m_showNetsFilter.clear();
754
755 while( showFilters.HasMoreTokens() )
756 {
757 wxString filter = showFilters.GetNextToken();
758 filter.Trim( false );
759 filter.Trim( true );
760
761 if( !filter.IsEmpty() )
762 {
763 m_showNetsFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD>() );
764 m_showNetsFilter.back()->SetPattern( filter );
765 }
766 }
767}
768
769
771{
773
774 wxArrayString netNames;
775
776 for( NETINFO_ITEM* net : m_netInfoItemList )
777 {
778 if( m_hideAutoGeneratedNets && net->HasAutoGeneratedNetname() )
779 continue;
780
781 const wxString& netName = getUnescapedNetName( net );
782
783 for( const NET_FILTER& filter : m_showNetsFilter )
784 {
785 if( filter->Find( netName.Lower() ) )
786 {
787 netNames.Add( netName );
788 break;
789 }
790 }
791 }
792
793 netNames.Insert( wxT( "<no net>" ), INVALID_NET_CODE );
794
795 return netNames;
796}
797
798
800{
803 else
805}
806
807
808void DIALOG_COPPER_ZONE::sortNetsByPadCount( std::vector<NETINFO_ITEM*>& nets,
809 const int maxNetCode )
810{
811 const std::vector<PAD*> pads = m_Parent->GetBoard()->GetPads();
812
813 padCountListByNet.clear();
814
815 // +1 is required for <no-net> item
816 padCountListByNet.assign( maxNetCode + 1, 0 );
817
818 for( PAD* pad : pads )
819 {
820 const int netCode = pad->GetNetCode();
821
822 if( netCode > INVALID_NET_CODE )
823 padCountListByNet[netCode]++;
824 }
825
826 sort( nets.begin(), nets.end(), sortNetsByNodes );
827}
828
829
830void DIALOG_COPPER_ZONE::displayNetsList( const wxArrayString& netNamesList, int selectIndex )
831{
832 m_ListNetNameSelection->Clear();
833 m_ListNetNameSelection->InsertItems( netNamesList, 0 );
834 m_ListNetNameSelection->SetSelection( selectIndex );
835 m_ListNetNameSelection->EnsureVisible( selectIndex );
836}
837
838
839int DIALOG_COPPER_ZONE::ensureSelectedNetIsVisible( int selectedNetCode, wxArrayString& netsList )
840{
841 int selectedIndex = 0;
842
843 if( selectedNetCode > INVALID_NET_CODE )
844 {
845 NETINFO_ITEM* selectedNet = m_Parent->GetBoard()->FindNet( selectedNetCode );
846
847 if( selectedNet )
848 {
849 const wxString& netName = getUnescapedNetName( selectedNet );
850 selectedIndex = netsList.Index( netName );
851
852 if( wxNOT_FOUND == selectedIndex )
853 {
854 // the currently selected net must *always* be visible.
855 // <no net> is the zero'th index, so pick next lowest
856 netsList.Insert( netName, 1 );
857 selectedIndex = 1;
858 }
859 }
860 }
861
862 return selectedIndex;
863}
864
865
867{
868 return UnescapeString( net->GetNetname() );
869}
870
871
873{
875 && !m_copperZoneInfo->IsShown()
877 {
878 m_copperZoneInfo->ShowMessage( _( "<no net> will result in an isolated copper island." ),
879 wxICON_WARNING );
880 }
881 else if( m_copperZoneInfo->IsShown() )
882 {
883 m_copperZoneInfo->Dismiss();
884 }
885}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:763
ZONES & Zones()
Definition: board.h:313
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1391
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
Definition: board.cpp:1907
int GetCopperLayerCount() const
Definition: board.cpp:488
Class DIALOG_COPPER_ZONE_BASE.
wxSpinCtrlDouble * m_spinCtrlSmoothValue
wxCheckBox * m_cbIgnoreLineWidths
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)
bool TransferDataToWindow() override
void ExportSetupToOtherCopperZones(wxCommandEvent &event) 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
void OnButtonCancelClick(wxCommandEvent &event) override
wxCheckBox * m_cbDeleteOriginals
bool AcceptOptions(bool aUseExportableSetupOnly=false)
static constexpr int INVALID_NET_CODE
std::unique_ptr< EDA_PATTERN_MATCH > NET_FILTER
void OnClose(wxCloseEvent &event) override
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)
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:97
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:773
Handle the data for a net.
Definition: netinfo.h:66
const wxString & GetNetname() const
Definition: netinfo.h:119
int GetNetCode() const
Definition: netinfo.h:113
Container for NETINFO_ITEM elements, which are the nets.
Definition: netinfo.h:324
unsigned GetNetCount() const
Definition: netinfo.h:347
Definition: pad.h:58
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen and update the ...
BOARD * GetBoard() 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.
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:70
const ISLAND_REMOVAL_MODE GetIslandRemovalMode() const
EDA_ANGLE m_HatchOrientation
Definition: zone_settings.h:88
int m_NetcodeSelection
Definition: zone_settings.h:95
void SetIslandRemovalMode(ISLAND_REMOVAL_MODE aRemove)
double m_HatchSmoothingValue
Definition: zone_settings.h:91
void SetMinIslandArea(long long int aArea)
void ExportSetting(ZONE &aTarget, bool aFullExport=true) const
Function ExportSetting copy settings to a given zone.
void SetPadConnection(ZONE_CONNECTION aPadConnection)
int m_ZoneMinThickness
Definition: zone_settings.h:85
long long int GetMinIslandArea() const
long m_ThermalReliefSpokeWidth
ZONE_CONNECTION GetPadConnection() const
TEARDROP_TYPE m_TeardropType
unsigned m_ZonePriority
Definition: zone_settings.h:81
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:97
int GetCornerSmoothingType() const
ZONE_FILL_MODE m_FillMode
Definition: zone_settings.h:83
long m_ThermalReliefGap
void SetCornerSmoothingType(int aType)
int m_HatchSmoothingLevel
Definition: zone_settings.h:89
unsigned int GetCornerRadius() const
ZONE_BORDER_DISPLAY_STYLE m_ZoneBorderDisplayStyle
Option to show the zone area (outlines only, short hatches or full hatches.
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
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.
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:926
constexpr int Mils2IU(const EDA_IU_SCALE &aIuScale, int mils)
Definition: eda_units.h:123
wxString UnescapeString(const wxString &aSource)
constexpr int mmToIU(double mm) const
Definition: base_units.h:89
T NormalizeAngle180(T Angle)
Normalize angle to be in the -180.0 .. 180.0 range.
Definition: trigo.h:221
ISLAND_REMOVAL_MODE
Whether or not to remove isolated islands from a zone.
Definition: zone_settings.h:57
#define ZONE_THICKNESS_MIN_VALUE_MIL
Definition: zones.h:36
@ THERMAL
Use thermal relief for pads.
@ THT_THERMAL
Thermal relief only for THT pads.
@ NONE
Pads are not covered.
@ FULL
pads are covered by copper
#define ZONE_BORDER_HATCH_MINDIST_MM
Definition: zones.h:40
#define ZONE_EXPORT_VALUES
Definition: zones.h:44
#define ZONE_CLEARANCE_MAX_VALUE_MIL
Definition: zones.h:38
#define ZONE_BORDER_HATCH_MAXDIST_MM
Definition: zones.h:41