KiCad PCB EDA Suite
Loading...
Searching...
No Matches
symbol_tree_synchronizing_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 CERN
5 * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 3
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * https://www.gnu.org/licenses/gpl-3.0.html
22 * or you may search the http://www.gnu.org website for the version 3 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef SYMBOL_TREE_SYNCHRONIZING_ADAPTER_H
28#define SYMBOL_TREE_SYNCHRONIZING_ADAPTER_H
29
31#include <map>
32
35
37{
38public:
39 static wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> Create( SYMBOL_EDIT_FRAME* aParent,
41
42 bool IsContainer( const wxDataViewItem& aItem ) const override;
43
44 void Sync( const wxString& aForceRefresh,
45 std::function<void( int, int, const wxString&)> aProgressCallback );
46
47 int GetLibrariesCount() const override;
48
50
51 wxDataViewItem GetCurrentDataViewItem() override;
52
53 virtual bool HasPreview( const wxDataViewItem& aItem ) override;
54 virtual void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) override;
55
56protected:
57 void updateLibrary( LIB_TREE_NODE_LIBRARY& aLibNode );
58
59 LIB_TREE_NODE::PTR_VECTOR::iterator deleteLibrary( LIB_TREE_NODE::PTR_VECTOR::iterator& aLibNodeIt );
60
61 void GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
62 unsigned int aCol ) const override;
63 bool GetAttr( wxDataViewItem const& aItem, unsigned int aCol,
64 wxDataViewItemAttr& aAttr ) const override;
65
67 SYMBOL_LIBRARY_MANAGER* aLibMgr );
68
69 bool isSymbolModel() override { return true; }
70
71protected:
74
76 std::map<wxString, int> m_libHashes;
77
80};
81
82#endif /* SYMBOL_TREE_SYNCHRONIZING_ADAPTER_H */
Node type: library.
The symbol library editor main window.
Class to handle modifications to the symbol libraries.
LIB_TREE_NODE::PTR_VECTOR::iterator deleteLibrary(LIB_TREE_NODE::PTR_VECTOR::iterator &aLibNodeIt)
SYMBOL_LIBRARY_MANAGER * m_libMgr
Hashes to decide whether a library needs an update.
void GetValue(wxVariant &aVariant, wxDataViewItem const &aItem, unsigned int aCol) const override
bool GetAttr(wxDataViewItem const &aItem, unsigned int aCol, wxDataViewItemAttr &aAttr) const override
void updateLibrary(LIB_TREE_NODE_LIBRARY &aLibNode)
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(SYMBOL_EDIT_FRAME *aParent, SYMBOL_LIBRARY_MANAGER *aLibs)
virtual void ShowPreview(wxWindow *aParent, const wxDataViewItem &aItem) override
int GetLibrariesCount() const override
Return the number of libraries loaded in the tree.
void Sync(const wxString &aForceRefresh, std::function< void(int, int, const wxString &)> aProgressCallback)
bool IsContainer(const wxDataViewItem &aItem) const override
virtual bool HasPreview(const wxDataViewItem &aItem) override
std::map< wxString, int > m_libHashes
SYMBOL_LIBRARY_MANAGER hash value returned in the last synchronization.