2017-03-09 23:33:39 +00:00
|
|
|
/**
|
|
|
|
* @file dialog_symbol_remap.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2017 Wayne Stambaugh <stambaughw@verizon.net>
|
2021-06-10 14:10:55 +00:00
|
|
|
* Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2017-03-09 23:33:39 +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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <dialog_symbol_remap_base.h>
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _DIALOG_SYMBOL_REMAP_H_
|
|
|
|
#define _DIALOG_SYMBOL_REMAP_H_
|
|
|
|
|
|
|
|
|
|
|
|
class PART_LIB;
|
2021-06-10 14:10:55 +00:00
|
|
|
class SCH_SYMBOL;
|
2017-03-09 23:33:39 +00:00
|
|
|
class REPORTER;
|
|
|
|
|
|
|
|
|
|
|
|
class DIALOG_SYMBOL_REMAP : public DIALOG_SYMBOL_REMAP_BASE
|
|
|
|
{
|
|
|
|
public:
|
2017-11-01 00:57:57 +00:00
|
|
|
DIALOG_SYMBOL_REMAP( SCH_EDIT_FRAME* aParent );
|
2017-03-09 23:33:39 +00:00
|
|
|
|
|
|
|
void OnRemapSymbols( wxCommandEvent& aEvent ) override;
|
|
|
|
|
2017-12-18 23:25:34 +00:00
|
|
|
protected:
|
|
|
|
void OnUpdateUIRemapButton( wxUpdateUIEvent& aEvent ) override;
|
|
|
|
|
2017-03-09 23:33:39 +00:00
|
|
|
private:
|
|
|
|
/**
|
2017-11-01 00:57:57 +00:00
|
|
|
* Add libraries found in the legacy library list to \a aLibs that are not found in
|
2017-03-09 23:33:39 +00:00
|
|
|
* the global symbol library table.
|
|
|
|
*
|
|
|
|
* This function is used to create a project symbol library table when converting
|
|
|
|
* legacy projects over to the new symbol library table implementation. This only
|
|
|
|
* needs to be called the first time a legacy project is opened. The cache library
|
|
|
|
* is ignored.
|
|
|
|
*
|
|
|
|
* @param aLibs is a vector container to add all of the libraries not found in the
|
|
|
|
* global symbol library table that were found in the legacy library
|
|
|
|
* list.
|
|
|
|
* @return the number of libraries found.
|
|
|
|
*/
|
|
|
|
size_t getLibsNotInGlobalSymbolLibTable( std::vector< PART_LIB* >& aLibs );
|
|
|
|
|
|
|
|
void createProjectSymbolLibTable( REPORTER& aReporter );
|
|
|
|
|
|
|
|
void remapSymbolsToLibTable( REPORTER& aReporter );
|
|
|
|
|
2021-06-10 14:10:55 +00:00
|
|
|
bool remapSymbolToLibTable( SCH_SYMBOL* aSymbol );
|
2017-11-24 16:43:16 +00:00
|
|
|
|
|
|
|
/**
|
2018-01-03 16:25:19 +00:00
|
|
|
* Backup all of the files that could be modified by the remapping with a time stamp
|
|
|
|
* appended to the file name into the "remap_backup" folder in case something goes wrong.
|
2017-11-24 16:43:16 +00:00
|
|
|
*
|
|
|
|
* Backup the following:
|
2018-01-03 16:25:19 +00:00
|
|
|
* - All schematic (prj-name.sch -> remap_backup/prj-name-time-stamp.sch ) files.
|
|
|
|
* - The project (prj-name.pro) -> remap_backup/prj-name-time-stamp.pro) file.
|
|
|
|
* - The cache library (prj-name-cache.lib -> remap_backup/prj-name.-cache-time-stamp.lib)
|
|
|
|
* file.
|
|
|
|
* - The rescue library (prj-name-rescue.lib -> remap_backup/prj-name.rescue-time-stamp.lib)
|
|
|
|
* file.
|
|
|
|
* - The rescue library (prj-name-rescue.dcm -> remap_backup/prj-name.rescue-time-stamp.dcm)
|
|
|
|
* file.
|
|
|
|
*
|
|
|
|
* @param aReporter is the #REPORTER object in which to write information messages.
|
2018-01-12 15:13:41 +00:00
|
|
|
* @return true to continue rescue or false to abort rescue.
|
2017-11-24 16:43:16 +00:00
|
|
|
*/
|
2018-01-12 15:13:41 +00:00
|
|
|
bool backupProject( REPORTER& aReporter );
|
2017-12-18 23:25:34 +00:00
|
|
|
|
|
|
|
bool m_remapped;
|
2020-05-13 02:00:37 +00:00
|
|
|
|
|
|
|
SCH_EDIT_FRAME* m_frame;
|
2017-03-09 23:33:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _DIALOG_SYMBOL_REMAP_H_
|