23using namespace std::placeholders;
83 if( frame ==
nullptr )
86 if( aFootprint ==
nullptr )
94 if( aFootprint ==
nullptr )
107 const wxString instanceKey =
109 const bool createdNewTab =
m_tabsPanel->FindTab( instanceKey ) < 0;
138 if( !is_last_fp_from_brd )
162 static wxString lastComponentName;
166 if( frame->ShowModal( &footprintName,
this ) )
179 lastComponentName = footprintName;
199 static wxString oldName;
203 wxArrayString listnames;
206 listnames.
Add( footprint->GetReference() );
208 msg.Printf(
_(
"Footprints [%u items]" ), (
unsigned) listnames.GetCount() );
210 wxArrayString headers;
212 headers.Add(
_(
"Footprint" ) );
214 std::vector<wxArrayString> itemsToDisplay;
217 for(
unsigned i = 0; i < listnames.GetCount(); i++ )
221 item.Add( listnames[i] );
222 itemsToDisplay.push_back( item );
225 EDA_LIST_DIALOG dlg(
this, msg, headers, itemsToDisplay, wxEmptyString );
236 if( fpname == fp->GetReference() )
246 const wxString& curLibPath = aLibraryPath;
247 wxString dstLibPath =
CreateNewLibrary(
_(
"Save Footprint Library As" ), aLibraryPath );
269 msg = wxString::Format(
_(
"Unable to find a reader for '%s'." ), curLibPath );
276 msg = wxString::Format(
_(
"Unable to find a writer for '%s'." ), dstLibPath );
281 wxArrayString footprints;
283 cur->FootprintEnumerate( footprints, curLibPath,
false );
285 for(
const wxString& fp : footprints )
287 const FOOTPRINT* footprint = cur->GetEnumeratedFootprint( curLibPath, fp );
288 dst->FootprintSave( dstLibPath, footprint );
290 msg = wxString::Format(
_(
"Footprint '%s' saved." ), fp );
291 SetStatusText( msg );
300 msg = wxString::Format(
_(
"Footprint library '%s' saved as '%s'." ),
306 SetStatusText( wxEmptyString );
318 if( aFootprint ==
nullptr )
323 if( aFootprint->
IsNew() )
344 if( aPosition.has_value() )
354 if( aRecreateRatsnest )
355 m_pcb->GetConnectivity()->Update( aFootprint );
357 if( aRecreateRatsnest )
358 m_pcb->CompileRatsnest();
void SetContentModified(bool aModified=true)
Information pertinent to a Pcbnew printed circuit board.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
const FOOTPRINTS & Footprints() const
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
bool IsType(FRAME_T aType) const
void ReCreateMenuBar()
Recreate 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 ReCreateHToolbar()
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.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
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()
void SetLink(EDA_ITEM *aItem)
KIWAY_PLAYER(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, const EDA_IU_SCALE &aIuScale)
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.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
wxString CreateNewLibrary(const wxString &aDialogTitle, const wxString &aInitialPath=wxEmptyString)
If a library name is given, creates a new footprint library in the project folder with the given name...
void setFPWatcher(FOOTPRINT *aFootprint)
Create or removes a watcher on the specified footprint.
void OnModify() override
Must be called after a change in order to set the "modify" flag and update other data structures and ...
virtual void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand)
Create a new entry in undo list of commands.
FOOTPRINT * SelectFootprintFromLibrary(LIB_ID aPreselect=LIB_ID())
Open a dialog to select a footprint.
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, std::optional< VECTOR2I > aPosition=std::nullopt)
Place aFootprint at the current cursor position (or provided one) and updates footprint coordinates w...
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.
PCB_FILE_T
The set of file types that the PCB_IO_MGR knows about, and for which there has been a plugin written,...
@ KICAD_SEXP
S-expression Pcbnew file format.
static PCB_IO * FindPlugin(PCB_FILE_T aFileType)
Return a #PLUGIN which the caller can use to import, export, save, or load design documents.
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath, int aCtl=0)
Return a plugin type given a footprint library's libPath.
A holder to handle information on schematic or board items.
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning 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.
@ FRAME_FOOTPRINT_CHOOSER
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
This file contains miscellaneous commonly used macros and functions.
FOOTPRINT * LoadFootprintFromProject(BOARD *aBoard, const LIB_ID &aFootprintId, bool aKeepUuid)
Load a footprint from the project library table and apply board default settings.
KIWAY Kiway(KFCTL_STANDALONE)
std::vector< FAB_LAYER_COLOR > dummy