KiCad PCB EDA Suite
panel_setup_layers.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) 2009 Isaac Marino Bavaresco, isaacbavaresco@yahoo.com.br
5  * Copyright (C) 2009 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2009-2018 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 
27 #include <fctsys.h>
28 #include <macros.h>
29 #include <confirm.h>
30 #include <pcbnew.h>
31 #include <pcb_edit_frame.h>
32 #include <class_board.h>
33 #include <collectors.h>
34 #include <panel_setup_layers.h>
35 
36 
37 // some define to choose how copper layers widgets are shown
38 
39 // if defined, display only active copper layers
40 // if not displays always 1=the full set (32 copper layers)
41 #define HIDE_INACTIVE_LAYERS
42 
43 
44 static LSEQ dlg_layers()
45 {
46  // layers that are put out into the dialog UI, coordinate with wxformbuilder and
47  // getCTLs( LAYER_NUM aLayerNumber )
48  static const PCB_LAYER_ID layers[] = {
49  F_CrtYd,
50  F_Fab,
51  F_Adhes,
52  F_Paste,
53  F_SilkS,
54  F_Mask,
55  F_Cu,
56 
57  In1_Cu,
58  In2_Cu,
59  In3_Cu,
60  In4_Cu,
61  In5_Cu,
62  In6_Cu,
63  In7_Cu,
64  In8_Cu,
65  In9_Cu,
66  In10_Cu,
67  In11_Cu,
68  In12_Cu,
69  In13_Cu,
70  In14_Cu,
71  In15_Cu,
72 
73  In16_Cu,
74  In17_Cu,
75  In18_Cu,
76  In19_Cu,
77  In20_Cu,
78  In21_Cu,
79  In22_Cu,
80  In23_Cu,
81  In24_Cu,
82  In25_Cu,
83  In26_Cu,
84  In27_Cu,
85  In28_Cu,
86  In29_Cu,
87  In30_Cu,
88 
89  B_Cu,
90  B_Mask,
91  B_SilkS,
92  B_Paste,
93  B_Adhes,
94  B_Fab,
95  B_CrtYd,
96 
97  Edge_Cuts,
98  Margin,
99  Eco2_User,
100  Eco1_User,
101  Cmts_User,
102  Dwgs_User,
103  };
104 
105  return LSEQ( layers, layers + arrayDim( layers ) );
106 }
107 
108 
109 // Layer bit masks for each defined "Preset Layer Grouping"
110 static const LSET presets[] =
111 {
112  LSET(), // shift the array index up by one, matches with "Custom".
113 
114  // "Two layers, parts on Front only"
115  LSET( 2, F_Cu, B_Cu ) | LSET::FrontTechMask() | LSET( 1, B_Mask ) | LSET::UserMask(),
116 
117  // "Two layers, parts on Back only",
118  LSET( 2, F_Cu, B_Cu ) | LSET::BackTechMask() | LSET( 1, F_Mask ) | LSET::UserMask(),
119 
120  // "Two layers, parts on Front and Back",
122 
123  // "Four layers, parts on Front only"
125 
126  // "Four layers, parts on Front and Back"
128  LSET::UserMask(),
129 
130  // "All layers on",
131  LSET().set(),
132 };
133 
134 
136  PANEL_SETUP_LAYERS_BASE( aParent->GetTreebook() ),
137  m_Parent( aParent ), m_frame( aFrame )
138 {
139  m_pcb = aFrame->GetBoard();
140 }
141 
142 
144 {
145 #define RETURN_COPPER(x) return PANEL_SETUP_LAYERS_CTLs( x##Name, x##CheckBox, x##Choice )
146 #define RETURN_AUX(x) return PANEL_SETUP_LAYERS_CTLs( x##Name, x##CheckBox, x##StaticText )
147 
148  switch( aLayerNumber )
149  {
150  case F_CrtYd: RETURN_AUX( m_CrtYdFront );
151  case F_Fab: RETURN_AUX( m_FabFront );
152  case F_Adhes: RETURN_AUX( m_AdhesFront );
153  case F_Paste: RETURN_AUX( m_SoldPFront );
154  case F_SilkS: RETURN_AUX( m_SilkSFront );
155  case F_Mask: RETURN_AUX( m_MaskFront );
156  case F_Cu: RETURN_COPPER( m_Front );
157 
158  case In1_Cu: RETURN_COPPER( m_In1 );
159  case In2_Cu: RETURN_COPPER( m_In2 );
160  case In3_Cu: RETURN_COPPER( m_In3 );
161  case In4_Cu: RETURN_COPPER( m_In4 );
162  case In5_Cu: RETURN_COPPER( m_In5 );
163  case In6_Cu: RETURN_COPPER( m_In6 );
164  case In7_Cu: RETURN_COPPER( m_In7 );
165  case In8_Cu: RETURN_COPPER( m_In8 );
166  case In9_Cu: RETURN_COPPER( m_In9 );
167  case In10_Cu: RETURN_COPPER( m_In10 );
168  case In11_Cu: RETURN_COPPER( m_In11 );
169  case In12_Cu: RETURN_COPPER( m_In12 );
170  case In13_Cu: RETURN_COPPER( m_In13 );
171  case In14_Cu: RETURN_COPPER( m_In14 );
172  case In15_Cu: RETURN_COPPER( m_In15 );
173 
174  case In16_Cu: RETURN_COPPER( m_In16 );
175  case In17_Cu: RETURN_COPPER( m_In17 );
176  case In18_Cu: RETURN_COPPER( m_In18 );
177  case In19_Cu: RETURN_COPPER( m_In19 );
178  case In20_Cu: RETURN_COPPER( m_In20 );
179  case In21_Cu: RETURN_COPPER( m_In21 );
180  case In22_Cu: RETURN_COPPER( m_In22 );
181  case In23_Cu: RETURN_COPPER( m_In23 );
182  case In24_Cu: RETURN_COPPER( m_In24 );
183  case In25_Cu: RETURN_COPPER( m_In25 );
184  case In26_Cu: RETURN_COPPER( m_In26 );
185  case In27_Cu: RETURN_COPPER( m_In27 );
186  case In28_Cu: RETURN_COPPER( m_In28 );
187  case In29_Cu: RETURN_COPPER( m_In29 );
188  case In30_Cu: RETURN_COPPER( m_In30 );
189 
190  case B_Cu: RETURN_COPPER( m_Back );
191  case B_Mask: RETURN_AUX( m_MaskBack );
192  case B_SilkS: RETURN_AUX( m_SilkSBack );
193  case B_Paste: RETURN_AUX( m_SoldPBack );
194  case B_Adhes: RETURN_AUX( m_AdhesBack );
195  case B_Fab: RETURN_AUX( m_FabBack );
196  case B_CrtYd: RETURN_AUX( m_CrtYdBack );
197 
198  case Edge_Cuts: RETURN_AUX( m_PCBEdges );
199  case Margin: RETURN_AUX( m_Margin );
200  case Eco2_User: RETURN_AUX( m_Eco2 );
201  case Eco1_User: RETURN_AUX( m_Eco1 );
202  case Cmts_User: RETURN_AUX( m_Comments );
203  case Dwgs_User: RETURN_AUX( m_Drawings );
204  default:
205  wxASSERT_MSG( 0, wxT( "bad layer id" ) );
206  return PANEL_SETUP_LAYERS_CTLs( nullptr, nullptr, nullptr );
207  }
208 }
209 
210 
212 {
213  return getCTLs( aLayer ).name;
214 }
215 
216 
218 {
219  return getCTLs( aLayer ).checkbox;
220 }
221 
222 
224 {
225  return (wxChoice*) getCTLs( aLayer ).choice;
226 }
227 
228 
230 {
232 
235 
239  showLayerTypes();
241 
242  return true;
243 }
244 
245 
247 {
248  for( int layer : { F_CrtYd, B_CrtYd, Edge_Cuts, Margin } )
249  setLayerCheckBox( layer, true );
250 }
251 
252 
254 {
255  if( copperCount > MAX_CU_LAYERS )
256  copperCount = MAX_CU_LAYERS;
257 
258  if( copperCount < 2 )
259  copperCount = 2;
260 
261  for( int lyrCnt = 2; lyrCnt <= MAX_CU_LAYERS; lyrCnt += 2 )
262  {
263  // note this will change a one layer board to 2:
264  if( copperCount <= lyrCnt )
265  {
266  int idx = lyrCnt/2 - 1;
267  m_CopperLayersChoice->SetSelection(idx);
268  break;
269  }
270  }
271 }
272 
273 
275 {
276  // Set all the board's layer names into the dialog by calling BOARD::GetLayerName(),
277  // which will call BOARD::GetStandardLayerName() for non-coppers.
278 
279  for( LSEQ seq = dlg_layers(); seq; ++seq )
280  {
281  PCB_LAYER_ID layer = *seq;
282  wxControl* ctl = getName( layer );
283 
284  if( ctl )
285  {
286  wxString lname = m_pcb->GetLayerName( layer );
287 
288  if( dynamic_cast<wxTextCtrl*>( ctl ) )
289  dynamic_cast<wxTextCtrl*>( ctl )->SetValue( lname ); // wxTextCtrl
290  else
291  ctl->SetLabel( lname ); // wxStaticText
292  }
293  }
294 }
295 
296 
298 {
299  // the check boxes
300  for( LSEQ seq = dlg_layers(); seq; ++seq )
301  {
302  PCB_LAYER_ID layer = *seq;
303  setLayerCheckBox( layer, enabledLayers[layer] );
304  }
305 }
306 
307 
309 {
310  int presetsNdx = 0; // the "Custom" setting, matches nothing
311 
312  for( unsigned i=1; i<arrayDim( presets ); ++i )
313  {
314  if( enabledLayers == presets[i] )
315  {
316  presetsNdx = i;
317  break;
318  }
319  }
320 
321  m_PresetsChoice->SetSelection( presetsNdx );
322 }
323 
324 
326 {
327  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
328  {
329  PCB_LAYER_ID cu_layer = *seq;
330 
331  wxChoice* ctl = getChoice( cu_layer );
332  ctl->SetSelection( m_pcb->GetLayerType( cu_layer ) );
333  }
334 }
335 
336 
338 {
339  LSET layerMaskResult;
340 
341  for( LSEQ seq = dlg_layers(); seq; ++seq )
342  {
343  PCB_LAYER_ID layer = *seq;
344  wxCheckBox* ctl = getCheckBox( layer );
345 
346  if( ctl->GetValue() )
347  layerMaskResult.set( layer );
348  }
349 
350  return layerMaskResult;
351 }
352 
353 
354 void PANEL_SETUP_LAYERS::setLayerCheckBox( LAYER_NUM aLayer, bool isChecked )
355 {
356  PANEL_SETUP_LAYERS_CTLs ctl = getCTLs( aLayer );
357 
358  ctl.checkbox->SetValue( isChecked );
359 }
360 
361 
363 {
364  if( copperCount > 0 )
365  {
366  setLayerCheckBox( F_Cu, true );
367  --copperCount;
368  }
369 
370  if( copperCount > 0 )
371  {
372  setLayerCheckBox( B_Cu, true );
373  --copperCount;
374  }
375 
376  for( LSEQ seq = LSET::InternalCuMask().Seq(); seq; ++seq, --copperCount )
377  {
378  PCB_LAYER_ID layer = *seq;
379  bool state = copperCount > 0;
380 
381 #ifdef HIDE_INACTIVE_LAYERS
382  // This code hides non-active copper layers, or redisplays hidden
383  // layers which are now needed.
384  PANEL_SETUP_LAYERS_CTLs ctl = getCTLs( layer );
385 
386  ctl.name->Show( state );
387  ctl.checkbox->Show( state );
388  ctl.choice->Show( state );
389 #endif
390 
391  setLayerCheckBox( layer, state );
392  }
393 
394 #ifdef HIDE_INACTIVE_LAYERS
395  // Send an size event to force sizers to be updated,
396  // because the number of copper layers can have changed.
397  wxSizeEvent evt_size( m_LayersListPanel->GetSize() );
398  m_LayersListPanel->GetEventHandler()->ProcessEvent( evt_size );
399 #endif
400 }
401 
402 
403 void PANEL_SETUP_LAYERS::OnCheckBox( wxCommandEvent& event )
404 {
406 
408 }
409 
410 
411 void PANEL_SETUP_LAYERS::DenyChangeCheckBox( wxCommandEvent& event )
412 {
413  wxObject* source = event.GetEventObject();
414  wxString msg;
415 
416  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
417  {
418  wxCheckBox* copper = getCheckBox( *seq );
419 
420  if( source == copper )
421  {
422  wxString controlLabel = m_staticTextCopperLayers->GetLabel();
423  // knock the ':' off the end
424  controlLabel = controlLabel.substr( 0, controlLabel.size() - 1 );
425 
426  msg.Printf( _( "Use the \"%s\" control to change the number of copper layers." ),
427  controlLabel );
428  DisplayError( this, msg );
429 
430  copper->SetValue( true );
431  return;
432  }
433  }
434 
435  for( int layer : { F_CrtYd, B_CrtYd, Edge_Cuts, Margin } )
436  {
437  wxCheckBox* mandatory = getCheckBox( layer );
438 
439  if( source == mandatory )
440  {
441  msg.Printf( _( "The %s layer is mandatory." ), GetLayerName( layer ) );
442  DisplayError( this, msg );
443  mandatory->SetValue( true );
444  return;
445  }
446  }
447 }
448 
449 
450 void PANEL_SETUP_LAYERS::OnPresetsChoice( wxCommandEvent& event )
451 {
452  int presetNdx = m_PresetsChoice->GetCurrentSelection();
453 
454  if( presetNdx <= 0 ) // the Custom setting controls nothing.
455  return;
456 
457  if( presetNdx < (int) arrayDim(presets) )
458  {
459  m_enabledLayers = presets[ presetNdx ];
460  LSET copperSet = m_enabledLayers & LSET::AllCuMask();
461  int copperCount = copperSet.count();
462 
463  showCopperChoice( copperCount );
465  setCopperLayerCheckBoxes( copperCount );
466  }
467 
468  // Ensure mandatory layers are activated
470 }
471 
472 
473 void PANEL_SETUP_LAYERS::OnCopperLayersChoice( wxCommandEvent& event )
474 {
475  setCopperLayerCheckBoxes( m_CopperLayersChoice->GetCurrentSelection() * 2 + 2 );
478 }
479 
480 
482 {
483  if( !testLayerNames() )
484  return false;
485 
486  wxString msg;
487 
488  // Check for removed layers with items which will get deleted from the board.
489  LSEQ removedLayers = getRemovedLayersWithItems();
490 
491  // Check for non copper layers in use in footprints, and therefore not removable.
492  LSEQ notremovableLayers = getNonRemovableLayers();
493 
494  if( !notremovableLayers.empty() )
495  {
496  for( unsigned int ii = 0; ii < notremovableLayers.size(); ii++ )
497  msg << m_pcb->GetLayerName( notremovableLayers[ii] ) << "\n";
498 
499  if( !IsOK( this, wxString::Format( _( "Footprints have some items on removed layers:\n"
500  "%s\n"
501  "These items will be no longer accessible\n"
502  "Do you wish to continue?" ), msg ) ) )
503  return false;
504  }
505 
506  if( !removedLayers.empty() &&
507  !IsOK( this, _( "Items have been found on removed layers. This operation will delete "
508  "all items from removed layers and cannot be undone. Do you wish to "
509  "continue?" ) ) )
510  return false;
511 
512  // Delete all objects on layers that have been removed. Leaving them in copper layers
513  // can (will?) result in DRC errors and it pollutes the board file with cruft.
514  bool hasRemovedBoardItems = false;
515 
516  if( !removedLayers.empty() )
517  {
518  PCB_LAYER_COLLECTOR collector;
519 
520  for( auto layer_id : removedLayers )
521  {
522  collector.SetLayerId( layer_id );
524 
525  // Bye-bye items on on removed layer.
526  if( collector.GetCount() != 0 )
527  {
528  hasRemovedBoardItems = true;
529 
530  for( int i = 0; i < collector.GetCount(); i++ )
531  {
532  BOARD_ITEM* item = collector[i];
533  m_pcb->Remove( item );
534  delete item;
535  }
536  }
537  }
538  }
539 
541 
543  {
545 
546  /* Ensure enabled layers are also visible
547  * This is mainly to avoid mistakes if some enabled
548  * layers are not visible when exiting this dialog
549  */
551  }
552 
553  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
554  {
555  PCB_LAYER_ID layer = *seq;
556 
557  if( m_enabledLayers[layer] )
558  {
559  m_pcb->SetLayerName( layer, GetLayerName( layer ) );
560  LAYER_T t = (LAYER_T) getLayerTypeIndex( layer );
561  m_pcb->SetLayerType( layer, t );
562  }
563  }
564 
565  // If some board items are deleted: rebuild the connectivity,
566  // because it is likely some tracks and vias where removed
567  if( hasRemovedBoardItems )
568  {
569  // Rebuild list of nets (full ratsnest rebuild)
570  m_frame->Compile_Ratsnest( true );
572  }
573 
574  return true;
575 }
576 
577 
579 {
580  wxChoice* ctl = getChoice( aLayer );
581  int ret = ctl->GetCurrentSelection(); // indices must have same sequence as LAYER_T
582  return ret;
583 }
584 
585 
587 {
588  wxControl* control = getName( aLayer );
589 
590  if( dynamic_cast<wxTextCtrl*>( control ) )
591  return static_cast<wxTextCtrl*>( control )->GetValue().Trim();
592  else
593  return static_cast<wxStaticText*>( control )->GetLabel();
594 }
595 
596 
597 static bool hasOneOf( const wxString& str, const wxString& chars )
598 {
599  for( unsigned i=0; i<chars.Len(); ++i )
600  {
601  if( str.Find( chars[i] ) != wxNOT_FOUND )
602  return true;
603  }
604 
605  return false;
606 }
607 
608 
610 {
611  std::vector<wxString> names;
612  wxTextCtrl* ctl;
613 
614  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
615  {
616  PCB_LAYER_ID layer = *seq;
617 
618  // we _can_ rely on m_enabledLayers being current here:
619  if( !m_enabledLayers[layer] )
620  continue;
621 
622  wxString name = GetLayerName( layer );
623 
624  ctl = (wxTextCtrl*) getName( layer );
625 
626  // check name for legality.
627  // 1) cannot be blank.
628  // 2) cannot have blanks.
629  // 3) cannot have " chars
630  // 4) cannot be 'signal'
631  // 5) must be unique.
632  // 6) cannot have illegal chars in filenames ( some filenames are built from layer names )
633  // like : % $ \ " / :
634  wxString badchars = wxFileName::GetForbiddenChars( wxPATH_DOS );
635  badchars.Append( '%' );
636 
637  if( !name )
638  {
639  m_Parent->SetError( _( "Layer must have a name." ), this, ctl );
640  return false;
641  }
642 
643  if( hasOneOf( name, badchars ) )
644  {
645  auto msg = wxString::Format(_( "\"%s\" are forbidden in layer names." ), badchars );
646  m_Parent->SetError( msg, this, ctl );
647  return false;
648  }
649 
650  if( name == wxT( "signal" ) )
651  {
652  m_Parent->SetError( _( "Layer name \"signal\" is reserved." ), this, ctl );
653  return false;
654  }
655 
656  for( const wxString& existingName : names )
657  {
658  if( name == existingName )
659  {
660  auto msg = wxString::Format(_( "Layer name \"%s\" is already in use." ), name );
661  m_Parent->SetError( msg, this, ctl );
662  return false;
663  }
664  }
665 
666  names.push_back( name );
667  }
668 
669  return true;
670 }
671 
672 
674 {
675  LSEQ removedLayers;
676  LSET newLayers = GetUILayerMask();
677  LSET curLayers = m_pcb->GetEnabledLayers();
678 
679  if( newLayers == curLayers ) // return a empty list if no change
680  return removedLayers;
681 
682  PCB_LAYER_COLLECTOR collector;
683  LSEQ newLayerSeq = newLayers.Seq();
684 
685  for( auto layer_id : curLayers.Seq() )
686  {
687  if( std::find( newLayerSeq.begin(), newLayerSeq.end(), layer_id ) == newLayerSeq.end() )
688  {
689  collector.SetLayerId( layer_id );
691 
692  if( collector.GetCount() != 0 )
693  removedLayers.push_back( layer_id );
694  }
695  }
696 
697  return removedLayers;
698 }
699 
700 
702 {
703  //Build the list of non copper layers in use in footprints.
704  LSEQ inUseLayers;
705  LSET newLayers = GetUILayerMask();
706  LSET curLayers = m_pcb->GetEnabledLayers();
707 
708  if( newLayers == curLayers ) // return a empty list if no change
709  return inUseLayers;
710 
711  PCB_LAYER_COLLECTOR collector;
712  LSEQ newLayerSeq = newLayers.Seq();
713 
714  for( auto layer_id : curLayers.Seq() )
715  {
716  if( IsCopperLayer( layer_id ) ) // Copper layers are not taken in account here
717  continue;
718 
719  if( std::find( newLayerSeq.begin(), newLayerSeq.end(), layer_id ) == newLayerSeq.end() )
720  {
721  collector.SetLayerId( layer_id );
723 
724  if( collector.GetCount() != 0 )
725  inUseLayers.push_back( layer_id );
726  }
727  }
728 
729  return inUseLayers;
730 }
731 
732 
734 {
735  BOARD* savedBoard = m_pcb;
736 
737  m_pcb = aBoard;
739 
740  m_pcb = savedBoard;
741 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:676
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:236
LSEQ getNonRemovableLayers()
Return a list of layers in use in footprints, and therefore not removable.
static const KICAD_T BoardLevelItems[]
A scan list for all primary board items, omitting items which are subordinate to a MODULE,...
Definition: collectors.h:283
static bool hasOneOf(const wxString &str, const wxString &chars)
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
void OnCheckBox(wxCommandEvent &event) override
void showCopperChoice(int copperCount)
PANEL_SETUP_LAYERS(PAGED_DIALOG *aParent, PCB_EDIT_FRAME *aFrame)
void Compile_Ratsnest(bool aDisplayStatus)
Function Compile_Ratsnest Create the entire board ratsnest.
Definition: ratsnest.cpp:44
This file is part of the common library.
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
bool TransferDataFromWindow() override
static LSET BackTechMask()
Function BackTechMask returns a mask holding all technical layers (no CU layer) on back side.
Definition: lset.cpp:720
wxScrolledWindow * m_LayersListPanel
bool TransferDataToWindow() override
Class PANEL_SETUP_LAYERS_BASE.
void Collect(BOARD_ITEM *aBoard, const KICAD_T aScanList[])
Tests a BOARD_ITEM using this class's Inspector method, which does the collection.
Definition: collectors.cpp:538
static LSET FrontTechMask()
Function FrontTechMask returns a mask holding all technical layers (no CU layer) on front side.
Definition: lset.cpp:732
wxChoice * getChoice(LAYER_NUM aLayer)
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
PAGED_DIALOG * m_Parent
Collect all BOARD_ITEM objects on a given layer.
Definition: collectors.h:650
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Function SetLayerType changes the type of the layer given by aLayer.
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:367
const string & str
Definition: json11.cpp:596
void SetLayerId(PCB_LAYER_ID aLayerId)
Definition: collectors.h:660
This file contains miscellaneous commonly used macros and functions.
wxCheckBox * getCheckBox(LAYER_NUM aLayer)
void setCopperLayerCheckBoxes(int copperCount)
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:113
PCB_LAYER_ID
A quick note on layer IDs:
void OnCopperLayersChoice(wxCommandEvent &event) override
Class LSET is a set of PCB_LAYER_IDs.
#define RETURN_COPPER(x)
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
LAYER_T
Enum LAYER_T gives the allowed types of layers, same as Specctra DSN spec.
Definition: class_board.h:66
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Function SetLayerName changes the name of the layer given by aLayer.
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:636
void BuildConnectivity()
Builds or rebuilds the board connectivity database for the board, especially the list of connected it...
#define _(s)
void SetError(const wxString &aMessage, wxWindow *aPage, wxObject *aCtrl, int aRow=-1, int aCol=-1)
Class LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
void ImportSettingsFrom(BOARD *aBoard)
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
static const LSET presets[]
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Function GetLayerType returns the type of the copper layer given by aLayer.
PCB_EDIT_FRAME * m_frame
PANEL_SETUP_LAYERS_CTLs getCTLs(LAYER_NUM aLayerNumber)
const char * name
Definition: DXF_plotter.cpp:61
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
static const KICAD_T ModuleItems[]
A scan list for primary module items.
Definition: collectors.h:308
size_t i
Definition: json11.cpp:597
int GetCopperLayerCount() const
Function GetCopperLayerCount.
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
void showPresets(LSET enabledLayerMask)
void showSelectedLayerCheckBoxes(LSET enableLayerMask)
wxControl * getName(LAYER_NUM aLayer)
wxString GetLayerName(LAYER_NUM layer)
void setLayerCheckBox(LAYER_NUM layer, bool isChecked)
int getLayerTypeIndex(LAYER_NUM layer)
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
static LSEQ dlg_layers()
BOARD * GetBoard() const
void OnPresetsChoice(wxCommandEvent &event) override
static LSET UserMask()
Definition: lset.cpp:760
Holds the 3 UI control pointers for a single board layer.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:281
void SetEnabledLayers(LSET aLayerMask)
Function SetEnabledLayers is a proxy function that calls the correspondent function in m_BoardSetting...
void Remove(BOARD_ITEM *aBoardItem) override
Removes an item from the container.
void DenyChangeCheckBox(wxCommandEvent &event) override
LSEQ getRemovedLayersWithItems()
Return a list of layers removed from the board that contain items.
#define RETURN_AUX(x)