You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.3 KiB

  1. /**
  2. * @file dialog_symbol_remap.h
  3. */
  4. /*
  5. * This program source code file is part of KiCad, a free EDA CAD application.
  6. *
  7. * Copyright (C) 2017 Wayne Stambaugh <stambaughw@verizon.net>
  8. * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
  9. *
  10. * This program is free software: you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation, either version 3 of the License, or (at your
  13. * option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License along
  21. * with this program. If not, see <http://www.gnu.org/licenses/>.
  22. */
  23. #include <dialog_symbol_remap_base.h>
  24. #ifndef _DIALOG_SYMBOL_REMAP_H_
  25. #define _DIALOG_SYMBOL_REMAP_H_
  26. class SYMBOL_LIB;
  27. class SCH_SYMBOL;
  28. class REPORTER;
  29. class DIALOG_SYMBOL_REMAP : public DIALOG_SYMBOL_REMAP_BASE
  30. {
  31. public:
  32. DIALOG_SYMBOL_REMAP( SCH_EDIT_FRAME* aParent );
  33. void OnRemapSymbols( wxCommandEvent& aEvent ) override;
  34. protected:
  35. void OnUpdateUIRemapButton( wxUpdateUIEvent& aEvent ) override;
  36. private:
  37. /**
  38. * Add libraries found in the legacy library list to \a aLibs that are not found in
  39. * the global symbol library table.
  40. *
  41. * This function is used to create a project symbol library table when converting
  42. * legacy projects over to the new symbol library table implementation. This only
  43. * needs to be called the first time a legacy project is opened. The cache library
  44. * is ignored.
  45. *
  46. * @param aLibs is a vector container to add all of the libraries not found in the
  47. * global symbol library table that were found in the legacy library
  48. * list.
  49. * @return the number of libraries found.
  50. */
  51. size_t getLibsNotInGlobalSymbolLibTable( std::vector< SYMBOL_LIB* >& aLibs );
  52. void createProjectSymbolLibTable( REPORTER& aReporter );
  53. void remapSymbolsToLibTable( REPORTER& aReporter );
  54. bool remapSymbolToLibTable( SCH_SYMBOL* aSymbol );
  55. /**
  56. * Backup all of the files that could be modified by the remapping with a time stamp
  57. * appended to the file name into the "remap_backup" folder in case something goes wrong.
  58. *
  59. * Backup the following:
  60. * - All schematic (prj-name.sch -> remap_backup/prj-name-time-stamp.sch ) files.
  61. * - The project (prj-name.pro) -> remap_backup/prj-name-time-stamp.pro) file.
  62. * - The cache library (prj-name-cache.lib -> remap_backup/prj-name.-cache-time-stamp.lib)
  63. * file.
  64. * - The rescue library (prj-name-rescue.lib -> remap_backup/prj-name.rescue-time-stamp.lib)
  65. * file.
  66. * - The rescue library (prj-name-rescue.dcm -> remap_backup/prj-name.rescue-time-stamp.dcm)
  67. * file.
  68. *
  69. * @param aReporter is the #REPORTER object in which to write information messages.
  70. * @return true to continue rescue or false to abort rescue.
  71. */
  72. bool backupProject( REPORTER& aReporter );
  73. bool m_remapped;
  74. SCH_EDIT_FRAME* m_frame;
  75. };
  76. #endif // _DIALOG_SYMBOL_REMAP_H_