KiCad PCB EDA Suite
panel_fp_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) 2018 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 along
17  * with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef PANEL_FP_LIB_TABLE_H
21 #define PANEL_FP_LIB_TABLE_H
22 
25 #include <widgets/wx_grid.h>
26 
27 class FP_LIB_TABLE;
28 class FP_LIB_TABLE_GRID;
29 
30 
35 {
36 
37 public:
39  FP_LIB_TABLE* aGlobal, const wxString& aGlobalTblPath,
40  FP_LIB_TABLE* aProject, const wxString& aProjectTblPath,
41  const wxString& aProjectBasePath );
42  ~PANEL_FP_LIB_TABLE() override;
43 
44 private:
45  bool TransferDataFromWindow() override;
46 
52  bool verifyTables();
53 
54  void pageChangedHandler( wxAuiNotebookEvent& event ) override;
55  void appendRowHandler( wxCommandEvent& event ) override;
56  void browseLibrariesHandler( wxCommandEvent& event ) override;
57  void deleteRowHandler( wxCommandEvent& event ) override;
58  void moveUpHandler( wxCommandEvent& event ) override;
59  void moveDownHandler( wxCommandEvent& event ) override;
60  void onSizeGrid( wxSizeEvent& event ) override;
61 
62  void adjustPathSubsGridColumns( int aWidth );
63 
67 
68  // caller's tables are modified only on OK button and successful verification.
72 
74  {
75  return (FP_LIB_TABLE_GRID*) m_global_grid->GetTable();
76  }
77 
79  {
80  return (FP_LIB_TABLE_GRID*) m_project_grid->GetTable();
81  }
82 
84  {
85  return (FP_LIB_TABLE_GRID*) m_cur_grid->GetTable();
86  }
87 
89 
90  WX_GRID* m_cur_grid; // changed based on tab choice
91  static size_t m_pageNdx; // Remember last notebook page selected during a session
92  static wxString m_lastBrowseDir; // Remember last directory browsed during a session
93 };
94 
95 #endif // PANEL_FP_LIB_TABLE_H
FP_LIB_TABLE_GRID * global_model() const
void moveDownHandler(wxCommandEvent &event) override
FP_LIB_TABLE_GRID * cur_model() const
FP_LIB_TABLE * m_project
void appendRowHandler(wxCommandEvent &event) override
void adjustPathSubsGridColumns(int aWidth)
void browseLibrariesHandler(wxCommandEvent &event) override
static wxString m_lastBrowseDir
FP_LIB_TABLE_GRID * project_model() const
static size_t m_pageNdx
void moveUpHandler(wxCommandEvent &event) override
PANEL_FP_LIB_TABLE(DIALOG_EDIT_LIBRARY_TABLES *aParent, FP_LIB_TABLE *aGlobal, const wxString &aGlobalTblPath, FP_LIB_TABLE *aProject, const wxString &aProjectTblPath, const wxString &aProjectBasePath)
void deleteRowHandler(wxCommandEvent &event) override
bool verifyTables()
Trim important fields, removes blank row entries, and checks for duplicates.
Class PANEL_FP_LIB_TABLE_BASE.
void pageChangedHandler(wxAuiNotebookEvent &event) override
bool TransferDataFromWindow() override
This class builds a wxGridTableBase by wrapping an FP_LIB_TABLE object.
DIALOG_EDIT_LIBRARY_TABLES * m_parent
void onSizeGrid(wxSizeEvent &event) override
FP_LIB_TABLE * m_global
Dialog to show and edit symbol library tables.
void populateEnvironReadOnlyTable()
Populate the readonly environment variable table with names and values by examining all the full_uri ...