24#include "wx/generic/textdlgg.h"
37 m_frame = getEditFrame<EDA_DRAW_FRAME>();
43 auto checkPinnedStatus = [
this](
bool aPin )
49 std::vector<LIB_TREE_NODE*> selection;
54 if( lib && lib->m_Type == LIB_TREE_NODE::TYPE::LIBRARY && lib->m_Pinned != aPin )
69 auto pinnedLibSelectedCondition = [checkPinnedStatus](
const SELECTION& aSel )
71 return checkPinnedStatus(
true );
74 auto unpinnedLibSelectedCondition = [checkPinnedStatus](
const SELECTION& aSel )
76 return checkPinnedStatus(
false );
104 std::vector<LIB_TREE_NODE*> selection;
109 if( lib && lib->m_Type == LIB_TREE_NODE::TYPE::LIBRARY && lib->m_Pinned != aPin )
126 lib->m_Pinned = aPin;
130 wxFAIL_MSG( wxT(
"Unsupported frame type for library pinning." ) );
175 RENAME_DIALOG( wxWindow* aParent,
const wxString& aTitle,
const wxString& aName,
176 std::function<
bool(
const wxString& newName )> aValidator ) :
177 wxTextEntryDialog( aParent,
_(
"New name:" ), aTitle, aName ),
184 return m_validator( m_textctrl->GetValue().Trim(
true ).Trim(
false ) );
193 std::function<
bool(
const wxString& aNewName )> aValidator )
197 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.
FACE_T
Known KIFACE implementations.
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)
void changeSelectedPinStatus(const bool aPin)
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.
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.
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
int GetSelectedTreeNodes(std::vector< LIB_TREE_NODE * > &aSelection) const
Retrieve a list of pointers to selected tree nodes for trees that allow multi-selection.
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).