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 <mrluzeiro@ua.pt>
5  * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
6  * Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com
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 
242 bool allPadsLocked( FOOTPRINT* aFootprint )
243 {
244  for( PAD* pad : aFootprint->Pads() )
245  {
246  if( !pad->IsLocked() )
247  return false;
248  }
249 
250  return true;
251 }
252 
253 
255 {
256  if( !wxDialog::TransferDataToWindow() )
257  return false;
258 
259  if( !m_PanelGeneral->TransferDataToWindow() )
260  return false;
261 
262  // Add the models to the panel
264  return false;
265 
266  // Footprint Texts
267  m_texts->push_back( m_footprint->Reference() );
268  m_texts->push_back( m_footprint->Value() );
269 
270  for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
271  {
272  FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
273 
274  if( textItem )
275  m_texts->push_back( *textItem );
276  }
277 
278  // notify the grid
279  wxGridTableMessage tmsg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_texts->GetNumberRows() );
280  m_itemsGrid->ProcessTableMessage( tmsg );
281 
282  // Footprint Properties
283 
286 
287  m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
288 
290 
291  if( m_orientValue == 0.0 )
292  m_Orient0->SetValue( true );
293  else if( m_orientValue == 90.0 || m_orientValue == -270.0 )
294  m_Orient90->SetValue( true );
295  else if( m_orientValue == 270.0 || m_orientValue == -90.0 )
296  m_Orient270->SetValue( true );
297  else if( m_orientValue == 180.0 || m_orientValue == -180.0 )
298  m_Orient180->SetValue( true );
299  else
300  m_OrientOther->SetValue( true );
301 
303 
304  m_AutoPlaceCtrl->SetSelection( m_footprint->IsLocked() ? 1 : 0 );
305 
306  m_AutoPlaceCtrl->SetItemToolTip( 0, _( "Footprint can be freely moved and oriented on the "
307  "canvas." ) );
308  m_AutoPlaceCtrl->SetItemToolTip( 1, _( "Footprint is locked: it cannot be freely moved and "
309  "oriented on the canvas and can only be selected when "
310  "the 'Locked items' checkbox is enabled in the "
311  "selection filter." ) );
312 
315 
317  m_componentType->SetSelection( 0 );
318  else if( m_footprint->GetAttributes() & FP_SMD )
319  m_componentType->SetSelection( 1 );
320  else
321  m_componentType->SetSelection( 2 );
322 
326 
327  // Local Clearances
328 
333 
334  switch( m_footprint->GetZoneConnection() )
335  {
336  default:
337  case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
338  case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
339  case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
340  case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
341  }
342 
343  // Show the footprint's FPID.
344  m_tcLibraryID->SetValue( m_footprint->GetFPID().Format() );
345 
346  for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
347  {
348  m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false,
349  false ) );
350  // Adjust the column size.
351  int col_size = m_itemsGrid->GetVisibleWidth( col, true, true, false );
352 
353  if( col == FPT_LAYER ) // This one's a drop-down. Check all possible values.
354  {
355  BOARD* board = m_footprint->GetBoard();
356 
357  for( PCB_LAYER_ID layer : board->GetEnabledLayers().Seq() )
358  col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
359 
360  // And the swatch:
361  col_size += 20;
362  }
363 
364  if( m_itemsGrid->IsColShown( col ) )
365  m_itemsGrid->SetColSize( col, col_size );
366  }
367 
368  m_itemsGrid->SetRowLabelSize( m_itemsGrid->GetVisibleWidth( -1, false, true, true ) );
369 
370  Layout();
371  adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
372 
373  return true;
374 }
375 
376 
378 {
380  return false;
381 
382  if( !DIALOG_SHIM::Validate() )
383  return false;
384 
385  // Check for empty texts.
386  for( size_t i = 2; i < m_texts->size(); ++i )
387  {
388  FP_TEXT& text = m_texts->at( i );
389 
390  if( text.GetText().IsEmpty() )
391  {
392  if( m_NoteBook->GetSelection() != 0 )
393  m_NoteBook->SetSelection( 0 );
394 
396  m_delayedErrorMessage = _( "Text items must have some content." );
398  m_delayedFocusRow = i;
399 
400  return false;
401  }
402  }
403 
404  if( !m_netClearance.Validate( 0, INT_MAX ) )
405  return false;
406 
407  return true;
408 }
409 
410 
412 {
413  if( !Validate() )
414  return false;
415 
417  return false;
418 
419  // This only commits the editor, model updating is done below so it is inside
420  // the commit
422  return false;
423 
424  auto view = m_frame->GetCanvas()->GetView();
425  BOARD_COMMIT commit( m_frame );
426  commit.Modify( m_footprint );
427 
428  // copy reference and value
429  m_footprint->Reference() = m_texts->at( 0 );
430  m_footprint->Value() = m_texts->at( 1 );
431 
432  size_t i = 2;
433 
434  for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
435  {
436  FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
437 
438  if( textItem )
439  {
440  // copy grid table entries till we run out, then delete any remaining texts
441  if( i < m_texts->size() )
442  *textItem = m_texts->at( i++ );
443  else
444  textItem->DeleteStructure();
445  }
446  }
447 
448  // if there are still grid table entries, create new texts for them
449  while( i < m_texts->size() )
450  {
451  auto newText = new FP_TEXT( m_texts->at( i++ ) );
452  m_footprint->Add( newText, ADD_MODE::APPEND );
453  view->Add( newText );
454  }
455 
456  // Initialize masks clearances
461 
462  switch( m_ZoneConnectionChoice->GetSelection() )
463  {
464  default:
469  }
470 
471  // Set Footprint Position
472  wxPoint pos( m_posX.GetValue(), m_posY.GetValue() );
473  m_footprint->SetPosition( pos );
474  m_footprint->SetLocked( m_AutoPlaceCtrl->GetSelection() == 1 );
475 
476  int attributes = 0;
477 
478  switch( m_componentType->GetSelection() )
479  {
480  case 0: attributes |= FP_THROUGH_HOLE; break;
481  case 1: attributes |= FP_SMD; break;
482  default: break;
483  }
484 
485  if( m_boardOnly->GetValue() )
486  attributes |= FP_BOARD_ONLY;
487 
488  if( m_excludeFromPosFiles->GetValue() )
489  attributes |= FP_EXCLUDE_FROM_POS_FILES;
490 
491  if( m_excludeFromBOM->GetValue() )
492  attributes |= FP_EXCLUDE_FROM_BOM;
493 
494  m_footprint->SetAttributes( attributes );
495 
498 
499  // Now, set orientation. Must be done after other changes because rotation changes field
500  // positions on board (so that relative positions are held constant)
501  m_orientValidator.TransferFromWindow();
502 
503  double orient = m_orientValue * 10;
504 
505  if( m_footprint->GetOrientation() != orient )
507 
508  // Set component side, that also have effect on the fields positions on board
509  bool change_layer = false;
510  if( m_BoardSideCtrl->GetSelection() == 0 ) // layer req = COMPONENT
511  {
512  if( m_footprint->GetLayer() == B_Cu )
513  change_layer = true;
514  }
515  else if( m_footprint->GetLayer() == F_Cu )
516  change_layer = true;
517 
518  if( change_layer )
520 
521  // Copy the models from the panel to the footprint
522  std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
523  std::list<FP_3DMODEL>* fpList = &m_footprint->Models();
524  fpList->clear();
525  fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
526 
527  // This is a simple edit, we must create an undo entry
528  if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
529  commit.Push( _( "Modify footprint properties" ) );
530 
532  return true;
533 }
534 
535 
537 {
539  return;
540 
541  const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
542  FP_TEXT textItem( m_footprint );
543 
544  // Set active layer if legal; otherwise copy layer from previous text item
546  textItem.SetLayer( m_frame->GetActiveLayer() );
547  else
548  textItem.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
549 
550  textItem.SetTextSize( dsnSettings.GetTextSize( textItem.GetLayer() ) );
551  textItem.SetTextThickness( dsnSettings.GetTextThickness( textItem.GetLayer() ) );
552  textItem.SetItalic( dsnSettings.GetTextItalic( textItem.GetLayer() ) );
553  textItem.SetKeepUpright( dsnSettings.GetTextUpright( textItem.GetLayer() ) );
554  textItem.SetMirrored( IsBackLayer( textItem.GetLayer() ) );
555 
556  m_texts->push_back( textItem );
557 
558  // notify the grid
559  wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
560  m_itemsGrid->ProcessTableMessage( msg );
561 
562  m_itemsGrid->SetFocus();
563  m_itemsGrid->MakeCellVisible( m_texts->size() - 1, 0 );
564  m_itemsGrid->SetGridCursor( m_texts->size() - 1, 0 );
565 
566  m_itemsGrid->EnableCellEditControl( true );
567  m_itemsGrid->ShowCellEditControl();
568 }
569 
570 
572 {
573  m_itemsGrid->CommitPendingChanges( true /* quiet mode */ );
574 
575  int curRow = m_itemsGrid->GetGridCursorRow();
576 
577  if( curRow < 0 )
578  return;
579  else if( curRow < 2 )
580  {
581  DisplayError( nullptr, _( "Reference and value are mandatory." ) );
582  return;
583  }
584 
585  m_texts->erase( m_texts->begin() + curRow );
586 
587  // notify the grid
588  wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 );
589  m_itemsGrid->ProcessTableMessage( msg );
590 
591  if( m_itemsGrid->GetNumberRows() > 0 )
592  {
593  m_itemsGrid->MakeCellVisible( std::max( 0, curRow-1 ), m_itemsGrid->GetGridCursorCol() );
594  m_itemsGrid->SetGridCursor( std::max( 0, curRow-1 ), m_itemsGrid->GetGridCursorCol() );
595  }
596 }
597 
598 
600 {
601  // Account for scroll bars
602  int itemsWidth = aWidth - ( m_itemsGrid->GetSize().x - m_itemsGrid->GetClientSize().x );
603 
604  itemsWidth -= m_itemsGrid->GetRowLabelSize();
605 
606  for( int i = 1; i < m_itemsGrid->GetNumberCols(); i++ )
607  itemsWidth -= m_itemsGrid->GetColSize( i );
608 
609  if( itemsWidth > 0 )
610  {
611  m_itemsGrid->SetColSize( 0, std::max( itemsWidth,
612  m_itemsGrid->GetVisibleWidth( 0, true, false, false ) ) );
613  }
614 
615  // Update the width of the 3D panel
617 }
618 
619 
621 {
622  if( !m_initialized )
623  return;
624 
625  if( !m_itemsGrid->IsCellEditControlShown() )
626  adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
627 
628  // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
629  // even when the original validation was triggered from a killFocus event, and so
630  // that the corresponding notebook page can be shown in the background when triggered
631  // from an OK.
632  if( m_delayedFocusRow >= 0 )
633  {
634  // We will re-enter this routine if an error dialog is displayed, so make sure we
635  // zero out our member variables first.
636  wxGrid* grid = m_delayedFocusGrid;
637  int row = m_delayedFocusRow;
638  int col = m_delayedFocusColumn;
639  wxString msg = m_delayedErrorMessage;
640 
641  m_delayedFocusGrid = nullptr;
642  m_delayedFocusRow = -1;
644  m_delayedErrorMessage = wxEmptyString;
645 
646  if( !msg.IsEmpty() )
647  {
648  // Do not use DisplayErrorMessage(); it screws up window order on Mac
649  DisplayError( nullptr, msg );
650  }
651 
652  grid->SetFocus();
653  grid->MakeCellVisible( row, col );
654 
655  // Selecting the first grid item only makes sense for the
656  // items grid
657  if( !m_initialFocus || grid == m_itemsGrid )
658  {
659  grid->SetGridCursor( row, col );
660  grid->EnableCellEditControl( true );
661  grid->ShowCellEditControl();
662 
663  if( grid == m_itemsGrid && row == 0 && col == 0 )
664  {
665  auto referenceEditor = grid->GetCellEditor( 0, 0 );
666 
667  if( auto textEntry = dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) )
668  KIUI::SelectReferenceNumber( textEntry );
669 
670  referenceEditor->DecRef();
671  }
672  }
673  m_initialFocus = false;
674  }
675 }
676 
677 
678 void DIALOG_FOOTPRINT_PROPERTIES::OnGridSize( wxSizeEvent& aEvent )
679 {
680  adjustGridColumns( aEvent.GetSize().GetX() );
681 
682  aEvent.Skip();
683 }
684 
685 
686 void DIALOG_FOOTPRINT_PROPERTIES::OnPageChange( wxNotebookEvent& aEvent )
687 {
688  int page = aEvent.GetSelection();
689 
690  // Shouldn't be necessary, but is on at least OSX
691  if( page >= 0 )
692  m_NoteBook->ChangeSelection( (unsigned) page );
693 
694 #ifdef __WXMAC__
695  // Work around an OSX bug where the wxGrid children don't get placed correctly until
696  // the first resize event
697  if( m_macHack[ page ] )
698  {
699  wxSize pageSize = m_NoteBook->GetPage( page )->GetSize();
700  pageSize.x -= 1;
701 
702  m_NoteBook->GetPage( page )->SetSize( pageSize );
703  m_macHack[ page ] = false;
704  }
705 #endif
706 }
707 
708 
710 {
712 }
void SetMirrored(bool isMirrored)
Definition: eda_text.h:188
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:271
bool IsLocked() const override
Definition: footprint.h:286
void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:182
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:182
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:361
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: footprint.h:226
void OnAddField(wxCommandEvent &) override
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:192
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:80
int GetPlacementCost180() const
Definition: footprint.h:539
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:179
void OnUpdateUI(wxUpdateUIEvent &) override
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:141
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:190
void DeleteStructure()
Delete this object after removing from its parent if it has one.
Definition: board_item.cpp:140
Class DIALOG_FOOTPRINT_PROPERTIES_BASE.
void FootprintOrientEvent(wxCommandEvent &) override
std::vector< FP_3DMODEL > & GetModelList()
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: footprint.h:224
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:466
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:237
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:820
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:236
PADS & Pads()
Definition: footprint.h:168
void SetPlacementCost180(int aCost)
Definition: footprint.h:540
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:466
bool GetTextUpright(PCB_LAYER_ID aLayer) const
FP_TEXT & Reference()
Definition: footprint.h:467
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:886
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:1428
void SetLocalClearance(int aClearance)
Definition: footprint.h:210
int GetLocalClearance() const
Definition: footprint.h:209
#define _(s)
DRAWINGS & GraphicalItems()
Definition: footprint.h:171
const LIB_ID & GetFPID() const
Definition: footprint.h:194
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:158
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:1403
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
EDA_UNITS m_units
Definition: dialog_shim.h:198
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:206
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:235
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
Definition: layer_ids.h:70
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:296
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:186
double GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:223
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:50
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.h:159
ZONE_CONNECTION GetZoneConnection() const
Definition: footprint.h:227
int GetPlacementCost90() const
Definition: footprint.h:542
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:220
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.
Definition: pad.h:57
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1499
bool allPadsLocked(FOOTPRINT *aFootprint)
void OnPageChange(wxNotebookEvent &event) override
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171
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:543
void EditFootprint(wxCommandEvent &) override
void SetLocalSolderMaskMargin(int aMargin)
Definition: footprint.h:207
void ChangeFootprint(wxCommandEvent &) override
void OnGridSize(wxSizeEvent &aEvent) override
Container for design settings for a BOARD object.
void SetLocalSolderPasteMargin(int aMargin)
Definition: footprint.h:221