KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_footprint_properties_fp_editor.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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2015 Dick Hollenbeck, [email protected]
6 * Copyright (C) 2008 Wayne Stambaugh <[email protected]>
7 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
24
25#include <wx/debug.h>
26#include <wx/tokenzr.h>
27
30#include <bitmaps.h>
31#include <board.h>
32#include <board_commit.h>
34#include <confirm.h>
35#include <core/kicad_algo.h>
36
39#include <embedded_files.h>
40#include <filename_resolver.h>
41#include <footprint.h>
43#include <pad.h>
46#include <layer_utils.h>
47#include <kiplatform/ui.h>
50#include <pgm_base.h>
52#include <template_fieldnames.h>
53#include <tool/tool_manager.h>
54#include <tools/pcb_actions.h>
56#include <validators.h>
60#include <widgets/wx_grid.h>
61#include <zone.h>
62
64#include <project_pcb.h>
65#include <kidialog.h>
66
67
68class LAYERS_GRID_TABLE : public WX_GRID_TABLE_BASE, public std::vector<PCB_LAYER_ID>
69{
70public:
71 LAYERS_GRID_TABLE( PCB_BASE_FRAME* aFrame, const LSET& aForbiddenLayers );
73
74 int GetNumberRows() override { return (int) size(); }
75 int GetNumberCols() override { return 1; }
76
77 bool CanGetValueAs( int aRow, int aCol, const wxString& aTypeName ) override;
78 bool CanSetValueAs( int aRow, int aCol, const wxString& aTypeName ) override;
79 wxGridCellAttr* GetAttr( int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind ) override;
80
81 wxString GetValue( int aRow, int aCol ) override;
82 long GetValueAsLong( int aRow, int aCol ) override;
83
84 void SetValue( int aRow, int aCol, const wxString& aValue ) override;
85 void SetValueAsLong( int aRow, int aCol, long aValue ) override;
86
87private:
89 wxGridCellAttr* m_layerColAttr;
90};
91
92
93LAYERS_GRID_TABLE::LAYERS_GRID_TABLE( PCB_BASE_FRAME* aFrame, const LSET& aForbiddenLayers ) :
94 m_frame( aFrame )
95{
96 m_layerColAttr = new wxGridCellAttr;
97 m_layerColAttr->SetRenderer( new GRID_CELL_LAYER_RENDERER( m_frame ) );
98
99 m_layerColAttr->SetEditor( new GRID_CELL_LAYER_SELECTOR( m_frame, aForbiddenLayers, true ) );
100}
101
102
107
108
109bool LAYERS_GRID_TABLE::CanGetValueAs( int aRow, int aCol, const wxString& aTypeName )
110{
111 return aTypeName == wxGRID_VALUE_NUMBER;
112}
113
114
115bool LAYERS_GRID_TABLE::CanSetValueAs( int aRow, int aCol, const wxString& aTypeName )
116{
117 return aTypeName == wxGRID_VALUE_NUMBER;
118}
119
120
121wxGridCellAttr* LAYERS_GRID_TABLE::GetAttr( int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind )
122{
123 m_layerColAttr->IncRef();
124 return enhanceAttr( m_layerColAttr, aRow, aCol, aKind );
125}
126
127
128wxString LAYERS_GRID_TABLE::GetValue( int aRow, int aCol )
129{
130 return m_frame->GetBoard()->GetLayerName( this->at( (size_t) aRow ) );
131}
132
133
134long LAYERS_GRID_TABLE::GetValueAsLong( int aRow, int aCol )
135{
136 return this->at( (size_t) aRow );
137}
138
139
140void LAYERS_GRID_TABLE::SetValue( int aRow, int aCol, const wxString& aValue )
141{
142 wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a string value" ), aCol ) );
143}
144
145
146void LAYERS_GRID_TABLE::SetValueAsLong( int aRow, int aCol, long aValue )
147{
148 this->at( (size_t) aRow ) = ToLAYER_ID( (int) aValue );
149}
150
151
152// Remember the last open page during session.
153
155
156
158 FOOTPRINT* aFootprint ) :
160 m_frame( aParent ),
161 m_footprint( aFootprint ),
162 m_initialized( false ),
166{
167 SetEvtHandlerEnabled( false );
168
169 // Create the extra panels.
172
173 m_NoteBook->AddPage( m_3dPanel, _("3D Models"), false );
174 m_NoteBook->AddPage( m_embeddedFiles, _( "Embedded Files" ) );
175
176 m_fields = new PCB_FIELDS_GRID_TABLE( m_frame, this, { m_embeddedFiles->GetLocalFiles() } );
177
178 {
179 LSET forbiddenLayers = LSET::AllCuMask() | LSET::AllTechMask();
180 forbiddenLayers.set( Edge_Cuts );
181 forbiddenLayers.set( Margin );
182
183 m_privateLayers = new LAYERS_GRID_TABLE( m_frame, forbiddenLayers );
184 }
185
186 {
187 LSET forbiddenLayers = LSET::AllLayersMask() & ~LSET::UserDefinedLayersMask();
188 m_customUserLayers = new LAYERS_GRID_TABLE( m_frame, forbiddenLayers );
189 }
190
191 m_delayedErrorMessage = wxEmptyString;
192 m_delayedFocusCtrl = nullptr;
193 m_delayedFocusGrid = nullptr;
197
198 // Give an icon
199 wxIcon icon;
200 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit ) );
201 SetIcon( icon );
202
203 m_itemsGrid->SetTable( m_fields );
204 m_itemsGrid->OverrideMinSize( 1.0, 1.0 );
207
208 m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
209 m_itemsGrid->Bind( wxEVT_GRID_CELL_CHANGING, &DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnGridCellChanging, this );
211 [this]( wxCommandEvent& aEvent )
212 {
213 OnAddPrivateLayer( aEvent );
214 } ) );
215 m_nettieGroupsGrid->PushEventHandler( new GRID_TRICKS( m_nettieGroupsGrid,
216 [this]( wxCommandEvent& aEvent )
217 {
218 OnAddNettieGroup( aEvent );
219 } ) );
220 m_jumperGroupsGrid->PushEventHandler( new GRID_TRICKS( m_jumperGroupsGrid,
221 [this]( wxCommandEvent& aEvent )
222 {
223 OnAddJumperGroup( aEvent );
224 } ) );
226 [this]( wxCommandEvent& aEvent )
227 {
228 OnAddCustomLayer( aEvent );
229 } ) );
230
231 m_itemsGrid->SetupColumnAutosizer( PFC_VALUE );
232 m_privateLayersGrid->SetupColumnAutosizer( 0 );
233 m_nettieGroupsGrid->SetupColumnAutosizer( 0 );
234 m_jumperGroupsGrid->SetupColumnAutosizer( 0 );
235 m_customUserLayersGrid->SetupColumnAutosizer( 0 );
236
237 m_itemsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
238 m_privateLayersGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
239 m_nettieGroupsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
240 m_jumperGroupsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
241 m_customUserLayersGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
242
243 m_itemsGrid->ShowHideColumns( "0 1 2 3 4 5 7" );
244
246
247 // Set font sizes
248 wxFont infoFont = KIUI::GetInfoFont( this ).Italic();
249 m_staticTextInfoCopper->SetFont( infoFont );
250 m_staticTextInfoPaste->SetFont( infoFont );
251
252 if( static_cast<int>( m_page ) >= 0 )
253 m_NoteBook->SetSelection( (unsigned) m_page );
254
256 {
261 }
263 {
265 }
266
267 // Update label text and tooltip for combined offset + ratio field
268 m_SolderPasteMarginLabel->SetLabel( _( "Solder paste clearance:" ) );
269 m_SolderPasteMarginLabel->SetToolTip( _( "Local solder paste clearance for this footprint.\n"
270 "Enter an absolute value (e.g., -0.1mm), a percentage "
271 "(e.g., -5%), or both (e.g., -0.1mm - 5%).\n"
272 "If blank, the global value is used." ) );
273
274 // Hide the old ratio controls - they're no longer needed
275 m_PasteMarginRatioLabel->Show( false );
276 m_PasteMarginRatioCtrl->Show( false );
277 m_PasteMarginRatioUnits->Show( false );
278
279 // Configure button logos
290
292
294 SetEvtHandlerEnabled( true );
295}
296
297
299{
300 m_itemsGrid->Unbind( wxEVT_GRID_CELL_CHANGING, &DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnGridCellChanging, this );
301
302 // Prevents crash bug in wxGrid's d'tor
303 m_itemsGrid->DestroyTable( m_fields );
304 m_privateLayersGrid->DestroyTable( m_privateLayers );
306
307 // Delete the GRID_TRICKS.
308 m_itemsGrid->PopEventHandler( true );
309 m_privateLayersGrid->PopEventHandler( true );
310 m_nettieGroupsGrid->PopEventHandler( true );
311 m_jumperGroupsGrid->PopEventHandler( true );
312 m_customUserLayersGrid->PopEventHandler( true );
313
314 m_page = static_cast<NOTEBOOK_PAGES>( m_NoteBook->GetSelection() );
315
316 // the GL canvas on the 3D models page has to be visible before it is destroyed
317 m_NoteBook->SetSelection( static_cast<int>( NOTEBOOK_PAGES::PAGE_3D_MODELS ) );
318}
319
320
322{
323 if( !wxDialog::TransferDataToWindow() )
324 return false;
325
326 if( !m_embeddedFiles->CommitPendingChanges() )
327 return false;
328
329 if( !m_PanelGeneral->TransferDataToWindow() )
330 return false;
331
332 if( !m_3dPanel->Validate() )
333 return false;
334
335 LIB_ID fpID = m_footprint->GetFPID();
336 wxString footprintName = fpID.GetLibItemName();
337
338 m_FootprintNameCtrl->ChangeValue( footprintName );
339
340 m_DocCtrl->SetValue( EscapeString( m_footprint->GetLibDescription(), CTX_LINE ) );
341 m_KeywordCtrl->SetValue( m_footprint->GetKeywords() );
342
343 // Add the models to the panel
344 (void) m_3dPanel->TransferDataToWindow();
345
346 (void) m_embeddedFiles->TransferDataToWindow();
347
348 // Footprint Fields
349 for( PCB_FIELD* field : m_footprint->GetFields() )
350 {
351 wxCHECK2( field, continue );
352
353 m_fields->push_back( *field );
354 }
355
356 // Notify the grid
357 wxGridTableMessage tmsg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->GetNumberRows() );
358 m_itemsGrid->ProcessTableMessage( tmsg );
359
360 if( m_footprint->GetAttributes() & FP_THROUGH_HOLE )
361 m_componentType->SetSelection( 0 );
362 else if( m_footprint->GetAttributes() & FP_SMD )
363 m_componentType->SetSelection( 1 );
364 else
365 m_componentType->SetSelection( 2 );
366
367 // Private layers
368 for( PCB_LAYER_ID privateLayer : m_footprint->GetPrivateLayers().UIOrder() )
369 m_privateLayers->push_back( privateLayer );
370
371 // Notify the grid
372 wxGridTableMessage gridTableMessagesg( m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
373 m_privateLayers->GetNumberRows() );
374 m_privateLayersGrid->ProcessTableMessage( gridTableMessagesg );
375
376 switch( m_footprint->GetStackupMode() )
377 {
379 {
380 m_cbCustomLayers->SetValue( false );
381
382 m_copperLayerCount->SetSelection( 0 );
383 break;
384 }
386 {
387 m_cbCustomLayers->SetValue( true );
388
389 const LSET& customFpLayers = m_footprint->GetStackupLayers();
390 const LSET customUserLayers = customFpLayers & LSET::UserDefinedLayersMask();
391
392 for( PCB_LAYER_ID customUserLayer : customUserLayers )
393 {
394 m_customUserLayers->push_back( customUserLayer );
395 }
396
397 // Set the number of copper layers
398 m_copperLayerCount->SetSelection( ( customFpLayers & LSET::AllCuMask() ).count() / 2 - 1 );
399 break;
400 }
401 }
403
404 // Notify the grid
405 {
406 wxGridTableMessage gridTableMessagesCustom( m_customUserLayers, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
407 m_customUserLayers->GetNumberRows() );
408 m_customUserLayersGrid->ProcessTableMessage( gridTableMessagesCustom );
409 }
410
411 m_boardOnly->SetValue( m_footprint->GetAttributes() & FP_BOARD_ONLY );
412 m_cbExcludeFromSim->SetValue( m_footprint->GetAttributes() & FP_EXCLUDE_FROM_SIM );
413 m_excludeFromPosFiles->SetValue( m_footprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES );
414 m_excludeFromBOM->SetValue( m_footprint->GetAttributes() & FP_EXCLUDE_FROM_BOM );
415 m_cbDNP->SetValue( m_footprint->GetAttributes() & FP_DNP );
416
417 // Local Clearances
418
419 if( m_footprint->GetLocalClearance().has_value() )
420 m_netClearance.SetValue( m_footprint->GetLocalClearance().value() );
421 else
422 m_netClearance.SetValue( wxEmptyString );
423
424 if( m_footprint->GetLocalSolderMaskMargin().has_value() )
425 m_solderMask.SetValue( m_footprint->GetLocalSolderMaskMargin().value() );
426 else
427 m_solderMask.SetValue( wxEmptyString );
428
429 m_solderPaste.SetOffsetValue( m_footprint->GetLocalSolderPasteMargin() );
430 m_solderPaste.SetRatioValue( m_footprint->GetLocalSolderPasteMarginRatio() );
431
432 m_noCourtyards->SetValue( m_footprint->AllowMissingCourtyard() );
433 m_allowBridges->SetValue( m_footprint->AllowSolderMaskBridges() );
434
435 switch( m_footprint->GetLocalZoneConnection() )
436 {
437 default:
438 case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
439 case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
440 case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
441 case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
442 }
443
444 for( const wxString& group : m_footprint->GetNetTiePadGroups() )
445 {
446 if( !group.IsEmpty() )
447 {
448 m_nettieGroupsGrid->AppendRows( 1 );
449 m_nettieGroupsGrid->SetCellValue( m_nettieGroupsGrid->GetNumberRows() - 1, 0, group );
450 }
451 }
452
453 m_cbDuplicatePadsAreJumpers->SetValue( m_footprint->GetDuplicatePadNumbersAreJumpers() );
454
455 for( const JUMPER_GROUP& group : m_footprint->JumperPadGroups().GetAll() )
456 {
457 wxString groupTxt;
458
459 for( const wxString& pinNumber : group.GetNames() )
460 {
461 if( !groupTxt.IsEmpty() )
462 groupTxt << ", ";
463
464 groupTxt << pinNumber;
465 }
466
467 m_jumperGroupsGrid->AppendRows( 1 );
468 m_jumperGroupsGrid->SetCellValue( m_jumperGroupsGrid->GetNumberRows() - 1, 0, groupTxt );
469 }
470
471 // Items grid
472 for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
473 {
474 // Adjust min size to the column label size
475 m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false ) );
476 // Adjust the column size.
477 int col_size = m_itemsGrid->GetVisibleWidth( col );
478
479 if( col == PFC_LAYER ) // This one's a drop-down. Check all possible values.
480 {
481 BOARD* board = m_footprint->GetBoard();
482
483 for( PCB_LAYER_ID layer : board->GetEnabledLayers() )
484 col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
485
486 // Swatch and gaps:
487 col_size += KiROUND( 14 * GetDPIScaleFactor() ) + 12;
488 }
489
490 if( m_itemsGrid->IsColShown( col ) )
491 m_itemsGrid->SetColSize( col, col_size );
492 }
493
494 m_itemsGrid->SetRowLabelSize( 0 );
495
496 Layout();
497 m_itemsGrid->SetMinVisibleRows( this, 4 );
498 m_initialized = true;
499
500 return true;
501}
502
503
505 LIB_ID* doOverwrite )
506{
507 if( aFootprintName.IsEmpty() )
508 {
509 m_delayedErrorMessage = _( "Footprint must have a name." );
510 return false;
511 }
512 else if( !FOOTPRINT::IsLibNameValid( aFootprintName ) )
513 {
514 m_delayedErrorMessage.Printf( _( "Footprint name may not contain '%s'." ),
516 return false;
517 }
518
519 LIB_ID fpID = m_footprint->GetFPID();
520 wxString libraryName = fpID.GetLibNickname();
521 wxString originalFPName = fpID.GetLibItemName();
522
524
525 if( aFootprintName != originalFPName && adapter->FootprintExists( libraryName, aFootprintName ) )
526 {
527 wxString msg = wxString::Format( _( "Footprint '%s' already exists in library '%s'." ),
528 aFootprintName, libraryName );
529
530 KIDIALOG errorDlg( m_frame, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
531 errorDlg.SetOKLabel( _( "Overwrite" ) );
532
533 if( errorDlg.ShowModal() == wxID_OK )
534 {
535 doOverwrite->SetLibNickname( libraryName );
536 doOverwrite->SetLibItemName( aFootprintName );
537 return true;
538 }
539 }
540
541 return true;
542}
543
544
546{
547 LSET userLayers;
548 if( m_cbCustomLayers->GetValue() )
549 {
550 userLayers |= LSET::AllCuMask( ( m_copperLayerCount->GetSelection() + 1 ) * 2 );
551
552 for( PCB_LAYER_ID layer : *m_customUserLayers )
553 {
554 userLayers.set( layer );
555 }
556 }
557 else
558 {
559 // The default stackup restricts nothing, so every standard layer is available.
560 userLayers |= LSET{ F_Cu, B_Cu };
561 userLayers |= LSET::InternalCuMask();
562 userLayers |= LSET::UserDefinedLayersMask();
563 }
564
565 return userLayers;
566}
567
568
570{
571 if( !m_itemsGrid->CommitPendingChanges() )
572 return false;
573
574 if( !DIALOG_SHIM::Validate() )
575 return false;
576
577 // First, test for invalid chars in footprint name
578 wxString footprintName = m_FootprintNameCtrl->GetValue();
579 LIB_ID overwrite;
580
581 if( !checkFootprintName( footprintName, &overwrite ) )
582 {
583 if( m_NoteBook->GetSelection() != 0 )
584 m_NoteBook->SetSelection( 0 );
585
588
589 return false;
590 }
591
592 // Check for valid field text properties
593 for( int i = 0; i < (int) m_fields->size(); ++i )
594 {
595 PCB_FIELD& field = m_fields->at( i );
596
597 // Check for missing field names.
598 if( field.GetName( false ).IsEmpty() )
599 {
601 m_delayedErrorMessage = wxString::Format( _( "Fields must have a name." ) );
604
605 return false;
606 }
607
608 int minSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM );
609 int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
610
611 if( field.GetTextWidth() < minSize || field.GetTextWidth() > maxSize )
612 {
614 m_delayedErrorMessage = wxString::Format( _( "The text width must be between %s and %s." ),
615 m_frame->StringFromValue( minSize, true ),
616 m_frame->StringFromValue( maxSize, true ) );
619
620 return false;
621 }
622
623 if( field.GetTextHeight() < minSize || field.GetTextHeight() > maxSize )
624 {
626 m_delayedErrorMessage = wxString::Format( _( "The text height must be between %s and %s." ),
627 m_frame->StringFromValue( minSize, true ),
628 m_frame->StringFromValue( maxSize, true ) );
631
632 return false;
633 }
634
635 // Test for acceptable values for thickness and size and clamp if fails
636 int maxPenWidth = ClampTextPenSize( field.GetTextThickness(), field.GetTextSize() );
637
638 if( field.GetTextThickness() > maxPenWidth )
639 {
640 m_itemsGrid->SetCellValue( i, PFC_THICKNESS, m_frame->StringFromValue( maxPenWidth, true ) );
641
643 m_delayedErrorMessage = _( "The text thickness is too large for the text size.\n"
644 "It will be clamped." );
647
648 return false;
649 }
650 }
651
652 if( !m_netClearance.Validate( 0, INT_MAX ) )
653 return false;
654
655 if( overwrite.IsValid() )
656 {
657 if( m_frame->DeleteFootprintFromLibrary( overwrite, false /* already confirmed */ ) )
658 m_frame->SyncLibraryTree( true );
659 }
660
661 // A custom layer set restricts which layers the footprint may use, so check that the user
662 // isn't removing a layer that is still used by the footprint. The default stackup imposes no
663 // such restriction, so nothing can be orphaned in that case.
664 if( m_cbCustomLayers->GetValue() )
665 {
668
669 if( orphanLayers.any() )
670 {
672 wxString::Format( _( "You are trying to remove layers that are used by the footprint: %s.\n"
673 "Please remove the objects that use these layers first." ),
674 LAYER_UTILS::AccumulateNames( orphanLayers, m_frame->GetBoard() ) );
679 return false;
680 }
681 }
682
683 return true;
684}
685
686
688{
689 if( !m_itemsGrid->CommitPendingChanges()
690 || !m_privateLayersGrid->CommitPendingChanges()
691 || !m_nettieGroupsGrid->CommitPendingChanges()
692 || !m_jumperGroupsGrid->CommitPendingChanges()
693 || !m_customUserLayersGrid->CommitPendingChanges() )
694 {
695 return false;
696 }
697
698 KIGFX::PCB_VIEW* view = m_frame->GetCanvas()->GetView();
699 PCB_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
700 BOARD_COMMIT commit( m_frame );
701 commit.Modify( m_footprint );
702
703 // Must be done inside the commit to capture the undo state
704 // This will call TransferDataToWindow() on the 3D panel and
705 // the embedded files panel.
706 if( !DIALOG_SHIM::TransferDataFromWindow() )
707 return false;
708
709 // Clear out embedded files that are no longer in use
710 std::set<wxString> files;
711 std::set<wxString> files_to_delete;
712
713 // Get the new files from the footprint fields
714 for( const PCB_FIELD& field : *m_fields )
715 {
716 if( field.GetText().StartsWith( FILEEXT::KiCadUriPrefix ) )
717 files.insert( field.GetText() );
718 }
719
720 // Find any files referenced in the old fields that are not in the new fields
721 for( PCB_FIELD* field : m_footprint->GetFields() )
722 {
723 wxCHECK2( field, continue );
724
725 if( field->GetText().StartsWith( FILEEXT::KiCadUriPrefix ) )
726 {
727 if( files.find( field->GetText() ) == files.end() )
728 files_to_delete.insert( field->GetText() );
729 }
730 }
731
732 for( const wxString& file : files_to_delete )
733 {
734 wxString name = file.Mid( FILEEXT::KiCadUriPrefix.size() + 3 ); // Skip "kicad-embed://"
735 m_footprint->RemoveFile( name );
736 }
737
738 LIB_ID fpID = m_footprint->GetFPID();
739 fpID.SetLibItemName( m_FootprintNameCtrl->GetValue() );
740 m_footprint->SetFPID( fpID );
741
742 m_footprint->SetLibDescription( UnescapeString( m_DocCtrl->GetValue() ) );
743 m_footprint->SetKeywords( m_KeywordCtrl->GetValue() );
744
745 // Update fields
746 m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear );
747
748 std::vector<PCB_FIELD*> addedFields;
749 std::vector<PCB_FIELD*> detachedFields;
750
751 m_footprint->UpdateFields( *m_fields, addedFields, detachedFields );
752
753 for( PCB_FIELD* field : detachedFields )
754 {
755 view->Remove( field );
756 delete field;
757 }
758
759 for( PCB_FIELD* field : m_footprint->GetFields() )
760 {
761 // Reused fields are already known to the view
762 if( alg::contains( addedFields, field ) )
763 view->Add( field );
764 else
765 view->Update( field );
766
767 if( field->IsSelected() )
768 {
769 // The old copy was in the selection list, but this one is not. Remove the
770 // out-of-sync selection flag so we can re-add the field to the selection.
771 field->ClearSelected();
772 selectionTool->AddItemToSel( field, true );
773 }
774 }
775
776 LSET privateLayers;
777
778 for( PCB_LAYER_ID layer : *m_privateLayers )
779 privateLayers.set( layer );
780
781 m_footprint->SetPrivateLayers( privateLayers );
782
783 if( m_cbCustomLayers->GetValue() )
784 {
785 const LSET customLayers = getCustomLayersFromControls();
786
788 m_footprint->SetStackupLayers( std::move( customLayers ) );
789 }
790 else
791 {
792 // Just use the default stackup mode
794 }
795
796 int attributes = 0;
797
798 switch( m_componentType->GetSelection() )
799 {
800 case 0: attributes |= FP_THROUGH_HOLE; break;
801 case 1: attributes |= FP_SMD; break;
802 default: break;
803 }
804
805 if( m_boardOnly->GetValue() )
806 attributes |= FP_BOARD_ONLY;
807
808 if( m_cbExcludeFromSim->GetValue() )
809 attributes |= FP_EXCLUDE_FROM_SIM;
810
811 if( m_excludeFromPosFiles->GetValue() )
812 attributes |= FP_EXCLUDE_FROM_POS_FILES;
813
814 if( m_excludeFromBOM->GetValue() )
815 attributes |= FP_EXCLUDE_FROM_BOM;
816
817 if( m_cbDNP->GetValue() )
818 attributes |= FP_DNP;
819
820 m_footprint->SetAttributes( attributes );
821
822 m_footprint->SetAllowMissingCourtyard( m_noCourtyards->GetValue() );
823 m_footprint->SetAllowSolderMaskBridges( m_allowBridges->GetValue() );
824
825 // Initialize mask clearances
826 if( m_netClearance.IsNull() )
827 m_footprint->SetLocalClearance( {} );
828 else
829 m_footprint->SetLocalClearance( m_netClearance.GetValue() );
830
831 if( m_solderMask.IsNull() )
832 m_footprint->SetLocalSolderMaskMargin( {} );
833 else
834 m_footprint->SetLocalSolderMaskMargin( m_solderMask.GetValue() );
835
836 m_footprint->SetLocalSolderPasteMargin( m_solderPaste.GetOffsetValue() );
837 m_footprint->SetLocalSolderPasteMarginRatio( m_solderPaste.GetRatioValue() );
838
839 switch( m_ZoneConnectionChoice->GetSelection() )
840 {
841 default:
842 case 0: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::INHERITED ); break;
843 case 1: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::FULL ); break;
844 case 2: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::THERMAL ); break;
845 case 3: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::NONE ); break;
846 }
847
848 m_footprint->ClearNetTiePadGroups();
849
850 for( int ii = 0; ii < m_nettieGroupsGrid->GetNumberRows(); ++ii )
851 {
852 wxString group = m_nettieGroupsGrid->GetCellValue( ii, 0 );
853
854 if( !group.IsEmpty() )
855 m_footprint->AddNetTiePadGroup( group );
856 }
857
858 m_footprint->SetDuplicatePadNumbersAreJumpers( m_cbDuplicatePadsAreJumpers->GetValue() );
859
860 std::set<wxString> availablePads;
861
862 for( const PAD* pad : m_footprint->Pads() )
863 availablePads.insert( pad->GetNumber() );
864
865 JUMPER_GROUP_SET newJumpers;
866
867 for( int ii = 0; ii < m_jumperGroupsGrid->GetNumberRows(); ++ii )
868 {
869 wxStringTokenizer tokenizer( m_jumperGroupsGrid->GetCellValue( ii, 0 ), ", \t\r\n", wxTOKEN_STRTOK );
870 std::set<wxString> names;
871
872 while( tokenizer.HasMoreTokens() )
873 {
874 wxString token = tokenizer.GetNextToken();
875
876 if( token.IsEmpty() )
877 continue;
878
879 if( !availablePads.count( token ) )
880 {
881 wxString msg;
882 msg.Printf( _( "Pad '%s' in jumper pad group %d does not exist in this footprint." ),
883 token, ii + 1 );
884 DisplayErrorMessage( this, msg );
885 return false;
886 }
887
888 names.insert( token );
889 }
890
891 if( std::optional<JUMPER_GROUP> group = JUMPER_GROUP::Make( std::move( names ) ) )
892 newJumpers.Add( std::move( *group ) );
893 }
894
895 m_footprint->JumperPadGroups() = std::move( newJumpers );
896
897 // Copy the models from the panel to the footprint
898 std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
899 std::vector<FP_3DMODEL>* fpList = &m_footprint->Models();
900 fpList->clear();
901 fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
902
903 commit.Push( _( "Edit Footprint Properties" ) );
904
905 return true;
906}
907
908
910{
911 m_itemsGrid->OnAddRow(
912 [&]() -> std::pair<int, int>
913 {
914 const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
915
917
918 // Set active layer if legal; otherwise copy layer from previous text item
919 if( LSET::AllTechMask().test( m_frame->GetActiveLayer() ) )
920 newField.SetLayer( m_frame->GetActiveLayer() );
921 else
922 newField.SetLayer( m_fields->at( m_fields->size() - 1 ).GetLayer() );
923
924 newField.SetTextSize( dsnSettings.GetTextSize( newField.GetLayer() ) );
925 newField.SetTextThickness( dsnSettings.GetTextThickness( newField.GetLayer() ) );
926 newField.SetItalic( dsnSettings.GetTextItalic( newField.GetLayer() ) );
927
928 m_fields->push_back( newField );
929
930 // notify the grid
931 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
932 m_itemsGrid->ProcessTableMessage( msg );
933 OnModify();
934
935 return { m_fields->size() - 1, PFC_NAME };
936 } );
937}
938
939
941{
942 m_itemsGrid->OnDeleteRows(
943 [&]( int row )
944 {
945 if( row < m_fields->GetMandatoryRowCount() )
946 {
947 DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
948 m_fields->GetMandatoryRowCount() ) );
949 return false;
950 }
951
952 return true;
953 },
954 [&]( int row )
955 {
956 m_fields->DeleteRows( row );
957 } );
958
959 OnModify();
960}
961
962
964 int aRow )
965{
966 aLayerTable.erase( aLayerTable.begin() + aRow );
967
968 // notify the grid
969 wxGridTableMessage msg( &aLayerTable, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aRow, 1 );
970 aGrid.ProcessTableMessage( msg );
971
972 OnModify();
973}
974
975
977 LAYERS_GRID_TABLE& aGridTable )
978{
979 PCB_LAYER_ID nextLayer = User_1;
980
981 while( alg::contains( aGridTable, nextLayer ) && nextLayer < User_45 )
982 nextLayer = ToLAYER_ID( nextLayer + 2 );
983
984 aGridTable.push_back( nextLayer );
985
986 // notify the grid
987 wxGridTableMessage msg( &aGridTable, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
988 aGrid.ProcessTableMessage( msg );
989 OnModify();
990
991 return { aGridTable.size() - 1, -1 };
992}
993
994
996{
997 m_privateLayersGrid->OnAddRow(
998 [&]()
999 {
1001 } );
1002}
1003
1004
1006{
1007 m_privateLayersGrid->OnDeleteRows(
1008 [&]( int row )
1009 {
1011 } );
1012}
1013
1014
1019
1020
1022{
1023 m_customUserLayersGrid->OnAddRow(
1024 [&]()
1025 {
1027 } );
1028}
1029
1030
1032{
1033 m_customUserLayersGrid->OnDeleteRows(
1034 [&]( int row )
1035 {
1037 } );
1038}
1039
1040
1045
1046
1051
1052
1057
1058
1063
1064
1066{
1067 aGrid->OnAddRow(
1068 [&]() -> std::pair<int, int>
1069 {
1070 aGrid->AppendRows( 1 );
1071 OnModify();
1072
1073 return { aGrid->GetNumberRows() - 1, 0 };
1074 } );
1075}
1076
1077
1079{
1080 aGrid->OnDeleteRows(
1081 [&]( int row )
1082 {
1083 aGrid->DeleteRows( row, 1 );
1084 } );
1085
1086 OnModify();
1087}
1088
1089
1091{
1092 wxGridCellEditor* editor = m_itemsGrid->GetCellEditor( aEvent.GetRow(), aEvent.GetCol() );
1093 wxControl* control = editor->GetControl();
1094
1095 if( control && control->GetValidator() && !control->GetValidator()->Validate( control ) )
1096 {
1097 aEvent.Veto();
1099 m_delayedFocusRow = aEvent.GetRow();
1100 m_delayedFocusColumn = aEvent.GetCol();
1102 }
1103 else if( aEvent.GetCol() == PFC_NAME )
1104 {
1105 wxString newName = aEvent.GetString();
1106
1107 for( int row = 0; row < m_itemsGrid->GetNumberRows(); ++row )
1108 {
1109 if( row == aEvent.GetRow() )
1110 continue;
1111
1112 if( FieldNamesAreDuplicates( newName, m_itemsGrid->GetCellValue( row, PFC_NAME ) ) )
1113 {
1114 aEvent.Veto();
1116 m_delayedFocusRow = aEvent.GetRow();
1117 m_delayedFocusColumn = aEvent.GetCol();
1119 m_delayedErrorMessage = wxString::Format( _( "Field name '%s' already in use." ), newName );
1120 break;
1121 }
1122 }
1123 }
1124
1125 editor->DecRef();
1126}
1127
1128
1130{
1131 // Handle a delayed focus. The delay allows us to:
1132 // a) change focus when the error was triggered from within a killFocus handler
1133 // b) show the correct notebook page in the background before the error dialog comes up
1134 // when triggered from an OK or a notebook page change
1135
1136 if( static_cast<int>( m_delayedFocusPage ) >= 0 )
1137 {
1138 if( m_NoteBook->GetSelection() != static_cast<int>( m_delayedFocusPage ) )
1139 {
1140 const int newPage = static_cast<int>( m_delayedFocusPage );
1141 const int oldPage = m_NoteBook->ChangeSelection( newPage );
1142
1143 // Notify page tools without rerunning the validation that requested this switch.
1144 wxBookCtrlEvent changed( wxEVT_NOTEBOOK_PAGE_CHANGED, m_NoteBook->GetId(), newPage, oldPage );
1145 changed.SetEventObject( m_NoteBook );
1146 m_NoteBook->GetEventHandler()->ProcessEvent( changed );
1147 }
1148
1150 }
1151
1152 if( !m_delayedErrorMessage.IsEmpty() )
1153 {
1154 // We will re-enter this routine when the error dialog is displayed, so make
1155 // sure we don't keep putting up more dialogs.
1156 wxString msg = m_delayedErrorMessage;
1157 m_delayedErrorMessage = wxEmptyString;
1158
1159 // Do not use DisplayErrorMessage(); it screws up window order on Mac
1160 DisplayError( nullptr, msg );
1161 }
1162
1163 if( m_delayedFocusCtrl )
1164 {
1165 m_delayedFocusCtrl->SetFocus();
1166
1167 if( wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
1168 textEntry->SelectAll();
1169
1170 m_delayedFocusCtrl = nullptr;
1171 }
1172 else if( m_delayedFocusGrid )
1173 {
1174 m_delayedFocusGrid->SetFocus();
1177
1178 if( !( m_delayedFocusColumn == 0 && m_delayedFocusRow < m_fields->GetMandatoryRowCount() ) )
1179 m_delayedFocusGrid->EnableCellEditControl( true );
1180
1181 m_delayedFocusGrid->ShowCellEditControl();
1182
1183 m_delayedFocusGrid = nullptr;
1184 m_delayedFocusRow = -1;
1186 }
1187}
1188
1189
1191{
1192 bool enableCustomCtrls = m_cbCustomLayers->GetValue();
1193
1194 m_copperLayerCount->Enable( enableCustomCtrls );
1195 m_customUserLayersGrid->Enable( enableCustomCtrls );
1196 m_bpAddCustomLayer->Enable( enableCustomCtrls );
1197 m_bpDeleteCustomLayer->Enable( enableCustomCtrls );
1198}
1199
1200
1202{
1203 if( !m_itemsGrid->CommitPendingChanges() )
1204 aEvent.Veto();
1205
1206 if( !m_privateLayersGrid->CommitPendingChanges() )
1207 aEvent.Veto();
1208
1209 if( !m_customUserLayersGrid->CommitPendingChanges() )
1210 aEvent.Veto();
1211}
1212
1213
1215{
1216 if( m_initialized )
1217 OnModify();
1218}
1219
1220
1222{
1223 if( m_initialized )
1224 OnModify();
1225}
1226
1227
1229{
1230 if( m_initialized )
1231 OnModify();
1232}
const char * name
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:128
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition bitmap.cpp:100
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:106
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:982
static TOOL_ACTION selectionClear
Clear the current selection.
Definition actions.h:220
BASE_SET & set(size_t pos)
Definition base_set.h:126
Container for design settings for a BOARD object.
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
bool GetTextItalic(PCB_LAYER_ID aLayer) const
VECTOR2I GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition board_item.h:374
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:410
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition board.cpp:943
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:1185
DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Footprint Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(FOOTPRINT_EDIT_FRAME *aParent, FOOTPRINT *aFootprint)
LSET getCustomLayersFromControls() const
Get the layers for the footprint from the controls that can be affected by the stackup.
bool checkFootprintName(const wxString &aFootprintName, LIB_ID *doOverwrite)
void onLayerGridRowDelete(WX_GRID &aGrid, LAYERS_GRID_TABLE &aLayerTable, int aRow)
std::pair< int, int > onLayerGridRowAddUserLayer(WX_GRID &aGrid, LAYERS_GRID_TABLE &aLayerTable)
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition dialog_shim.h:94
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
virtual int GetTextHeight() const
Definition eda_text.h:307
virtual int GetTextWidth() const
Definition eda_text.h:304
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
Definition eda_text.cpp:290
An interface to the global shared library manager that is schematic-specific and linked to one projec...
bool FootprintExists(const wxString &aNickname, const wxString &aName)
Provide a custom wxValidator object for limiting the allowable characters when defining footprint nam...
Definition validators.h:49
static bool IsLibNameValid(const wxString &aName)
Test for validity of a name of a footprint to be used in a footprint library ( no spaces,...
static const wxChar * StringLibNameInvalidChars(bool aUserReadable)
Test for validity of the name in a library of the footprint ( no spaces, dir separators ....
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition grid_tricks.h:57
Represents an (ordered) list of JUMPER_GROUP objects.
void Add(JUMPER_GROUP aGroup)
Add a JUMPER_GROUP to the set.
Represents a group of jumper pins or pads, keyed by name.
static std::optional< JUMPER_GROUP > Make(std::set< wxString > aNames)
Factory method to create a JUMPER_GROUP from a set of names.
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition kidialog.h:38
int ShowModal() override
Definition kidialog.cpp:89
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition pcb_view.cpp:87
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
Definition pcb_view.cpp:53
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition pcb_view.cpp:70
LAYERS_GRID_TABLE(PCB_BASE_FRAME *aFrame, const LSET &aForbiddenLayers)
wxString GetValue(int aRow, int aCol) override
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override
void SetValueAsLong(int aRow, int aCol, long aValue) override
long GetValueAsLong(int aRow, int aCol) override
bool CanSetValueAs(int aRow, int aCol, const wxString &aTypeName) override
void SetValue(int aRow, int aCol, const wxString &aValue) override
wxGridCellAttr * GetAttr(int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind) override
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
int SetLibItemName(const UTF8 &aLibItemName)
Override the library item name portion of the LIB_ID to aLibItemName.
Definition lib_id.cpp:124
bool IsValid() const
Check if this LID_ID is valid.
Definition lib_id.h:168
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
Definition lib_id.cpp:113
const UTF8 & GetLibItemName() const
Definition lib_id.h:98
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition lib_id.h:83
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
Definition lset.cpp:604
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition lset.cpp:672
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition lset.cpp:595
static const LSET & AllLayersMask()
Definition lset.cpp:637
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
Definition lset.cpp:700
static const LSET & InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Definition lset.cpp:573
Definition pad.h:61
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
The selection tool: currently supports:
void SetTextThickness(int aWidth) override
The TextThickness is that set by the user.
Definition pcb_text.cpp:512
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true) override
Definition pcb_text.cpp:484
int GetTextThickness() const override
Definition pcb_text.cpp:497
VECTOR2I GetTextSize() const override
Definition pcb_text.cpp:470
static FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(PROJECT *aProject)
int AddItemToSel(const TOOL_EVENT &aEvent)
wxGridCellAttr * enhanceAttr(wxGridCellAttr *aInputAttr, int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind)
Definition wx_grid.cpp:43
void OnDeleteRows(const std::function< void(int row)> &aDeleter)
Handles a row deletion event.
Definition wx_grid.cpp:838
void OnAddRow(const std::function< std::pair< int, int >()> &aAdder)
Definition wx_grid.cpp:818
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:217
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:192
This file is part of the common library.
const int minSize
Push and Shove router track width and via size dialog.
#define _(s)
Declaration of the eda_3d_viewer class.
#define TEXT_MIN_SIZE_MM
Minimum text size (1 micron).
Definition eda_text.h:61
#define TEXT_MAX_SIZE_MM
Maximum text size in mm (~10 inches)
Definition eda_text.h:62
@ FP_SMD
Definition footprint.h:87
@ FP_DNP
Definition footprint.h:92
@ FP_EXCLUDE_FROM_POS_FILES
Definition footprint.h:88
@ FP_BOARD_ONLY
Definition footprint.h:90
@ FP_EXCLUDE_FROM_BOM
Definition footprint.h:89
@ FP_EXCLUDE_FROM_SIM
Definition footprint.h:93
@ FP_THROUGH_HOLE
Definition footprint.h:86
@ EXPAND_INNER_LAYERS
The 'normal' stackup handling, where there is a single inner layer (In1) and rule areas using it expa...
Definition footprint.h:161
@ CUSTOM_LAYERS
Stackup handling where the footprint can have any number of copper layers, and objects on those layer...
Definition footprint.h:166
int ClampTextPenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
Definition gr_text.cpp:69
static const std::string KiCadUriPrefix
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ User_45
Definition layer_ids.h:164
@ Edge_Cuts
Definition layer_ids.h:108
@ B_Cu
Definition layer_ids.h:61
@ Margin
Definition layer_ids.h:109
@ User_1
Definition layer_ids.h:120
@ F_Cu
Definition layer_ids.h:60
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition lset.cpp:750
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
wxString AccumulateNames(const LSEQ &aLayers, const BOARD *aBoard)
Accumulate layer names from a layer set into a comma separated string.
LSET GetOrphanedFootprintLayers(const FOOTPRINT &aFootprint, const LSET &aCustomUserLayers)
Compute the set of footprint-used layers that would be orphaned if the footprint's allowed layer set ...
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition kicad_algo.h:96
@ PFC_THICKNESS
see class PGM_BASE
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_LINE
bool FieldNamesAreDuplicates(const wxString &aLhs, const wxString &aRhs, std::initializer_list< FIELD_T > aMandatoryFields)
Test whether two field names should be treated as duplicates for the purposes of field name uniquenes...
wxString GetUserFieldName(int aFieldNdx, TRANSLATION aTranslation)
@ USER
The field ID hasn't been set yet; field is invalid.
@ TRANSLATED
Custom text control validator definitions.
@ THERMAL
Use thermal relief for pads.
Definition zones.h:46
@ NONE
Pads are not covered.
Definition zones.h:45
@ FULL
pads are covered by copper
Definition zones.h:47