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 The 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 bool HasPreview( const wxDataViewItem& aItem ) override;
54 void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) override;
55 void ShutdownPreview( wxWindow* aParent ) override;
56
57protected:
58 void updateLibrary( LIB_TREE_NODE_LIBRARY& aLibNode );
59
60 LIB_TREE_NODE::PTR_VECTOR::iterator deleteLibrary( LIB_TREE_NODE::PTR_VECTOR::iterator& aLibNodeIt );
61
62 void GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
63 unsigned int aCol ) const override;
64 bool GetAttr( wxDataViewItem const& aItem, unsigned int aCol,
65 wxDataViewItemAttr& aAttr ) const override;
66
68 SYMBOL_LIBRARY_MANAGER* aLibMgr );
69
71
72protected:
75
77 std::map<wxString, int> m_libHashes;
78
81};
82
83#endif /* SYMBOL_TREE_SYNCHRONIZING_ADAPTER_H */
Node type: library.
LIB_TYPE_T
Definition: project.h:193
@ SYMBOL_LIB
Definition: project.h:194
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)
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)
void ShowPreview(wxWindow *aParent, const wxDataViewItem &aItem) override
int GetLibrariesCount() const override
Return the number of libraries loaded in the tree.
int m_lastSyncHash
SYMBOL_LIBRARY_MANAGER hash value returned in the last synchronization.
void Sync(const wxString &aForceRefresh, std::function< void(int, int, const wxString &)> aProgressCallback)
bool IsContainer(const wxDataViewItem &aItem) const override
bool HasPreview(const wxDataViewItem &aItem) override
std::map< wxString, int > m_libHashes
Hashes to decide whether a library needs an update.