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.

513 lines
17 KiB

Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Use legacy schematic plugin for loading schematics in all code paths. Use the legacy plugin schematic loader in the sheet edit and append schematic code paths. Check for fully qualified LIB_ID objects (must have library nickname) when loading existing schematics when edit sheets. Rewrite append schematic feature to handle import issues rather than change the name and file name of all of the sheets in the imported schematic. This includes the following: - Load the schematic into a temporary SCH_SHEET object. - Make sure the imported schematic does not cause any hierarchy recursion issues. - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table). - Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes: - Check if the symbol library already exists in the project or global symbol library table. - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project. - Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes. - Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes. - Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic. - Clear all of the annotation in the imported schematic to prevent clashes. - Append the objects from the temporary sheet to the current page. - Replace any duplicate time stamps. - Refresh the symbol library links. Add support code to SCH_SCREEN object to assist with schematic import. Doxygen comment cleaning. Fixes lp:1731760 https://bugs.launchpad.net/kicad/+bug/1731760
8 years ago
Modular-Kicad milestone B), major portions: *) Rework the set language support, simplify it by using KIWAY. Now any major frame with a "change language" menu can change the language for all KIWAY_PLAYERs in the whole KIWAY. Multiple KIWAYs are not supported yet. *) Simplify "modal wxFrame" support, and add that support exclusively to KIWAY_PLAYER where it is inherited by all derivatives. The function KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable. *) Remove the requirements and assumptions that the wxFrame hierarchy always had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers and editors. This is no longer the case, nor required. *) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame quickly. It also gives control to the KIWAY as to frame hierarchical relationships. *) Change single_top to use the KIWAY for loading a KIFACE and instantiating the single KIWAY_PLAYER, see bullet immediately above. *) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this gives the KIFACEs a chance to save their final configuration dope to disk. *) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and these modal frames are distinctly different than their non-modal equivalents. KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor, so this is another important reason for having a dedicated FRAME_T for each modal wxFrame. On balance, more lines were deleted than were added to achieve all this.
12 years ago
18 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2004-2018 KiCad Developers, see change_log.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. /**
  25. * @file sheet.cpp
  26. */
  27. #include <fctsys.h>
  28. #include <sch_draw_panel.h>
  29. #include <confirm.h>
  30. #include <kiface_i.h>
  31. #include <project.h>
  32. #include <wildcards_and_files_ext.h>
  33. #include <sch_edit_frame.h>
  34. #include <sch_legacy_plugin.h>
  35. #include <sch_sheet.h>
  36. #include <sch_sheet_path.h>
  37. #include <sch_view.h>
  38. #include <dialogs/dialog_sch_sheet_props.h>
  39. bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
  40. bool* aClearAnnotationNewItems )
  41. {
  42. if( aSheet == NULL || aHierarchy == NULL )
  43. return false;
  44. SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the schematic sheet hierarchy.
  45. // Get the new texts
  46. DIALOG_SCH_SHEET_PROPS dlg( this, aSheet );
  47. if( dlg.ShowModal() == wxID_CANCEL )
  48. return false;
  49. wxFileName fileName = dlg.GetFileName();
  50. fileName.SetExt( SchematicFileExtension );
  51. wxString msg;
  52. bool loadFromFile = false;
  53. bool clearAnnotation = false;
  54. SCH_SCREEN* useScreen = NULL;
  55. // Relative file names are relative to the path of the current sheet. This allows for
  56. // nesting of schematic files in subfolders.
  57. if( !fileName.IsAbsolute() )
  58. {
  59. const SCH_SCREEN* currentScreen = aHierarchy->LastScreen();
  60. wxCHECK_MSG( currentScreen, false, "Invalid sheet path object." );
  61. wxFileName currentSheetFileName = currentScreen->GetFileName();
  62. wxCHECK_MSG( fileName.Normalize( wxPATH_NORM_ALL, currentSheetFileName.GetPath() ), false,
  63. "Cannot normalize new sheet schematic file path." );
  64. }
  65. wxString newFilename = fileName.GetFullPath();
  66. // Search for a schematic file having the same filename
  67. // already in use in the hierarchy or on disk, in order to reuse it.
  68. if( !g_RootSheet->SearchHierarchy( newFilename, &useScreen ) )
  69. {
  70. loadFromFile = wxFileExists( newFilename );
  71. wxLogDebug( "Sheet requested file \"%s\", %s",
  72. newFilename,
  73. ( loadFromFile ) ? "found" : "not found" );
  74. }
  75. // Inside Eeschema, filenames are stored using unix notation
  76. newFilename.Replace( wxT( "\\" ), wxT( "/" ) );
  77. SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
  78. if( aSheet->GetScreen() == NULL ) // New sheet.
  79. {
  80. if( useScreen || loadFromFile ) // Load from existing file.
  81. {
  82. clearAnnotation = true;
  83. wxString existsMsg;
  84. wxString linkMsg;
  85. existsMsg.Printf( _( "\"%s\" already exists." ), fileName.GetFullName() );
  86. linkMsg.Printf( _( "Link \"%s\" to this file?" ), dlg.GetSheetName() );
  87. msg.Printf( wxT( "%s\n\n%s" ), existsMsg, linkMsg );
  88. if( !IsOK( this, msg ) )
  89. return false;
  90. }
  91. else // New file.
  92. {
  93. aSheet->SetScreen( new SCH_SCREEN( &Kiway() ) );
  94. aSheet->GetScreen()->SetModify();
  95. aSheet->GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
  96. aSheet->GetScreen()->SetFileName( newFilename );
  97. }
  98. }
  99. else // Existing sheet.
  100. {
  101. bool isUndoable = true;
  102. bool renameFile = false;
  103. wxString replaceMsg;
  104. wxString newMsg;
  105. wxString noUndoMsg;
  106. // Changing the filename of a sheet can modify the full hierarchy structure
  107. // and can be not always undoable.
  108. // So prepare messages for user notifications:
  109. replaceMsg.Printf( _( "Change \"%s\" link from \"%s\" to \"%s\"?" ),
  110. dlg.GetSheetName(), aSheet->GetFileName(), fileName.GetFullName() );
  111. newMsg.Printf( _( "Create new file \"%s\" with contents of \"%s\"?" ),
  112. fileName.GetFullName(), aSheet->GetFileName() );
  113. noUndoMsg = _( "This action cannot be undone." );
  114. // We are always using here a case insensitive comparison
  115. // to avoid issues under Windows, although under Unix
  116. // filenames are case sensitive.
  117. // But many users create schematic under both Unix and Windows
  118. // **
  119. // N.B. 1: aSheet->GetFileName() will return a relative path
  120. // aSheet->GetScreen()->GetFileName() returns a full path
  121. //
  122. // N.B. 2: newFilename uses the unix notation for separator.
  123. // so we must use it also to compare the old filename to the new filename
  124. wxString oldFilename = aSheet->GetScreen()->GetFileName();
  125. oldFilename.Replace( wxT( "\\" ), wxT( "/" ) );
  126. if( newFilename.CmpNoCase( oldFilename ) != 0 )
  127. {
  128. // Sheet file name changes cannot be undone.
  129. isUndoable = false;
  130. if( useScreen || loadFromFile ) // Load from existing file.
  131. {
  132. clearAnnotation = true;
  133. msg.Printf( wxT( "%s\n\n%s" ), replaceMsg, noUndoMsg );
  134. if( !IsOK( this, msg ) )
  135. return false;
  136. if( loadFromFile )
  137. aSheet->SetScreen( NULL );
  138. }
  139. else // Save to new file name.
  140. {
  141. if( aSheet->GetScreenCount() > 1 )
  142. {
  143. msg.Printf( wxT( "%s\n\n%s" ), newMsg, noUndoMsg );
  144. if( !IsOK( this, msg ) )
  145. return false;
  146. }
  147. renameFile = true;
  148. }
  149. }
  150. m_canvas->SetIgnoreMouseEvents( true );
  151. if( isUndoable )
  152. SaveCopyInUndoList( aSheet, UR_CHANGED );
  153. if( renameFile )
  154. {
  155. // If the the associated screen is shared by more than one sheet, do not
  156. // change the filename of the corresponding screen here.
  157. // (a new screen will be created later)
  158. // if it is not shared, update the filename
  159. if( aSheet->GetScreenCount() <= 1 )
  160. aSheet->GetScreen()->SetFileName( newFilename );
  161. try
  162. {
  163. pi->Save( newFilename, aSheet->GetScreen(), &Kiway() );
  164. }
  165. catch( const IO_ERROR& ioe )
  166. {
  167. msg.Printf( _( "Error occurred saving schematic file \"%s\"." ), newFilename );
  168. DisplayErrorMessage( this, msg, ioe.What() );
  169. msg.Printf( _( "Failed to save schematic \"%s\"" ), newFilename );
  170. AppendMsgPanel( wxEmptyString, msg, CYAN );
  171. return false;
  172. }
  173. // If the the associated screen is shared by more than one sheet, remove the
  174. // screen and reload the file to a new screen. Failure to do this will trash
  175. // the screen reference counting in complex hierarchies.
  176. if( aSheet->GetScreenCount() > 1 )
  177. {
  178. aSheet->SetScreen( NULL );
  179. loadFromFile = true;
  180. }
  181. }
  182. }
  183. wxFileName userFileName = dlg.GetFileName();
  184. userFileName.SetExt( SchematicFileExtension );
  185. aSheet->SetFileName( userFileName.GetFullPath( wxPATH_UNIX ) );
  186. if( useScreen )
  187. {
  188. aSheet->SetScreen( useScreen );
  189. }
  190. else if( loadFromFile )
  191. {
  192. try
  193. {
  194. aSheet = pi->Load( newFilename, &Kiway(), aSheet );
  195. if( !pi->GetError().IsEmpty() )
  196. {
  197. DisplayErrorMessage( this,
  198. _( "The entire schematic could not be loaded.\n"
  199. "Errors occurred loading hierarchical sheets." ),
  200. pi->GetError() );
  201. }
  202. }
  203. catch( const IO_ERROR& ioe )
  204. {
  205. msg.Printf( _( "Error occurred loading schematic file \"%s\"." ), newFilename );
  206. DisplayErrorMessage( this, msg, ioe.What() );
  207. msg.Printf( _( "Failed to load schematic \"%s\"" ), newFilename );
  208. AppendMsgPanel( wxEmptyString, msg, CYAN );
  209. return false;
  210. }
  211. }
  212. aSheet->SetFileNameSize( dlg.GetFileNameTextSize() );
  213. aSheet->SetName( dlg.GetSheetName() );
  214. aSheet->SetSheetNameSize( dlg.GetSheetNameTextSize() );
  215. if( aSheet->GetName().IsEmpty() )
  216. aSheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ),
  217. (long unsigned) aSheet->GetTimeStamp() ) );
  218. // Make sure the sheet changes do not cause any recursion.
  219. SCH_SHEET_LIST sheetHierarchy( aSheet );
  220. // Make sure files have fully qualified path and file name.
  221. wxFileName destFn = aHierarchy->Last()->GetFileName();
  222. if( destFn.IsRelative() )
  223. destFn.MakeAbsolute( Prj().GetProjectPath() );
  224. if( hierarchy.TestForRecursion( sheetHierarchy, destFn.GetFullPath( wxPATH_UNIX ) ) )
  225. {
  226. msg.Printf( _( "The sheet changes cannot be made because the destination sheet already "
  227. "has the sheet \"%s\" or one of it's subsheets as a parent somewhere in "
  228. "the schematic hierarchy." ),
  229. newFilename );
  230. DisplayError( this, msg );
  231. return false;
  232. }
  233. // Check to make sure the symbols have been remapped to the symbol library table.
  234. SCH_SCREENS newScreens( aSheet );
  235. if( newScreens.HasNoFullyDefinedLibIds() )
  236. {
  237. msg.Printf(_( "The schematic \"%s\" has not been remapped to the symbol\nlibrary table. "
  238. " The project this schematic belongs to must first be remapped\nbefore it "
  239. "can be imported into the current project." ), fileName.GetFullName() );
  240. DisplayInfoMessage( this, msg );
  241. return false;
  242. }
  243. if( aClearAnnotationNewItems )
  244. *aClearAnnotationNewItems = clearAnnotation;
  245. m_canvas->MoveCursorToCrossHair();
  246. m_canvas->SetIgnoreMouseEvents( false );
  247. GetCanvas()->GetView()->Update( aSheet );
  248. OnModify();
  249. return true;
  250. }
  251. /* Move selected sheet with the cursor.
  252. * Callback function used by m_mouseCaptureCallback.
  253. * Note also now this function is called only when resizing the sheet
  254. * But the (very small code) relative to sheet move is still present here
  255. */
  256. static void resizeSheetWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
  257. bool aErase )
  258. {
  259. BASE_SCREEN* screen = aPanel->GetScreen();
  260. SCH_SHEET* sheet = dynamic_cast<SCH_SHEET*>( screen->GetCurItem() );
  261. if( sheet == nullptr ) // Be sure we are using the right object
  262. return;
  263. wxPoint pos = sheet->GetPosition();
  264. int width = aPanel->GetParent()->GetCrossHairPosition().x - pos.x;
  265. int height = aPanel->GetParent()->GetCrossHairPosition().y - pos.y;
  266. // If the sheet doesn't have any pins, clamp the minimum size to the default values.
  267. width = ( width < MIN_SHEET_WIDTH ) ? MIN_SHEET_WIDTH : width;
  268. height = ( height < MIN_SHEET_HEIGHT ) ? MIN_SHEET_HEIGHT : height;
  269. if( sheet->HasPins() )
  270. {
  271. int gridSizeX = KiROUND( screen->GetGridSize().x );
  272. int gridSizeY = KiROUND( screen->GetGridSize().y );
  273. // If the sheet has pins, use the pin positions to clamp the minimum width and height.
  274. height = ( height < sheet->GetMinHeight() + gridSizeY ) ?
  275. sheet->GetMinHeight() + gridSizeY : height;
  276. width = ( width < sheet->GetMinWidth() + gridSizeX ) ?
  277. sheet->GetMinWidth() + gridSizeX : width;
  278. }
  279. wxPoint grid = aPanel->GetParent()->GetNearestGridPosition(
  280. wxPoint( pos.x + width, pos.y + height ) );
  281. sheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) );
  282. auto panel = static_cast<SCH_DRAW_PANEL*>( aPanel );
  283. auto view = panel->GetView();
  284. view->Hide( sheet );
  285. view->ClearPreview();
  286. view->AddToPreview( sheet->Clone() );
  287. }
  288. // Complete sheet move.
  289. static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
  290. {
  291. SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
  292. SCH_ITEM* item = screen->GetCurItem();
  293. SCH_EDIT_FRAME* parent = (SCH_EDIT_FRAME*) aPanel->GetParent();
  294. if( (item == NULL) || (item->Type() != SCH_SHEET_T) || (parent == NULL) )
  295. return;
  296. parent->SetRepeatItem( NULL );
  297. if( item->IsNew() )
  298. {
  299. delete item;
  300. }
  301. else if( item->IsMoving() || item->IsResized() )
  302. {
  303. parent->RemoveFromScreen( item );
  304. delete item;
  305. item = parent->GetUndoItem();
  306. wxCHECK_RET( item != NULL, wxT( "Cannot restore undefined last sheet item." ) );
  307. parent->AddToScreen( item );
  308. // the owner of item is no more parent, this is the draw list of screen:
  309. parent->SetUndoItem( NULL );
  310. item->ClearFlags();
  311. }
  312. else
  313. {
  314. item->ClearFlags();
  315. }
  316. auto panel = static_cast<SCH_DRAW_PANEL*>( aPanel );
  317. auto view = panel->GetView();
  318. view->ClearPreview();
  319. screen->SetCurItem( NULL );
  320. }
  321. // Create hierarchy sheet.
  322. SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
  323. {
  324. SetRepeatItem( NULL );
  325. SCH_SHEET* sheet = new SCH_SHEET( GetCrossHairPosition() );
  326. sheet->SetFlags( IS_NEW | IS_RESIZED );
  327. sheet->SetTimeStamp( GetNewTimeStamp() );
  328. sheet->SetParent( GetScreen() );
  329. sheet->SetScreen( NULL );
  330. // need to check if this is being added to the GetDrawItems().
  331. // also need to update the hierarchy, if we are adding
  332. // a sheet to a screen that already has multiple instances (!)
  333. GetScreen()->SetCurItem( sheet );
  334. m_canvas->SetMouseCapture( resizeSheetWithMouseCursor, ExitSheet );
  335. m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
  336. m_canvas->CrossHairOff( aDC );
  337. SetCrossHairPosition( sheet->GetResizePosition() );
  338. m_canvas->MoveCursorToCrossHair();
  339. m_canvas->CrossHairOn( aDC );
  340. return sheet;
  341. }
  342. void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
  343. {
  344. if( aSheet == NULL || aSheet->IsNew() )
  345. return;
  346. wxCHECK_RET( aSheet->Type() == SCH_SHEET_T,
  347. wxString::Format( wxT( "Cannot perform sheet resize on %s object." ),
  348. GetChars( aSheet->GetClass() ) ) );
  349. m_canvas->CrossHairOff( aDC );
  350. SetCrossHairPosition( aSheet->GetResizePosition() );
  351. m_canvas->MoveCursorToCrossHair();
  352. m_canvas->CrossHairOn( aDC );
  353. SetUndoItem( aSheet );
  354. aSheet->SetFlags( IS_RESIZED );
  355. std::vector<DANGLING_END_ITEM> emptySet;
  356. aSheet->UpdateDanglingState( emptySet );
  357. m_canvas->SetMouseCapture( resizeSheetWithMouseCursor, ExitSheet );
  358. m_canvas->CallMouseCapture( aDC, wxDefaultPosition, true );
  359. if( aSheet->IsNew() ) // not already in edit, save a copy for undo/redo
  360. SetUndoItem( aSheet );
  361. }
  362. void SCH_EDIT_FRAME::RotateHierarchicalSheet( SCH_SHEET* aSheet, bool aRotCCW )
  363. {
  364. if( aSheet == NULL )
  365. return;
  366. // Save old sheet in undo list if not already in edit, or moving.
  367. if( aSheet->GetFlags() == 0 )
  368. SaveCopyInUndoList( aSheet, UR_CHANGED );
  369. // Rotate the sheet on itself. Sheets do not have a anchor point.
  370. // Rotation is made around it center
  371. wxPoint rotPoint = aSheet->GetBoundingBox().Centre();
  372. // Keep this rotation point on the grid, otherwise all items of this sheet
  373. // will be moved off grid
  374. rotPoint = GetNearestGridPosition( rotPoint );
  375. // rotate CCW, or CW. to rotate CW, rotate 3 times
  376. aSheet->Rotate( rotPoint );
  377. if( !aRotCCW )
  378. {
  379. aSheet->Rotate( rotPoint );
  380. aSheet->Rotate( rotPoint );
  381. }
  382. GetCanvas()->GetView()->Update( aSheet );
  383. OnModify();
  384. }
  385. void SCH_EDIT_FRAME::MirrorSheet( SCH_SHEET* aSheet, bool aFromXaxis )
  386. {
  387. if( aSheet == NULL )
  388. return;
  389. // Save old sheet in undo list if not already in edit, or moving.
  390. if( aSheet->GetFlags() == 0 )
  391. SaveCopyInUndoList( aSheet, UR_CHANGED );
  392. // Mirror the sheet on itself. Sheets do not have a anchor point.
  393. // Mirroring is made around it center
  394. wxPoint mirrorPoint = aSheet->GetBoundingBox().Centre();
  395. if( aFromXaxis ) // mirror relative to Horizontal axis
  396. aSheet->MirrorX( mirrorPoint.y );
  397. else // Mirror relative to vertical axis
  398. aSheet->MirrorY( mirrorPoint.x );
  399. GetCanvas()->GetView()->Update( aSheet );
  400. OnModify();
  401. }