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 ),
67 m_initialized( false )
68{
69 // Create the extra panels. Embedded files is referenced by the 3D model panel.
72
73 m_NoteBook->AddPage( m_3dPanel, _("3D Models"), false );
74 m_NoteBook->AddPage( m_embeddedFiles, _( "Embedded Files" ) );
75
76 // Configure display origin transforms
79
80 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
81 embeddedFilesStack.push_back( m_embeddedFiles->GetLocalFiles() );
82 embeddedFilesStack.push_back( m_frame->GetBoard()->GetEmbeddedFiles() );
83
84 m_fields = new PCB_FIELDS_GRID_TABLE( m_frame, this, std::move( embeddedFilesStack ) );
85
86 m_delayedErrorMessage = wxEmptyString;
87 m_delayedFocusGrid = nullptr;
90 m_initialFocus = false;
91
92 // Give an icon
93 wxIcon icon;
94 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit ) );
95 SetIcon( icon );
96
97 m_itemsGrid->SetTable( m_fields );
98 m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
99 m_itemsGrid->SetupColumnAutosizer( PFC_VALUE );
100 m_itemsGrid->ShowHideColumns( "0 1 2 3 4 5 7" );
101
103 m_orientation.SetPrecision( 3 );
104
105 // Set predefined rotations in combo dropdown, according to the locale floating point
106 // separator notation
107 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
108
109 for( size_t ii = 0; ii < m_orientationCtrl->GetCount() && ii < 4; ++ii )
110 m_orientationCtrl->SetString( ii, wxString::Format( "%.1f", rot_list[ii] ) );
111
112 // Set font size for items showing long strings:
113 wxFont infoFont = KIUI::GetSmallInfoFont( this );
114 m_libraryIDLabel->SetFont( infoFont );
115 m_tcLibraryID->SetFont( infoFont );
116
117 infoFont = KIUI::GetInfoFont( this ).Italic();
118 m_staticTextInfoCopper->SetFont( infoFont );
119 m_staticTextInfoPaste->SetFont( infoFont );
120
121 m_NoteBook->SetSelection( m_page );
122
123 if( m_page == 0 )
124 {
128 }
129 else if( m_page == 1 )
130 {
132 }
133
134 // Update label text and tooltip for combined offset + ratio field
135 m_SolderPasteMarginLabel->SetLabel( _( "Solder paste clearance:" ) );
136 m_SolderPasteMarginLabel->SetToolTip( _( "Local solder paste clearance for this footprint.\n"
137 "Enter an absolute value (e.g., -0.1mm), a percentage "
138 "(e.g., -5%), or both (e.g., -0.1mm - 5%).\n"
139 "If blank, the global value is used." ) );
140
141 // Configure button logos
144
145 m_tcLibraryID->SetBackgroundColour( KIPLATFORM::UI::GetDialogBGColour() );
146
147 // We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
148 // implementation on MSW
149 m_tabOrder = {
160 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 wxCHECK2( srcField, continue );
257
258 PCB_FIELD field( *srcField );
259 field.SetText( m_footprint->GetBoard()->ConvertKIIDsToCrossReferences( field.GetText() ) );
260
261 m_fields->push_back( field );
262 }
263
264 // notify the grid
265 wxGridTableMessage tmsg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->GetNumberRows() );
266 m_itemsGrid->ProcessTableMessage( tmsg );
267
268 // Footprint Properties
269
270 m_posX.SetValue( m_footprint->GetPosition().x );
271 m_posY.SetValue( m_footprint->GetPosition().y );
272
273 m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
274
275 EDA_ANGLE orientation = m_footprint->GetOrientation();
276 m_orientation.SetAngleValue( orientation.Normalize180() );
277
278 m_cbLocked->SetValue( m_footprint->IsLocked() );
279 m_cbLocked->SetToolTip( _( "Locked footprints cannot be freely moved or oriented on the canvas and can only be "
280 "selected when the 'Locked items' checkbox is checked in the selection filter." ) );
281
282 if( m_footprint->GetAttributes() & FP_THROUGH_HOLE )
283 m_componentType->SetSelection( 0 );
284 else if( m_footprint->GetAttributes() & FP_SMD )
285 m_componentType->SetSelection( 1 );
286 else
287 m_componentType->SetSelection( 2 );
288
289 m_boardOnly->SetValue( m_footprint->GetAttributes() & FP_BOARD_ONLY );
290 m_excludeFromPosFiles->SetValue( m_footprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES );
291 m_excludeFromBOM->SetValue( m_footprint->GetAttributes() & FP_EXCLUDE_FROM_BOM );
292 m_cbDNP->SetValue( m_footprint->GetAttributes() & FP_DNP );
293
294 // Local Clearances
295
296 if( m_footprint->GetLocalClearance().has_value() )
297 m_netClearance.SetValue( m_footprint->GetLocalClearance().value() );
298 else
299 m_netClearance.SetValue( wxEmptyString );
300
301 if( m_footprint->GetLocalSolderMaskMargin().has_value() )
302 m_solderMask.SetValue( m_footprint->GetLocalSolderMaskMargin().value() );
303 else
304 m_solderMask.SetValue( wxEmptyString );
305
306 m_solderPaste.SetOffsetValue( m_footprint->GetLocalSolderPasteMargin() );
307 m_solderPaste.SetRatioValue( m_footprint->GetLocalSolderPasteMarginRatio() );
308
309 m_allowSolderMaskBridges->SetValue( m_footprint->AllowSolderMaskBridges() );
310
311 switch( m_footprint->GetLocalZoneConnection() )
312 {
313 default:
314 case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
315 case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
316 case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
317 case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
318 }
319
320 wxString jumperGroups;
321
322 if( m_footprint->GetDuplicatePadNumbersAreJumpers() )
323 jumperGroups = _( "all pads with duplicate numbers" );
324
325 for( const std::set<wxString>& group : m_footprint->JumperPadGroups() )
326 {
327 wxString groupTxt;
328
329 for( const wxString& pinNumber : group )
330 {
331 if( !groupTxt.IsEmpty() )
332 groupTxt << ", ";
333
334 groupTxt << pinNumber;
335 }
336
337 if( !jumperGroups.IsEmpty() )
338 jumperGroups << "; ";
339
340 jumperGroups << "(" << groupTxt << ")";
341 }
342
343 if( jumperGroups.IsEmpty() )
344 {
345 m_jumperGroupsText->SetLabel( _( "none" ) );
347 }
348 else
349 {
350 m_jumperGroupsText->SetLabel( jumperGroups );
351 }
352
353 // Show the footprint's FPID.
354 m_tcLibraryID->SetValue( m_footprint->GetFPID().Format() );
355
356 for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
357 {
358 m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false ) );
359
360 // Adjust the column size.
361 int col_size = m_itemsGrid->GetVisibleWidth( col );
362
363 if( col == PFC_LAYER ) // This one's a drop-down. Check all possible values.
364 {
365 BOARD* board = m_footprint->GetBoard();
366
367 for( PCB_LAYER_ID layer : board->GetEnabledLayers() )
368 col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
369
370 // Swatch and gaps:
371 col_size += KiROUND( 14 * GetDPIScaleFactor() ) + 12;
372 }
373
374 if( m_itemsGrid->IsColShown( col ) )
375 m_itemsGrid->SetColSize( col, col_size );
376 }
377
378 m_itemsGrid->SetRowLabelSize( 0 );
379
380 Layout();
381 m_initialized = true;
382
383 return true;
384}
385
386
388{
389 if( !m_itemsGrid->CommitPendingChanges() )
390 return false;
391
392 if( !DIALOG_SHIM::Validate() )
393 return false;
394
395 // Validate texts.
396 for( size_t i = 0; i < m_fields->size(); ++i )
397 {
398 PCB_FIELD& field = m_fields->at( i );
399
400 // Check for missing field names.
401 if( field.GetName( false ).IsEmpty() )
402 {
404 m_delayedErrorMessage = wxString::Format( _( "Fields must have a name." ) );
407
408 return false;
409 }
410
411 int minSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM );
412 int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
413 int width = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, PFC_WIDTH ) );
414 int height = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, PFC_HEIGHT ) );
415
416 if( width < minSize )
417 {
418 wxString min = m_frame->StringFromValue( minSize, true );
419
420 m_itemsGrid->SetCellValue( i, PFC_WIDTH, min );
421
423 m_delayedErrorMessage = wxString::Format( _( "Text width must be at least %s." ), min );
426
427 return false;
428 }
429 else if( width > maxSize )
430 {
431 wxString max = m_frame->StringFromValue( maxSize, true );
432
433 m_itemsGrid->SetCellValue( i, PFC_WIDTH, max );
434
436 m_delayedErrorMessage = wxString::Format( _( "Text width must be at most %s." ), max );
439
440 return false;
441 }
442
443 if( height < minSize )
444 {
445 wxString min = m_frame->StringFromValue( minSize, true );
446
447 m_itemsGrid->SetCellValue( i, PFC_HEIGHT, min );
448
450 m_delayedErrorMessage = wxString::Format( _( "Text height must be at least %s." ), min );
453
454 return false;
455 }
456 else if( height > maxSize )
457 {
458 wxString max = m_frame->StringFromValue( maxSize, true );
459
460 m_itemsGrid->SetCellValue( i, PFC_HEIGHT, max );
461
463 m_delayedErrorMessage = wxString::Format( _( "Text height must be at most %s." ), max );
466
467 return false;
468 }
469
470 // Test for acceptable values for thickness and size and clamp if fails
471 int maxPenWidth = ClampTextPenSize( field.GetTextThickness(), field.GetTextSize() );
472
473 if( field.GetTextThickness() > maxPenWidth )
474 {
475 wxString clamped = m_frame->StringFromValue( maxPenWidth, true );
476
477 m_itemsGrid->SetCellValue( i, PFC_THICKNESS, clamped );
478
480 m_delayedErrorMessage = wxString::Format( _( "Text thickness is too large for the text size.\n"
481 "It will be clamped at %s." ),
482 clamped );
485
486 return false;
487 }
488 }
489
490 if( !m_netClearance.Validate( 0, INT_MAX ) )
491 return false;
492
493 return true;
494}
495
496
498{
499 if( !Validate() )
500 return false;
501
502 if( !m_itemsGrid->CommitPendingChanges() )
503 return false;
504
505 KIGFX::PCB_VIEW* view = m_frame->GetCanvas()->GetView();
506 PCB_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
507 BOARD_COMMIT commit( m_frame );
508 commit.Modify( m_footprint );
509
510 // Make sure this happens inside a commit to capture any changed files
511 if( !m_3dPanel->TransferDataFromWindow() )
512 return false;
513
514 if( !m_embeddedFiles->TransferDataFromWindow() )
515 return false;
516
517 // Clear out embedded files that are no longer in use
518 std::set<wxString> files;
519 std::set<wxString> files_to_delete;
520
521 // Get the new files from the footprint fields
522 for( PCB_FIELD& field : *m_fields )
523 {
524 if( field.GetText().StartsWith( FILEEXT::KiCadUriPrefix ) )
525 files.insert( field.GetText() );
526 }
527
528 // Find any files referenced in the old fields that are not in the new fields
529 for( PCB_FIELD* field : m_footprint->GetFields() )
530 {
531 wxCHECK2( field, continue );
532
533 if( field->GetText().StartsWith( FILEEXT::KiCadUriPrefix ) )
534 {
535 if( files.find( field->GetText() ) == files.end() )
536 files_to_delete.insert( field->GetText() );
537 }
538 }
539
540 for( const wxString& file : files_to_delete )
541 {
542 wxString name = file.Mid( FILEEXT::KiCadUriPrefix.size() + 3 ); // Skip "kicad-embed://"
543 m_footprint->RemoveFile( name );
544 }
545
546 // Update fields
547 BOARD* board = m_footprint->GetBoard();
548
549 for( PCB_FIELD* existing : m_footprint->GetFields() )
550 {
551 if( board )
552 board->UncacheItemById( existing->m_Uuid );
553
554 delete existing;
555 }
556
557 m_footprint->GetFields().clear();
558
559 int ordinal = 42; // Arbitrarily larger than any mandatory FIELD_T ids.
560
561 for( PCB_FIELD& field : *m_fields )
562 {
563 PCB_FIELD* newField = field.CloneField();
564 newField->SetText( commit.GetBoard()->ConvertCrossReferencesToKIIDs( field.GetText() ) );
565
566 if( !field.IsMandatory() )
567 newField->SetOrdinal( ordinal++ );
568
569 m_footprint->Add( newField );
570 view->Add( newField );
571
572 if( newField->IsSelected() )
573 {
574 // The old copy was in the selection list, but this one is not. Remove the
575 // out-of-sync selection flag so we can re-add the field to the selection.
576 newField->ClearSelected();
577 selectionTool->AddItemToSel( newField, true );
578 }
579 }
580
581 // Initialize masks clearances
582 if( m_netClearance.IsNull() )
583 m_footprint->SetLocalClearance( {} );
584 else
585 m_footprint->SetLocalClearance( m_netClearance.GetValue() );
586
587 if( m_solderMask.IsNull() )
588 m_footprint->SetLocalSolderMaskMargin( {} );
589 else
590 m_footprint->SetLocalSolderMaskMargin( m_solderMask.GetValue() );
591
592 m_footprint->SetLocalSolderPasteMargin( m_solderPaste.GetOffsetValue() );
593 m_footprint->SetLocalSolderPasteMarginRatio( m_solderPaste.GetRatioValue() );
594
595 switch( m_ZoneConnectionChoice->GetSelection() )
596 {
597 default:
598 case 0: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::INHERITED ); break;
599 case 1: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::FULL ); break;
600 case 2: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::THERMAL ); break;
601 case 3: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::NONE ); break;
602 }
603
604 // Set Footprint Position
605 VECTOR2I pos( m_posX.GetValue(), m_posY.GetValue() );
606 m_footprint->SetPosition( pos );
607 m_footprint->SetLocked( m_cbLocked->GetValue() );
608
609 int attributes = 0;
610
611 switch( m_componentType->GetSelection() )
612 {
613 case 0: attributes |= FP_THROUGH_HOLE; break;
614 case 1: attributes |= FP_SMD; break;
615 default: break;
616 }
617
618 if( m_boardOnly->GetValue() )
619 attributes |= FP_BOARD_ONLY;
620
621 if( m_excludeFromPosFiles->GetValue() )
622 attributes |= FP_EXCLUDE_FROM_POS_FILES;
623
624 if( m_excludeFromBOM->GetValue() )
625 attributes |= FP_EXCLUDE_FROM_BOM;
626
627 if( m_cbDNP->GetValue() )
628 attributes |= FP_DNP;
629
630 m_footprint->SetAttributes( attributes );
631
632 m_footprint->SetAllowSolderMaskBridges( m_allowSolderMaskBridges->GetValue() );
633
634 EDA_ANGLE orient = m_orientation.GetAngleValue().Normalize();
635
636 if( m_footprint->GetOrientation() != orient )
637 m_footprint->Rotate( m_footprint->GetPosition(), orient - m_footprint->GetOrientation() );
638
639 // Set component side, that also have effect on the fields positions on board
640 bool change_layer = false;
641
642 if( m_BoardSideCtrl->GetSelection() == 0 ) // layer req = COMPONENT
643 {
644 if( m_footprint->GetLayer() == B_Cu )
645 change_layer = true;
646 }
647 else if( m_footprint->GetLayer() == F_Cu )
648 {
649 change_layer = true;
650 }
651
652 if( change_layer )
653 m_footprint->Flip( m_footprint->GetPosition(), m_frame->GetPcbNewSettings()->m_FlipDirection );
654
655 // Copy the models from the panel to the footprint
656 std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
657 std::vector<FP_3DMODEL>* fpList = &m_footprint->Models();
658 fpList->clear();
659 fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
660
661 // This is a simple edit, we must create an undo entry
662 if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
663 commit.Push( _( "Edit Footprint Properties" ) );
664
666 return true;
667}
668
669
671{
672 m_itemsGrid->OnAddRow(
673 [&]() -> std::pair<int, int>
674 {
676
677 newField.SetVisible( false );
678 newField.SetLayer( m_footprint->GetLayer() == F_Cu ? F_Fab : B_Fab );
679 newField.SetFPRelativePosition( { 0, 0 } );
680 newField.StyleFromSettings( m_frame->GetDesignSettings(), true );
681
682 m_fields->push_back( newField );
683
684 // notify the grid
685 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
686 m_itemsGrid->ProcessTableMessage( msg );
687 OnModify();
688
689 return { m_fields->size() - 1, PFC_NAME };
690 } );
691}
692
693
695{
696 m_itemsGrid->OnDeleteRows(
697 [&]( int row )
698 {
699 if( row < m_fields->GetMandatoryRowCount() )
700 {
701 DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
702 m_fields->GetMandatoryRowCount() ) );
703 return false;
704 }
705
706 return true;
707 },
708 [&]( int row )
709 {
710 m_fields->erase( m_fields->begin() + row );
711
712 // notify the grid
713 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
714 m_itemsGrid->ProcessTableMessage( msg );
715 } );
716
717 OnModify();
718}
719
720
722{
723 if( !m_initialized )
724 return;
725
726 // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
727 // even when the original validation was triggered from a killFocus event, and so
728 // that the corresponding notebook page can be shown in the background when triggered
729 // from an OK.
730 if( m_delayedFocusRow >= 0 )
731 {
732 // We will re-enter this routine if an error dialog is displayed, so make sure we
733 // zero out our member variables first.
734 wxGrid* grid = m_delayedFocusGrid;
735 int row = m_delayedFocusRow;
736 int col = m_delayedFocusColumn;
737 wxString msg = m_delayedErrorMessage;
738
739 m_delayedFocusGrid = nullptr;
742 m_delayedErrorMessage = wxEmptyString;
743
744 if( !msg.IsEmpty() )
745 {
746 // Do not use DisplayErrorMessage(); it screws up window order on Mac
747 DisplayError( nullptr, msg );
748 }
749
750 grid->SetFocus();
751 grid->MakeCellVisible( row, col );
752
753 // Selecting the first grid item only makes sense for the
754 // items grid
755 if( !m_initialFocus || grid == m_itemsGrid )
756 {
757 grid->SetGridCursor( row, col );
758
759 if( !( col == 0 && row < m_fields->GetMandatoryRowCount() ) )
760 grid->EnableCellEditControl( true );
761
762 grid->ShowCellEditControl();
763
764 if( grid == m_itemsGrid && row == 0 && col == 0 )
765 {
766 wxGridCellEditor* referenceEditor = grid->GetCellEditor( 0, 0 );
767
768 if( wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) )
769 KIUI::SelectReferenceNumber( textEntry );
770
771 referenceEditor->DecRef();
772 }
773 }
774
775 m_initialFocus = false;
776 }
777}
778
779
780void DIALOG_FOOTPRINT_PROPERTIES::OnPageChanging( wxNotebookEvent& aEvent )
781{
782 if( !m_itemsGrid->CommitPendingChanges() )
783 aEvent.Veto();
784}
785
786
787void DIALOG_FOOTPRINT_PROPERTIES::OnCheckBox( wxCommandEvent& event )
788{
789 if( m_initialized )
790 OnModify();
791}
792
793
794void DIALOG_FOOTPRINT_PROPERTIES::OnCombobox( wxCommandEvent& event )
795{
796 if( m_initialized )
797 OnModify();
798}
799
800
801void DIALOG_FOOTPRINT_PROPERTIES::OnText( wxCommandEvent& event )
802{
803 if( m_initialized )
804 OnModify();
805}
806
807
808void DIALOG_FOOTPRINT_PROPERTIES::OnChoice( wxCommandEvent& event )
809{
810 if( m_initialized )
811 OnModify();
812}
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:284
void SetFPRelativePosition(const VECTOR2I &aPos)
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:322
void UncacheItemById(const KIID &aId)
Remove an item from the item-by-id cache.
Definition board.h:1443
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition board.cpp:730
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:969
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:142
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:398
virtual void SetText(const wxString &aText)
Definition eda_text.cpp:282
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:118
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:85
@ FP_DNP
Definition footprint.h:90
@ FP_EXCLUDE_FROM_POS_FILES
Definition footprint.h:86
@ FP_BOARD_ONLY
Definition footprint.h:88
@ FP_EXCLUDE_FROM_BOM
Definition footprint.h:87
@ FP_THROUGH_HOLE
Definition footprint.h:84
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:62
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