27using namespace std::placeholders;
86 if( frame ==
nullptr )
89 if( aFootprint ==
nullptr )
97 if( aFootprint ==
nullptr )
111 auto recordAndUpdateUuid =
116 const_cast<KIID&
>( aItem->m_Uuid ) = newId;
125 recordAndUpdateUuid( newFootprint );
133 recordAndUpdateUuid( aItem );
165 if( !is_last_fp_from_brd )
217 wxString footprintName;
221 static wxString lastComponentName;
225 _(
"Loading Footprint Libraries" ), 3 );
227 bool cancel = progressReporter->WasCancelled();
234 delete progressReporter;
245 std::vector<LIB_TREE_ITEM*> historyInfos;
252 if( fp_info !=
nullptr )
253 historyInfos.push_back( fp_info );
256 adapter->
DoAddLibrary( wxT(
"-- " ) +
_(
"Recently Used" ) + wxT(
" --" ), wxEmptyString,
257 historyInfos,
false, true );
261 else if( historyInfos.size() )
267 title.Printf(
_(
"Choose Footprint (%d items loaded)" ), adapter->
GetItemCount() );
283 if( footprintName.IsEmpty() )
286 fpid.
Parse( footprintName );
295 footprintName = fpid.
Format();
308 lastComponentName = footprintName;
336 wxCHECK_MSG( fptbl,
nullptr, wxT(
"Cannot look up LIB_ID in NULL FP_LIB_TABLE." ) );
363 static wxString oldName;
367 wxArrayString listnames;
370 listnames.
Add( footprint->GetReference() );
372 msg.Printf(
_(
"Footprints [%u items]" ), (
unsigned) listnames.GetCount() );
374 wxArrayString headers;
376 headers.Add(
_(
"Footprint" ) );
378 std::vector<wxArrayString> itemsToDisplay;
381 for(
unsigned i = 0; i < listnames.GetCount(); i++ )
385 item.Add( listnames[i] );
386 itemsToDisplay.push_back( item );
389 EDA_LIST_DIALOG dlg(
this, msg, headers, itemsToDisplay, wxEmptyString );
391 if( dlg.ShowModal() == wxID_OK )
400 if( fpname == fp->GetReference() )
410 const wxString& curLibPath = aLibraryPath;
427 wxArrayString footprints;
431 for(
unsigned i = 0; i < footprints.size(); ++i )
436 msg = wxString::Format(
_(
"Footprint '%s' saved." ), footprints[i] );
437 SetStatusText( msg );
446 msg = wxString::Format(
_(
"Footprint library '%s' saved as '%s'." ),
452 SetStatusText( wxEmptyString );
465 wxString footprintName;
466 wxArrayString fplist;
470 fplist.
Add( fp->GetReference() + wxT(
" ( " ) + fp->GetValue() + wxT(
" )" ) );
476 if( dlg.ShowModal() != wxID_OK )
480 footprintName.Trim(
true );
481 footprintName.Trim(
false );
483 if( !footprintName.IsEmpty() )
487 if( fp->GetReference().CmpNoCase( footprintName ) == 0 )
498 if( aFootprint ==
nullptr )
503 if( aFootprint->
IsNew() )
509 ITEM_PICKER picker(
nullptr, aFootprint, UNDO_REDO::CHANGED );
530 if( aRecreateRatsnest )
533 if( aRecreateRatsnest )
void SetContentModified(bool aModified=true)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetParentGroup(PCB_GROUP *aGroup)
virtual void SetLocked(bool aLocked)
Information pertinent to a Pcbnew printed circuit board.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
FOOTPRINTS & Footprints()
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
bool IsType(FRAME_T aType) const
void ReCreateMenuBar()
Recreates the menu bar.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
virtual void SetParent(EDA_ITEM *aParent)
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
FOOTPRINT * FootprintLoadWithOptionalNickname(const LIB_ID &aFootprintId, bool aKeepUUID=false)
Load a footprint having aFootprintId with possibly an empty nickname.
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(EDA_BASE_FRAME *aParent, LIB_TABLE *aLibs)
Factory function: create a model adapter in a reference-counting container.
void AddLibraries(EDA_BASE_FRAME *aParent)
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Return a plugin type given a footprint library's libPath.
PCB_FILE_T
The set of file types that the IO_MGR knows about, and for which there has been a plugin written.
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Return a PLUGIN which the caller can use to import, export, save, or load design documents.
void SetLink(EDA_ITEM *aItem)
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
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.
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
bool IsValid() const
Check if this LID_ID is valid.
A mix-in to provide polymorphism between items stored in libraries (symbols, aliases and footprints).
void SetPreselectNode(const LIB_ID &aLibId, int aUnit)
Set the symbol name to be selected if there are no search results.
void DoAddLibrary(const wxString &aNodeName, const wxString &aDesc, const std::vector< LIB_TREE_ITEM * > &aItemList, bool pinned, bool presorted)
Add the given list of symbols by alias.
void SaveSettings()
Save the column widths to the config file.
int GetItemCount() const
Return the number of symbols loaded in the tree.
void RefreshLibTree()
Refreshes the tree (mainly to update highlighting and asterisking)
wxString CreateNewLibrary(const wxString &aLibName=wxEmptyString, const wxString &aProposedName=wxEmptyString)
If a library name is given, creates a new footprint library in the project folder with the given name...
wxString SelectFootprintFromLibBrowser()
Launch the footprint viewer to select the name of a footprint to load.
FOOTPRINT * SelectFootprintFromLibTree(LIB_ID aPreselect=LIB_ID())
Open a dialog to select a footprint.
FOOTPRINT * GetFootprintFromBoardByReference()
PCBNEW_SETTINGS * GetPcbNewSettings() const
void OnModify() override
Must be called after a change in order to set the "modify" flag and update other data structures and ...
FOOTPRINT * loadFootprint(const LIB_ID &aFootprintId)
Attempts to load aFootprintId from the footprint library table.
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.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true)
Places aFootprint at the current cursor position and updates footprint coordinates with the new posit...
virtual void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand)=0
Create a new entry in undo list of commands.
void Compile_Ratsnest(bool aDisplayStatus)
Create the entire board ratsnest.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
The main frame for Pcbnew.
A holder to handle information on schematic or board items.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
unsigned GetCount() const
void ClearItemsList()
Delete only the list of pickers NOT the picked data itself.
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
virtual const FOOTPRINT * GetEnumeratedFootprint(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.
virtual void FootprintSave(const wxString &aLibraryPath, const FOOTPRINT *aFootprint, const STRING_UTF8_MAP *aProperties=nullptr)
Write aFootprint to an existing library located at aLibraryPath.
virtual void FootprintEnumerate(wxArrayString &aFootprintNames, const wxString &aLibraryPath, bool aBestEfforts, const STRING_UTF8_MAP *aProperties=nullptr)
Return a list of footprint names contained within the library at aLibraryPath.
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
This file is part of the common library.
#define PAD_PROPERTIES_DLG_NAME
DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder.
static constexpr EDA_ANGLE & ANGLE_0
@ FRAME_FOOTPRINT_VIEWER_MODAL
void ignore_unused(const T &)
This file contains miscellaneous commonly used macros and functions.
std::vector< FAB_LAYER_COLOR > dummy
@ PCB_PAD_T
class PAD, a pad in a footprint
VECTOR2< double > VECTOR2D