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 65 bool updateMode,
bool selectedMode ) :
69 m_currentFootprint( aFootprint ),
70 m_updateMode( updateMode )
74 SetTitle(
_(
"Change Footprints" ) );
75 m_matchAll->SetLabel(
_(
"Change all footprints on board" ) );
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." );
132 wxCommandEvent event;
133 event.SetEventObject(
this );
200 return aFootprint->
GetFPID() == specifiedID;
216 default:
return nullptr;
225 wxRadioButton* rb_butt_list[] =
238 for(
int ii = 0; rb_butt_list[ii]; ++ii )
240 bool state = rb_butt_list[ii] == rb_button;
242 if( rb_butt_list[ii]->GetValue() != state )
243 rb_butt_list[ii]->SetValue( state );
252 if( event.GetEventObject() == this )
263 if( event.GetEventObject() == this )
274 if( event.GetEventObject() == this )
285 if( event.GetEventObject() == this )
296 if( event.GetEventObject() == this )
375 msg.Printf(
_(
"Update footprint %s from '%s' to '%s'" ),
382 msg.Printf(
_(
"Change footprint %s from '%s' to '%s'" ),
392 msg << wxT(
": " ) <<
_(
"*** footprint not found ***" );
407 msg += wxT(
": OK" );
415 bool resetText,
bool resetTextLayers,
bool resetTextEffects )
420 if( !resetTextLayers )
426 if( !resetTextEffects )
440 std::vector<FP_TEXT*> candidates;
444 FP_TEXT* candidate = dyn_cast<FP_TEXT*>( item );
447 candidates.push_back( candidate );
450 if( candidates.size() == 0 )
453 if( candidates.size() == 1 )
454 return candidates[0];
457 std::vector<FP_TEXT*> candidatesOnSameLayer;
459 for(
FP_TEXT* candidate : candidates )
461 if( candidate->GetLayer() == aRefItem->
GetLayer() )
462 candidatesOnSameLayer.push_back( candidate );
465 if( candidatesOnSameLayer.size() == 1 )
466 return candidatesOnSameLayer[0];
469 std::vector<FP_TEXT*> candidatesAtSamePos;
471 for(
FP_TEXT* candidate : candidatesOnSameLayer.size() ? candidatesOnSameLayer : candidates )
473 if( candidate->GetPos0() == aRefItem->
GetPos0() )
474 candidatesAtSamePos.push_back( candidate );
477 if( candidatesAtSamePos.size() > 0 )
478 return candidatesAtSamePos[0];
479 else if( candidatesOnSameLayer.size() > 0 )
480 return candidatesOnSameLayer[0];
482 return candidates[0];
488 bool resetTextLayers,
bool resetTextEffects,
489 bool resetFabricationAttrs,
bool reset3DModels )
518 PAD* pad_model =
nullptr;
521 if( !
pad->IsOnCopperLayer() )
528 if(
pad->GetNumber().IsEmpty() )
535 PAD* last_pad =
nullptr;
547 last_pad = pad_model;
564 resetTextLayers, resetTextEffects );
571 resetTextLayers, resetTextEffects );
576 FP_TEXT* srcItem = dyn_cast<FP_TEXT*>( item );
583 processTextItem( *srcItem, *destItem,
false, resetTextLayers, resetTextEffects );
584 else if( !deleteExtraTexts )
589 if( !resetFabricationAttrs )
601 aCommit.
Remove( aExisting );
610 wxString newname =
m_newID->GetValue();
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...
PCB_GROUP * GetParentGroup() const
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
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.
const UTF8 & GetLibItemName() const
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
void Compile_Ratsnest(bool aDisplayStatus)
Create the entire board ratsnest.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
COMMIT & Add(EDA_ITEM *aItem)
Notify observers that aItem has been added.
A set of BOARD_ITEMs (i.e., without duplicates).
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.
bool GetLocalRatsnestVisible() const
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
A logical library item identifier and consists of various portions much like a URI.
bool IsValid() const
Check if this LID_ID is valid.
virtual bool IsLocked() const
PCBNEW_SETTINGS * m_settings
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
virtual void SetParent(EDA_ITEM *aParent)
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true)
Places aFootprint at the current cursor position and updates footprint coordinates with the new posit...
This file contains miscellaneous commonly used macros and functions.
const char * c_str() const
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
virtual void SetVisible(bool aVisible)
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,...
virtual void SetText(const wxString &aText)
virtual bool IsVisible() const
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
FOOTPRINTS & Footprints()
const wxString & GetPinType() const
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
FOOTPRINT * LoadFootprint(const LIB_ID &aFootprintId)
Attempt to load aFootprintId from the footprint library table.
bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
COMMIT & Remove(EDA_ITEM *aItem)
Notify observers that aItem has been removed.
bool IsOnCopperLayer() const override
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
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.
const wxPoint & GetPos0() const
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.
void Clear()
return the number of messages matching the given severity mask.
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...
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.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
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.
void SetFileName(const wxString &aReportFileName)
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
const wxString & GetPinFunction() const
static const int UNCONNECTED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
virtual const wxString & GetText() const
Return the string associated with the text object.