27#include <wx/generic/textdlgg.h>
54 m_checkerDialog( nullptr )
66 m_frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
79 auto libSelectedCondition =
89 auto libInferredCondition =
95 auto pinnedLibSelectedCondition =
101 auto unpinnedLibSelectedCondition =
107 auto fpSelectedCondition =
114 auto fpExportCondition =
118 return fp !=
nullptr;
214 if( wizard->ShowModal(
nullptr,
m_frame ) )
217 FOOTPRINT* newFootprint = wizard->GetBuiltFootprint();
330 getEditFrame<FOOTPRINT_EDIT_FRAME>()->RevertFootprint();
364 newName +=
_(
"_copy" );
405 std::function<
bool( wxString newName )> aValidator ) :
406 wxTextEntryDialog( aParent,
_(
"New name:" ),
_(
"Change Footprint Name" ), aName ),
412 wxString
name = m_textctrl->GetValue();
413 name.Trim(
true ).Trim(
false );
424 std::function<bool( wxString newName )>
m_validator;
437 [&]( wxString newName )
439 if( newName.IsEmpty() )
441 wxMessageBox( _(
"Footprint must have a name." ) );
447 msg = wxString::Format( _(
"Footprint '%s' already exists in library '%s'." ),
448 newName, libraryName );
450 KIDIALOG errorDlg( m_frame, msg, _(
"Confirmation" ),
451 wxOK | wxCANCEL | wxICON_WARNING );
452 errorDlg.SetOKLabel( _(
"Overwrite" ) );
454 return errorDlg.ShowModal() == wxID_OK;
460 if( dlg.ShowModal() != wxID_OK )
521 if(
frame->DeleteFootprintFromLibrary(
frame->GetTargetFPID(),
true ) )
523 if(
frame->GetTargetFPID() ==
frame->GetLoadedFPID() )
524 frame->Clear_Pcb(
false );
526 frame->SyncLibraryTree(
true );
549 if( is_last_fp_from_brd )
581 if( currentNode && !currentNode->
m_Pinned )
597 if( currentNode && currentNode->
m_Pinned )
634 getEditFrame<FOOTPRINT_EDIT_FRAME>()->OnEditItemRequest(
footprint );
644 getEditFrame<FOOTPRINT_EDIT_FRAME>()->ShowPadPropertiesDialog(
nullptr );
710 if( ids.count( aItem->m_Uuid ) )
713 const_cast<KIID&
>( aItem->m_Uuid ) =
KIID();
716 ids.insert( aItem->m_Uuid );
741 processItem(
group );
745 errors += duplicates;
746 details += wxString::Format(
_(
"%d duplicate IDs replaced.\n" ), duplicates );
761 wxString msg = wxString::Format(
_(
"%d potential problems repaired." ), errors );
static TOOL_ACTION revert
static TOOL_ACTION saveAs
static TOOL_ACTION pinLibrary
static TOOL_ACTION zoomFitScreen
static TOOL_ACTION unpinLibrary
static TOOL_ACTION showProperties
void SetContentModified(bool aModified=true)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
FOOTPRINTS & Footprints()
bool Show(bool show) override
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
void ReCreateMenuBar()
Recreates the menu bar.
WX_INFOBAR * GetInfoBar()
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.
void ForceRefresh()
Force a redraw.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
A base class for most all the KiCad significant classes used in schematics and boards.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
void FootprintDelete(const wxString &aNickname, const wxString &aFootprintName)
Delete the aFootprintName from the library given by aNickname.
bool FootprintExists(const wxString &aNickname, const wxString &aFootprintName)
Indicates whether or not the given footprint already exists in the given library.
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()
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
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 & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
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 SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
const wxString GetUniStringLibNickname() const
const UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
wxString GetFullURI(const wxString &aLibNickname, bool aExpandEnvVars=true) const
Return the full URI of the library mapped to aLibNickname.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
static TOOL_ACTION deleteFootprint
static TOOL_ACTION renameFootprint
static TOOL_ACTION showLayersManager
static TOOL_ACTION createFootprint
static TOOL_ACTION hideFootprintTree
static TOOL_ACTION editFootprint
static TOOL_ACTION exportFootprint
static TOOL_ACTION showFootprintTree
static TOOL_ACTION editTextAndGraphics
static TOOL_ACTION newFootprint
static TOOL_ACTION defaultPadProperties
static TOOL_ACTION importFootprint
static TOOL_ACTION pasteFootprint
static TOOL_ACTION footprintProperties
static TOOL_ACTION checkFootprint
static TOOL_ACTION duplicateFootprint
static TOOL_ACTION cutFootprint
static TOOL_ACTION repairFootprint
static TOOL_ACTION copyFootprint
static TOOL_ACTION cleanupGraphics
void ToggleProperties() override
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.
FOOTPRINT * CreateNewFootprint(const wxString &aFootprintName, const wxString &aLibName, bool aQuiet)
Creates a new footprint, at position 0,0.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
A set of BOARD_ITEMs (i.e., without duplicates).
static FP_LIB_TABLE * PcbFootprintLibs(PROJECT *aProject)
Return the table of footprint libraries without Kiway.
void UnpinLibrary(const wxString &aLibrary, bool isSymbolLibrary)
void PinLibrary(const wxString &aLibrary, bool isSymbolLibrary)
std::function< bool(wxString newName)> m_validator
bool TransferDataFromWindow() override
RENAME_DIALOG(wxWindow *aParent, const wxString &aName, std::function< bool(wxString newName)> aValidator)
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
A modified version of the wxInfoBar class that allows us to:
bool HasCloseButton() const
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Handle a list of polygons defining a copper zone.
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.
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
This file is part of the common library.
Class to handle a set of BOARD_ITEMs.
VECTOR2< double > VECTOR2D