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, 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>
42
43#include <wx/choicdlg.h>
44#include <wx/msgdlg.h>
45#include <eda_list_dialog.h>
46
47#include <list>
48#include <set>
49
50
54static void mandatoryLayerCbSetup( wxCheckBox& aCheckBox )
55{
56 aCheckBox.Show();
57 aCheckBox.Disable();
58 aCheckBox.SetValue( true );
59 aCheckBox.SetToolTip( _( "This layer is required and cannot be disabled" ) );
60}
61
62
63PANEL_SETUP_LAYERS::PANEL_SETUP_LAYERS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame ) :
64 PANEL_SETUP_LAYERS_BASE( aParentWindow ),
65 m_frame( aFrame ),
66 m_physicalStackup( nullptr ),
67 m_initialized( false ),
68 m_CrtYdFrontCheckBox( nullptr ),
69 m_CrtYdFrontName( nullptr ),
70 m_CrtYdFrontStaticText( nullptr ),
71 m_FabFrontCheckBox( nullptr ),
72 m_FabFrontName( nullptr ),
73 m_FabFrontStaticText( nullptr ),
74 m_AdhesFrontCheckBox( nullptr ),
75 m_AdhesFrontName( nullptr ),
76 m_AdhesFrontStaticText( nullptr ),
77 m_SoldPFrontCheckBox( nullptr ),
78 m_SoldPFrontName( nullptr ),
79 m_SoldPFrontStaticText( nullptr ),
80 m_SilkSFrontCheckBox( nullptr ),
81 m_SilkSFrontName( nullptr ),
82 m_SilkSFrontStaticText( nullptr ),
83 m_MaskFrontCheckBox( nullptr ),
84 m_MaskFrontName( nullptr ),
85 m_MaskFrontStaticText( nullptr ),
86 m_MaskBackCheckBox( nullptr ),
87 m_MaskBackName( nullptr ),
88 m_MaskBackStaticText( nullptr ),
89 m_SilkSBackCheckBox( nullptr ),
90 m_SilkSBackName( nullptr ),
91 m_SilkSBackStaticText( nullptr ),
92 m_SoldPBackCheckBox( nullptr ),
93 m_SoldPBackName( nullptr ),
94 m_SoldPBackStaticText( nullptr ),
95 m_AdhesBackCheckBox( nullptr ),
96 m_AdhesBackName( nullptr ),
97 m_AdhesBackStaticText( nullptr ),
98 m_FabBackCheckBox( nullptr ),
99 m_FabBackName( nullptr ),
100 m_FabBackStaticText( nullptr ),
101 m_CrtYdBackCheckBox( nullptr ),
102 m_CrtYdBackName( nullptr ),
103 m_CrtYdBackStaticText( nullptr ),
104 m_PCBEdgesCheckBox( nullptr ),
105 m_PCBEdgesName( nullptr ),
106 m_PCBEdgesStaticText( nullptr ),
107 m_MarginCheckBox( nullptr ),
108 m_MarginName( nullptr ),
109 m_MarginStaticText( nullptr ),
110 m_Eco1CheckBox( nullptr ),
111 m_Eco1Name( nullptr ),
112 m_Eco1StaticText( nullptr ),
113 m_Eco2CheckBox( nullptr ),
114 m_Eco2Name( nullptr ),
115 m_Eco2StaticText( nullptr ),
116 m_CommentsCheckBox( nullptr ),
117 m_CommentsName( nullptr ),
118 m_CommentsStaticText( nullptr ),
119 m_DrawingsCheckBox( nullptr ),
120 m_DrawingsName( nullptr ),
121 m_DrawingsStaticText( nullptr )
122{
123 m_pcb = aFrame->GetBoard();
124}
125
126
128{
129 m_CrtYdFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
130 wxDefaultPosition, wxDefaultSize, 0 );
132 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT
133 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
134 5 );
135
136 m_CrtYdFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_CrtYd ),
137 wxDefaultPosition, wxDefaultSize, 0 );
138 m_CrtYdFrontName->SetMinSize( wxSize( 160, -1 ) );
139
140 m_LayersSizer->Add( m_CrtYdFrontName, 0, wxRIGHT | wxEXPAND, 5 );
141
143 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, testing" ),
144 wxDefaultPosition, wxDefaultSize, 0 );
145 m_CrtYdFrontStaticText->Wrap( -1 );
146 m_CrtYdFrontStaticText->SetMinSize( wxSize( 150, -1 ) );
147
148 m_LayersSizer->Add( m_CrtYdFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
149
150 m_FabFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
151 wxDefaultPosition, wxDefaultSize, 0 );
152 m_FabFrontCheckBox->SetToolTip(
153 _( "If you want a fabrication layer for the front side of the board" ) );
154
156 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
157
158 m_FabFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Fab ),
159 wxDefaultPosition, wxDefaultSize, 0 );
160 m_LayersSizer->Add( m_FabFrontName, 0, wxEXPAND | wxRIGHT, 5 );
161
163 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, manufacturing" ),
164 wxDefaultPosition, wxDefaultSize, 0 );
165 m_FabFrontStaticText->Wrap( -1 );
166 m_LayersSizer->Add( m_FabFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
167
168 m_AdhesFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
169 wxDefaultPosition, wxDefaultSize, 0 );
170 m_AdhesFrontCheckBox->SetToolTip(
171 _( "If you want an adhesive template for the front side of the board" ) );
172
174 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
175
176 m_AdhesFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Adhes ),
177 wxDefaultPosition, wxDefaultSize, 0 );
178 m_LayersSizer->Add( m_AdhesFrontName, 0, wxEXPAND | wxRIGHT, 5 );
179
181 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
182 wxDefaultPosition, wxDefaultSize, 0 );
183 m_AdhesFrontStaticText->Wrap( -1 );
184 m_LayersSizer->Add( m_AdhesFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
185
186 m_SoldPFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
187 wxDefaultPosition, wxDefaultSize, 0 );
188 m_SoldPFrontCheckBox->SetToolTip(
189 _( "If you want a solder paste layer for front side of the board" ) );
190
192 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
193
194 m_SoldPFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Paste ),
195 wxDefaultPosition, wxDefaultSize, 0 );
196 m_LayersSizer->Add( m_SoldPFrontName, 0, wxEXPAND | wxRIGHT, 5 );
197
199 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
200 wxDefaultPosition, wxDefaultSize, 0 );
201 m_SoldPFrontStaticText->Wrap( -1 );
202 m_LayersSizer->Add( m_SoldPFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
203
204 m_SilkSFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
205 wxDefaultPosition, wxDefaultSize, 0 );
206 m_SilkSFrontCheckBox->SetToolTip(
207 _( "If you want a silk screen layer for the front side of the board" ) );
208
210 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
211
212 m_SilkSFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_SilkS ),
213 wxDefaultPosition, wxDefaultSize, 0 );
214 m_LayersSizer->Add( m_SilkSFrontName, 0, wxEXPAND | wxRIGHT, 5 );
215
217 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
218 wxDefaultPosition, wxDefaultSize, 0 );
219 m_SilkSFrontStaticText->Wrap( -1 );
220 m_LayersSizer->Add( m_SilkSFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
221
222 m_MaskFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
223 wxDefaultPosition, wxDefaultSize, 0 );
224 m_MaskFrontCheckBox->SetToolTip(
225 _( "If you want a solder mask layer for the front of the board" ) );
226
228 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
229
230 m_MaskFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Mask ),
231 wxDefaultPosition, wxDefaultSize, 0 );
232 m_LayersSizer->Add( m_MaskFrontName, 0, wxEXPAND | wxRIGHT, 5 );
233
235 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
236 wxDefaultPosition, wxDefaultSize, 0 );
237 m_MaskFrontStaticText->Wrap( -1 );
238 m_LayersSizer->Add( m_MaskFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
239
241}
242
243
245{
246 m_MaskBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
247 wxDefaultPosition, wxDefaultSize, 0 );
248 m_MaskBackCheckBox->SetToolTip(
249 _( "If you want a solder mask layer for the back side of the board" ) );
250
252 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
253
254 m_MaskBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Mask ),
255 wxDefaultPosition, wxDefaultSize, 0 );
256 m_LayersSizer->Add( m_MaskBackName, 0, wxEXPAND | wxRIGHT, 5 );
257
259 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
260 wxDefaultPosition, wxDefaultSize, 0 );
261 m_MaskBackStaticText->Wrap( -1 );
262 m_LayersSizer->Add( m_MaskBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
263
264 m_SilkSBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
265 wxDefaultPosition, wxDefaultSize, 0 );
266 m_SilkSBackCheckBox->SetToolTip(
267 _( "If you want a silk screen layer for the back side of the board" ) );
268
270 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
271
272 m_SilkSBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_SilkS ),
273 wxDefaultPosition, wxDefaultSize, 0 );
274 m_LayersSizer->Add( m_SilkSBackName, 0, wxEXPAND | wxRIGHT, 5 );
275
277 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
278 wxDefaultPosition, wxDefaultSize, 0 );
279 m_SilkSBackStaticText->Wrap( -1 );
280 m_LayersSizer->Add( m_SilkSBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
281
282 m_SoldPBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
283 wxDefaultPosition, wxDefaultSize, 0 );
284 m_SoldPBackCheckBox->SetToolTip(
285 _( "If you want a solder paste layer for the back side of the board" ) );
286
288 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
289
290 m_SoldPBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Paste ),
291 wxDefaultPosition, wxDefaultSize, 0 );
292 m_LayersSizer->Add( m_SoldPBackName, 0, wxEXPAND | wxRIGHT, 5 );
293
295 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
296 wxDefaultPosition, wxDefaultSize, 0 );
297 m_SoldPBackStaticText->Wrap( -1 );
298 m_LayersSizer->Add( m_SoldPBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
299
300 m_AdhesBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
301 wxDefaultPosition, wxDefaultSize, 0 );
302 m_AdhesBackCheckBox->SetToolTip(
303 _( "If you want an adhesive layer for the back side of the board" ) );
304
306 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
307
308 m_AdhesBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Adhes ),
309 wxDefaultPosition, wxDefaultSize, 0 );
310 m_LayersSizer->Add( m_AdhesBackName, 0, wxEXPAND | wxRIGHT, 5 );
311
313 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
314 wxDefaultPosition, wxDefaultSize, 0 );
315 m_AdhesBackStaticText->Wrap( -1 );
316 m_LayersSizer->Add( m_AdhesBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
317
318 m_FabBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
319 wxDefaultPosition, wxDefaultSize, 0 );
320 m_FabBackCheckBox->SetToolTip(
321 _( "If you want a fabrication layer for the back side of the board" ) );
322
324 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
325
326 m_FabBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Fab ),
327 wxDefaultPosition, wxDefaultSize, 0 );
328 m_LayersSizer->Add( m_FabBackName, 0, wxEXPAND | wxRIGHT, 5 );
329
331 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, manufacturing" ),
332 wxDefaultPosition, wxDefaultSize, 0 );
333 m_FabBackStaticText->Wrap( -1 );
334 m_LayersSizer->Add( m_FabBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
335
336
337 m_CrtYdBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
338 wxDefaultPosition, wxDefaultSize, 0 );
340 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT
341 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
342 5 );
343
344 m_CrtYdBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_CrtYd ),
345 wxDefaultPosition, wxDefaultSize, 0 );
346 m_LayersSizer->Add( m_CrtYdBackName, 0, wxEXPAND | wxRIGHT, 5 );
347
349 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, testing" ),
350 wxDefaultPosition, wxDefaultSize, 0 );
351 m_CrtYdBackStaticText->Wrap( -1 );
352 m_LayersSizer->Add( m_CrtYdBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5 );
353
354
355 m_PCBEdgesCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
356 wxDefaultPosition, wxDefaultSize, 0 );
358 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT
359 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
360 5 );
361
362 m_PCBEdgesName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Edge_Cuts ),
363 wxDefaultPosition, wxDefaultSize, 0 );
364 m_LayersSizer->Add( m_PCBEdgesName, 0, wxEXPAND | wxRIGHT, 5 );
365
367 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Board contour" ),
368 wxDefaultPosition, wxDefaultSize, 0 );
369 m_PCBEdgesStaticText->Wrap( -1 );
370 m_LayersSizer->Add( m_PCBEdgesStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
371
372 m_MarginCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
373 wxDefaultPosition, wxDefaultSize, 0 );
375 wxLEFT | wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL
376 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
377 5 );
378
379 m_MarginName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Margin ),
380 wxDefaultPosition, wxDefaultSize, 0 );
381 m_LayersSizer->Add( m_MarginName, 0, wxEXPAND | wxRIGHT, 5 );
382
384 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Board contour setback" ),
385 wxDefaultPosition, wxDefaultSize, 0 );
386 m_MarginStaticText->Wrap( -1 );
387 m_LayersSizer->Add( m_MarginStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
388
389 m_Eco1CheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
390 wxDefaultPosition, wxDefaultSize, 0 );
392 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
393
394 m_Eco1Name = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Eco1_User ),
395 wxDefaultPosition, wxDefaultSize, 0 );
396 m_LayersSizer->Add( m_Eco1Name, 0, wxEXPAND | wxRIGHT, 5 );
397
398 m_Eco1StaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
399 wxDefaultPosition, wxDefaultSize, 0 );
400 m_Eco1StaticText->Wrap( -1 );
401 m_LayersSizer->Add( m_Eco1StaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
402
403 m_Eco2CheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
404 wxDefaultPosition, wxDefaultSize, 0 );
406 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
407
408 m_Eco2Name = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Eco2_User ),
409 wxDefaultPosition, wxDefaultSize, 0 );
410 m_LayersSizer->Add( m_Eco2Name, 0, wxEXPAND | wxRIGHT, 5 );
411
412 m_Eco2StaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
413 wxDefaultPosition, wxDefaultSize, 0 );
414 m_Eco2StaticText->Wrap( -1 );
415 m_LayersSizer->Add( m_Eco2StaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
416
417 m_CommentsCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
418 wxDefaultPosition, wxDefaultSize, 0 );
419 m_CommentsCheckBox->SetToolTip( _( "If you want a separate layer for comments or notes" ) );
420
422 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
423
424 m_CommentsName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Cmts_User ),
425 wxDefaultPosition, wxDefaultSize, 0 );
426 m_LayersSizer->Add( m_CommentsName, 0, wxEXPAND | wxRIGHT, 5 );
427
428 m_CommentsStaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
429 wxDefaultPosition, wxDefaultSize, 0 );
430 m_CommentsStaticText->Wrap( -1 );
431 m_LayersSizer->Add( m_CommentsStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
432
433 m_DrawingsCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
434 wxDefaultPosition, wxDefaultSize, 0 );
435 m_DrawingsCheckBox->SetToolTip( _( "If you want a layer for documentation drawings" ) );
436
438 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
439
440 m_DrawingsName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Dwgs_User ),
441 wxDefaultPosition, wxDefaultSize, 0 );
442 m_LayersSizer->Add( m_DrawingsName, 0, wxEXPAND | wxRIGHT, 5 );
443
444 m_DrawingsStaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
445 wxDefaultPosition, wxDefaultSize, 0 );
446 m_DrawingsStaticText->Wrap( -1 );
448 wxALIGN_CENTER_VERTICAL | wxBOTTOM | wxLEFT | wxRIGHT, 5 );
449
453}
454
455
457{
458 Freeze();
459 m_layersControls.clear();
460 m_LayersSizer->Clear( true );
468
469
470 LSET layers = m_enabledLayers;
471
472 for( auto it = layers.copper_layers_begin(); it != layers.copper_layers_end(); ++it )
473 {
474 wxCheckBox* cb = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
475 cb->SetToolTip( _( "Use the Physical Stackup page to change the number of copper layers." ) );
476 cb->Disable();
477
478 m_LayersSizer->Add( cb, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
479
480 wxTextCtrl* txt = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( *it ), wxDefaultPosition, wxDefaultSize, 0 );
481 txt->SetToolTip( _("Layer Name") );
482
483 m_LayersSizer->Add( txt, 0, wxEXPAND|wxRIGHT, 5 );
484
485 wxArrayString choices;
486 choices.Add( _( "signal" ) );
487 choices.Add( _( "power plane" ) );
488 choices.Add( _( "mixed" ) );
489 choices.Add( _( "jumper" ) );
490 wxChoice* choice = new wxChoice( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices, 0 );
491 choice->SetSelection( 0 );
492 choice->SetToolTip( _("Copper layer type for Freerouter and other external routers.\n"
493 "Power plane layers are removed from Freerouter's layer menus.") );
494
495 m_LayersSizer->Add( choice, 0, wxRIGHT|wxEXPAND, 5 );
496 m_layersControls[*it] = PANEL_SETUP_LAYERS_CTLs( txt, cb, choice );
497 }
498
512
513 layers &= LSET::UserDefinedLayersMask();
514
515 for( auto it = layers.non_copper_layers_begin(); it != layers.non_copper_layers_end(); ++it )
516 {
517 append_user_layer( *it );
518 }
519
520 Thaw();
521 m_LayersListPanel->FitInside(); // Updates virtual size to fit subwindows, also auto-layouts.
522}
523
524
526{
527 wxCheckBox* cb = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString, wxDefaultPosition,
528 wxDefaultSize, 0 );
529 m_LayersSizer->Add( cb, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
530
531 wxTextCtrl* txt = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( aLayer ),
532 wxDefaultPosition, wxDefaultSize, 0 );
533 txt->SetToolTip( _( "Layer Name" ) );
534 m_LayersSizer->Add( txt, 0, wxEXPAND | wxRIGHT, 5 );
535
536 wxArrayString choices;
537 choices.Add( _( "Auxiliary" ) );
538 choices.Add( _( "Off-board, front" ) );
539 choices.Add( _( "Off-board, back" ) );
540
541 wxChoice* choice = new wxChoice( m_LayersListPanel, wxID_ANY, wxDefaultPosition,
542 wxDefaultSize, choices, 0 );
543 choice->SetSelection( 0 );
544 choice->SetToolTip(
545 _( "Auxiliary layers do not flip with board side, while back and front layers do." ) );
546
547 m_LayersSizer->Add( choice, 0, wxEXPAND | wxRIGHT, 5 );
548 m_layersControls[aLayer] = PANEL_SETUP_LAYERS_CTLs( txt, cb, choice );
549}
550
551
553{
554 return m_layersControls[aLayer].name;
555}
556
557
559{
560 return m_layersControls[aLayer].checkbox;
561}
562
563
565{
566 return dynamic_cast<wxChoice*>( m_layersControls[aLayer].choice );
567}
568
569
571{
572 m_enabledLayers = m_pcb->GetEnabledLayers();
573
574 // Rescue may be enabled, but should not be shown in this dialog
575 m_enabledLayers.reset( Rescue );
576
578
579 setCopperLayerCheckBoxes( m_pcb->GetCopperLayerCount() );
580
583
586
587 m_initialized = true;
588
589 return true;
590}
591
592
593void PANEL_SETUP_LAYERS::SyncCopperLayers( int aNumCopperLayers )
594{
595 BOARD* savedBoard = m_pcb;
596 BOARD temp;
597
598 m_pcb = &temp;
600
601 for( size_t ii = 0; ii < m_enabledLayers.size(); ii++ )
602 {
603 if( IsCopperLayer( int( ii ) ) )
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:185
@ LT_POWER
Definition board.h:188
@ LT_FRONT
Definition board.h:192
@ LT_MIXED
Definition board.h:189
@ LT_BACK
Definition board.h:193
@ LT_UNDEFINED
Definition board.h:186
@ LT_JUMPER
Definition board.h:190
@ LT_AUX
Definition board.h:191
@ LT_SIGNAL
Definition board.h:187
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition actions.h:227
static TOOL_ACTION selectionClear
Clear the current selection.
Definition actions.h:224
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:83
FOOTPRINT * GetParentFootprint() const
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:322
int GetCopperLayerCount() const
Definition board.cpp:919
int GetCount() const
Return the number of objects in the list.
Definition collector.h:83
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:144
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:107
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:907
copper_layers_iterator copper_layers_begin() const
Definition lset.cpp:901
non_copper_layers_iterator non_copper_layers_begin() const
Definition lset.cpp:913
non_copper_layers_iterator non_copper_layers_end() const
Definition lset.cpp:919
static const LSET & AllLayersMask()
Definition lset.cpp:624
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
Definition lset.cpp:687
static LSET AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
Definition lset.cpp:591
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:560
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition lset.cpp:188
bool Contains(PCB_LAYER_ID aLayer) const
See if the layer set contains a PCB layer.
Definition lset.h:63
Definition pad.h:55
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:549
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:555
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition confirm.cpp:259
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:202
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:677
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
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_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:86