KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_footprint_properties.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) 2016 Mario Luzeiro <[email protected]>
5 * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
6 * Copyright (C) 2015 Dick Hollenbeck, [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, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
28#include <bitmaps.h>
29#include <board_commit.h>
31#include <board.h>
32#include <footprint.h>
33#include <confirm.h>
35#include <filename_resolver.h>
36#include <pcb_edit_frame.h>
37#include <pcbnew_settings.h>
38#include <pgm_base.h>
39#include <project_pcb.h>
40#include <kiplatform/ui.h>
49#include <tool/tool_manager.h>
51
52
53int DIALOG_FOOTPRINT_PROPERTIES::m_page = 0; // remember the last open page during session
54
55
58 m_frame( aParent ),
59 m_footprint( aFootprint ),
68 m_initialized( false )
69{
70 // Create the extra panels. Embedded files is referenced by the 3D model panel.
73
74 m_NoteBook->AddPage( m_3dPanel, _("3D Models"), false );
75 m_NoteBook->AddPage( m_embeddedFiles, _( "Embedded Files" ) );
76
77 // Configure display origin transforms
80
81 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
82 embeddedFilesStack.push_back( m_embeddedFiles->GetLocalFiles() );
83 embeddedFilesStack.push_back( m_frame->GetBoard()->GetEmbeddedFiles() );
84
85 m_fields = new PCB_FIELDS_GRID_TABLE( m_frame, this, std::move( embeddedFilesStack ) );
86
87 m_delayedErrorMessage = wxEmptyString;
88 m_delayedFocusGrid = nullptr;
91 m_initialFocus = false;
92
93 // Give an icon
94 wxIcon icon;
95 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit ) );
96 SetIcon( icon );
97
98 m_itemsGrid->SetTable( m_fields );
99 m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
100 m_itemsGrid->SetupColumnAutosizer( PFC_VALUE );
101 m_itemsGrid->ShowHideColumns( "0 1 2 3 4 5 7" );
102
104 m_orientation.SetPrecision( 3 );
105
106 // Set predefined rotations in combo dropdown, according to the locale floating point
107 // separator notation
108 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
109
110 for( size_t ii = 0; ii < m_orientationCtrl->GetCount() && ii < 4; ++ii )
111 m_orientationCtrl->SetString( ii, wxString::Format( "%.1f", rot_list[ii] ) );
112
113 // Set font size for items showing long strings:
114 wxFont infoFont = KIUI::GetSmallInfoFont( this );
115 m_libraryIDLabel->SetFont( infoFont );
116 m_tcLibraryID->SetFont( infoFont );
117
118 infoFont = KIUI::GetInfoFont( this ).Italic();
119 m_staticTextInfoCopper->SetFont( infoFont );
120 m_staticTextInfoPaste->SetFont( infoFont );
121
122 m_NoteBook->SetSelection( m_page );
123
124 if( m_page == 0 )
125 {
129 }
130 else if( m_page == 1 )
131 {
133 }
134
135 m_solderPaste.SetNegativeZero();
136
138 m_solderPasteRatio.SetNegativeZero();
139
140 // Configure button logos
143
144 m_tcLibraryID->SetBackgroundColour( KIPLATFORM::UI::GetDialogBGColour() );
145
146 // We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
147 // implementation on MSW
148 m_tabOrder = {
159 m_cbDNP,
166 };
167
169
170 // The 3D model tab was added after the base dtor. The final dialog size needs to be set
171 // accordingly.
172 SetSizer( m_GeneralBoxSizer );
173 Layout();
174 m_GeneralBoxSizer->Fit( this );
175
177}
178
179
181{
182 // Prevents crash bug in wxGrid's d'tor
183 m_itemsGrid->DestroyTable( m_fields );
184
185 // Delete the GRID_TRICKS.
186 m_itemsGrid->PopEventHandler( true );
187
188 // free the memory used by all models, otherwise models which were
189 // browsed but not used would consume memory
191
192 // the GL canvas has to be visible before it is destroyed
193 m_page = m_NoteBook->GetSelection();
194 m_NoteBook->SetSelection( 1 );
195}
196
197
199{
201 {
203 Close();
204 }
205}
206
207
209{
211 {
213 Close();
214 }
215}
216
217
219{
221 {
223 Close();
224 }
225}
226
227
229{
231 {
233 Close();
234 }
235}
236
237
239{
240 if( !wxDialog::TransferDataToWindow() )
241 return false;
242
243 if( !m_PanelGeneral->TransferDataToWindow() )
244 return false;
245
246 // Add the models to the panel
247 if( !m_3dPanel->TransferDataToWindow() )
248 return false;
249
250 if( !m_embeddedFiles->TransferDataToWindow() )
251 return false;
252
253 // Footprint Fields
254 for( PCB_FIELD* srcField : m_footprint->GetFields() )
255 {
256 PCB_FIELD field( *srcField );
257 field.SetText( m_footprint->GetBoard()->ConvertKIIDsToCrossReferences( field.GetText() ) );
258
259 m_fields->push_back( field );
260 }
261
262 // notify the grid
263 wxGridTableMessage tmsg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->GetNumberRows() );
264 m_itemsGrid->ProcessTableMessage( tmsg );
265
266 // Footprint Properties
267
268 m_posX.SetValue( m_footprint->GetPosition().x );
269 m_posY.SetValue( m_footprint->GetPosition().y );
270
271 m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
272
273 EDA_ANGLE orientation = m_footprint->GetOrientation();
274 m_orientation.SetAngleValue( orientation.Normalize180() );
275
276 m_cbLocked->SetValue( m_footprint->IsLocked() );
277 m_cbLocked->SetToolTip( _( "Locked footprints cannot be freely moved or oriented on the canvas and can only be "
278 "selected when the 'Locked items' checkbox is checked in the selection filter." ) );
279
280 if( m_footprint->GetAttributes() & FP_THROUGH_HOLE )
281 m_componentType->SetSelection( 0 );
282 else if( m_footprint->GetAttributes() & FP_SMD )
283 m_componentType->SetSelection( 1 );
284 else
285 m_componentType->SetSelection( 2 );
286
287 m_boardOnly->SetValue( m_footprint->GetAttributes() & FP_BOARD_ONLY );
288 m_excludeFromPosFiles->SetValue( m_footprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES );
289 m_excludeFromBOM->SetValue( m_footprint->GetAttributes() & FP_EXCLUDE_FROM_BOM );
290 m_cbDNP->SetValue( m_footprint->GetAttributes() & FP_DNP );
291
292 // Local Clearances
293
294 if( m_footprint->GetLocalClearance().has_value() )
295 m_netClearance.SetValue( m_footprint->GetLocalClearance().value() );
296 else
297 m_netClearance.SetValue( wxEmptyString );
298
299 if( m_footprint->GetLocalSolderMaskMargin().has_value() )
300 m_solderMask.SetValue( m_footprint->GetLocalSolderMaskMargin().value() );
301 else
302 m_solderMask.SetValue( wxEmptyString );
303
304 if( m_footprint->GetLocalSolderPasteMargin().has_value() )
305 m_solderPaste.SetValue( m_footprint->GetLocalSolderPasteMargin().value() );
306 else
307 m_solderPaste.SetValue( wxEmptyString );
308
309 if( m_footprint->GetLocalSolderPasteMarginRatio().has_value() )
310 m_solderPasteRatio.SetDoubleValue( m_footprint->GetLocalSolderPasteMarginRatio().value() * 100.0 );
311 else
312 m_solderPasteRatio.SetValue( wxEmptyString );
313
314 m_allowSolderMaskBridges->SetValue( m_footprint->AllowSolderMaskBridges() );
315
316 switch( m_footprint->GetLocalZoneConnection() )
317 {
318 default:
319 case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
320 case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
321 case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
322 case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
323 }
324
325 wxString jumperGroups;
326
327 if( m_footprint->GetDuplicatePadNumbersAreJumpers() )
328 jumperGroups = _( "all pads with duplicate numbers" );
329
330 for( const std::set<wxString>& group : m_footprint->JumperPadGroups() )
331 {
332 wxString groupTxt;
333
334 for( const wxString& pinNumber : group )
335 {
336 if( !groupTxt.IsEmpty() )
337 groupTxt << ", ";
338
339 groupTxt << pinNumber;
340 }
341
342 if( !jumperGroups.IsEmpty() )
343 jumperGroups << "; ";
344
345 jumperGroups << "(" << groupTxt << ")";
346 }
347
348 if( jumperGroups.IsEmpty() )
349 {
350 m_jumperGroupsText->SetLabel( _( "none" ) );
352 }
353 else
354 {
355 m_jumperGroupsText->SetLabel( jumperGroups );
356 }
357
358 // Show the footprint's FPID.
359 m_tcLibraryID->SetValue( m_footprint->GetFPID().Format() );
360
361 for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
362 {
363 m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false ) );
364
365 // Adjust the column size.
366 int col_size = m_itemsGrid->GetVisibleWidth( col );
367
368 if( col == PFC_LAYER ) // This one's a drop-down. Check all possible values.
369 {
370 BOARD* board = m_footprint->GetBoard();
371
372 for( PCB_LAYER_ID layer : board->GetEnabledLayers() )
373 col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
374
375 // Swatch and gaps:
376 col_size += KiROUND( 14 * GetDPIScaleFactor() ) + 12;
377 }
378
379 if( m_itemsGrid->IsColShown( col ) )
380 m_itemsGrid->SetColSize( col, col_size );
381 }
382
383 m_itemsGrid->SetRowLabelSize( 0 );
384
385 Layout();
386 m_initialized = true;
387
388 return true;
389}
390
391
393{
394 if( !m_itemsGrid->CommitPendingChanges() )
395 return false;
396
397 if( !DIALOG_SHIM::Validate() )
398 return false;
399
400 // Validate texts.
401 for( size_t i = 0; i < m_fields->size(); ++i )
402 {
403 PCB_FIELD& field = m_fields->at( i );
404
405 // Check for missing field names.
406 if( field.GetName( false ).IsEmpty() )
407 {
409 m_delayedErrorMessage = wxString::Format( _( "Fields must have a name." ) );
412
413 return false;
414 }
415
416 int minSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM );
417 int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
418 int width = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, PFC_WIDTH ) );
419 int height = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, PFC_HEIGHT ) );
420
421 if( width < minSize )
422 {
423 wxString min = m_frame->StringFromValue( minSize, true );
424
425 m_itemsGrid->SetCellValue( i, PFC_WIDTH, min );
426
428 m_delayedErrorMessage = wxString::Format( _( "Text width must be at least %s." ), min );
431
432 return false;
433 }
434 else if( width > maxSize )
435 {
436 wxString max = m_frame->StringFromValue( maxSize, true );
437
438 m_itemsGrid->SetCellValue( i, PFC_WIDTH, max );
439
441 m_delayedErrorMessage = wxString::Format( _( "Text width must be at most %s." ), max );
444
445 return false;
446 }
447
448 if( height < minSize )
449 {
450 wxString min = m_frame->StringFromValue( minSize, true );
451
452 m_itemsGrid->SetCellValue( i, PFC_HEIGHT, min );
453
455 m_delayedErrorMessage = wxString::Format( _( "Text height must be at least %s." ), min );
458
459 return false;
460 }
461 else if( height > maxSize )
462 {
463 wxString max = m_frame->StringFromValue( maxSize, true );
464
465 m_itemsGrid->SetCellValue( i, PFC_HEIGHT, max );
466
468 m_delayedErrorMessage = wxString::Format( _( "Text height must be at most %s." ), max );
471
472 return false;
473 }
474
475 // Test for acceptable values for thickness and size and clamp if fails
476 int maxPenWidth = ClampTextPenSize( field.GetTextThickness(), field.GetTextSize() );
477
478 if( field.GetTextThickness() > maxPenWidth )
479 {
480 wxString clamped = m_frame->StringFromValue( maxPenWidth, true );
481
482 m_itemsGrid->SetCellValue( i, PFC_THICKNESS, clamped );
483
485 m_delayedErrorMessage = wxString::Format( _( "Text thickness is too large for the text size.\n"
486 "It will be clamped at %s." ),
487 clamped );
490
491 return false;
492 }
493 }
494
495 if( !m_netClearance.Validate( 0, INT_MAX ) )
496 return false;
497
498 return true;
499}
500
501
503{
504 if( !Validate() )
505 return false;
506
507 if( !m_itemsGrid->CommitPendingChanges() )
508 return false;
509
510 KIGFX::PCB_VIEW* view = m_frame->GetCanvas()->GetView();
511 PCB_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
512 BOARD_COMMIT commit( m_frame );
513 commit.Modify( m_footprint );
514
515 // Make sure this happens inside a commit to capture any changed files
516 if( !m_3dPanel->TransferDataFromWindow() )
517 return false;
518
519 if( !m_embeddedFiles->TransferDataFromWindow() )
520 return false;
521
522 // Clear out embedded files that are no longer in use
523 std::set<wxString> files;
524 std::set<wxString> files_to_delete;
525
526 // Get the new files from the footprint fields
527 for( PCB_FIELD& field : *m_fields )
528 {
529 if( field.GetText().StartsWith( FILEEXT::KiCadUriPrefix ) )
530 files.insert( field.GetText() );
531 }
532
533 // Find any files referenced in the old fields that are not in the new fields
534 for( PCB_FIELD* field : m_footprint->GetFields() )
535 {
536 if( field->GetText().StartsWith( FILEEXT::KiCadUriPrefix ) )
537 {
538 if( files.find( field->GetText() ) == files.end() )
539 files_to_delete.insert( field->GetText() );
540 }
541 }
542
543 for( const wxString& file : files_to_delete )
544 {
545 wxString name = file.Mid( FILEEXT::KiCadUriPrefix.size() + 3 ); // Skip "kicad-embed://"
546 m_footprint->RemoveFile( name );
547 }
548
549 // Update fields
550 for( PCB_FIELD* existing : m_footprint->GetFields() )
551 delete existing;
552
553 m_footprint->GetFields().clear();
554
555 int ordinal = 42; // Arbitrarily larger than any mandatory FIELD_T ids.
556
557 for( PCB_FIELD& field : *m_fields )
558 {
559 PCB_FIELD* newField = field.CloneField();
560 newField->SetText( commit.GetBoard()->ConvertCrossReferencesToKIIDs( field.GetText() ) );
561
562 if( !field.IsMandatory() )
563 newField->SetOrdinal( ordinal++ );
564
565 m_footprint->Add( newField );
566 view->Add( newField );
567
568 if( newField->IsSelected() )
569 {
570 // The old copy was in the selection list, but this one is not. Remove the
571 // out-of-sync selection flag so we can re-add the field to the selection.
572 newField->ClearSelected();
573 selectionTool->AddItemToSel( newField, true );
574 }
575 }
576
577 // Initialize masks clearances
578 if( m_netClearance.IsNull() )
579 m_footprint->SetLocalClearance( {} );
580 else
581 m_footprint->SetLocalClearance( m_netClearance.GetValue() );
582
583 if( m_solderMask.IsNull() )
584 m_footprint->SetLocalSolderMaskMargin( {} );
585 else
586 m_footprint->SetLocalSolderMaskMargin( m_solderMask.GetValue() );
587
588 if( m_solderPaste.IsNull() )
589 m_footprint->SetLocalSolderPasteMargin( {} );
590 else
591 m_footprint->SetLocalSolderPasteMargin( m_solderPaste.GetValue() );
592
593 if( m_solderPasteRatio.IsNull() )
594 m_footprint->SetLocalSolderPasteMarginRatio( {} );
595 else
596 m_footprint->SetLocalSolderPasteMarginRatio( m_solderPasteRatio.GetDoubleValue() / 100.0 );
597
598 switch( m_ZoneConnectionChoice->GetSelection() )
599 {
600 default:
601 case 0: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::INHERITED ); break;
602 case 1: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::FULL ); break;
603 case 2: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::THERMAL ); break;
604 case 3: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::NONE ); break;
605 }
606
607 // Set Footprint Position
608 VECTOR2I pos( m_posX.GetValue(), m_posY.GetValue() );
609 m_footprint->SetPosition( pos );
610 m_footprint->SetLocked( m_cbLocked->GetValue() );
611
612 int attributes = 0;
613
614 switch( m_componentType->GetSelection() )
615 {
616 case 0: attributes |= FP_THROUGH_HOLE; break;
617 case 1: attributes |= FP_SMD; break;
618 default: break;
619 }
620
621 if( m_boardOnly->GetValue() )
622 attributes |= FP_BOARD_ONLY;
623
624 if( m_excludeFromPosFiles->GetValue() )
625 attributes |= FP_EXCLUDE_FROM_POS_FILES;
626
627 if( m_excludeFromBOM->GetValue() )
628 attributes |= FP_EXCLUDE_FROM_BOM;
629
630 if( m_cbDNP->GetValue() )
631 attributes |= FP_DNP;
632
633 m_footprint->SetAttributes( attributes );
634
635 m_footprint->SetAllowSolderMaskBridges( m_allowSolderMaskBridges->GetValue() );
636
637 EDA_ANGLE orient = m_orientation.GetAngleValue().Normalize();
638
639 if( m_footprint->GetOrientation() != orient )
640 m_footprint->Rotate( m_footprint->GetPosition(), orient - m_footprint->GetOrientation() );
641
642 // Set component side, that also have effect on the fields positions on board
643 bool change_layer = false;
644
645 if( m_BoardSideCtrl->GetSelection() == 0 ) // layer req = COMPONENT
646 {
647 if( m_footprint->GetLayer() == B_Cu )
648 change_layer = true;
649 }
650 else if( m_footprint->GetLayer() == F_Cu )
651 {
652 change_layer = true;
653 }
654
655 if( change_layer )
656 m_footprint->Flip( m_footprint->GetPosition(), m_frame->GetPcbNewSettings()->m_FlipDirection );
657
658 // Copy the models from the panel to the footprint
659 std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
660 std::vector<FP_3DMODEL>* fpList = &m_footprint->Models();
661 fpList->clear();
662 fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
663
664 // This is a simple edit, we must create an undo entry
665 if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
666 commit.Push( _( "Edit Footprint Properties" ) );
667
669 return true;
670}
671
672
674{
675 m_itemsGrid->OnAddRow(
676 [&]() -> std::pair<int, int>
677 {
679
680 newField.SetVisible( false );
681 newField.SetLayer( m_footprint->GetLayer() == F_Cu ? F_Fab : B_Fab );
682 newField.SetFPRelativePosition( { 0, 0 } );
683 newField.StyleFromSettings( m_frame->GetDesignSettings(), true );
684
685 m_fields->push_back( newField );
686
687 // notify the grid
688 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
689 m_itemsGrid->ProcessTableMessage( msg );
690 OnModify();
691
692 return { m_fields->size() - 1, PFC_NAME };
693 } );
694}
695
696
698{
699 m_itemsGrid->OnDeleteRows(
700 [&]( int row )
701 {
702 if( row < m_fields->GetMandatoryRowCount() )
703 {
704 DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
705 m_fields->GetMandatoryRowCount() ) );
706 return false;
707 }
708
709 return true;
710 },
711 [&]( int row )
712 {
713 m_fields->erase( m_fields->begin() + row );
714
715 // notify the grid
716 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
717 m_itemsGrid->ProcessTableMessage( msg );
718 } );
719
720 OnModify();
721}
722
723
725{
726 if( !m_initialized )
727 return;
728
729 // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
730 // even when the original validation was triggered from a killFocus event, and so
731 // that the corresponding notebook page can be shown in the background when triggered
732 // from an OK.
733 if( m_delayedFocusRow >= 0 )
734 {
735 // We will re-enter this routine if an error dialog is displayed, so make sure we
736 // zero out our member variables first.
737 wxGrid* grid = m_delayedFocusGrid;
738 int row = m_delayedFocusRow;
739 int col = m_delayedFocusColumn;
740 wxString msg = m_delayedErrorMessage;
741
742 m_delayedFocusGrid = nullptr;
745 m_delayedErrorMessage = wxEmptyString;
746
747 if( !msg.IsEmpty() )
748 {
749 // Do not use DisplayErrorMessage(); it screws up window order on Mac
750 DisplayError( nullptr, msg );
751 }
752
753 grid->SetFocus();
754 grid->MakeCellVisible( row, col );
755
756 // Selecting the first grid item only makes sense for the
757 // items grid
758 if( !m_initialFocus || grid == m_itemsGrid )
759 {
760 grid->SetGridCursor( row, col );
761
762 if( !( col == 0 && row < m_fields->GetMandatoryRowCount() ) )
763 grid->EnableCellEditControl( true );
764
765 grid->ShowCellEditControl();
766
767 if( grid == m_itemsGrid && row == 0 && col == 0 )
768 {
769 wxGridCellEditor* referenceEditor = grid->GetCellEditor( 0, 0 );
770
771 if( wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) )
772 KIUI::SelectReferenceNumber( textEntry );
773
774 referenceEditor->DecRef();
775 }
776 }
777
778 m_initialFocus = false;
779 }
780}
781
782
783void DIALOG_FOOTPRINT_PROPERTIES::OnPageChanging( wxNotebookEvent& aEvent )
784{
785 if( !m_itemsGrid->CommitPendingChanges() )
786 aEvent.Veto();
787}
788
789
790void DIALOG_FOOTPRINT_PROPERTIES::OnCheckBox( wxCommandEvent& event )
791{
792 if( m_initialized )
793 OnModify();
794}
795
796
797void DIALOG_FOOTPRINT_PROPERTIES::OnCombobox( wxCommandEvent& event )
798{
799 if( m_initialized )
800 OnModify();
801}
802
803
804void DIALOG_FOOTPRINT_PROPERTIES::OnText( wxCommandEvent& event )
805{
806 if( m_initialized )
807 OnModify();
808}
809
810
811void DIALOG_FOOTPRINT_PROPERTIES::OnChoice( wxCommandEvent& event )
812{
813 if( m_initialized )
814 OnModify();
815}
const char * name
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:112
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:104
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:110
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:990
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition board_item.h:280
void SetFPRelativePosition(const VECTOR2I &aPos)
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:322
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition board.cpp:715
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:954
DIALOG_FOOTPRINT_PROPERTIES_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)
void OnDeleteField(wxCommandEvent &) override
void OnUpdateUI(wxUpdateUIEvent &) override
void OnAddField(wxCommandEvent &) override
void OnText(wxCommandEvent &event) override
void OnCombobox(wxCommandEvent &event) override
PANEL_FP_PROPERTIES_3D_MODEL * m_3dPanel
void OnPageChanging(wxNotebookEvent &event) override
void EditLibraryFootprint(wxCommandEvent &) override
DIALOG_FOOTPRINT_PROPERTIES(PCB_EDIT_FRAME *aParent, FOOTPRINT *aFootprint)
void OnChoice(wxCommandEvent &event) override
void EditFootprint(wxCommandEvent &) override
void OnCheckBox(wxCommandEvent &event) override
void UpdateFootprint(wxCommandEvent &) override
void ChangeFootprint(wxCommandEvent &) override
std::vector< wxWindow * > m_tabOrder
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition dialog_shim.h:82
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...
EDA_ANGLE Normalize180()
Definition eda_angle.h:268
void ClearSelected()
Definition eda_item.h:137
bool IsSelected() const
Definition eda_item.h:127
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:98
virtual void SetVisible(bool aVisible)
Definition eda_text.cpp:394
virtual void SetText(const wxString &aText)
Definition eda_text.cpp:278
int GetTextThickness() const
Definition eda_text.h:128
VECTOR2I GetTextSize() const
Definition eda_text.h:261
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition grid_tricks.h:61
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
Definition pcb_view.cpp:57
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
The main frame for Pcbnew.
void SetOrdinal(int aOrdinal)
Definition pcb_field.h:116
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
PCB_FIELD * CloneField() const
Same as Clone, but returns a PCB_FIELD item.
Definition pcb_field.h:92
The selection tool: currently supports:
void StyleFromSettings(const BOARD_DESIGN_SETTINGS &settings, bool aCheckSide) override
Definition pcb_text.cpp:311
static S3D_CACHE * Get3DCacheManager(PROJECT *aProject, bool updateProjDir=false)
Return a pointer to an instance of the 3D cache manager.
void FlushCache(bool closePlugins=true)
Free all data in the cache and by default closes all plugins.
Definition 3d_cache.cpp:525
int AddItemToSel(const TOOL_EVENT &aEvent)
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:177
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:47
#define TEXT_MAX_SIZE_MM
Maximum text size in mm (~10 inches)
Definition eda_text.h:48
@ FP_SMD
Definition footprint.h:82
@ FP_DNP
Definition footprint.h:87
@ FP_EXCLUDE_FROM_POS_FILES
Definition footprint.h:83
@ FP_BOARD_ONLY
Definition footprint.h:85
@ FP_EXCLUDE_FROM_BOM
Definition footprint.h:84
@ FP_THROUGH_HOLE
Definition footprint.h:81
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:73
static const std::string KiCadUriPrefix
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:60
@ B_Cu
Definition layer_ids.h:65
@ F_Fab
Definition layer_ids.h:119
@ F_Cu
Definition layer_ids.h:64
@ B_Fab
Definition layer_ids.h:118
wxColour GetDialogBGColour()
Definition wxgtk/ui.cpp:61
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
KICOMMON_API wxFont GetSmallInfoFont(wxWindow *aWindow)
KICOMMON_API wxFont GetControlFont(wxWindow *aWindow)
KICOMMON_API void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
@ PFC_THICKNESS
see class PGM_BASE
wxString GetUserFieldName(int aFieldNdx, bool aTranslateForHI)
#define DO_TRANSLATE
@ USER
The field ID hasn't been set yet; field is invalid.
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695
@ THERMAL
Use thermal relief for pads.
Definition zones.h:50
@ NONE
Pads are not covered.
Definition zones.h:49
@ FULL
pads are covered by copper
Definition zones.h:51