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>
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 m_CrtYdFrontCheckBox( nullptr ),
68 m_CrtYdFrontName( nullptr ),
69 m_CrtYdFrontStaticText( nullptr ),
70 m_FabFrontCheckBox( nullptr ),
71 m_FabFrontName( nullptr ),
72 m_FabFrontStaticText( nullptr ),
73 m_AdhesFrontCheckBox( nullptr ),
74 m_AdhesFrontName( nullptr ),
75 m_AdhesFrontStaticText( nullptr ),
76 m_SoldPFrontCheckBox( nullptr ),
77 m_SoldPFrontName( nullptr ),
78 m_SoldPFrontStaticText( nullptr ),
79 m_SilkSFrontCheckBox( nullptr ),
80 m_SilkSFrontName( nullptr ),
81 m_SilkSFrontStaticText( nullptr ),
82 m_MaskFrontCheckBox( nullptr ),
83 m_MaskFrontName( nullptr ),
84 m_MaskFrontStaticText( nullptr ),
85 m_MaskBackCheckBox( nullptr ),
86 m_MaskBackName( nullptr ),
87 m_MaskBackStaticText( nullptr ),
88 m_SilkSBackCheckBox( nullptr ),
89 m_SilkSBackName( nullptr ),
90 m_SilkSBackStaticText( nullptr ),
91 m_SoldPBackCheckBox( nullptr ),
92 m_SoldPBackName( nullptr ),
93 m_SoldPBackStaticText( nullptr ),
94 m_AdhesBackCheckBox( nullptr ),
95 m_AdhesBackName( nullptr ),
96 m_AdhesBackStaticText( nullptr ),
97 m_FabBackCheckBox( nullptr ),
98 m_FabBackName( nullptr ),
99 m_FabBackStaticText( nullptr ),
100 m_CrtYdBackCheckBox( nullptr ),
101 m_CrtYdBackName( nullptr ),
102 m_CrtYdBackStaticText( nullptr ),
103 m_PCBEdgesCheckBox( nullptr ),
104 m_PCBEdgesName( nullptr ),
105 m_PCBEdgesStaticText( nullptr ),
106 m_MarginCheckBox( nullptr ),
107 m_MarginName( nullptr ),
108 m_MarginStaticText( nullptr ),
109 m_Eco1CheckBox( nullptr ),
110 m_Eco1Name( nullptr ),
111 m_Eco1StaticText( nullptr ),
112 m_Eco2CheckBox( nullptr ),
113 m_Eco2Name( nullptr ),
114 m_Eco2StaticText( nullptr ),
115 m_CommentsCheckBox( nullptr ),
116 m_CommentsName( nullptr ),
117 m_CommentsStaticText( nullptr ),
118 m_DrawingsCheckBox( nullptr ),
119 m_DrawingsName( nullptr ),
120 m_DrawingsStaticText( nullptr )
121{
122 m_pcb = aFrame->GetBoard();
123}
124
125
127{
128 m_CrtYdFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
129 wxDefaultPosition, wxDefaultSize, 0 );
131 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT
132 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
133 5 );
134
135 m_CrtYdFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_CrtYd ),
136 wxDefaultPosition, wxDefaultSize, 0 );
137 m_CrtYdFrontName->SetMinSize( wxSize( 160, -1 ) );
138
139 m_LayersSizer->Add( m_CrtYdFrontName, 0, wxRIGHT | wxEXPAND, 5 );
140
142 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, testing" ),
143 wxDefaultPosition, wxDefaultSize, 0 );
144 m_CrtYdFrontStaticText->Wrap( -1 );
145 m_CrtYdFrontStaticText->SetMinSize( wxSize( 150, -1 ) );
146
147 m_LayersSizer->Add( m_CrtYdFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
148
149 m_FabFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
150 wxDefaultPosition, wxDefaultSize, 0 );
151 m_FabFrontCheckBox->SetToolTip(
152 _( "If you want a fabrication layer for the front side of the board" ) );
153
155 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
156
157 m_FabFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Fab ),
158 wxDefaultPosition, wxDefaultSize, 0 );
159 m_LayersSizer->Add( m_FabFrontName, 0, wxEXPAND | wxRIGHT, 5 );
160
162 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, manufacturing" ),
163 wxDefaultPosition, wxDefaultSize, 0 );
164 m_FabFrontStaticText->Wrap( -1 );
165 m_LayersSizer->Add( m_FabFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
166
167 m_AdhesFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
168 wxDefaultPosition, wxDefaultSize, 0 );
169 m_AdhesFrontCheckBox->SetToolTip(
170 _( "If you want an adhesive template for the front side of the board" ) );
171
173 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
174
175 m_AdhesFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Adhes ),
176 wxDefaultPosition, wxDefaultSize, 0 );
177 m_LayersSizer->Add( m_AdhesFrontName, 0, wxEXPAND | wxRIGHT, 5 );
178
180 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
181 wxDefaultPosition, wxDefaultSize, 0 );
182 m_AdhesFrontStaticText->Wrap( -1 );
183 m_LayersSizer->Add( m_AdhesFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
184
185 m_SoldPFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
186 wxDefaultPosition, wxDefaultSize, 0 );
187 m_SoldPFrontCheckBox->SetToolTip(
188 _( "If you want a solder paste layer for front side of the board" ) );
189
191 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
192
193 m_SoldPFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Paste ),
194 wxDefaultPosition, wxDefaultSize, 0 );
195 m_LayersSizer->Add( m_SoldPFrontName, 0, wxEXPAND | wxRIGHT, 5 );
196
198 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
199 wxDefaultPosition, wxDefaultSize, 0 );
200 m_SoldPFrontStaticText->Wrap( -1 );
201 m_LayersSizer->Add( m_SoldPFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
202
203 m_SilkSFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
204 wxDefaultPosition, wxDefaultSize, 0 );
205 m_SilkSFrontCheckBox->SetToolTip(
206 _( "If you want a silk screen layer for the front side of the board" ) );
207
209 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
210
211 m_SilkSFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_SilkS ),
212 wxDefaultPosition, wxDefaultSize, 0 );
213 m_LayersSizer->Add( m_SilkSFrontName, 0, wxEXPAND | wxRIGHT, 5 );
214
216 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
217 wxDefaultPosition, wxDefaultSize, 0 );
218 m_SilkSFrontStaticText->Wrap( -1 );
219 m_LayersSizer->Add( m_SilkSFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
220
221 m_MaskFrontCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
222 wxDefaultPosition, wxDefaultSize, 0 );
223 m_MaskFrontCheckBox->SetToolTip(
224 _( "If you want a solder mask layer for the front of the board" ) );
225
227 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
228
229 m_MaskFrontName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( F_Mask ),
230 wxDefaultPosition, wxDefaultSize, 0 );
231 m_LayersSizer->Add( m_MaskFrontName, 0, wxEXPAND | wxRIGHT, 5 );
232
234 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
235 wxDefaultPosition, wxDefaultSize, 0 );
236 m_MaskFrontStaticText->Wrap( -1 );
237 m_LayersSizer->Add( m_MaskFrontStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
238
240}
241
242
244{
245 m_MaskBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
246 wxDefaultPosition, wxDefaultSize, 0 );
247 m_MaskBackCheckBox->SetToolTip(
248 _( "If you want a solder mask layer for the back side of the board" ) );
249
251 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
252
253 m_MaskBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Mask ),
254 wxDefaultPosition, wxDefaultSize, 0 );
255 m_LayersSizer->Add( m_MaskBackName, 0, wxEXPAND | wxRIGHT, 5 );
256
258 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
259 wxDefaultPosition, wxDefaultSize, 0 );
260 m_MaskBackStaticText->Wrap( -1 );
261 m_LayersSizer->Add( m_MaskBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
262
263 m_SilkSBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
264 wxDefaultPosition, wxDefaultSize, 0 );
265 m_SilkSBackCheckBox->SetToolTip(
266 _( "If you want a silk screen layer for the back side of the board" ) );
267
269 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
270
271 m_SilkSBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_SilkS ),
272 wxDefaultPosition, wxDefaultSize, 0 );
273 m_LayersSizer->Add( m_SilkSBackName, 0, wxEXPAND | wxRIGHT, 5 );
274
276 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
277 wxDefaultPosition, wxDefaultSize, 0 );
278 m_SilkSBackStaticText->Wrap( -1 );
279 m_LayersSizer->Add( m_SilkSBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
280
281 m_SoldPBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
282 wxDefaultPosition, wxDefaultSize, 0 );
283 m_SoldPBackCheckBox->SetToolTip(
284 _( "If you want a solder paste layer for the back side of the board" ) );
285
287 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
288
289 m_SoldPBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Paste ),
290 wxDefaultPosition, wxDefaultSize, 0 );
291 m_LayersSizer->Add( m_SoldPBackName, 0, wxEXPAND | wxRIGHT, 5 );
292
294 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
295 wxDefaultPosition, wxDefaultSize, 0 );
296 m_SoldPBackStaticText->Wrap( -1 );
297 m_LayersSizer->Add( m_SoldPBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
298
299 m_AdhesBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
300 wxDefaultPosition, wxDefaultSize, 0 );
301 m_AdhesBackCheckBox->SetToolTip(
302 _( "If you want an adhesive layer for the back side of the board" ) );
303
305 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
306
307 m_AdhesBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Adhes ),
308 wxDefaultPosition, wxDefaultSize, 0 );
309 m_LayersSizer->Add( m_AdhesBackName, 0, wxEXPAND | wxRIGHT, 5 );
310
312 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "On-board, non-copper" ),
313 wxDefaultPosition, wxDefaultSize, 0 );
314 m_AdhesBackStaticText->Wrap( -1 );
315 m_LayersSizer->Add( m_AdhesBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
316
317 m_FabBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
318 wxDefaultPosition, wxDefaultSize, 0 );
319 m_FabBackCheckBox->SetToolTip(
320 _( "If you want a fabrication layer for the back side of the board" ) );
321
323 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
324
325 m_FabBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_Fab ),
326 wxDefaultPosition, wxDefaultSize, 0 );
327 m_LayersSizer->Add( m_FabBackName, 0, wxEXPAND | wxRIGHT, 5 );
328
330 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, manufacturing" ),
331 wxDefaultPosition, wxDefaultSize, 0 );
332 m_FabBackStaticText->Wrap( -1 );
333 m_LayersSizer->Add( m_FabBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
334
335
336 m_CrtYdBackCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
337 wxDefaultPosition, wxDefaultSize, 0 );
339 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT
340 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
341 5 );
342
343 m_CrtYdBackName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( B_CrtYd ),
344 wxDefaultPosition, wxDefaultSize, 0 );
345 m_LayersSizer->Add( m_CrtYdBackName, 0, wxEXPAND | wxRIGHT, 5 );
346
348 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Off-board, testing" ),
349 wxDefaultPosition, wxDefaultSize, 0 );
350 m_CrtYdBackStaticText->Wrap( -1 );
351 m_LayersSizer->Add( m_CrtYdBackStaticText, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5 );
352
353
354 m_PCBEdgesCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
355 wxDefaultPosition, wxDefaultSize, 0 );
357 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT
358 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
359 5 );
360
361 m_PCBEdgesName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Edge_Cuts ),
362 wxDefaultPosition, wxDefaultSize, 0 );
363 m_LayersSizer->Add( m_PCBEdgesName, 0, wxEXPAND | wxRIGHT, 5 );
364
366 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Board contour" ),
367 wxDefaultPosition, wxDefaultSize, 0 );
368 m_PCBEdgesStaticText->Wrap( -1 );
369 m_LayersSizer->Add( m_PCBEdgesStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
370
371 m_MarginCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
372 wxDefaultPosition, wxDefaultSize, 0 );
374 wxLEFT | wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL
375 | wxRESERVE_SPACE_EVEN_IF_HIDDEN,
376 5 );
377
378 m_MarginName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Margin ),
379 wxDefaultPosition, wxDefaultSize, 0 );
380 m_LayersSizer->Add( m_MarginName, 0, wxEXPAND | wxRIGHT, 5 );
381
383 new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Board contour setback" ),
384 wxDefaultPosition, wxDefaultSize, 0 );
385 m_MarginStaticText->Wrap( -1 );
386 m_LayersSizer->Add( m_MarginStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
387
388 m_Eco1CheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
389 wxDefaultPosition, wxDefaultSize, 0 );
391 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
392
393 m_Eco1Name = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Eco1_User ),
394 wxDefaultPosition, wxDefaultSize, 0 );
395 m_LayersSizer->Add( m_Eco1Name, 0, wxEXPAND | wxRIGHT, 5 );
396
397 m_Eco1StaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
398 wxDefaultPosition, wxDefaultSize, 0 );
399 m_Eco1StaticText->Wrap( -1 );
400 m_LayersSizer->Add( m_Eco1StaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
401
402 m_Eco2CheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
403 wxDefaultPosition, wxDefaultSize, 0 );
405 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
406
407 m_Eco2Name = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Eco2_User ),
408 wxDefaultPosition, wxDefaultSize, 0 );
409 m_LayersSizer->Add( m_Eco2Name, 0, wxEXPAND | wxRIGHT, 5 );
410
411 m_Eco2StaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
412 wxDefaultPosition, wxDefaultSize, 0 );
413 m_Eco2StaticText->Wrap( -1 );
414 m_LayersSizer->Add( m_Eco2StaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
415
416 m_CommentsCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
417 wxDefaultPosition, wxDefaultSize, 0 );
418 m_CommentsCheckBox->SetToolTip( _( "If you want a separate layer for comments or notes" ) );
419
421 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
422
423 m_CommentsName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Cmts_User ),
424 wxDefaultPosition, wxDefaultSize, 0 );
425 m_LayersSizer->Add( m_CommentsName, 0, wxEXPAND | wxRIGHT, 5 );
426
427 m_CommentsStaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
428 wxDefaultPosition, wxDefaultSize, 0 );
429 m_CommentsStaticText->Wrap( -1 );
430 m_LayersSizer->Add( m_CommentsStaticText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
431
432 m_DrawingsCheckBox = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString,
433 wxDefaultPosition, wxDefaultSize, 0 );
434 m_DrawingsCheckBox->SetToolTip( _( "If you want a layer for documentation drawings" ) );
435
437 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
438
439 m_DrawingsName = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( Dwgs_User ),
440 wxDefaultPosition, wxDefaultSize, 0 );
441 m_LayersSizer->Add( m_DrawingsName, 0, wxEXPAND | wxRIGHT, 5 );
442
443 m_DrawingsStaticText = new wxStaticText( m_LayersListPanel, wxID_ANY, _( "Auxiliary" ),
444 wxDefaultPosition, wxDefaultSize, 0 );
445 m_DrawingsStaticText->Wrap( -1 );
447 wxALIGN_CENTER_VERTICAL | wxBOTTOM | wxLEFT | wxRIGHT, 5 );
448
452}
453
454
456{
457 Freeze();
458 m_layersControls.clear();
459 m_LayersSizer->Clear( true );
467
468
469 LSET layers = m_enabledLayers;
470
471 for( auto it = layers.copper_layers_begin(); it != layers.copper_layers_end(); ++it )
472 {
473 wxCheckBox* cb = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
474 cb->SetToolTip( _( "Use the Physical Stackup page to change the number of copper layers." ) );
475 cb->Disable();
476
477 m_LayersSizer->Add( cb, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
478
479 wxTextCtrl* txt = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( *it ), wxDefaultPosition, wxDefaultSize, 0 );
480 txt->SetToolTip( _("Layer Name") );
481
482 m_LayersSizer->Add( txt, 0, wxEXPAND|wxRIGHT, 5 );
483
484 wxArrayString choices;
485 choices.Add( _( "signal" ) );
486 choices.Add( _( "power plane" ) );
487 choices.Add( _( "mixed" ) );
488 choices.Add( _( "jumper" ) );
489 wxChoice* choice = new wxChoice( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices, 0 );
490 choice->SetSelection( 0 );
491 choice->SetToolTip( _("Copper layer type for Freerouter and other external routers.\n"
492 "Power plane layers are removed from Freerouter's layer menus.") );
493
494 m_LayersSizer->Add( choice, 0, wxRIGHT|wxEXPAND, 5 );
495 m_layersControls[*it] = PANEL_SETUP_LAYERS_CTLs( txt, cb, choice );
496 }
497
511
512 layers &= LSET::UserDefinedLayersMask();
513
514 for( auto it = layers.non_copper_layers_begin(); it != layers.non_copper_layers_end(); ++it )
515 {
516 append_user_layer( *it );
517 }
518
519 Thaw();
520 m_LayersListPanel->FitInside(); // Updates virtual size to fit subwindows, also auto-layouts.
521}
522
523
525{
526 wxCheckBox* cb = new wxCheckBox( m_LayersListPanel, wxID_ANY, wxEmptyString, wxDefaultPosition,
527 wxDefaultSize, 0 );
528 m_LayersSizer->Add( cb, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
529
530 wxTextCtrl* txt = new wxTextCtrl( m_LayersListPanel, wxID_ANY, LayerName( aLayer ),
531 wxDefaultPosition, wxDefaultSize, 0 );
532 txt->SetToolTip( _( "Layer Name" ) );
533 m_LayersSizer->Add( txt, 0, wxEXPAND | wxRIGHT, 5 );
534
535 wxArrayString choices;
536 choices.Add( _( "Auxiliary" ) );
537 choices.Add( _( "Off-board, front" ) );
538 choices.Add( _( "Off-board, back" ) );
539
540 wxChoice* choice = new wxChoice( m_LayersListPanel, wxID_ANY, wxDefaultPosition,
541 wxDefaultSize, choices, 0 );
542 choice->SetSelection( 0 );
543 choice->SetToolTip(
544 _( "Auxiliary layers do not flip with board side, while back and front layers do." ) );
545
546 m_LayersSizer->Add( choice, 0, wxEXPAND | wxRIGHT, 5 );
547 m_layersControls[aLayer] = PANEL_SETUP_LAYERS_CTLs( txt, cb, choice );
548}
549
550
552{
553 return m_layersControls[aLayer].name;
554}
555
556
558{
559 return m_layersControls[aLayer].checkbox;
560}
561
562
564{
565 return dynamic_cast<wxChoice*>( m_layersControls[aLayer].choice );
566}
567
568
570{
572
573 // Rescue may be enabled, but should not be shown in this dialog
575
577
579
582
585
586 m_initialized = true;
587
588 return true;
589}
590
591
592void PANEL_SETUP_LAYERS::SyncCopperLayers( int aNumCopperLayers )
593{
594 BOARD* savedBoard = m_pcb;
595 BOARD temp;
596
597 m_pcb = &temp;
599
600 for( size_t ii = 0; ii < m_enabledLayers.size(); ii++ )
601 {
602 if( IsCopperLayer( int( ii ) ) )
604 }
605
606 m_enabledLayers |= LSET::AllCuMask( aNumCopperLayers );
607
609 setCopperLayerCheckBoxes( aNumCopperLayers );
610
613
616
617 m_pcb = savedBoard;
618}
619
620
622{
624
625 for( PCB_LAYER_ID layer : layers )
626 setLayerCheckBox( layer, m_pcb->IsLayerEnabled( layer ) );
627}
628
629
631{
632 // Set all the board's layer names into the dialog by calling BOARD::LayerName(),
633 // which will call BOARD::GetStandardLayerName() for non-coppers.
634
635 for( PCB_LAYER_ID layer : m_enabledLayers )
636 {
637 wxControl* ctl = getName( layer );
638
639 if( ctl )
640 {
641 wxString lname = m_pcb->GetLayerName( layer );
642
643 if( auto textCtl = dynamic_cast<wxTextCtrl*>( ctl ) )
644 textCtl->ChangeValue( lname ); // wxTextCtrl
645 else
646 ctl->SetLabel( lname ); // wxStaticText
647 }
648 }
649}
650
651
653{
654 for( auto& [layer,ctl] : m_layersControls )
655 setLayerCheckBox( layer, enabledLayers.test( layer ) );
656}
657
658
660{
662
663 for( PCB_LAYER_ID cu_layer : m_enabledLayers.CuStack() )
664 {
665 wxChoice* ctl = getChoice( cu_layer );
666
667 switch ( m_pcb->GetLayerType( cu_layer ) )
668 {
669 case LT_SIGNAL: ctl->SetSelection( 0 ); break;
670 case LT_POWER: ctl->SetSelection( 1 ); break;
671 case LT_MIXED: ctl->SetSelection( 2 ); break;
672 case LT_JUMPER: ctl->SetSelection( 3 ); break;
673 default: ctl->SetSelection( 0 );
674 }
675
676 }
677
679
680 for( PCB_LAYER_ID layer : layers )
681 {
682 wxChoice* ctl = getChoice( layer );
683
684 switch( m_pcb->GetLayerType( layer ) )
685 {
686 case LT_AUX: ctl->SetSelection( 0 ); break;
687 case LT_FRONT: ctl->SetSelection( 1 ); break;
688 case LT_BACK: ctl->SetSelection( 2 ); break;
689 default: ctl->SetSelection( 0 ); break;
690 }
691 }
692}
693
694
696{
697 LSET layerMaskResult;
698
699 for( auto& [layer, _] : m_layersControls )
700 {
701 wxCheckBox* ctl = getCheckBox( layer );
702
703 if( ctl && ctl->IsChecked() )
704 layerMaskResult.set( layer );
705 }
706
707 return layerMaskResult;
708}
709
710
712{
714
715 if( !ctl.checkbox )
716 return;
717
718 ctl.checkbox->SetValue( isChecked );
719}
720
721
723{
724 if( copperCount > 0 )
725 {
726 wxCheckBox* fcu = getCheckBox( F_Cu );
727 mandatoryLayerCbSetup( *fcu );
728 }
729
730 if( copperCount > 0 )
731 {
732 wxCheckBox* bcu = getCheckBox( B_Cu );
733 mandatoryLayerCbSetup( *bcu );
734 }
735
736 LSET layers = m_enabledLayers & LSET::AllCuMask( copperCount );
737 layers.reset( F_Cu );
738 layers.reset( B_Cu );
739
740 for( PCB_LAYER_ID layer : layers )
741 {
742 wxCheckBox* cb = getCheckBox( layer );
744 }
745
746}
747
748
750{
751 bool modified = false;
752 LSET enabledLayers = GetUILayerMask();
753
754 LSET previousEnabled = m_pcb->GetEnabledLayers();
755
756 if( enabledLayers != previousEnabled )
757 {
758 m_pcb->SetEnabledLayers( enabledLayers );
759
760 LSET changedLayers = enabledLayers ^ previousEnabled;
761
762 /*
763 * Ensure enabled layers are also visible. This is mainly to avoid mistakes if some
764 * enabled layers are not visible when exiting this dialog.
765 */
766 m_pcb->SetVisibleLayers( m_pcb->GetVisibleLayers() | changedLayers );
767
768 /*
769 * Ensure items with through holes have all inner copper layers. (For historical reasons
770 * this is NOT trimmed to the currently-enabled inner layers.)
771 */
772 for( FOOTPRINT* fp : m_pcb->Footprints() )
773 {
774 for( PAD* pad : fp->Pads() )
775 {
776 if( pad->HasHole() && pad->IsOnCopperLayer() )
777 pad->SetLayerSet( pad->GetLayerSet() | LSET::InternalCuMask() );
778 }
779 }
780
781 // Tracks do not change their layer
782 // Vias layers are defined by the starting layer and the ending layer, so
783 // they are not modified by adding a layer.
784 // So do nothing for tracks/vias
785
786 modified = true;
787 }
788
789 for( PCB_LAYER_ID layer : enabledLayers )
790 {
791 wxString newLayerName = getName( layer )->GetValue();
792
793 if( m_pcb->GetLayerName( layer ) != newLayerName )
794 {
795 m_pcb->SetLayerName( layer, newLayerName );
796 modified = true;
797 }
798
799 if( IsCopperLayer( layer ) )
800 {
801 LAYER_T t;
802
803 switch( getChoice( layer )->GetCurrentSelection() )
804 {
805 case 0: t = LT_SIGNAL; break;
806 case 1: t = LT_POWER; break;
807 case 2: t = LT_MIXED; break;
808 case 3: t = LT_JUMPER; break;
809 default: t = LT_UNDEFINED; break;
810 }
811
812 if( m_pcb->GetLayerType( layer ) != t )
813 {
814 m_pcb->SetLayerType( layer, t );
815 modified = true;
816 }
817 }
818 else if( layer >= User_1 && !IsCopperLayer( layer ) )
819 {
820 LAYER_T t;
821
822 switch( getChoice( layer )->GetCurrentSelection() )
823 {
824 case 0: t = LT_AUX; break;
825 case 1: t = LT_FRONT; break;
826 case 2: t = LT_BACK; break;
827 default: t = LT_UNDEFINED; break;
828 }
829
830 if( m_pcb->GetLayerType( layer ) != t )
831 {
832 m_pcb->SetLayerType( layer, t );
833 modified = true;
834 }
835 }
836 }
837
838 LSET layers = enabledLayers & LSET::UserDefinedLayersMask();
839
840 for( PCB_LAYER_ID layer : layers )
841 {
842 wxString newLayerName = getName( layer )->GetValue();
843
844 if( m_pcb->GetLayerName( layer ) != newLayerName )
845 {
846 m_pcb->SetLayerName( layer, newLayerName );
847 modified = true;
848 }
849 }
850
851 return modified;
852}
853
854
856{
857 if( !testLayerNames() )
858 return false;
859
860 // Make sure we have the latest copper layer count
863
864 wxString msg;
865 bool modified = false;
866 wxWindow* parent = wxGetTopLevelParent( this );
867
868 // Check for removed layers with items which will get deleted from the board.
869 LSEQ removedLayers = getRemovedLayersWithItems();
870
871 // Check for non-copper layers in use in footprints, and therefore not removable.
872 LSEQ notremovableLayers = getNonRemovableLayers();
873
874 if( !notremovableLayers.empty() )
875 {
876 for( PCB_LAYER_ID layer : notremovableLayers )
877 msg << m_pcb->GetLayerName( layer ) << wxT( "\n" );
878
879 if( !IsOK( parent, wxString::Format( _( "Footprints have some items on removed layers:\n"
880 "%s\n"
881 "These items will be no longer accessible\n"
882 "Do you wish to continue?" ),
883 msg ) ) )
884 {
885 return false;
886 }
887 }
888
889 if( !removedLayers.empty() )
890 {
891 if( !IsOK( parent, _( "Items have been found on removed layers. This operation will "
892 "delete all items from removed layers and cannot be undone.\n"
893 "Do you wish to continue?" ) ) )
894 {
895 return false;
896 }
897 }
898
899 // Delete all objects on layers that have been removed. Leaving them in copper layers
900 // can (will?) result in DRC errors and it pollutes the board file with cruft.
901 bool hasRemovedBoardItemLayers = false;
902
903 if( !removedLayers.empty() )
904 {
906
907 PCB_LAYER_COLLECTOR collector;
908
909 for( PCB_LAYER_ID layer_id : removedLayers )
910 {
911 collector.SetLayerId( layer_id );
913
914 // Bye-bye items on removed layer.
915 for( int i = 0; i < collector.GetCount(); i++ )
916 {
917 BOARD_ITEM* item = collector[i];
918
919 // Do not remove/change an item owned by a footprint
920 if( item->GetParentFootprint() )
921 continue;
922
923 // Do not remove footprints
924 if( item->Type() == PCB_FOOTPRINT_T )
925 continue;
926
927 // Note: vias are specific. They are only on copper layers, and
928 // do not use a layer set, only store the copper top and the copper bottom.
929 // So reinit the layer set does not work with vias
930 if( item->Type() == PCB_VIA_T )
931 {
932 PCB_VIA* via = static_cast<PCB_VIA*>( item );
933
934 if( via->GetViaType() == VIATYPE::THROUGH )
935 {
936 hasRemovedBoardItemLayers = true;
937 continue;
938 }
939 else if( via->IsOnLayer( layer_id ) )
940 {
941 PCB_LAYER_ID top_layer;
942 PCB_LAYER_ID bottom_layer;
943 via->LayerPair( &top_layer, &bottom_layer );
944
945 if( top_layer == layer_id || bottom_layer == layer_id )
946 {
947 // blind/buried vias with a top or bottom layer on a removed layer
948 // are removed. Perhaps one could just modify the top/bottom layer,
949 // but I am not sure this is better.
950 m_pcb->Remove( item );
951 delete item;
952 modified = true;
953 }
954
955 hasRemovedBoardItemLayers = true;
956 }
957 }
958 else if( item->IsOnLayer( layer_id ) )
959 {
960 LSET layers = item->GetLayerSet();
961
962 layers.reset( layer_id );
963
964 if( layers.any() )
965 {
966 item->SetLayerSet( layers );
967 }
968 else
969 {
970 m_pcb->Remove( item );
971 delete item;
972 modified = true;
973 }
974
975 hasRemovedBoardItemLayers = true;
976 }
977 }
978 }
979
980 // Undo state may have copies of pointers deleted above
982 }
983
984 modified |= transferDataFromWindow();
985
986 // If some board items are deleted: Rebuild the connectivity, because it is likely some
987 // tracks and vias were removed
988 if( hasRemovedBoardItemLayers )
990
991 if( modified )
992 m_frame->OnModify();
993
994 return true;
995}
996
997
999{
1000 std::vector<wxString> names;
1001 wxTextCtrl* ctl;
1002
1003 for( PCB_LAYER_ID layer : LSET::AllLayersMask() )
1004 {
1005 // we _can_ rely on m_enabledLayers being current here:
1006
1007 if( !m_enabledLayers[layer] )
1008 continue;
1009
1010 ctl = (wxTextCtrl*) getName( layer );
1011 wxString name = ctl->GetValue();
1012
1013 // Check name for legality:
1014 // 1) Cannot be blank.
1015 // 2) Cannot have blanks.
1016 // 3) Cannot have " chars
1017 // 4) Cannot be 'signal'
1018 // 5) Must be unique.
1019 // 6) Cannot have illegal chars in filenames ( some filenames are built from layer names )
1020 // like : % $ \ " / :
1021 wxString badchars = wxFileName::GetForbiddenChars( wxPATH_DOS );
1022 badchars.Append( '%' );
1023
1024 if( !name )
1025 {
1026 PAGED_DIALOG::GetDialog( this )->SetError( _( "Layer must have a name." ), this, ctl );
1027 return false;
1028 }
1029
1030 if( name.find_first_of( badchars ) != wxString::npos )
1031 {
1032 wxString msg = wxString::Format(_( "%s are forbidden in layer names." ), badchars );
1033 PAGED_DIALOG::GetDialog( this )->SetError( msg, this, ctl );
1034 return false;
1035 }
1036
1037 if( name == wxT( "signal" ) )
1038 {
1039 PAGED_DIALOG::GetDialog( this )->SetError( _( "Layer name \"signal\" is reserved." ), this, ctl );
1040 return false;
1041 }
1042
1043 for( const wxString& existingName : names )
1044 {
1045 if( name == existingName )
1046 {
1047 wxString msg = wxString::Format(_( "Layer name '%s' already in use." ), name );
1048 PAGED_DIALOG::GetDialog( this )->SetError( msg, this, ctl );
1049 return false;
1050 }
1051 }
1052
1053 names.push_back( name );
1054 }
1055
1056 return true;
1057}
1058
1059
1061{
1062 LSEQ removedLayers;
1063 LSET newLayers = GetUILayerMask();
1064 LSET curLayers = m_pcb->GetEnabledLayers();
1065
1066 if( newLayers == curLayers ) // Return an empty list if no change
1067 return removedLayers;
1068
1069 PCB_LAYER_COLLECTOR collector;
1070
1071 for( PCB_LAYER_ID layer_id : curLayers )
1072 {
1073 if( !newLayers[layer_id] )
1074 {
1075 collector.SetLayerId( layer_id );
1077
1078 if( collector.GetCount() != 0 )
1079 {
1080 // Skip items owned by footprints and footprints when building
1081 // the actual list of removed layers: these items are not removed
1082 for( int i = 0; i < collector.GetCount(); i++ )
1083 {
1084 BOARD_ITEM* item = collector[i];
1085
1086 if( item->Type() == PCB_FOOTPRINT_T || item->GetParentFootprint() )
1087 continue;
1088
1089 // Vias are on multiple adjacent layers, but only the top and
1090 // the bottom layers are stored. So there are issues only if one
1091 // is on a removed layer
1092 if( item->Type() == PCB_VIA_T )
1093 {
1094 PCB_VIA* via = static_cast<PCB_VIA*>( item );
1095
1096 if( via->GetViaType() == VIATYPE::THROUGH )
1097 continue;
1098 else
1099 {
1100 PCB_LAYER_ID top_layer;
1101 PCB_LAYER_ID bottom_layer;
1102 via->LayerPair( &top_layer, &bottom_layer );
1103
1104 if( top_layer != layer_id && bottom_layer != layer_id )
1105 continue;
1106 }
1107 }
1108
1109 removedLayers.push_back( layer_id );
1110 break;
1111 }
1112 }
1113 }
1114 }
1115
1116 return removedLayers;
1117}
1118
1119
1121{
1122 // Build the list of non-copper layers in use in footprints.
1123 LSEQ inUseLayers;
1124 LSET newLayers = GetUILayerMask();
1125 LSET curLayers = m_pcb->GetEnabledLayers();
1126
1127 if( newLayers == curLayers ) // Return an empty list if no change
1128 return inUseLayers;
1129
1130 PCB_LAYER_COLLECTOR collector;
1131
1132 for( PCB_LAYER_ID layer_id : curLayers )
1133 {
1134 if( IsCopperLayer( layer_id ) ) // Copper layers are not taken into account here
1135 continue;
1136
1137 if( !newLayers.Contains( layer_id ) )
1138 {
1139 collector.SetLayerId( layer_id );
1141
1142 if( collector.GetCount() != 0 )
1143 inUseLayers.push_back( layer_id );
1144 }
1145 }
1146
1147 return inUseLayers;
1148}
1149
1150
1152{
1153 BOARD* savedBoard = m_pcb;
1154
1155 m_pcb = aBoard;
1157
1158 m_pcb = savedBoard;
1159}
1160
1161
1162bool PANEL_SETUP_LAYERS::CheckCopperLayerCount( BOARD* aWorkingBoard, BOARD* aImportedBoard )
1163{
1164 /*
1165 * This function warns users if they are going to delete inner copper layers because
1166 * they're importing settings from a board with less copper layers than the board
1167 * already loaded. We want to return "true" as default on the assumption no layer will
1168 * actually be deleted.
1169 */
1170 bool okToDeleteCopperLayers = true;
1171
1172 // Get the number of copper layers in the loaded board and the "import settings" board
1173 int currNumLayers = aWorkingBoard->GetCopperLayerCount();
1174 int newNumLayers = aImportedBoard->GetCopperLayerCount();
1175
1176 if( newNumLayers < currNumLayers )
1177 {
1178 wxString msg = wxString::Format( _( "Imported settings have fewer copper layers than "
1179 "the current board (%i instead of %i).\n\n"
1180 "Continue and delete the extra inner copper layers "
1181 "from the current board?" ),
1182 newNumLayers,
1183 currNumLayers );
1184
1185 wxWindow* topLevelParent = wxGetTopLevelParent( this );
1186
1187 wxMessageDialog dlg( topLevelParent, msg, _( "Inner Layers to Be Deleted" ),
1188 wxICON_WARNING | wxSTAY_ON_TOP | wxYES | wxNO | wxNO_DEFAULT );
1189
1190 if( wxID_ANY == dlg.ShowModal() )
1191 okToDeleteCopperLayers = false;
1192 }
1193
1194 return okToDeleteCopperLayers;
1195}
1196
1197
1198void PANEL_SETUP_LAYERS::addUserDefinedLayer( wxCommandEvent& aEvent )
1199{
1200 wxArrayString headers;
1201 headers.Add( _( "Layers" ) );
1202
1203 // Build the available user-defined layers list:
1204 std::vector<wxArrayString> list;
1205
1206 for( PCB_LAYER_ID layer : LSET::UserDefinedLayersMask().Seq() )
1207 {
1208 wxCheckBox* checkBox = getCheckBox( layer );
1209
1210 if( checkBox && checkBox->IsShown() )
1211 continue;
1212
1213 wxArrayString available_user_layer;
1214 available_user_layer.Add( LayerName( layer ) );
1215
1216 list.emplace_back( available_user_layer );
1217 }
1218
1219 if( list.empty() )
1220 {
1222 _( "All user-defined layers have already been added." ) );
1223 return;
1224 }
1225
1226 EDA_LIST_DIALOG dlg( PAGED_DIALOG::GetDialog( this ), _( "Add User-defined Layer" ),
1227 headers, list );
1228 dlg.SetListLabel( _( "Select layer to add:" ) );
1229 dlg.HideFilter();
1230
1231 if( dlg.ShowModal() == wxID_ANY || dlg.GetTextSelection().IsEmpty() )
1232 return;
1233
1235
1236 for( PCB_LAYER_ID layer2 : LSET::UserDefinedLayersMask().Seq() )
1237 {
1238 if( LayerName( layer2 ) == dlg.GetTextSelection() )
1239 {
1240 layer = layer2;
1241 break;
1242 }
1243 }
1244
1245 wxCHECK( layer >= User_1, /* void */ );
1246
1247 m_enabledLayers.set( layer );
1248 append_user_layer( layer );
1249
1251
1252 // All user-defined layers should have a checkbox
1253 wxASSERT( ctl.checkbox );
1254 ctl.checkbox->SetValue( true );
1255
1256 wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( ctl.name );
1257
1258 wxCHECK( textCtrl, /* void */ );
1259 textCtrl->ChangeValue( LSET::Name( layer ) );
1260
1261 wxChoice* userLayerType = dynamic_cast<wxChoice*>( ctl.choice );
1262
1263 wxCHECK( userLayerType, /* void */ );
1264 userLayerType->SetSelection( 0 );
1265
1266 ctl.name->Show( true );
1267 ctl.checkbox->Show( true );
1268 ctl.choice->Show( true );
1269
1270 wxSizeEvent evt_size( m_LayersListPanel->GetSize() );
1271 m_LayersListPanel->GetEventHandler()->ProcessEvent( evt_size );
1272}
1273
1274
const char * name
Definition: DXF_plotter.cpp:62
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
Definition: board.h:180
@ LT_POWER
Definition: board.h:183
@ LT_FRONT
Definition: board.h:187
@ LT_MIXED
Definition: board.h:184
@ LT_BACK
Definition: board.h:188
@ LT_UNDEFINED
Definition: board.h:181
@ LT_JUMPER
Definition: board.h:185
@ LT_AUX
Definition: board.h:186
@ LT_SIGNAL
Definition: board.h:182
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: actions.h:221
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:79
virtual void SetLayerSet(const LSET &aLayers)
Definition: board_item.h:260
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
Definition: board_item.h:314
FOOTPRINT * GetParentFootprint() const
Definition: board_item.cpp:97
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:252
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:317
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:939
const LSET & GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:921
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:186
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:933
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
Definition: board.cpp:730
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition: board.cpp:698
int GetCopperLayerCount() const
Definition: board.cpp:859
const FOOTPRINTS & Footprints() const
Definition: board.h:358
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
Definition: board.cpp:749
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:680
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:907
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: board.cpp:1310
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:927
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:83
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: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:238
static const std::vector< KICAD_T > FootprintItems
A scan list for primary footprint items.
Definition: collectors.h:253
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:913
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
Definition: lset.cpp:246
copper_layers_iterator copper_layers_begin() const
Definition: lset.cpp:907
non_copper_layers_iterator non_copper_layers_begin() const
Definition: lset.cpp:919
non_copper_layers_iterator non_copper_layers_end() const
Definition: lset.cpp:925
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: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
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: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.
Definition: collectors.cpp:559
void SetLayerId(PCB_LAYER_ID aLayerId)
Definition: collectors.h:555
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:251
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:665
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_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