23 #include <wx/tokenzr.h> 24 #include <wx/window.h> 38 #define PROGRESS_INTERVAL_MILLIS 33 // 30 FPS refresh rate 41 wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>
45 return wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>( adapter );
62 std::unique_ptr<WX_PROGRESS_REPORTER> prg =
nullptr;
66 prg = std::make_unique<WX_PROGRESS_REPORTER>( aParent,
_(
"Loading Symbol Libraries" ),
67 aNicknames.size(), true );
73 std::unordered_map<wxString, std::vector<LIB_SYMBOL*>> loadedSymbols;
77 &loadedSymbols, prg.get() );
83 while( !loader.Done() )
85 if( prg && !prg->KeepRefreshing() )
93 bool cancelled =
false;
96 cancelled = prg->IsCancelled();
98 if( !loader.GetErrors().IsEmpty() )
104 wxString msg = loader.GetErrors();
105 msg.Replace( wxT(
"\n" ), wxT(
"<BR>" ) );
111 if( loadedSymbols.size() > 0 )
113 for(
const std::pair<
const wxString, std::vector<LIB_SYMBOL*>>& pair : loadedSymbols )
115 std::vector<LIB_TREE_ITEM*> treeItems( pair.second.begin(), pair.second.end() );
143 std::vector<LIB_SYMBOL*> symbols;
144 std::vector<LIB_TREE_ITEM*> comp_list;
152 wxLogError(
_(
"Error loading symbol library '%s'." ) + wxS(
"\n%s" ),
158 if( symbols.size() > 0 )
160 comp_list.assign( symbols.begin(), symbols.end() );
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
void AddLibrary(wxString const &aLibNickname)
wxString GenerateInfo(LIB_ID const &aLibId, int aUnit) override
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(EDA_BASE_FRAME *aParent, LIB_TABLE *aLibs)
Factory function: create a model adapter in a reference-counting container.
SYM_FILTER_TYPE GetFilter() const
Return the active filter.
A logical library item identifier and consists of various portions much like a URI.
Abstract pattern-matching tool and implementations.
SYMBOL_TREE_MODEL_ADAPTER(EDA_BASE_FRAME *aParent, LIB_TABLE *aLibs)
Constructor; takes a set of libraries to be included in the search.
SYMBOL_LIB_TABLE * m_libs
wxString GenerateAliasInfo(SYMBOL_LIB_TABLE *aSymLibTable, LIB_ID const &aLibId, int aUnit)
Return an HTML page describing a LIB_ID in a SYMBOL_LIB_TABLE.
virtual const wxString What() const
A composite of Problem() and Where()
const wxString GetDescription(const wxString &aNickname)
void MessageSet(const wxString &message)
Add a message (in bold) to message list.
void LoadSymbolLib(std::vector< LIB_SYMBOL * > &aAliasList, const wxString &aNickname, bool aPowerSymbolsOnly=false)
void DoAddLibrary(const wxString &aNodeName, const wxString &aDesc, const std::vector< LIB_TREE_ITEM * > &aItemList, bool presorted)
Add the given list of symbols by alias.
void AssignIntrinsicRanks(bool presorted=false)
Store intrinsic ranks on all children of this node.
static bool m_show_progress
Flag to only show the symbol library table load progress dialog the first time.
static void CreateNilUuids(bool aNil=true)
A performance optimization which disables/enables the generation of pseudo-random UUIDs.
void AddHTML_Text(const wxString &message)
Add HTML text (without any change) to message list.
The base frame for deriving all KiCad main window classes.
LIB_TREE_NODE_ROOT m_tree
#define PROGRESS_INTERVAL_MILLIS
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
~SYMBOL_TREE_MODEL_ADAPTER()
Destructor.
bool AddLibraries(const std::vector< wxString > &aNicknames, wxWindow *aParent)
Add all the libraries in a SYMBOL_LIB_TABLE to the model.
Manage LIB_TABLE_ROW records (rows), and can be searched based on library nickname.