2018-07-20 17:46:56 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2017 Wayne Stambaugh <stambaughw@gmail.com>
|
2020-11-01 13:30:27 +00:00
|
|
|
* Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-07-20 17:46:56 +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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PANEL_SYM_LIB_TABLE_H
|
|
|
|
#define PANEL_SYM_LIB_TABLE_H
|
|
|
|
|
2022-06-08 21:05:47 +00:00
|
|
|
#include <grid_tricks.h>
|
2020-10-25 13:36:19 +00:00
|
|
|
#include <dialogs/dialog_edit_library_tables.h>
|
2018-07-20 17:46:56 +00:00
|
|
|
#include <panel_sym_lib_table_base.h>
|
2022-06-08 21:05:47 +00:00
|
|
|
#include <lib_table_grid.h>
|
2020-12-13 11:39:53 +00:00
|
|
|
|
2018-07-20 17:46:56 +00:00
|
|
|
class SYMBOL_LIB_TABLE;
|
|
|
|
class SYMBOL_LIB_TABLE_GRID;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dialog to show and edit symbol library tables.
|
|
|
|
*/
|
|
|
|
class PANEL_SYM_LIB_TABLE : public PANEL_SYM_LIB_TABLE_BASE
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2020-12-13 11:39:53 +00:00
|
|
|
PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PROJECT* m_project,
|
2018-08-06 18:33:28 +00:00
|
|
|
SYMBOL_LIB_TABLE* aGlobal, const wxString& aGlobalTablePath,
|
2020-12-13 11:39:53 +00:00
|
|
|
SYMBOL_LIB_TABLE* aProject, const wxString& aProjectTablePath );
|
2018-07-20 17:46:56 +00:00
|
|
|
virtual ~PANEL_SYM_LIB_TABLE();
|
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* 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-07-20 17:46:56 +00:00
|
|
|
void browseLibrariesHandler( wxCommandEvent& event ) override;
|
|
|
|
void appendRowHandler( wxCommandEvent& event ) override;
|
|
|
|
void deleteRowHandler( wxCommandEvent& event ) override;
|
|
|
|
void moveUpHandler( wxCommandEvent& event ) override;
|
|
|
|
void moveDownHandler( wxCommandEvent& event ) override;
|
|
|
|
void onSizeGrid( wxSizeEvent& event ) override;
|
|
|
|
void adjustPathSubsGridColumns( int aWidth );
|
2020-12-13 11:39:53 +00:00
|
|
|
void onConvertLegacyLibraries( wxCommandEvent& event ) override;
|
2018-07-20 17:46:56 +00:00
|
|
|
|
|
|
|
bool TransferDataFromWindow() override;
|
|
|
|
|
|
|
|
/// Populate the readonly environment variable table with names and values
|
|
|
|
/// by examining all the full_uri columns.
|
|
|
|
void populateEnvironReadOnlyTable();
|
|
|
|
|
2020-12-13 11:39:53 +00:00
|
|
|
bool convertLibrary( const wxString& aLibrary, const wxString& legacyFilepath,
|
|
|
|
const wxString& newFilepath );
|
2018-07-20 17:46:56 +00:00
|
|
|
|
|
|
|
SYMBOL_LIB_TABLE_GRID* global_model() const;
|
|
|
|
|
|
|
|
SYMBOL_LIB_TABLE_GRID* project_model() const;
|
|
|
|
|
|
|
|
SYMBOL_LIB_TABLE_GRID* cur_model() const;
|
|
|
|
|
2023-04-27 10:54:18 +00:00
|
|
|
/**
|
|
|
|
* @return true if the plugin type can be selected from the library path only
|
|
|
|
* (i.e. only from its extension)
|
|
|
|
* if the type needs an access to the file itself, return false because
|
|
|
|
* the file can be not (at least temporary) available
|
|
|
|
*/
|
|
|
|
bool allowAutomaticPluginTypeSelection( wxString& aLibraryPath );
|
|
|
|
|
2020-12-13 11:39:53 +00:00
|
|
|
private:
|
|
|
|
// Caller's tables are modified only on OK button and successful verification.
|
|
|
|
SYMBOL_LIB_TABLE* m_globalTable;
|
|
|
|
SYMBOL_LIB_TABLE* m_projectTable;
|
|
|
|
PROJECT* m_project;
|
|
|
|
|
2018-07-20 17:46:56 +00:00
|
|
|
DIALOG_EDIT_LIBRARY_TABLES* m_parent;
|
|
|
|
|
2020-12-13 11:39:53 +00:00
|
|
|
WX_GRID* m_cur_grid; ///< changed based on tab choice
|
|
|
|
static size_t m_pageNdx; ///< Remember the last notebook page selected
|
2021-01-31 23:59:47 +00:00
|
|
|
wxString m_lastProjectLibDir; //< Transient (unsaved) last browsed folder when adding a project level library
|
2018-07-20 17:46:56 +00:00
|
|
|
};
|
|
|
|
|
2018-08-06 18:33:28 +00:00
|
|
|
|
|
|
|
void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent );
|
|
|
|
|
|
|
|
|
2018-07-20 17:46:56 +00:00
|
|
|
#endif // PANEL_SYM_LIB_TABLE_H
|