KiCad PCB EDA Suite
Loading...
Searching...
No Matches
symbol_tree_model_adapter.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2017 Chris Pavlina <[email protected]>
5 * Copyright (C) 2014 Henner Zeller <[email protected]>
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#ifndef SYMBOL_TREE_MODEL_ADAPTER_H
23#define SYMBOL_TREE_MODEL_ADAPTER_H
24
27
29class SCH_BASE_FRAME;
30
31class wxTimer;
32
34{
35public:
42
48 static wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> Create( SCH_BASE_FRAME* aParent,
50
56 void AddLibraries( SCH_BASE_FRAME* aFrame );
57
58 void AddLibrary( wxString const& aLibNickname, bool pinned );
59
61 {
62 m_compatCallback = std::move( aFunc );
63 m_compatCache.clear();
64 }
65
66 bool GetAttr( const wxDataViewItem& aItem, unsigned int aCol,
67 wxDataViewItemAttr& aAttr ) const override;
68
69 wxString GenerateInfo( LIB_ID const& aLibId, int aUnit ) override;
70
71protected:
76
77 void loadColumnConfig() override;
78
80
81private:
83
84 std::set<wxString> m_pending_load_libraries;
85 std::unique_ptr<wxTimer> m_check_pending_libraries_timer;
86
88 mutable std::map<LIB_ID, bool> m_compatCache;
89};
90
91#endif // SYMBOL_TREE_MODEL_ADAPTER_H
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
LIB_TREE_MODEL_ADAPTER(EDA_BASE_FRAME *aParent, const wxString &aPinnedKey, APP_SETTINGS_BASE::LIB_TREE &aSettingsStruct)
Create the adapter.
@ SYMBOL_LIB
Definition project.h:191
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
An interface to the global shared library manager that is schematic-specific and linked to one projec...
wxString GenerateInfo(LIB_ID const &aLibId, int aUnit) override
void AddLibraries(SCH_BASE_FRAME *aFrame)
Add all the libraries in a SYMBOL_LIB_TABLE to the model.
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(SCH_BASE_FRAME *aParent, SYMBOL_LIBRARY_ADAPTER *aLibs)
Factory function: create a model adapter in a reference-counting container.
std::unique_ptr< wxTimer > m_check_pending_libraries_timer
std::map< LIB_ID, bool > m_compatCache
void AddLibrary(wxString const &aLibNickname, bool pinned)
PROJECT::LIB_TYPE_T getLibType() override
SYMBOL_LIBRARY_ADAPTER * m_adapter
std::set< wxString > m_pending_load_libraries
bool GetAttr(const wxDataViewItem &aItem, unsigned int aCol, wxDataViewItemAttr &aAttr) const override
void SetCompatibilityCallback(SYMBOL_COMPAT_FUNC aFunc)
SYMBOL_TREE_MODEL_ADAPTER(SCH_BASE_FRAME *aParent, SYMBOL_LIBRARY_ADAPTER *aManager)
Constructor; takes a set of libraries to be included in the search.
std::function< std::vector< VARIANT_COMPAT_RESULT >(const LIB_ID &)> SYMBOL_COMPAT_FUNC
Callback that evaluates variant symbol compatibility for a given candidate LIB_ID.