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 <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
68 bool AcceptOptions( bool aUseExportableSetupOnly = false );
69
70 void OnStyleSelection( wxCommandEvent& event ) override;
71 void OnLayerSelection( wxDataViewEvent& event ) override;
72 void OnNetSortingOptionSelected( wxCommandEvent& event ) override;
73 void ExportSetupToOtherCopperZones( wxCommandEvent& event ) override;
74 void OnShowNetNameFilterChange( wxCommandEvent& event ) override;
75 void OnUpdateUI( wxUpdateUIEvent& ) override;
76 void OnButtonCancelClick( wxCommandEvent& event ) override;
77 void OnClose( wxCloseEvent& event ) override;
78 void OnNetSelectionUpdated( wxCommandEvent& event ) override;
79 void OnRemoveIslandsSelection( wxCommandEvent& event ) override;
80
81 void readNetInformation();
83 wxArrayString buildListOfNetsToDisplay();
84 void sortNetsByPadCount( std::vector<NETINFO_ITEM*>& nets, const int maxNetCode );
86 int ensureSelectedNetIsVisible( int selectedNetCode, wxArrayString& netsList );
87 void displayNetsList( const wxArrayString& netNamesList, int selectIndex );
89 wxString getUnescapedNetName( const NETINFO_ITEM* net );
90 void sortNetsIfRequired();
92 void updateInfoBar();
95
96private:
98
99 bool m_settingsExported; // settings will be written to all other zones
100
105
110
116
123
124 std::map<wxString, int> m_netNameToNetCode;
125 std::vector<NETINFO_ITEM*> m_netInfoItemList;
126
128 wxRadioButton* m_rbCenterline;
129 wxRadioButton* m_rbEnvelope;
131};
132
133
135 CONVERT_SETTINGS* aConvertSettings )
136{
137 DIALOG_COPPER_ZONE dlg( aCaller, aSettings, aConvertSettings );
138
139 return dlg.ShowQuasiModal();
140}
141
142
143// The pad count for each netcode, stored in a buffer for a fast access.
144// This is needed by the sort function sortNetsByNodes()
145static std::vector<int> padCountListByNet;
146
147
148// Sort nets by decreasing pad count.
149// For same pad count, sort by alphabetic names
150static bool sortNetsByNodes( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
151{
152 int countA = padCountListByNet[a->GetNetCode()];
153 int countB = padCountListByNet[b->GetNetCode()];
154
155 if( countA == countB )
156 return a->GetNetname() < b->GetNetname();
157 else
158 return countB < countA;
159}
160
161
162// Sort nets by alphabetic names
163static bool sortNetsByNames( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
164{
165 return a->GetNetname() < b->GetNetname();
166}
167
168
170 CONVERT_SETTINGS* aConvertSettings ) :
171 DIALOG_COPPER_ZONE_BASE( aParent ),
172 m_cornerSmoothingType( ZONE_SETTINGS::SMOOTHING_UNDEFINED ),
173 m_outlineHatchPitch( aParent, m_stBorderHatchPitchText,
174 m_outlineHatchPitchCtrl, m_outlineHatchUnits ),
175 m_cornerRadius( aParent, m_cornerRadiusLabel, m_cornerRadiusCtrl, m_cornerRadiusUnits ),
176 m_clearance( aParent, m_clearanceLabel, m_clearanceCtrl, m_clearanceUnits ),
177 m_minWidth( aParent, m_minWidthLabel, m_minWidthCtrl, m_minWidthUnits ),
178 m_antipadClearance( aParent, m_antipadLabel, m_antipadCtrl, m_antipadUnits ),
179 m_spokeWidth( aParent, m_spokeWidthLabel, m_spokeWidthCtrl, m_spokeWidthUnits ),
180 m_gridStyleRotation( aParent, m_staticTextGrindOrient, m_tcGridStyleOrientation,
181 m_staticTextRotUnits ),
182 m_gridStyleThickness( aParent, m_staticTextStyleThickness, m_tcGridStyleThickness,
183 m_GridStyleThicknessUnits ),
184 m_gridStyleGap( aParent, m_staticTextGridGap, m_tcGridStyleGap, m_GridStyleGapUnits ),
185 m_islandThreshold( aParent, m_islandThresholdLabel, m_tcIslandThreshold,
186 m_islandThresholdUnits ),
187 m_hideAutoGeneratedNets{ false },
188 m_convertSettings( aConvertSettings ),
189 m_rbCenterline( nullptr ),
190 m_rbEnvelope( nullptr ),
191 m_cbDeleteOriginals( nullptr )
192{
193 m_Parent = aParent;
194
195 m_ptr = aSettings;
196 m_settings = *aSettings;
199 false );
201
202 switch( m_settings.m_TeardropType )
203 {
205 // standard copper zone
206 break;
207
209 SetTitle( _( "Teardrop on Vias/Pads Properties" ) );
210 break;
211
213 SetTitle( _( "Teardrop on Tracks Properties" ) );
214 break;
215
216 default:
217 SetTitle( _( "Teardrop Properties" ) );
218 break;
219 }
220
221 if( aConvertSettings )
222 {
223 wxStaticBox* bConvertBox = new wxStaticBox( this, wxID_ANY, _( "Conversion Settings" ) );
224 wxStaticBoxSizer* bConvertSizer = new wxStaticBoxSizer( bConvertBox, wxVERTICAL );
225
226 m_rbCenterline = new wxRadioButton( this, wxID_ANY, _( "Use centerlines" ) );
227 bConvertSizer->Add( m_rbCenterline, 0, wxLEFT|wxRIGHT, 5 );
228
229 bConvertSizer->AddSpacer( 2 );
230 m_rbEnvelope = new wxRadioButton( this, wxID_ANY, _( "Create bounding hull" ) );
231 bConvertSizer->Add( m_rbEnvelope, 0, wxLEFT|wxRIGHT, 5 );
232
233 bConvertSizer->AddSpacer( 6 );
234 m_cbDeleteOriginals = new wxCheckBox( this, wxID_ANY, _( "Delete source objects after conversion" ) );
235 bConvertSizer->Add( m_cbDeleteOriginals, 0, wxALL, 5 );
236
237 GetSizer()->Insert( 0, bConvertSizer, 0, wxALL|wxEXPAND, 10 );
238
239 wxStaticLine* line = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
240 wxLI_HORIZONTAL );
241 GetSizer()->Insert( 1, line, 0, wxLEFT|wxRIGHT|wxEXPAND, 10 );
242
243 SetTitle( _( "Convert to Copper Zone" ) );
244 }
245
246 m_settingsExported = false;
249
250 m_netSortingByPadCount = true; // false = alphabetic sort, true = pad count sort
251
252 m_ShowNetNameFilter->SetHint( _( "Filter" ) );
253
254 m_cbRemoveIslands->Bind( wxEVT_CHOICE,
255 [&]( wxCommandEvent& )
256 {
257 // Area mode is index 2
258 m_islandThreshold.Enable( m_cbRemoveIslands->GetSelection() == 2 );
259 } );
260
262
264}
265
266
268{
270 {
272 m_rbEnvelope->SetValue( true );
273 else
274 m_rbCenterline->SetValue( true );
275
277 }
278
279 m_cbLocked->SetValue( m_settings.m_Locked );
283
284 if( m_isTeardrop ) // outlines are never smoothed: they have already the right shape
285 {
286 m_cornerSmoothingChoice->SetSelection( 0 );
287 m_cornerSmoothingChoice->Enable( false );
289 m_cornerRadius.Enable( false );
290 }
291
293 {
294 case ZONE_BORDER_DISPLAY_STYLE::NO_HATCH: m_OutlineDisplayCtrl->SetSelection( 0 ); break;
297 }
298
300
303
304 switch( m_settings.GetPadConnection() )
305 {
306 default:
307 case ZONE_CONNECTION::THERMAL: m_PadInZoneOpt->SetSelection( 1 ); break;
308 case ZONE_CONNECTION::THT_THERMAL: m_PadInZoneOpt->SetSelection( 2 ); break;
309 case ZONE_CONNECTION::NONE: m_PadInZoneOpt->SetSelection( 3 ); break;
310 case ZONE_CONNECTION::FULL: m_PadInZoneOpt->SetSelection( 0 ); break;
311 }
312
313 if( m_isTeardrop )
314 {
315 m_PadInZoneOpt->SetSelection( 0 );
316 m_PadInZoneOpt->Enable( false );
317 }
318
319 // Do not enable/disable antipad clearance and spoke width. They might be needed if
320 // a footprint or pad overrides the zone to specify a thermal connection.
323
326
327 m_cbRemoveIslands->SetSelection( static_cast<int>( m_settings.GetIslandRemovalMode() ) );
328
330
332
335
337
338 // Initialize information required to display nets list
340
342 m_GridStyleCtrl->SetSelection( 1 );
343 else
344 m_GridStyleCtrl->SetSelection( 0 );
345
346 m_GridStyleCtrl->Enable( !m_isTeardrop );
347
350
351 // Gives a reasonable value to grid style parameters, if currently there are no defined
352 // parameters for grid pattern thickness and gap (if the value is 0)
353 // the grid pattern thickness default value is (arbitrary) m_ZoneMinThickness * 4
354 // or 1mm
355 // the grid pattern gap default value is (arbitrary) m_ZoneMinThickness * 6
356 // or 1.5 mm
357 int bestvalue = m_settings.m_HatchThickness;
358
359 if( bestvalue <= 0 ) // No defined value for m_HatchThickness
360 bestvalue = std::max( m_settings.m_ZoneMinThickness * 4, pcbIUScale.mmToIU( 1.0 ) );
361
363
364 bestvalue = m_settings.m_HatchGap;
365
366 if( bestvalue <= 0 ) // No defined value for m_HatchGap
367 bestvalue = std::max( m_settings.m_ZoneMinThickness * 6, pcbIUScale.mmToIU( 1.5 ) );
368
369 m_gridStyleGap.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
370
373
374 m_tcZoneName->SetValue( m_settings.m_Name );
375
377
378 // Enable/Disable some widgets
379 wxCommandEvent event;
380 OnStyleSelection( event );
381 OnNetSelectionUpdated( event );
382
383 Fit();
384
385 return true;
386}
387
388
390{
391 NETINFO_LIST& netInfoList = m_Parent->GetBoard()->GetNetInfo();
392
393 m_netInfoItemList.clear();
394 m_netInfoItemList.reserve( netInfoList.GetNetCount() );
395
396 m_netNameToNetCode.clear();
397 m_netNameToNetCode[ _( "<no net>" ) ] = INVALID_NET_CODE;
398
400
401 for( NETINFO_ITEM* net : netInfoList )
402 {
403 const int& netCode = net->GetNetCode();
404 const wxString& netName = getUnescapedNetName( net );
405
406 m_netNameToNetCode[netName] = netCode;
407
408 if( netCode > INVALID_NET_CODE && net->IsCurrent() )
409 {
410 m_netInfoItemList.push_back( net );
411 m_maxNetCode = std::max( netCode, m_maxNetCode );
412 }
413 }
414
416}
417
418
419void DIALOG_COPPER_ZONE::OnUpdateUI( wxUpdateUIEvent& )
420{
421 if( m_cornerSmoothingType != m_cornerSmoothingChoice->GetSelection() )
422 {
424
426 m_cornerRadiusLabel->SetLabel( _( "Chamfer distance:" ) );
427 else
428 m_cornerRadiusLabel->SetLabel( _( "Fillet radius:" ) );
429 }
430
432}
433
434
435void DIALOG_COPPER_ZONE::OnButtonCancelClick( wxCommandEvent& event )
436{
437 // After an "Export Settings to Other Zones" cancel and close must return
438 // ZONE_EXPORT_VALUES instead of wxID_CANCEL.
439 Close( true );
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 )
483 else
485
486 if( !AcceptOptions() )
487 return false;
488
490 {
491 if( m_rbEnvelope->GetValue() )
493 else
495
497 }
498
504
505 *m_ptr = m_settings;
506 return true;
507}
508
509
510void DIALOG_COPPER_ZONE::OnClose( wxCloseEvent& event )
511{
512 SetReturnCode( m_settingsExported ? ZONE_EXPORT_VALUES : wxID_CANCEL );
513 event.Skip();
514}
515
516
517bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
518{
520 return false;
521
523 INT_MAX ) )
524 return false;
525
526 if( !m_cornerRadius.Validate( 0, INT_MAX ) )
527 return false;
528
529 if( !m_spokeWidth.Validate( 0, INT_MAX ) )
530 return false;
531
533
535 {
536 int minThickness = m_minWidth.GetValue();
537
538 if( !m_gridStyleThickness.Validate( minThickness, INT_MAX ) )
539 return false;
540
541 if( !m_gridStyleGap.Validate( minThickness, INT_MAX ) )
542 return false;
543 }
544
545 switch( m_PadInZoneOpt->GetSelection() )
546 {
551 }
552
553 switch( m_OutlineDisplayCtrl->GetSelection() )
554 {
558 }
559
562 return false;
563
565
568
570
572 ? 0 : m_cornerRadius.GetValue() );
573
575
576 m_settings.m_Locked = m_cbLocked->GetValue();
577
580
582 {
583 DisplayError( this, _( "Thermal spoke width cannot be smaller than the minimum width." ) );
584 return false;
585 }
586
588
591
592 // If we use only exportable to others zones parameters, exit here:
593 if( aUseExportableSetupOnly )
594 return true;
595
596 // Get the layer selection for this zone
597 int layers = 0;
598
599 for( int ii = 0; ii < m_layers->GetItemCount(); ++ii )
600 {
601 if( m_layers->GetToggleValue( (unsigned) ii, 0 ) )
602 layers++;
603 }
604
605 if( layers == 0 )
606 {
607 DisplayError( this, _( "No layer selected." ) );
608 return false;
609 }
610
612
613 m_settings.m_Name = m_tcZoneName->GetValue();
614
615 return true;
616}
617
618
620{
621 const int netSelection = m_ListNetNameSelection->GetSelection();
622
623 if( netSelection > 0 )
624 {
625 const wxString& selectedNetName = m_ListNetNameSelection->GetString( netSelection );
627 }
628 else
629 {
631 }
632}
633
634
635void DIALOG_COPPER_ZONE::OnStyleSelection( wxCommandEvent& event )
636{
637 bool enable = m_GridStyleCtrl->GetSelection() >= 1;
638 m_tcGridStyleThickness->Enable( enable );
639 m_tcGridStyleGap->Enable( enable );
640 m_tcGridStyleOrientation->Enable( enable );
641 m_spinCtrlSmoothLevel->Enable( enable );
642 m_spinCtrlSmoothValue->Enable( enable );
643}
644
645
646void DIALOG_COPPER_ZONE::OnLayerSelection( wxDataViewEvent& event )
647{
648 if( event.GetColumn() != 0 )
649 return;
650
651 int row = m_layers->ItemToRow( event.GetItem() );
652
653 bool checked = m_layers->GetToggleValue( row, 0 );
654
655 wxVariant layerID;
656 m_layers->GetValue( layerID, row, 2 );
657
658 m_settings.m_Layers.set( ToLAYER_ID( layerID.GetInteger() ), checked );
659}
660
661
663{
665}
666
667
669{
670 // These configurations are persistent across multiple invocations of
671 // this dialog
672 int newConfig = NO_PERSISTENT_SORT_MODE;
673
675 newConfig |= HIDE_ANONYMOUS_NETS;
676
678 newConfig |= SORT_BY_PAD_COUNT;
679
681 cfg->m_Zones.net_sort_mode = newConfig;
682}
683
684
686{
688 int sortMode = cfg->m_Zones.net_sort_mode;
689
690 if( sortMode == DEFAULT_SORT_CONFIG )
691 sortMode = HIDE_ANONYMOUS_NETS;
692
695}
696
697
699{
700 if( !AcceptOptions( true ) )
701 return;
702
703 // Export settings ( but layer and netcode ) to others copper zones
704 BOARD* pcb = m_Parent->GetBoard();
705
706 for( ZONE* zone : pcb->Zones() )
707 {
708 // Cannot export settings from a copper zone
709 // to a zone keepout:
710 if( zone->GetIsRuleArea() )
711 continue;
712
713 // Export only to similar zones:
714 // Teardrop area -> teardrop area of same type
715 // copper zone -> copper zone
716 // Exporting current settings to a different zone type make no sense
717 if( m_settings.m_TeardropType != zone->GetTeardropAreaType() )
718 continue;
719
720 m_settings.ExportSetting( *zone, false ); // false = partial export
721 m_settingsExported = true;
723 }
724}
725
726
728{
730}
731
732
734{
736
737 wxArrayString listOfNets = buildListOfNetsToDisplay();
738
739 const int selectedNet = ensureSelectedNetIsVisible( m_currentlySelectedNetcode, listOfNets );
740
741 displayNetsList( listOfNets, selectedNet );
742}
743
744
746{
748
749 // Hide nets filter criteria
751
752 // Nets sort criteria
754}
755
756
758{
759 wxString netNameShowFilter = m_ShowNetNameFilter->GetValue();
760
761 if( netNameShowFilter.Len() == 0 )
762 netNameShowFilter = wxT( "*" );
763
764 wxStringTokenizer showFilters( netNameShowFilter.Lower(), wxT( "," ) );
765
766 m_showNetsFilter.clear();
767
768 while( showFilters.HasMoreTokens() )
769 {
770 wxString filter = showFilters.GetNextToken();
771 filter.Trim( false );
772 filter.Trim( true );
773
774 if( !filter.IsEmpty() )
775 {
776 m_showNetsFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD>() );
777 m_showNetsFilter.back()->SetPattern( filter );
778 }
779 }
780}
781
782
784{
786
787 wxArrayString netNames;
788
789 for( NETINFO_ITEM* net : m_netInfoItemList )
790 {
791 if( m_hideAutoGeneratedNets && net->HasAutoGeneratedNetname() )
792 continue;
793
794 const wxString& netName = getUnescapedNetName( net );
795
796 for( const NET_FILTER& filter : m_showNetsFilter )
797 {
798 if( filter->Find( netName.Lower() ) )
799 {
800 netNames.Add( netName );
801 break;
802 }
803 }
804 }
805
806 netNames.Insert( _( "<no net>" ), INVALID_NET_CODE );
807
808 return netNames;
809}
810
811
813{
816 else
818}
819
820
821void DIALOG_COPPER_ZONE::sortNetsByPadCount( std::vector<NETINFO_ITEM*>& nets,
822 const int maxNetCode )
823{
824 const std::vector<PAD*> pads = m_Parent->GetBoard()->GetPads();
825
826 padCountListByNet.clear();
827
828 // +1 is required for <no-net> item
829 padCountListByNet.assign( maxNetCode + 1, 0 );
830
831 for( PAD* pad : pads )
832 {
833 const int netCode = pad->GetNetCode();
834
835 if( netCode > INVALID_NET_CODE )
836 padCountListByNet[netCode]++;
837 }
838
839 sort( nets.begin(), nets.end(), sortNetsByNodes );
840}
841
842
843void DIALOG_COPPER_ZONE::displayNetsList( const wxArrayString& netNamesList, int selectIndex )
844{
845 m_ListNetNameSelection->Clear();
846 m_ListNetNameSelection->InsertItems( netNamesList, 0 );
847 m_ListNetNameSelection->SetSelection( selectIndex );
848 m_ListNetNameSelection->EnsureVisible( selectIndex );
849}
850
851
852int DIALOG_COPPER_ZONE::ensureSelectedNetIsVisible( int selectedNetCode, wxArrayString& netsList )
853{
854 int selectedIndex = 0;
855
856 if( selectedNetCode > INVALID_NET_CODE )
857 {
858 NETINFO_ITEM* selectedNet = m_Parent->GetBoard()->FindNet( selectedNetCode );
859
860 if( selectedNet )
861 {
862 const wxString& netName = getUnescapedNetName( selectedNet );
863 selectedIndex = netsList.Index( netName );
864
865 if( wxNOT_FOUND == selectedIndex )
866 {
867 // the currently selected net must *always* be visible.
868 // <no net> is the zero'th index, so pick next lowest
869 netsList.Insert( netName, 1 );
870 selectedIndex = 1;
871 }
872 }
873 }
874
875 return selectedIndex;
876}
877
878
880{
881 return UnescapeString( net->GetNetname() );
882}
883
884
886{
888 && !m_copperZoneInfo->IsShown()
890 {
891 m_copperZoneInfo->ShowMessage( _( "<no net> will result in an isolated copper island." ),
892 wxICON_WARNING );
893 }
894 else if( m_copperZoneInfo->IsShown() )
895 {
896 m_copperZoneInfo->Dismiss();
897 }
898}
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:765
ZONES & Zones()
Definition: board.h:313
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1460
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
Definition: board.cpp:1969
int GetCopperLayerCount() const
Definition: board.cpp:545
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
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)
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: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:67
const wxString & GetNetname() const
Definition: netinfo.h:120
int GetNetCode() const
Definition: netinfo.h:114
Container for NETINFO_ITEM elements, which are the nets.
Definition: netinfo.h:333
unsigned GetNetCount() const
Definition: netinfo.h:356
Definition: pad.h:59
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
PCBNEW_SETTINGS * GetPcbNewSettings() const
void OnModify() override
Must be called after a change in order to set the "modify" flag and update other data structures and ...
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:300
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:932
constexpr int Mils2IU(const EDA_IU_SCALE &aIuScale, int mils)
Definition: eda_units.h:123
@ CENTERLINE
@ BOUNDING_HULL
wxString UnescapeString(const wxString &aSource)
CONVERT_STRATEGY m_Strategy
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