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>
48
49
50int DIALOG_FOOTPRINT_PROPERTIES::m_page = 0; // remember the last open page during session
51
52
54 FOOTPRINT* aFootprint ) :
56 m_frame( aParent ),
57 m_footprint( aFootprint ),
58 m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ),
59 m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ),
60 m_orientation( aParent, m_orientationLabel, m_orientationCtrl, nullptr ),
61 m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits ),
62 m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl,
63 m_SolderMaskMarginUnits ),
64 m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl,
65 m_SolderPasteMarginUnits ),
66 m_solderPasteRatio( aParent, m_PasteMarginRatioLabel, m_PasteMarginRatioCtrl,
67 m_PasteMarginRatioUnits ),
68 m_returnValue( FP_PROPS_CANCEL ),
69 m_initialized( false ),
70 m_gridSize( 0, 0 ),
71 m_lastRequestedSize( 0, 0 )
72{
73 // Create the 3D models page
75 m_NoteBook->AddPage( m_3dPanel, _("3D Models"), false );
76
77 // Configure display origin transforms
80
82
83 m_delayedErrorMessage = wxEmptyString;
84 m_delayedFocusGrid = nullptr;
87 m_initialFocus = false;
88
89 // Give an icon
90 wxIcon icon;
91 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit ) );
92 SetIcon( icon );
93
94 // Give a bit more room for combobox editors
95 m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 );
96
98 m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
99
101
102 // Show/hide text item columns according to the user's preference
104
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
141
142 // Configure button logos
145
146 // We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
147 // implementation on MSW
148 m_tabOrder = {
166 };
167
169
171 m_initialized = true;
172}
173
174
176{
178
179 // Prevents crash bug in wxGrid's d'tor
181
182 // Delete the GRID_TRICKS.
183 m_itemsGrid->PopEventHandler( true );
184
185 // free the memory used by all models, otherwise models which were
186 // browsed but not used would consume memory
187 Prj().Get3DCacheManager()->FlushCache( false );
188
189 // the GL canvas has to be visible before it is destroyed
190 m_page = m_NoteBook->GetSelection();
191 m_NoteBook->SetSelection( 1 );
192}
193
194
196{
198 {
200 Close();
201 }
202}
203
204
206{
208 {
210 Close();
211 }
212}
213
214
216{
218 {
220 Close();
221 }
222}
223
224
226{
228 {
230 Close();
231 }
232}
233
234
236{
237 if( !wxDialog::TransferDataToWindow() )
238 return false;
239
240 if( !m_PanelGeneral->TransferDataToWindow() )
241 return false;
242
243 // Add the models to the panel
245 return false;
246
247 // Footprint Texts
248 m_texts->push_back( m_footprint->Reference() );
249 m_texts->push_back( m_footprint->Value() );
250
251 for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
252 {
253 FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
254
255 if( textItem )
256 m_texts->push_back( *textItem );
257 }
258
259 // notify the grid
260 wxGridTableMessage tmsg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_texts->GetNumberRows() );
261 m_itemsGrid->ProcessTableMessage( tmsg );
262
263 // Footprint Properties
264
267
268 m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
269
270 EDA_ANGLE orientation = m_footprint->GetOrientation();
272
273 m_cbLocked->SetValue( m_footprint->IsLocked() );
274 m_cbLocked->SetToolTip( _( "Locked footprints cannot be freely moved and oriented on the "
275 "canvas and can only be selected when the 'Locked items' checkbox "
276 "is enabled in the selection filter." ) );
277
279 m_componentType->SetSelection( 0 );
280 else if( m_footprint->GetAttributes() & FP_SMD )
281 m_componentType->SetSelection( 1 );
282 else
283 m_componentType->SetSelection( 2 );
284
289
290 // Local Clearances
291
297
298 switch( m_footprint->GetZoneConnection() )
299 {
300 default:
301 case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
302 case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
303 case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
304 case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
305 }
306
307 // Show the footprint's FPID.
308 m_tcLibraryID->SetValue( m_footprint->GetFPID().Format() );
309
310 for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
311 {
312 m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false ) );
313
314 // Adjust the column size.
315 int col_size = m_itemsGrid->GetVisibleWidth( col );
316
317 if( col == FPT_LAYER ) // This one's a drop-down. Check all possible values.
318 {
319 BOARD* board = m_footprint->GetBoard();
320
321 for( PCB_LAYER_ID layer : board->GetEnabledLayers().Seq() )
322 col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
323
324 // And the swatch:
325 col_size += 20;
326 }
327
328 if( m_itemsGrid->IsColShown( col ) )
329 m_itemsGrid->SetColSize( col, col_size );
330 }
331
332 m_itemsGrid->SetRowLabelSize( m_itemsGrid->GetVisibleWidth( -1, false, true, true ) );
333
334 Layout();
336
337 return true;
338}
339
340
342{
344 return false;
345
346 if( !DIALOG_SHIM::Validate() )
347 return false;
348
349 // Validate texts.
350 for( size_t i = 0; i < m_texts->size(); ++i )
351 {
352 FP_TEXT& text = m_texts->at( i );
353
354 if( i >= 2 )
355 {
356 if( text.GetText().IsEmpty() )
357 {
358 if( m_NoteBook->GetSelection() != 0 )
359 m_NoteBook->SetSelection( 0 );
360
362 m_delayedErrorMessage = _( "Text items must have some content." );
365
366 return false;
367 }
368 }
369
370 int width = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, FPT_WIDTH ) );
371
372 if( width < TEXTS_MIN_SIZE )
373 {
374 wxString min = m_frame->StringFromValue( TEXTS_MIN_SIZE, true );
375
376 m_itemsGrid->SetCellValue( i, FPT_WIDTH, min );
377
379 m_delayedErrorMessage = wxString::Format( _( "Text width must be at least %s." ), min );
382
383 return false;
384 }
385 else if( width > TEXTS_MAX_SIZE )
386 {
387 wxString max = m_frame->StringFromValue( TEXTS_MAX_SIZE, true );
388
389 m_itemsGrid->SetCellValue( i, FPT_WIDTH, max );
390
392 m_delayedErrorMessage = wxString::Format( _( "Text width must be at most %s." ), max );
395
396 return false;
397 }
398
399 int height = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, FPT_HEIGHT ) );
400
401 if( height < TEXTS_MIN_SIZE )
402 {
403 wxString min = m_frame->StringFromValue( TEXTS_MIN_SIZE, true );
404
405 m_itemsGrid->SetCellValue( i, FPT_HEIGHT, min );
406
408 m_delayedErrorMessage = wxString::Format( _( "Text height must be at least %s." ), min );
411
412 return false;
413 }
414 else if( height > TEXTS_MAX_SIZE )
415 {
416 wxString max = m_frame->StringFromValue( TEXTS_MAX_SIZE, true );
417
418 m_itemsGrid->SetCellValue( i, FPT_HEIGHT, max );
419
421 m_delayedErrorMessage = wxString::Format( _( "Text height must be at most %s." ), max );
424
425 return false;
426 }
427
428 // Test for acceptable values for thickness and size and clamp if fails
429 int maxPenWidth = Clamp_Text_PenSize( text.GetTextThickness(), text.GetTextSize() );
430
431 if( text.GetTextThickness() > maxPenWidth )
432 {
433 wxString clamped = m_frame->StringFromValue( maxPenWidth, true );
434
435 m_itemsGrid->SetCellValue( i, FPT_THICKNESS, clamped );
436
438 m_delayedErrorMessage = wxString::Format( _( "Text thickness is too large for the "
439 "text size.\n"
440 "It will be clamped at %s." ),
441 clamped );
444
445 return false;
446 }
447 }
448
449 if( !m_netClearance.Validate( 0, INT_MAX ) )
450 return false;
451
452 return true;
453}
454
455
457{
458 if( !Validate() )
459 return false;
460
462 return false;
463
464 // This only commits the editor, model updating is done below so it is inside
465 // the commit
467 return false;
468
469 auto view = m_frame->GetCanvas()->GetView();
470 BOARD_COMMIT commit( m_frame );
471 commit.Modify( m_footprint );
472
473 // copy reference and value
474 m_footprint->Reference() = m_texts->at( 0 );
475 m_footprint->Value() = m_texts->at( 1 );
476
477 size_t i = 2;
478
479 for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
480 {
481 FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
482
483 if( textItem )
484 {
485 // copy grid table entries till we run out, then delete any remaining texts
486 if( i < m_texts->size() )
487 *textItem = m_texts->at( i++ );
488 else
489 textItem->DeleteStructure();
490 }
491 }
492
493 // if there are still grid table entries, create new texts for them
494 while( i < m_texts->size() )
495 {
496 auto newText = new FP_TEXT( m_texts->at( i++ ) );
497 m_footprint->Add( newText, ADD_MODE::APPEND );
498 view->Add( newText );
499 }
500
501 // Initialize masks clearances
506
507 switch( m_ZoneConnectionChoice->GetSelection() )
508 {
509 default:
514 }
515
516 // Set Footprint Position
518 m_footprint->SetPosition( pos );
519 m_footprint->SetLocked( m_cbLocked->GetValue() );
520
521 int attributes = 0;
522
523 switch( m_componentType->GetSelection() )
524 {
525 case 0: attributes |= FP_THROUGH_HOLE; break;
526 case 1: attributes |= FP_SMD; break;
527 default: break;
528 }
529
530 if( m_boardOnly->GetValue() )
531 attributes |= FP_BOARD_ONLY;
532
533 if( m_excludeFromPosFiles->GetValue() )
534 attributes |= FP_EXCLUDE_FROM_POS_FILES;
535
536 if( m_excludeFromBOM->GetValue() )
537 attributes |= FP_EXCLUDE_FROM_BOM;
538
539 if( m_noCourtyards->GetValue() )
540 attributes |= FP_ALLOW_MISSING_COURTYARD;
541
542 if( m_allowSolderMaskBridges->GetValue() )
543 attributes |= FP_ALLOW_SOLDERMASK_BRIDGES;
544
545 m_footprint->SetAttributes( attributes );
546
548
549 if( m_footprint->GetOrientation() != orient )
551
552 // Set component side, that also have effect on the fields positions on board
553 bool change_layer = false;
554 if( m_BoardSideCtrl->GetSelection() == 0 ) // layer req = COMPONENT
555 {
556 if( m_footprint->GetLayer() == B_Cu )
557 change_layer = true;
558 }
559 else if( m_footprint->GetLayer() == F_Cu )
560 change_layer = true;
561
562 if( change_layer )
564
565 // Copy the models from the panel to the footprint
566 std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
567 std::vector<FP_3DMODEL>* fpList = &m_footprint->Models();
568 fpList->clear();
569 fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
570
571 // This is a simple edit, we must create an undo entry
572 if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
573 commit.Push( _( "Modify footprint properties" ) );
574
576 return true;
577}
578
579
581{
583 return;
584
585 const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
586 FP_TEXT textItem( m_footprint );
587
588 // Set active layer if legal; otherwise copy layer from previous text item
590 textItem.SetLayer( m_frame->GetActiveLayer() );
591 else
592 textItem.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
593
594 textItem.SetTextSize( dsnSettings.GetTextSize( textItem.GetLayer() ) );
595 textItem.SetTextThickness( dsnSettings.GetTextThickness( textItem.GetLayer() ) );
596 textItem.SetItalic( dsnSettings.GetTextItalic( textItem.GetLayer() ) );
597 textItem.SetKeepUpright( dsnSettings.GetTextUpright( textItem.GetLayer() ) );
598 textItem.SetMirrored( IsBackLayer( textItem.GetLayer() ) );
599
600 m_texts->push_back( textItem );
601
602 // notify the grid
603 wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
604 m_itemsGrid->ProcessTableMessage( msg );
605
606 m_itemsGrid->SetFocus();
607 m_itemsGrid->MakeCellVisible( m_texts->size() - 1, 0 );
608 m_itemsGrid->SetGridCursor( m_texts->size() - 1, 0 );
609
610 m_itemsGrid->EnableCellEditControl( true );
611 m_itemsGrid->ShowCellEditControl();
612}
613
614
616{
618 return;
619
620 wxArrayInt selectedRows = m_itemsGrid->GetSelectedRows();
621
622 if( selectedRows.empty() && m_itemsGrid->GetGridCursorRow() >= 0 )
623 selectedRows.push_back( m_itemsGrid->GetGridCursorRow() );
624
625 if( selectedRows.empty() )
626 return;
627
628 for( int row : selectedRows )
629 {
630 if( row < 2 )
631 {
632 DisplayError( nullptr, _( "Reference and value are mandatory." ) );
633 return;
634 }
635 }
636
637 // Reverse sort so deleting a row doesn't change the indexes of the other rows.
638 selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } );
639
640 for( int row : selectedRows )
641 {
642 m_texts->erase( m_texts->begin() + row );
643
644 // notify the grid
645 wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
646 m_itemsGrid->ProcessTableMessage( msg );
647
648 if( m_itemsGrid->GetNumberRows() > 0 )
649 {
650 m_itemsGrid->MakeCellVisible( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
651 m_itemsGrid->SetGridCursor( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
652 }
653 }
654}
655
656
658{
659 // Account for scroll bars
661
662 itemsWidth -= m_itemsGrid->GetRowLabelSize();
663
664 for( int i = 1; i < m_itemsGrid->GetNumberCols(); i++ )
665 itemsWidth -= m_itemsGrid->GetColSize( i );
666
667 m_itemsGrid->SetColSize( 0, std::max( itemsWidth,
668 m_itemsGrid->GetVisibleWidth( 0, true, false ) ) );
669
670 // Update the width of the 3D panel
672}
673
674
676{
677 if( !m_initialized )
678 return;
679
680 // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
681 // even when the original validation was triggered from a killFocus event, and so
682 // that the corresponding notebook page can be shown in the background when triggered
683 // from an OK.
684 if( m_delayedFocusRow >= 0 )
685 {
686 // We will re-enter this routine if an error dialog is displayed, so make sure we
687 // zero out our member variables first.
688 wxGrid* grid = m_delayedFocusGrid;
689 int row = m_delayedFocusRow;
690 int col = m_delayedFocusColumn;
691 wxString msg = m_delayedErrorMessage;
692
693 m_delayedFocusGrid = nullptr;
696 m_delayedErrorMessage = wxEmptyString;
697
698 if( !msg.IsEmpty() )
699 {
700 // Do not use DisplayErrorMessage(); it screws up window order on Mac
701 DisplayError( nullptr, msg );
702 }
703
704 grid->SetFocus();
705 grid->MakeCellVisible( row, col );
706
707 // Selecting the first grid item only makes sense for the
708 // items grid
709 if( !m_initialFocus || grid == m_itemsGrid )
710 {
711 grid->SetGridCursor( row, col );
712 grid->EnableCellEditControl( true );
713 grid->ShowCellEditControl();
714
715 if( grid == m_itemsGrid && row == 0 && col == 0 )
716 {
717 auto referenceEditor = grid->GetCellEditor( 0, 0 );
718
719 if( auto textEntry = dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) )
720 KIUI::SelectReferenceNumber( textEntry );
721
722 referenceEditor->DecRef();
723 }
724 }
725 m_initialFocus = false;
726 }
727}
728
729
731{
732 wxSize new_size = aEvent.GetSize();
733
734 if( ( !m_itemsGrid->IsCellEditControlShown() || m_lastRequestedSize != new_size )
735 && m_gridSize != new_size )
736 {
737 m_gridSize = new_size;
738
739 // A trick to fix a cosmetic issue: when, in m_itemsGrid, a layer selector widget has
740 // the focus (is activated in column 6) when resizing the grid, the widget is not moved.
741 // So just change the widget having the focus in this case
742 if( m_NoteBook->GetSelection() == 0 && !m_itemsGrid->HasFocus() )
743 {
744 int col = m_itemsGrid->GetGridCursorCol();
745
746 if( col == 6 ) // a layer selector widget can be activated
747 m_itemsGrid->SetFocus();
748 }
749
751 }
752
753 // We store this value to check whether the dialog is changing size. This might indicate
754 // that the user is scaling the dialog with an editor shown. Some editors do not close
755 // (at least on GTK) when the user drags a dialog corner
756 m_lastRequestedSize = new_size;
757
758 // Always propagate for a grid repaint (needed if the height changes, as well as width)
759 aEvent.Skip();
760
761}
762
763
764void DIALOG_FOOTPRINT_PROPERTIES::OnPageChange( wxNotebookEvent& aEvent )
765{
766 int page = aEvent.GetSelection();
767
768 // Shouldn't be necessary, but is on at least OSX
769 if( page >= 0 )
770 m_NoteBook->ChangeSelection( (unsigned) page );
771}
772
773
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:106
@ 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.
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
VECTOR2I GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:70
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:192
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:226
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:269
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:587
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:474
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:288
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:145
void SetMirrored(bool isMirrored)
Definition: eda_text.cpp:226
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.cpp:187
void SetKeepUpright(bool aKeepUpright)
Definition: eda_text.cpp:258
void SetTextSize(const VECTOR2I &aNewSize)
Definition: eda_text.cpp:349
void SetItalic(bool aItalic)
Definition: eda_text.cpp:203
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1688
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:1565
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:568
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:1600
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.
void SetBitmap(const wxBitmap &aBmp)
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:520
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:295
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:164
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:262
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:276
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:423
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:300
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:87
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition: layer_ids.h:924
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:133
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:156
void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:230
#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