KiCad PCB EDA Suite
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-2022 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 <footprint.h>
32#include <confirm.h>
34#include <filename_resolver.h>
35#include <pcb_edit_frame.h>
36#include <pcbnew_settings.h>
37#include <pgm_base.h>
38#include <pcbnew.h>
39#include <kiplatform/ui.h>
43
45
48
50
51
52int DIALOG_FOOTPRINT_PROPERTIES::m_page = 0; // remember the last open page during session
53
54
56 FOOTPRINT* aFootprint ) :
58 m_frame( aParent ),
59 m_footprint( aFootprint ),
60 m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ),
61 m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ),
62 m_orientation( aParent, m_orientationLabel, m_orientationCtrl, nullptr ),
63 m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits ),
64 m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl,
65 m_SolderMaskMarginUnits ),
66 m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl,
67 m_SolderPasteMarginUnits ),
68 m_solderPasteRatio( aParent, m_PasteMarginRatioLabel, m_PasteMarginRatioCtrl,
69 m_PasteMarginRatioUnits ),
70 m_returnValue( FP_PROPS_CANCEL ),
71 m_initialized( false ),
72 m_gridSize( 0, 0 ),
73 m_lastRequestedSize( 0, 0 )
74{
75 // Create the 3D models page
77 m_NoteBook->AddPage( m_3dPanel, _("3D Models"), false );
78
79 // Configure display origin transforms
82
84
85 m_delayedErrorMessage = wxEmptyString;
86 m_delayedFocusGrid = nullptr;
89 m_initialFocus = false;
90
91 // Give an icon
92 wxIcon icon;
93 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit ) );
94 SetIcon( icon );
95
96 // Give a bit more room for combobox editors
97 m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 );
98
100 m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
101
103
104 // Show/hide text item columns according to the user's preference
106
109
110 // Set predefined rotations in combo dropdown, according to the locale floating point
111 // separator notation
112 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
113
114 for( size_t ii = 0; ii < m_orientationCtrl->GetCount() && ii < 4; ++ii )
115 m_orientationCtrl->SetString( ii, wxString::Format( "%.1f", rot_list[ii] ) );
116
117 // Set font size for items showing long strings:
118 wxFont infoFont = KIUI::GetInfoFont( this );
119 m_libraryIDLabel->SetFont( infoFont );
120 m_tcLibraryID->SetFont( infoFont );
121
122 infoFont.SetStyle( wxFONTSTYLE_ITALIC );
123 m_staticTextInfoCopper->SetFont( infoFont );
124 m_staticTextInfoPaste->SetFont( infoFont );
125
126 m_NoteBook->SetSelection( m_page );
127
128 if( m_page == 0 )
129 {
133 }
134 else if( m_page == 1 )
135 {
137 }
138
140
143
144 // Configure button logos
145 m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
147
148 // We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
149 // implementation on MSW
150 m_tabOrder = {
168 };
169
171
173 m_initialized = true;
174}
175
176
178{
180
181 // Prevents crash bug in wxGrid's d'tor
183
184 // Delete the GRID_TRICKS.
185 m_itemsGrid->PopEventHandler( true );
186
187 // free the memory used by all models, otherwise models which were
188 // browsed but not used would consume memory
189 Prj().Get3DCacheManager()->FlushCache( false );
190
191 // the GL canvas has to be visible before it is destroyed
192 m_page = m_NoteBook->GetSelection();
193 m_NoteBook->SetSelection( 1 );
194}
195
196
198{
200 {
202 Close();
203 }
204}
205
206
208{
210 {
212 Close();
213 }
214}
215
216
218{
220 {
222 Close();
223 }
224}
225
226
228{
230 {
232 Close();
233 }
234}
235
236
238{
239 if( !wxDialog::TransferDataToWindow() )
240 return false;
241
242 if( !m_PanelGeneral->TransferDataToWindow() )
243 return false;
244
245 // Add the models to the panel
247 return false;
248
249 // Footprint Texts
250 m_texts->push_back( m_footprint->Reference() );
251 m_texts->push_back( m_footprint->Value() );
252
253 for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
254 {
255 FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
256
257 if( textItem )
258 m_texts->push_back( *textItem );
259 }
260
261 // notify the grid
262 wxGridTableMessage tmsg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_texts->GetNumberRows() );
263 m_itemsGrid->ProcessTableMessage( tmsg );
264
265 // Footprint Properties
266
269
270 m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
271
272 EDA_ANGLE orientation = m_footprint->GetOrientation();
274
275 m_cbLocked->SetValue( m_footprint->IsLocked() );
276 m_cbLocked->SetToolTip( _( "Locked footprints cannot be freely moved and oriented on the "
277 "canvas and can only be selected when the 'Locked items' checkbox "
278 "is enabled in the selection filter." ) );
279
281 m_componentType->SetSelection( 0 );
282 else if( m_footprint->GetAttributes() & FP_SMD )
283 m_componentType->SetSelection( 1 );
284 else
285 m_componentType->SetSelection( 2 );
286
291
292 // Local Clearances
293
299
300 switch( m_footprint->GetZoneConnection() )
301 {
302 default:
303 case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
304 case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
305 case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
306 case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
307 }
308
309 // Show the footprint's FPID.
310 m_tcLibraryID->SetValue( m_footprint->GetFPID().Format() );
311
312 for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
313 {
314 m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false ) );
315
316 // Adjust the column size.
317 int col_size = m_itemsGrid->GetVisibleWidth( col );
318
319 if( col == FPT_LAYER ) // This one's a drop-down. Check all possible values.
320 {
321 BOARD* board = m_footprint->GetBoard();
322
323 for( PCB_LAYER_ID layer : board->GetEnabledLayers().Seq() )
324 col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
325
326 // And the swatch:
327 col_size += 20;
328 }
329
330 if( m_itemsGrid->IsColShown( col ) )
331 m_itemsGrid->SetColSize( col, col_size );
332 }
333
334 m_itemsGrid->SetRowLabelSize( m_itemsGrid->GetVisibleWidth( -1, false, true, true ) );
335
336 Layout();
338
339 return true;
340}
341
342
344{
346 return false;
347
348 if( !DIALOG_SHIM::Validate() )
349 return false;
350
351 // Validate texts.
352 for( size_t i = 0; i < m_texts->size(); ++i )
353 {
354 FP_TEXT& text = m_texts->at( i );
355
356 if( i >= 2 )
357 {
358 if( text.GetText().IsEmpty() )
359 {
360 if( m_NoteBook->GetSelection() != 0 )
361 m_NoteBook->SetSelection( 0 );
362
364 m_delayedErrorMessage = _( "Text items must have some content." );
367
368 return false;
369 }
370 }
371
372 int width = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, FPT_WIDTH ) );
373
374 if( width < TEXTS_MIN_SIZE )
375 {
376 wxString min = m_frame->StringFromValue( TEXTS_MIN_SIZE, true );
377
378 m_itemsGrid->SetCellValue( i, FPT_WIDTH, min );
379
381 m_delayedErrorMessage = wxString::Format( _( "Text width must be at least %s." ), min );
384
385 return false;
386 }
387 else if( width > TEXTS_MAX_SIZE )
388 {
389 wxString max = m_frame->StringFromValue( TEXTS_MAX_SIZE, true );
390
391 m_itemsGrid->SetCellValue( i, FPT_WIDTH, max );
392
394 m_delayedErrorMessage = wxString::Format( _( "Text width must be at most %s." ), max );
397
398 return false;
399 }
400
401 int height = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, FPT_HEIGHT ) );
402
403 if( height < TEXTS_MIN_SIZE )
404 {
405 wxString min = m_frame->StringFromValue( TEXTS_MIN_SIZE, true );
406
407 m_itemsGrid->SetCellValue( i, FPT_HEIGHT, min );
408
410 m_delayedErrorMessage = wxString::Format( _( "Text height must be at least %s." ), min );
413
414 return false;
415 }
416 else if( height > TEXTS_MAX_SIZE )
417 {
418 wxString max = m_frame->StringFromValue( TEXTS_MAX_SIZE, true );
419
420 m_itemsGrid->SetCellValue( i, FPT_HEIGHT, max );
421
423 m_delayedErrorMessage = wxString::Format( _( "Text height must be at most %s." ), max );
426
427 return false;
428 }
429
430 // Test for acceptable values for thickness and size and clamp if fails
431 int maxPenWidth = Clamp_Text_PenSize( text.GetTextThickness(), text.GetTextSize() );
432
433 if( text.GetTextThickness() > maxPenWidth )
434 {
435 wxString clamped = m_frame->StringFromValue( maxPenWidth, true );
436
437 m_itemsGrid->SetCellValue( i, FPT_THICKNESS, clamped );
438
440 m_delayedErrorMessage = wxString::Format( _( "Text thickness is too large for the "
441 "text size.\n"
442 "It will be clamped at %s." ),
443 clamped );
446
447 return false;
448 }
449 }
450
451 if( !m_netClearance.Validate( 0, INT_MAX ) )
452 return false;
453
454 return true;
455}
456
457
459{
460 if( !Validate() )
461 return false;
462
464 return false;
465
466 // This only commits the editor, model updating is done below so it is inside
467 // the commit
469 return false;
470
471 auto view = m_frame->GetCanvas()->GetView();
472 BOARD_COMMIT commit( m_frame );
473 commit.Modify( m_footprint );
474
475 // copy reference and value
476 m_footprint->Reference() = m_texts->at( 0 );
477 m_footprint->Value() = m_texts->at( 1 );
478
479 size_t i = 2;
480
481 for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
482 {
483 FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
484
485 if( textItem )
486 {
487 // copy grid table entries till we run out, then delete any remaining texts
488 if( i < m_texts->size() )
489 *textItem = m_texts->at( i++ );
490 else
491 textItem->DeleteStructure();
492 }
493 }
494
495 // if there are still grid table entries, create new texts for them
496 while( i < m_texts->size() )
497 {
498 auto newText = new FP_TEXT( m_texts->at( i++ ) );
499 m_footprint->Add( newText, ADD_MODE::APPEND );
500 view->Add( newText );
501 }
502
503 // Initialize masks clearances
508
509 switch( m_ZoneConnectionChoice->GetSelection() )
510 {
511 default:
516 }
517
518 // Set Footprint Position
519 wxPoint pos( m_posX.GetValue(), m_posY.GetValue() );
520 m_footprint->SetPosition( pos );
521 m_footprint->SetLocked( m_cbLocked->GetValue() );
522
523 int attributes = 0;
524
525 switch( m_componentType->GetSelection() )
526 {
527 case 0: attributes |= FP_THROUGH_HOLE; break;
528 case 1: attributes |= FP_SMD; break;
529 default: break;
530 }
531
532 if( m_boardOnly->GetValue() )
533 attributes |= FP_BOARD_ONLY;
534
535 if( m_excludeFromPosFiles->GetValue() )
536 attributes |= FP_EXCLUDE_FROM_POS_FILES;
537
538 if( m_excludeFromBOM->GetValue() )
539 attributes |= FP_EXCLUDE_FROM_BOM;
540
541 if( m_noCourtyards->GetValue() )
542 attributes |= FP_ALLOW_MISSING_COURTYARD;
543
544 if( m_allowSolderMaskBridges->GetValue() )
545 attributes |= FP_ALLOW_SOLDERMASK_BRIDGES;
546
547 m_footprint->SetAttributes( attributes );
548
550
551 if( m_footprint->GetOrientation() != orient )
553
554 // Set component side, that also have effect on the fields positions on board
555 bool change_layer = false;
556 if( m_BoardSideCtrl->GetSelection() == 0 ) // layer req = COMPONENT
557 {
558 if( m_footprint->GetLayer() == B_Cu )
559 change_layer = true;
560 }
561 else if( m_footprint->GetLayer() == F_Cu )
562 change_layer = true;
563
564 if( change_layer )
566
567 // Copy the models from the panel to the footprint
568 std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
569 std::vector<FP_3DMODEL>* fpList = &m_footprint->Models();
570 fpList->clear();
571 fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
572
573 // This is a simple edit, we must create an undo entry
574 if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
575 commit.Push( _( "Modify footprint properties" ) );
576
578 return true;
579}
580
581
583{
585 return;
586
587 const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
588 FP_TEXT textItem( m_footprint );
589
590 // Set active layer if legal; otherwise copy layer from previous text item
592 textItem.SetLayer( m_frame->GetActiveLayer() );
593 else
594 textItem.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
595
596 textItem.SetTextSize( dsnSettings.GetTextSize( textItem.GetLayer() ) );
597 textItem.SetTextThickness( dsnSettings.GetTextThickness( textItem.GetLayer() ) );
598 textItem.SetItalic( dsnSettings.GetTextItalic( textItem.GetLayer() ) );
599 textItem.SetKeepUpright( dsnSettings.GetTextUpright( textItem.GetLayer() ) );
600 textItem.SetMirrored( IsBackLayer( textItem.GetLayer() ) );
601
602 m_texts->push_back( textItem );
603
604 // notify the grid
605 wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
606 m_itemsGrid->ProcessTableMessage( msg );
607
608 m_itemsGrid->SetFocus();
609 m_itemsGrid->MakeCellVisible( m_texts->size() - 1, 0 );
610 m_itemsGrid->SetGridCursor( m_texts->size() - 1, 0 );
611
612 m_itemsGrid->EnableCellEditControl( true );
613 m_itemsGrid->ShowCellEditControl();
614}
615
616
618{
620 return;
621
622 wxArrayInt selectedRows = m_itemsGrid->GetSelectedRows();
623
624 if( selectedRows.empty() && m_itemsGrid->GetGridCursorRow() >= 0 )
625 selectedRows.push_back( m_itemsGrid->GetGridCursorRow() );
626
627 if( selectedRows.empty() )
628 return;
629
630 for( int row : selectedRows )
631 {
632 if( row < 2 )
633 {
634 DisplayError( nullptr, _( "Reference and value are mandatory." ) );
635 return;
636 }
637 }
638
639 // Reverse sort so deleting a row doesn't change the indexes of the other rows.
640 selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } );
641
642 for( int row : selectedRows )
643 {
644 m_texts->erase( m_texts->begin() + row );
645
646 // notify the grid
647 wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
648 m_itemsGrid->ProcessTableMessage( msg );
649
650 if( m_itemsGrid->GetNumberRows() > 0 )
651 {
652 m_itemsGrid->MakeCellVisible( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
653 m_itemsGrid->SetGridCursor( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
654 }
655 }
656}
657
658
660{
661 // Account for scroll bars
663
664 itemsWidth -= m_itemsGrid->GetRowLabelSize();
665
666 for( int i = 1; i < m_itemsGrid->GetNumberCols(); i++ )
667 itemsWidth -= m_itemsGrid->GetColSize( i );
668
669 m_itemsGrid->SetColSize( 0, std::max( itemsWidth,
670 m_itemsGrid->GetVisibleWidth( 0, true, false ) ) );
671
672 // Update the width of the 3D panel
674}
675
676
678{
679 if( !m_initialized )
680 return;
681
682 // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
683 // even when the original validation was triggered from a killFocus event, and so
684 // that the corresponding notebook page can be shown in the background when triggered
685 // from an OK.
686 if( m_delayedFocusRow >= 0 )
687 {
688 // We will re-enter this routine if an error dialog is displayed, so make sure we
689 // zero out our member variables first.
690 wxGrid* grid = m_delayedFocusGrid;
691 int row = m_delayedFocusRow;
692 int col = m_delayedFocusColumn;
693 wxString msg = m_delayedErrorMessage;
694
695 m_delayedFocusGrid = nullptr;
698 m_delayedErrorMessage = wxEmptyString;
699
700 if( !msg.IsEmpty() )
701 {
702 // Do not use DisplayErrorMessage(); it screws up window order on Mac
703 DisplayError( nullptr, msg );
704 }
705
706 grid->SetFocus();
707 grid->MakeCellVisible( row, col );
708
709 // Selecting the first grid item only makes sense for the
710 // items grid
711 if( !m_initialFocus || grid == m_itemsGrid )
712 {
713 grid->SetGridCursor( row, col );
714 grid->EnableCellEditControl( true );
715 grid->ShowCellEditControl();
716
717 if( grid == m_itemsGrid && row == 0 && col == 0 )
718 {
719 auto referenceEditor = grid->GetCellEditor( 0, 0 );
720
721 if( auto textEntry = dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) )
722 KIUI::SelectReferenceNumber( textEntry );
723
724 referenceEditor->DecRef();
725 }
726 }
727 m_initialFocus = false;
728 }
729}
730
731
733{
734 wxSize new_size = aEvent.GetSize();
735
736 if( ( !m_itemsGrid->IsCellEditControlShown() || m_lastRequestedSize != new_size )
737 && m_gridSize != new_size )
738 {
739 m_gridSize = new_size;
740
741 // A trick to fix a cosmetic issue: when, in m_itemsGrid, a layer selector widget has
742 // the focus (is activated in column 6) when resizing the grid, the widget is not moved.
743 // So just change the widget having the focus in this case
744 if( m_NoteBook->GetSelection() == 0 && !m_itemsGrid->HasFocus() )
745 {
746 int col = m_itemsGrid->GetGridCursorCol();
747
748 if( col == 6 ) // a layer selector widget can be activated
749 m_itemsGrid->SetFocus();
750 }
751
753 }
754
755 // We store this value to check whether the dialog is changing size. This might indicate
756 // that the user is scaling the dialog with an editor shown. Some editors do not close
757 // (at least on GTK) when the user drags a dialog corner
758 m_lastRequestedSize = new_size;
759
760 // Always propagate for a grid repaint (needed if the height changes, as well as width)
761 aEvent.Skip();
762
763}
764
765
766void DIALOG_FOOTPRINT_PROPERTIES::OnPageChange( wxNotebookEvent& aEvent )
767{
768 int page = aEvent.GetSelection();
769
770 // Shouldn't be necessary, but is on at least OSX
771 if( page >= 0 )
772 m_NoteBook->ChangeSelection( (unsigned) page );
773}
774
775
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:105
@ icon_modedit
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
Container for design settings for a BOARD object.
wxSize GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
bool GetTextUpright(PCB_LAYER_ID aLayer) const
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
bool GetTextItalic(PCB_LAYER_ID aLayer) const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:58
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:180
void DeleteStructure()
Delete this object after removing from its parent if it has one.
Definition: board_item.cpp:150
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:214
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:43
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:526
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:413
COMMIT & Modify(EDA_ITEM *aItem)
Create an undo entry for an item that has been already modified.
Definition: commit.h:103
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:222
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:97
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:249
EDA_ANGLE Normalize180()
Definition: eda_angle.h:271
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:147
void SetMirrored(bool isMirrored)
Definition: eda_text.cpp:224
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.cpp:185
void SetKeepUpright(bool aKeepUpright)
Definition: eda_text.cpp:256
void SetTextSize(const VECTOR2I &aNewSize)
Definition: eda_text.cpp:347
void SetItalic(bool aItalic)
Definition: eda_text.cpp:201
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1658
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:350
EDA_ANGLE GetOrientation() const
Definition: footprint.h:191
int GetLocalClearance() const
Definition: footprint.h:230
void SetAttributes(int aAttributes)
Definition: footprint.h:251
double GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:244
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: footprint.cpp:1539
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: footprint.h:245
void SetLocalSolderPasteMargin(int aMargin)
Definition: footprint.h:242
int GetAttributes() const
Definition: footprint.h:250
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:200
int GetLocalSolderPasteMargin() const
Definition: footprint.h:241
void SetLocalClearance(int aClearance)
Definition: footprint.h:231
const LIB_ID & GetFPID() const
Definition: footprint.h:212
bool IsLocked() const override
Definition: footprint.h:340
void SetLocalSolderMaskMargin(int aMargin)
Definition: footprint.h:228
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:567
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:561
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: footprint.h:247
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:184
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1574
ZONE_CONNECTION GetZoneConnection() const
Definition: footprint.h:248
VECTOR2I GetPosition() const override
Definition: footprint.h:188
DRAWINGS & GraphicalItems()
Definition: footprint.h:173
FP_TEXT & Reference()
Definition: footprint.h:568
int GetLocalSolderMaskMargin() const
Definition: footprint.h:227
int GetNumberRows() override
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:117
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:411
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:841
std::vector< FP_3DMODEL > & GetModelList()
wxString m_FootprintTextShownColumns
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual PCB_LAYER_ID GetActiveLayer() 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 StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Converts aValue in internal units into a united string.
int ValueFromString(const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
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:187
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:377
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:226
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:95
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:193
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:207
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:280
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:280
This file is part of the common library.
#define _(s)
@ FP_SMD
Definition: footprint.h:69
@ FP_ALLOW_MISSING_COURTYARD
Definition: footprint.h:75
@ FP_EXCLUDE_FROM_POS_FILES
Definition: footprint.h:70
@ FP_BOARD_ONLY
Definition: footprint.h:72
@ FP_EXCLUDE_FROM_BOM
Definition: footprint.h:71
@ FP_THROUGH_HOLE
Definition: footprint.h:68
@ FP_ALLOW_SOLDERMASK_BRIDGES
Definition: footprint.h:74
@ FPT_LAYER
@ FPT_WIDTH
@ FPT_HEIGHT
@ FPT_TEXT
@ FPT_THICKNESS
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:75
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition: layer_ids.h:922
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ B_Cu
Definition: layer_ids.h:95
@ F_Cu
Definition: layer_ids.h:64
wxSize GetUnobscuredSize(const wxWindow *aWindow)
Tries to determine the size of the viewport of a scrollable widget (wxDataViewCtrl,...
Definition: gtk/ui.cpp:126
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:144
void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:218
#define TEXTS_MAX_SIZE
Maximum text size in internal units (10 inches)
Definition: pcbnew.h:32
#define TEXTS_MIN_SIZE
Minimum text size in internal units (1 mil)
Definition: pcbnew.h:31
see class PGM_BASE
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
@ THERMAL
Use thermal relief for pads.
@ NONE
Pads are not covered.
@ FULL
pads are covered by copper