KiCad PCB EDA Suite
dialog_edit_footprint_for_BoardEditor.cpp
Go to the documentation of this file.
1 
5 /*
6  * This program source code file is part of KiCad, a free EDA CAD application.
7  *
8  * Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
9  * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
10  * Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com
11  * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, you may find one here:
25  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
26  * or you may search the http://www.gnu.org website for the version 2 license,
27  * or you may write to the Free Software Foundation, Inc.,
28  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
29  */
30 
31 
32 #include <fctsys.h>
33 #include <kiface_i.h>
34 #include <gr_basic.h>
35 #include <class_drawpanel.h>
36 #include <confirm.h>
37 #include <pcbnew.h>
38 #include <pgm_base.h>
39 #include <gestfich.h>
40 #include <3d_viewer.h>
41 #include <pcb_edit_frame.h>
42 #include <base_units.h>
43 #include <project.h>
44 #include <board_commit.h>
45 #include <bitmaps.h>
46 #include <dialog_text_entry.h>
47 
48 #include <class_module.h>
49 #include <class_text_mod.h>
50 #include <validators.h>
51 #include <widgets/text_ctrl_eval.h>
52 
57 #include "3d_cache/3d_cache.h"
59 
61 
62 size_t DIALOG_FOOTPRINT_BOARD_EDITOR::m_page = 0; // remember the last open page during session
63 
64 
66  MODULE* aModule,
67  wxDC* aDC ) :
69  m_OrientValidator( 1, &m_OrientValue )
70 {
71  wxASSERT( aParent != NULL );
72  wxASSERT( aModule != NULL );
73 
74  m_Parent = aParent;
75  m_DC = aDC;
76  m_CurrentModule = aModule;
77 
78  m_currentModuleCopy = new MODULE( *aModule );
79 
80  // Give an icon
81  wxIcon icon;
82  icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) );
83  SetIcon( icon );
84 
85  m_OrientValidator.SetRange( -360.0, 360.0 );
86  m_OrientValueCtrl->SetValidator( m_OrientValidator );
88 
89  aParent->Prj().Get3DCacheManager()->GetResolver()->SetProgramBase( &Pgm() );
90 
92  aParent->Prj().Get3DCacheManager(),
94  &aParent->Settings().Colors(),
95  &m_shapes3D_list );
96 
97  bLowerSizer3D->Add( m_PreviewPane, 1, wxEXPAND, 5 );
98 
99  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
100  infoFont.SetSymbolicSize( wxFONTSIZE_X_SMALL );
101  m_staticTextInfoValNeg->SetFont( infoFont );
102  m_staticTextInfoValPos->SetFont( infoFont );
103  m_staticTextInfo2->SetFont( infoFont );
104 
105  m_NoteBook->SetSelection( m_page );
106  m_sdbSizerStdButtonsOK->SetDefault();
107 
108  m_ReferenceCopy = NULL;
109  m_ValueCopy = NULL;
111  m_OrientValue = 0;
112 
113  // Layout() gets called correctly in TransferDataToWindow().
114 }
115 
116 
117 
119 {
120  m_shapes3D_list.clear();
121 
122  // free the memory used by all models, otherwise models which were
123  // browsed but not used would consume memory
124  Prj().Get3DCacheManager()->FlushCache( false );
125 
126  // the GL canvas has to be visible before it is destroyed
127  m_page = m_NoteBook->GetSelection();
128  m_NoteBook->SetSelection( 1 );
129 
130  delete m_ReferenceCopy;
131  m_ReferenceCopy = NULL;
132 
133  delete m_ValueCopy;
134  m_ValueCopy = NULL;
135 
136  delete m_PreviewPane;
137  m_PreviewPane = NULL; // just in case, to avoid double-free
138 
139  // this is already deleted by the board used on preview pane so
140  // no need to delete here
141  // delete m_currentModuleCopy;
142  // m_currentModuleCopy = NULL;
143 }
144 
145 
146 // Creation of the panel properties of the module editor.
148 {
151 
154 
155  m_LayerCtrl->SetSelection(
156  (m_CurrentModule->GetLayer() == B_Cu) ? 1 : 0 );
157 
158  bool custom_orientation = false;
159  switch( int( m_CurrentModule->GetOrientation() ) )
160  {
161  case 0:
162  m_OrientCtrl->SetSelection( 0 );
163  break;
164 
165  case 900:
166  case -2700:
167  m_OrientCtrl->SetSelection( 1 );
168  break;
169 
170  case -900:
171  case 2700:
172  m_OrientCtrl->SetSelection( 2 );
173  break;
174 
175  case -1800:
176  case 1800:
177  m_OrientCtrl->SetSelection( 3 );
178  break;
179 
180  default:
181  m_OrientCtrl->SetSelection( 4 );
182  custom_orientation = true;
183  break;
184  }
185 
186  m_OrientValueCtrl->Enable( custom_orientation );
188  m_OrientValidator.TransferToWindow();
189 
190  // Initialize dialog relative to masks clearances
194 
197 
198  // These 2 parameters are usually < 0, so prepare entering a negative
199  // value, if current is 0
201 
203  m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
204  m_SolderPasteMarginCtrl->GetValue() );
205 
206  // Add solder paste margin ration in per cent
207  // for the usual default value 0.0, display -0.0 (or -0,0 in some countries)
208  wxString msg;
209  msg.Printf( wxT( "%f" ),
211 
213  msg[0] == '0') // Sometimes Printf adds a sign if the value is very small (0.0)
214  m_SolderPasteMarginRatioCtrl->SetValue( wxT("-") + msg );
215  else
217 
219  {
220  default:
222  m_ZoneConnectionChoice->SetSelection( 0 );
223  break;
224 
225  case PAD_ZONE_CONN_FULL:
226  m_ZoneConnectionChoice->SetSelection( 1 );
227  break;
228 
230  m_ZoneConnectionChoice->SetSelection( 2 );
231  break;
232 
233  case PAD_ZONE_CONN_NONE:
234  m_ZoneConnectionChoice->SetSelection( 3 );
235  break;
236  }
237 }
238 
239 
241 {
242  if( m_CurrentModule->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp
243  {
245  m_Parent->OnModify();
246  }
247 
248  EndModal( PRM_EDITOR_WANT_MODEDIT );
249 }
250 
251 
252 void DIALOG_FOOTPRINT_BOARD_EDITOR::UpdateModule( wxCommandEvent& event )
253 {
254  EndModal( PRM_EDITOR_WANT_UPDATE_FP );
255 }
256 
257 
259 {
260  EndModal( PRM_EDITOR_WANT_EXCHANGE_FP );
261 }
262 
263 
265 {
266  bool custom_orientation = false;
267 
268  switch( m_OrientCtrl->GetSelection() )
269  {
270  case 0:
271  m_OrientValue = 0.0;
272  break;
273 
274  case 1:
275  m_OrientValue = 90.0;
276  break;
277 
278  case 2:
279  m_OrientValue = 270.0;
280  break;
281 
282  case 3:
283  m_OrientValue = 180.0;
284  break;
285 
286  default:
287  custom_orientation = true;
288  break;
289  }
290 
291  m_OrientValidator.TransferToWindow();
292  m_OrientValueCtrl->Enable( custom_orientation );
293 }
294 
295 
297 {
298  wxString default_path;
299  wxGetEnv( KISYS3DMOD, &default_path );
300 #ifdef __WINDOWS__
301  default_path.Replace( wxT( "/" ), wxT( "\\" ) );
302 #endif
303 
305 
306  // Init 3D shape list
307  m_3D_ShapeNameListBox->Clear();
308  auto sM = m_CurrentModule->Models().begin();
309  auto eM = m_CurrentModule->Models().end();
310  m_shapes3D_list.clear();
311 
312  wxString origPath;
313  wxString alias;
314  wxString shortPath;
315  S3D_FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
316 
317  while( sM != eM )
318  {
319  m_shapes3D_list.push_back( *sM );
320  origPath = sM->m_Filename;
321 
322  if( res && res->SplitAlias( origPath, alias, shortPath ) )
323  {
324  origPath = alias;
325  origPath.append( ":" );
326  origPath.append( shortPath );
327  }
328 
329  m_3D_ShapeNameListBox->Append( origPath );
330  ++sM;
331 
332  }
333 
338  m_ReferenceCtrl->SetValue( m_ReferenceCopy->GetText() );
339  m_ValueCtrl->SetValue( m_ValueCopy->GetText() );
340 
341  // Shows the footprint's schematic path.
343 
344  m_AttributsCtrl->SetItemToolTip( 0,
345  _( "Use this attribute for most non SMD footprints\n"
346  "Footprints with this option are not put in the footprint position list file" ) );
347  m_AttributsCtrl->SetItemToolTip( 1,
348  _( "Use this attribute for SMD footprints.\n"
349  "Only footprints with this option are put in the footprint position list file" ) );
350  m_AttributsCtrl->SetItemToolTip( 2,
351  _( "Use this attribute for \"virtual\" footprints drawn on board\n"
352  "such as an edge connector (old ISA PC bus for instance)" ) );
353 
354  // Controls on right side of the dialog
355  switch( m_CurrentModule->GetAttributes() & 255 )
356  {
357  case 0:
358  m_AttributsCtrl->SetSelection( 0 );
359  break;
360 
361  case MOD_CMS:
362  m_AttributsCtrl->SetSelection( 1 );
363  break;
364 
365  case MOD_VIRTUAL:
366  m_AttributsCtrl->SetSelection( 2 );
367  break;
368 
369  default:
370  m_AttributsCtrl->SetSelection( 0 );
371  break;
372  }
373 
374  if( m_CurrentModule->IsLocked() )
375  m_AutoPlaceCtrl->SetSelection( 2 );
376  else if( m_CurrentModule->PadsLocked() )
377  m_AutoPlaceCtrl->SetSelection( 1 );
378  else
379  m_AutoPlaceCtrl->SetSelection( 0 );
380 
381  m_AutoPlaceCtrl->SetItemToolTip( 0,
382  _( "Component can be freely moved and auto placed. User "
383  "can arbitrarily select and edit component's pads." ) );
384  m_AutoPlaceCtrl->SetItemToolTip( 1,
385  _( "Component can be freely moved and auto placed, but its "
386  "pads cannot be selected or edited." ) );
387  m_AutoPlaceCtrl->SetItemToolTip( 2,
388  _( "Component is locked: it cannot be freely moved or auto "
389  "placed." ) );
390 
392 
394 
395  // if m_3D_ShapeNameListBox is not empty, preselect first 3D shape
396  if( m_3D_ShapeNameListBox->GetCount() > 0 )
397  {
400 
401  if( m_PreviewPane )
403  }
404  else
405  {
406  if( m_PreviewPane )
407  m_PreviewPane->ResetModelData( true );
408  }
409 
410  // We have modified the UI, so call Fit() for m_Panel3D
411  // to be sure the m_Panel3D sizers are initiliazed before opening the dialog
412  m_Panel3D->GetSizer()->Fit( m_Panel3D );
413 
414  // For some reason, on Linux, after the call to
415  // m_PreviewPane->SetModelDataIdx( m_LastSelected3DShapeIndex, true )
416  // the dialog has no longer the focus. Force it:
417  m_sdbSizerStdButtonsOK->SetFocus();
418 }
419 
420 
422 {
424 
425  if( m_LastSelected3DShapeIndex < 0 ) // happens under wxGTK when
426  // deleting an item in
427  // m_3D_ShapeNameListBox wxListBox
428  {
429  if( m_PreviewPane )
431 
432  return;
433  }
434 
435  if( m_LastSelected3DShapeIndex >= (int) m_shapes3D_list.size() )
436  {
437  wxMessageBox( wxT( "On3DShapeNameSelected() error" ) );
439 
440  if( m_PreviewPane )
442 
443  return;
444  }
445 
446  if( m_PreviewPane )
448 }
449 
450 
451 
452 void DIALOG_FOOTPRINT_BOARD_EDITOR::Remove3DShape( wxCommandEvent& event )
453 {
454  int ii = m_3D_ShapeNameListBox->GetSelection();
455 
456  if( ii < 0 )
457  {
458  if( m_PreviewPane )
459  m_PreviewPane->ResetModelData( true );
460 
461  return;
462  }
463 
464  m_shapes3D_list.erase( m_shapes3D_list.begin() + ii );
465  m_3D_ShapeNameListBox->Delete( ii );
466 
467  if( m_3D_ShapeNameListBox->GetCount() > 0 )
468  {
469  if( ii > 0 )
471  else
473 
475 
476  if( m_PreviewPane )
478  }
479  else
480  {
481  if( m_PreviewPane )
482  m_PreviewPane->ResetModelData( true );
483  }
484 
485  return;
486 }
487 
488 
490 {
491  int idx = m_3D_ShapeNameListBox->GetSelection();
492 
493  if( idx < 0 )
494  return;
495 
496  // Edit filename
497  wxString filename = m_3D_ShapeNameListBox->GetStringSelection();
498  WX_TEXT_ENTRY_DIALOG dlg( this, wxEmptyString, wxEmptyString, filename );
499 
500  bool hasAlias;
501  S3D_FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
502 
503  if( dlg.ShowModal() != wxID_OK )
504  return;
505 
506  filename = dlg.GetValue();
507 
508  if( filename.empty() )
509  return;
510 
511  if( !res->ValidateFileName( filename, hasAlias ) )
512  {
513  wxString msg = _( "Invalid filename: " );
514  msg.append( filename );
515  wxMessageBox( msg, _( "Edit 3D file name" ) );
516 
517  return;
518  }
519 
520  m_3D_ShapeNameListBox->SetString( idx, filename );
521 
522  // if the user has specified an alias in the name then prepend ':'
523  if( hasAlias )
524  filename.insert( 0, wxT( ":" ) );
525 
526  #ifdef __WINDOWS__
527  // In Kicad files, filenames and paths are stored using Unix notation
528  filename.Replace( wxT( "\\" ), wxT( "/" ) );
529  #endif
530 
531  m_shapes3D_list[idx].m_Filename = filename;
532 
533  // This assumes that the index didn't change and will just update the filename
534  if( m_PreviewPane )
535  m_PreviewPane->UpdateModelName( filename );
536 
537  return;
538 }
539 
540 
542 {
543  PROJECT& prj = Prj();
544  MODULE_3D_SETTINGS model;
545 
546  wxString initialpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
547  wxString sidx = prj.GetRString( PROJECT::VIEWER_3D_FILTER_INDEX );
548  int filter = 0;
549 
550  // If the PROJECT::VIEWER_3D_PATH hasn't been set yet, use the KISYS3DMOD environment
551  // varaible and fall back to the project path if necessary.
552  if( initialpath.IsEmpty() )
553  {
554  if( !wxGetEnv( "KISYS3DMOD", &initialpath ) || initialpath.IsEmpty() )
555  initialpath = prj.GetProjectPath();
556  }
557 
558  if( !sidx.empty() )
559  {
560  long tmp;
561  sidx.ToLong( &tmp );
562 
563  if( tmp > 0 && tmp <= INT_MAX )
564  filter = (int) tmp;
565  }
566 
567  if( !S3D::Select3DModel( this, Prj().Get3DCacheManager(),
568  initialpath, filter, &model ) || model.m_Filename.empty() )
569  {
570  return;
571  }
572 
573  prj.SetRString( PROJECT::VIEWER_3D_PATH, initialpath );
574  sidx = wxString::Format( wxT( "%i" ), filter );
576  S3D_FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
577  wxString alias;
578  wxString shortPath;
579  wxString filename = model.m_Filename;
580 
581  if( res && res->SplitAlias( filename, alias, shortPath ) )
582  {
583  alias.Append( wxT( ":" ) );
584  alias.Append( shortPath );
585  m_3D_ShapeNameListBox->Append( alias );
586  }
587  else
588  {
589  m_3D_ShapeNameListBox->Append( filename );
590  }
591 
592 #ifdef __WINDOWS__
593  // In Kicad files, filenames and paths are stored using Unix notation
594  model.m_Filename.Replace( "\\", "/" );
595 #endif
596 
597  m_shapes3D_list.push_back( model );
600 
601  if( m_PreviewPane )
603 
604  return;
605 }
606 
607 
609 {
610  if( !wxDialog::TransferDataToWindow() ||
611  !m_PanelProperties->TransferDataToWindow() )
612  {
613  wxMessageBox( _( "Error: invalid footprint parameter" ) );
614  return false;
615  }
616 
617  if( !m_Panel3D->TransferDataToWindow() )
618  {
619  wxMessageBox( _( "Error: invalid 3D parameter" ) );
620  return false;
621  }
622 
625  Layout();
626 
627  return true;
628 }
629 
630 
632 {
633  wxPoint modpos;
634  wxString msg;
635 
636  if( !Validate() || !DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::TransferDataFromWindow() ||
637  !m_PanelProperties->TransferDataFromWindow() )
638  {
639  wxMessageBox( _( "Error: invalid or missing footprint parameter" ) );
640  return false;
641  }
642 
643  if( !m_Panel3D->TransferDataFromWindow() )
644  {
645  wxMessageBox( _( "Error: invalid or missing 3D parameter" ) );
646  return false;
647  }
648 
649  // Check if footprint local clerance is acceptable (i.e. >= 0 )
650  int localNetClearance = ValueFromTextCtrl( *m_NetClearanceValueCtrl );
651 
652  if( localNetClearance < 0 )
653  {
654  wxMessageBox( _( "Error: footprint local net clearance is < 0" ) );
655  return false;
656  }
657 
658  if( m_DC )
659  {
662  }
663 
664  BOARD_COMMIT commit( m_Parent );
665  commit.Modify( m_CurrentModule );
666 
667  // Init Fields (should be first, because they can be moved or/and flipped later):
668  TEXTE_MODULE& reference = m_CurrentModule->Reference();
669  reference = *m_ReferenceCopy;
670  TEXTE_MODULE& value = m_CurrentModule->Value();
671  value = *m_ValueCopy;
672 
673  // Initialize masks clearances
674  m_CurrentModule->SetLocalClearance( localNetClearance );
677 
678  double dtmp = 0.0;
679  msg = m_SolderPasteMarginRatioCtrl->GetValue();
680  msg.ToDouble( &dtmp );
681 
682  // A -50% margin ratio means no paste on a pad, the ratio must be >= -50%
683  if( dtmp < -50.0 )
684  dtmp = -50.0;
685  // A margin ratio is always <= 0
686  // 0 means use full pad copper area
687  if( dtmp > 0.0 )
688  dtmp = 0.0;
689 
691 
692  switch( m_ZoneConnectionChoice->GetSelection() )
693  {
694  default:
695  case 0:
697  break;
698 
699  case 1:
701  break;
702 
703  case 2:
705  break;
706 
707  case 3:
709  break;
710  }
711 
712  // Set Module Position
713  modpos.x = ValueFromTextCtrl( *m_ModPositionX );
714  modpos.y = ValueFromTextCtrl( *m_ModPositionY );
715  m_CurrentModule->SetPosition( modpos );
716  m_CurrentModule->SetLocked( m_AutoPlaceCtrl->GetSelection() == 2 );
717  m_CurrentModule->SetPadsLocked( m_AutoPlaceCtrl->GetSelection() == 1 );
718 
719  switch( m_AttributsCtrl->GetSelection() )
720  {
721  case 0:
723  break;
724 
725  case 1:
727  break;
728 
729  case 2:
731  break;
732  }
733 
736 
737  /* Now, set orientation. must be made after others changes,
738  * because rotation changes fields positions on board according to the new orientation
739  * (relative positions are not modified)
740  */
741  int orient = KiROUND( m_OrientValue * 10.0 );
742 
743  if( m_CurrentModule->GetOrientation() != orient )
745  orient - m_CurrentModule->GetOrientation() );
746 
747  // Set component side, that also have effect on the fields positions on board
748  bool change_layer = false;
749  if( m_LayerCtrl->GetSelection() == 0 ) // layer req = COMPONENT
750  {
751  if( m_CurrentModule->GetLayer() == B_Cu )
752  change_layer = true;
753  }
754  else if( m_CurrentModule->GetLayer() == F_Cu )
755  change_layer = true;
756 
757  if( change_layer )
759 
760  // This will update the S3D_INFO list into the current module
761  msg.Clear();
762 
763  if( !m_PreviewPane->ValidateWithMessage( msg ) )
764  {
765  DisplayError( this, msg );
766  return false;
767  }
768 
769  std::list<MODULE_3D_SETTINGS>* draw3D = &m_CurrentModule->Models();
770  draw3D->clear();
771  draw3D->insert( draw3D->end(), m_shapes3D_list.begin(), m_shapes3D_list.end() );
772 
774 
775  // This is a simple edition, we must create an undo entry
776  if( m_CurrentModule->GetFlags() == 0 )
777  commit.Push( _( "Modify module properties" ) );
778 
779  SetReturnCode( PRM_EDITOR_EDIT_OK );
780 
781  if( m_DC )
782  {
785  }
786 
787  return true;
788 }
789 
790 
792 {
794 
797 
798  DIALOG_EDIT_FPTEXT dialog( this, m_Parent, m_ReferenceCopy, NULL );
799  dialog.ShowModal();
800 
802  m_ReferenceCtrl->SetValue( m_ReferenceCopy->GetText() );
803 }
804 
805 
806 void DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditValue( wxCommandEvent& event )
807 {
809 
812 
813  DIALOG_EDIT_FPTEXT dialog( this, m_Parent, m_ValueCopy, NULL );
814  dialog.ShowModal();
815 
817  m_ValueCtrl->SetValue( m_ValueCopy->GetText() );
818 }
819 
820 
821 void DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath( wxCommandEvent& event )
822 {
823  if( S3D::Configure3DPaths( this, Prj().Get3DCacheManager()->GetResolver() ) )
824  if( m_LastSelected3DShapeIndex >= 0 )
825  if( m_PreviewPane )
827 }
void ResetModelData(bool aReloadPreviewModule=false)
ResetModelData - Clear the values and reload the preview board.
void SetPlacementCost90(int aCost)
Definition: class_module.h:573
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
COMMIT & Modify(EDA_ITEM *aItem)
Modifies a given item in the model.
Definition: commit.h:103
TEXTE_MODULE & Reference()
Definition: class_module.h:502
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
Class PROJECT holds project specific data.
Definition: project.h:56
const wxPoint & GetTextPos() const
Definition: eda_text.h:222
void SetLocalClearance(int aClearance)
Definition: class_module.h:207
This file is part of the common library TODO brief description.
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:106
void SetPlacementCost180(int aCost)
Definition: class_module.h:570
Implementation of conversion functions that require both schematic and board internal units...
This file is part of the common library.
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:359
int GetLocalClearance() const
Definition: class_module.h:206
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw draws the footprint to the aDC.
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
void Cfg3DPath(wxCommandEvent &event) override
bool ValidateWithMessage(wxString &aErrorMessage)
verify X,Y and Z scale factors are acceptable (> 0.001 and < 1000.0)
Set for modules listed in the automatic insertion list (usually SMD footprints)
Definition: class_module.h:77
void OnEditValue(wxCommandEvent &event) override
void SetZoneConnection(ZoneConnection aType)
Definition: class_module.h:215
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
static size_t m_page
Module editor: Dialog for editing footprint properties in the pcb editor.
void ExchangeModule(wxCommandEvent &event) override
void ModuleOrientEvent(wxCommandEvent &event) override
ZoneConnection GetZoneConnection() const
Definition: class_module.h:216
int GetPlacementCost90() const
Definition: class_module.h:572
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_module.h:213
double GetLocalSolderPasteMarginRatio() const
Definition: class_module.h:212
void SetValue(const wxString &aValue) override
Set a new value in evaluator buffer, and display it in the wxTextCtrl.
Pads are not covered.
Definition: zones.h:57
bool Configure3DPaths(wxWindow *aParent, S3D_FILENAME_RESOLVER *aResolver)
bool ValidateFileName(const wxString &aFileName, bool &hasAlias)
Function ValidateName returns true if the given path is a valid aliased relative path.
bool SplitAlias(const wxString &aFileName, wxString &anAlias, wxString &aRelPath)
Function SplitAlias returns true if the given name contains an alias and populates the string anAlias...
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
bool PadsLocked() const
Definition: class_module.h:299
timestamp_t GetNewTimeStamp()
Definition: common.cpp:160
void SetModelDataIdx(int idx, bool aReloadPreviewModule=false)
SetModelDataIdx - This will set the index of the INFO list that was set on the parent.
Footprint text class description.
Defines a panel which is to be added to a wxFileDialog via SetExtraControl(); The panel shows a previ...
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:224
double GetOrientation() const
Definition: class_module.h:187
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:501
PCB_GENERAL_SETTINGS & Settings()
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:485
#define KISYS3DMOD
A variable name whose value holds the path of 3D shape files.
Definition: 3d_viewer.h:38
wxFloatingPointValidator< double > m_OrientValidator
The common library.
int GetAttributes() const
Definition: class_module.h:224
void SetPadsLocked(bool aPadsLocked)
Definition: class_module.h:301
void SetPosition(const wxPoint &aPos) override
int GetLocalSolderMaskMargin() const
Definition: class_module.h:203
int ValueFromTextCtrl(const wxTextCtrl &aTextCtr)
Convert the number Value in a string according to the internal units and the selected unit (g_UserUni...
Definition: base_units.cpp:386
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:265
bool IsLocked() const override
Function IsLocked.
Definition: class_module.h:263
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_module.h:204
COLORS_DESIGN_SETTINGS & Colors()
void Remove3DShape(wxCommandEvent &event) override
int GetLocalSolderPasteMargin() const
Definition: class_module.h:209
wxString m_Filename
The 3D shape filename in 3D library.
Definition: class_module.h:102
VTBL_ENTRY void SetRString(RSTRING_T aStringId, const wxString &aString)
Function SetRString stores a "retained string", which is any session and project specific string iden...
Definition: project.cpp:171
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
Definition: gr_basic.h:38
void PutValueInLocalUnits(wxTextCtrl &aTextCtr, int aValue)
Function PutValueInLocalUnits converts aValue from internal units to user units and append the units ...
Definition: base_units.cpp:267
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_module.h:210
VTBL_ENTRY const wxString & GetRString(RSTRING_T aStringId)
Function GetRString returns a "retained string", which is any session and project specific string ide...
Definition: project.cpp:186
wxString GetValue()
std::list< MODULE_3D_SETTINGS > & Models()
Definition: class_module.h:177
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:272
see class PGM_BASE
void SetLocked(bool isLocked) override
Function SetLocked sets the MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: class_module.h:273
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void GotoModuleEditor(wxCommandEvent &event) override
provides an extensible class to resolve 3D model paths.
void OnEditReference(wxCommandEvent &event) override
Virtual component: when created by copper shapes on board (Like edge card connectors, mounting hole...)
Definition: class_module.h:79
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
defines the display data cache manager for 3D models
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:102
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Executes the changes.
bool Select3DModel(wxWindow *aParent, S3D_CACHE *aCache, wxString &prevModelSelectDir, int &prevModelWildcard, MODULE_3D_SETTINGS *aModel)
Module description (excepted pads)
void UpdateModule(wxCommandEvent &event) override
const wxString & GetPath() const
Definition: class_module.h:200
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
DIALOG_FOOTPRINT_BOARD_EDITOR(PCB_EDIT_FRAME *aParent, MODULE *aModule, wxDC *aDC)
void On3DShapeNameSelected(wxCommandEvent &event) override
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
int GetPlacementCost180() const
Definition: class_module.h:569
const wxPoint GetPosition() const override
Definition: class_module.h:182
Use thermal relief for pads.
Definition: zones.h:58
Custom text control validator definitions.
Declaration of the eda_3d_viewer class.
timestamp_t GetTimeStamp() const
Definition: base_struct.h:215
void UpdateModelName(wxString const &aModel)
void SetAttributes(int aAttributes)
Definition: class_module.h:225
Class DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:214
pads are covered by copper
Definition: zones.h:59
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list