KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_sym_lib_table.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 Wayne Stambaugh <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#pragma once
22
23#include <grid_tricks.h>
27#include <sch_io/sch_io_mgr.h>
28#include <io/io_base.h>
29
30
31class LIBRARY_TABLE;
33
38{
39
40public:
42 virtual ~PANEL_SYM_LIB_TABLE();
43
44 bool TransferDataToWindow() override;
45 bool TransferDataFromWindow() override;
46
47 void AddTable( LIBRARY_TABLE* table, const wxString& aTitle, bool aClosable );
48 void OpenTable( const std::shared_ptr<LIBRARY_TABLE>& table, const wxString& aTitle );
49
50 wxAuiNotebook* GetNotebook() const { return m_notebook; }
51
52private:
58 bool verifyTables();
59
60 void browseLibrariesHandler( wxCommandEvent& event );
61
63 void newDatabaseLibraryHandler( wxCommandEvent& event );
64
66 void appendLibraryRow( const wxString& aNickname, SCH_IO_MGR::SCH_FILE_T aType, const wxString& aFilePath );
67 void appendRowHandler( wxCommandEvent& event ) override;
68 void deleteRowHandler( wxCommandEvent& event ) override;
69 void moveUpHandler( wxCommandEvent& event ) override;
70 void moveDownHandler( wxCommandEvent& event ) override;
71 void onSizeGrid( wxSizeEvent& event ) override;
72 void adjustPathSubsGridColumns( int aWidth );
73 void onConvertLegacyLibraries( wxCommandEvent& event ) override;
74
75 void onNotebookPageChangeRequest( wxAuiNotebookEvent& aEvent );
76 void onNotebookPageCloseRequest( wxAuiNotebookEvent& aEvent );
77
78 void onPageChange( wxAuiNotebookEvent& event ) override;
79 void onReset( wxCommandEvent& event ) override;
80
84
85 void populatePluginList();
86
88 SYMBOL_LIB_TABLE_GRID_DATA_MODEL* cur_model() const { return get_model( m_notebook->GetSelection() ); }
89
90 WX_GRID* get_grid( int aPage ) const;
91 WX_GRID* cur_grid() const { return get_grid( m_notebook->GetSelection() ); }
92
93private:
97 wxArrayString m_pluginChoices;
98
99 wxString m_lastProjectLibDir; //< Transient (unsaved) last browsed folder when adding a
100 // project level library.
101
102 std::vector<std::shared_ptr<LIBRARY_TABLE>> m_nestedTables;
103
104 std::map<SCH_IO_MGR::SCH_FILE_T, IO_BASE::IO_FILE_DESC> m_supportedSymFiles;
105};
106
107
108void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent );
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:348
PANEL_SYM_LIB_TABLE_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
void moveUpHandler(wxCommandEvent &event) override
SYMBOL_LIB_TABLE_GRID_DATA_MODEL * get_model(int aPage) const
void onReset(wxCommandEvent &event) override
void browseLibrariesHandler(wxCommandEvent &event)
void deleteRowHandler(wxCommandEvent &event) override
WX_GRID * get_grid(int aPage) const
void onNotebookPageCloseRequest(wxAuiNotebookEvent &aEvent)
void onPageChange(wxAuiNotebookEvent &event) override
void AddTable(LIBRARY_TABLE *table, const wxString &aTitle, bool aClosable)
bool verifyTables()
Trim important fields, removes blank row entries, and checks for duplicates.
void adjustPathSubsGridColumns(int aWidth)
wxAuiNotebook * GetNotebook() const
void OpenTable(const std::shared_ptr< LIBRARY_TABLE > &table, const wxString &aTitle)
void onSizeGrid(wxSizeEvent &event) override
std::vector< std::shared_ptr< LIBRARY_TABLE > > m_nestedTables
void onConvertLegacyLibraries(wxCommandEvent &event) override
void onNotebookPageChangeRequest(wxAuiNotebookEvent &aEvent)
std::map< SCH_IO_MGR::SCH_FILE_T, IO_BASE::IO_FILE_DESC > m_supportedSymFiles
void newDatabaseLibraryHandler(wxCommandEvent &event)
Creates or opens a .kicad_dbl in the settings editor and adds it to the current table.
bool TransferDataToWindow() override
void appendLibraryRow(const wxString &aNickname, SCH_IO_MGR::SCH_FILE_T aType, const wxString &aFilePath)
Appends a row for aFilePath, storing the path relative to an environment variable if possible.
wxArrayString m_pluginChoices
void moveDownHandler(wxCommandEvent &event) override
PANEL_SYM_LIB_TABLE(DIALOG_EDIT_LIBRARY_TABLES *aParent, PROJECT *m_project)
SYMBOL_LIB_TABLE_GRID_DATA_MODEL * cur_model() const
void populateEnvironReadOnlyTable()
Populate the readonly environment variable table with names and values by examining all the full_uri ...
WX_GRID * cur_grid() const
DIALOG_EDIT_LIBRARY_TABLES * m_parent
bool TransferDataFromWindow() override
void appendRowHandler(wxCommandEvent &event) override
Container for project specific data.
Definition project.h:63
void InvokeSchEditSymbolLibTable(KIWAY *aKiway, wxWindow *aParent)