KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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 The 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 <confirm.h>
28#include <core/arraydim.h>
29#include <core/kicad_algo.h>
30#include <pcb_edit_frame.h>
31#include <tool/tool_manager.h>
32#include <tools/pcb_actions.h>
33#include <board.h>
34#include <collectors.h>
35#include <footprint.h>
36#include <layer_ids.h>
37#include <pad.h>
38#include <pcb_track.h>
39#include <panel_setup_layers.h>
41
42#include <wx/choicdlg.h>
43#include <wx/msgdlg.h>
44#include <eda_list_dialog.h>
45
46#include <list>
47#include <set>
48
49
53static void mandatoryLayerCbSetup( wxCheckBox& aCheckBox )
54{
55 aCheckBox.Show();
56 aCheckBox.Disable();
57 aCheckBox.SetValue( true );
58 aCheckBox.SetToolTip( _( "This layer is required and cannot be disabled" ) );
59}
60
61
62PANEL_SETUP_LAYERS::PANEL_SETUP_LAYERS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame ) :
63 PANEL_SETUP_LAYERS_BASE( aParentWindow ),
64 m_frame( aFrame ),
65 m_physicalStackup( nullptr ),
66 m_initialized( false )
67{
68 m_pcb = aFrame->GetBoard();
69}
70
71
73{
74 m_CrtYdFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
75 wxDefaultPosition, wxDefaultSize, 0 );
77 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT
78 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
79 5 );
80
81 m_CrtYdFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_CrtYd ),
82 wxDefaultPosition, wxDefaultSize, 0 );
83 m_CrtYdFrontName->SetMinSize( wxSize( 160, -1 ) );
84
85 m_LayersSizer->Add( m_CrtYdFrontName, 0, wxRIGHT | wxEXPAND, 5 );
86
88 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, testing" ),
89 wxDefaultPosition, wxDefaultSize, 0 );
90 m_CrtYdFrontStaticText->Wrap( -1 );
91 m_CrtYdFrontStaticText->SetMinSize( wxSize( 150, -1 ) );
92
93 m_LayersSizer->Add( m_CrtYdFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
94
95 m_FabFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
96 wxDefaultPosition, wxDefaultSize, 0 );
97 m_FabFrontCheckBox->SetToolTip(
98 _( "If you want a fabrication layer for the front side of the board" ) );
99
101 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
102
103 m_FabFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Fab ),
104 wxDefaultPosition, wxDefaultSize, 0 );
105 m_LayersSizer->Add( m_FabFrontName, 0, wxEXPAND | wxRIGHT, 5 );
106
108 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, manufacturing" ),
109 wxDefaultPosition, wxDefaultSize, 0 );
110 m_FabFrontStaticText->Wrap( -1 );
111 m_LayersSizer->Add( m_FabFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
112
113 m_AdhesFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
114 wxDefaultPosition, wxDefaultSize, 0 );
115 m_AdhesFrontCheckBox->SetToolTip(
116 _( "If you want an adhesive template for the front side of the board" ) );
117
119 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
120
121 m_AdhesFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Adhes ),
122 wxDefaultPosition, wxDefaultSize, 0 );
123 m_LayersSizer->Add( m_AdhesFrontName, 0, wxEXPAND | wxRIGHT, 5 );
124
126 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
127 wxDefaultPosition, wxDefaultSize, 0 );
128 m_AdhesFrontStaticText->Wrap( -1 );
129 m_LayersSizer->Add( m_AdhesFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
130
131 m_SoldPFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
132 wxDefaultPosition, wxDefaultSize, 0 );
133 m_SoldPFrontCheckBox->SetToolTip(
134 _( "If you want a solder paste layer for front side of the board" ) );
135
137 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
138
139 m_SoldPFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Paste ),
140 wxDefaultPosition, wxDefaultSize, 0 );
141 m_LayersSizer->Add( m_SoldPFrontName, 0, wxEXPAND | wxRIGHT, 5 );
142
144 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
145 wxDefaultPosition, wxDefaultSize, 0 );
146 m_SoldPFrontStaticText->Wrap( -1 );
147 m_LayersSizer->Add( m_SoldPFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
148
149 m_SilkSFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
150 wxDefaultPosition, wxDefaultSize, 0 );
151 m_SilkSFrontCheckBox->SetToolTip(
152 _( "If you want a silk screen layer for the front side of the board" ) );
153
155 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
156
157 m_SilkSFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_SilkS ),
158 wxDefaultPosition, wxDefaultSize, 0 );
159 m_LayersSizer->Add( m_SilkSFrontName, 0, wxEXPAND | wxRIGHT, 5 );
160
162 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
163 wxDefaultPosition, wxDefaultSize, 0 );
164 m_SilkSFrontStaticText->Wrap( -1 );
165 m_LayersSizer->Add( m_SilkSFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
166
167 m_MaskFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
168 wxDefaultPosition, wxDefaultSize, 0 );
169 m_MaskFrontCheckBox->SetToolTip(
170 _( "If you want a solder mask layer for the front of the board" ) );
171
173 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
174
175 m_MaskFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Mask ),
176 wxDefaultPosition, wxDefaultSize, 0 );
177 m_LayersSizer->Add( m_MaskFrontName, 0, wxEXPAND | wxRIGHT, 5 );
178
180 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
181 wxDefaultPosition, wxDefaultSize, 0 );
182 m_MaskFrontStaticText->Wrap( -1 );
183 m_LayersSizer->Add( m_MaskFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
184
186}
187
188
190{
191 m_MaskBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
192 wxDefaultPosition, wxDefaultSize, 0 );
193 m_MaskBackCheckBox->SetToolTip(
194 _( "If you want a solder mask layer for the back side of the board" ) );
195
197 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
198
199 m_MaskBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Mask ),
200 wxDefaultPosition, wxDefaultSize, 0 );
201 m_LayersSizer->Add( m_MaskBackName, 0, wxEXPAND | wxRIGHT, 5 );
202
204 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
205 wxDefaultPosition, wxDefaultSize, 0 );
206 m_MaskBackStaticText->Wrap( -1 );
207 m_LayersSizer->Add( m_MaskBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
208
209 m_SilkSBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
210 wxDefaultPosition, wxDefaultSize, 0 );
211 m_SilkSBackCheckBox->SetToolTip(
212 _( "If you want a silk screen layer for the back side of the board" ) );
213
215 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
216
217 m_SilkSBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_SilkS ),
218 wxDefaultPosition, wxDefaultSize, 0 );
219 m_LayersSizer->Add( m_SilkSBackName, 0, wxEXPAND | wxRIGHT, 5 );
220
222 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
223 wxDefaultPosition, wxDefaultSize, 0 );
224 m_SilkSBackStaticText->Wrap( -1 );
225 m_LayersSizer->Add( m_SilkSBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
226
227 m_SoldPBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
228 wxDefaultPosition, wxDefaultSize, 0 );
229 m_SoldPBackCheckBox->SetToolTip(
230 _( "If you want a solder paste layer for the back side of the board" ) );
231
233 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
234
235 m_SoldPBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Paste ),
236 wxDefaultPosition, wxDefaultSize, 0 );
237 m_LayersSizer->Add( m_SoldPBackName, 0, wxEXPAND | wxRIGHT, 5 );
238
240 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
241 wxDefaultPosition, wxDefaultSize, 0 );
242 m_SoldPBackStaticText->Wrap( -1 );
243 m_LayersSizer->Add( m_SoldPBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
244
245 m_AdhesBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
246 wxDefaultPosition, wxDefaultSize, 0 );
247 m_AdhesBackCheckBox->SetToolTip(
248 _( "If you want an adhesive layer for the back side of the board" ) );
249
251 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
252
253 m_AdhesBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Adhes ),
254 wxDefaultPosition, wxDefaultSize, 0 );
255 m_LayersSizer->Add( m_AdhesBackName, 0, wxEXPAND | wxRIGHT, 5 );
256
258 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
259 wxDefaultPosition, wxDefaultSize, 0 );
260 m_AdhesBackStaticText->Wrap( -1 );
261 m_LayersSizer->Add( m_AdhesBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
262
263 m_FabBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
264 wxDefaultPosition, wxDefaultSize, 0 );
265 m_FabBackCheckBox->SetToolTip(
266 _( "If you want a fabrication layer for the back side of the board" ) );
267
269 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
270
271 m_FabBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Fab ),
272 wxDefaultPosition, wxDefaultSize, 0 );
273 m_LayersSizer->Add( m_FabBackName, 0, wxEXPAND | wxRIGHT, 5 );
274
276 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, manufacturing" ),
277 wxDefaultPosition, wxDefaultSize, 0 );
278 m_FabBackStaticText->Wrap( -1 );
279 m_LayersSizer->Add( m_FabBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
280
281
282 m_CrtYdBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
283 wxDefaultPosition, wxDefaultSize, 0 );
285 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT
286 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
287 5 );
288
289 m_CrtYdBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_CrtYd ),
290 wxDefaultPosition, wxDefaultSize, 0 );
291 m_LayersSizer->Add( m_CrtYdBackName, 0, wxEXPAND | wxRIGHT, 5 );
292
294 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, testing" ),
295 wxDefaultPosition, wxDefaultSize, 0 );
296 m_CrtYdBackStaticText->Wrap( -1 );
297 m_LayersSizer->Add( m_CrtYdBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5 );
298
299
300 m_PCBEdgesCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
301 wxDefaultPosition, wxDefaultSize, 0 );
303 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT
304 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
305 5 );
306
307 m_PCBEdgesName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Edge_Cuts ),
308 wxDefaultPosition, wxDefaultSize, 0 );
309 m_LayersSizer->Add( m_PCBEdgesName, 0, wxEXPAND | wxRIGHT, 5 );
310
312 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Board contour" ),
313 wxDefaultPosition, wxDefaultSize, 0 );
314 m_PCBEdgesStaticText->Wrap( -1 );
315 m_LayersSizer->Add( m_PCBEdgesStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
316
317 m_MarginCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
318 wxDefaultPosition, wxDefaultSize, 0 );
320 wxLEFT | wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL
321 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
322 5 );
323
324 m_MarginName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Margin ),
325 wxDefaultPosition, wxDefaultSize, 0 );
326 m_LayersSizer->Add( m_MarginName, 0, wxEXPAND | wxRIGHT, 5 );
327
329 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Board contour setback" ),
330 wxDefaultPosition, wxDefaultSize, 0 );
331 m_MarginStaticText->Wrap( -1 );
332 m_LayersSizer->Add( m_MarginStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
333
334 m_Eco1CheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
335 wxDefaultPosition, wxDefaultSize, 0 );
337 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
338
339 m_Eco1Name = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Eco1_User ),
340 wxDefaultPosition, wxDefaultSize, 0 );
341 m_LayersSizer->Add( m_Eco1Name, 0, wxEXPAND | wxRIGHT, 5 );
342
343 m_Eco1StaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
344 wxDefaultPosition, wxDefaultSize, 0 );
345 m_Eco1StaticText->Wrap( -1 );
346 m_LayersSizer->Add( m_Eco1StaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
347
348 m_Eco2CheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
349 wxDefaultPosition, wxDefaultSize, 0 );
351 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
352
353 m_Eco2Name = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Eco2_User ),
354 wxDefaultPosition, wxDefaultSize, 0 );
355 m_LayersSizer->Add( m_Eco2Name, 0, wxEXPAND | wxRIGHT, 5 );
356
357 m_Eco2StaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
358 wxDefaultPosition, wxDefaultSize, 0 );
359 m_Eco2StaticText->Wrap( -1 );
360 m_LayersSizer->Add( m_Eco2StaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
361
362 m_CommentsCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
363 wxDefaultPosition, wxDefaultSize, 0 );
364 m_CommentsCheckBox->SetToolTip( _( "If you want a separate layer for comments or notes" ) );
365
367 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
368
369 m_CommentsName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Cmts_User ),
370 wxDefaultPosition, wxDefaultSize, 0 );
371 m_LayersSizer->Add( m_CommentsName, 0, wxEXPAND | wxRIGHT, 5 );
372
373 m_CommentsStaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
374 wxDefaultPosition, wxDefaultSize, 0 );
375 m_CommentsStaticText->Wrap( -1 );
376 m_LayersSizer->Add( m_CommentsStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
377
378 m_DrawingsCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
379 wxDefaultPosition, wxDefaultSize, 0 );
380 m_DrawingsCheckBox->SetToolTip( _( "If you want a layer for documentation drawings" ) );
381
383 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
384
385 m_DrawingsName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Dwgs_User ),
386 wxDefaultPosition, wxDefaultSize, 0 );
387 m_LayersSizer->Add( m_DrawingsName, 0, wxEXPAND | wxRIGHT, 5 );
388
389 m_DrawingsStaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
390 wxDefaultPosition, wxDefaultSize, 0 );
391 m_DrawingsStaticText->Wrap( -1 );
393 wxALIGN_CENTER_VERTICAL | wxBOTTOM | wxLEFT | wxRIGHT, 5 );
394
398}
399
400
402{
403 Freeze();
404 m_layersControls.clear();
405 m_LayersSizer->Clear( true );
413
414
415 LSET layers = m_enabledLayers;
416
417 for( auto it = layers.copper_layers_begin(); it != layers.copper_layers_end(); ++it )
418 {
419 wxCheckBox* cb = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
420 cb->SetToolTip( _( "Use the Physical Stackup page to change the number of copper layers." ) );
421 cb->Disable();
422
423 m_LayersSizer->Add( cb, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
424
425 wxTextCtrl* txt = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( *it ), wxDefaultPosition, wxDefaultSize, 0 );
426 txt->SetToolTip( _("Layer Name") );
427
428 m_LayersSizer->Add( txt, 0, wxEXPAND|wxRIGHT, 5 );
429
430 wxArrayString choices;
431 choices.Add( _( "signal" ) );
432 choices.Add( _( "power plane" ) );
433 choices.Add( _( "mixed" ) );
434 choices.Add( _( "jumper" ) );
435 wxChoice* choice = new wxChoice( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices, 0 );
436 choice->SetSelection( 0 );
437 choice->SetToolTip( _("Copper layer type for Freerouter and other external routers.\n"
438 "Power plane layers are removed from Freerouter's layer menus.") );
439
440 m_LayersSizer->Add( choice, 0, wxRIGHT|wxEXPAND, 5 );
441 m_layersControls[*it] = PANEL_SETUP_LAYERS_CTLs( txt, cb, choice );
442 }
443
457
458 layers &= LSET::UserDefinedLayersMask();
459
460 for( auto it = layers.non_copper_layers_begin(); it != layers.non_copper_layers_end(); ++it )
461 {
462 append_user_layer( *it );
463 }
464
465 Thaw();
466 m_LayersListPanel->FitInside(); // Updates virtual size to fit subwindows, also auto-layouts.
467}
468
469
471{
472 wxCheckBox* cb = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString, wxDefaultPosition,
473 wxDefaultSize, 0 );
474 m_LayersSizer->Add( cb, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
475
476 wxTextCtrl* txt = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( aLayer ),
477 wxDefaultPosition, wxDefaultSize, 0 );
478 txt->SetToolTip( _( "Layer Name" ) );
479 m_LayersSizer->Add( txt, 0, wxEXPAND | wxRIGHT, 5 );
480
481 wxArrayString choices;
482 choices.Add( _( "Auxiliary" ) );
483 choices.Add( _( "Off-board, front" ) );
484 choices.Add( _( "Off-board, back" ) );
485
486 wxChoice* choice = new wxChoice( m_LayersListPanel, wxID_ANY, wxDefaultPosition,
487 wxDefaultSize, choices, 0 );
488 choice->SetSelection( 0 );
489 choice->SetToolTip(
490 _( "Auxiliary layers do not flip with board side, while back and front layers do." ) );
491
492 m_LayersSizer->Add( choice, 0, wxEXPAND | wxRIGHT, 5 );
493 m_layersControls[aLayer] = PANEL_SETUP_LAYERS_CTLs( txt, cb, choice );
494}
495
496
498{
499 return m_layersControls[aLayer].name;
500}
501
502
504{
505 return m_layersControls[aLayer].checkbox;
506}
507
508
510{
511 return dynamic_cast<wxChoice*>( m_layersControls[aLayer].choice );
512}
513
514
516{
518
519 // Rescue may be enabled, but should not be shown in this dialog
521
523
525
528
531
532 m_initialized = true;
533
534 return true;
535}
536
537
538void PANEL_SETUP_LAYERS::SyncCopperLayers( int aNumCopperLayers )
539{
540 BOARD* savedBoard = m_pcb;
541 BOARD temp;
542
543 m_pcb = &temp;
545
546 for( size_t ii = 0; ii < m_enabledLayers.size(); ii++ )
547 {
548 if( IsCopperLayer( int( ii ) ) )
550 }
551
552 m_enabledLayers |= LSET::AllCuMask( aNumCopperLayers );
553
555 setCopperLayerCheckBoxes( aNumCopperLayers );
556
559
562
563 m_pcb = savedBoard;
564}
565
566
568{
570
571 for( PCB_LAYER_ID layer : layers )
572 setLayerCheckBox( layer, m_pcb->IsLayerEnabled( layer ) );
573}
574
575
577{
578 // Set all the board's layer names into the dialog by calling BOARD::LayerName(),
579 // which will call BOARD::GetStandardLayerName() for non-coppers.
580
581 for( PCB_LAYER_ID layer : m_enabledLayers )
582 {
583 wxControl* ctl = getName( layer );
584
585 if( ctl )
586 {
587 wxString lname = m_pcb->GetLayerName( layer );
588
589 if( auto textCtl = dynamic_cast<wxTextCtrl*>( ctl ) )
590 textCtl->ChangeValue( lname ); // wxTextCtrl
591 else
592 ctl->SetLabel( lname ); // wxStaticText
593 }
594 }
595}
596
597
599{
600 for( auto& [layer,ctl] : m_layersControls )
601 setLayerCheckBox( layer, enabledLayers.test( layer ) );
602}
603
604
606{
608
609 for( PCB_LAYER_ID cu_layer : m_enabledLayers.CuStack() )
610 {
611 wxChoice* ctl = getChoice( cu_layer );
612
613 switch ( m_pcb->GetLayerType( cu_layer ) )
614 {
615 case LT_SIGNAL: ctl->SetSelection( 0 ); break;
616 case LT_POWER: ctl->SetSelection( 1 ); break;
617 case LT_MIXED: ctl->SetSelection( 2 ); break;
618 case LT_JUMPER: ctl->SetSelection( 3 ); break;
619 default: ctl->SetSelection( 0 );
620 }
621
622 }
623
625
626 for( PCB_LAYER_ID layer : layers )
627 {
628 wxChoice* ctl = getChoice( layer );
629
630 switch( m_pcb->GetLayerType( layer ) )
631 {
632 case LT_AUX: ctl->SetSelection( 0 ); break;
633 case LT_FRONT: ctl->SetSelection( 1 ); break;
634 case LT_BACK: ctl->SetSelection( 2 ); break;
635 default: ctl->SetSelection( 0 ); break;
636 }
637 }
638}
639
640
642{
643 LSET layerMaskResult;
644
645 for( auto& [layer, _] : m_layersControls )
646 {
647 wxCheckBox* ctl = getCheckBox( layer );
648
649 if( ctl && ctl->IsChecked() )
650 layerMaskResult.set( layer );
651 }
652
653 return layerMaskResult;
654}
655
656
658{
660
661 if( !ctl.checkbox )
662 return;
663
664 ctl.checkbox->SetValue( isChecked );
665}
666
667
669{
670 if( copperCount > 0 )
671 {
672 wxCheckBox* fcu = getCheckBox( F_Cu );
673 mandatoryLayerCbSetup( *fcu );
674 }
675
676 if( copperCount > 0 )
677 {
678 wxCheckBox* bcu = getCheckBox( B_Cu );
679 mandatoryLayerCbSetup( *bcu );
680 }
681
682 LSET layers = m_enabledLayers & LSET::AllCuMask( copperCount );
683 layers.reset( F_Cu );
684 layers.reset( B_Cu );
685
686 for( PCB_LAYER_ID layer : layers )
687 {
688 wxCheckBox* cb = getCheckBox( layer );
690 }
691
692}
693
694
696{
697 bool modified = false;
698 LSET enabledLayers = GetUILayerMask();
699
700 LSET previousEnabled = m_pcb->GetEnabledLayers();
701
702 if( enabledLayers != previousEnabled )
703 {
704 m_pcb->SetEnabledLayers( enabledLayers );
705
706 LSET changedLayers = enabledLayers ^ previousEnabled;
707
708 /*
709 * Ensure enabled layers are also visible. This is mainly to avoid mistakes if some
710 * enabled layers are not visible when exiting this dialog.
711 */
712 m_pcb->SetVisibleLayers( m_pcb->GetVisibleLayers() | changedLayers );
713
714 /*
715 * Ensure items with through holes have all inner copper layers. (For historical reasons
716 * this is NOT trimmed to the currently-enabled inner layers.)
717 */
718 for( FOOTPRINT* fp : m_pcb->Footprints() )
719 {
720 for( PAD* pad : fp->Pads() )
721 {
722 if( pad->HasHole() && pad->IsOnCopperLayer() )
723 pad->SetLayerSet( pad->GetLayerSet() | LSET::InternalCuMask() );
724 }
725 }
726
727 // Tracks do not change their layer
728 // Vias layers are defined by the starting layer and the ending layer, so
729 // they are not modified by adding a layer.
730 // So do nothing for tracks/vias
731
732 modified = true;
733 }
734
735 for( PCB_LAYER_ID layer : enabledLayers )
736 {
737 wxString newLayerName = getName( layer )->GetValue();
738
739 if( m_pcb->GetLayerName( layer ) != newLayerName )
740 {
741 m_pcb->SetLayerName( layer, newLayerName );
742 modified = true;
743 }
744
745 if( IsCopperLayer( layer ) )
746 {
747 LAYER_T t;
748
749 switch( getChoice( layer )->GetCurrentSelection() )
750 {
751 case 0: t = LT_SIGNAL; break;
752 case 1: t = LT_POWER; break;
753 case 2: t = LT_MIXED; break;
754 case 3: t = LT_JUMPER; break;
755 default: t = LT_UNDEFINED; break;
756 }
757
758 if( m_pcb->GetLayerType( layer ) != t )
759 {
760 m_pcb->SetLayerType( layer, t );
761 modified = true;
762 }
763 }
764 else if( layer >= User_1 && !IsCopperLayer( layer ) )
765 {
766 LAYER_T t;
767
768 switch( getChoice( layer )->GetCurrentSelection() )
769 {
770 case 0: t = LT_AUX; break;
771 case 1: t = LT_FRONT; break;
772 case 2: t = LT_BACK; break;
773 default: t = LT_UNDEFINED; break;
774 }
775
776 if( m_pcb->GetLayerType( layer ) != t )
777 {
778 m_pcb->SetLayerType( layer, t );
779 modified = true;
780 }
781 }
782 }
783
784 LSET layers = enabledLayers & LSET::UserDefinedLayersMask();
785
786 for( PCB_LAYER_ID layer : layers )
787 {
788 wxString newLayerName = getName( layer )->GetValue();
789
790 if( m_pcb->GetLayerName( layer ) != newLayerName )
791 {
792 m_pcb->SetLayerName( layer, newLayerName );
793 modified = true;
794 }
795 }
796
797 return modified;
798}
799
800
802{
803 if( !testLayerNames() )
804 return false;
805
806 // Make sure we have the latest copper layer count
809
810 wxString msg;
811 bool modified = false;
812 wxWindow* parent = wxGetTopLevelParent( this );
813
814 // Check for removed layers with items which will get deleted from the board.
815 LSEQ removedLayers = getRemovedLayersWithItems();
816
817 // Check for non-copper layers in use in footprints, and therefore not removable.
818 LSEQ notremovableLayers = getNonRemovableLayers();
819
820 if( !notremovableLayers.empty() )
821 {
822 for( PCB_LAYER_ID layer : notremovableLayers )
823 msg << m_pcb->GetLayerName( layer ) << wxT( "\n" );
824
825 if( !IsOK( parent, wxString::Format( _( "Footprints have some items on removed layers:\n"
826 "%s\n"
827 "These items will be no longer accessible\n"
828 "Do you wish to continue?" ),
829 msg ) ) )
830 {
831 return false;
832 }
833 }
834
835 if( !removedLayers.empty() )
836 {
837 if( !IsOK( parent, _( "Items have been found on removed layers. This operation will "
838 "delete all items from removed layers and cannot be undone.\n"
839 "Do you wish to continue?" ) ) )
840 {
841 return false;
842 }
843 }
844
845 // Delete all objects on layers that have been removed. Leaving them in copper layers
846 // can (will?) result in DRC errors and it pollutes the board file with cruft.
847 bool hasRemovedBoardItems = false;
848
849 if( !removedLayers.empty() )
850 {
852
853 PCB_LAYER_COLLECTOR collector;
854
855 for( PCB_LAYER_ID layer_id : removedLayers )
856 {
857 collector.SetLayerId( layer_id );
859
860 // Bye-bye items on removed layer.
861 for( int i = 0; i < collector.GetCount(); i++ )
862 {
863 BOARD_ITEM* item = collector[i];
864
865 // Do not remove/change an item owned by a footprint
866 if( item->GetParentFootprint() )
867 continue;
868
869 // Do not remove footprints
870 if( item->Type() == PCB_FOOTPRINT_T )
871 continue;
872
873 // Vias are also specific
874 // Note: vias are specific. They are only on copper layers, and
875 // do not use a layer set, only store the copper top and the copper bottom.
876 // So reinit the layer set does not work with vias
877 if( item->Type() == PCB_VIA_T )
878 {
879 PCB_VIA* via = static_cast<PCB_VIA*>( item );
880
881 if( via->GetViaType() == VIATYPE::THROUGH )
882 continue;
883 else
884 {
885 PCB_LAYER_ID top_layer;
886 PCB_LAYER_ID bottom_layer;
887 via->LayerPair( &top_layer, &bottom_layer );
888
889 if( top_layer != layer_id && bottom_layer != layer_id )
890 continue;
891 }
892 // blind/buried vias with a top or bottom layer on a removed layer
893 // are removed. Perhaps one could just modify the top/bottom layer,
894 // but I am not sure this is better.
895 m_pcb->Remove( item );
896 delete item;
897 }
898 else
899 {
900 LSET layers = item->GetLayerSet();
901
902 layers.reset( layer_id );
903 hasRemovedBoardItems = true;
904 modified = true;
905
906 if( layers.any() )
907 {
908 item->SetLayerSet( layers );
909 }
910 else
911 {
912 m_pcb->Remove( item );
913 delete item;
914 }
915 }
916 }
917 }
918
919 // Undo state may have copies of pointers deleted above
921 }
922
923 modified |= transferDataFromWindow();
924
925 // If some board items are deleted: Rebuild the connectivity, because it is likely some
926 // tracks and vias were removed
927 if( hasRemovedBoardItems )
929
930 if( modified )
931 m_frame->OnModify();
932
933 return true;
934}
935
936
938{
939 std::vector<wxString> names;
940 wxTextCtrl* ctl;
941
942 for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
943 {
944 // we _can_ rely on m_enabledLayers being current here:
945
946 if( !m_enabledLayers[layer] )
947 continue;
948
949 ctl = (wxTextCtrl*) getName( layer );
950 wxString name = ctl->GetValue();
951
952 // Check name for legality:
953 // 1) Cannot be blank.
954 // 2) Cannot have blanks.
955 // 3) Cannot have " chars
956 // 4) Cannot be 'signal'
957 // 5) Must be unique.
958 // 6) Cannot have illegal chars in filenames ( some filenames are built from layer names )
959 // like : % $ \ " / :
960 wxString badchars = wxFileName::GetForbiddenChars( wxPATH_DOS );
961 badchars.Append( '%' );
962
963 if( !name )
964 {
965 PAGED_DIALOG::GetDialog( this )->SetError( _( "Layer must have a name." ), this, ctl );
966 return false;
967 }
968
969 if( name.find_first_of( badchars ) != wxString::npos )
970 {
971 wxString msg = wxString::Format(_( "%s are forbidden in layer names." ), badchars );
972 PAGED_DIALOG::GetDialog( this )->SetError( msg, this, ctl );
973 return false;
974 }
975
976 if( name == wxT( "signal" ) )
977 {
978 PAGED_DIALOG::GetDialog( this )->SetError( _( "Layer name \"signal\" is reserved." ),
979 this, ctl );
980 return false;
981 }
982
983 for( const wxString& existingName : names )
984 {
985 if( name == existingName )
986 {
987 wxString msg = wxString::Format(_( "Layer name '%s' already in use." ), name );
988 PAGED_DIALOG::GetDialog( this )->SetError( msg, this, ctl );
989 return false;
990 }
991 }
992
993 names.push_back( name );
994 }
995
996 return true;
997}
998
999
1001{
1002 LSEQ removedLayers;
1003 LSET newLayers = GetUILayerMask();
1004 LSET curLayers = m_pcb->GetEnabledLayers();
1005
1006 if( newLayers == curLayers ) // Return an empty list if no change
1007 return removedLayers;
1008
1009 PCB_LAYER_COLLECTOR collector;
1010 LSEQ newLayerSeq = newLayers.Seq();
1011
1012 for( PCB_LAYER_ID layer_id : curLayers )
1013 {
1014 if( !newLayers[layer_id] )
1015 {
1016 collector.SetLayerId( layer_id );
1018
1019 if( collector.GetCount() != 0 )
1020 {
1021 // Skip items owned by footprints and footprints when building
1022 // the actual list of removed layers: these items are not removed
1023 for( int i = 0; i < collector.GetCount(); i++ )
1024 {
1025 BOARD_ITEM* item = collector[i];
1026
1027 if( item->Type() == PCB_FOOTPRINT_T || item->GetParentFootprint() )
1028 continue;
1029
1030 // Vias are on multiple adjacent layers, but only the top and
1031 // the bottom layers are stored. So there are issues only if one
1032 // is on a removed layer
1033 if( item->Type() == PCB_VIA_T )
1034 {
1035 PCB_VIA* via = static_cast<PCB_VIA*>( item );
1036
1037 if( via->GetViaType() == VIATYPE::THROUGH )
1038 continue;
1039 else
1040 {
1041 PCB_LAYER_ID top_layer;
1042 PCB_LAYER_ID bottom_layer;
1043 via->LayerPair( &top_layer, &bottom_layer );
1044
1045 if( top_layer != layer_id && bottom_layer != layer_id )
1046 continue;
1047 }
1048 }
1049
1050 removedLayers.push_back( layer_id );
1051 break;
1052 }
1053 }
1054 }
1055 }
1056
1057 return removedLayers;
1058}
1059
1060
1062{
1063 // Build the list of non-copper layers in use in footprints.
1064 LSEQ inUseLayers;
1065 LSET newLayers = GetUILayerMask();
1066 LSET curLayers = m_pcb->GetEnabledLayers();
1067
1068 if( newLayers == curLayers ) // Return an empty list if no change
1069 return inUseLayers;
1070
1071 PCB_LAYER_COLLECTOR collector;
1072 LSEQ newLayerSeq = newLayers.Seq();
1073
1074 for( PCB_LAYER_ID layer_id : curLayers.Seq() )
1075 {
1076 if( IsCopperLayer( layer_id ) ) // Copper layers are not taken into account here
1077 continue;
1078
1079 if( !alg::contains( newLayerSeq, layer_id ) )
1080 {
1081 collector.SetLayerId( layer_id );
1083
1084 if( collector.GetCount() != 0 )
1085 inUseLayers.push_back( layer_id );
1086 }
1087 }
1088
1089 return inUseLayers;
1090}
1091
1092
1094{
1095 BOARD* savedBoard = m_pcb;
1096
1097 m_pcb = aBoard;
1099
1100 m_pcb = savedBoard;
1101}
1102
1103
1104bool PANEL_SETUP_LAYERS::CheckCopperLayerCount( BOARD* aWorkingBoard, BOARD* aImportedBoard )
1105{
1106 /*
1107 * This function warns users if they are going to delete inner copper layers because
1108 * they're importing settings from a board with less copper layers than the board
1109 * already loaded. We want to return "true" as default on the assumption no layer will
1110 * actually be deleted.
1111 */
1112 bool okToDeleteCopperLayers = true;
1113
1114 // Get the number of copper layers in the loaded board and the "import settings" board
1115 int currNumLayers = aWorkingBoard->GetCopperLayerCount();
1116 int newNumLayers = aImportedBoard->GetCopperLayerCount();
1117
1118 if( newNumLayers < currNumLayers )
1119 {
1120 wxString msg = wxString::Format( _( "Imported settings have fewer copper layers than "
1121 "the current board (%i instead of %i).\n\n"
1122 "Continue and delete the extra inner copper layers "
1123 "from the current board?" ),
1124 newNumLayers,
1125 currNumLayers );
1126
1127 wxWindow* topLevelParent = wxGetTopLevelParent( this );
1128
1129 wxMessageDialog dlg( topLevelParent, msg, _( "Inner Layers to Be Deleted" ),
1130 wxICON_WARNING | wxSTAY_ON_TOP | wxYES | wxNO | wxNO_DEFAULT );
1131
1132 if( wxID_ANY == dlg.ShowModal() )
1133 okToDeleteCopperLayers = false;
1134 }
1135
1136 return okToDeleteCopperLayers;
1137}
1138
1139
1140void PANEL_SETUP_LAYERS::addUserDefinedLayer( wxCommandEvent& aEvent )
1141{
1142 wxArrayString headers;
1143 headers.Add( _( "Layers" ) );
1144
1145 // Build the available user-defined layers list:
1146 std::vector<wxArrayString> list;
1147
1148 for( PCB_LAYER_ID layer : LSET::UserDefinedLayersMask().Seq() )
1149 {
1150 wxCheckBox* checkBox = getCheckBox( layer );
1151
1152 if( checkBox && checkBox->IsShown() )
1153 continue;
1154
1155 wxArrayString available_user_layer;
1156 available_user_layer.Add( LayerName( layer ) );
1157
1158 list.emplace_back( available_user_layer );
1159 }
1160
1161 if( list.empty() )
1162 {
1164 _( "All user-defined layers have already been added." ) );
1165 return;
1166 }
1167
1168 EDA_LIST_DIALOG dlg( PAGED_DIALOG::GetDialog( this ), _( "Add User-defined Layer" ),
1169 headers, list );
1170 dlg.SetListLabel( _( "Select layer to add:" ) );
1171 dlg.HideFilter();
1172
1173 if( dlg.ShowModal() == wxID_ANY || dlg.GetTextSelection().IsEmpty() )
1174 return;
1175
1177
1178 for( PCB_LAYER_ID layer2 : LSET::UserDefinedLayersMask().Seq() )
1179 {
1180 if( LayerName( layer2 ) == dlg.GetTextSelection() )
1181 {
1182 layer = layer2;
1183 break;
1184 }
1185 }
1186
1187 wxCHECK( layer >= User_1, /* void */ );
1188
1189 m_enabledLayers.set( layer );
1190 append_user_layer( layer );
1191
1193
1194 // All user-defined layers should have a checkbox
1195 wxASSERT( ctl.checkbox );
1196 ctl.checkbox->SetValue( true );
1197
1198 wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( ctl.name );
1199
1200 wxCHECK( textCtrl, /* void */ );
1201 textCtrl->ChangeValue( LSET::Name( layer ) );
1202
1203 wxChoice* userLayerType = dynamic_cast<wxChoice*>( ctl.choice );
1204
1205 wxCHECK( userLayerType, /* void */ );
1206 userLayerType->SetSelection( 0 );
1207
1208 ctl.name->Show( true );
1209 ctl.checkbox->Show( true );
1210 ctl.choice->Show( true );
1211
1212 wxSizeEvent evt_size( m_LayersListPanel->GetSize() );
1213 m_LayersListPanel->GetEventHandler()->ProcessEvent( evt_size );
1214}
1215
1216
const char * name
Definition: DXF_plotter.cpp:59
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
Definition: board.h:160
@ LT_POWER
Definition: board.h:163
@ LT_FRONT
Definition: board.h:167
@ LT_MIXED
Definition: board.h:164
@ LT_BACK
Definition: board.h:168
@ LT_UNDEFINED
Definition: board.h:161
@ LT_JUMPER
Definition: board.h:165
@ LT_AUX
Definition: board.h:166
@ LT_SIGNAL
Definition: board.h:162
BASE_SET & reset(size_t pos)
Definition: base_set.h:143
BASE_SET & set(size_t pos)
Definition: base_set.h:116
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:78
virtual void SetLayerSet(const LSET &aLayers)
Definition: board_item.h:263
FOOTPRINT * GetParentFootprint() const
Definition: board_item.cpp:305
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:255
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:297
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:829
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:843
void SetVisibleLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition: board.cpp:861
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
Definition: board.cpp:185
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition: board.cpp:855
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
Definition: board.cpp:652
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition: board.cpp:632
int GetCopperLayerCount() const
Definition: board.cpp:781
const FOOTPRINTS & Footprints() const
Definition: board.h:338
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
Definition: board.cpp:671
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:614
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: board.cpp:1213
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:849
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:82
int ShowModal() override
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:107
A dialog which shows:
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
void SetListLabel(const wxString &aLabel)
static const std::vector< KICAD_T > BoardLevelItems
A scan list for all primary board items, omitting items which are subordinate to a FOOTPRINT,...
Definition: collectors.h:233
static const std::vector< KICAD_T > FootprintItems
A scan list for primary footprint items.
Definition: collectors.h:248
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: lseq.h:47
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:37
copper_layers_iterator copper_layers_end() const
Definition: lset.cpp:891
static LSET AllLayersMask()
Definition: lset.cpp:601
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
Definition: lset.cpp:247
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Definition: lset.cpp:561
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:572
copper_layers_iterator copper_layers_begin() const
Definition: lset.cpp:885
non_copper_layers_iterator non_copper_layers_begin() const
Definition: lset.cpp:897
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:297
non_copper_layers_iterator non_copper_layers_end() const
Definition: lset.cpp:903
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
Definition: lset.cpp:665
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition: lset.cpp:188
Definition: pad.h:54
static PAGED_DIALOG * GetDialog(wxWindow *aWindow)
void SetError(const wxString &aMessage, const wxString &aPageName, int aCtrlId, int aRow=-1, int aCol=-1)
Class PANEL_SETUP_LAYERS_BASE.
wxScrolledWindow * m_LayersListPanel
wxStaticText * m_CrtYdBackStaticText
wxStaticText * m_CrtYdFrontStaticText
wxCheckBox * m_SoldPBackCheckBox
wxStaticText * m_PCBEdgesStaticText
wxTextCtrl * m_FabBackName
wxStaticText * m_FabBackStaticText
wxTextCtrl * m_PCBEdgesName
wxTextCtrl * m_DrawingsName
wxStaticText * m_MarginStaticText
void append_user_layer(PCB_LAYER_ID aLayer)
wxCheckBox * m_AdhesBackCheckBox
wxTextCtrl * getName(PCB_LAYER_ID aLayer)
wxStaticText * m_Eco2StaticText
void showSelectedLayerCheckBoxes(const LSET &enableLayerMask)
bool CheckCopperLayerCount(BOARD *aWorkingBoard, BOARD *aImportedBoard)
Check and warn if inner copper layers will be deleted.
wxTextCtrl * m_CrtYdBackName
wxStaticText * m_AdhesFrontStaticText
wxTextCtrl * m_MaskFrontName
wxCheckBox * m_Eco1CheckBox
wxCheckBox * m_CrtYdFrontCheckBox
wxCheckBox * m_FabFrontCheckBox
bool TransferDataToWindow() override
wxTextCtrl * m_AdhesFrontName
wxCheckBox * getCheckBox(PCB_LAYER_ID aLayer)
wxCheckBox * m_MaskFrontCheckBox
void setLayerCheckBox(PCB_LAYER_ID layer, bool isChecked)
virtual void addUserDefinedLayer(wxCommandEvent &aEvent) override
wxCheckBox * m_SilkSBackCheckBox
void SyncCopperLayers(int aNumCopperLayers)
Called when switching to this tab to make sure that any changes to the copper layer count made on the...
wxStaticText * m_AdhesBackStaticText
wxTextCtrl * m_CrtYdFrontName
std::map< PCB_LAYER_ID, PANEL_SETUP_LAYERS_CTLs > m_layersControls
wxTextCtrl * m_MaskBackName
wxStaticText * m_Eco1StaticText
PANEL_SETUP_BOARD_STACKUP * m_physicalStackup
wxTextCtrl * m_AdhesBackName
wxCheckBox * m_MaskBackCheckBox
wxCheckBox * m_SoldPFrontCheckBox
wxStaticText * m_CommentsStaticText
PCB_EDIT_FRAME * m_frame
wxCheckBox * m_PCBEdgesCheckBox
wxStaticText * m_FabFrontStaticText
wxStaticText * m_MaskFrontStaticText
LSEQ getNonRemovableLayers()
Return a list of layers in use in footprints, and therefore not removable.
wxStaticText * m_SilkSFrontStaticText
wxCheckBox * m_MarginCheckBox
wxStaticText * m_SoldPBackStaticText
wxCheckBox * m_SilkSFrontCheckBox
wxStaticText * m_MaskBackStaticText
void setCopperLayerCheckBoxes(int copperCount)
wxCheckBox * m_CrtYdBackCheckBox
wxCheckBox * m_CommentsCheckBox
wxCheckBox * m_FabBackCheckBox
wxTextCtrl * m_SoldPFrontName
wxTextCtrl * m_SilkSBackName
wxTextCtrl * m_SoldPBackName
wxStaticText * m_SilkSBackStaticText
wxTextCtrl * m_SilkSFrontName
wxCheckBox * m_Eco2CheckBox
wxCheckBox * m_AdhesFrontCheckBox
wxChoice * getChoice(PCB_LAYER_ID aLayer)
wxStaticText * m_SoldPFrontStaticText
LSEQ getRemovedLayersWithItems()
Return a list of layers removed from the board that contain items.
wxCheckBox * m_DrawingsCheckBox
wxStaticText * m_DrawingsStaticText
bool TransferDataFromWindow() override
PANEL_SETUP_LAYERS(wxWindow *aParentWindow, PCB_EDIT_FRAME *aFrame)
void ImportSettingsFrom(BOARD *aBoard)
wxTextCtrl * m_CommentsName
wxTextCtrl * m_FabFrontName
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:69
BOARD * GetBoard() const
The main frame for Pcbnew.
void OnModify() override
Must be called after a board change to set the modified flag.
Collect all BOARD_ITEM objects on a given layer.
Definition: collectors.h:539
void Collect(BOARD_ITEM *aBoard, const std::vector< KICAD_T > &aTypes)
Test a BOARD_ITEM using this class's Inspector method, which does the collection.
Definition: collectors.cpp:536
void SetLayerId(PCB_LAYER_ID aLayerId)
Definition: collectors.h:545
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:150
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:249
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:194
This file is part of the common library.
#define _(s)
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
Definition: layer_id.cpp:31
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
Definition: layer_ids.h:663
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ F_CrtYd
Definition: layer_ids.h:116
@ B_Adhes
Definition: layer_ids.h:103
@ Edge_Cuts
Definition: layer_ids.h:112
@ Dwgs_User
Definition: layer_ids.h:107
@ F_Paste
Definition: layer_ids.h:104
@ Cmts_User
Definition: layer_ids.h:108
@ F_Adhes
Definition: layer_ids.h:102
@ B_Mask
Definition: layer_ids.h:98
@ B_Cu
Definition: layer_ids.h:65
@ Eco1_User
Definition: layer_ids.h:109
@ F_Mask
Definition: layer_ids.h:97
@ B_Paste
Definition: layer_ids.h:105
@ F_Fab
Definition: layer_ids.h:119
@ Margin
Definition: layer_ids.h:113
@ F_SilkS
Definition: layer_ids.h:100
@ B_CrtYd
Definition: layer_ids.h:115
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
@ Eco2_User
Definition: layer_ids.h:110
@ Rescue
Definition: layer_ids.h:121
@ User_1
Definition: layer_ids.h:124
@ B_SilkS
Definition: layer_ids.h:101
@ F_Cu
Definition: layer_ids.h:64
@ B_Fab
Definition: layer_ids.h:118
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:100
static void mandatoryLayerCbSetup(wxCheckBox &aCheckBox)
Configure a layer checkbox to be mandatory and disabled.
std::deque< BOARD_ITEM * > GetCurrentSelection()
Get the list of selected objects.
The 3 UI control pointers for a single board layer.
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86