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 <[email protected]>
6  * Copyright (C) 2013 Wayne Stambaugh <[email protected]>
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  /*
340  * NB: the change is done from the last footprint because processFootprint() modifies the
341  * last item in the list.
342  */
343  for( auto it = m_parent->GetBoard()->Footprints().rbegin();
344  it != m_parent->GetBoard()->Footprints().rend(); it++ )
345  {
346  FOOTPRINT* footprint = *it;
347 
348  if( !isMatch( footprint ) )
349  continue;
350 
351  if( m_updateMode )
352  {
353  if( processFootprint( footprint, footprint->GetFPID() ) )
354  change = true;
355  }
356  else
357  {
358  if( processFootprint( footprint, newFPID ) )
359  change = true;
360  }
361  }
362 
363  return change;
364 }
365 
366 
368 {
369  LIB_ID oldFPID = aFootprint->GetFPID();
370  wxString msg;
371 
372  // Load new footprint.
373  if( m_updateMode )
374  {
375  msg.Printf( _( "Update footprint %s from '%s' to '%s'" ),
376  aFootprint->GetReference(),
377  oldFPID.Format().c_str(),
378  aNewFPID.Format().c_str() );
379  }
380  else
381  {
382  msg.Printf( _( "Change footprint %s from '%s' to '%s'" ),
383  aFootprint->GetReference(),
384  oldFPID.Format().c_str(),
385  aNewFPID.Format().c_str() );
386  }
387 
388  FOOTPRINT* newFootprint = m_parent->LoadFootprint( aNewFPID );
389 
390  if( !newFootprint )
391  {
392  msg << wxT( ": " ) << _( "*** footprint not found ***" );
394  return false;
395  }
396 
397  m_parent->ExchangeFootprint( aFootprint, newFootprint, m_commit,
398  m_removeExtraBox->GetValue(),
399  m_resetTextItemLayers->GetValue(),
400  m_resetTextItemEffects->GetValue(),
401  m_resetFabricationAttrs->GetValue(),
402  m_reset3DModels->GetValue() );
403 
404  if( aFootprint == m_currentFootprint )
405  m_currentFootprint = newFootprint;
406 
407  msg += wxT( ": OK" );
409 
410  return true;
411 }
412 
413 
414 void processTextItem( const FP_TEXT& aSrc, FP_TEXT& aDest,
415  bool resetText, bool resetTextLayers, bool resetTextEffects )
416 {
417  if( !resetText )
418  aDest.SetText( aSrc.GetText() );
419 
420  if( !resetTextLayers )
421  {
422  aDest.SetLayer( aSrc.GetLayer() );
423  aDest.SetVisible( aSrc.IsVisible() );
424  }
425 
426  if( !resetTextEffects )
427  {
428  // Careful: the visible bit is also in Effects
429  bool visible = aDest.IsVisible();
430  aDest.SetEffects( aSrc );
431  aDest.SetVisible( visible );
432  }
433 
434  aDest.SetLocked( aSrc.IsLocked() );
435 }
436 
437 
438 FP_TEXT* getMatchingTextItem( FP_TEXT* aRefItem, FOOTPRINT* aFootprint )
439 {
440  std::vector<FP_TEXT*> candidates;
441 
442  for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
443  {
444  FP_TEXT* candidate = dyn_cast<FP_TEXT*>( item );
445 
446  if( candidate && candidate->GetText() == aRefItem->GetText() )
447  candidates.push_back( candidate );
448  }
449 
450  if( candidates.size() == 0 )
451  return nullptr;
452 
453  if( candidates.size() == 1 )
454  return candidates[0];
455 
456  // Try refining the match by layer
457  std::vector<FP_TEXT*> candidatesOnSameLayer;
458 
459  for( FP_TEXT* candidate : candidates )
460  {
461  if( candidate->GetLayer() == aRefItem->GetLayer() )
462  candidatesOnSameLayer.push_back( candidate );
463  }
464 
465  if( candidatesOnSameLayer.size() == 1 )
466  return candidatesOnSameLayer[0];
467 
468  // Last ditch effort: refine by position
469  std::vector<FP_TEXT*> candidatesAtSamePos;
470 
471  for( FP_TEXT* candidate : candidatesOnSameLayer.size() ? candidatesOnSameLayer : candidates )
472  {
473  if( candidate->GetPos0() == aRefItem->GetPos0() )
474  candidatesAtSamePos.push_back( candidate );
475  }
476 
477  if( candidatesAtSamePos.size() > 0 )
478  return candidatesAtSamePos[0];
479  else if( candidatesOnSameLayer.size() > 0 )
480  return candidatesOnSameLayer[0];
481  else
482  return candidates[0];
483 }
484 
485 #include <wx/log.h>
487  BOARD_COMMIT& aCommit, bool deleteExtraTexts,
488  bool resetTextLayers, bool resetTextEffects,
489  bool resetFabricationAttrs, bool reset3DModels )
490 {
491  PCB_GROUP* parentGroup = aExisting->GetParentGroup();
492 
493  if( parentGroup )
494  {
495  parentGroup->RemoveItem( aExisting );
496  parentGroup->AddItem( aNew );
497  }
498 
499  aNew->SetParent( GetBoard() );
500 
501  PlaceFootprint( aNew, false );
502 
503  // PlaceFootprint will move the footprint to the cursor position, which we don't want. Copy
504  // the original position across.
505  aNew->SetPosition( aExisting->GetPosition() );
506 
507  if( aNew->GetLayer() != aExisting->GetLayer() )
508  aNew->Flip( aNew->GetPosition(), m_settings->m_FlipLeftRight );
509 
510  if( aNew->GetOrientation() != aExisting->GetOrientation() )
511  aNew->SetOrientation( aExisting->GetOrientation() );
512 
513  aNew->SetLocked( aExisting->IsLocked() );
514 
515  // Now transfer the net info from "old" pads to the new footprint
516  for( PAD* pad : aNew->Pads() )
517  {
518  PAD* pad_model = nullptr;
519 
520  // Pads with no copper are never connected to a net
521  if( !pad->IsOnCopperLayer() )
522  {
523  pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
524  continue;
525  }
526 
527  // Pads with no numbers are never connected to a net
528  if( pad->GetNumber().IsEmpty() )
529  {
530  pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
531  continue;
532  }
533 
534  // Search for a similar pad on a copper layer, to reuse net info
535  PAD* last_pad = nullptr;
536 
537  while( true )
538  {
539  pad_model = aExisting->FindPadByNumber( pad->GetNumber(), last_pad );
540 
541  if( !pad_model )
542  break;
543 
544  if( pad_model->IsOnCopperLayer() ) // a candidate is found
545  break;
546 
547  last_pad = pad_model;
548  }
549 
550  if( pad_model )
551  {
552  pad->SetLocalRatsnestVisible( pad_model->GetLocalRatsnestVisible() );
553  pad->SetPinFunction( pad_model->GetPinFunction() );
554  pad->SetPinType( pad_model->GetPinType() );
555  }
556 
557  pad->SetNetCode( pad_model ? pad_model->GetNetCode() : NETINFO_LIST::UNCONNECTED );
558  }
559 
560  // Copy reference
561  processTextItem( aExisting->Reference(), aNew->Reference(),
562  // never reset reference text
563  false,
564  resetTextLayers, resetTextEffects );
565 
566  // Copy value
567  processTextItem( aExisting->Value(), aNew->Value(),
568  // reset value text only when it is a proxy for the footprint ID
569  // (cf replacing value "MountingHole-2.5mm" with "MountingHole-4.0mm")
570  aExisting->GetValue() == aExisting->GetFPID().GetLibItemName(),
571  resetTextLayers, resetTextEffects );
572 
573  // Copy fields in accordance with the reset* flags
574  for( BOARD_ITEM* item : aExisting->GraphicalItems() )
575  {
576  FP_TEXT* srcItem = dyn_cast<FP_TEXT*>( item );
577 
578  if( srcItem )
579  {
580  FP_TEXT* destItem = getMatchingTextItem( srcItem, aNew );
581 
582  if( destItem )
583  processTextItem( *srcItem, *destItem, false, resetTextLayers, resetTextEffects );
584  else if( !deleteExtraTexts )
585  aNew->Add( new FP_TEXT( *srcItem ) );
586  }
587  }
588 
589  if( !resetFabricationAttrs )
590  aNew->SetAttributes( aExisting->GetAttributes() );
591 
592  // Copy 3D model settings in accordance with the reset* flag
593  if( !reset3DModels )
594  aNew->Models() = aExisting->Models(); // Linked list of 3D models.
595 
596  // Updating other parameters
597  const_cast<KIID&>( aNew->m_Uuid ) = aExisting->m_Uuid;
598  aNew->SetProperties( aExisting->GetProperties() );
599  aNew->SetPath( aExisting->GetPath() );
600 
601  aCommit.Remove( aExisting );
602  aCommit.Add( aNew );
603 
604  aNew->ClearFlags();
605 }
606 
607 
609 {
610  wxString newname = m_newID->GetValue();
611 
613 
614  if( frame->ShowModal( &newname, this ) )
615  {
616  if( event.GetEventObject() == m_newIDBrowseButton )
617  m_newID->SetValue( newname );
618  else
619  m_specifiedID->SetValue( newname );
620  }
621 
622  frame->Destroy();
623 }
624 
625 
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:60
bool IsLocked() const override
Definition: footprint.h:297
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:39
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:183
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:488
bool IsSelected() const
Definition: eda_item.h:122
const KIID_PATH & GetPath() const
Definition: footprint.h:207
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:164
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:208
std::string m_hash_key
Definition: dialog_shim.h:201
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:191
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:393
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
Definition: board_item.h:218
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:64
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:115
void SetAttributes(int aAttributes)
Definition: footprint.h:240
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:169
This file contains miscellaneous commonly used macros and functions.
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:502
const char * c_str() const
Definition: utf8.h:102
int g_matchModeForUpdateSelected
FP_TEXT & Reference()
Definition: footprint.h:503
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:206
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:124
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:207
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
void SetOrientation(double aNewAngle)
Definition: footprint.cpp:1681
FOOTPRINTS & Footprints()
Definition: board.h:234
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:1491
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:1075
const wxString & GetPinType() const
Definition: pad.h:146
const wxString & GetReference() const
Definition: footprint.h:466
#define _(s)
bool g_reset3DModels[2]
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:153
DRAWINGS & GraphicalItems()
Definition: footprint.h:172
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:51
bool g_removeExtraTextItems[2]
#define ID_MATCH_FP_SELECTED
const LIB_ID & GetFPID() const
Definition: footprint.h:195
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:474
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:239
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:307
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:187
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:509
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:510
Definition: pad.h:57
void SetFileName(const wxString &aReportFileName)
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1562
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:143
const wxString & GetPinFunction() const
Definition: pad.h:140
static const int UNCONNECTED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition: netinfo.h:372
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:154
void OnOKClicked(wxCommandEvent &event) override
int g_matchModeForUpdate