KiCad PCB EDA Suite
Loading...
Searching...
No Matches
design_block_pane.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
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU 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#ifndef DESIGN_BLOCK_PANE_H
20#define DESIGN_BLOCK_PANE_H
21
24#include <widgets/html_window.h>
25#include <widgets/wx_panel.h>
26#include <wx/checkbox.h>
27#include <wx/filedlgcustomize.h>
28#include <eda_draw_frame.h>
29
30
31class DESIGN_BLOCK;
33
34
36{
37public:
38 DESIGN_BLOCK_PANE( EDA_DRAW_FRAME* aParent, const LIB_ID* aPreselect, std::vector<LIB_ID>& aHistoryList );
39
40 ~DESIGN_BLOCK_PANE() override;
41
42 void SaveSettings();
43
44 LIB_ID GetSelectedLibId( int* aUnit = nullptr ) const;
45 void SelectLibId( const LIB_ID& aLibId );
46
56 DESIGN_BLOCK* GetDesignBlock( const LIB_ID& aLibId, bool aUseCacheLib, bool aShowErrorMsg );
57 DESIGN_BLOCK* GetSelectedDesignBlock( bool aUseCacheLib, bool aShowErrorMsg );
58
59 void RefreshLibs();
60
61 virtual void ProjectChanged() {}
62
69 wxString CreateNewDesignBlockLibrary( const wxString& aDialogTitle );
70
77 bool AddDesignBlockLibrary( const wxString& aDialogTitle, const wxString& aFilename,
78 LIBRARY_TABLE_SCOPE aScope );
79
80 bool DeleteDesignBlockLibrary( const wxString& aLibName, bool aConfirm );
81
82 bool DeleteDesignBlockFromLibrary( const LIB_ID& aLibId, bool aConfirm );
83
84 bool EditDesignBlockProperties( const LIB_ID& aLibId );
85
87
88protected:
89 virtual void setLabelsAndTooltips() = 0;
90
91 virtual void OnLanguageChanged( wxCommandEvent& aEvent );
92 void OnClosed( wxAuiManagerEvent& aEvent );
93
96
97private:
98 bool checkOverwrite( wxWindow* aFrame, wxString& libname, wxString& newName );
99
100 wxString createNewDesignBlockLibrary( const wxString& aDialogTitle );
101};
102#endif
bool DeleteDesignBlockLibrary(const wxString &aLibName, bool aConfirm)
PANEL_DESIGN_BLOCK_CHOOSER * GetDesignBlockPanel() const
bool checkOverwrite(wxWindow *aFrame, wxString &libname, wxString &newName)
bool DeleteDesignBlockFromLibrary(const LIB_ID &aLibId, bool aConfirm)
void SelectLibId(const LIB_ID &aLibId)
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
DESIGN_BLOCK_PANE(EDA_DRAW_FRAME *aParent, const LIB_ID *aPreselect, std::vector< LIB_ID > &aHistoryList)
DESIGN_BLOCK * GetDesignBlock(const LIB_ID &aLibId, bool aUseCacheLib, bool aShowErrorMsg)
Load design block from design block library table.
wxString createNewDesignBlockLibrary(const wxString &aDialogTitle)
PANEL_DESIGN_BLOCK_CHOOSER * m_chooserPanel
bool EditDesignBlockProperties(const LIB_ID &aLibId)
virtual void setLabelsAndTooltips()=0
wxString CreateNewDesignBlockLibrary(const wxString &aDialogTitle)
Creates a new design block library.
virtual void OnLanguageChanged(wxCommandEvent &aEvent)
EDA_DRAW_FRAME * m_frame
DESIGN_BLOCK * GetSelectedDesignBlock(bool aUseCacheLib, bool aShowErrorMsg)
virtual void ProjectChanged()
void OnClosed(wxAuiManagerEvent &aEvent)
bool AddDesignBlockLibrary(const wxString &aDialogTitle, const wxString &aFilename, LIBRARY_TABLE_SCOPE aScope)
Add an existing library to a library table (presumed to be either the global or project design block ...
The base class for create windows for drawing purpose.
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
WX_PANEL(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
Definition wx_panel.cpp:24
LIBRARY_TABLE_SCOPE