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 (C) 2004-2024 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 3D models page
76 m_NoteBook->AddPage( m_3dPanel, _("3D Models"), false );
77
78 // Configure display origin transforms
81
83
84 m_delayedErrorMessage = wxEmptyString;
85 m_delayedFocusGrid = nullptr;
88 m_initialFocus = false;
89
90 // Give an icon
91 wxIcon icon;
92 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit ) );
93 SetIcon( icon );
94
95 // Give a bit more room for combobox editors
96 m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 );
97
99 m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
100
101 // Show/hide text item columns according to the user's preference
103 m_itemsGrid->ShowHideColumns( cfg->m_FootprintTextShownColumns );
104
105 m_orientation.SetUnits( EDA_UNITS::DEGREES );
107
108 // Set predefined rotations in combo dropdown, according to the locale floating point
109 // separator notation
110 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
111
112 for( size_t ii = 0; ii < m_orientationCtrl->GetCount() && ii < 4; ++ii )
113 m_orientationCtrl->SetString( ii, wxString::Format( "%.1f", rot_list[ii] ) );
114
115 // Set font size for items showing long strings:
116 wxFont infoFont = KIUI::GetInfoFont( this );
117 m_libraryIDLabel->SetFont( infoFont );
118 m_tcLibraryID->SetFont( infoFont );
119
120 infoFont.SetStyle( wxFONTSTYLE_ITALIC );
121 m_staticTextInfoCopper->SetFont( infoFont );
122 m_staticTextInfoPaste->SetFont( infoFont );
123
124 m_NoteBook->SetSelection( m_page );
125
126 if( m_page == 0 )
127 {
131 }
132 else if( m_page == 1 )
133 {
135 }
136
138
139 m_solderPasteRatio.SetUnits( EDA_UNITS::PERCENT );
141
142 // Configure button logos
143 m_bpAdd->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
144 m_bpDelete->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
145
146 m_tcLibraryID->SetBackgroundColour( KIPLATFORM::UI::GetDialogBGColour() );
147
148 // We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
149 // implementation on MSW
150 m_tabOrder = {
162 m_cbDNP,
169 };
170
172
174 m_initialized = true;
175}
176
177
179{
180 PCBNEW_SETTINGS* cfg = nullptr;
181
182 try
183 {
184 cfg = m_frame->GetPcbNewSettings();
185 }
186 catch( const std::runtime_error& e )
187 {
188 wxFAIL_MSG( e.what() );
189 }
190
191 if( cfg )
192 {
194 }
195
196 // Prevents crash bug in wxGrid's d'tor
198
199 // Delete the GRID_TRICKS.
200 m_itemsGrid->PopEventHandler( true );
201
202 // free the memory used by all models, otherwise models which were
203 // browsed but not used would consume memory
205
206 // the GL canvas has to be visible before it is destroyed
207 m_page = m_NoteBook->GetSelection();
208 m_NoteBook->SetSelection( 1 );
209}
210
211
213{
215 {
217 Close();
218 }
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{
254 if( !wxDialog::TransferDataToWindow() )
255 return false;
256
257 if( !m_PanelGeneral->TransferDataToWindow() )
258 return false;
259
260 // Add the models to the panel
262 return false;
263
264 // Footprint Fields
265 for( PCB_FIELD* srcField : m_footprint->GetFields() )
266 {
267 PCB_FIELD field( *srcField );
269
270 m_fields->push_back( field );
271 }
272
273 // notify the grid
274 wxGridTableMessage tmsg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
276 m_itemsGrid->ProcessTableMessage( tmsg );
277
278 // Footprint Properties
279
282
283 m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
284
285 EDA_ANGLE orientation = m_footprint->GetOrientation();
287
288 m_cbLocked->SetValue( m_footprint->IsLocked() );
289 m_cbLocked->SetToolTip( _( "Locked footprints cannot be freely moved and oriented on the "
290 "canvas and can only be selected when the 'Locked items' checkbox "
291 "is checked in the selection filter." ) );
292
294 m_componentType->SetSelection( 0 );
295 else if( m_footprint->GetAttributes() & FP_SMD )
296 m_componentType->SetSelection( 1 );
297 else
298 m_componentType->SetSelection( 2 );
299
304 m_cbDNP->SetValue( m_footprint->GetAttributes() & FP_DNP );
305
306 // Local Clearances
307
308 if( m_footprint->GetLocalClearance().has_value() )
310 else
311 m_netClearance.SetValue( wxEmptyString );
312
313 if( m_footprint->GetLocalSolderMaskMargin().has_value() )
315 else
316 m_solderMask.SetValue( wxEmptyString );
317
318 if( m_footprint->GetLocalSolderPasteMargin().has_value() )
320 else
321 m_solderPaste.SetValue( wxEmptyString );
322
325 else
326 m_solderPasteRatio.SetValue( wxEmptyString );
327
329
331 {
332 default:
333 case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
334 case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
335 case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
336 case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
337 }
338
339 // Show the footprint's FPID.
340 m_tcLibraryID->SetValue( m_footprint->GetFPID().Format() );
341
342 for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
343 {
344 m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false ) );
345
346 // Adjust the column size.
347 int col_size = m_itemsGrid->GetVisibleWidth( col );
348
349 if( col == PFC_LAYER ) // This one's a drop-down. Check all possible values.
350 {
351 BOARD* board = m_footprint->GetBoard();
352
353 for( PCB_LAYER_ID layer : board->GetEnabledLayers().Seq() )
354 col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
355
356 // And the swatch:
357 col_size += 20;
358 }
359
360 if( m_itemsGrid->IsColShown( col ) )
361 m_itemsGrid->SetColSize( col, col_size );
362 }
363
364 m_itemsGrid->SetRowLabelSize( 0 );
365
366 Layout();
368
369 return true;
370}
371
372
374{
376 return false;
377
378 if( !DIALOG_SHIM::Validate() )
379 return false;
380
381 // Validate texts.
382 for( size_t i = 0; i < m_fields->size(); ++i )
383 {
384 PCB_FIELD& field = m_fields->at( i );
385
386 // Check for missing field names.
387 if( field.GetName( false ).IsEmpty() )
388 {
390 m_delayedErrorMessage = wxString::Format( _( "Fields must have a name." ) );
393
394 return false;
395 }
396
398 int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
399 int width = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, PFC_WIDTH ) );
400 int height = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, PFC_HEIGHT ) );
401
402 if( width < minSize )
403 {
404 wxString min = m_frame->StringFromValue( minSize, true );
405
406 m_itemsGrid->SetCellValue( i, PFC_WIDTH, min );
407
409 m_delayedErrorMessage = wxString::Format( _( "Text width must be at least %s." ), min );
412
413 return false;
414 }
415 else if( width > maxSize )
416 {
417 wxString max = m_frame->StringFromValue( maxSize, true );
418
419 m_itemsGrid->SetCellValue( i, PFC_WIDTH, max );
420
422 m_delayedErrorMessage = wxString::Format( _( "Text width must be at most %s." ), max );
425
426 return false;
427 }
428
429 if( height < minSize )
430 {
431 wxString min = m_frame->StringFromValue( minSize, true );
432
433 m_itemsGrid->SetCellValue( i, PFC_HEIGHT, min );
434
436 m_delayedErrorMessage = wxString::Format( _( "Text height must be at least %s." ), min );
439
440 return false;
441 }
442 else if( height > maxSize )
443 {
444 wxString max = m_frame->StringFromValue( maxSize, true );
445
446 m_itemsGrid->SetCellValue( i, PFC_HEIGHT, max );
447
449 m_delayedErrorMessage = wxString::Format( _( "Text height must be at most %s." ), max );
452
453 return false;
454 }
455
456 // Test for acceptable values for thickness and size and clamp if fails
457 int maxPenWidth = Clamp_Text_PenSize( field.GetTextThickness(), field.GetTextSize() );
458
459 if( field.GetTextThickness() > maxPenWidth )
460 {
461 wxString clamped = m_frame->StringFromValue( maxPenWidth, true );
462
463 m_itemsGrid->SetCellValue( i, PFC_THICKNESS, clamped );
464
466 m_delayedErrorMessage = wxString::Format( _( "Text thickness is too large for the "
467 "text size.\n"
468 "It will be clamped at %s." ),
469 clamped );
472
473 return false;
474 }
475 }
476
477 if( !m_netClearance.Validate( 0, INT_MAX ) )
478 return false;
479
480 return true;
481}
482
483
485{
486 if( !Validate() )
487 return false;
488
490 return false;
491
492 // This only commits the editor, model updating is done below so it is inside
493 // the commit
495 return false;
496
497 auto view = m_frame->GetCanvas()->GetView();
498 BOARD_COMMIT commit( m_frame );
499 commit.Modify( m_footprint );
500
501 // Update fields
502 for( size_t ii = 0; ii < m_fields->size(); ++ii )
503 {
504 PCB_FIELD& field = m_fields->at( ii );
506 }
507
508 size_t i = 0;
509
510 for( PCB_FIELD* field : m_footprint->GetFields() )
511 {
512 // copy grid table entries till we run out, then delete any remaining texts
513 if( i < m_fields->size() )
514 *field = m_fields->at( i++ );
515 else
516 field->DeleteStructure();
517 }
518
519 // if there are still grid table entries, create new fields for them
520 while( i < m_fields->size() )
521 {
522 view->Add( m_footprint->AddField( m_fields->at( i++ ) ) );
523 }
524
525 // Initialize masks clearances
526 if( m_netClearance.IsNull() )
528 else
530
531 if( m_solderMask.IsNull() )
533 else
535
536 if( m_solderPaste.IsNull() )
538 else
540
543 else
545
546 switch( m_ZoneConnectionChoice->GetSelection() )
547 {
548 default:
549 case 0: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::INHERITED ); break;
550 case 1: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::FULL ); break;
551 case 2: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::THERMAL ); break;
552 case 3: m_footprint->SetLocalZoneConnection( ZONE_CONNECTION::NONE ); break;
553 }
554
555 // Set Footprint Position
557 m_footprint->SetPosition( pos );
558 m_footprint->SetLocked( m_cbLocked->GetValue() );
559
560 int attributes = 0;
561
562 switch( m_componentType->GetSelection() )
563 {
564 case 0: attributes |= FP_THROUGH_HOLE; break;
565 case 1: attributes |= FP_SMD; break;
566 default: break;
567 }
568
569 if( m_boardOnly->GetValue() )
570 attributes |= FP_BOARD_ONLY;
571
572 if( m_excludeFromPosFiles->GetValue() )
573 attributes |= FP_EXCLUDE_FROM_POS_FILES;
574
575 if( m_excludeFromBOM->GetValue() )
576 attributes |= FP_EXCLUDE_FROM_BOM;
577
578 if( m_cbDNP->GetValue() )
579 attributes |= FP_DNP;
580
581 if( m_noCourtyards->GetValue() )
582 attributes |= FP_ALLOW_MISSING_COURTYARD;
583
584 if( m_allowSolderMaskBridges->GetValue() )
585 attributes |= FP_ALLOW_SOLDERMASK_BRIDGES;
586
587 m_footprint->SetAttributes( attributes );
588
590
591 if( m_footprint->GetOrientation() != orient )
593
594 // Set component side, that also have effect on the fields positions on board
595 bool change_layer = false;
596 if( m_BoardSideCtrl->GetSelection() == 0 ) // layer req = COMPONENT
597 {
598 if( m_footprint->GetLayer() == B_Cu )
599 change_layer = true;
600 }
601 else if( m_footprint->GetLayer() == F_Cu )
602 change_layer = true;
603
604 if( change_layer )
606
607 // Copy the models from the panel to the footprint
608 std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
609 std::vector<FP_3DMODEL>* fpList = &m_footprint->Models();
610 fpList->clear();
611 fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
612
613 // This is a simple edit, we must create an undo entry
614 if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
615 commit.Push( _( "Edit Footprint Properties" ) );
616
618 return true;
619}
620
621
623{
625 return;
626
627 int fieldId = (int) m_fields->size();
628 PCB_FIELD newField =
631
632 newField.SetVisible( false );
633 newField.SetLayer( m_footprint->GetLayer() == F_Cu ? F_Fab : B_Fab );
634 newField.SetFPRelativePosition( { 0, 0 } );
636
637 m_fields->push_back( newField );
638
639 // notify the grid
640 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
641 m_itemsGrid->ProcessTableMessage( msg );
642
643 m_itemsGrid->SetFocus();
644 m_itemsGrid->MakeCellVisible( m_fields->size() - 1, 0 );
645 m_itemsGrid->SetGridCursor( m_fields->size() - 1, 0 );
646
647 m_itemsGrid->EnableCellEditControl( true );
648 m_itemsGrid->ShowCellEditControl();
649}
650
651
653{
655 return;
656
657 wxArrayInt selectedRows = m_itemsGrid->GetSelectedRows();
658
659 if( selectedRows.empty() && m_itemsGrid->GetGridCursorRow() >= 0 )
660 selectedRows.push_back( m_itemsGrid->GetGridCursorRow() );
661
662 if( selectedRows.empty() )
663 return;
664
665 for( int row : selectedRows )
666 {
667 if( row < MANDATORY_FIELDS )
668 {
669 DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
671 return;
672 }
673 }
674
675 m_itemsGrid->CommitPendingChanges( true /* quiet mode */ );
676 m_itemsGrid->ClearSelection();
677
678 // Reverse sort so deleting a row doesn't change the indexes of the other rows.
679 selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } );
680
681 for( int row : selectedRows )
682 {
683 m_fields->erase( m_fields->begin() + row );
684
685 // notify the grid
686 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
687 m_itemsGrid->ProcessTableMessage( msg );
688
689 if( m_itemsGrid->GetNumberRows() > 0 )
690 {
691 m_itemsGrid->MakeCellVisible( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
692 m_itemsGrid->SetGridCursor( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
693 }
694 }
695}
696
697
699{
700 // Account for scroll bars
702
703 itemsWidth -= m_itemsGrid->GetRowLabelSize();
704
705 for( int i = 0; i < m_itemsGrid->GetNumberCols(); i++ )
706 {
707 if( i == 1 )
708 continue;
709
710 itemsWidth -= m_itemsGrid->GetColSize( i );
711 }
712
713 m_itemsGrid->SetColSize(
714 1, std::max( itemsWidth, m_itemsGrid->GetVisibleWidth( 0, true, false ) ) );
715
716 // Update the width of the 3D panel
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 < MANDATORY_FIELDS ) )
760 grid->EnableCellEditControl( true );
761
762 grid->ShowCellEditControl();
763
764 if( grid == m_itemsGrid && row == 0 && col == 0 )
765 {
766 auto referenceEditor = grid->GetCellEditor( 0, 0 );
767
768 if( auto textEntry = dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) )
769 KIUI::SelectReferenceNumber( textEntry );
770
771 referenceEditor->DecRef();
772 }
773 }
774 m_initialFocus = false;
775 }
776}
777
778
780{
781 wxSize new_size = aEvent.GetSize();
782
783 if( ( !m_itemsGrid->IsCellEditControlShown() || m_lastRequestedSize != new_size )
784 && m_gridSize != new_size )
785 {
786 m_gridSize = new_size;
787
788 // A trick to fix a cosmetic issue: when, in m_itemsGrid, a layer selector widget has
789 // the focus (is activated in column 6) when resizing the grid, the widget is not moved.
790 // So just change the widget having the focus in this case
791 if( m_NoteBook->GetSelection() == 0 && !m_itemsGrid->HasFocus() )
792 {
793 int col = m_itemsGrid->GetGridCursorCol();
794
795 if( col == 6 ) // a layer selector widget can be activated
796 m_itemsGrid->SetFocus();
797 }
798
800 }
801
802 // We store this value to check whether the dialog is changing size. This might indicate
803 // that the user is scaling the dialog with an editor shown. Some editors do not close
804 // (at least on GTK) when the user drags a dialog corner
805 m_lastRequestedSize = new_size;
806
807 // Always propagate for a grid repaint (needed if the height changes, as well as width)
808 aEvent.Skip();
809
810}
811
812
813void DIALOG_FOOTPRINT_PROPERTIES::OnPageChange( wxNotebookEvent& aEvent )
814{
815 int page = aEvent.GetSelection();
816
817 // Shouldn't be necessary, but is on at least OSX
818 if( page >= 0 )
819 m_NoteBook->ChangeSelection( (unsigned) page );
820}
821
822
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
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
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:260
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
void SetFPRelativePosition(const VECTOR2I &aPos)
Definition: board_item.cpp:276
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:282
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:677
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
Definition: board.cpp:1433
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:564
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
Definition: board.cpp:1487
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
Definition: commit.h:105
Class DIALOG_FOOTPRINT_PROPERTIES_BASE.
void OnDeleteField(wxCommandEvent &) override
void OnUpdateUI(wxUpdateUIEvent &) override
void OnAddField(wxCommandEvent &) override
void OnPageChange(wxNotebookEvent &event) override
PANEL_FP_PROPERTIES_3D_MODEL * m_3dPanel
void OnGridSize(wxSizeEvent &aEvent) override
void EditLibraryFootprint(wxCommandEvent &) override
DIALOG_FOOTPRINT_PROPERTIES(PCB_EDIT_FRAME *aParent, FOOTPRINT *aFootprint)
void EditFootprint(wxCommandEvent &) override
void UpdateFootprint(wxCommandEvent &) override
void ChangeFootprint(wxCommandEvent &) override
std::vector< wxWindow * > m_tabOrder
Definition: dialog_shim.h:230
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 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:255
EDA_ANGLE Normalize180()
Definition: eda_angle.h:294
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:132
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:243
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:181
int GetTextThickness() const
Definition: eda_text.h:126
VECTOR2I GetTextSize() const
Definition: eda_text.h:222
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2315
ZONE_CONNECTION GetLocalZoneConnection() const
Definition: footprint.h:274
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:407
EDA_ANGLE GetOrientation() const
Definition: footprint.h:212
void SetLocalSolderPasteMarginRatio(std::optional< double > aRatio)
Definition: footprint.h:271
PCB_FIELD * AddField(const PCB_FIELD &aField)
Add a field to the symbol.
Definition: footprint.cpp:580
void SetAttributes(int aAttributes)
Definition: footprint.h:277
std::optional< int > GetLocalSolderPasteMargin() const
Definition: footprint.h:267
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: footprint.cpp:2219
std::optional< int > GetLocalClearance() const
Definition: footprint.h:261
int GetAttributes() const
Definition: footprint.h:276
void SetLocalZoneConnection(ZONE_CONNECTION aType)
Definition: footprint.h:273
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:221
const LIB_ID & GetFPID() const
Definition: footprint.h:233
bool IsLocked() const override
Definition: footprint.h:397
void GetFields(std::vector< PCB_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with PCB_TEXTs.
Definition: footprint.cpp:565
std::optional< double > GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:270
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:205
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:2256
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition: footprint.h:265
void SetLocalClearance(std::optional< int > aClearance)
Definition: footprint.h:262
std::optional< int > GetLocalSolderMaskMargin() const
Definition: footprint.h:264
void SetLocalSolderPasteMargin(std::optional< int > aMargin)
Definition: footprint.h:268
VECTOR2I GetPosition() const override
Definition: footprint.h:209
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 PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:418
std::vector< FP_3DMODEL > & GetModelList()
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
Returns 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:92
void StyleFromSettings(const BOARD_DESIGN_SETTINGS &settings) override
Definition: pcb_text.cpp:364
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:608
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:71
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:188
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)
Calculates the specified column based on the actual size of the text on screen.
Definition: wx_grid.cpp:687
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:440
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:263
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:396
wxString GetShownColumnsAsString()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:410
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:590
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:161
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:45
#define TEXT_MAX_SIZE_MM
Maximum text size in mm (~10 inches)
Definition: eda_text.h:46
@ FP_SMD
Definition: footprint.h:73
@ FP_DNP
Definition: footprint.h:80
@ FP_ALLOW_MISSING_COURTYARD
Definition: footprint.h:79
@ FP_EXCLUDE_FROM_POS_FILES
Definition: footprint.h:74
@ FP_BOARD_ONLY
Definition: footprint.h:76
@ FP_EXCLUDE_FROM_BOM
Definition: footprint.h:75
@ FP_THROUGH_HOLE
Definition: footprint.h:72
@ FP_ALLOW_SOLDERMASK_BRIDGES
Definition: footprint.h:78
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
Definition: gr_text.cpp:87
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ B_Cu
Definition: layer_ids.h:95
@ F_Fab
Definition: layer_ids.h:120
@ F_Cu
Definition: layer_ids.h:64
@ B_Fab
Definition: layer_ids.h:119
wxColour GetDialogBGColour()
Definition: gtk/ui.cpp:61
wxSize GetUnobscuredSize(const wxWindow *aWindow)
Tries to determine the size of the viewport of a scrollable widget (wxDataViewCtrl,...
Definition: gtk/ui.cpp:195
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:154
KICOMMON_API void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:228
@ PFC_HEIGHT
@ PFC_THICKNESS
see class PGM_BASE
constexpr int mmToIU(double mm) const
Definition: base_units.h:88
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslateForHI=false)
Return a default symbol field name for field aFieldNdx for all components.
#define DO_TRANSLATE
@ MANDATORY_FIELDS
The first 5 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.