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
50
51int DIALOG_FOOTPRINT_PROPERTIES::m_page = 0; // remember the last open page during session
52
53
55 FOOTPRINT* aFootprint ) :
57 m_frame( aParent ),
58 m_footprint( aFootprint ),
59 m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ),
60 m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ),
61 m_orientation( aParent, m_orientationLabel, m_orientationCtrl, nullptr ),
62 m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits ),
63 m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl,
64 m_SolderMaskMarginUnits ),
65 m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl,
66 m_SolderPasteMarginUnits ),
67 m_solderPasteRatio( aParent, m_PasteMarginRatioLabel, m_PasteMarginRatioCtrl,
68 m_PasteMarginRatioUnits ),
69 m_returnValue( FP_PROPS_CANCEL ),
70 m_initialized( false ),
71 m_gridSize( 0, 0 ),
72 m_lastRequestedSize( 0, 0 )
73{
74 // Create the extra panels. Embedded files is referenced by the 3D model panel.
77
78 m_NoteBook->AddPage( m_3dPanel, _("3D Models"), false );
79 m_NoteBook->AddPage( m_embeddedFiles, _( "Embedded Files" ) );
80
81 // Configure display origin transforms
84
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 // Give a bit more room for combobox editors
99 m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 );
100
102 m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
103
104 // Show/hide text item columns according to the user's preference
106 m_itemsGrid->ShowHideColumns( cfg->m_FootprintTextShownColumns );
107
108 m_orientation.SetUnits( EDA_UNITS::DEGREES );
110
111 // Set predefined rotations in combo dropdown, according to the locale floating point
112 // separator notation
113 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
114
115 for( size_t ii = 0; ii < m_orientationCtrl->GetCount() && ii < 4; ++ii )
116 m_orientationCtrl->SetString( ii, wxString::Format( "%.1f", rot_list[ii] ) );
117
118 // Set font size for items showing long strings:
119 wxFont infoFont = KIUI::GetInfoFont( this );
120 m_libraryIDLabel->SetFont( infoFont );
121 m_tcLibraryID->SetFont( infoFont );
122
123 infoFont.SetStyle( wxFONTSTYLE_ITALIC );
124 m_staticTextInfoCopper->SetFont( infoFont );
125 m_staticTextInfoPaste->SetFont( infoFont );
126
127 m_NoteBook->SetSelection( m_page );
128
129 if( m_page == 0 )
130 {
134 }
135 else if( m_page == 1 )
136 {
138 }
139
141
142 m_solderPasteRatio.SetUnits( EDA_UNITS::PERCENT );
144
145 // Configure button logos
146 m_bpAdd->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
147 m_bpDelete->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
148
149 m_tcLibraryID->SetBackgroundColour( KIPLATFORM::UI::GetDialogBGColour() );
150
151 // We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
152 // implementation on MSW
153 m_tabOrder = {
165 m_cbDNP,
172 };
173
175
176 // The 3D model tab was added after the base dtor. The final dialog size needs to be set
177 // accordingly.
178 SetSizer( m_GeneralBoxSizer );
179 Layout();
180 m_GeneralBoxSizer->Fit( this );
181
183}
184
185
187{
188 PCBNEW_SETTINGS* cfg = nullptr;
189
190 try
191 {
192 cfg = m_frame->GetPcbNewSettings();
193 }
194 catch( const std::runtime_error& e )
195 {
196 wxFAIL_MSG( e.what() );
197 }
198
199 if( cfg )
200 {
202 }
203
204 // Prevents crash bug in wxGrid's d'tor
206
207 // Delete the GRID_TRICKS.
208 m_itemsGrid->PopEventHandler( true );
209
210 // free the memory used by all models, otherwise models which were
211 // browsed but not used would consume memory
213
214 // the GL canvas has to be visible before it is destroyed
215 m_page = m_NoteBook->GetSelection();
216 m_NoteBook->SetSelection( 1 );
217}
218
219
221{
223 {
225 Close();
226 }
227}
228
229
231{
233 {
235 Close();
236 }
237}
238
239
241{
243 {
245 Close();
246 }
247}
248
249
251{
253 {
255 Close();
256 }
257}
258
259
261{
262 if( !wxDialog::TransferDataToWindow() )
263 return false;
264
265 if( !m_PanelGeneral->TransferDataToWindow() )
266 return false;
267
268 // Add the models to the panel
270 return false;
271
273 return false;
274
275 // Footprint Fields
276 for( PCB_FIELD* srcField : m_footprint->GetFields() )
277 {
278 PCB_FIELD field( *srcField );
280
281 m_fields->push_back( field );
282 }
283
284 // notify the grid
285 wxGridTableMessage tmsg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
287 m_itemsGrid->ProcessTableMessage( tmsg );
288
289 // Footprint Properties
290
293
294 m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
295
296 EDA_ANGLE orientation = m_footprint->GetOrientation();
298
299 m_cbLocked->SetValue( m_footprint->IsLocked() );
300 m_cbLocked->SetToolTip( _( "Locked footprints cannot be freely moved and oriented on the "
301 "canvas and can only be selected when the 'Locked items' checkbox "
302 "is checked in the selection filter." ) );
303
305 m_componentType->SetSelection( 0 );
306 else if( m_footprint->GetAttributes() & FP_SMD )
307 m_componentType->SetSelection( 1 );
308 else
309 m_componentType->SetSelection( 2 );
310
315 m_cbDNP->SetValue( m_footprint->GetAttributes() & FP_DNP );
316
317 // Local Clearances
318
319 if( m_footprint->GetLocalClearance().has_value() )
321 else
322 m_netClearance.SetValue( wxEmptyString );
323
324 if( m_footprint->GetLocalSolderMaskMargin().has_value() )
326 else
327 m_solderMask.SetValue( wxEmptyString );
328
329 if( m_footprint->GetLocalSolderPasteMargin().has_value() )
331 else
332 m_solderPaste.SetValue( wxEmptyString );
333
336 else
337 m_solderPasteRatio.SetValue( wxEmptyString );
338
340
342 {
343 default:
344 case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
345 case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
346 case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
347 case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
348 }
349
350 // Show the footprint's FPID.
351 m_tcLibraryID->SetValue( m_footprint->GetFPID().Format() );
352
353 for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
354 {
355 m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false ) );
356
357 // Adjust the column size.
358 int col_size = m_itemsGrid->GetVisibleWidth( col );
359
360 if( col == PFC_LAYER ) // This one's a drop-down. Check all possible values.
361 {
362 BOARD* board = m_footprint->GetBoard();
363
364 for( PCB_LAYER_ID layer : board->GetEnabledLayers().Seq() )
365 col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
366
367 // Swatch and gaps:
368 col_size += KiROUND( 14 * GetDPIScaleFactor() ) + 12;
369 }
370
371 if( m_itemsGrid->IsColShown( col ) )
372 m_itemsGrid->SetColSize( col, col_size );
373 }
374
375 m_itemsGrid->SetRowLabelSize( 0 );
376
377 Layout();
379 m_initialized = true;
380
381 return true;
382}
383
384
386{
388 return false;
389
390 if( !DIALOG_SHIM::Validate() )
391 return false;
392
393 // Validate texts.
394 for( size_t i = 0; i < m_fields->size(); ++i )
395 {
396 PCB_FIELD& field = m_fields->at( i );
397
398 // Check for missing field names.
399 if( field.GetName( false ).IsEmpty() )
400 {
402 m_delayedErrorMessage = wxString::Format( _( "Fields must have a name." ) );
405
406 return false;
407 }
408
410 int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
411 int width = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, PFC_WIDTH ) );
412 int height = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, PFC_HEIGHT ) );
413
414 if( width < minSize )
415 {
416 wxString min = m_frame->StringFromValue( minSize, true );
417
418 m_itemsGrid->SetCellValue( i, PFC_WIDTH, min );
419
421 m_delayedErrorMessage = wxString::Format( _( "Text width must be at least %s." ), min );
424
425 return false;
426 }
427 else if( width > maxSize )
428 {
429 wxString max = m_frame->StringFromValue( maxSize, true );
430
431 m_itemsGrid->SetCellValue( i, PFC_WIDTH, max );
432
434 m_delayedErrorMessage = wxString::Format( _( "Text width must be at most %s." ), max );
437
438 return false;
439 }
440
441 if( height < minSize )
442 {
443 wxString min = m_frame->StringFromValue( minSize, true );
444
445 m_itemsGrid->SetCellValue( i, PFC_HEIGHT, min );
446
448 m_delayedErrorMessage = wxString::Format( _( "Text height must be at least %s." ), min );
451
452 return false;
453 }
454 else if( height > maxSize )
455 {
456 wxString max = m_frame->StringFromValue( maxSize, true );
457
458 m_itemsGrid->SetCellValue( i, PFC_HEIGHT, max );
459
461 m_delayedErrorMessage = wxString::Format( _( "Text height must be at most %s." ), max );
464
465 return false;
466 }
467
468 // Test for acceptable values for thickness and size and clamp if fails
469 int maxPenWidth = ClampTextPenSize( field.GetTextThickness(), field.GetTextSize() );
470
471 if( field.GetTextThickness() > maxPenWidth )
472 {
473 wxString clamped = m_frame->StringFromValue( maxPenWidth, true );
474
475 m_itemsGrid->SetCellValue( i, PFC_THICKNESS, clamped );
476
478 m_delayedErrorMessage = wxString::Format( _( "Text thickness is too large for the "
479 "text size.\n"
480 "It will be clamped at %s." ),
481 clamped );
484
485 return false;
486 }
487 }
488
489 if( !m_netClearance.Validate( 0, INT_MAX ) )
490 return false;
491
492 return true;
493}
494
495
497{
498 if( !Validate() )
499 return false;
500
502 return false;
503
504 auto view = m_frame->GetCanvas()->GetView();
505 BOARD_COMMIT commit( m_frame );
506 commit.Modify( m_footprint );
507
508 // Make sure this happens inside a commit to capture any changed files
510 return false;
511
513 return false;
514
515 // Clear out embedded files that are no longer in use
516 std::set<wxString> files;
517 std::set<wxString> files_to_delete;
518
519 // Get the new files from the footprint fields
520 for( size_t ii = 0; ii < m_fields->size(); ++ii )
521 {
522 const wxString& name = m_fields->at( ii ).GetText();
523
524 if( name.StartsWith( FILEEXT::KiCadUriPrefix ) )
525 files.insert( name );
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 if( field->GetText().StartsWith( FILEEXT::KiCadUriPrefix ) )
532 {
533 if( files.find( field->GetText() ) == files.end() )
534 files_to_delete.insert( field->GetText() );
535 }
536 }
537
538 for( const wxString& file : files_to_delete )
539 {
540 wxString name = file.Mid( FILEEXT::KiCadUriPrefix.size() + 3 ); // Skip "kicad-embed://"
542 }
543
544 // Update fields
545 for( size_t ii = 0; ii < m_fields->size(); ++ii )
546 {
547 PCB_FIELD& field = m_fields->at( ii );
549 }
550
551 size_t i = 0;
552
553 for( PCB_FIELD* field : m_footprint->GetFields() )
554 {
555 // copy grid table entries till we run out, then delete any remaining texts
556 if( i < m_fields->size() )
557 *field = m_fields->at( i++ );
558 else
559 field->DeleteStructure();
560 }
561
562 // if there are still grid table entries, create new fields for them
563 while( i < m_fields->size() )
564 {
565 view->Add( m_footprint->AddField( m_fields->at( i++ ) ) );
566 }
567
568 // Initialize masks clearances
569 if( m_netClearance.IsNull() )
571 else
573
574 if( m_solderMask.IsNull() )
576 else
578
579 if( m_solderPaste.IsNull() )
581 else
583
586 else
588
589 switch( m_ZoneConnectionChoice->GetSelection() )
590 {
591 default:
592 case 0: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::INHERITED ); break;
593 case 1: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::FULL ); break;
594 case 2: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::THERMAL ); break;
595 case 3: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::NONE ); break;
596 }
597
598 // Set Footprint Position
600 m_footprint->SetPosition( pos );
601 m_footprint->SetLocked( m_cbLocked->GetValue() );
602
603 int attributes = 0;
604
605 switch( m_componentType->GetSelection() )
606 {
607 case 0: attributes |= FP_THROUGH_HOLE; break;
608 case 1: attributes |= FP_SMD; break;
609 default: break;
610 }
611
612 if( m_boardOnly->GetValue() )
613 attributes |= FP_BOARD_ONLY;
614
615 if( m_excludeFromPosFiles->GetValue() )
616 attributes |= FP_EXCLUDE_FROM_POS_FILES;
617
618 if( m_excludeFromBOM->GetValue() )
619 attributes |= FP_EXCLUDE_FROM_BOM;
620
621 if( m_cbDNP->GetValue() )
622 attributes |= FP_DNP;
623
624 if( m_noCourtyards->GetValue() )
625 attributes |= FP_ALLOW_MISSING_COURTYARD;
626
627 if( m_allowSolderMaskBridges->GetValue() )
628 attributes |= FP_ALLOW_SOLDERMASK_BRIDGES;
629
630 m_footprint->SetAttributes( attributes );
631
633
634 if( m_footprint->GetOrientation() != orient )
636
637 // Set component side, that also have effect on the fields positions on board
638 bool change_layer = false;
639 if( m_BoardSideCtrl->GetSelection() == 0 ) // layer req = COMPONENT
640 {
641 if( m_footprint->GetLayer() == B_Cu )
642 change_layer = true;
643 }
644 else if( m_footprint->GetLayer() == F_Cu )
645 change_layer = true;
646
647 if( change_layer )
648 {
651 }
652
653 // Copy the models from the panel to the footprint
654 std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
655 std::vector<FP_3DMODEL>* fpList = &m_footprint->Models();
656 fpList->clear();
657 fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
658
659 // This is a simple edit, we must create an undo entry
660 if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
661 commit.Push( _( "Edit Footprint Properties" ) );
662
664 return true;
665}
666
667
669{
671 return;
672
675
676 newField.SetVisible( false );
677 newField.SetLayer( m_footprint->GetLayer() == F_Cu ? F_Fab : B_Fab );
678 newField.SetFPRelativePosition( { 0, 0 } );
680
681 m_fields->push_back( newField );
682
683 // notify the grid
684 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
685 m_itemsGrid->ProcessTableMessage( msg );
686
687 m_itemsGrid->SetFocus();
688 m_itemsGrid->MakeCellVisible( m_fields->size() - 1, 0 );
689 m_itemsGrid->SetGridCursor( m_fields->size() - 1, 0 );
690
691 m_itemsGrid->EnableCellEditControl( true );
692 m_itemsGrid->ShowCellEditControl();
693
694 OnModify();
695}
696
697
699{
701 return;
702
703 wxArrayInt selectedRows = m_itemsGrid->GetSelectedRows();
704
705 if( selectedRows.empty() && m_itemsGrid->GetGridCursorRow() >= 0 )
706 selectedRows.push_back( m_itemsGrid->GetGridCursorRow() );
707
708 if( selectedRows.empty() )
709 return;
710
711 for( int row : selectedRows )
712 {
713
714 if( row < m_fields->GetMandatoryRowCount() )
715 {
716 DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
718 return;
719 }
720 }
721
722 m_itemsGrid->CommitPendingChanges( true /* quiet mode */ );
723 m_itemsGrid->ClearSelection();
724
725 // Reverse sort so deleting a row doesn't change the indexes of the other rows.
726 selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } );
727
728 for( int row : selectedRows )
729 {
730 m_fields->erase( m_fields->begin() + row );
731
732 // notify the grid
733 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
734 m_itemsGrid->ProcessTableMessage( msg );
735
736 if( m_itemsGrid->GetNumberRows() > 0 )
737 {
738 m_itemsGrid->MakeCellVisible( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
739 m_itemsGrid->SetGridCursor( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
740 }
741 }
742
743 OnModify();
744}
745
746
748{
749 // Account for scroll bars
751
752 itemsWidth -= m_itemsGrid->GetRowLabelSize();
753
754 for( int i = 0; i < m_itemsGrid->GetNumberCols(); i++ )
755 {
756 if( i == 1 )
757 continue;
758
759 itemsWidth -= m_itemsGrid->GetColSize( i );
760 }
761
762 m_itemsGrid->SetColSize(
763 1, std::max( itemsWidth, m_itemsGrid->GetVisibleWidth( 0, true, false ) ) );
764
765 // Update the width of the 3D panel
767}
768
769
771{
772 if( !m_initialized )
773 return;
774
775 // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
776 // even when the original validation was triggered from a killFocus event, and so
777 // that the corresponding notebook page can be shown in the background when triggered
778 // from an OK.
779 if( m_delayedFocusRow >= 0 )
780 {
781 // We will re-enter this routine if an error dialog is displayed, so make sure we
782 // zero out our member variables first.
783 wxGrid* grid = m_delayedFocusGrid;
784 int row = m_delayedFocusRow;
785 int col = m_delayedFocusColumn;
786 wxString msg = m_delayedErrorMessage;
787
788 m_delayedFocusGrid = nullptr;
791 m_delayedErrorMessage = wxEmptyString;
792
793 if( !msg.IsEmpty() )
794 {
795 // Do not use DisplayErrorMessage(); it screws up window order on Mac
796 DisplayError( nullptr, msg );
797 }
798
799 grid->SetFocus();
800 grid->MakeCellVisible( row, col );
801
802 // Selecting the first grid item only makes sense for the
803 // items grid
804 if( !m_initialFocus || grid == m_itemsGrid )
805 {
806 grid->SetGridCursor( row, col );
807
808 if( !( col == 0 && row < m_fields->GetMandatoryRowCount() ) )
809 grid->EnableCellEditControl( true );
810
811 grid->ShowCellEditControl();
812
813 if( grid == m_itemsGrid && row == 0 && col == 0 )
814 {
815 auto referenceEditor = grid->GetCellEditor( 0, 0 );
816
817 if( auto textEntry = dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) )
818 KIUI::SelectReferenceNumber( textEntry );
819
820 referenceEditor->DecRef();
821 }
822 }
823
824 m_initialFocus = false;
825 }
826}
827
828
830{
831 wxSize new_size = aEvent.GetSize();
832
833 if( ( !m_itemsGrid->IsCellEditControlShown() || m_lastRequestedSize != new_size )
834 && m_gridSize != new_size )
835 {
836 m_gridSize = new_size;
837
838 // A trick to fix a cosmetic issue: when, in m_itemsGrid, a layer selector widget has
839 // the focus (is activated in column 6) when resizing the grid, the widget is not moved.
840 // So just change the widget having the focus in this case
841 if( m_NoteBook->GetSelection() == 0 && !m_itemsGrid->HasFocus() )
842 {
843 int col = m_itemsGrid->GetGridCursorCol();
844
845 if( col == 6 ) // a layer selector widget can be activated
846 m_itemsGrid->SetFocus();
847 }
848
850 }
851
852 // We store this value to check whether the dialog is changing size. This might indicate
853 // that the user is scaling the dialog with an editor shown. Some editors do not close
854 // (at least on GTK) when the user drags a dialog corner
855 m_lastRequestedSize = new_size;
856
857 // Always propagate for a grid repaint (needed if the height changes, as well as width)
858 aEvent.Skip();
859
860}
861
862
863void DIALOG_FOOTPRINT_PROPERTIES::OnPageChanging( wxNotebookEvent& aEvent )
864{
866 aEvent.Veto();
867}
868
869
870void DIALOG_FOOTPRINT_PROPERTIES::OnCheckBox( wxCommandEvent& event )
871{
872 if( m_initialized )
873 OnModify();
874}
875
876
877void DIALOG_FOOTPRINT_PROPERTIES::OnCombobox( wxCommandEvent& event )
878{
879 if( m_initialized )
880 OnModify();
881}
882
883
884void DIALOG_FOOTPRINT_PROPERTIES::OnText( wxCommandEvent& event )
885{
886 if( m_initialized )
887 OnModify();
888}
889
890
891void DIALOG_FOOTPRINT_PROPERTIES::OnChoice( wxCommandEvent& event )
892{
893 if( m_initialized )
894 OnModify();
895}
const char * name
Definition: DXF_plotter.cpp:59
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
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 Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:290
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:47
void SetFPRelativePosition(const VECTOR2I &aPos)
Definition: board_item.cpp:341
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:295
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:831
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
Definition: board.cpp:1625
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:616
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
Definition: board.cpp:1679
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Modify a given item in the model.
Definition: commit.h:108
Class DIALOG_FOOTPRINT_PROPERTIES_BASE.
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 OnGridSize(wxSizeEvent &aEvent) override
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
Definition: dialog_shim.h:250
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:102
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void OnModify()
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
EDA_ANGLE Normalize()
Definition: eda_angle.h:221
EDA_ANGLE Normalize180()
Definition: eda_angle.h:260
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:131
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:379
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:270
int GetTextThickness() const
Definition: eda_text.h:126
VECTOR2I GetTextSize() const
Definition: eda_text.h:248
void RemoveFile(const wxString &name, bool aErase=true)
Remove a file from the collection and frees the memory.
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2500
ZONE_CONNECTION GetLocalZoneConnection() const
Definition: footprint.h:286
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:419
EDA_ANGLE GetOrientation() const
Definition: footprint.h:225
void SetLocalSolderPasteMarginRatio(std::optional< double > aRatio)
Definition: footprint.h:283
PCB_FIELD * AddField(const PCB_FIELD &aField)
Add a field to the symbol.
Definition: footprint.cpp:686
void SetAttributes(int aAttributes)
Definition: footprint.h:289
std::optional< int > GetLocalSolderPasteMargin() const
Definition: footprint.h:279
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: footprint.cpp:2403
int GetNextFieldId() const
Return the next ID for a field for this footprint.
Definition: footprint.h:742
std::optional< int > GetLocalClearance() const
Definition: footprint.h:273
int GetAttributes() const
Definition: footprint.h:288
void SetLocalZoneConnection(ZONE_CONNECTION aType)
Definition: footprint.h:285
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:234
const LIB_ID & GetFPID() const
Definition: footprint.h:246
bool IsLocked() const override
Definition: footprint.h:409
std::optional< double > GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:282
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: footprint.cpp:2438
void GetFields(std::vector< PCB_FIELD * > &aVector, bool aVisibleOnly) const
Populate a std::vector with PCB_TEXTs.
Definition: footprint.cpp:680
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:218
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition: footprint.h:277
void SetLocalClearance(std::optional< int > aClearance)
Definition: footprint.h:274
std::optional< int > GetLocalSolderMaskMargin() const
Definition: footprint.h:276
void SetLocalSolderPasteMargin(std::optional< int > aMargin)
Definition: footprint.h:280
VECTOR2I GetPosition() const override
Definition: footprint.h:222
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition: grid_tricks.h:61
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
UTF8 Format() const
Definition: lib_id.cpp:118
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:297
EMBEDDED_FILES * GetLocalFiles()
bool TransferDataToWindow() override
bool TransferDataFromWindow() override
std::vector< FP_3DMODEL > & GetModelList()
FLIP_DIRECTION m_FlipDirection
wxString m_FootprintTextShownColumns
PCBNEW_SETTINGS * GetPcbNewSettings() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Return the BOARD_DESIGN_SETTINGS for the open project.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
The main frame for Pcbnew.
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Definition: pcb_field.cpp:96
void StyleFromSettings(const BOARD_DESIGN_SETTINGS &settings) override
Definition: pcb_text.cpp:300
static S3D_CACHE * Get3DCacheManager(PROJECT *aProject, bool updateProjDir=false)
Return a pointer to an instance of the 3D cache manager.
Definition: project_pcb.cpp:77
void FlushCache(bool closePlugins=true)
Free all data in the cache and by default closes all plugins.
Definition: 3d_cache.cpp:524
void SetBitmap(const wxBitmapBundle &aBmp)
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aValue in internal units into a united string.
int ValueFromString(const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aTextValue in aUnits to internal units used by the frame.
virtual long long int GetValue()
Return the current value in Internal Units.
virtual void SetPrecision(int aLength)
Normally not needed, but can be used to set the precision when using internal units that are floats (...
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
virtual EDA_ANGLE GetAngleValue()
virtual void SetNegativeZero()
Definition: unit_binder.h:73
virtual double GetDoubleValue()
Return the current value in Internal Units.
virtual void SetAngleValue(const EDA_ANGLE &aValue)
virtual void SetDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
virtual bool Validate(double aMin, double aMax, EDA_UNITS aUnits=EDA_UNITS::UNSCALED)
Validate the control against the given range, informing the user of any errors found.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
Definition: unit_binder.h:200
bool IsNull() const
Return true if the control holds no value (ie: empty string, not 0).
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=true, bool aKeep=false)
Calculate the specified column based on the actual size of the text on screen.
Definition: wx_grid.cpp:776
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:494
void SetTable(wxGridTableBase *table, bool aTakeOwnership=false)
Hide wxGrid's SetTable() method with one which doesn't mess up the grid column widths when setting th...
Definition: wx_grid.cpp:275
void DestroyTable(wxGridTableBase *aTable)
Work-around for a bug in wxGrid which crashes when deleting the table if the cell edit control was no...
Definition: wx_grid.cpp:449
wxString GetShownColumnsAsString()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:464
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:644
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:170
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:80
@ FP_DNP
Definition: footprint.h:87
@ FP_ALLOW_MISSING_COURTYARD
Definition: footprint.h:86
@ FP_EXCLUDE_FROM_POS_FILES
Definition: footprint.h:81
@ FP_BOARD_ONLY
Definition: footprint.h:83
@ FP_EXCLUDE_FROM_BOM
Definition: footprint.h:82
@ FP_THROUGH_HOLE
Definition: footprint.h:79
@ FP_ALLOW_SOLDERMASK_BRIDGES
Definition: footprint.h:85
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:72
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
wxSize GetUnobscuredSize(const wxWindow *aWindow)
Tries to determine the size of the viewport of a scrollable widget (wxDataViewCtrl,...
Definition: wxgtk/ui.cpp:252
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:155
KICOMMON_API void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:229
@ PFC_HEIGHT
@ PFC_THICKNESS
see class PGM_BASE
constexpr int mmToIU(double mm) const
Definition: base_units.h:88
wxString GetUserFieldName(int aFieldNdx, bool aTranslateForHI)
#define DO_TRANSLATE