KiCad PCB EDA Suite
dialog_layers_setup.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 - 2015 KiCad Developers, see change_log.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 
30 #include <confirm.h>
31 #include <pcbnew.h>
32 #include <invoke_pcb_dialog.h>
33 
34 #include <class_board.h>
35 
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 // if defined, use the layer manager copper layers order (from FRONT to BACK)
46 // to display inner layers.
47 // if not, use the default order (from BACK to FRONT)
48 #define USE_LAYER_MANAGER_COPPER_LAYERS_ORDER
49 
50 
55 struct CTLs
56 {
57  CTLs( wxControl* aName, wxCheckBox* aCheckBox, wxControl* aChoiceOrDesc, wxPanel * aPanel = NULL)
58  {
59  name = aName;
60  checkbox = aCheckBox;
61  choice = aChoiceOrDesc;
62  panel = aPanel;
63  }
64 
65  wxControl* name;
66  wxCheckBox* checkbox;
67  wxControl* choice;
68  wxPanel * panel;
69 };
70 
71 
72 static LSEQ dlg_layers()
73 {
74  // layers that are put out into the dialog UI, coordinate with wxformbuilder and
75  // getCTLs( LAYER_NUM aLayerNumber )
76  static const PCB_LAYER_ID layers[] = {
77  F_CrtYd,
78  F_Fab,
79  F_Adhes,
80  F_Paste,
81  F_SilkS,
82  F_Mask,
83  F_Cu,
84 
85  In1_Cu,
86  In2_Cu,
87  In3_Cu,
88  In4_Cu,
89  In5_Cu,
90  In6_Cu,
91  In7_Cu,
92  In8_Cu,
93  In9_Cu,
94  In10_Cu,
95  In11_Cu,
96  In12_Cu,
97  In13_Cu,
98  In14_Cu,
99  In15_Cu,
100 
101  In16_Cu,
102  In17_Cu,
103  In18_Cu,
104  In19_Cu,
105  In20_Cu,
106  In21_Cu,
107  In22_Cu,
108  In23_Cu,
109  In24_Cu,
110  In25_Cu,
111  In26_Cu,
112  In27_Cu,
113  In28_Cu,
114  In29_Cu,
115  In30_Cu,
116 
117  B_Cu,
118  B_Mask,
119  B_SilkS,
120  B_Paste,
121  B_Adhes,
122  B_Fab,
123  B_CrtYd,
124 
125  Edge_Cuts,
126  Margin,
127  Eco2_User,
128  Eco1_User,
129  Cmts_User,
130  Dwgs_User,
131  };
132 
133  return LSEQ( layers, layers + DIM( layers ) );
134 }
135 
136 
138 {
139 public:
140  DIALOG_LAYERS_SETUP( wxTopLevelWindow* aCaller, BOARD* aBoard );
141 
142 private:
145 
147 
148  wxStaticText* m_nameStaticText;
149  wxStaticText* m_enabledStaticText;
150  wxStaticText* m_typeStaticText;
151 
152  void setLayerCheckBox( LAYER_NUM layer, bool isChecked );
153  void setCopperLayerCheckBoxes( int copperCount );
154 
155  void showCopperChoice( int copperCount );
156  void showBoardLayerNames();
157  void showSelectedLayerCheckBoxes( LSET enableLayerMask );
158  void showLayerTypes();
159  void showPresets( LSET enabledLayerMask );
160 
163  wxString getLayerName( LAYER_NUM layer );
164  int getLayerTypeIndex( LAYER_NUM layer );
165 
166 
167  void OnCancelButtonClick( wxCommandEvent& event ) override;
168  void OnOkButtonClick( wxCommandEvent& event ) override;
169  void OnCheckBox( wxCommandEvent& event ) override;
170  void DenyChangeCheckBox( wxCommandEvent& event ) override;
171  void OnPresetsChoice( wxCommandEvent& event ) override;
172  void OnCopperLayersChoice( wxCommandEvent& event ) override;
173 
174  bool testLayerNames();
175 
181  CTLs getCTLs( LAYER_NUM aLayerNumber );
182 
183  wxControl* getName( LAYER_NUM aLayer )
184  {
185  return getCTLs( aLayer ).name;
186  }
187 
188  wxCheckBox* getCheckBox( LAYER_NUM aLayer )
189  {
190  return getCTLs( aLayer ).checkbox;
191  }
192 
193  wxChoice* getChoice( LAYER_NUM aLayer )
194  {
195  return (wxChoice*) getCTLs( aLayer ).choice;
196  }
197 
198  void moveTitles()
199  {
200  wxArrayInt widths = m_LayerListFlexGridSizer->GetColWidths();
201 
202  int offset = 0;
203  wxSize txtz;
204 
205  txtz = m_nameStaticText->GetSize();
206  m_nameStaticText->Move( offset + (widths[0] - txtz.x)/2, 5 );
207  offset += widths[0];
208 
209  txtz = m_enabledStaticText->GetSize();
210  m_enabledStaticText->Move( offset + (widths[1] - txtz.x)/2, 5 );
211  offset += widths[1];
212 
213  txtz = m_typeStaticText->GetSize();
214  m_typeStaticText->Move( offset + (widths[2] - txtz.x)/2, 5 );
215  }
216 
217  void OnSize( wxSizeEvent& event ) override;
218 };
219 
220 
221 // Layer bit masks for each defined "Preset Layer Grouping"
222 static const LSET presets[] =
223 {
224  LSET(), // shift the array index up by one, matches with "Custom".
225 
226  // "Two layers, parts on Front only"
228 
229  // "Two layers, parts on Back only",
231 
232  // "Two layers, parts on Front and Back",
234 
235  // "Four layers, parts on Front only"
237 
238  // "Four layers, parts on Front and Back"
240 
241  // "All layers on",
242  LSET().set(),
243 };
244 
245 
247 {
248 #define RETCOP(x) return CTLs( x##Name, x##CheckBox, x##Choice, x##Panel );
249 #define RETAUX(x) return CTLs( x##Name, x##CheckBox, x##StaticText, x##Panel );
250 
251  switch( aLayerNumber )
252  {
253  case F_CrtYd: RETAUX( m_CrtYdFront );
254  case F_Fab: RETAUX( m_FabFront );
255  case F_Adhes: RETAUX( m_AdhesFront );
256  case F_Paste: RETAUX( m_SoldPFront );
257  case F_SilkS: RETAUX( m_SilkSFront );
258  case F_Mask: RETAUX( m_MaskFront );
259  case F_Cu: RETCOP( m_Front );
260 
261  case In1_Cu: RETCOP( m_In1 );
262  case In2_Cu: RETCOP( m_In2 );
263  case In3_Cu: RETCOP( m_In3 );
264  case In4_Cu: RETCOP( m_In4 );
265  case In5_Cu: RETCOP( m_In5 );
266  case In6_Cu: RETCOP( m_In6 );
267  case In7_Cu: RETCOP( m_In7 );
268  case In8_Cu: RETCOP( m_In8 );
269  case In9_Cu: RETCOP( m_In9 );
270  case In10_Cu: RETCOP( m_In10 );
271  case In11_Cu: RETCOP( m_In11 );
272  case In12_Cu: RETCOP( m_In12 );
273  case In13_Cu: RETCOP( m_In13 );
274  case In14_Cu: RETCOP( m_In14 );
275  case In15_Cu: RETCOP( m_In15 );
276 
277  case In16_Cu: RETCOP( m_In16 );
278  case In17_Cu: RETCOP( m_In17 );
279  case In18_Cu: RETCOP( m_In18 );
280  case In19_Cu: RETCOP( m_In19 );
281  case In20_Cu: RETCOP( m_In20 );
282  case In21_Cu: RETCOP( m_In21 );
283  case In22_Cu: RETCOP( m_In22 );
284  case In23_Cu: RETCOP( m_In23 );
285  case In24_Cu: RETCOP( m_In24 );
286  case In25_Cu: RETCOP( m_In25 );
287  case In26_Cu: RETCOP( m_In26 );
288  case In27_Cu: RETCOP( m_In27 );
289  case In28_Cu: RETCOP( m_In28 );
290  case In29_Cu: RETCOP( m_In29 );
291  case In30_Cu: RETCOP( m_In30 );
292 
293  case B_Cu: RETCOP( m_Back );
294  case B_Mask: RETAUX( m_MaskBack );
295  case B_SilkS: RETAUX( m_SilkSBack );
296  case B_Paste: RETAUX( m_SoldPBack );
297  case B_Adhes: RETAUX( m_AdhesBack );
298  case B_Fab: RETAUX( m_FabBack );
299  case B_CrtYd: RETAUX( m_CrtYdBack );
300 
301  case Edge_Cuts: RETAUX( m_PCBEdges );
302  case Margin: RETAUX( m_Margin );
303  case Eco2_User: RETAUX( m_Eco2 );
304  case Eco1_User: RETAUX( m_Eco1 );
305  case Cmts_User: RETAUX( m_Comments );
306  case Dwgs_User: RETAUX( m_Drawings );
307  default:
308  wxASSERT_MSG( 0, wxT( "bad layer id" ) );
309  return CTLs( 0, 0, 0 );
310  }
311 
312 #undef RETCOP
313 #undef RETAUX
314 }
315 
316 
317 DIALOG_LAYERS_SETUP::DIALOG_LAYERS_SETUP( wxTopLevelWindow* aParent, BOARD* aBoard ) :
318  DIALOG_LAYERS_SETUP_BASE( aParent )
319 {
320  m_pcb = aBoard;
321 
328 
330 
334 
335  showLayerTypes();
336 
337  SetAutoLayout( true );
338 
339  // these 3 controls are handled outside wxformbuilder so that we can add
340  // them without a sizer. Then we position them manually based on the column
341  // widths from m_LayerListFlexGridSizer->GetColWidths()
342  m_nameStaticText = new wxStaticText( m_TitlePanel, wxID_ANY, _("Name"), wxDefaultPosition, wxDefaultSize, 0 );
343 
344  m_enabledStaticText = new wxStaticText( m_TitlePanel, wxID_ANY, _("Enabled"), wxDefaultPosition, wxDefaultSize, 0 );
345 
346  m_typeStaticText = new wxStaticText( m_TitlePanel, wxID_ANY, _("Type"), wxDefaultPosition, wxDefaultSize, 0 );
347 
348  // set the height of the title panel to be the size of any wxStaticText object
349  // plus 10 so we can have a border of 5 on both top and bottom.
350  m_TitlePanel->SetMinSize( wxSize( -1, m_AdhesFrontName->GetSize().y+10 ) );
351 
352  m_LayersListPanel->ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
353 
354  Layout();
355  Fit();
356  moveTitles();
357 
358  Center();
359 
360  m_sdbSizerOK->SetFocus();
361  m_sdbSizerOK->SetDefault();
362 }
363 
364 void DIALOG_LAYERS_SETUP::OnSize( wxSizeEvent& event )
365 {
366  moveTitles();
367  event.Skip();
368 }
369 
371 {
372  if( copperCount > MAX_CU_LAYERS )
373  copperCount = MAX_CU_LAYERS;
374 
375  if( copperCount < 2 )
376  copperCount = 2;
377 
378  for( int lyrCnt = 2; lyrCnt <= MAX_CU_LAYERS; lyrCnt += 2 )
379  {
380  // note this will change a one layer board to 2:
381  if( copperCount <= lyrCnt )
382  {
383  int idx = lyrCnt/2 - 1;
384  m_CopperLayersChoice->SetSelection(idx);
385  break;
386  }
387  }
388 }
389 
390 
392 {
393  // Establish all the board's layer names into the dialog presentation, by
394  // obtaining them from BOARD::GetLayerName() which calls
395  // BOARD::GetStandardLayerName() for non-coppers.
396 
397  for( LSEQ seq = dlg_layers(); seq; ++seq )
398  {
399  PCB_LAYER_ID layer = *seq;
400 
401  wxControl* ctl = getName( layer );
402 
403  wxASSERT( ctl );
404 
405  if( ctl )
406  {
407  wxString lname = m_pcb->GetLayerName( layer );
408  //D(printf("layerName[%d]=%s\n", layer, TO_UTF8( lname ) );)
409 
410  if( ctl->IsKindOf( CLASSINFO(wxTextCtrl) ) )
411  ((wxTextCtrl*)ctl)->SetValue( lname ); // wxTextCtrl
412  else
413  ctl->SetLabel( lname ); // wxStaticText
414  }
415  }
416 }
417 
418 
420 {
421  // the check boxes
422  for( LSEQ seq = dlg_layers(); seq; ++seq )
423  {
424  PCB_LAYER_ID layer = *seq;
425  setLayerCheckBox( layer, enabledLayers[layer] );
426  }
427 }
428 
429 
431 {
432  int presetsNdx = 0; // the "Custom" setting, matches nothing
433 
434  for( unsigned i=1; i<DIM(presets); ++i )
435  {
436  if( enabledLayers == presets[i] )
437  {
438  presetsNdx = i;
439  break;
440  }
441  }
442 
443  m_PresetsChoice->SetSelection( presetsNdx );
444 }
445 
446 
448 {
449  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
450  {
451  PCB_LAYER_ID cu_layer = *seq;
452 
453  wxChoice* ctl = getChoice( cu_layer );
454  ctl->SetSelection( m_pcb->GetLayerType( cu_layer ) );
455  }
456 }
457 
458 
460 {
461  LSET layerMaskResult;
462 
463  for( LSEQ seq = dlg_layers(); seq; ++seq )
464  {
465  PCB_LAYER_ID layer = *seq;
466  wxCheckBox* ctl = getCheckBox( layer );
467 
468  if( ctl->GetValue() )
469  {
470  layerMaskResult.set( layer );
471  }
472  }
473 
474  return layerMaskResult;
475 }
476 
477 
478 void DIALOG_LAYERS_SETUP::setLayerCheckBox( LAYER_NUM aLayer, bool isChecked )
479 {
480  wxCheckBox* ctl = getCheckBox( aLayer );
481  ctl->SetValue( isChecked );
482 }
483 
484 
486 {
487  if( copperCount > 0 )
488  {
489  setLayerCheckBox( F_Cu, true );
490  --copperCount;
491  }
492 
493  if( copperCount > 0 )
494  {
495  setLayerCheckBox( B_Cu, true );
496  --copperCount;
497  }
498 
499  for( LSEQ seq = LSET::InternalCuMask().Seq(); seq; ++seq, --copperCount )
500  {
501  PCB_LAYER_ID layer = *seq;
502  bool state = copperCount > 0;
503 
504 #ifdef HIDE_INACTIVE_LAYERS
505  // This code hides non-active copper layers, or redisplays hidden
506  // layers which are now needed.
507  CTLs ctl = getCTLs( layer );
508 
509  ctl.name->Show( state );
510  ctl.checkbox->Show( state );
511  ctl.choice->Show( state );
512 
513  if( ctl.panel )
514  ctl.panel->Show( state );
515 #endif
516 
517  setLayerCheckBox( layer, state );
518  }
519 
520 #ifdef HIDE_INACTIVE_LAYERS
521  // Send an size event to force sizers to be updated,
522  // because the number of copper layers can have changed.
523  wxSizeEvent evt_size( m_LayersListPanel->GetSize() );
524  m_LayersListPanel->GetEventHandler()->ProcessEvent( evt_size );
525 #endif
526 }
527 
528 
529 void DIALOG_LAYERS_SETUP::OnCheckBox( wxCommandEvent& event )
530 {
532 
534 }
535 
536 
537 void DIALOG_LAYERS_SETUP::DenyChangeCheckBox( wxCommandEvent& event )
538 {
539  // user may not change copper layer checkboxes from anything other than
540  // either presets choice or the copper layer choice controls.
541 
542  // I tried to simply disable the copper CheckBoxes but they look like crap,
543  // so leave them enabled and reverse the user's attempt to toggle them.
544 
546 }
547 
548 
549 void DIALOG_LAYERS_SETUP::OnPresetsChoice( wxCommandEvent& event )
550 {
551  unsigned presetNdx = m_PresetsChoice->GetCurrentSelection();
552 
553  if( presetNdx == 0 ) // the Custom setting controls nothing.
554  return;
555 
556  if( presetNdx < DIM(presets) )
557  {
558  m_enabledLayers = presets[ presetNdx ];
559 
560  LSET copperSet = m_enabledLayers & LSET::AllCuMask();
561 
562  int copperCount = copperSet.count();
563 
564  m_copperLayerCount = copperCount;
565 
567 
569 
571  }
572 }
573 
574 
575 void DIALOG_LAYERS_SETUP::OnCopperLayersChoice( wxCommandEvent& event )
576 {
577  m_copperLayerCount = m_CopperLayersChoice->GetCurrentSelection() * 2 + 2;
578 
580 
582 
584 }
585 
586 
587 void DIALOG_LAYERS_SETUP::OnCancelButtonClick( wxCommandEvent& event )
588 {
589  EndModal( wxID_CANCEL );
590 }
591 
592 
593 void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event )
594 {
595  if( testLayerNames() )
596  {
597  wxString name;
598 
601 
602  /* Ensure enabled layers are also visible
603  * This is mainly to avoid mistakes if some enabled
604  * layers are not visible when exiting this dialog
605  */
607 
608  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
609  {
610  PCB_LAYER_ID layer = *seq;
611 
612  if( m_enabledLayers[layer] )
613  {
614  name = getLayerName( layer );
615  m_pcb->SetLayerName( layer, name );
616  LAYER_T t = (LAYER_T) getLayerTypeIndex( layer );
617  m_pcb->SetLayerType( layer, t );
618  }
619  }
620 
621  int thickness = ValueFromTextCtrl( *m_textCtrlBrdThickness );
622 
623  // Clamp the value between reasonable values
624 
625  thickness = Clamp( Millimeter2iu( 0.1 ), thickness, Millimeter2iu( 10.0 ) );
626  m_pcb->GetDesignSettings().SetBoardThickness( thickness );
627 
628  EndModal( wxID_OK );
629  }
630 }
631 
632 
634 {
635  wxChoice* ctl = getChoice( aLayer );
636 
637  int ret = ctl->GetCurrentSelection(); // indices must have same sequence as LAYER_T
638 
639  return ret;
640 }
641 
642 
644 {
645  wxString ret;
646 
647  wxASSERT( IsCopperLayer( aLayer ) );
648 
649  wxTextCtrl* ctl = (wxTextCtrl*) getName( aLayer );
650 
651  ret = ctl->GetValue().Trim();
652 
653  return ret;
654 }
655 
656 
657 static bool hasOneOf( const wxString& str, const wxString& chars )
658 {
659  for( unsigned i=0; i<chars.Len(); ++i )
660  if( str.Find( chars[i] ) != wxNOT_FOUND )
661  return true;
662  return false;
663 }
664 
665 
667 {
668  std::vector<wxString> names;
669 
670  wxTextCtrl* ctl;
671 
672  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
673  {
674  PCB_LAYER_ID layer = *seq;
675 
676  // we _can_ rely on m_enabledLayers being current here:
677  if( !m_enabledLayers[layer] )
678  continue;
679 
680  wxString name = getLayerName( layer );
681 
682  //D(printf("name[%d]=%s\n", layer, TO_UTF8(name) );)
683 
684  ctl = (wxTextCtrl*) getName( layer );
685 
686  // check name for legality.
687  // 1) cannot be blank.
688  // 2) cannot have blanks.
689  // 3) cannot have " chars
690  // 4) cannot be 'signal'
691  // 5) must be unique.
692  // 6) cannot have illegal chars in filenames ( some filenames are built from layer names )
693  // like : % $ \ " / :
694 
695  wxString badchars = wxFileName::GetForbiddenChars(wxPATH_DOS);
696  badchars.Append( '%' );
697 
698  if( !name )
699  {
700  DisplayError( this, _("Layer name may not be empty" ) );
701  ctl->SetFocus(); // on the bad name
702  return false;
703  }
704 
705  if( hasOneOf( name, badchars ) )
706  {
707  DisplayError( this, _("Layer name has an illegal character, one of: '") + badchars + wxT("'") );
708  ctl->SetFocus(); // on the bad name
709  return false;
710  }
711 
712  if( name == wxT("signal") )
713  {
714  DisplayError( this, _("'signal' is a reserved layer name") );
715  ctl->SetFocus(); // on the bad name
716  return false;
717  }
718 
719  for( std::vector<wxString>::iterator it = names.begin(); it != names.end(); ++it )
720  {
721  if( name == *it )
722  {
723  DisplayError( this, _("Layer name is a duplicate of another") );
724  ctl->SetFocus(); // on the bad name
725  return false;
726  }
727  }
728 
729  names.push_back( name );
730  }
731 
732  return true;
733 }
734 
735 
736 bool InvokeLayerSetup( wxTopLevelWindow* aCaller, BOARD* aBoard )
737 {
738  DIALOG_LAYERS_SETUP dlg( aCaller, aBoard );
739 
740  return dlg.ShowModal() == wxID_OK;
741 }
wxCheckBox * getCheckBox(LAYER_NUM aLayer)
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:639
#define DIM(x)
of elements in an array
Definition: macros.h:98
static LSEQ dlg_layers()
wxFlexGridSizer * m_LayerListFlexGridSizer
const T & Clamp(const T &lower, const T &value, const T &upper)
Function Clamp limits value within the range lower <= value <= upper.
Definition: macros.h:127
Struct CTLs holds the 3 ui control pointers for a single board layer.
wxControl * getName(LAYER_NUM aLayer)
This file is part of the common library.
static LSET BackTechMask()
Function BackTechMask returns a mask holding all technical layers (no CU layer) on back side...
Definition: lset.cpp:683
void setLayerCheckBox(LAYER_NUM layer, bool isChecked)
Class BOARD to handle a board.
int GetCopperLayerCount() const
Function GetCopperLayerCount.
wxStaticText * m_typeStaticText
CTLs(wxControl *aName, wxCheckBox *aCheckBox, wxControl *aChoiceOrDesc, wxPanel *aPanel=NULL)
void showPresets(LSET enabledLayerMask)
static LSET FrontTechMask()
Function FrontTechMask returns a mask holding all technical layers (no CU layer) on front side...
Definition: lset.cpp:695
wxStaticText * m_enabledStaticText
CTLs getCTLs(LAYER_NUM aLayerNumber)
Function getCTLs maps aLayerNumber to the wx IDs for that layer which are the layer name control ID...
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Function SetLayerType changes the type of the layer given by aLayer.
void OnSize(wxSizeEvent &event) override
void SetBoardThickness(int aThickness)
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
Class DIALOG_LAYERS_SETUP_BASE.
void OnCheckBox(wxCommandEvent &event) override
bool InvokeLayerSetup(wxTopLevelWindow *aCaller, BOARD *aBoard)
Function InvokeLayerSetup shows the layer setup dialog.
This file contains miscellaneous commonly used macros and functions.
wxStaticText * m_nameStaticText
wxControl * choice
static const LSET presets[]
wxPanel * panel
PCB_LAYER_ID
A quick note on layer IDs:
Class LSET is a set of PCB_LAYER_IDs.
void showCopperChoice(int copperCount)
#define RETCOP(x)
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
void OnPresetsChoice(wxCommandEvent &event) override
LAYER_T
Enum LAYER_T gives the allowed types of layers, same as Specctra DSN spec.
Definition: class_board.h:71
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:479
void setCopperLayerCheckBoxes(int copperCount)
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:599
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:533
#define RETAUX(x)
int ValueFromTextCtrl(const wxTextCtrl &aTextCtr)
Convert the number Value in a string according to the internal units and the selected unit (g_UserUni...
Definition: base_units.cpp:384
Class LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
void OnCopperLayersChoice(wxCommandEvent &event) override
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
wxChoice * getChoice(LAYER_NUM aLayer)
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void showSelectedLayerCheckBoxes(LSET enableLayerMask)
LSET getUILayerMask()
return the selected layer mask within the UI checkboxes
void PutValueInLocalUnits(wxTextCtrl &aTextCtr, int aValue)
Function PutValueInLocalUnits converts aValue from internal units to user units and append the units ...
Definition: base_units.cpp:265
void OnCancelButtonClick(wxCommandEvent &event) override
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
wxString getLayerName(LAYER_NUM layer)
const char * name
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
wxCheckBox * checkbox
static bool hasOneOf(const wxString &str, const wxString &chars)
int getLayerTypeIndex(LAYER_NUM layer)
void DenyChangeCheckBox(wxCommandEvent &event) override
static LSET UserMask()
Definition: lset.cpp:723
wxControl * name
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
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 OnOkButtonClick(wxCommandEvent &event) override
DIALOG_LAYERS_SETUP(wxTopLevelWindow *aCaller, BOARD *aBoard)