KiCad PCB EDA Suite
Loading...
Searching...
No Matches
db_lib_preview_panel.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef DB_LIB_PREVIEW_PANEL_H
21#define DB_LIB_PREVIEW_PANEL_H
22
23#include <map>
24#include <memory>
25#include <vector>
26
27#include <wx/panel.h>
28
33
34class EDA_BASE_FRAME;
36class KIWAY;
37class LIB_SYMBOL;
38class LIB_TREE;
40class wxChoice;
41class wxStaticText;
42
43
49class DB_LIB_PREVIEW_PANEL : public wxPanel
50{
51public:
56 DB_LIB_PREVIEW_PANEL( wxWindow* aParent, EDA_BASE_FRAME* aFrame, KIWAY* aKiway,
57 EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
58
59 ~DB_LIB_PREVIEW_PANEL() override;
60
65 void SetSymbols( const wxString& aLibNickname, std::vector<std::unique_ptr<LIB_SYMBOL>> aSymbols );
66
68 void SetStatus( const wxString& aText );
69
70 void SelectSymbol( const wxString& aSymbolName );
71
72private:
73 void onSymbolSelected( wxCommandEvent& aEvent );
74 void onFootprintSelected( wxCommandEvent& aEvent );
75
76 void showSymbol( const LIB_SYMBOL* aSymbol, int aUnit );
77 void showFootprint( const wxString& aFootprint );
78
79 const LIB_SYMBOL* findSymbol( const LIB_ID& aLibId ) const;
80
82 wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> m_adapter;
87 wxStaticText* m_status;
89
92
93 wxString m_nickname;
94 std::map<wxString, std::unique_ptr<LIB_SYMBOL>> m_symbols;
95};
96
97#endif // DB_LIB_PREVIEW_PANEL_H
void onFootprintSelected(wxCommandEvent &aEvent)
const LIB_SYMBOL * findSymbol(const LIB_ID &aLibId) const
void showSymbol(const LIB_SYMBOL *aSymbol, int aUnit)
void showFootprint(const wxString &aFootprint)
void onSymbolSelected(wxCommandEvent &aEvent)
WX_DEBOUNCED_ACTION m_footprintLoadRetry
Polls the footprint library load, which DisplayFootprint() needs finished.
FOOTPRINT_PREVIEW_WIDGET * m_footprintPreview
void SelectSymbol(const wxString &aSymbolName)
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > m_adapter
void SetSymbols(const wxString &aLibNickname, std::vector< std::unique_ptr< LIB_SYMBOL > > aSymbols)
Replaces the previewed library, keeping the selected symbol when it still exists.
DB_LIB_PREVIEW_PANEL(wxWindow *aParent, EDA_BASE_FRAME *aFrame, KIWAY *aKiway, EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
SYMBOL_PREVIEW_WIDGET * m_symbolPreview
void SetStatus(const wxString &aText)
Shows a one-line status below the library tree.
std::map< wxString, std::unique_ptr< LIB_SYMBOL > > m_symbols
APP_SETTINGS_BASE::LIB_TREE m_treeSettings
The base frame for deriving all KiCad main window classes.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:348
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
Define a library symbol object.
Definition lib_symbol.h:114
Widget displaying a tree of symbols with optional search text control and description panel.
Definition lib_tree.h:44
Debounces an action: runs it only after a quiet period following the last trigger.