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