32 wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>
37 return wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>( adapter );
64 #define PROGRESS_INTERVAL_MILLIS 120 67 std::function<
void(
int,
int,
const wxString& )> aProgressCallback )
77 const wxString&
name = it->get()->m_Name;
79 if( wxGetUTCTimeMillis() > nextUpdate )
81 aProgressCallback( i, max,
name );
92 ||
name == aForceRefresh )
111 if( wxGetUTCTimeMillis() > nextUpdate )
113 aProgressCallback( i++, max, libName );
160 auto aliasIt = std::find_if( aliases.begin(), aliases.end(),
163 return a->GetName() == (*nodeIt)->m_Name;
166 if( aliasIt != aliases.end() )
170 static_cast<LIB_TREE_NODE_LIB_ID*>( nodeIt->get() )->Update( *aliasIt );
171 aliases.erase( aliasIt );
192 LIB_TREE_NODE::PTR_VECTOR::iterator& aLibNodeIt )
202 unsigned int aCol )
const 206 aVariant = wxEmptyString;
228 aVariant = aVariant.GetString() +
" *";
233 aVariant = aVariant.GetString() +
" *";
248 aVariant =
_(
"(failed to load)" ) + wxS(
" " ) + aVariant.GetString();
261 wxDataViewItemAttr& aAttr )
const 267 wxCHECK( node,
false );
272 aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
294 aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
296 aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
297 aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT ) );
315 aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
317 aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
318 aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT ) );
const UTF8 & GetLibItemName() const
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
LIB_ID GetLibId() const override
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(SYMBOL_EDIT_FRAME *aParent, SYMBOL_LIBRARY_MANAGER *aLibs)
virtual int GetLibrariesCount() const
Return the number of libraries loaded in the tree.
bool IsContainer(const wxDataViewItem &aItem) const override
SYMBOL_EDIT_FRAME * m_frame
SYMBOL_TREE_SYNCHRONIZING_ADAPTER(SYMBOL_EDIT_FRAME *aParent, SYMBOL_LIBRARY_MANAGER *aLibMgr)
std::map< wxString, int > m_libHashes
SYMBOL_LIBRARY_MANAGER hash value returned in the last synchronization.
int GetLibrariesCount() const override
Return the number of libraries loaded in the tree.
const wxString & GetDescr() const
Return the description of the library referenced by this row.
void Sync(const wxString &aForceRefresh, std::function< void(int, int, const wxString &)> aProgressCallback)
#define PROGRESS_INTERVAL_MILLIS
LIB_TREE_NODE_LIB_ID & AddItem(LIB_TREE_ITEM *aItem)
Construct a new alias node, add it to this library, and return it.
SYMBOL_LIB_TABLE_ROW * GetLibrary(const wxString &aLibrary) const
Find a single library within the (aggregate) library table.
int GetLibraryHash(const wxString &aLibrary) const
Return a library hash value to determine if it has changed.
Class to handle modifications to the symbol libraries.
void updateLibrary(LIB_TREE_NODE_LIB &aLibNode)
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
TOOL_INTERACTIVE * GetContextMenuTool() override
Define a library symbol object.
static LIB_TREE_NODE * ToNode(wxDataViewItem aItem)
Convert wxDataViewItem -> CMP_TREE_NODE.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
bool GetAttr(wxDataViewItem const &aItem, unsigned int aCol, wxDataViewItemAttr &aAttr) const override
wxString GetDescription() override
SYMBOL_LIBRARY_MANAGER * m_libMgr
Hashes to decide whether a library needs an update.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
LIB_TREE_NODE_LIB & DoAddLibraryNode(wxString const &aNodeName, wxString const &aDesc)
wxArrayString GetLibraryNames() const
Return the array of library names.
const wxString GetPinningSymbol() const
bool IsLibraryModified(const wxString &aLibrary) const
Return true if library has unsaved modifications.
LIB_TREE_NODE::PTR_VECTOR::iterator deleteLibrary(LIB_TREE_NODE::PTR_VECTOR::iterator &aLibNodeIt)
bool LibraryExists(const wxString &aLibrary, bool aCheckEnabled=false) const
Return true if library exists.
void AssignIntrinsicRanks(bool presorted=false)
Store intrinsic ranks on all children of this node.
void GetValue(wxVariant &aVariant, wxDataViewItem const &aItem, unsigned int aCol) const override
bool IsLibraryLoaded(const wxString &aLibrary) const
Return true if the library was successfully loaded.
std::list< LIB_PART * > GetAliases(const wxString &aLibrary) const
LIB_TREE_NODE_ROOT m_tree
Handle actions for the various symbol editor and viewers.
The symbol library editor main window.
bool IsPartModified(const wxString &aAlias, const wxString &aLibrary) const
Return true if part has unsaved modifications.