2018-03-14 04:51:59 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-07-19 19:15:40 +00:00
|
|
|
#ifndef PANEL_FP_LIB_TABLE_H
|
|
|
|
#define PANEL_FP_LIB_TABLE_H
|
2018-03-14 04:51:59 +00:00
|
|
|
|
2018-07-19 19:15:40 +00:00
|
|
|
#include <dialog_edit_library_tables.h>
|
2018-07-20 17:46:56 +00:00
|
|
|
#include <panel_fp_lib_table_base.h>
|
2018-08-19 16:10:14 +00:00
|
|
|
#include <widgets/wx_grid.h>
|
2018-03-14 04:51:59 +00:00
|
|
|
|
|
|
|
class FP_LIB_TABLE;
|
|
|
|
class FP_LIB_TABLE_GRID;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dialog to show and edit symbol library tables.
|
|
|
|
*/
|
2018-07-19 19:15:40 +00:00
|
|
|
class PANEL_FP_LIB_TABLE : public PANEL_FP_LIB_TABLE_BASE
|
2018-03-14 04:51:59 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2018-08-06 18:33:28 +00:00
|
|
|
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 );
|
2018-07-19 19:15:40 +00:00
|
|
|
~PANEL_FP_LIB_TABLE() override;
|
2018-03-14 04:51:59 +00:00
|
|
|
|
|
|
|
private:
|
2018-07-19 19:15:40 +00:00
|
|
|
bool TransferDataFromWindow() override;
|
|
|
|
|
2018-03-14 04:51:59 +00:00
|
|
|
/**
|
|
|
|
* Trim important fields, removes blank row entries, and checks for duplicates.
|
|
|
|
*
|
|
|
|
* @return bool - true if tables are OK, else false.
|
|
|
|
*/
|
|
|
|
bool verifyTables();
|
|
|
|
|
|
|
|
void pageChangedHandler( wxAuiNotebookEvent& event ) override;
|
|
|
|
void appendRowHandler( wxCommandEvent& event ) override;
|
2020-01-03 15:09:26 +00:00
|
|
|
void browseLibrariesHandler( wxCommandEvent& event );
|
2018-03-14 04:51:59 +00:00
|
|
|
void deleteRowHandler( wxCommandEvent& event ) override;
|
|
|
|
void moveUpHandler( wxCommandEvent& event ) override;
|
|
|
|
void moveDownHandler( wxCommandEvent& event ) override;
|
|
|
|
void onSizeGrid( wxSizeEvent& event ) override;
|
|
|
|
|
|
|
|
void adjustPathSubsGridColumns( int aWidth );
|
|
|
|
|
|
|
|
/// Populate the readonly environment variable table with names and values
|
|
|
|
/// by examining all the full_uri columns.
|
|
|
|
void populateEnvironReadOnlyTable();
|
|
|
|
|
|
|
|
// caller's tables are modified only on OK button and successful verification.
|
|
|
|
FP_LIB_TABLE* m_global;
|
|
|
|
FP_LIB_TABLE* m_project;
|
2018-08-06 18:33:28 +00:00
|
|
|
wxString m_projectBasePath;
|
2018-03-14 04:51:59 +00:00
|
|
|
|
|
|
|
FP_LIB_TABLE_GRID* global_model() const
|
|
|
|
{
|
|
|
|
return (FP_LIB_TABLE_GRID*) m_global_grid->GetTable();
|
|
|
|
}
|
|
|
|
|
|
|
|
FP_LIB_TABLE_GRID* project_model() const
|
|
|
|
{
|
2020-08-07 19:22:15 +00:00
|
|
|
return m_project_grid ? (FP_LIB_TABLE_GRID*) m_project_grid->GetTable() : nullptr;
|
2018-03-14 04:51:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FP_LIB_TABLE_GRID* cur_model() const
|
|
|
|
{
|
|
|
|
return (FP_LIB_TABLE_GRID*) m_cur_grid->GetTable();
|
|
|
|
}
|
|
|
|
|
2018-07-19 19:15:40 +00:00
|
|
|
DIALOG_EDIT_LIBRARY_TABLES* m_parent;
|
|
|
|
|
2018-08-19 16:10:14 +00:00
|
|
|
WX_GRID* m_cur_grid; // changed based on tab choice
|
2018-03-14 04:51:59 +00:00
|
|
|
static size_t m_pageNdx; // Remember last notebook page selected during a session
|
|
|
|
};
|
|
|
|
|
2018-07-19 19:15:40 +00:00
|
|
|
#endif // PANEL_FP_LIB_TABLE_H
|