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-2020 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>
30 #include <board_design_settings.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 <validators.h>
40 #include <widgets/text_ctrl_eval.h>
41 #include <widgets/wx_grid.h>
43 
45 
48 
50 
51 
52 int 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_orientValidator( 3, &m_orientValue ),
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 {
73  // Create the 3D models page
75  m_NoteBook->AddPage( m_3dPanel, _("3D Models"), false );
76 
77  // Configure display origin transforms
80 
81  for( size_t i = 0; i < m_NoteBook->GetPageCount(); ++i )
82  m_macHack.push_back( true );
83 
85 
86  m_delayedErrorMessage = wxEmptyString;
87  m_delayedFocusGrid = nullptr;
88  m_delayedFocusRow = -1;
90  m_initialFocus = false;
91 
92  // Give an icon
93  wxIcon icon;
94  icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit ) );
95  SetIcon( icon );
96 
97  // Give a bit more room for combobox editors
98  m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 );
99 
101  m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
102 
104 
105  // Show/hide text item columns according to the user's preference
107 
108  m_orientValidator.SetRange( -360.0, 360.0 );
109  m_OrientValueCtrl->SetValidator( m_orientValidator );
111 
112  // Set font size for items showing long strings:
113  wxFont infoFont = KIUI::GetInfoFont( this );
114 #if __WXMAC__
115  m_allow90Label->SetFont( infoFont );
116  m_allow180Label->SetFont( infoFont );
117 #endif
118  m_libraryIDLabel->SetFont( infoFont );
119  m_tcLibraryID->SetFont( infoFont );
120 
121  infoFont.SetStyle( wxFONTSTYLE_ITALIC );
122  m_staticTextInfoValNeg->SetFont( infoFont );
123  m_staticTextInfoValPos->SetFont( infoFont );
124  m_staticTextInfoCopper->SetFont( infoFont );
125  m_staticTextInfoPaste->SetFont( infoFont );
126 
127  m_NoteBook->SetSelection( m_page );
128 
129  if( m_page == 0 )
130  {
132  m_delayedFocusRow = 0;
134  }
135  else if( m_page == 1 )
136  {
138  }
139 
141 
144 
145  m_sdbSizerStdButtonsOK->SetDefault();
146 
147  m_orientValue = 0;
148 
149  // Configure button logos
150  m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
151  m_bpDelete->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
152 
154  m_initialized = true;
155 }
156 
157 
159 {
161  m_itemsGrid->GetShownColumns().ToStdString();
162 
163  // Prevents crash bug in wxGrid's d'tor
165 
166  // Delete the GRID_TRICKS.
167  m_itemsGrid->PopEventHandler( true );
168 
169  // free the memory used by all models, otherwise models which were
170  // browsed but not used would consume memory
171  Prj().Get3DCacheManager()->FlushCache( false );
172 
173  // the GL canvas has to be visible before it is destroyed
174  m_page = m_NoteBook->GetSelection();
175  m_NoteBook->SetSelection( 1 );
176 }
177 
178 
180 {
181  if( TransferDataFromWindow() )
182  {
184  Close();
185  }
186 }
187 
188 
190 {
191  if( TransferDataFromWindow() )
192  {
194  Close();
195  }
196 }
197 
198 
200 {
201  if( TransferDataFromWindow() )
202  {
204  Close();
205  }
206 }
207 
208 
210 {
211  if( TransferDataFromWindow() )
212  {
214  Close();
215  }
216 }
217 
218 
220 {
221  if( m_Orient0->GetValue() )
222  m_orientValue = 0.0;
223  else if( m_Orient90->GetValue() )
224  m_orientValue = 90.0;
225  else if( m_Orient270->GetValue() )
226  m_orientValue = 270.0;
227  else if( m_Orient180->GetValue() )
228  m_orientValue = 180.0;
229 
231 }
232 
233 
235 {
236  m_OrientOther->SetValue( true );
237 
238  aEvent.Skip();
239 }
240 
241 
243 {
244  if( !wxDialog::TransferDataToWindow() )
245  return false;
246 
247  if( !m_PanelGeneral->TransferDataToWindow() )
248  return false;
249 
250  // Add the models to the panel
252  return false;
253 
254  // Footprint Texts
255  m_texts->push_back( m_footprint->Reference() );
256  m_texts->push_back( m_footprint->Value() );
257 
258  for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
259  {
260  FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
261 
262  if( textItem )
263  m_texts->push_back( *textItem );
264  }
265 
266  // notify the grid
267  wxGridTableMessage tmsg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_texts->GetNumberRows() );
268  m_itemsGrid->ProcessTableMessage( tmsg );
269 
270  // Footprint Properties
271 
274 
275  m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
276 
278 
279  if( m_orientValue == 0.0 )
280  m_Orient0->SetValue( true );
281  else if( m_orientValue == 90.0 || m_orientValue == -270.0 )
282  m_Orient90->SetValue( true );
283  else if( m_orientValue == 270.0 || m_orientValue == -90.0 )
284  m_Orient270->SetValue( true );
285  else if( m_orientValue == 180.0 || m_orientValue == -180.0 )
286  m_Orient180->SetValue( true );
287  else
288  m_OrientOther->SetValue( true );
289 
291 
292  m_AutoPlaceCtrl->SetSelection( m_footprint->IsLocked() ? 1 : 0 );
293 
294  m_AutoPlaceCtrl->SetItemToolTip( 0, _( "Footprint can be freely moved and oriented on the "
295  "canvas." ) );
296  m_AutoPlaceCtrl->SetItemToolTip( 1, _( "Footprint is locked: it cannot be freely moved and "
297  "oriented on the canvas and can only be selected when "
298  "the 'Locked items' checkbox is enabled in the "
299  "selection filter." ) );
300 
303 
305  m_componentType->SetSelection( 0 );
306  else if( m_footprint->GetAttributes() & FP_SMD )
307  m_componentType->SetSelection( 1 );
308  else
309  m_componentType->SetSelection( 2 );
310 
314 
315  // Local Clearances
316 
321 
322  switch( m_footprint->GetZoneConnection() )
323  {
324  default:
325  case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
326  case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
327  case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
328  case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
329  }
330 
331  // Show the footprint's FPID.
332  m_tcLibraryID->SetValue( m_footprint->GetFPID().Format() );
333 
334  for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
335  {
336  m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false,
337  false ) );
338  // Adjust the column size.
339  int col_size = m_itemsGrid->GetVisibleWidth( col, true, true, false );
340 
341  if( col == FPT_LAYER ) // This one's a drop-down. Check all possible values.
342  {
343  BOARD* board = m_footprint->GetBoard();
344 
345  for( PCB_LAYER_ID layer : board->GetEnabledLayers().Seq() )
346  col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
347 
348  // And the swatch:
349  col_size += 20;
350  }
351 
352  if( m_itemsGrid->IsColShown( col ) )
353  m_itemsGrid->SetColSize( col, col_size );
354  }
355 
356  m_itemsGrid->SetRowLabelSize( m_itemsGrid->GetVisibleWidth( -1, false, true, true ) );
357 
358  Layout();
359  adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
360 
361  return true;
362 }
363 
364 
366 {
368  return false;
369 
370  if( !DIALOG_SHIM::Validate() )
371  return false;
372 
373  // Check for empty texts.
374  for( size_t i = 2; i < m_texts->size(); ++i )
375  {
376  FP_TEXT& text = m_texts->at( i );
377 
378  if( text.GetText().IsEmpty() )
379  {
380  if( m_NoteBook->GetSelection() != 0 )
381  m_NoteBook->SetSelection( 0 );
382 
384  m_delayedErrorMessage = _( "Text items must have some content." );
386  m_delayedFocusRow = i;
387 
388  return false;
389  }
390  }
391 
392  if( !m_netClearance.Validate( 0, INT_MAX ) )
393  return false;
394 
395  return true;
396 }
397 
398 
400 {
401  if( !Validate() )
402  return false;
403 
405  return false;
406 
407  // This only commits the editor, model updating is done below so it is inside
408  // the commit
410  return false;
411 
412  auto view = m_frame->GetCanvas()->GetView();
413  BOARD_COMMIT commit( m_frame );
414  commit.Modify( m_footprint );
415 
416  // copy reference and value
417  m_footprint->Reference() = m_texts->at( 0 );
418  m_footprint->Value() = m_texts->at( 1 );
419 
420  size_t i = 2;
421 
422  for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
423  {
424  FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
425 
426  if( textItem )
427  {
428  // copy grid table entries till we run out, then delete any remaining texts
429  if( i < m_texts->size() )
430  *textItem = m_texts->at( i++ );
431  else
432  textItem->DeleteStructure();
433  }
434  }
435 
436  // if there are still grid table entries, create new texts for them
437  while( i < m_texts->size() )
438  {
439  auto newText = new FP_TEXT( m_texts->at( i++ ) );
440  m_footprint->Add( newText, ADD_MODE::APPEND );
441  view->Add( newText );
442  }
443 
444  // Initialize masks clearances
449 
450  switch( m_ZoneConnectionChoice->GetSelection() )
451  {
452  default:
457  }
458 
459  // Set Footprint Position
460  wxPoint pos( m_posX.GetValue(), m_posY.GetValue() );
461  m_footprint->SetPosition( pos );
462  m_footprint->SetLocked( m_AutoPlaceCtrl->GetSelection() == 1 );
463 
464  int attributes = 0;
465 
466  switch( m_componentType->GetSelection() )
467  {
468  case 0: attributes |= FP_THROUGH_HOLE; break;
469  case 1: attributes |= FP_SMD; break;
470  default: break;
471  }
472 
473  if( m_boardOnly->GetValue() )
474  attributes |= FP_BOARD_ONLY;
475 
476  if( m_excludeFromPosFiles->GetValue() )
477  attributes |= FP_EXCLUDE_FROM_POS_FILES;
478 
479  if( m_excludeFromBOM->GetValue() )
480  attributes |= FP_EXCLUDE_FROM_BOM;
481 
482  m_footprint->SetAttributes( attributes );
483 
486 
487  // Now, set orientation. Must be done after other changes because rotation changes field
488  // positions on board (so that relative positions are held constant)
489  m_orientValidator.TransferFromWindow();
490 
491  double orient = m_orientValue * 10;
492 
493  if( m_footprint->GetOrientation() != orient )
495 
496  // Set component side, that also have effect on the fields positions on board
497  bool change_layer = false;
498  if( m_BoardSideCtrl->GetSelection() == 0 ) // layer req = COMPONENT
499  {
500  if( m_footprint->GetLayer() == B_Cu )
501  change_layer = true;
502  }
503  else if( m_footprint->GetLayer() == F_Cu )
504  change_layer = true;
505 
506  if( change_layer )
508 
509  // Copy the models from the panel to the footprint
510  std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
511  std::list<FP_3DMODEL>* fpList = &m_footprint->Models();
512  fpList->clear();
513  fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
514 
515  // This is a simple edit, we must create an undo entry
516  if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
517  commit.Push( _( "Modify footprint properties" ) );
518 
520  return true;
521 }
522 
523 
525 {
527  return;
528 
529  const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
530  FP_TEXT textItem( m_footprint );
531 
532  // Set active layer if legal; otherwise copy layer from previous text item
534  textItem.SetLayer( m_frame->GetActiveLayer() );
535  else
536  textItem.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
537 
538  textItem.SetTextSize( dsnSettings.GetTextSize( textItem.GetLayer() ) );
539  textItem.SetTextThickness( dsnSettings.GetTextThickness( textItem.GetLayer() ) );
540  textItem.SetItalic( dsnSettings.GetTextItalic( textItem.GetLayer() ) );
541  textItem.SetKeepUpright( dsnSettings.GetTextUpright( textItem.GetLayer() ) );
542  textItem.SetMirrored( IsBackLayer( textItem.GetLayer() ) );
543 
544  m_texts->push_back( textItem );
545 
546  // notify the grid
547  wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
548  m_itemsGrid->ProcessTableMessage( msg );
549 
550  m_itemsGrid->SetFocus();
551  m_itemsGrid->MakeCellVisible( m_texts->size() - 1, 0 );
552  m_itemsGrid->SetGridCursor( m_texts->size() - 1, 0 );
553 
554  m_itemsGrid->EnableCellEditControl( true );
555  m_itemsGrid->ShowCellEditControl();
556 }
557 
558 
560 {
562  return;
563 
564  wxArrayInt selectedRows = m_itemsGrid->GetSelectedRows();
565 
566  if( selectedRows.empty() && m_itemsGrid->GetGridCursorRow() >= 0 )
567  selectedRows.push_back( m_itemsGrid->GetGridCursorRow() );
568 
569  if( selectedRows.empty() )
570  return;
571 
572  for( int row : selectedRows )
573  {
574  if( row < 2 )
575  {
576  DisplayError( nullptr, _( "Reference and value are mandatory." ) );
577  return;
578  }
579  }
580 
581  // Reverse sort so deleting a row doesn't change the indexes of the other rows.
582  selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } );
583 
584  for( int row : selectedRows )
585  {
586  m_texts->erase( m_texts->begin() + row );
587 
588  // notify the grid
589  wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
590  m_itemsGrid->ProcessTableMessage( msg );
591 
592  if( m_itemsGrid->GetNumberRows() > 0 )
593  {
594  m_itemsGrid->MakeCellVisible( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
595  m_itemsGrid->SetGridCursor( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
596  }
597  }
598 }
599 
600 
602 {
603  // Account for scroll bars
604  int itemsWidth = aWidth - ( m_itemsGrid->GetSize().x - m_itemsGrid->GetClientSize().x );
605 
606  itemsWidth -= m_itemsGrid->GetRowLabelSize();
607 
608  for( int i = 1; i < m_itemsGrid->GetNumberCols(); i++ )
609  itemsWidth -= m_itemsGrid->GetColSize( i );
610 
611  if( itemsWidth > 0 )
612  {
613  m_itemsGrid->SetColSize( 0, std::max( itemsWidth,
614  m_itemsGrid->GetVisibleWidth( 0, true, false, false ) ) );
615  }
616 
617  // Update the width of the 3D panel
619 }
620 
621 
623 {
624  if( !m_initialized )
625  return;
626 
627  if( !m_itemsGrid->IsCellEditControlShown() )
628  adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
629 
630  // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
631  // even when the original validation was triggered from a killFocus event, and so
632  // that the corresponding notebook page can be shown in the background when triggered
633  // from an OK.
634  if( m_delayedFocusRow >= 0 )
635  {
636  // We will re-enter this routine if an error dialog is displayed, so make sure we
637  // zero out our member variables first.
638  wxGrid* grid = m_delayedFocusGrid;
639  int row = m_delayedFocusRow;
640  int col = m_delayedFocusColumn;
641  wxString msg = m_delayedErrorMessage;
642 
643  m_delayedFocusGrid = nullptr;
644  m_delayedFocusRow = -1;
646  m_delayedErrorMessage = wxEmptyString;
647 
648  if( !msg.IsEmpty() )
649  {
650  // Do not use DisplayErrorMessage(); it screws up window order on Mac
651  DisplayError( nullptr, msg );
652  }
653 
654  grid->SetFocus();
655  grid->MakeCellVisible( row, col );
656 
657  // Selecting the first grid item only makes sense for the
658  // items grid
659  if( !m_initialFocus || grid == m_itemsGrid )
660  {
661  grid->SetGridCursor( row, col );
662  grid->EnableCellEditControl( true );
663  grid->ShowCellEditControl();
664 
665  if( grid == m_itemsGrid && row == 0 && col == 0 )
666  {
667  auto referenceEditor = grid->GetCellEditor( 0, 0 );
668 
669  if( auto textEntry = dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) )
670  KIUI::SelectReferenceNumber( textEntry );
671 
672  referenceEditor->DecRef();
673  }
674  }
675  m_initialFocus = false;
676  }
677 }
678 
679 
680 void DIALOG_FOOTPRINT_PROPERTIES::OnGridSize( wxSizeEvent& aEvent )
681 {
682  // A trick to fix a cosmetic issue: when, in m_itemsGrid, a layer selector widget
683  // has the focus (is activated in column 6) when resizing the grid, the widget
684  // is not moved. So just change the widget having the focus in this case
685  if( m_NoteBook->GetSelection() == 0 && !m_itemsGrid->HasFocus() )
686  {
687  int col = m_itemsGrid->GetGridCursorCol();
688 
689  if( col == 6 ) // a layer selector widget can be activated
690  m_itemsGrid->SetFocus();
691  }
692 
693  adjustGridColumns( aEvent.GetSize().GetX() );
694 
695  aEvent.Skip();
696 }
697 
698 
699 void DIALOG_FOOTPRINT_PROPERTIES::OnPageChange( wxNotebookEvent& aEvent )
700 {
701  int page = aEvent.GetSelection();
702 
703  // Shouldn't be necessary, but is on at least OSX
704  if( page >= 0 )
705  m_NoteBook->ChangeSelection( (unsigned) page );
706 
707 #ifdef __WXMAC__
708  // Work around an OSX bug where the wxGrid children don't get placed correctly until
709  // the first resize event
710  if( m_macHack[ page ] )
711  {
712  wxSize pageSize = m_NoteBook->GetPage( page )->GetSize();
713  pageSize.x -= 1;
714 
715  m_NoteBook->GetPage( page )->SetSize( pageSize );
716  m_macHack[ page ] = false;
717  }
718 #endif
719 }
720 
721 
723 {
725 }
void SetMirrored(bool isMirrored)
Definition: eda_text.h:209
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:279
bool IsLocked() const override
Definition: footprint.h:294
void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:185
COMMIT & Modify(EDA_ITEM *aItem)
Create an undo entry for an item that has been already modified.
Definition: commit.h:103
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
virtual void SetNegativeZero()
Definition: unit_binder.h:67
PANEL_FP_PROPERTIES_3D_MODEL * m_3dPanel
std::list< FP_3DMODEL > & Models()
Definition: footprint.h:183
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: footprint.h:227
void OnAddField(wxCommandEvent &) override
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:163
This file is part of the common library.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
int GetPlacementCost180() const
Definition: footprint.h:579
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:136
void ValidatorTransferToWindowWithoutEvents(wxValidator &aValidator)
Call a text validator's TransferDataToWindow method without firing a text change event.
Definition: validators.cpp:376
int GetNumberRows() override
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetItalic(bool isItalic)
Definition: eda_text.h:200
void OnUpdateUI(wxUpdateUIEvent &) override
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:144
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition: grid_tricks.h:55
double GetOrientation() const
Definition: footprint.h:191
void DeleteStructure()
Delete this object after removing from its parent if it has one.
Definition: board_item.cpp:128
Class DIALOG_FOOTPRINT_PROPERTIES_BASE.
void FootprintOrientEvent(wxCommandEvent &) override
std::vector< FP_3DMODEL > & GetModelList()
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: footprint.h:225
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:467
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:258
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:72
wxString m_FootprintTextShownColumns
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:829
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
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 OnDeleteField(wxCommandEvent &) override
void SetAttributes(int aAttributes)
Definition: footprint.h:237
void SetPlacementCost180(int aCost)
Definition: footprint.h:580
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=false, bool aKeep=true)
Calculates the specified column based on the actual size of the text on screen.
Definition: wx_grid.cpp:246
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:500
bool GetTextUpright(PCB_LAYER_ID aLayer) const
FP_TEXT & Reference()
Definition: footprint.h:501
void EditLibraryFootprint(wxCommandEvent &) override
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:104
bool GetTextItalic(PCB_LAYER_ID aLayer) const
virtual PCB_LAYER_ID GetActiveLayer() const
pads are covered by copper
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition: layer_ids.h:896
void OnOtherOrientation(wxCommandEvent &aEvent) override
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
wxFloatingPointValidator< double > m_orientValidator
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1490
void SetLocalClearance(int aClearance)
Definition: footprint.h:211
int GetLocalClearance() const
Definition: footprint.h:210
#define _(s)
DRAWINGS & GraphicalItems()
Definition: footprint.h:172
const LIB_ID & GetFPID() const
Definition: footprint.h:195
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:157
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:190
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
Definition: footprint.cpp:1465
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
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
UTF8 Format() const
Definition: lib_id.cpp:116
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Use thermal relief for pads.
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:117
void SetKeepUpright(bool aKeepUpright)
Definition: fp_text.h:115
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...
Definition: unit_binder.cpp:92
int GetLocalSolderMaskMargin() const
Definition: footprint.h:207
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.
see class PGM_BASE
int GetAttributes() const
Definition: footprint.h:236
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
Definition: layer_ids.h:71
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:304
The main frame for Pcbnew.
PCBNEW_SETTINGS & Settings()
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Revert the commit by restoring the modified items state.
Pads are not covered.
wxPoint GetPosition() const override
Definition: footprint.h:187
double GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:224
virtual long long int GetValue()
Return the current value in Internal Units.
DIALOG_FOOTPRINT_PROPERTIES(PCB_EDIT_FRAME *aParent, FOOTPRINT *aFootprint)
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.h:180
ZONE_CONNECTION GetZoneConnection() const
Definition: footprint.h:228
int GetPlacementCost90() const
Definition: footprint.h:582
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
Definition: unit_binder.h:177
void UpdateFootprint(wxCommandEvent &) override
int GetLocalSolderPasteMargin() const
Definition: footprint.h:221
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Removes an item from the container.
Definition: footprint.cpp:513
virtual void SetDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
virtual double GetDoubleValue()
Return the current value in Internal Units.
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1561
void OnPageChange(wxNotebookEvent &event) override
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:142
void updateOrientationControl()
Update the orientation validated control, without triggering a change event on the control (which wou...
Custom text control validator definitions.
wxSize GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
void SetPlacementCost90(int aCost)
Definition: footprint.h:583
void EditFootprint(wxCommandEvent &) override
void SetLocalSolderMaskMargin(int aMargin)
Definition: footprint.h:208
void ChangeFootprint(wxCommandEvent &) override
void OnGridSize(wxSizeEvent &aEvent) override
Container for design settings for a BOARD object.
void SetLocalSolderPasteMargin(int aMargin)
Definition: footprint.h:222