23using namespace std::placeholders;
83 if( frame ==
nullptr )
86 if( aFootprint ==
nullptr )
94 if( aFootprint ==
nullptr )
108 const bool createdNewTab =
m_tabsPanel->FindTab( instanceKey ) < 0;
142 if( !is_last_fp_from_brd )
166 static wxString lastComponentName;
170 if( frame->ShowModal( &footprintName,
this ) )
183 lastComponentName = footprintName;
203 static wxString oldName;
207 wxArrayString listnames;
210 listnames.
Add( footprint->GetReference() );
212 msg.Printf(
_(
"Footprints [%u items]" ), (
unsigned) listnames.GetCount() );
214 wxArrayString headers;
216 headers.Add(
_(
"Footprint" ) );
218 std::vector<wxArrayString> itemsToDisplay;
221 for(
unsigned i = 0; i < listnames.GetCount(); i++ )
225 item.Add( listnames[i] );
226 itemsToDisplay.push_back( item );
229 EDA_LIST_DIALOG dlg(
this, msg, headers, itemsToDisplay, wxEmptyString );
240 if( fpname == fp->GetReference() )
250 const wxString& curLibPath = aLibraryPath;
251 wxString dstLibPath =
CreateNewLibrary(
_(
"Save Footprint Library As" ), aLibraryPath );
273 msg = wxString::Format(
_(
"Unable to find a reader for '%s'." ), curLibPath );
280 msg = wxString::Format(
_(
"Unable to find a writer for '%s'." ), dstLibPath );
285 wxArrayString footprints;
287 cur->FootprintEnumerate( footprints, curLibPath,
false );
289 for(
const wxString& fp : footprints )
291 const FOOTPRINT* footprint = cur->GetEnumeratedFootprint( curLibPath, fp );
292 dst->FootprintSave( dstLibPath, footprint );
294 msg = wxString::Format(
_(
"Footprint '%s' saved." ), fp );
295 SetStatusText( msg );
304 msg = wxString::Format(
_(
"Footprint library '%s' saved as '%s'." ),
310 SetStatusText( wxEmptyString );
322 if( aFootprint ==
nullptr )
327 if( aFootprint->
IsNew() )
348 if( aPosition.has_value() )
358 if( aRecreateRatsnest )
359 m_pcb->GetConnectivity()->Update( aFootprint );
361 if( aRecreateRatsnest )
362 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 PCB_IO 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