27using namespace std::placeholders;
83 if( frame ==
nullptr )
86 if( aFootprint ==
nullptr )
94 if( aFootprint ==
nullptr )
108 auto recordAndUpdateUuid =
113 const_cast<KIID&
>( aItem->m_Uuid ) = newId;
122 recordAndUpdateUuid( newFootprint );
130 recordAndUpdateUuid( aItem );
165 if( !is_last_fp_from_brd )
185 wxString footprintName;
189 static wxString lastComponentName;
213 lastComponentName = footprintName;
241 wxCHECK_MSG( fptbl,
nullptr, wxT(
"Cannot look up LIB_ID in NULL FP_LIB_TABLE." ) );
278 static wxString oldName;
282 wxArrayString listnames;
285 listnames.
Add( footprint->GetReference() );
287 msg.Printf(
_(
"Footprints [%u items]" ), (
unsigned) listnames.GetCount() );
289 wxArrayString headers;
291 headers.Add(
_(
"Footprint" ) );
293 std::vector<wxArrayString> itemsToDisplay;
296 for(
unsigned i = 0; i < listnames.GetCount(); i++ )
300 item.Add( listnames[i] );
301 itemsToDisplay.push_back( item );
304 EDA_LIST_DIALOG dlg(
this, msg, headers, itemsToDisplay, wxEmptyString );
315 if( fpname == fp->GetReference() )
325 const wxString& curLibPath = aLibraryPath;
347 msg = wxString::Format(
_(
"Unable to find a reader for '%s'." ), curLibPath );
354 msg = wxString::Format(
_(
"Unable to find a writer for '%s'." ), dstLibPath );
359 wxArrayString footprints;
361 cur->FootprintEnumerate( footprints, curLibPath,
false );
363 for(
unsigned i = 0; i < footprints.size(); ++i )
365 const FOOTPRINT* footprint = cur->GetEnumeratedFootprint( curLibPath, footprints[i] );
366 dst->FootprintSave( dstLibPath, footprint );
368 msg = wxString::Format(
_(
"Footprint '%s' saved." ), footprints[i] );
369 SetStatusText( msg );
378 msg = wxString::Format(
_(
"Footprint library '%s' saved as '%s'." ),
384 SetStatusText( wxEmptyString );
396 if( aFootprint ==
nullptr )
401 if( aFootprint->
IsNew() )
407 ITEM_PICKER picker(
nullptr, aFootprint, UNDO_REDO::CHANGED );
428 if( aRecreateRatsnest )
431 if( aRecreateRatsnest )
void SetContentModified(bool aModified=true)
Container for design settings for a BOARD object.
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.
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
const FOOTPRINTS & Footprints() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
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.
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.
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.
bool IsValid() const
Check if this LID_ID is valid.
void RefreshLibTree()
Refreshes the tree (mainly to update highlighting and asterisking)
FLIP_DIRECTION m_FlipDirection
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...
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)
Attempts 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)
Places aFootprint at the current cursor position and updates footprint coordinates with the new posit...
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.
static PCB_IO * PluginFind(PCB_FILE_T aFileType)
Return a #PLUGIN which the caller can use to import, export, save, or load design documents.
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_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.
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.
static FP_LIB_TABLE * PcbFootprintLibs(PROJECT *aProject)
Return the table of footprint libraries without Kiway.
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
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