27using namespace std::placeholders;
84 if( frame ==
nullptr )
87 if( aFootprint ==
nullptr )
95 if( aFootprint ==
nullptr )
112 auto recordAndUpdateUuid =
117 const_cast<KIID&
>( aItem->m_Uuid ) = newId;
126 recordAndUpdateUuid( newFootprint );
134 recordAndUpdateUuid( aItem );
170 if( !is_last_fp_from_brd )
194 static wxString lastComponentName;
198 if( frame->ShowModal( &footprintName,
this ) )
217 lastComponentName = footprintName;
280 static wxString oldName;
284 wxArrayString listnames;
287 listnames.
Add( footprint->GetReference() );
289 msg.Printf(
_(
"Footprints [%u items]" ), (
unsigned) listnames.GetCount() );
291 wxArrayString headers;
293 headers.Add(
_(
"Footprint" ) );
295 std::vector<wxArrayString> itemsToDisplay;
298 for(
unsigned i = 0; i < listnames.GetCount(); i++ )
302 item.Add( listnames[i] );
303 itemsToDisplay.push_back( item );
306 EDA_LIST_DIALOG dlg(
this, msg, headers, itemsToDisplay, wxEmptyString );
317 if( fpname == fp->GetReference() )
327 const wxString& curLibPath = aLibraryPath;
328 wxString dstLibPath =
CreateNewLibrary(
_(
"Save Footprint Library As" ), aLibraryPath );
350 msg = wxString::Format(
_(
"Unable to find a reader for '%s'." ), curLibPath );
357 msg = wxString::Format(
_(
"Unable to find a writer for '%s'." ), dstLibPath );
362 wxArrayString footprints;
364 cur->FootprintEnumerate( footprints, curLibPath,
false );
366 for(
const wxString& fp : footprints )
368 const FOOTPRINT* footprint = cur->GetEnumeratedFootprint( curLibPath, fp );
369 dst->FootprintSave( dstLibPath, footprint );
371 msg = wxString::Format(
_(
"Footprint '%s' saved." ), fp );
372 SetStatusText( msg );
381 msg = wxString::Format(
_(
"Footprint library '%s' saved as '%s'." ),
387 SetStatusText( wxEmptyString );
399 if( aFootprint ==
nullptr )
404 if( aFootprint->
IsNew() )
431 if( aRecreateRatsnest )
432 m_pcb->GetConnectivity()->Update( aFootprint );
434 if( aRecreateRatsnest )
void SetContentModified(bool aModified=true)
Container for design settings for a BOARD object.
std::map< int, SEVERITY > m_DRCSeverities
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetLocked(bool aLocked) override
Information pertinent to a Pcbnew printed circuit board.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
const FOOTPRINTS & Footprints() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() 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.
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 SetParentGroup(EDA_GROUP *aGroup)
virtual void SetParent(EDA_ITEM *aParent)
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)
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.
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.
FLIP_DIRECTION m_FlipDirection
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...
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 ...
virtual void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand)
Create a new entry in undo list of commands.
FOOTPRINT * loadFootprint(const LIB_ID &aFootprintId)
Attempt to load aFootprintId from the footprint library table.
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)
Place aFootprint at the current cursor position and updates footprint coordinates with the new positi...
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.
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.
static FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(PROJECT *aProject)
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.
static constexpr EDA_ANGLE ANGLE_0
@ 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.
KIWAY Kiway(KFCTL_STANDALONE)
std::vector< FAB_LAYER_COLOR > dummy
@ PCB_PAD_T
class PAD, a pad in a footprint
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D