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 
153  // We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
154  // implementation on MSW
155  m_tabOrder = {
156  m_itemsGrid,
162  m_boardOnly,
170  };
171 
173  m_initialized = true;
174 }
175 
176 
178 {
180  m_itemsGrid->GetShownColumns().ToStdString();
181 
182  // Prevents crash bug in wxGrid's d'tor
184 
185  // Delete the GRID_TRICKS.
186  m_itemsGrid->PopEventHandler( true );
187 
188  // free the memory used by all models, otherwise models which were
189  // browsed but not used would consume memory
190  Prj().Get3DCacheManager()->FlushCache( false );
191 
192  // the GL canvas has to be visible before it is destroyed
193  m_page = m_NoteBook->GetSelection();
194  m_NoteBook->SetSelection( 1 );
195 }
196 
197 
199 {
200  if( TransferDataFromWindow() )
201  {
203  Close();
204  }
205 }
206 
207 
209 {
210  if( TransferDataFromWindow() )
211  {
213  Close();
214  }
215 }
216 
217 
219 {
220  if( TransferDataFromWindow() )
221  {
223  Close();
224  }
225 }
226 
227 
229 {
230  if( TransferDataFromWindow() )
231  {
233  Close();
234  }
235 }
236 
237 
239 {
240  if( m_Orient0->GetValue() )
241  m_orientValue = 0.0;
242  else if( m_Orient90->GetValue() )
243  m_orientValue = 90.0;
244  else if( m_Orient270->GetValue() )
245  m_orientValue = 270.0;
246  else if( m_Orient180->GetValue() )
247  m_orientValue = 180.0;
248 
250 }
251 
252 
254 {
255  m_OrientOther->SetValue( true );
256 
257  aEvent.Skip();
258 }
259 
260 
262 {
263  if( !wxDialog::TransferDataToWindow() )
264  return false;
265 
266  if( !m_PanelGeneral->TransferDataToWindow() )
267  return false;
268 
269  // Add the models to the panel
271  return false;
272 
273  // Footprint Texts
274  m_texts->push_back( m_footprint->Reference() );
275  m_texts->push_back( m_footprint->Value() );
276 
277  for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
278  {
279  FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
280 
281  if( textItem )
282  m_texts->push_back( *textItem );
283  }
284 
285  // notify the grid
286  wxGridTableMessage tmsg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_texts->GetNumberRows() );
287  m_itemsGrid->ProcessTableMessage( tmsg );
288 
289  // Footprint Properties
290 
293 
294  m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
295 
297 
298  if( m_orientValue == 0.0 )
299  m_Orient0->SetValue( true );
300  else if( m_orientValue == 90.0 || m_orientValue == -270.0 )
301  m_Orient90->SetValue( true );
302  else if( m_orientValue == 270.0 || m_orientValue == -90.0 )
303  m_Orient270->SetValue( true );
304  else if( m_orientValue == 180.0 || m_orientValue == -180.0 )
305  m_Orient180->SetValue( true );
306  else
307  m_OrientOther->SetValue( true );
308 
310 
311  m_AutoPlaceCtrl->SetSelection( m_footprint->IsLocked() ? 1 : 0 );
312 
313  m_AutoPlaceCtrl->SetItemToolTip( 0, _( "Footprint can be freely moved and oriented on the "
314  "canvas." ) );
315  m_AutoPlaceCtrl->SetItemToolTip( 1, _( "Footprint is locked: it cannot be freely moved and "
316  "oriented on the canvas and can only be selected when "
317  "the 'Locked items' checkbox is enabled in the "
318  "selection filter." ) );
319 
322 
324  m_componentType->SetSelection( 0 );
325  else if( m_footprint->GetAttributes() & FP_SMD )
326  m_componentType->SetSelection( 1 );
327  else
328  m_componentType->SetSelection( 2 );
329 
333 
334  // Local Clearances
335 
340 
341  switch( m_footprint->GetZoneConnection() )
342  {
343  default:
344  case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
345  case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
346  case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
347  case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
348  }
349 
350  // Show the footprint's FPID.
351  m_tcLibraryID->SetValue( m_footprint->GetFPID().Format() );
352 
353  for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
354  {
355  m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false,
356  false ) );
357  // Adjust the column size.
358  int col_size = m_itemsGrid->GetVisibleWidth( col, true, true, false );
359 
360  if( col == FPT_LAYER ) // This one's a drop-down. Check all possible values.
361  {
362  BOARD* board = m_footprint->GetBoard();
363 
364  for( PCB_LAYER_ID layer : board->GetEnabledLayers().Seq() )
365  col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
366 
367  // And the swatch:
368  col_size += 20;
369  }
370 
371  if( m_itemsGrid->IsColShown( col ) )
372  m_itemsGrid->SetColSize( col, col_size );
373  }
374 
375  m_itemsGrid->SetRowLabelSize( m_itemsGrid->GetVisibleWidth( -1, false, true, true ) );
376 
377  Layout();
378  adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
379 
380  return true;
381 }
382 
383 
385 {
387  return false;
388 
389  if( !DIALOG_SHIM::Validate() )
390  return false;
391 
392  // Check for empty texts.
393  for( size_t i = 2; i < m_texts->size(); ++i )
394  {
395  FP_TEXT& text = m_texts->at( i );
396 
397  if( text.GetText().IsEmpty() )
398  {
399  if( m_NoteBook->GetSelection() != 0 )
400  m_NoteBook->SetSelection( 0 );
401 
403  m_delayedErrorMessage = _( "Text items must have some content." );
405  m_delayedFocusRow = i;
406 
407  return false;
408  }
409  }
410 
411  if( !m_netClearance.Validate( 0, INT_MAX ) )
412  return false;
413 
414  return true;
415 }
416 
417 
419 {
420  if( !Validate() )
421  return false;
422 
424  return false;
425 
426  // This only commits the editor, model updating is done below so it is inside
427  // the commit
429  return false;
430 
431  auto view = m_frame->GetCanvas()->GetView();
432  BOARD_COMMIT commit( m_frame );
433  commit.Modify( m_footprint );
434 
435  // copy reference and value
436  m_footprint->Reference() = m_texts->at( 0 );
437  m_footprint->Value() = m_texts->at( 1 );
438 
439  size_t i = 2;
440 
441  for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
442  {
443  FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
444 
445  if( textItem )
446  {
447  // copy grid table entries till we run out, then delete any remaining texts
448  if( i < m_texts->size() )
449  *textItem = m_texts->at( i++ );
450  else
451  textItem->DeleteStructure();
452  }
453  }
454 
455  // if there are still grid table entries, create new texts for them
456  while( i < m_texts->size() )
457  {
458  auto newText = new FP_TEXT( m_texts->at( i++ ) );
459  m_footprint->Add( newText, ADD_MODE::APPEND );
460  view->Add( newText );
461  }
462 
463  // Initialize masks clearances
468 
469  switch( m_ZoneConnectionChoice->GetSelection() )
470  {
471  default:
476  }
477 
478  // Set Footprint Position
479  wxPoint pos( m_posX.GetValue(), m_posY.GetValue() );
480  m_footprint->SetPosition( pos );
481  m_footprint->SetLocked( m_AutoPlaceCtrl->GetSelection() == 1 );
482 
483  int attributes = 0;
484 
485  switch( m_componentType->GetSelection() )
486  {
487  case 0: attributes |= FP_THROUGH_HOLE; break;
488  case 1: attributes |= FP_SMD; break;
489  default: break;
490  }
491 
492  if( m_boardOnly->GetValue() )
493  attributes |= FP_BOARD_ONLY;
494 
495  if( m_excludeFromPosFiles->GetValue() )
496  attributes |= FP_EXCLUDE_FROM_POS_FILES;
497 
498  if( m_excludeFromBOM->GetValue() )
499  attributes |= FP_EXCLUDE_FROM_BOM;
500 
501  m_footprint->SetAttributes( attributes );
502 
505 
506  // Now, set orientation. Must be done after other changes because rotation changes field
507  // positions on board (so that relative positions are held constant)
508  m_orientValidator.TransferFromWindow();
509 
510  double orient = m_orientValue * 10;
511 
512  if( m_footprint->GetOrientation() != orient )
514 
515  // Set component side, that also have effect on the fields positions on board
516  bool change_layer = false;
517  if( m_BoardSideCtrl->GetSelection() == 0 ) // layer req = COMPONENT
518  {
519  if( m_footprint->GetLayer() == B_Cu )
520  change_layer = true;
521  }
522  else if( m_footprint->GetLayer() == F_Cu )
523  change_layer = true;
524 
525  if( change_layer )
527 
528  // Copy the models from the panel to the footprint
529  std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
530  std::list<FP_3DMODEL>* fpList = &m_footprint->Models();
531  fpList->clear();
532  fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
533 
534  // This is a simple edit, we must create an undo entry
535  if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
536  commit.Push( _( "Modify footprint properties" ) );
537 
539  return true;
540 }
541 
542 
544 {
546  return;
547 
548  const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
549  FP_TEXT textItem( m_footprint );
550 
551  // Set active layer if legal; otherwise copy layer from previous text item
553  textItem.SetLayer( m_frame->GetActiveLayer() );
554  else
555  textItem.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
556 
557  textItem.SetTextSize( dsnSettings.GetTextSize( textItem.GetLayer() ) );
558  textItem.SetTextThickness( dsnSettings.GetTextThickness( textItem.GetLayer() ) );
559  textItem.SetItalic( dsnSettings.GetTextItalic( textItem.GetLayer() ) );
560  textItem.SetKeepUpright( dsnSettings.GetTextUpright( textItem.GetLayer() ) );
561  textItem.SetMirrored( IsBackLayer( textItem.GetLayer() ) );
562 
563  m_texts->push_back( textItem );
564 
565  // notify the grid
566  wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
567  m_itemsGrid->ProcessTableMessage( msg );
568 
569  m_itemsGrid->SetFocus();
570  m_itemsGrid->MakeCellVisible( m_texts->size() - 1, 0 );
571  m_itemsGrid->SetGridCursor( m_texts->size() - 1, 0 );
572 
573  m_itemsGrid->EnableCellEditControl( true );
574  m_itemsGrid->ShowCellEditControl();
575 }
576 
577 
579 {
581  return;
582 
583  wxArrayInt selectedRows = m_itemsGrid->GetSelectedRows();
584 
585  if( selectedRows.empty() && m_itemsGrid->GetGridCursorRow() >= 0 )
586  selectedRows.push_back( m_itemsGrid->GetGridCursorRow() );
587 
588  if( selectedRows.empty() )
589  return;
590 
591  for( int row : selectedRows )
592  {
593  if( row < 2 )
594  {
595  DisplayError( nullptr, _( "Reference and value are mandatory." ) );
596  return;
597  }
598  }
599 
600  // Reverse sort so deleting a row doesn't change the indexes of the other rows.
601  selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } );
602 
603  for( int row : selectedRows )
604  {
605  m_texts->erase( m_texts->begin() + row );
606 
607  // notify the grid
608  wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
609  m_itemsGrid->ProcessTableMessage( msg );
610 
611  if( m_itemsGrid->GetNumberRows() > 0 )
612  {
613  m_itemsGrid->MakeCellVisible( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
614  m_itemsGrid->SetGridCursor( std::max( 0, row-1 ), m_itemsGrid->GetGridCursorCol() );
615  }
616  }
617 }
618 
619 
621 {
622  // Account for scroll bars
623  int itemsWidth = aWidth - ( m_itemsGrid->GetSize().x - m_itemsGrid->GetClientSize().x );
624 
625  itemsWidth -= m_itemsGrid->GetRowLabelSize();
626 
627  for( int i = 1; i < m_itemsGrid->GetNumberCols(); i++ )
628  itemsWidth -= m_itemsGrid->GetColSize( i );
629 
630  if( itemsWidth > 0 )
631  {
632  m_itemsGrid->SetColSize( 0, std::max( itemsWidth,
633  m_itemsGrid->GetVisibleWidth( 0, true, false, false ) ) );
634  }
635 
636  // Update the width of the 3D panel
638 }
639 
640 
642 {
643  if( !m_initialized )
644  return;
645 
646  if( !m_itemsGrid->IsCellEditControlShown() )
647  adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
648 
649  // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
650  // even when the original validation was triggered from a killFocus event, and so
651  // that the corresponding notebook page can be shown in the background when triggered
652  // from an OK.
653  if( m_delayedFocusRow >= 0 )
654  {
655  // We will re-enter this routine if an error dialog is displayed, so make sure we
656  // zero out our member variables first.
657  wxGrid* grid = m_delayedFocusGrid;
658  int row = m_delayedFocusRow;
659  int col = m_delayedFocusColumn;
660  wxString msg = m_delayedErrorMessage;
661 
662  m_delayedFocusGrid = nullptr;
663  m_delayedFocusRow = -1;
665  m_delayedErrorMessage = wxEmptyString;
666 
667  if( !msg.IsEmpty() )
668  {
669  // Do not use DisplayErrorMessage(); it screws up window order on Mac
670  DisplayError( nullptr, msg );
671  }
672 
673  grid->SetFocus();
674  grid->MakeCellVisible( row, col );
675 
676  // Selecting the first grid item only makes sense for the
677  // items grid
678  if( !m_initialFocus || grid == m_itemsGrid )
679  {
680  grid->SetGridCursor( row, col );
681  grid->EnableCellEditControl( true );
682  grid->ShowCellEditControl();
683 
684  if( grid == m_itemsGrid && row == 0 && col == 0 )
685  {
686  auto referenceEditor = grid->GetCellEditor( 0, 0 );
687 
688  if( auto textEntry = dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) )
689  KIUI::SelectReferenceNumber( textEntry );
690 
691  referenceEditor->DecRef();
692  }
693  }
694  m_initialFocus = false;
695  }
696 }
697 
698 
699 void DIALOG_FOOTPRINT_PROPERTIES::OnGridSize( wxSizeEvent& aEvent )
700 {
701  // A trick to fix a cosmetic issue: when, in m_itemsGrid, a layer selector widget
702  // has the focus (is activated in column 6) when resizing the grid, the widget
703  // is not moved. So just change the widget having the focus in this case
704  if( m_NoteBook->GetSelection() == 0 && !m_itemsGrid->HasFocus() )
705  {
706  int col = m_itemsGrid->GetGridCursorCol();
707 
708  if( col == 6 ) // a layer selector widget can be activated
709  m_itemsGrid->SetFocus();
710  }
711 
712  adjustGridColumns( aEvent.GetSize().GetX() );
713 
714  aEvent.Skip();
715 }
716 
717 
718 void DIALOG_FOOTPRINT_PROPERTIES::OnPageChange( wxNotebookEvent& aEvent )
719 {
720  int page = aEvent.GetSelection();
721 
722  // Shouldn't be necessary, but is on at least OSX
723  if( page >= 0 )
724  m_NoteBook->ChangeSelection( (unsigned) page );
725 
726 #ifdef __WXMAC__
727  // Work around an OSX bug where the wxGrid children don't get placed correctly until
728  // the first resize event
729  if( m_macHack[ page ] )
730  {
731  wxSize pageSize = m_NoteBook->GetPage( page )->GetSize();
732  pageSize.x -= 1;
733 
734  m_NoteBook->GetPage( page )->SetSize( pageSize );
735  m_macHack[ page ] = false;
736  }
737 #endif
738 }
739 
740 
742 {
744 }
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:297
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:230
void OnAddField(wxCommandEvent &) override
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:164
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:581
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:172
void ValidatorTransferToWindowWithoutEvents(wxValidator &aValidator)
Call a text validator's TransferDataToWindow method without firing a text change event.
Definition: validators.cpp:376
std::vector< wxWindow * > m_tabOrder
Definition: dialog_shim.h:220
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:228
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:93
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:240
void SetPlacementCost180(int aCost)
Definition: footprint.h:582
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:282
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:502
bool GetTextUpright(PCB_LAYER_ID aLayer) const
FP_TEXT & Reference()
Definition: footprint.h:503
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:139
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:907
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:1491
void SetLocalClearance(int aClearance)
Definition: footprint.h:214
int GetLocalClearance() const
Definition: footprint.h:213
#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:226
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
Definition: footprint.cpp:1466
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:153
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:210
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:239
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
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:307
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:227
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
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:231
int GetPlacementCost90() const
Definition: footprint.h:584
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:224
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:1562
void OnPageChange(wxNotebookEvent &event) override
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:143
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:585
void EditFootprint(wxCommandEvent &) override
void SetLocalSolderMaskMargin(int aMargin)
Definition: footprint.h:211
void ChangeFootprint(wxCommandEvent &) override
void OnGridSize(wxSizeEvent &aEvent) override
Container for design settings for a BOARD object.
void SetLocalSolderPasteMargin(int aMargin)
Definition: footprint.h:225