KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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 <mrluzeiro@ua.pt>
5 * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
6 * Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com
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
57 FOOTPRINT* aFootprint ) :
59 m_frame( aParent ),
60 m_footprint( aFootprint ),
61 m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ),
62 m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ),
63 m_orientation( aParent, m_orientationLabel, m_orientationCtrl, nullptr ),
64 m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits ),
65 m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl,
66 m_SolderMaskMarginUnits ),
67 m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl,
68 m_SolderPasteMarginUnits ),
69 m_solderPasteRatio( aParent, m_PasteMarginRatioLabel, m_PasteMarginRatioCtrl,
70 m_PasteMarginRatioUnits ),
71 m_returnValue( FP_PROPS_CANCEL ),
72 m_initialized( false ),
73 m_gridSize( 0, 0 ),
74 m_lastRequestedSize( 0, 0 )
75{
76 // Create the extra panels. Embedded files is referenced by the 3D model panel.
79
80 m_NoteBook->AddPage( m_3dPanel, _("3D Models"), false );
81 m_NoteBook->AddPage( m_embeddedFiles, _( "Embedded Files" ) );
82
83 // Configure display origin transforms
86
88
89 m_delayedErrorMessage = wxEmptyString;
90 m_delayedFocusGrid = nullptr;
93 m_initialFocus = false;
94
95 // Give an icon
96 wxIcon icon;
97 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit ) );
98 SetIcon( icon );
99
100 // Give a bit more room for combobox editors
101 m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 );
102
104 m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
105
106 // Show/hide text item columns according to the user's preference
108 m_itemsGrid->ShowHideColumns( cfg->m_FootprintTextShownColumns );
109
110 m_orientation.SetUnits( EDA_UNITS::DEGREES );
112
113 // Set predefined rotations in combo dropdown, according to the locale floating point
114 // separator notation
115 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
116
117 for( size_t ii = 0; ii < m_orientationCtrl->GetCount() && ii < 4; ++ii )
118 m_orientationCtrl->SetString( ii, wxString::Format( "%.1f", rot_list[ii] ) );
119
120 // Set font size for items showing long strings:
121 wxFont infoFont = KIUI::GetInfoFont( this );
122 m_libraryIDLabel->SetFont( infoFont );
123 m_tcLibraryID->SetFont( infoFont );
124
125 infoFont.SetStyle( wxFONTSTYLE_ITALIC );
126 m_staticTextInfoCopper->SetFont( infoFont );
127 m_staticTextInfoPaste->SetFont( infoFont );
128
129 m_NoteBook->SetSelection( m_page );
130
131 if( m_page == 0 )
132 {
136 }
137 else if( m_page == 1 )
138 {
140 }
141
143
144 m_solderPasteRatio.SetUnits( EDA_UNITS::PERCENT );
146
147 // Configure button logos
148 m_bpAdd->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
149 m_bpDelete->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
150
151 m_tcLibraryID->SetBackgroundColour( KIPLATFORM::UI::GetDialogBGColour() );
152
153 // We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
154 // implementation on MSW
155 m_tabOrder = {
167 m_cbDNP,
174 };
175
177
178 // The 3D model tab was added after the base dtor. The final dialog size needs to be set
179 // accordingly.
180 SetSizer( m_GeneralBoxSizer );
181 Layout();
182 m_GeneralBoxSizer->Fit( this );
183
185}
186
187
189{
190 PCBNEW_SETTINGS* cfg = nullptr;
191
192 try
193 {
194 cfg = m_frame->GetPcbNewSettings();
195 }
196 catch( const std::runtime_error& e )
197 {
198 wxFAIL_MSG( e.what() );
199 }
200
201 if( cfg )
202 {
204 }
205
206 // Prevents crash bug in wxGrid's d'tor
208
209 // Delete the GRID_TRICKS.
210 m_itemsGrid->PopEventHandler( true );
211
212 // free the memory used by all models, otherwise models which were
213 // browsed but not used would consume memory
215
216 // the GL canvas has to be visible before it is destroyed
217 m_page = m_NoteBook->GetSelection();
218 m_NoteBook->SetSelection( 1 );
219}
220
221
223{
225 {
227 Close();
228 }
229}
230
231
233{
235 {
237 Close();
238 }
239}
240
241
243{
245 {
247 Close();
248 }
249}
250
251
253{
255 {
257 Close();
258 }
259}
260
261
263{
264 if( !wxDialog::TransferDataToWindow() )
265 return false;
266
267 if( !m_PanelGeneral->TransferDataToWindow() )
268 return false;
269
270 // Add the models to the panel
272 return false;
273
275 return false;
276
277 // Footprint Fields
278 for( PCB_FIELD* srcField : m_footprint->GetFields() )
279 {
280 PCB_FIELD field( *srcField );
282
283 m_fields->push_back( field );
284 }
285
286 // notify the grid
287 wxGridTableMessage tmsg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
289 m_itemsGrid->ProcessTableMessage( tmsg );
290
291 // Footprint Properties
292
295
296 m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
297
298 EDA_ANGLE orientation = m_footprint->GetOrientation();
300
301 m_cbLocked->SetValue( m_footprint->IsLocked() );
302 m_cbLocked->SetToolTip( _( "Locked footprints cannot be freely moved and oriented on the "
303 "canvas and can only be selected when the 'Locked items' checkbox "
304 "is checked in the selection filter." ) );
305
307 m_componentType->SetSelection( 0 );
308 else if( m_footprint->GetAttributes() & FP_SMD )
309 m_componentType->SetSelection( 1 );
310 else
311 m_componentType->SetSelection( 2 );
312
317 m_cbDNP->SetValue( m_footprint->GetAttributes() & FP_DNP );
318
319 // Local Clearances
320
321 if( m_footprint->GetLocalClearance().has_value() )
323 else
324 m_netClearance.SetValue( wxEmptyString );
325
326 if( m_footprint->GetLocalSolderMaskMargin().has_value() )
328 else
329 m_solderMask.SetValue( wxEmptyString );
330
331 if( m_footprint->GetLocalSolderPasteMargin().has_value() )
333 else
334 m_solderPaste.SetValue( wxEmptyString );
335
338 else
339 m_solderPasteRatio.SetValue( wxEmptyString );
340
342
344 {
345 default:
346 case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
347 case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
348 case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
349 case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
350 }
351
352 // Show the footprint's FPID.
353 m_tcLibraryID->SetValue( m_footprint->GetFPID().Format() );
354
355 for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
356 {
357 m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false ) );
358
359 // Adjust the column size.
360 int col_size = m_itemsGrid->GetVisibleWidth( col );
361
362 if( col == PFC_LAYER ) // This one's a drop-down. Check all possible values.
363 {
364 BOARD* board = m_footprint->GetBoard();
365
366 for( PCB_LAYER_ID layer : board->GetEnabledLayers().Seq() )
367 col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
368
369 // Swatch and gaps:
370 col_size += KiROUND( 14 * GetDPIScaleFactor() ) + 12;
371 }
372
373 if( m_itemsGrid->IsColShown( col ) )
374 m_itemsGrid->SetColSize( col, col_size );
375 }
376
377 m_itemsGrid->SetRowLabelSize( 0 );
378
379 Layout();
381 m_initialized = true;
382
383 return true;
384}
385
386
388{
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
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 "
481 "text size.\n"
482 "It will be clamped at %s." ),
483 clamped );
486
487 return false;
488 }
489 }
490
491 if( !m_netClearance.Validate( 0, INT_MAX ) )
492 return false;
493
494 return true;
495}
496
497
499{
500 if( !Validate() )
501 return false;
502
504 return false;
505
508 BOARD_COMMIT commit( m_frame );
509 commit.Modify( m_footprint );
510
511 // Make sure this happens inside a commit to capture any changed files
513 return false;
514
516 return false;
517
518 // Clear out embedded files that are no longer in use
519 std::set<wxString> files;
520 std::set<wxString> files_to_delete;
521
522 // Get the new files from the footprint fields
523 for( PCB_FIELD& field : *m_fields )
524 {
525 if( field.GetText().StartsWith( FILEEXT::KiCadUriPrefix ) )
526 files.insert( field.GetText() );
527 }
528
529 // Find any files referenced in the old fields that are not in the new fields
530 for( PCB_FIELD* field : m_footprint->GetFields() )
531 {
532 if( field->GetText().StartsWith( FILEEXT::KiCadUriPrefix ) )
533 {
534 if( files.find( field->GetText() ) == files.end() )
535 files_to_delete.insert( field->GetText() );
536 }
537 }
538
539 for( const wxString& file : files_to_delete )
540 {
541 wxString name = file.Mid( FILEEXT::KiCadUriPrefix.size() + 3 ); // Skip "kicad-embed://"
543 }
544
545 // Update fields
546 for( PCB_FIELD* existing : m_footprint->GetFields() )
547 delete existing;
548
549 m_footprint->GetFields().clear();
550
551 int ordinal = 42; // Arbitrarily larger than any mandatory FIELD_T ids.
552
553 for( PCB_FIELD& field : *m_fields )
554 {
555 PCB_FIELD* newField = field.CloneField();
556 newField->SetText( commit.GetBoard()->ConvertCrossReferencesToKIIDs( field.GetText() ) );
557
558 if( !field.IsMandatory() )
559 newField->SetOrdinal( ordinal++ );
560
561 m_footprint->Add( newField );
562 view->Add( newField );
563
564 if( newField->IsSelected() )
565 {
566 // The old copy was in the selection list, but this one is not. Remove the
567 // out-of-sync selection flag so we can re-add the field to the selection.
568 newField->ClearSelected();
569 selectionTool->AddItemToSel( newField, true );
570 }
571 }
572
573 // Initialize masks clearances
574 if( m_netClearance.IsNull() )
576 else
578
579 if( m_solderMask.IsNull() )
581 else
583
584 if( m_solderPaste.IsNull() )
586 else
588
591 else
593
594 switch( m_ZoneConnectionChoice->GetSelection() )
595 {
596 default:
597 case 0: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::INHERITED ); break;
598 case 1: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::FULL ); break;
599 case 2: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::THERMAL ); break;
600 case 3: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::NONE ); break;
601 }
602
603 // Set Footprint Position
605 m_footprint->SetPosition( pos );
606 m_footprint->SetLocked( m_cbLocked->GetValue() );
607
608 int attributes = 0;
609
610 switch( m_componentType->GetSelection() )
611 {
612 case 0: attributes |= FP_THROUGH_HOLE; break;
613 case 1: attributes |= FP_SMD; break;
614 default: break;
615 }
616
617 if( m_boardOnly->GetValue() )
618 attributes |= FP_BOARD_ONLY;
619
620 if( m_excludeFromPosFiles->GetValue() )
621 attributes |= FP_EXCLUDE_FROM_POS_FILES;
622
623 if( m_excludeFromBOM->GetValue() )
624 attributes |= FP_EXCLUDE_FROM_BOM;
625
626 if( m_cbDNP->GetValue() )
627 attributes |= FP_DNP;
628
629 if( m_noCourtyards->GetValue() )
630 attributes |= FP_ALLOW_MISSING_COURTYARD;
631
632 if( m_allowSolderMaskBridges->GetValue() )
633 attributes |= FP_ALLOW_SOLDERMASK_BRIDGES;
634
635 m_footprint->SetAttributes( attributes );
636
638
639 if( m_footprint->GetOrientation() != orient )
641
642 // Set component side, that also have effect on the fields positions on board
643 bool change_layer = false;
644 if( m_BoardSideCtrl->GetSelection() == 0 ) // layer req = COMPONENT
645 {
646 if( m_footprint->GetLayer() == B_Cu )
647 change_layer = true;
648 }
649 else if( m_footprint->GetLayer() == F_Cu )
650 change_layer = true;
651
652 if( change_layer )
653 {
656 }
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{
676 return;
677
678 PCB_FIELD newField( m_footprint, FIELD_T::USER,
680
681 newField.SetVisible( false );
682 newField.SetLayer( m_footprint->GetLayer() == F_Cu ? F_Fab : B_Fab );
683 newField.SetFPRelativePosition( { 0, 0 } );
685
686 m_fields->push_back( newField );
687
688 // notify the grid
689 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
690 m_itemsGrid->ProcessTableMessage( msg );
691
692 m_itemsGrid->SetFocus();
693 m_itemsGrid->MakeCellVisible( m_fields->size() - 1, 0 );
694 m_itemsGrid->SetGridCursor( m_fields->size() - 1, 0 );
695
696 m_itemsGrid->EnableCellEditControl( true );
697 m_itemsGrid->ShowCellEditControl();
698
699 OnModify();
700}
701
702
704{
706 return;
707
708 wxArrayInt selectedRows = m_itemsGrid->GetSelectedRows();
709
710 if( selectedRows.empty() && m_itemsGrid->GetGridCursorRow() >= 0 )
711 selectedRows.push_back( m_itemsGrid->GetGridCursorRow() );
712
713 if( selectedRows.empty() )
714 return;
715
716 for( int row : selectedRows )
717 {
718
719 if( row < m_fields->GetMandatoryRowCount() )
720 {
721 DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
723 return;
724 }
725 }
726
727 m_itemsGrid->CommitPendingChanges( true /* quiet mode */ );
728 m_itemsGrid->ClearSelection();
729
730 // Reverse sort so deleting a row doesn't change the indexes of the other rows.
731 selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } );
732
733 for( int row : selectedRows )
734 {
735 m_fields->erase( m_fields->begin() + row );
736
737 // notify the grid
738 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
739 m_itemsGrid->ProcessTableMessage( msg );
740
741 if( m_itemsGrid->GetNumberRows() > 0 )
742 {
743 m_itemsGrid->MakeCellVisible( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
744 m_itemsGrid->SetGridCursor( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
745 }
746 }
747
748 OnModify();
749}
750
751
753{
754 // Account for scroll bars
756
757 itemsWidth -= m_itemsGrid->GetRowLabelSize();
758
759 for( int i = 0; i < m_itemsGrid->GetNumberCols(); i++ )
760 {
761 if( i == 1 )
762 continue;
763
764 itemsWidth -= m_itemsGrid->GetColSize( i );
765 }
766
767 m_itemsGrid->SetColSize(
768 1, std::max( itemsWidth, m_itemsGrid->GetVisibleWidth( 0, true, false ) ) );
769
770 // Update the width of the 3D panel
772}
773
774
776{
777 if( !m_initialized )
778 return;
779
780 // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
781 // even when the original validation was triggered from a killFocus event, and so
782 // that the corresponding notebook page can be shown in the background when triggered
783 // from an OK.
784 if( m_delayedFocusRow >= 0 )
785 {
786 // We will re-enter this routine if an error dialog is displayed, so make sure we
787 // zero out our member variables first.
788 wxGrid* grid = m_delayedFocusGrid;
789 int row = m_delayedFocusRow;
790 int col = m_delayedFocusColumn;
791 wxString msg = m_delayedErrorMessage;
792
793 m_delayedFocusGrid = nullptr;
796 m_delayedErrorMessage = wxEmptyString;
797
798 if( !msg.IsEmpty() )
799 {
800 // Do not use DisplayErrorMessage(); it screws up window order on Mac
801 DisplayError( nullptr, msg );
802 }
803
804 grid->SetFocus();
805 grid->MakeCellVisible( row, col );
806
807 // Selecting the first grid item only makes sense for the
808 // items grid
809 if( !m_initialFocus || grid == m_itemsGrid )
810 {
811 grid->SetGridCursor( row, col );
812
813 if( !( col == 0 && row < m_fields->GetMandatoryRowCount() ) )
814 grid->EnableCellEditControl( true );
815
816 grid->ShowCellEditControl();
817
818 if( grid == m_itemsGrid && row == 0 && col == 0 )
819 {
820 auto referenceEditor = grid->GetCellEditor( 0, 0 );
821
822 if( auto textEntry = dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) )
823 KIUI::SelectReferenceNumber( textEntry );
824
825 referenceEditor->DecRef();
826 }
827 }
828
829 m_initialFocus = false;
830 }
831}
832
833
835{
836 wxSize new_size = aEvent.GetSize();
837
838 if( ( !m_itemsGrid->IsCellEditControlShown() || m_lastRequestedSize != new_size )
839 && m_gridSize != new_size )
840 {
841 m_gridSize = new_size;
842
843 // A trick to fix a cosmetic issue: when, in m_itemsGrid, a layer selector widget has
844 // the focus (is activated in column 6) when resizing the grid, the widget is not moved.
845 // So just change the widget having the focus in this case
846 if( m_NoteBook->GetSelection() == 0 && !m_itemsGrid->HasFocus() )
847 {
848 int col = m_itemsGrid->GetGridCursorCol();
849
850 if( col == 6 ) // a layer selector widget can be activated
851 m_itemsGrid->SetFocus();
852 }
853
855 }
856
857 // We store this value to check whether the dialog is changing size. This might indicate
858 // that the user is scaling the dialog with an editor shown. Some editors do not close
859 // (at least on GTK) when the user drags a dialog corner
860 m_lastRequestedSize = new_size;
861
862 // Always propagate for a grid repaint (needed if the height changes, as well as width)
863 aEvent.Skip();
864
865}
866
867
868void DIALOG_FOOTPRINT_PROPERTIES::OnPageChanging( wxNotebookEvent& aEvent )
869{
871 aEvent.Veto();
872}
873
874
875void DIALOG_FOOTPRINT_PROPERTIES::OnCheckBox( wxCommandEvent& event )
876{
877 if( m_initialized )
878 OnModify();
879}
880
881
882void DIALOG_FOOTPRINT_PROPERTIES::OnCombobox( wxCommandEvent& event )
883{
884 if( m_initialized )
885 OnModify();
886}
887
888
889void DIALOG_FOOTPRINT_PROPERTIES::OnText( wxCommandEvent& event )
890{
891 if( m_initialized )
892 OnModify();
893}
894
895
896void DIALOG_FOOTPRINT_PROPERTIES::OnChoice( wxCommandEvent& event )
897{
898 if( m_initialized )
899 OnModify();
900}
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 SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:284
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:296
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:830
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:615
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
Definition: board.cpp:1699
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:214
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:66
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:137
void ClearSelected()
Definition: eda_item.h:126
bool IsSelected() const
Definition: eda_item.h:116
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:2435
ZONE_CONNECTION GetLocalZoneConnection() const
Definition: footprint.h:288
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:421
EDA_ANGLE GetOrientation() const
Definition: footprint.h:227
void SetLocalSolderPasteMarginRatio(std::optional< double > aRatio)
Definition: footprint.h:285
void SetAttributes(int aAttributes)
Definition: footprint.h:291
std::optional< int > GetLocalSolderPasteMargin() const
Definition: footprint.h:281
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: footprint.cpp:2344
std::optional< int > GetLocalClearance() const
Definition: footprint.h:275
int GetAttributes() const
Definition: footprint.h:290
void SetLocalZoneConnection(ZONE_CONNECTION aType)
Definition: footprint.h:287
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:236
const LIB_ID & GetFPID() const
Definition: footprint.h:248
bool IsLocked() const override
Definition: footprint.h:411
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:1048
std::optional< double > GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:284
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: footprint.cpp:2376
void GetFields(std::vector< PCB_FIELD * > &aVector, bool aVisibleOnly) const
Populate a std::vector with PCB_TEXTs.
Definition: footprint.cpp:627
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:220
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition: footprint.h:279
void SetLocalClearance(std::optional< int > aClearance)
Definition: footprint.h:276
std::optional< int > GetLocalSolderMaskMargin() const
Definition: footprint.h:278
void SetLocalSolderPasteMargin(std::optional< int > aMargin)
Definition: footprint.h:282
VECTOR2I GetPosition() const override
Definition: footprint.h:224
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.
UTF8 Format() const
Definition: lib_id.cpp:119
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.
void SetOrdinal(int aOrdinal)
Definition: pcb_field.h:114
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Definition: pcb_field.cpp:100
PCB_FIELD * CloneField() const
Same as Clone, but returns a PCB_FIELD item.
Definition: pcb_field.h:90
The selection tool: currently supports:
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
int AddItemToSel(const TOOL_EVENT &aEvent)
void SetBitmap(const wxBitmapBundle &aBmp)
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
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)
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:81
@ FP_DNP
Definition: footprint.h:88
@ FP_ALLOW_MISSING_COURTYARD
Definition: footprint.h:87
@ FP_EXCLUDE_FROM_POS_FILES
Definition: footprint.h:82
@ FP_BOARD_ONLY
Definition: footprint.h:84
@ FP_EXCLUDE_FROM_BOM
Definition: footprint.h:83
@ FP_THROUGH_HOLE
Definition: footprint.h:80
@ FP_ALLOW_SOLDERMASK_BRIDGES
Definition: footprint.h:86
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:156
KICOMMON_API void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:230
@ 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