KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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, [email protected]
5 * Copyright (C) 2009 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
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, see <https://www.gnu.org/licenses/>.
20 */
21
22
23#include <confirm.h>
24#include <core/arraydim.h>
25#include <core/kicad_algo.h>
26#include <pcb_edit_frame.h>
27#include <tool/tool_manager.h>
28#include <tools/pcb_actions.h>
29#include <board.h>
30#include <collectors.h>
31#include <footprint.h>
32#include <layer_ids.h>
33#include <pad.h>
34#include <pcb_track.h>
35#include <panel_setup_layers.h>
38
39#include <wx/choicdlg.h>
40#include <wx/msgdlg.h>
41#include <eda_list_dialog.h>
42
43#include <list>
44#include <set>
45
46
50static void mandatoryLayerCbSetup( wxCheckBox& aCheckBox )
51{
52 aCheckBox.Show();
53 aCheckBox.Disable();
54 aCheckBox.SetValue( true );
55 aCheckBox.SetToolTip( _( "This layer is required and cannot be disabled" ) );
56}
57
58
59PANEL_SETUP_LAYERS::PANEL_SETUP_LAYERS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame ) :
60 PANEL_SETUP_LAYERS_BASE( aParentWindow ),
61 m_frame( aFrame ),
62 m_physicalStackup( nullptr ),
63 m_initialized( false ),
64 m_CrtYdFrontCheckBox( nullptr ),
65 m_CrtYdFrontName( nullptr ),
66 m_CrtYdFrontStaticText( nullptr ),
67 m_FabFrontCheckBox( nullptr ),
68 m_FabFrontName( nullptr ),
69 m_FabFrontStaticText( nullptr ),
70 m_AdhesFrontCheckBox( nullptr ),
71 m_AdhesFrontName( nullptr ),
72 m_AdhesFrontStaticText( nullptr ),
73 m_SoldPFrontCheckBox( nullptr ),
74 m_SoldPFrontName( nullptr ),
75 m_SoldPFrontStaticText( nullptr ),
76 m_SilkSFrontCheckBox( nullptr ),
77 m_SilkSFrontName( nullptr ),
78 m_SilkSFrontStaticText( nullptr ),
79 m_MaskFrontCheckBox( nullptr ),
80 m_MaskFrontName( nullptr ),
81 m_MaskFrontStaticText( nullptr ),
82 m_MaskBackCheckBox( nullptr ),
83 m_MaskBackName( nullptr ),
84 m_MaskBackStaticText( nullptr ),
85 m_SilkSBackCheckBox( nullptr ),
86 m_SilkSBackName( nullptr ),
87 m_SilkSBackStaticText( nullptr ),
88 m_SoldPBackCheckBox( nullptr ),
89 m_SoldPBackName( nullptr ),
90 m_SoldPBackStaticText( nullptr ),
91 m_AdhesBackCheckBox( nullptr ),
92 m_AdhesBackName( nullptr ),
93 m_AdhesBackStaticText( nullptr ),
94 m_FabBackCheckBox( nullptr ),
95 m_FabBackName( nullptr ),
96 m_FabBackStaticText( nullptr ),
97 m_CrtYdBackCheckBox( nullptr ),
98 m_CrtYdBackName( nullptr ),
99 m_CrtYdBackStaticText( nullptr ),
100 m_PCBEdgesCheckBox( nullptr ),
101 m_PCBEdgesName( nullptr ),
102 m_PCBEdgesStaticText( nullptr ),
103 m_MarginCheckBox( nullptr ),
104 m_MarginName( nullptr ),
105 m_MarginStaticText( nullptr ),
106 m_Eco1CheckBox( nullptr ),
107 m_Eco1Name( nullptr ),
108 m_Eco1StaticText( nullptr ),
109 m_Eco2CheckBox( nullptr ),
110 m_Eco2Name( nullptr ),
111 m_Eco2StaticText( nullptr ),
112 m_CommentsCheckBox( nullptr ),
113 m_CommentsName( nullptr ),
114 m_CommentsStaticText( nullptr ),
115 m_DrawingsCheckBox( nullptr ),
116 m_DrawingsName( nullptr ),
117 m_DrawingsStaticText( nullptr )
118{
119 m_pcb = aFrame->GetBoard();
120}
121
122
124{
125 m_CrtYdFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
126 wxDefaultPosition, wxDefaultSize, 0 );
128 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT
129 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
130 5 );
131
132 m_CrtYdFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_CrtYd ),
133 wxDefaultPosition, wxDefaultSize, 0 );
134 m_CrtYdFrontName->SetMinSize( wxSize( 160, -1 ) );
135
136 m_LayersSizer->Add( m_CrtYdFrontName, 0, wxRIGHT | wxEXPAND, 5 );
137
139 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, testing" ),
140 wxDefaultPosition, wxDefaultSize, 0 );
141 m_CrtYdFrontStaticText->Wrap( -1 );
142 m_CrtYdFrontStaticText->SetMinSize( wxSize( 150, -1 ) );
143
144 m_LayersSizer->Add( m_CrtYdFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
145
146 m_FabFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
147 wxDefaultPosition, wxDefaultSize, 0 );
148 m_FabFrontCheckBox->SetToolTip(
149 _( "If you want a fabrication layer for the front side of the board" ) );
150
152 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
153
154 m_FabFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Fab ),
155 wxDefaultPosition, wxDefaultSize, 0 );
156 m_LayersSizer->Add( m_FabFrontName, 0, wxEXPAND | wxRIGHT, 5 );
157
159 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, manufacturing" ),
160 wxDefaultPosition, wxDefaultSize, 0 );
161 m_FabFrontStaticText->Wrap( -1 );
162 m_LayersSizer->Add( m_FabFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
163
164 m_AdhesFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
165 wxDefaultPosition, wxDefaultSize, 0 );
166 m_AdhesFrontCheckBox->SetToolTip(
167 _( "If you want an adhesive template for the front side of the board" ) );
168
170 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
171
172 m_AdhesFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Adhes ),
173 wxDefaultPosition, wxDefaultSize, 0 );
174 m_LayersSizer->Add( m_AdhesFrontName, 0, wxEXPAND | wxRIGHT, 5 );
175
177 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
178 wxDefaultPosition, wxDefaultSize, 0 );
179 m_AdhesFrontStaticText->Wrap( -1 );
180 m_LayersSizer->Add( m_AdhesFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
181
182 m_SoldPFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
183 wxDefaultPosition, wxDefaultSize, 0 );
184 m_SoldPFrontCheckBox->SetToolTip(
185 _( "If you want a solder paste layer for front side of the board" ) );
186
188 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
189
190 m_SoldPFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Paste ),
191 wxDefaultPosition, wxDefaultSize, 0 );
192 m_LayersSizer->Add( m_SoldPFrontName, 0, wxEXPAND | wxRIGHT, 5 );
193
195 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
196 wxDefaultPosition, wxDefaultSize, 0 );
197 m_SoldPFrontStaticText->Wrap( -1 );
198 m_LayersSizer->Add( m_SoldPFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
199
200 m_SilkSFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
201 wxDefaultPosition, wxDefaultSize, 0 );
202 m_SilkSFrontCheckBox->SetToolTip(
203 _( "If you want a silk screen layer for the front side of the board" ) );
204
206 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
207
208 m_SilkSFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_SilkS ),
209 wxDefaultPosition, wxDefaultSize, 0 );
210 m_LayersSizer->Add( m_SilkSFrontName, 0, wxEXPAND | wxRIGHT, 5 );
211
213 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
214 wxDefaultPosition, wxDefaultSize, 0 );
215 m_SilkSFrontStaticText->Wrap( -1 );
216 m_LayersSizer->Add( m_SilkSFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
217
218 m_MaskFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
219 wxDefaultPosition, wxDefaultSize, 0 );
220 m_MaskFrontCheckBox->SetToolTip(
221 _( "If you want a solder mask layer for the front of the board" ) );
222
224 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
225
226 m_MaskFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Mask ),
227 wxDefaultPosition, wxDefaultSize, 0 );
228 m_LayersSizer->Add( m_MaskFrontName, 0, wxEXPAND | wxRIGHT, 5 );
229
231 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
232 wxDefaultPosition, wxDefaultSize, 0 );
233 m_MaskFrontStaticText->Wrap( -1 );
234 m_LayersSizer->Add( m_MaskFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
235
237}
238
239
241{
242 m_MaskBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
243 wxDefaultPosition, wxDefaultSize, 0 );
244 m_MaskBackCheckBox->SetToolTip(
245 _( "If you want a solder mask layer for the back side of the board" ) );
246
248 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
249
250 m_MaskBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Mask ),
251 wxDefaultPosition, wxDefaultSize, 0 );
252 m_LayersSizer->Add( m_MaskBackName, 0, wxEXPAND | wxRIGHT, 5 );
253
255 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
256 wxDefaultPosition, wxDefaultSize, 0 );
257 m_MaskBackStaticText->Wrap( -1 );
258 m_LayersSizer->Add( m_MaskBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
259
260 m_SilkSBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
261 wxDefaultPosition, wxDefaultSize, 0 );
262 m_SilkSBackCheckBox->SetToolTip(
263 _( "If you want a silk screen layer for the back side of the board" ) );
264
266 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
267
268 m_SilkSBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_SilkS ),
269 wxDefaultPosition, wxDefaultSize, 0 );
270 m_LayersSizer->Add( m_SilkSBackName, 0, wxEXPAND | wxRIGHT, 5 );
271
273 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
274 wxDefaultPosition, wxDefaultSize, 0 );
275 m_SilkSBackStaticText->Wrap( -1 );
276 m_LayersSizer->Add( m_SilkSBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
277
278 m_SoldPBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
279 wxDefaultPosition, wxDefaultSize, 0 );
280 m_SoldPBackCheckBox->SetToolTip(
281 _( "If you want a solder paste layer for the back side of the board" ) );
282
284 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
285
286 m_SoldPBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Paste ),
287 wxDefaultPosition, wxDefaultSize, 0 );
288 m_LayersSizer->Add( m_SoldPBackName, 0, wxEXPAND | wxRIGHT, 5 );
289
291 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
292 wxDefaultPosition, wxDefaultSize, 0 );
293 m_SoldPBackStaticText->Wrap( -1 );
294 m_LayersSizer->Add( m_SoldPBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
295
296 m_AdhesBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
297 wxDefaultPosition, wxDefaultSize, 0 );
298 m_AdhesBackCheckBox->SetToolTip(
299 _( "If you want an adhesive layer for the back side of the board" ) );
300
302 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
303
304 m_AdhesBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Adhes ),
305 wxDefaultPosition, wxDefaultSize, 0 );
306 m_LayersSizer->Add( m_AdhesBackName, 0, wxEXPAND | wxRIGHT, 5 );
307
309 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
310 wxDefaultPosition, wxDefaultSize, 0 );
311 m_AdhesBackStaticText->Wrap( -1 );
312 m_LayersSizer->Add( m_AdhesBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
313
314 m_FabBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
315 wxDefaultPosition, wxDefaultSize, 0 );
316 m_FabBackCheckBox->SetToolTip(
317 _( "If you want a fabrication layer for the back side of the board" ) );
318
320 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
321
322 m_FabBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Fab ),
323 wxDefaultPosition, wxDefaultSize, 0 );
324 m_LayersSizer->Add( m_FabBackName, 0, wxEXPAND | wxRIGHT, 5 );
325
327 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, manufacturing" ),
328 wxDefaultPosition, wxDefaultSize, 0 );
329 m_FabBackStaticText->Wrap( -1 );
330 m_LayersSizer->Add( m_FabBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
331
332
333 m_CrtYdBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
334 wxDefaultPosition, wxDefaultSize, 0 );
336 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT
337 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
338 5 );
339
340 m_CrtYdBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_CrtYd ),
341 wxDefaultPosition, wxDefaultSize, 0 );
342 m_LayersSizer->Add( m_CrtYdBackName, 0, wxEXPAND | wxRIGHT, 5 );
343
345 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, testing" ),
346 wxDefaultPosition, wxDefaultSize, 0 );
347 m_CrtYdBackStaticText->Wrap( -1 );
348 m_LayersSizer->Add( m_CrtYdBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5 );
349
350
351 m_PCBEdgesCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
352 wxDefaultPosition, wxDefaultSize, 0 );
354 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT
355 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
356 5 );
357
358 m_PCBEdgesName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Edge_Cuts ),
359 wxDefaultPosition, wxDefaultSize, 0 );
360 m_LayersSizer->Add( m_PCBEdgesName, 0, wxEXPAND | wxRIGHT, 5 );
361
363 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Board contour" ),
364 wxDefaultPosition, wxDefaultSize, 0 );
365 m_PCBEdgesStaticText->Wrap( -1 );
366 m_LayersSizer->Add( m_PCBEdgesStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
367
368 m_MarginCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
369 wxDefaultPosition, wxDefaultSize, 0 );
371 wxLEFT | wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL
372 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
373 5 );
374
375 m_MarginName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Margin ),
376 wxDefaultPosition, wxDefaultSize, 0 );
377 m_LayersSizer->Add( m_MarginName, 0, wxEXPAND | wxRIGHT, 5 );
378
380 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Board contour setback" ),
381 wxDefaultPosition, wxDefaultSize, 0 );
382 m_MarginStaticText->Wrap( -1 );
383 m_LayersSizer->Add( m_MarginStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
384
385 m_Eco1CheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
386 wxDefaultPosition, wxDefaultSize, 0 );
388 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
389
390 m_Eco1Name = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Eco1_User ),
391 wxDefaultPosition, wxDefaultSize, 0 );
392 m_LayersSizer->Add( m_Eco1Name, 0, wxEXPAND | wxRIGHT, 5 );
393
394 m_Eco1StaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
395 wxDefaultPosition, wxDefaultSize, 0 );
396 m_Eco1StaticText->Wrap( -1 );
397 m_LayersSizer->Add( m_Eco1StaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
398
399 m_Eco2CheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
400 wxDefaultPosition, wxDefaultSize, 0 );
402 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
403
404 m_Eco2Name = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Eco2_User ),
405 wxDefaultPosition, wxDefaultSize, 0 );
406 m_LayersSizer->Add( m_Eco2Name, 0, wxEXPAND | wxRIGHT, 5 );
407
408 m_Eco2StaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
409 wxDefaultPosition, wxDefaultSize, 0 );
410 m_Eco2StaticText->Wrap( -1 );
411 m_LayersSizer->Add( m_Eco2StaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
412
413 m_CommentsCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
414 wxDefaultPosition, wxDefaultSize, 0 );
415 m_CommentsCheckBox->SetToolTip( _( "If you want a separate layer for comments or notes" ) );
416
418 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
419
420 m_CommentsName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Cmts_User ),
421 wxDefaultPosition, wxDefaultSize, 0 );
422 m_LayersSizer->Add( m_CommentsName, 0, wxEXPAND | wxRIGHT, 5 );
423
424 m_CommentsStaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
425 wxDefaultPosition, wxDefaultSize, 0 );
426 m_CommentsStaticText->Wrap( -1 );
427 m_LayersSizer->Add( m_CommentsStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
428
429 m_DrawingsCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
430 wxDefaultPosition, wxDefaultSize, 0 );
431 m_DrawingsCheckBox->SetToolTip( _( "If you want a layer for documentation drawings" ) );
432
434 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
435
436 m_DrawingsName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Dwgs_User ),
437 wxDefaultPosition, wxDefaultSize, 0 );
438 m_LayersSizer->Add( m_DrawingsName, 0, wxEXPAND | wxRIGHT, 5 );
439
440 m_DrawingsStaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
441 wxDefaultPosition, wxDefaultSize, 0 );
442 m_DrawingsStaticText->Wrap( -1 );
444 wxALIGN_CENTER_VERTICAL | wxBOTTOM | wxLEFT | wxRIGHT, 5 );
445
449}
450
451
453{
454 Freeze();
455 m_layersControls.clear();
456 m_LayersSizer->Clear( true );
464
465
466 LSET layers = m_enabledLayers;
467
468 for( auto it = layers.copper_layers_begin(); it != layers.copper_layers_end(); ++it )
469 {
470 wxCheckBox* cb = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
471 cb->SetToolTip( _( "Use the Physical Stackup page to change the number of copper layers." ) );
472 cb->Disable();
473
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( *it ), wxDefaultPosition, wxDefaultSize, 0 );
477 txt->SetToolTip( _("Layer Name") );
478
479 m_LayersSizer->Add( txt, 0, wxEXPAND|wxRIGHT, 5 );
480
481 wxArrayString choices;
482 choices.Add( _( "signal" ) );
483 choices.Add( _( "power plane" ) );
484 choices.Add( _( "mixed" ) );
485 choices.Add( _( "jumper" ) );
486 wxChoice* choice = new wxChoice( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices, 0 );
487 choice->SetSelection( 0 );
488 choice->SetToolTip( _("Copper layer type for Freerouter and other external routers.\n"
489 "Power plane layers are removed from Freerouter's layer menus.") );
490
491 m_LayersSizer->Add( choice, 0, wxRIGHT|wxEXPAND, 5 );
492 m_layersControls[*it] = PANEL_SETUP_LAYERS_CTLs( txt, cb, choice );
493 }
494
508
509 layers &= LSET::UserDefinedLayersMask();
510
511 for( auto it = layers.non_copper_layers_begin(); it != layers.non_copper_layers_end(); ++it )
512 {
513 append_user_layer( *it );
514 }
515
516 Thaw();
517 m_LayersListPanel->FitInside(); // Updates virtual size to fit subwindows, also auto-layouts.
518}
519
520
522{
523 wxCheckBox* cb = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString, wxDefaultPosition,
524 wxDefaultSize, 0 );
525 m_LayersSizer->Add( cb, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
526
527 wxTextCtrl* txt = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( aLayer ),
528 wxDefaultPosition, wxDefaultSize, 0 );
529 txt->SetToolTip( _( "Layer Name" ) );
530 m_LayersSizer->Add( txt, 0, wxEXPAND | wxRIGHT, 5 );
531
532 wxArrayString choices;
533 choices.Add( _( "Auxiliary" ) );
534 choices.Add( _( "Off-board, front" ) );
535 choices.Add( _( "Off-board, back" ) );
536
537 wxChoice* choice = new wxChoice( m_LayersListPanel, wxID_ANY, wxDefaultPosition,
538 wxDefaultSize, choices, 0 );
539 choice->SetSelection( 0 );
540 choice->SetToolTip(
541 _( "Auxiliary layers do not flip with board side, while back and front layers do." ) );
542
543 m_LayersSizer->Add( choice, 0, wxEXPAND | wxRIGHT, 5 );
544 m_layersControls[aLayer] = PANEL_SETUP_LAYERS_CTLs( txt, cb, choice );
545}
546
547
549{
550 return m_layersControls[aLayer].name;
551}
552
553
555{
556 return m_layersControls[aLayer].checkbox;
557}
558
559
561{
562 return dynamic_cast<wxChoice*>( m_layersControls[aLayer].choice );
563}
564
565
567{
568 m_enabledLayers = m_pcb->GetEnabledLayers();
569
570 // Rescue may be enabled, but should not be shown in this dialog
571 m_enabledLayers.reset( Rescue );
572
574
575 setCopperLayerCheckBoxes( m_pcb->GetCopperLayerCount() );
576
579
582
583 m_initialized = true;
584
585 return true;
586}
587
588
589void PANEL_SETUP_LAYERS::SyncCopperLayers( int aNumCopperLayers )
590{
591 BOARD* savedBoard = m_pcb;
592 BOARD temp;
593
594 m_pcb = &temp;
596
597 for( int ii = 0; ii < (int) m_enabledLayers.size(); ii++ )
598 {
599 if( IsCopperLayer( ToLAYER_ID( ii ) ) )
600 m_enabledLayers.reset( ii );
601 else if( getCheckBox( ToLAYER_ID( ii ) ) && getCheckBox( ToLAYER_ID( ii ) )->IsChecked() )
602 m_enabledLayers.set( ii );
603 else
604 m_enabledLayers.reset( ii );
605 }
606
607 m_enabledLayers |= LSET::AllCuMask( aNumCopperLayers );
608
610 setCopperLayerCheckBoxes( aNumCopperLayers );
611
614
617
618 m_pcb = savedBoard;
619}
620
621
623{
625
626 for( PCB_LAYER_ID layer : layers )
627 setLayerCheckBox( layer, m_pcb->IsLayerEnabled( layer ) );
628}
629
630
632{
633 // Set all the board's layer names into the dialog by calling BOARD::LayerName(),
634 // which will call BOARD::GetStandardLayerName() for non-coppers.
635
636 for( PCB_LAYER_ID layer : m_enabledLayers )
637 {
638 wxControl* ctl = getName( layer );
639
640 if( ctl )
641 {
642 wxString lname = m_pcb->GetLayerName( layer );
643
644 if( auto textCtl = dynamic_cast<wxTextCtrl*>( ctl ) )
645 textCtl->ChangeValue( lname ); // wxTextCtrl
646 else
647 ctl->SetLabel( lname ); // wxStaticText
648 }
649 }
650}
651
652
654{
655 for( auto& [layer,ctl] : m_layersControls )
656 setLayerCheckBox( layer, enabledLayers.test( layer ) );
657}
658
659
661{
662 LSET layers = m_enabledLayers & LSET::AllCuMask( m_pcb->GetCopperLayerCount() );
663
664 for( PCB_LAYER_ID cu_layer : m_enabledLayers.CuStack() )
665 {
666 wxChoice* ctl = getChoice( cu_layer );
667
668 switch ( m_pcb->GetLayerType( cu_layer ) )
669 {
670 case LT_SIGNAL: ctl->SetSelection( 0 ); break;
671 case LT_POWER: ctl->SetSelection( 1 ); break;
672 case LT_MIXED: ctl->SetSelection( 2 ); break;
673 case LT_JUMPER: ctl->SetSelection( 3 ); break;
674 default: ctl->SetSelection( 0 );
675 }
676
677 }
678
680
681 for( PCB_LAYER_ID layer : layers )
682 {
683 wxChoice* ctl = getChoice( layer );
684
685 switch( m_pcb->GetLayerType( layer ) )
686 {
687 case LT_AUX: ctl->SetSelection( 0 ); break;
688 case LT_FRONT: ctl->SetSelection( 1 ); break;
689 case LT_BACK: ctl->SetSelection( 2 ); break;
690 default: ctl->SetSelection( 0 ); break;
691 }
692 }
693}
694
695
697{
698 LSET layerMaskResult;
699
700 for( auto& [layer, _] : m_layersControls )
701 {
702 wxCheckBox* ctl = getCheckBox( layer );
703
704 if( ctl && ctl->IsChecked() )
705 layerMaskResult.set( layer );
706 }
707
708 return layerMaskResult;
709}
710
711
713{
715
716 if( !ctl.checkbox )
717 return;
718
719 ctl.checkbox->SetValue( isChecked );
720}
721
722
724{
725 if( copperCount > 0 )
726 {
727 wxCheckBox* fcu = getCheckBox( F_Cu );
728 mandatoryLayerCbSetup( *fcu );
729 }
730
731 if( copperCount > 0 )
732 {
733 wxCheckBox* bcu = getCheckBox( B_Cu );
734 mandatoryLayerCbSetup( *bcu );
735 }
736
737 LSET layers = m_enabledLayers & LSET::AllCuMask( copperCount );
738 layers.reset( F_Cu );
739 layers.reset( B_Cu );
740
741 for( PCB_LAYER_ID layer : layers )
742 {
743 wxCheckBox* cb = getCheckBox( layer );
745 }
746
747}
748
749
751{
752 bool modified = false;
753 LSET enabledLayers = GetUILayerMask();
754
755 LSET previousEnabled = m_pcb->GetEnabledLayers();
756
757 if( enabledLayers != previousEnabled )
758 {
759 m_pcb->SetEnabledLayers( enabledLayers );
760
761 LSET changedLayers = enabledLayers ^ previousEnabled;
762
763 /*
764 * Ensure enabled layers are also visible. This is mainly to avoid mistakes if some
765 * enabled layers are not visible when exiting this dialog.
766 */
767 m_pcb->SetVisibleLayers( m_pcb->GetVisibleLayers() | changedLayers );
768
769 /*
770 * Ensure items with through holes have all inner copper layers. (For historical reasons
771 * this is NOT trimmed to the currently-enabled inner layers.)
772 */
773 for( FOOTPRINT* fp : m_pcb->Footprints() )
774 {
775 for( PAD* pad : fp->Pads() )
776 {
777 if( pad->HasHole() && pad->IsOnCopperLayer() )
778 pad->SetLayerSet( pad->GetLayerSet() | LSET::InternalCuMask() );
779 }
780 }
781
782 // Tracks do not change their layer
783 // Vias layers are defined by the starting layer and the ending layer, so
784 // they are not modified by adding a layer.
785 // So do nothing for tracks/vias
786
787 modified = true;
788 }
789
790 for( PCB_LAYER_ID layer : enabledLayers )
791 {
792 wxString newLayerName = getName( layer )->GetValue();
793
794 if( m_pcb->GetLayerName( layer ) != newLayerName )
795 {
796 m_pcb->SetLayerName( layer, newLayerName );
797 modified = true;
798 }
799
800 if( IsCopperLayer( layer ) )
801 {
802 LAYER_T t;
803
804 switch( getChoice( layer )->GetCurrentSelection() )
805 {
806 case 0: t = LT_SIGNAL; break;
807 case 1: t = LT_POWER; break;
808 case 2: t = LT_MIXED; break;
809 case 3: t = LT_JUMPER; break;
810 default: t = LT_UNDEFINED; break;
811 }
812
813 if( m_pcb->GetLayerType( layer ) != t )
814 {
815 m_pcb->SetLayerType( layer, t );
816 modified = true;
817 }
818 }
819 else if( layer >= User_1 && !IsCopperLayer( layer ) )
820 {
821 LAYER_T t;
822
823 switch( getChoice( layer )->GetCurrentSelection() )
824 {
825 case 0: t = LT_AUX; break;
826 case 1: t = LT_FRONT; break;
827 case 2: t = LT_BACK; break;
828 default: t = LT_UNDEFINED; break;
829 }
830
831 if( m_pcb->GetLayerType( layer ) != t )
832 {
833 m_pcb->SetLayerType( layer, t );
834 modified = true;
835 }
836 }
837 }
838
839 LSET layers = enabledLayers & LSET::UserDefinedLayersMask();
840
841 for( PCB_LAYER_ID layer : layers )
842 {
843 wxString newLayerName = getName( layer )->GetValue();
844
845 if( m_pcb->GetLayerName( layer ) != newLayerName )
846 {
847 m_pcb->SetLayerName( layer, newLayerName );
848 modified = true;
849 }
850 }
851
852 return modified;
853}
854
855
857{
858 if( !testLayerNames() )
859 return false;
860
861 // Make sure we have the latest copper layer count
863 SyncCopperLayers( m_physicalStackup->GetCopperLayerCount() );
864
865 wxString msg;
866 bool modified = false;
867 wxWindow* parent = wxGetTopLevelParent( this );
868
869 // Check for removed layers with items which will get deleted from the board.
870 LSEQ removedLayers = getRemovedLayersWithItems();
871
872 // Check for non-copper layers in use in footprints, and therefore not removable.
873 LSEQ notremovableLayers = getNonRemovableLayers();
874
875 if( !notremovableLayers.empty() )
876 {
877 for( PCB_LAYER_ID layer : notremovableLayers )
878 msg << m_pcb->GetLayerName( layer ) << wxT( "\n" );
879
880 if( !IsOK( parent, wxString::Format( _( "Footprints have some items on removed layers:\n"
881 "%s\n"
882 "These items will be no longer accessible\n"
883 "Do you wish to continue?" ),
884 msg ) ) )
885 {
886 return false;
887 }
888 }
889
890 if( !removedLayers.empty() )
891 {
892 std::vector<BOARD_ITEM*> items;
893 std::vector<wxString> itemDescriptions;
894
895 for( PCB_LAYER_ID layer : removedLayers )
896 {
897 PCB_LAYER_COLLECTOR collector;
898 collector.SetLayerId( layer );
900
901 for( int i = 0; i < collector.GetCount(); i++ )
902 {
903 BOARD_ITEM* item = collector[i];
904
905 if( item->Type() == PCB_FOOTPRINT_T || item->GetParentFootprint() )
906 continue;
907
908 items.push_back( item );
909 itemDescriptions.push_back( item->GetItemDescription( m_frame, true ) );
910 }
911
912 for( FOOTPRINT* footprint : m_pcb->Footprints() )
913 {
914 for( PAD* pad : footprint->Pads() )
915 {
916 if( pad->HasExplicitDefinitionForLayer( layer ) )
917 {
918 items.push_back( pad );
919 itemDescriptions.push_back( wxString::Format( _( "Pad %s of %s on %s" ),
920 pad->GetNumber(),
921 footprint->GetReference(),
922 m_pcb->GetLayerName( layer ) ) );
923 }
924 }
925 }
926 }
927
928 if( !items.empty() )
929 {
930 DIALOG_ITEMS_LIST dlg( parent, _( "Warning" ),
931 _( "Items have been found on removed layers. This operation will "
932 "delete all items from removed layers and cannot be undone." ),
933 _( "Show Details" ) );
934
935 dlg.AddItems( itemDescriptions );
936
938 [&]( int index )
939 {
940 if( index >= 0 && index < (int) items.size() )
941 {
942 m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear );
943 m_frame->GetToolManager()->RunAction( ACTIONS::selectItem, static_cast<EDA_ITEM*>( items[index] ) );
944 m_frame->GetCanvas()->Refresh();
945 }
946 } );
947
948 if( dlg.ShowModal() != wxID_OK )
949 return false;
950 }
951 }
952
953 // Delete all objects on layers that have been removed. Leaving them in copper layers
954 // can (will?) result in DRC errors and it pollutes the board file with cruft.
955 if( !removedLayers.empty() )
956 {
957 m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear );
958
959 for( PCB_LAYER_ID layer_id : removedLayers )
960 modified |= m_pcb->RemoveAllItemsOnLayer( layer_id );
961
962 // Undo state may have copies of pointers deleted above
963 m_frame->ClearUndoRedoList();
964 }
965
966 modified |= transferDataFromWindow();
967
968 if( modified )
969 m_frame->OnModify();
970
971 return true;
972}
973
974
976{
977 std::vector<wxString> names;
978 wxTextCtrl* ctl;
979
980 for( PCB_LAYER_ID layer : LSET::AllLayersMask() )
981 {
982 // we _can_ rely on m_enabledLayers being current here:
983
984 if( !m_enabledLayers[layer] )
985 continue;
986
987 ctl = (wxTextCtrl*) getName( layer );
988 wxString name = ctl->GetValue();
989
990 // Check name for legality:
991 // 1) Cannot be blank.
992 // 2) Cannot have blanks.
993 // 3) Cannot have " chars
994 // 4) Cannot be 'signal'
995 // 5) Must be unique.
996 // 6) Cannot have illegal chars in filenames ( some filenames are built from layer names )
997 // like : % $ \ " / :
998 wxString badchars = wxFileName::GetForbiddenChars( wxPATH_DOS );
999 badchars.Append( '%' );
1000
1001 if( !name )
1002 {
1003 PAGED_DIALOG::GetDialog( this )->SetError( _( "Layer must have a name." ), this, ctl );
1004 return false;
1005 }
1006
1007 if( name.find_first_of( badchars ) != wxString::npos )
1008 {
1009 wxString msg = wxString::Format(_( "%s are forbidden in layer names." ), badchars );
1010 PAGED_DIALOG::GetDialog( this )->SetError( msg, this, ctl );
1011 return false;
1012 }
1013
1014 if( name == wxT( "signal" ) )
1015 {
1016 PAGED_DIALOG::GetDialog( this )->SetError( _( "Layer name \"signal\" is reserved." ), this, ctl );
1017 return false;
1018 }
1019
1020 for( const wxString& existingName : names )
1021 {
1022 if( name == existingName )
1023 {
1024 wxString msg = wxString::Format(_( "Layer name '%s' already in use." ), name );
1025 PAGED_DIALOG::GetDialog( this )->SetError( msg, this, ctl );
1026 return false;
1027 }
1028 }
1029
1030 names.push_back( name );
1031 }
1032
1033 return true;
1034}
1035
1036
1038{
1039 LSEQ removedLayers;
1040 LSET newLayers = GetUILayerMask();
1041 LSET curLayers = m_pcb->GetEnabledLayers();
1042
1043 if( newLayers == curLayers ) // Return an empty list if no change
1044 return removedLayers;
1045
1046 for( PCB_LAYER_ID layer_id : curLayers )
1047 {
1048 if( !newLayers[layer_id] )
1049 {
1050 bool hasItems = m_pcb->HasItemsOnLayer( layer_id );
1051
1052 if( !hasItems )
1053 {
1054 // Check for pads with custom properties on this layer
1055 for( FOOTPRINT* footprint : m_pcb->Footprints() )
1056 {
1057 for( PAD* pad : footprint->Pads() )
1058 {
1059 if( pad->HasExplicitDefinitionForLayer( layer_id ) )
1060 {
1061 hasItems = true;
1062 break;
1063 }
1064 }
1065 if( hasItems )
1066 break;
1067 }
1068 }
1069
1070 if( hasItems )
1071 removedLayers.push_back( layer_id );
1072 }
1073 }
1074
1075 return removedLayers;
1076}
1077
1078
1080{
1081 // Build the list of non-copper layers in use in footprints.
1082 LSEQ inUseLayers;
1083 LSET newLayers = GetUILayerMask();
1084 LSET curLayers = m_pcb->GetEnabledLayers();
1085
1086 if( newLayers == curLayers ) // Return an empty list if no change
1087 return inUseLayers;
1088
1089 PCB_LAYER_COLLECTOR collector;
1090
1091 for( PCB_LAYER_ID layer_id : curLayers )
1092 {
1093 if( IsCopperLayer( layer_id ) ) // Copper layers are not taken into account here
1094 continue;
1095
1096 if( !newLayers.Contains( layer_id ) )
1097 {
1098 collector.SetLayerId( layer_id );
1100
1101 if( collector.GetCount() != 0 )
1102 inUseLayers.push_back( layer_id );
1103 }
1104 }
1105
1106 return inUseLayers;
1107}
1108
1109
1111{
1112 BOARD* savedBoard = m_pcb;
1113
1114 m_pcb = aBoard;
1116
1117 m_pcb = savedBoard;
1118}
1119
1120
1121bool PANEL_SETUP_LAYERS::CheckCopperLayerCount( BOARD* aWorkingBoard, BOARD* aImportedBoard )
1122{
1123 /*
1124 * This function warns users if they are going to delete inner copper layers because
1125 * they're importing settings from a board with less copper layers than the board
1126 * already loaded. We want to return "true" as default on the assumption no layer will
1127 * actually be deleted.
1128 */
1129 bool okToDeleteCopperLayers = true;
1130
1131 // Get the number of copper layers in the loaded board and the "import settings" board
1132 int currNumLayers = aWorkingBoard->GetCopperLayerCount();
1133 int newNumLayers = aImportedBoard->GetCopperLayerCount();
1134
1135 if( newNumLayers < currNumLayers )
1136 {
1137 wxString msg = wxString::Format( _( "Imported settings have fewer copper layers than "
1138 "the current board (%i instead of %i).\n\n"
1139 "Continue and delete the extra inner copper layers "
1140 "from the current board?" ),
1141 newNumLayers,
1142 currNumLayers );
1143
1144 wxWindow* topLevelParent = wxGetTopLevelParent( this );
1145
1146 wxMessageDialog dlg( topLevelParent, msg, _( "Inner Layers to Be Deleted" ),
1147 wxICON_WARNING | wxSTAY_ON_TOP | wxYES | wxNO | wxNO_DEFAULT );
1148
1149 if( wxID_ANY == dlg.ShowModal() )
1150 okToDeleteCopperLayers = false;
1151 }
1152
1153 return okToDeleteCopperLayers;
1154}
1155
1156
1157void PANEL_SETUP_LAYERS::addUserDefinedLayer( wxCommandEvent& aEvent )
1158{
1159 wxArrayString headers;
1160 headers.Add( _( "Layers" ) );
1161
1162 // Build the available user-defined layers list:
1163 std::vector<wxArrayString> list;
1164
1165 for( PCB_LAYER_ID layer : LSET::UserDefinedLayersMask().Seq() )
1166 {
1167 wxCheckBox* checkBox = getCheckBox( layer );
1168
1169 if( checkBox && checkBox->IsShown() )
1170 continue;
1171
1172 wxArrayString available_user_layer;
1173 available_user_layer.Add( LayerName( layer ) );
1174
1175 list.emplace_back( available_user_layer );
1176 }
1177
1178 if( list.empty() )
1179 {
1181 _( "All user-defined layers have already been added." ) );
1182 return;
1183 }
1184
1185 EDA_LIST_DIALOG dlg( PAGED_DIALOG::GetDialog( this ), _( "Add User-defined Layer" ),
1186 headers, list );
1187 dlg.SetListLabel( _( "Select layer to add:" ) );
1188 dlg.HideFilter();
1189
1190 if( dlg.ShowModal() == wxID_ANY || dlg.GetTextSelection().IsEmpty() )
1191 return;
1192
1194
1195 for( PCB_LAYER_ID layer2 : LSET::UserDefinedLayersMask().Seq() )
1196 {
1197 if( LayerName( layer2 ) == dlg.GetTextSelection() )
1198 {
1199 layer = layer2;
1200 break;
1201 }
1202 }
1203
1204 wxCHECK( layer >= User_1, /* void */ );
1205
1206 m_enabledLayers.set( layer );
1207 append_user_layer( layer );
1208
1210
1211 // All user-defined layers should have a checkbox
1212 wxASSERT( ctl.checkbox );
1213 ctl.checkbox->SetValue( true );
1214
1215 wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( ctl.name );
1216
1217 wxCHECK( textCtrl, /* void */ );
1218 textCtrl->ChangeValue( LSET::Name( layer ) );
1219
1220 wxChoice* userLayerType = dynamic_cast<wxChoice*>( ctl.choice );
1221
1222 wxCHECK( userLayerType, /* void */ );
1223 userLayerType->SetSelection( 0 );
1224
1225 ctl.name->Show( true );
1226 ctl.checkbox->Show( true );
1227 ctl.choice->Show( true );
1228
1229 wxSizeEvent evt_size( m_LayersListPanel->GetSize() );
1230 m_LayersListPanel->GetEventHandler()->ProcessEvent( evt_size );
1231}
1232
1233
int index
const char * name
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
Definition board.h:243
@ LT_POWER
Definition board.h:246
@ LT_FRONT
Definition board.h:250
@ LT_MIXED
Definition board.h:247
@ LT_BACK
Definition board.h:251
@ LT_UNDEFINED
Definition board.h:244
@ LT_JUMPER
Definition board.h:248
@ LT_AUX
Definition board.h:249
@ LT_SIGNAL
Definition board.h:245
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition actions.h:223
static TOOL_ACTION selectionClear
Clear the current selection.
Definition actions.h:220
BASE_SET & reset(size_t pos)
Definition base_set.h:153
BASE_SET & set(size_t pos)
Definition base_set.h:126
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:85
FOOTPRINT * GetParentFootprint() const
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:411
int GetCopperLayerCount() const
Definition board.cpp:1127
int GetCount() const
Return the number of objects in the list.
Definition collector.h:79
void SetSelectionCallback(std::function< void(int)> aCallback)
void AddItems(const std::vector< wxString > &aItems)
int ShowModal() override
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
virtual wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const
Return a user-visible description string of this item.
Definition eda_item.cpp:304
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
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:69
static const std::vector< KICAD_T > FootprintItems
A scan list for primary footprint items.
Definition collectors.h:110
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:922
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
Definition lset.cpp:604
copper_layers_iterator copper_layers_begin() const
Definition lset.cpp:916
non_copper_layers_iterator non_copper_layers_begin() const
Definition lset.cpp:928
non_copper_layers_iterator non_copper_layers_end() const
Definition lset.cpp:934
static const LSET & AllLayersMask()
Definition lset.cpp:637
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
Definition lset.cpp:700
static const LSET & InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Definition lset.cpp:573
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition lset.cpp:184
bool Contains(PCB_LAYER_ID aLayer) const
See if the layer set contains a PCB layer.
Definition lset.h:63
Definition pad.h:61
static PAGED_DIALOG * GetDialog(wxWindow *aWindow)
void SetError(const wxString &aMessage, const wxString &aPageName, int aCtrlId, int aRow=-1, int aCol=-1)
wxScrolledWindow * m_LayersListPanel
PANEL_SETUP_LAYERS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
wxStaticText * m_CrtYdBackStaticText
wxStaticText * m_CrtYdFrontStaticText
wxCheckBox * m_SoldPBackCheckBox
wxStaticText * m_PCBEdgesStaticText
wxStaticText * m_FabBackStaticText
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.
wxStaticText * m_AdhesFrontStaticText
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
wxStaticText * m_Eco1StaticText
PANEL_SETUP_BOARD_STACKUP * m_physicalStackup
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
wxStaticText * m_SilkSBackStaticText
wxTextCtrl * m_SilkSFrontName
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)
BOARD * GetBoard() const
The main frame for Pcbnew.
Collect all BOARD_ITEM objects on a given layer.
Definition collectors.h:546
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.
void SetLayerId(PCB_LAYER_ID aLayerId)
Definition collectors.h:552
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition confirm.cpp:274
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:217
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:741
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ F_CrtYd
Definition layer_ids.h:112
@ B_Adhes
Definition layer_ids.h:99
@ Edge_Cuts
Definition layer_ids.h:108
@ Dwgs_User
Definition layer_ids.h:103
@ F_Paste
Definition layer_ids.h:100
@ Cmts_User
Definition layer_ids.h:104
@ F_Adhes
Definition layer_ids.h:98
@ B_Mask
Definition layer_ids.h:94
@ B_Cu
Definition layer_ids.h:61
@ Eco1_User
Definition layer_ids.h:105
@ F_Mask
Definition layer_ids.h:93
@ B_Paste
Definition layer_ids.h:101
@ F_Fab
Definition layer_ids.h:115
@ Margin
Definition layer_ids.h:109
@ F_SilkS
Definition layer_ids.h:96
@ B_CrtYd
Definition layer_ids.h:111
@ UNDEFINED_LAYER
Definition layer_ids.h:57
@ Eco2_User
Definition layer_ids.h:106
@ Rescue
Definition layer_ids.h:117
@ User_1
Definition layer_ids.h:120
@ B_SilkS
Definition layer_ids.h:97
@ F_Cu
Definition layer_ids.h:60
@ B_Fab
Definition layer_ids.h:114
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition lset.cpp:750
static void mandatoryLayerCbSetup(wxCheckBox &aCheckBox)
Configure a layer checkbox to be mandatory and disabled.
The 3 UI control pointers for a single board layer.
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:78