KiCad PCB EDA Suite
dialog_exchange_footprints.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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
7  * Copyright (C) 1992-2018 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 
27 #include <bitmaps.h>
28 #include <board_commit.h>
29 #include <board.h>
30 #include <footprint.h>
31 #include <pad.h>
33 #include <string_utils.h>
34 #include <kiway.h>
35 #include <macros.h>
36 #include <pcb_edit_frame.h>
37 #include <pcb_group.h>
38 #include <pcbnew_settings.h>
39 #include <project.h>
40 #include <wx_html_report_panel.h>
41 
42 
43 #define ID_MATCH_FP_ALL 4200
44 #define ID_MATCH_FP_SELECTED 4201
45 #define ID_MATCH_FP_REF 4202
46 #define ID_MATCH_FP_VAL 4203
47 #define ID_MATCH_FP_ID 4204
48 
49 
54 
55  // { update, change }
56 bool g_removeExtraTextItems[2] = { false, false };
57 bool g_resetTextItemLayers[2] = { false, true };
58 bool g_resetTextItemEffects[2] = { false, true };
59 bool g_resetFabricationAttrs[2] = { false, true };
60 bool g_reset3DModels[2] = { true, true };
61 
62 
64  FOOTPRINT* aFootprint,
65  bool updateMode, bool selectedMode ) :
67  m_commit( aParent ),
68  m_parent( aParent ),
69  m_currentFootprint( aFootprint ),
70  m_updateMode( updateMode )
71 {
72  if( !updateMode )
73  {
74  SetTitle( _( "Change Footprints" ) );
75  m_matchAll->SetLabel( _( "Change all footprints on board" ) );
76  m_matchSelected->SetLabel( _( "Change selected footprint(s)" ) );
77  m_matchSpecifiedRef->SetLabel( _( "Change footprints matching reference designator:" ) );
78  m_matchSpecifiedValue->SetLabel( _( "Change footprints matching value:" ) );
79  m_matchSpecifiedID->SetLabel( _( "Change footprints with library id:" ) );
80  m_resetTextItemLayers->SetLabel( _( "Update text layers and visibilities" ) );
81  m_resetTextItemEffects->SetLabel( _( "Update text sizes, styles and positions" ) );
82  m_resetFabricationAttrs->SetLabel( _( "Update fabrication attributes" ) );
83  m_reset3DModels->SetLabel( _( "Update 3D models" ) );
84  }
85 
86 #if 0 // translator hint
87  wxString x = _( "Update/reset strings: there are two cases these descriptions need to cover: "
88  "the user made overrides to a footprint on the PCB and wants to remove them, "
89  "or the user made changes to the library footprint and wants to propagate "
90  "them back to the PCB." );
91 #endif
92 
93  if( m_updateMode )
94  {
95  m_changeSizer->Show( false );
96  }
97  else
98  {
99  m_upperSizer->FindItem( m_matchAll )->Show( false );
101  }
102 
103  if( m_currentFootprint )
104  {
105  m_newID->AppendText( FROM_UTF8( m_currentFootprint->GetFPID().Format().c_str() ) );
106  }
107  else
108  m_upperSizer->FindItem( m_matchSelected )->Show( false );
109 
110  // Use ChangeValue() instead of SetValue() so we don't generate events.
111  if( m_currentFootprint )
113 
114  if( m_currentFootprint )
115  m_specifiedValue->ChangeValue( m_currentFootprint->GetValue() );
116 
117  if( m_currentFootprint )
118  m_specifiedID->ChangeValue( FROM_UTF8( m_currentFootprint->GetFPID().Format().c_str() ) );
119 
121 
122  m_upperSizer->SetEmptyCellSize( wxSize( 0, 0 ) );
123  // The upper sizer has its content modified: re-layout it:
124  m_upperSizer->Layout();
125 
126  // initialize match-mode
127  if( m_updateMode )
129  else
131 
132  wxCommandEvent event;
133  event.SetEventObject( this );
134 
135  switch( *m_matchMode )
136  {
137  case ID_MATCH_FP_ALL: OnMatchAllClicked( event ); break;
138  case ID_MATCH_FP_SELECTED: OnMatchSelectedClicked( event ); break;
139  case ID_MATCH_FP_REF: OnMatchRefClicked( event ); break;
140  case ID_MATCH_FP_VAL: OnMatchValueClicked( event ); break;
141  case ID_MATCH_FP_ID: OnMatchIDClicked( event ); break;
142  default: break;
143  }
144 
145  m_removeExtraBox->SetValue( g_removeExtraTextItems[ m_updateMode ? 0 : 1 ] );
149  m_reset3DModels->SetValue( g_reset3DModels[ m_updateMode ? 0 : 1 ] );
150 
152  m_MessageWindow->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
153 
154  // DIALOG_SHIM needs a unique hash_key because classname is not sufficient
155  // because the update and change versions of this dialog have different controls.
156  m_hash_key = TO_UTF8( GetTitle() );
157 
158  // Ensure m_closeButton (with id = wxID_CANCEL) has the right label
159  // (to fix automatic renaming of button label )
160  m_sdbSizerCancel->SetLabel( _( "Close" ) );
161 
162  if( m_updateMode )
163  m_sdbSizerOK->SetLabel( _( "Update" ) );
164  else
165  m_sdbSizerOK->SetLabel( _( "Change" ) );
166 
167  m_sdbSizerOK->SetDefault();
168 
169  // Now all widgets have the size fixed, call FinishDialogSettings
171 }
172 
173 
175 {
176  g_removeExtraTextItems[ m_updateMode ? 0 : 1 ] = m_removeExtraBox->GetValue();
180  g_reset3DModels[ m_updateMode ? 0 : 1 ] = m_reset3DModels->GetValue();
181 }
182 
183 
185 {
186  LIB_ID specifiedID;
187 
188  switch( *m_matchMode )
189  {
190  case ID_MATCH_FP_ALL:
191  return true;
193  return aFootprint == m_currentFootprint || aFootprint->IsSelected();
194  case ID_MATCH_FP_REF:
195  return WildCompareString( m_specifiedRef->GetValue(), aFootprint->GetReference(), false );
196  case ID_MATCH_FP_VAL:
197  return WildCompareString( m_specifiedValue->GetValue(), aFootprint->GetValue(), false );
198  case ID_MATCH_FP_ID:
199  specifiedID.Parse( m_specifiedID->GetValue() );
200  return aFootprint->GetFPID() == specifiedID;
201  default:
202  return false; // just to quiet compiler warnings....
203  }
204 }
205 
206 
208 {
209  switch( *m_matchMode )
210  {
211  case ID_MATCH_FP_ALL: return m_matchAll;
215  case ID_MATCH_FP_ID: return m_matchSpecifiedID;
216  default: return nullptr;
217  }
218 }
219 
220 
222 {
223  wxRadioButton* rb_button = getRadioButtonForMode();
224 
225  wxRadioButton* rb_butt_list[] =
226  {
227  m_matchAll,
232  nullptr // end of list
233  };
234 
235  // Ensure the button state is ok. Only one button can be checked
236  // Change button state only if its state is incorrect, otherwise
237  // we have issues depending on the platform.
238  for( int ii = 0; rb_butt_list[ii]; ++ii )
239  {
240  bool state = rb_butt_list[ii] == rb_button;
241 
242  if( rb_butt_list[ii]->GetValue() != state )
243  rb_butt_list[ii]->SetValue( state );
244  }
245 }
246 
247 
249 {
251 
252  if( event.GetEventObject() == this )
254  else
255  m_matchAll->SetFocus();
256 }
257 
258 
260 {
262 
263  if( event.GetEventObject() == this )
265  else
266  m_matchSelected->SetFocus();
267 }
268 
269 
271 {
273 
274  if( event.GetEventObject() == this )
276  else if( event.GetEventObject() != m_specifiedRef )
277  m_specifiedRef->SetFocus();
278 }
279 
280 
282 {
284 
285  if( event.GetEventObject() == this )
287  else if( event.GetEventObject() != m_specifiedValue )
288  m_specifiedValue->SetFocus();
289 }
290 
291 
292 void DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked( wxCommandEvent& event )
293 {
295 
296  if( event.GetEventObject() == this )
298  else if( event.GetEventObject() != m_specifiedID )
299  m_specifiedID->SetFocus();
300 }
301 
302 
303 void DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked( wxCommandEvent& event )
304 {
305  wxBusyCursor dummy;
306 
308  m_MessageWindow->Flush( false );
309 
311  {
312  m_parent->Compile_Ratsnest( true );
313  m_parent->GetCanvas()->Refresh();
314  }
315 
316  m_MessageWindow->Flush( false );
317 
318  m_commit.Push( wxT( "Changed footprint" ) );
319 }
320 
321 
323 {
324  bool change = false;
325  LIB_ID newFPID;
326  wxString value;
327 
328  if( m_parent->GetBoard()->Footprints().empty() )
329  return false;
330 
331  if( !m_updateMode )
332  {
333  newFPID.Parse( m_newID->GetValue() );
334 
335  if( !newFPID.IsValid() )
336  return false;
337  }
338 
339  /* The change is done from the last footprint because processFootprint() modifies the last
340  * item in the list.
341  */
342  for( auto it = m_parent->GetBoard()->Footprints().rbegin();
343  it != m_parent->GetBoard()->Footprints().rend(); it++ )
344  {
345  auto mod = *it;
346 
347  if( !isMatch( mod ) )
348  continue;
349 
350  if( m_updateMode )
351  {
352  if( processFootprint( mod, mod->GetFPID() ) )
353  change = true;
354  }
355  else
356  {
357  if( processFootprint( mod, newFPID ) )
358  change = true;
359  }
360  }
361 
362  return change;
363 }
364 
365 
367 {
368  LIB_ID oldFPID = aFootprint->GetFPID();
369  wxString msg;
370 
371  // Load new footprint.
372  if( m_updateMode )
373  {
374  msg.Printf( _( "Update footprint %s from '%s' to '%s'" ),
375  aFootprint->GetReference(),
376  oldFPID.Format().c_str(),
377  aNewFPID.Format().c_str() );
378  }
379  else
380  {
381  msg.Printf( _( "Change footprint %s from '%s' to '%s'" ),
382  aFootprint->GetReference(),
383  oldFPID.Format().c_str(),
384  aNewFPID.Format().c_str() );
385  }
386 
387  FOOTPRINT* newFootprint = m_parent->LoadFootprint( aNewFPID );
388 
389  if( !newFootprint )
390  {
391  msg << ": " << _( "*** footprint not found ***" );
393  return false;
394  }
395 
396  m_parent->ExchangeFootprint( aFootprint, newFootprint, m_commit,
397  m_removeExtraBox->GetValue(),
398  m_resetTextItemLayers->GetValue(),
399  m_resetTextItemEffects->GetValue(),
400  m_resetFabricationAttrs->GetValue(),
401  m_reset3DModels->GetValue() );
402 
403  if( aFootprint == m_currentFootprint )
404  m_currentFootprint = newFootprint;
405 
406  msg += ": OK";
408 
409  return true;
410 }
411 
412 
413 void processTextItem( const FP_TEXT& aSrc, FP_TEXT& aDest,
414  bool resetText, bool resetTextLayers, bool resetTextEffects )
415 {
416  if( !resetText )
417  aDest.SetText( aSrc.GetText() );
418 
419  if( !resetTextLayers )
420  {
421  aDest.SetLayer( aSrc.GetLayer() );
422  aDest.SetVisible( aSrc.IsVisible() );
423  }
424 
425  if( !resetTextEffects )
426  {
427  // Careful: the visible bit is also in Effects
428  bool visible = aDest.IsVisible();
429  aDest.SetEffects( aSrc );
430  aDest.SetVisible( visible );
431  }
432 
433  aDest.SetLocked( aSrc.IsLocked() );
434 }
435 
436 
437 FP_TEXT* getMatchingTextItem( FP_TEXT* aRefItem, FOOTPRINT* aFootprint )
438 {
439  std::vector<FP_TEXT*> candidates;
440 
441  for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
442  {
443  FP_TEXT* candidate = dyn_cast<FP_TEXT*>( item );
444 
445  if( candidate && candidate->GetText() == aRefItem->GetText() )
446  candidates.push_back( candidate );
447  }
448 
449  if( candidates.size() == 0 )
450  return nullptr;
451 
452  if( candidates.size() == 1 )
453  return candidates[0];
454 
455  // Try refining the match by layer
456  std::vector<FP_TEXT*> candidatesOnSameLayer;
457 
458  for( FP_TEXT* candidate : candidates )
459  {
460  if( candidate->GetLayer() == aRefItem->GetLayer() )
461  candidatesOnSameLayer.push_back( candidate );
462  }
463 
464  if( candidatesOnSameLayer.size() == 1 )
465  return candidatesOnSameLayer[0];
466 
467  // Last ditch effort: refine by position
468  std::vector<FP_TEXT*> candidatesAtSamePos;
469 
470  for( FP_TEXT* candidate : candidatesOnSameLayer.size() ? candidatesOnSameLayer : candidates )
471  {
472  if( candidate->GetPos0() == aRefItem->GetPos0() )
473  candidatesAtSamePos.push_back( candidate );
474  }
475 
476  if( candidatesAtSamePos.size() > 0 )
477  return candidatesAtSamePos[0];
478  else if( candidatesOnSameLayer.size() > 0 )
479  return candidatesOnSameLayer[0];
480  else
481  return candidates[0];
482 }
483 
484 #include <wx/log.h>
486  BOARD_COMMIT& aCommit, bool deleteExtraTexts,
487  bool resetTextLayers, bool resetTextEffects,
488  bool resetFabricationAttrs, bool reset3DModels )
489 {
490  PCB_GROUP* parentGroup = aExisting->GetParentGroup();
491 
492  if( parentGroup )
493  {
494  parentGroup->RemoveItem( aExisting );
495  parentGroup->AddItem( aNew );
496  }
497 
498  aNew->SetParent( GetBoard() );
499 
500  PlaceFootprint( aNew, false );
501 
502  // PlaceFootprint will move the footprint to the cursor position, which we don't want. Copy
503  // the original position across.
504  aNew->SetPosition( aExisting->GetPosition() );
505 
506  if( aNew->GetLayer() != aExisting->GetLayer() )
507  aNew->Flip( aNew->GetPosition(), m_settings->m_FlipLeftRight );
508 
509  if( aNew->GetOrientation() != aExisting->GetOrientation() )
510  aNew->SetOrientation( aExisting->GetOrientation() );
511 
512  aNew->SetLocked( aExisting->IsLocked() );
513 
514  // Now transfer the net info from "old" pads to the new footprint
515  for( PAD* pad : aNew->Pads() )
516  {
517  PAD* pad_model = nullptr;
518 
519  // Skip pad not on a copper layer, because we only want to transfer the net info
520  if( !pad->IsOnCopperLayer() )
521  continue;
522 
523  // Pads with no numbers are never connected to a net
524  if( pad->GetNumber().IsEmpty() )
525  continue;
526 
527  // Search for a similar pad on a copper layer, to reuse net info
528  PAD* last_pad = nullptr;
529 
530  while( true )
531  {
532  pad_model = aExisting->FindPadByNumber( pad->GetNumber(), last_pad );
533 
534  if( !pad_model )
535  break;
536 
537  if( pad_model->IsOnCopperLayer() ) // a candidate is found
538  break;
539 
540  last_pad = pad_model;
541  }
542 
543  if( pad_model )
544  {
545  pad->SetLocalRatsnestVisible( pad_model->GetLocalRatsnestVisible() );
546  pad->SetPinFunction( pad_model->GetPinFunction() );
547  }
548 
549  pad->SetNetCode( pad_model ? pad_model->GetNetCode() : NETINFO_LIST::UNCONNECTED );
550  }
551 
552  // Copy reference
553  processTextItem( aExisting->Reference(), aNew->Reference(),
554  // never reset reference text
555  false,
556  resetTextLayers, resetTextEffects );
557 
558  // Copy value
559  processTextItem( aExisting->Value(), aNew->Value(),
560  // reset value text only when it is a proxy for the footprint ID
561  // (cf replacing value "MountingHole-2.5mm" with "MountingHole-4.0mm")
562  aExisting->GetValue() == aExisting->GetFPID().GetLibItemName(),
563  resetTextLayers, resetTextEffects );
564 
565  // Copy fields in accordance with the reset* flags
566  for( BOARD_ITEM* item : aExisting->GraphicalItems() )
567  {
568  FP_TEXT* srcItem = dyn_cast<FP_TEXT*>( item );
569 
570  if( srcItem )
571  {
572  FP_TEXT* destItem = getMatchingTextItem( srcItem, aNew );
573 
574  if( destItem )
575  processTextItem( *srcItem, *destItem, false, resetTextLayers, resetTextEffects );
576  else if( !deleteExtraTexts )
577  aNew->Add( new FP_TEXT( *srcItem ) );
578  }
579  }
580 
581  if( !resetFabricationAttrs )
582  aNew->SetAttributes( aExisting->GetAttributes() );
583 
584  // Copy 3D model settings in accordance with the reset* flag
585  if( !reset3DModels )
586  aNew->Models() = aExisting->Models(); // Linked list of 3D models.
587 
588  // Updating other parameters
589  const_cast<KIID&>( aNew->m_Uuid ) = aExisting->m_Uuid;
590  aNew->SetProperties( aExisting->GetProperties() );
591  aNew->SetPath( aExisting->GetPath() );
592 
593  aCommit.Remove( aExisting );
594  aCommit.Add( aNew );
595 
596  aNew->ClearFlags();
597 }
598 
599 
601 {
602  wxString newname = m_newID->GetValue();
603 
605 
606  if( frame->ShowModal( &newname, this ) )
607  {
608  if( event.GetEventObject() == m_newIDBrowseButton )
609  m_newID->SetValue( newname );
610  else
611  m_specifiedID->SetValue( newname );
612  }
613 
614  frame->Destroy();
615 }
616 
617 
virtual bool ShowModal(wxString *aResult=nullptr, wxWindow *aResultantFocusWindow=nullptr)
Show this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until t...
DIALOG_EXCHANGE_FOOTPRINTS(PCB_EDIT_FRAME *aParent, FOOTPRINT *aFootprint, bool updateMode, bool selectedMode)
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:91
bool IsLocked() const override
Definition: footprint.h:286
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:38
void SetLazyUpdate(bool aLazyUpdate)
Forces updating the HTML page, after the report is built in lazy mode If aSort = true,...
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:64
const UTF8 & GetLibItemName() const
Definition: lib_id.h:104
void OnMatchIDClicked(wxCommandEvent &event) override
bool processFootprint(FOOTPRINT *aFootprint, const LIB_ID &aNewFPID)
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
std::list< FP_3DMODEL > & Models()
Definition: footprint.h:182
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
const wxString & GetValue() const
Definition: footprint.h:452
bool IsSelected() const
Definition: eda_item.h:123
const KIID_PATH & GetPath() const
Definition: footprint.h:203
void Compile_Ratsnest(bool aDisplayStatus)
Create the entire board ratsnest.
Definition: ratsnest.cpp:40
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:192
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:204
std::string m_hash_key
Definition: dialog_shim.h:199
COMMIT & Add(EDA_ITEM *aItem)
Notify observers that aItem has been added.
Definition: commit.h:78
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void Flush(bool aSort=false)
Set the visible severity filter.
double GetOrientation() const
Definition: footprint.h:190
bool GetLocalRatsnestVisible() const
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:382
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
Definition: board_item.h:252
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:159
virtual bool IsLocked() const
Definition: board_item.cpp:78
PCBNEW_SETTINGS * m_settings
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:97
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:116
void SetAttributes(int aAttributes)
Definition: footprint.h:236
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true)
Places aFootprint at the current cursor position and updates footprint coordinates with the new posit...
PADS & Pads()
Definition: footprint.h:168
This file contains miscellaneous commonly used macros and functions.
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:466
const char * c_str() const
Definition: utf8.h:102
int g_matchModeForUpdateSelected
FP_TEXT & Reference()
Definition: footprint.h:467
void OnMatchAllClicked(wxCommandEvent &event) override
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
bool g_resetTextItemEffects[2]
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
virtual void SetVisible(bool aVisible)
Definition: eda_text.h:185
void ExchangeFootprint(FOOTPRINT *aExisting, FOOTPRINT *aNew, BOARD_COMMIT &aCommit, bool deleteExtraTexts=true, bool resetTextLayers=true, bool resetTextEffects=true, bool resetFabricationAttrs=true, bool reset3DModels=true)
Replace aExisting footprint by aNew footprint using the Existing footprint settings (position,...
#define ID_MATCH_FP_ID
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:114
Class DIALOG_EXCHANGE_FOOTPRINTS_BASE.
#define ID_MATCH_FP_ALL
FP_TEXT * getMatchingTextItem(FP_TEXT *aRefItem, FOOTPRINT *aFootprint)
virtual bool IsVisible() const
Definition: eda_text.h:186
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
void SetOrientation(double aNewAngle)
Definition: footprint.cpp:1618
FOOTPRINTS & Footprints()
Definition: board.h:233
bool g_resetFabricationAttrs[2]
void OnMatchSelectedClicked(wxCommandEvent &event) override
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1428
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:1012
const wxString & GetReference() const
Definition: footprint.h:430
#define _(s)
bool g_reset3DModels[2]
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:154
DRAWINGS & GraphicalItems()
Definition: footprint.h:171
FOOTPRINT * LoadFootprint(const LIB_ID &aFootprintId)
Attempt to load aFootprintId from the footprint library table.
bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
Definition: pcb_group.cpp:50
bool g_removeExtraTextItems[2]
#define ID_MATCH_FP_SELECTED
const LIB_ID & GetFPID() const
Definition: footprint.h:194
COMMIT & Remove(EDA_ITEM *aItem)
Notify observers that aItem has been removed.
Definition: commit.h:90
bool IsOnCopperLayer() const override
Definition: pad.h:218
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
#define ID_MATCH_FP_REF
int g_matchModeForExchangeSelected
UTF8 Format() const
Definition: lib_id.cpp:116
void Report(const wxString &aText, SEVERITY aSeverity, REPORTER::LOCATION aLocation=REPORTER::LOC_BODY)
Reports the string.
void SetEffects(const FP_TEXT &aSrc)
Set the text effects from another instance.
Definition: fp_text.h:146
void processTextItem(const FP_TEXT &aSrc, FP_TEXT &aDest, bool resetText, bool resetTextLayers, bool resetTextEffects)
const KIID m_Uuid
Definition: eda_item.h:475
void updateMatchModeRadioButtons(wxUpdateUIEvent &event) override
const wxPoint & GetPos0() const
Definition: fp_text.h:166
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:49
bool g_resetTextItemLayers[2]
int GetAttributes() const
Definition: footprint.h:235
void Clear()
return the number of messages matching the given severity mask.
void OnMatchRefClicked(wxCommandEvent &event) override
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
#define ID_MATCH_FP_VAL
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:296
The main frame for Pcbnew.
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.
wxPoint GetPosition() const override
Definition: footprint.h:186
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void ViewAndSelectFootprint(wxCommandEvent &event) override
const std::map< wxString, wxString > & GetProperties() const
Definition: footprint.h:473
bool WildCompareString(const wxString &pattern, const wxString &string_to_tst, bool case_sensitive)
Compare a string against wild card (* and ?) pattern using the usual rules.
BOARD * GetBoard() const
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Removes an item from the container.
Definition: footprint.cpp:513
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: footprint.h:474
Definition: pad.h:57
void SetFileName(const wxString &aReportFileName)
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1499
int g_matchModeForExchange
void OnMatchValueClicked(wxCommandEvent &event) override
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171
static const int UNCONNECTED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition: netinfo.h:365
const wxString & GetPinFunction() const
Definition: pad.h:140
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
void OnOKClicked(wxCommandEvent &event) override
int g_matchModeForUpdate