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>
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 }
56bool g_removeExtraTextItems[2] = { false, false };
57bool g_resetTextItemLayers[2] = { false, true };
58bool g_resetTextItemEffects[2] = { false, true };
59bool g_resetFabricationAttrs[2] = { false, true };
60bool 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
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.
113
116
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
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 wxString okLabel = m_updateMode ? _( "Update" ) : _( "Change" );
159
160 SetupStandardButtons( { { wxID_OK, okLabel },
161 { wxID_CANCEL, _( "Close" ) } } );
162
163 // Now all widgets have the size fixed, call FinishDialogSettings
165}
166
167
169{
174 g_reset3DModels[ m_updateMode ? 0 : 1 ] = m_reset3DModels->GetValue();
175}
176
177
179{
180 LIB_ID specifiedID;
181
182 switch( *m_matchMode )
183 {
184 case ID_MATCH_FP_ALL:
185 return true;
187 return aFootprint == m_currentFootprint || aFootprint->IsSelected();
188 case ID_MATCH_FP_REF:
189 return WildCompareString( m_specifiedRef->GetValue(), aFootprint->GetReference(), false );
190 case ID_MATCH_FP_VAL:
191 return WildCompareString( m_specifiedValue->GetValue(), aFootprint->GetValue(), false );
192 case ID_MATCH_FP_ID:
193 specifiedID.Parse( m_specifiedID->GetValue() );
194 return aFootprint->GetFPID() == specifiedID;
195 default:
196 return false; // just to quiet compiler warnings....
197 }
198}
199
200
202{
203 switch( *m_matchMode )
204 {
205 case ID_MATCH_FP_ALL: return m_matchAll;
210 default: return nullptr;
211 }
212}
213
214
216{
217 wxRadioButton* rb_button = getRadioButtonForMode();
218
219 wxRadioButton* rb_butt_list[] =
220 {
226 nullptr // end of list
227 };
228
229 // Ensure the button state is ok. Only one button can be checked
230 // Change button state only if its state is incorrect, otherwise
231 // we have issues depending on the platform.
232 for( int ii = 0; rb_butt_list[ii]; ++ii )
233 {
234 bool state = rb_butt_list[ii] == rb_button;
235
236 if( rb_butt_list[ii]->GetValue() != state )
237 rb_butt_list[ii]->SetValue( state );
238 }
239}
240
241
243{
245
246 if( event.GetEventObject() == this )
248 else
249 m_matchAll->SetFocus();
250}
251
252
254{
256
257 if( event.GetEventObject() == this )
259 else
260 m_matchSelected->SetFocus();
261}
262
263
265{
267
268 if( event.GetEventObject() == this )
270 else if( event.GetEventObject() != m_specifiedRef )
271 m_specifiedRef->SetFocus();
272}
273
274
276{
278
279 if( event.GetEventObject() == this )
281 else if( event.GetEventObject() != m_specifiedValue )
282 m_specifiedValue->SetFocus();
283}
284
285
287{
289
290 if( event.GetEventObject() == this )
292 else if( event.GetEventObject() != m_specifiedID )
293 m_specifiedID->SetFocus();
294}
295
296
297void DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked( wxCommandEvent& event )
298{
299 wxBusyCursor dummy;
300
302 m_MessageWindow->Flush( false );
303
305
306 m_parent->Compile_Ratsnest( true );
308
309 m_MessageWindow->Flush( false );
310
311 m_commit.Push( wxT( "Changed footprint" ) );
312}
313
314
316{
317 LIB_ID newFPID;
318
319 if( m_parent->GetBoard()->Footprints().empty() )
320 return;
321
322 if( !m_updateMode )
323 {
324 newFPID.Parse( m_newID->GetValue() );
325
326 if( !newFPID.IsValid() )
327 return;
328 }
329
330 /*
331 * NB: the change is done from the last footprint because processFootprint() modifies the
332 * last item in the list.
333 */
334 for( auto it = m_parent->GetBoard()->Footprints().rbegin();
335 it != m_parent->GetBoard()->Footprints().rend(); it++ )
336 {
337 FOOTPRINT* footprint = *it;
338
339 if( !isMatch( footprint ) )
340 continue;
341
342 if( m_updateMode )
343 processFootprint( footprint, footprint->GetFPID() );
344 else
345 processFootprint( footprint, newFPID );
346 }
347}
348
349
351{
352 LIB_ID oldFPID = aFootprint->GetFPID();
353 wxString msg;
354
355 // Load new footprint.
356 if( m_updateMode )
357 {
358 msg.Printf( _( "Updated footprint %s (%s)" ) + wxS( ": " ),
359 aFootprint->GetReference(),
360 oldFPID.Format().c_str() );
361 }
362 else
363 {
364 msg.Printf( _( "Changed footprint %s from '%s' to '%s'" ) + wxS( ": " ),
365 aFootprint->GetReference(),
366 oldFPID.Format().c_str(),
367 aNewFPID.Format().c_str() );
368 }
369
370 FOOTPRINT* newFootprint = m_parent->LoadFootprint( aNewFPID );
371
372 if( !newFootprint )
373 {
374 msg += _( "*** library footprint not found ***" );
376 return;
377 }
378
379 bool updated = !m_updateMode || aFootprint->FootprintNeedsUpdate( newFootprint );
380
381 m_parent->ExchangeFootprint( aFootprint, newFootprint, m_commit,
382 m_removeExtraBox->GetValue(),
383 m_resetTextItemLayers->GetValue(),
384 m_resetTextItemEffects->GetValue(),
385 m_resetFabricationAttrs->GetValue(),
386 m_reset3DModels->GetValue(),
387 &updated );
388
389 if( aFootprint == m_currentFootprint )
390 m_currentFootprint = newFootprint;
391
392 if( m_updateMode && !updated )
393 {
394 msg += _( ": (no changes)" );
396 }
397 else
398 {
399 msg += _( ": OK" );
401 }
402
403 return;
404}
405
406
407void processTextItem( const FP_TEXT& aSrc, FP_TEXT& aDest,
408 bool resetText, bool resetTextLayers, bool resetTextEffects,
409 bool* aUpdated )
410{
411 if( resetText )
412 *aUpdated |= aSrc.GetText() != aDest.GetText();
413 else
414 aDest.SetText( aSrc.GetText() );
415
416 if( resetTextLayers )
417 {
418 *aUpdated |= aSrc.GetLayer() != aDest.GetLayer();
419 *aUpdated |= aSrc.IsVisible() != aDest.IsVisible();
420 }
421 else
422 {
423 aDest.SetLayer( aSrc.GetLayer() );
424 aDest.SetVisible( aSrc.IsVisible() );
425 }
426
427 if( resetTextEffects )
428 {
429 *aUpdated |= aSrc.GetHorizJustify() != aDest.GetHorizJustify();
430 *aUpdated |= aSrc.GetVertJustify() != aDest.GetVertJustify();
431 *aUpdated |= aSrc.GetTextSize() != aDest.GetTextSize();
432 *aUpdated |= aSrc.GetTextThickness() != aDest.GetTextThickness();
433 *aUpdated |= aSrc.GetTextAngle() != aDest.GetTextAngle();
434 *aUpdated |= aSrc.GetPos0() != aDest.GetPos0();
435 }
436 else
437 {
438 // Careful: the visible bit and position are also set by SetAttributes()
439 bool visible = aDest.IsVisible();
440 aDest.SetAttributes( aSrc );
441 aDest.SetVisible( visible );
442 aDest.SetPos0( aSrc.GetPos0() );
443 }
444
445 aDest.SetLocked( aSrc.IsLocked() );
446}
447
448
450{
451 std::vector<FP_TEXT*> candidates;
452
453 for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
454 {
455 FP_TEXT* candidate = dyn_cast<FP_TEXT*>( item );
456
457 if( candidate && candidate->GetText() == aRefItem->GetText() )
458 candidates.push_back( candidate );
459 }
460
461 if( candidates.size() == 0 )
462 return nullptr;
463
464 if( candidates.size() == 1 )
465 return candidates[0];
466
467 // Try refining the match by layer
468 std::vector<FP_TEXT*> candidatesOnSameLayer;
469
470 for( FP_TEXT* candidate : candidates )
471 {
472 if( candidate->GetLayer() == aRefItem->GetLayer() )
473 candidatesOnSameLayer.push_back( candidate );
474 }
475
476 if( candidatesOnSameLayer.size() == 1 )
477 return candidatesOnSameLayer[0];
478
479 // Last ditch effort: refine by position
480 std::vector<FP_TEXT*> candidatesAtSamePos;
481
482 for( FP_TEXT* candidate : candidatesOnSameLayer.size() ? candidatesOnSameLayer : candidates )
483 {
484 if( candidate->GetPos0() == aRefItem->GetPos0() )
485 candidatesAtSamePos.push_back( candidate );
486 }
487
488 if( candidatesAtSamePos.size() > 0 )
489 return candidatesAtSamePos[0];
490 else if( candidatesOnSameLayer.size() > 0 )
491 return candidatesOnSameLayer[0];
492 else
493 return candidates[0];
494}
495
496#include <wx/log.h>
498 BOARD_COMMIT& aCommit, bool deleteExtraTexts,
499 bool resetTextLayers, bool resetTextEffects,
500 bool resetFabricationAttrs, bool reset3DModels,
501 bool* aUpdated )
502{
503 PCB_GROUP* parentGroup = aExisting->GetParentGroup();
504 bool dummyBool = false;
505
506 if( !aUpdated )
507 aUpdated = &dummyBool;
508
509 if( parentGroup )
510 {
511 parentGroup->RemoveItem( aExisting );
512 parentGroup->AddItem( aNew );
513 }
514
515 aNew->SetParent( GetBoard() );
516
517 PlaceFootprint( aNew, false );
518
519 // PlaceFootprint will move the footprint to the cursor position, which we don't want. Copy
520 // the original position across.
521 aNew->SetPosition( aExisting->GetPosition() );
522
523 if( aNew->GetLayer() != aExisting->GetLayer() )
524 aNew->Flip( aNew->GetPosition(), GetPcbNewSettings()->m_FlipLeftRight );
525
526 if( aNew->GetOrientation() != aExisting->GetOrientation() )
527 aNew->SetOrientation( aExisting->GetOrientation() );
528
529 aNew->SetLocked( aExisting->IsLocked() );
530
531 // Now transfer the net info from "old" pads to the new footprint
532 for( PAD* pad : aNew->Pads() )
533 {
534 PAD* pad_model = nullptr;
535
536 // Pads with no copper are never connected to a net
537 if( !pad->IsOnCopperLayer() )
538 {
539 pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
540 continue;
541 }
542
543 // Pads with no numbers are never connected to a net
544 if( pad->GetNumber().IsEmpty() )
545 {
546 pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
547 continue;
548 }
549
550 // Search for a similar pad on a copper layer, to reuse net info
551 PAD* last_pad = nullptr;
552
553 while( true )
554 {
555 pad_model = aExisting->FindPadByNumber( pad->GetNumber(), last_pad );
556
557 if( !pad_model )
558 break;
559
560 if( pad_model->IsOnCopperLayer() ) // a candidate is found
561 break;
562
563 last_pad = pad_model;
564 }
565
566 if( pad_model )
567 {
568 pad->SetLocalRatsnestVisible( pad_model->GetLocalRatsnestVisible() );
569 pad->SetPinFunction( pad_model->GetPinFunction() );
570 pad->SetPinType( pad_model->GetPinType() );
571 }
572
573 pad->SetNetCode( pad_model ? pad_model->GetNetCode() : NETINFO_LIST::UNCONNECTED );
574 }
575
576 // Copy reference
577 processTextItem( aExisting->Reference(), aNew->Reference(),
578 // never reset reference text
579 false,
580 resetTextLayers, resetTextEffects, aUpdated );
581
582 // Copy value
583 processTextItem( aExisting->Value(), aNew->Value(),
584 // reset value text only when it is a proxy for the footprint ID
585 // (cf replacing value "MountingHole-2.5mm" with "MountingHole-4.0mm")
586 aExisting->GetValue() == aExisting->GetFPID().GetLibItemName(),
587 resetTextLayers, resetTextEffects, aUpdated );
588
589 // Copy fields in accordance with the reset* flags
590 for( BOARD_ITEM* item : aExisting->GraphicalItems() )
591 {
592 FP_TEXT* srcItem = dyn_cast<FP_TEXT*>( item );
593
594 if( srcItem )
595 {
596 FP_TEXT* destItem = getMatchingTextItem( srcItem, aNew );
597
598 if( destItem )
599 {
600 processTextItem( *srcItem, *destItem, false, resetTextLayers, resetTextEffects,
601 aUpdated );
602 }
603 else if( !deleteExtraTexts )
604 {
605 aNew->Add( new FP_TEXT( *srcItem ) );
606 }
607 }
608 }
609
610 if( !resetFabricationAttrs )
611 aNew->SetAttributes( aExisting->GetAttributes() );
612
613 // Copy 3D model settings in accordance with the reset* flag
614 if( !reset3DModels )
615 aNew->Models() = aExisting->Models(); // Linked list of 3D models.
616
617 // Updating other parameters
618 const_cast<KIID&>( aNew->m_Uuid ) = aExisting->m_Uuid;
619 aNew->SetProperties( aExisting->GetProperties() );
620 aNew->SetPath( aExisting->GetPath() );
621
622 aCommit.Remove( aExisting );
623 aCommit.Add( aNew );
624
625 aNew->ClearFlags();
626}
627
628
630{
631 wxString newname = m_newID->GetValue();
632
634
635 if( frame->ShowModal( &newname, this ) )
636 {
637 if( event.GetEventObject() == m_newIDBrowseButton )
638 m_newID->SetValue( newname );
639 else
640 m_specifiedID->SetValue( newname );
641 }
642
643 frame->Destroy();
644}
645
646
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
@ small_library
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
bool GetLocalRatsnestVisible() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:50
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:167
virtual void SetLocked(bool aLocked)
Definition: board_item.h:241
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:62
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:201
virtual bool IsLocked() const
Definition: board_item.cpp:65
FOOTPRINTS & Footprints()
Definition: board.h:307
COMMIT & Remove(EDA_ITEM *aItem)
Notify observers that aItem has been removed.
Definition: commit.h:90
COMMIT & Add(EDA_ITEM *aItem)
Notify observers that aItem has been added.
Definition: commit.h:78
Class DIALOG_EXCHANGE_FOOTPRINTS_BASE.
void updateMatchModeRadioButtons(wxUpdateUIEvent &event) override
void OnMatchValueClicked(wxCommandEvent &event) override
void processFootprint(FOOTPRINT *aFootprint, const LIB_ID &aNewFPID)
void ViewAndSelectFootprint(wxCommandEvent &event) override
DIALOG_EXCHANGE_FOOTPRINTS(PCB_EDIT_FRAME *aParent, FOOTPRINT *aFootprint, bool updateMode, bool selectedMode)
void OnMatchIDClicked(wxCommandEvent &event) override
void OnMatchSelectedClicked(wxCommandEvent &event) override
void OnMatchAllClicked(wxCommandEvent &event) override
void OnMatchRefClicked(wxCommandEvent &event) override
void OnOKClicked(wxCommandEvent &event) override
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 SetupStandardButtons(std::map< int, wxString > aLabels={})
std::string m_hash_key
Definition: dialog_shim.h:203
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
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...
const KIID m_Uuid
Definition: eda_item.h:492
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:143
bool IsSelected() const
Definition: eda_item.h:107
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:117
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
void SetAttributes(const EDA_TEXT &aSrc)
Set the text attributes from another instance.
Definition: eda_text.cpp:264
virtual bool IsVisible() const
Definition: eda_text.h:126
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:139
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:217
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:142
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:163
int GetTextThickness() const
Definition: eda_text.h:109
VECTOR2I GetTextSize() const
Definition: eda_text.h:186
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1636
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:345
EDA_ANGLE GetOrientation() const
Definition: footprint.h:195
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:1766
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:220
void SetAttributes(int aAttributes)
Definition: footprint.h:246
int GetAttributes() const
Definition: footprint.h:245
bool FootprintNeedsUpdate(const FOOTPRINT *aLibFootprint)
Return true if a board footprint differs from the library version.
PADS & Pads()
Definition: footprint.h:174
const LIB_ID & GetFPID() const
Definition: footprint.h:207
bool IsLocked() const override
Definition: footprint.h:335
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:555
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:549
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:188
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1553
const wxString & GetValue() const
Definition: footprint.h:541
const wxString & GetReference() const
Definition: footprint.h:519
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: footprint.h:563
const KIID_PATH & GetPath() const
Definition: footprint.h:219
VECTOR2I GetPosition() const override
Definition: footprint.h:192
DRAWINGS & GraphicalItems()
Definition: footprint.h:177
FP_TEXT & Reference()
Definition: footprint.h:556
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:1151
const std::map< wxString, wxString > & GetProperties() const
Definition: footprint.h:562
const VECTOR2I & GetPos0() const
Definition: fp_text.h:124
void SetPos0(const VECTOR2I &aPos)
Definition: fp_text.h:123
Definition: kiid.h:47
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:66
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...
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:394
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:50
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:165
UTF8 Format() const
Definition: lib_id.cpp:117
const UTF8 & GetLibItemName() const
Definition: lib_id.h:101
static const int UNCONNECTED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition: netinfo.h:373
Definition: pad.h:58
const wxString & GetPinType() const
Definition: pad.h:151
const wxString & GetPinFunction() const
Definition: pad.h:145
bool IsOnCopperLayer() const override
Definition: pad.h:236
PCBNEW_SETTINGS * GetPcbNewSettings() const
FOOTPRINT * LoadFootprint(const LIB_ID &aFootprintId)
Attempt to load aFootprintId from the footprint library table.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
BOARD * GetBoard() const
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true)
Places aFootprint at the current cursor position and updates footprint coordinates with the new posit...
void Compile_Ratsnest(bool aDisplayStatus)
Create the entire board ratsnest.
Definition: ratsnest.cpp:35
The main frame for Pcbnew.
void ExchangeFootprint(FOOTPRINT *aExisting, FOOTPRINT *aNew, BOARD_COMMIT &aCommit, bool deleteExtraTexts=true, bool resetTextLayers=true, bool resetTextEffects=true, bool resetFabricationAttrs=true, bool reset3DModels=true, bool *aUpdated=nullptr)
Replace aExisting footprint by aNew footprint using the Existing footprint settings (position,...
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:51
bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
Definition: pcb_group.cpp:51
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:39
const char * c_str() const
Definition: utf8.h:102
void Clear()
return the number of messages matching the given severity mask.
void SetLazyUpdate(bool aLazyUpdate)
Forces updating the HTML page, after the report is built in lazy mode If aSort = true,...
void SetFileName(const wxString &aReportFileName)
void Report(const wxString &aText, SEVERITY aSeverity, REPORTER::LOCATION aLocation=REPORTER::LOC_BODY)
Reports the string.
void Flush(bool aSort=false)
Set the visible severity filter.
#define ID_MATCH_FP_ALL
bool g_resetTextItemLayers[2]
#define ID_MATCH_FP_VAL
FP_TEXT * getMatchingTextItem(FP_TEXT *aRefItem, FOOTPRINT *aFootprint)
void processTextItem(const FP_TEXT &aSrc, FP_TEXT &aDest, bool resetText, bool resetTextLayers, bool resetTextEffects, bool *aUpdated)
bool g_resetFabricationAttrs[2]
bool g_resetTextItemEffects[2]
#define ID_MATCH_FP_SELECTED
#define ID_MATCH_FP_REF
int g_matchModeForExchange
int g_matchModeForUpdateSelected
int g_matchModeForUpdate
bool g_reset3DModels[2]
bool g_removeExtraTextItems[2]
#define ID_MATCH_FP_ID
int g_matchModeForExchangeSelected
#define _(s)
@ FRAME_FOOTPRINT_VIEWER_MODAL
Definition: frame_type.h:43
This file contains miscellaneous commonly used macros and functions.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
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
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_INFO
@ RPT_SEVERITY_ACTION
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:74
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.