33 wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>
38 return wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>( adapter );
65 #define PROGRESS_INTERVAL_MILLIS 120 68 std::function<
void(
int,
int,
const wxString& )> aProgressCallback )
78 const wxString&
name = it->get()->m_Name;
80 if( wxGetUTCTimeMillis() > nextUpdate )
82 aProgressCallback( i, max,
name );
93 ||
name == aForceRefresh )
112 if( wxGetUTCTimeMillis() > nextUpdate )
114 aProgressCallback( i++, max, libName );
161 auto aliasIt = std::find_if( aliases.begin(), aliases.end(),
164 return a->GetName() == (*nodeIt)->m_LibId.GetLibItemName();
167 if( aliasIt != aliases.end() )
171 static_cast<LIB_TREE_NODE_LIB_ID*>( nodeIt->get() )->Update( *aliasIt );
172 aliases.erase( aliasIt );
193 LIB_TREE_NODE::PTR_VECTOR::iterator& aLibNodeIt )
203 unsigned int aCol )
const 207 aVariant = wxEmptyString;
229 aVariant = aVariant.GetString() + wxT(
" *" );
234 aVariant = aVariant.GetString() + wxT(
" *" );
259 aVariant =
_(
"(failed to load)" ) + wxS(
" " ) + aVariant.GetString();
272 wxDataViewItemAttr& aAttr )
const 278 wxCHECK( node,
false );
283 aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
305 aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
307 aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
308 aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT ) );
326 aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
328 aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
329 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...
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.
LIB_TREE_NODE_LIB & DoAddLibraryNode(const wxString &aNodeName, const wxString &aDesc)
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.
Define a library symbol object.
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_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
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.
LIB_ID GetLibId() const override
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
bool IsSymbolModified(const wxString &aAlias, const wxString &aLibrary) const
Return true if symbol has unsaved modifications.
SYMBOL_LIBRARY_MANAGER & GetLibManager()
static LIB_TREE_NODE * ToNode(wxDataViewItem aItem)
Convert wxDataViewItem -> #SYM_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
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.
wxString UnescapeString(const wxString &aSource)
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.
LIB_TREE_NODE_ROOT m_tree
wxString GetDescription() override
Handle actions for the various symbol editor and viewers.
std::list< LIB_SYMBOL * > GetAliases(const wxString &aLibrary) const
The symbol library editor main window.