2018-03-14 04:51:59 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-08-13 02:26:06 +00:00
|
|
|
* Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-03-14 04:51:59 +00:00
|
|
|
*
|
|
|
|
* 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-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>
|
2023-12-19 17:39:26 +00:00
|
|
|
#include <pcb_io/pcb_io_mgr.h>
|
2018-03-14 04:51:59 +00:00
|
|
|
|
|
|
|
class FP_LIB_TABLE;
|
|
|
|
class FP_LIB_TABLE_GRID;
|
2023-08-28 20:44:10 +00:00
|
|
|
class PROJECT;
|
2018-03-14 04:51:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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:
|
2023-08-28 20:44:10 +00:00
|
|
|
PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PROJECT* aProject,
|
|
|
|
FP_LIB_TABLE* aGlobalTable, const wxString& aGlobalTblPath,
|
|
|
|
FP_LIB_TABLE* aProjectTable, const wxString& aProjectTblPath,
|
2018-08-06 18:33:28 +00:00
|
|
|
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();
|
|
|
|
|
2020-11-14 20:12:49 +00:00
|
|
|
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
2018-03-14 04:51:59 +00:00
|
|
|
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;
|
2023-08-28 20:44:10 +00:00
|
|
|
void onMigrateLibraries( wxCommandEvent& event ) override;
|
2018-03-14 04:51:59 +00:00
|
|
|
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();
|
2023-08-13 02:26:06 +00:00
|
|
|
void populatePluginList();
|
2023-12-19 17:39:26 +00:00
|
|
|
|
2023-08-28 20:44:10 +00:00
|
|
|
bool convertLibrary( STRING_UTF8_MAP* aOldFileProps, const wxString& aOldFilePath,
|
|
|
|
const wxString& aNewFilePath );
|
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();
|
|
|
|
}
|
|
|
|
|
2021-06-04 16:21:48 +00:00
|
|
|
// caller's tables are modified only on OK button and successful verification.
|
2023-08-28 20:44:10 +00:00
|
|
|
FP_LIB_TABLE* m_globalTable;
|
|
|
|
FP_LIB_TABLE* m_projectTable;
|
|
|
|
PROJECT* m_project;
|
2021-06-04 16:21:48 +00:00
|
|
|
wxString m_projectBasePath;
|
|
|
|
|
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
|
2021-01-31 23:53:44 +00:00
|
|
|
|
2021-06-04 16:21:48 +00:00
|
|
|
//< Transient (unsaved) last browsed folder when adding a project level library.
|
|
|
|
wxString m_lastProjectLibDir;
|
2023-08-13 02:26:06 +00:00
|
|
|
|
2023-12-27 16:34:59 +00:00
|
|
|
std::map<PCB_IO_MGR::PCB_FILE_T, IO_BASE::IO_FILE_DESC> m_supportedFpFiles;
|
2018-03-14 04:51:59 +00:00
|
|
|
};
|
|
|
|
|
2018-07-19 19:15:40 +00:00
|
|
|
#endif // PANEL_FP_LIB_TABLE_H
|