24#include "wx/generic/textdlgg.h"
37 m_frame = getEditFrame<EDA_DRAW_FRAME>();
43 auto pinnedLibSelectedCondition =
48 return current && current->
m_Type == LIB_TREE_NODE::TYPE::LIBRARY && current->
m_Pinned;
50 auto unpinnedLibSelectedCondition =
55 return current && current->
m_Type == LIB_TREE_NODE::TYPE::LIBRARY && !current->
m_Pinned;
96 default: wxFAIL_MSG( wxT(
"Unsupported frame type for library pinning." ) );
break;
124 default: wxFAIL_MSG( wxT(
"Unsupported frame type for library pinning." ) );
break;
155 RENAME_DIALOG( wxWindow* aParent,
const wxString& aTitle,
const wxString& aName,
156 std::function<
bool(
const wxString& newName )> aValidator ) :
157 wxTextEntryDialog( aParent,
_(
"New name:" ), aTitle, aName ),
164 return m_validator( m_textctrl->GetValue().Trim(
true ).Trim(
false ) );
173 std::function<
bool(
const wxString& aNewName )> aValidator )
177 return dlg.ShowModal() == wxID_OK;
static TOOL_ACTION showLibraryTree
static TOOL_ACTION pinLibrary
static TOOL_ACTION libraryTreeSearch
static TOOL_ACTION hideLibraryTree
static TOOL_ACTION unpinLibrary
FRAME_T GetFrameType() const
virtual void FocusLibraryTreeInput()
virtual void ToggleLibraryTree()
virtual bool IsLibraryTreeShown() const
virtual LIB_TREE * GetLibTree() const
virtual LIB_ID GetTargetLibId() const
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
static FACE_T KifaceType(FRAME_T aFrameType)
A simple mapping function which returns the FACE_T which is known to implement aFrameType.
int UnpinLibrary(const TOOL_EVENT &aEvent)
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
int ToggleLibraryTree(const TOOL_EVENT &aEvent)
bool RenameLibrary(const wxString &aTitle, const wxString &aName, std::function< bool(const wxString &aNewName)> aValidator)
int PinLibrary(const TOOL_EVENT &aEvent)
int LibraryTreeSearch(const TOOL_EVENT &aEvent)
void setTransitions() override
< Set up handlers for various events.
void regenerateLibraryTree()
void AddContextMenuItems(CONDITIONAL_MENU *aMenu)
A logical library item identifier and consists of various portions much like a URI.
bool IsValid() const
Check if this LID_ID is valid.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
Widget displaying a tree of symbols with optional search text control and description panel....
LIB_TREE_NODE * GetCurrentTreeNode() const
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
void Regenerate(bool aKeepState)
Regenerate the tree.
void PinLibrary(const wxString &aLibrary, enum LIB_TYPE_T aLibType)
void UnpinLibrary(const wxString &aLibrary, enum LIB_TYPE_T aLibType)
std::function< bool(const wxString &aNewName)> m_validator
bool TransferDataFromWindow() override
RENAME_DIALOG(wxWindow *aParent, const wxString &aTitle, const wxString &aName, std::function< bool(const wxString &newName)> aValidator)
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).