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 + arrayDim( 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 {
142  m_pcb = aFrame->GetBoard();
143 
144  m_LayersListPanel->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX) );
145 }
146 
147 
149 {
150 #define RETURN_COPPER(x) return PANEL_SETUP_LAYERS_CTLs( x##Name, x##CheckBox, x##Choice )
151 #define RETURN_AUX(x) return PANEL_SETUP_LAYERS_CTLs( x##Name, x##CheckBox, x##StaticText )
152 
153  switch( aLayerNumber )
154  {
155  case F_CrtYd: RETURN_AUX( m_CrtYdFront );
156  case F_Fab: RETURN_AUX( m_FabFront );
157  case F_Adhes: RETURN_AUX( m_AdhesFront );
158  case F_Paste: RETURN_AUX( m_SoldPFront );
159  case F_SilkS: RETURN_AUX( m_SilkSFront );
160  case F_Mask: RETURN_AUX( m_MaskFront );
161  case F_Cu: RETURN_COPPER( m_Front );
162 
163  case In1_Cu: RETURN_COPPER( m_In1 );
164  case In2_Cu: RETURN_COPPER( m_In2 );
165  case In3_Cu: RETURN_COPPER( m_In3 );
166  case In4_Cu: RETURN_COPPER( m_In4 );
167  case In5_Cu: RETURN_COPPER( m_In5 );
168  case In6_Cu: RETURN_COPPER( m_In6 );
169  case In7_Cu: RETURN_COPPER( m_In7 );
170  case In8_Cu: RETURN_COPPER( m_In8 );
171  case In9_Cu: RETURN_COPPER( m_In9 );
172  case In10_Cu: RETURN_COPPER( m_In10 );
173  case In11_Cu: RETURN_COPPER( m_In11 );
174  case In12_Cu: RETURN_COPPER( m_In12 );
175  case In13_Cu: RETURN_COPPER( m_In13 );
176  case In14_Cu: RETURN_COPPER( m_In14 );
177  case In15_Cu: RETURN_COPPER( m_In15 );
178 
179  case In16_Cu: RETURN_COPPER( m_In16 );
180  case In17_Cu: RETURN_COPPER( m_In17 );
181  case In18_Cu: RETURN_COPPER( m_In18 );
182  case In19_Cu: RETURN_COPPER( m_In19 );
183  case In20_Cu: RETURN_COPPER( m_In20 );
184  case In21_Cu: RETURN_COPPER( m_In21 );
185  case In22_Cu: RETURN_COPPER( m_In22 );
186  case In23_Cu: RETURN_COPPER( m_In23 );
187  case In24_Cu: RETURN_COPPER( m_In24 );
188  case In25_Cu: RETURN_COPPER( m_In25 );
189  case In26_Cu: RETURN_COPPER( m_In26 );
190  case In27_Cu: RETURN_COPPER( m_In27 );
191  case In28_Cu: RETURN_COPPER( m_In28 );
192  case In29_Cu: RETURN_COPPER( m_In29 );
193  case In30_Cu: RETURN_COPPER( m_In30 );
194 
195  case B_Cu: RETURN_COPPER( m_Back );
196  case B_Mask: RETURN_AUX( m_MaskBack );
197  case B_SilkS: RETURN_AUX( m_SilkSBack );
198  case B_Paste: RETURN_AUX( m_SoldPBack );
199  case B_Adhes: RETURN_AUX( m_AdhesBack );
200  case B_Fab: RETURN_AUX( m_FabBack );
201  case B_CrtYd: RETURN_AUX( m_CrtYdBack );
202 
203  case Edge_Cuts: RETURN_AUX( m_PCBEdges );
204  case Margin: RETURN_AUX( m_Margin );
205  case Eco2_User: RETURN_AUX( m_Eco2 );
206  case Eco1_User: RETURN_AUX( m_Eco1 );
207  case Cmts_User: RETURN_AUX( m_Comments );
208  case Dwgs_User: RETURN_AUX( m_Drawings );
209  default:
210  wxASSERT_MSG( 0, wxT( "bad layer id" ) );
211  return PANEL_SETUP_LAYERS_CTLs( nullptr, nullptr, nullptr );
212  }
213 }
214 
215 
217 {
218  return getCTLs( aLayer ).name;
219 }
220 
221 
223 {
224  return getCTLs( aLayer ).checkbox;
225 }
226 
227 
229 {
230  return (wxChoice*) getCTLs( aLayer ).choice;
231 }
232 
233 
235 {
237 
241 
245  showLayerTypes();
247 
248  return true;
249 }
250 
251 
253 {
254  for( int layer : { F_CrtYd, B_CrtYd, Edge_Cuts, Margin } )
255  setLayerCheckBox( layer, true );
256 }
257 
258 
260 {
261  if( copperCount > MAX_CU_LAYERS )
262  copperCount = MAX_CU_LAYERS;
263 
264  if( copperCount < 2 )
265  copperCount = 2;
266 
267  for( int lyrCnt = 2; lyrCnt <= MAX_CU_LAYERS; lyrCnt += 2 )
268  {
269  // note this will change a one layer board to 2:
270  if( copperCount <= lyrCnt )
271  {
272  int idx = lyrCnt/2 - 1;
273  m_CopperLayersChoice->SetSelection(idx);
274  break;
275  }
276  }
277 }
278 
279 
281 {
282  // Set all the board's layer names into the dialog by calling BOARD::GetLayerName(),
283  // which will call BOARD::GetStandardLayerName() for non-coppers.
284 
285  for( LSEQ seq = dlg_layers(); seq; ++seq )
286  {
287  PCB_LAYER_ID layer = *seq;
288  wxControl* ctl = getName( layer );
289 
290  if( ctl )
291  {
292  wxString lname = m_pcb->GetLayerName( layer );
293 
294  if( dynamic_cast<wxTextCtrl*>( ctl ) )
295  dynamic_cast<wxTextCtrl*>( ctl )->SetValue( lname ); // wxTextCtrl
296  else
297  ctl->SetLabel( lname ); // wxStaticText
298  }
299  }
300 }
301 
302 
304 {
305  // the check boxes
306  for( LSEQ seq = dlg_layers(); seq; ++seq )
307  {
308  PCB_LAYER_ID layer = *seq;
309  setLayerCheckBox( layer, enabledLayers[layer] );
310  }
311 }
312 
313 
315 {
316  int presetsNdx = 0; // the "Custom" setting, matches nothing
317 
318  for( unsigned i=1; i<arrayDim( presets ); ++i )
319  {
320  if( enabledLayers == presets[i] )
321  {
322  presetsNdx = i;
323  break;
324  }
325  }
326 
327  m_PresetsChoice->SetSelection( presetsNdx );
328 }
329 
330 
332 {
333  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
334  {
335  PCB_LAYER_ID cu_layer = *seq;
336 
337  wxChoice* ctl = getChoice( cu_layer );
338  ctl->SetSelection( m_pcb->GetLayerType( cu_layer ) );
339  }
340 }
341 
342 
344 {
345  LSET layerMaskResult;
346 
347  for( LSEQ seq = dlg_layers(); seq; ++seq )
348  {
349  PCB_LAYER_ID layer = *seq;
350  wxCheckBox* ctl = getCheckBox( layer );
351 
352  if( ctl->GetValue() )
353  layerMaskResult.set( layer );
354  }
355 
356  return layerMaskResult;
357 }
358 
359 
360 void PANEL_SETUP_LAYERS::setLayerCheckBox( LAYER_NUM aLayer, bool isChecked )
361 {
362  PANEL_SETUP_LAYERS_CTLs ctl = getCTLs( aLayer );
363 
364  ctl.checkbox->SetValue( isChecked );
365 }
366 
367 
369 {
370  if( copperCount > 0 )
371  {
372  setLayerCheckBox( F_Cu, true );
373  --copperCount;
374  }
375 
376  if( copperCount > 0 )
377  {
378  setLayerCheckBox( B_Cu, true );
379  --copperCount;
380  }
381 
382  for( LSEQ seq = LSET::InternalCuMask().Seq(); seq; ++seq, --copperCount )
383  {
384  PCB_LAYER_ID layer = *seq;
385  bool state = copperCount > 0;
386 
387 #ifdef HIDE_INACTIVE_LAYERS
388  // This code hides non-active copper layers, or redisplays hidden
389  // layers which are now needed.
390  PANEL_SETUP_LAYERS_CTLs ctl = getCTLs( layer );
391 
392  ctl.name->Show( state );
393  ctl.checkbox->Show( state );
394  ctl.choice->Show( state );
395 #endif
396 
397  setLayerCheckBox( layer, state );
398  }
399 
400 #ifdef HIDE_INACTIVE_LAYERS
401  // Send an size event to force sizers to be updated,
402  // because the number of copper layers can have changed.
403  wxSizeEvent evt_size( m_LayersListPanel->GetSize() );
404  m_LayersListPanel->GetEventHandler()->ProcessEvent( evt_size );
405 #endif
406 }
407 
408 
409 void PANEL_SETUP_LAYERS::OnCheckBox( wxCommandEvent& event )
410 {
412 
414 }
415 
416 
417 void PANEL_SETUP_LAYERS::DenyChangeCheckBox( wxCommandEvent& event )
418 {
419  wxObject* source = event.GetEventObject();
420  wxString msg;
421 
422  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
423  {
424  wxCheckBox* copper = getCheckBox( *seq );
425 
426  if( source == copper )
427  {
428  wxString controlLabel = m_staticTextCopperLayers->GetLabel();
429  // knock the ':' off the end
430  controlLabel = controlLabel.substr( 0, controlLabel.size() - 1 );
431 
432  msg.Printf( _( "Use the \"%s\" control to change the number of copper layers." ),
433  controlLabel );
434  DisplayError( this, msg );
435 
436  copper->SetValue( true );
437  return;
438  }
439  }
440 
441  for( int layer : { F_CrtYd, B_CrtYd, Edge_Cuts, Margin } )
442  {
443  wxCheckBox* mandatory = getCheckBox( layer );
444 
445  if( source == mandatory )
446  {
447  msg.Printf( _( "The %s layer is mandatory." ), getLayerName( layer ) );
448  DisplayError( this, msg );
449  mandatory->SetValue( true );
450  return;
451  }
452  }
453 }
454 
455 
456 void PANEL_SETUP_LAYERS::OnPresetsChoice( wxCommandEvent& event )
457 {
458  int presetNdx = m_PresetsChoice->GetCurrentSelection();
459 
460  if( presetNdx <= 0 ) // the Custom setting controls nothing.
461  return;
462 
463  if( presetNdx < (int) arrayDim(presets) )
464  {
465  m_enabledLayers = presets[ presetNdx ];
466  LSET copperSet = m_enabledLayers & LSET::AllCuMask();
467  int copperCount = copperSet.count();
468 
469  showCopperChoice( copperCount );
471  setCopperLayerCheckBoxes( copperCount );
472  }
473 
474  // Ensure mandatory layers are activated
476 }
477 
478 
479 void PANEL_SETUP_LAYERS::OnCopperLayersChoice( wxCommandEvent& event )
480 {
481  setCopperLayerCheckBoxes( m_CopperLayersChoice->GetCurrentSelection() * 2 + 2 );
484 }
485 
486 
488 {
489  if( !testLayerNames() )
490  return false;
491 
492  wxString msg;
493 
494  int thickness = m_pcbThickness.GetValue();
495 
496  // Check for removed layers with items which will get deleted from the board.
497  LSEQ removedLayers = getRemovedLayersWithItems();
498 
499  // Check for non copper layers in use in footprints, and therefore not removable.
500  LSEQ notremovableLayers = getNonRemovableLayers();
501 
502  if( !notremovableLayers.empty() )
503  {
504  for( unsigned int ii = 0; ii < notremovableLayers.size(); ii++ )
505  msg << m_pcb->GetLayerName( notremovableLayers[ii] ) << "\n";
506 
507  if( !IsOK( this, wxString::Format( _( "Footprints have some items on removed layers:\n"
508  "%s\n"
509  "These items will be no longer accessible\n"
510  "Do you wish to continue?" ), msg ) ) )
511  return false;
512  }
513 
514  if( !removedLayers.empty() &&
515  !IsOK( this, _( "Items have been found on removed layers. This operation will delete "
516  "all items from removed layers and cannot be undone. Do you wish to "
517  "continue?" ) ) )
518  return false;
519 
520  // Delete all objects on layers that have been removed. Leaving them in copper layers
521  // can (will?) result in DRC errors and it pollutes the board file with cruft.
522  bool hasRemovedBoardItems = false;
523 
524  if( !removedLayers.empty() )
525  {
526  PCB_LAYER_COLLECTOR collector;
527 
528  for( auto layer_id : removedLayers )
529  {
530  collector.SetLayerId( layer_id );
532 
533  // Bye-bye items on on removed layer.
534  if( collector.GetCount() != 0 )
535  {
536  hasRemovedBoardItems = true;
537 
538  for( int i = 0; i < collector.GetCount(); i++ )
539  {
540  BOARD_ITEM* item = collector[i];
541  m_pcb->Remove( item );
542  delete item;
543  }
544  }
545  }
546  }
547 
549 
551  {
553 
554  /* Ensure enabled layers are also visible
555  * This is mainly to avoid mistakes if some enabled
556  * layers are not visible when exiting this dialog
557  */
559  }
560 
561  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
562  {
563  PCB_LAYER_ID layer = *seq;
564 
565  if( m_enabledLayers[layer] )
566  {
567  m_pcb->SetLayerName( layer, getLayerName( layer ) );
568  LAYER_T t = (LAYER_T) getLayerTypeIndex( layer );
569  m_pcb->SetLayerType( layer, t );
570  }
571  }
572 
573  m_pcb->GetDesignSettings().SetBoardThickness( thickness );
574 
575  // If some board items are deleted: rebuild the connectivity,
576  // because it is likely some tracks and vias where removed
577  if( hasRemovedBoardItems )
578  {
579  // Rebuild list of nets (full ratsnest rebuild)
580  m_frame->Compile_Ratsnest( NULL, true );
582  }
583 
584  return true;
585 }
586 
587 
589 {
590  wxChoice* ctl = getChoice( aLayer );
591  int ret = ctl->GetCurrentSelection(); // indices must have same sequence as LAYER_T
592  return ret;
593 }
594 
595 
597 {
598  wxControl* control = getName( aLayer );
599 
600  if( dynamic_cast<wxTextCtrl*>( control ) )
601  return static_cast<wxTextCtrl*>( control )->GetValue().Trim();
602  else
603  return static_cast<wxStaticText*>( control )->GetLabel();
604 }
605 
606 
607 static bool hasOneOf( const wxString& str, const wxString& chars )
608 {
609  for( unsigned i=0; i<chars.Len(); ++i )
610  {
611  if( str.Find( chars[i] ) != wxNOT_FOUND )
612  return true;
613  }
614 
615  return false;
616 }
617 
618 
620 {
621  std::vector<wxString> names;
622  wxTextCtrl* ctl;
623 
624  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
625  {
626  PCB_LAYER_ID layer = *seq;
627 
628  // we _can_ rely on m_enabledLayers being current here:
629  if( !m_enabledLayers[layer] )
630  continue;
631 
632  wxString name = getLayerName( layer );
633 
634  ctl = (wxTextCtrl*) getName( layer );
635 
636  // check name for legality.
637  // 1) cannot be blank.
638  // 2) cannot have blanks.
639  // 3) cannot have " chars
640  // 4) cannot be 'signal'
641  // 5) must be unique.
642  // 6) cannot have illegal chars in filenames ( some filenames are built from layer names )
643  // like : % $ \ " / :
644  wxString badchars = wxFileName::GetForbiddenChars( wxPATH_DOS );
645  badchars.Append( '%' );
646 
647  if( !name )
648  {
649  m_Parent->SetError( _( "Layer must have a name." ), this, ctl );
650  return false;
651  }
652 
653  if( hasOneOf( name, badchars ) )
654  {
655  auto msg = wxString::Format(_( "\"%s\" are forbidden in layer names." ), badchars );
656  m_Parent->SetError( msg, this, ctl );
657  return false;
658  }
659 
660  if( name == wxT( "signal" ) )
661  {
662  m_Parent->SetError( _( "Layer name \"signal\" is reserved." ), this, ctl );
663  return false;
664  }
665 
666  for( const wxString& existingName : names )
667  {
668  if( name == existingName )
669  {
670  auto msg = wxString::Format(_( "Layer name \"%s\" is already in use." ), name );
671  m_Parent->SetError( msg, this, ctl );
672  return false;
673  }
674  }
675 
676  names.push_back( name );
677  }
678 
679  return true;
680 }
681 
682 
684 {
685  LSEQ removedLayers;
686  LSET newLayers = getUILayerMask();
687  LSET curLayers = m_pcb->GetEnabledLayers();
688 
689  if( newLayers == curLayers ) // return a empty list if no change
690  return removedLayers;
691 
692  PCB_LAYER_COLLECTOR collector;
693  LSEQ newLayerSeq = newLayers.Seq();
694 
695  for( auto layer_id : curLayers.Seq() )
696  {
697  if( std::find( newLayerSeq.begin(), newLayerSeq.end(), layer_id ) == newLayerSeq.end() )
698  {
699  collector.SetLayerId( layer_id );
701 
702  if( collector.GetCount() != 0 )
703  removedLayers.push_back( layer_id );
704  }
705  }
706 
707  return removedLayers;
708 }
709 
710 
712 {
713  //Build the list of non copper layers in use in footprints.
714  LSEQ inUseLayers;
715  LSET newLayers = getUILayerMask();
716  LSET curLayers = m_pcb->GetEnabledLayers();
717 
718  if( newLayers == curLayers ) // return a empty list if no change
719  return inUseLayers;
720 
721  PCB_LAYER_COLLECTOR collector;
722  LSEQ newLayerSeq = newLayers.Seq();
723 
724  for( auto layer_id : curLayers.Seq() )
725  {
726  if( IsCopperLayer( layer_id ) ) // Copper layers are not taken in account here
727  continue;
728 
729  if( std::find( newLayerSeq.begin(), newLayerSeq.end(), layer_id ) == newLayerSeq.end() )
730  {
731  collector.SetLayerId( layer_id );
733 
734  if( collector.GetCount() != 0 )
735  inUseLayers.push_back( layer_id );
736  }
737  }
738 
739  return inUseLayers;
740 }
741 
742 
744 {
745  BOARD* savedBoard = m_pcb;
746 
747  m_pcb = aBoard;
749 
750  m_pcb = savedBoard;
751 }
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
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:288
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)
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
Class BOARD to handle a board.
bool TransferDataToWindow() override
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's Inspector method, which does the collection.
Definition: collectors.cpp:546
UNIT_BINDER m_pcbThickness
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:539
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: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)
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: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.
void setCopperLayerCheckBoxes(int copperCount)
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:114
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:73
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...
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[]
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:99
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:171
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
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)
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
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:243
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:293
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)