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.

1022 lines
37 KiB

* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
6 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
6 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
6 years ago
6 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
  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 wanadoo.fr
  5. * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
  6. * Copyright (C) 2023 CERN (www.cern.ch)
  7. * Copyright (C) 2004-2024 KiCad Developers, see AUTHORS.txt for contributors.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, you may find one here:
  21. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  22. * or you may search the http://www.gnu.org website for the version 2 license,
  23. * or you may write to the Free Software Foundation, Inc.,
  24. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  25. */
  26. #ifndef SCH_EDIT_FRAME_H
  27. #define SCH_EDIT_FRAME_H
  28. #include <stddef.h>
  29. #include <vector>
  30. #include <wx/cmndata.h>
  31. #include <wx/event.h>
  32. #include <wx/gdicmn.h>
  33. #include <wx/string.h>
  34. #include <wx/treectrl.h>
  35. #include <wx/utils.h>
  36. #include <core/typeinfo.h>
  37. #include <eda_base_frame.h>
  38. #include <eeschema_settings.h>
  39. #include <math/box2.h>
  40. #include <sch_base_frame.h>
  41. #include <template_fieldnames.h>
  42. class SCH_ITEM;
  43. class EDA_ITEM;
  44. class SCH_LINE;
  45. class SCH_TEXT;
  46. class SCH_BITMAP;
  47. class SCH_SHEET;
  48. class SCH_SHEET_PATH;
  49. class SCH_SHEET_PIN;
  50. class SCH_SYMBOL;
  51. class SCH_FIELD;
  52. class SCH_JUNCTION;
  53. class SCHEMATIC;
  54. class SCH_COMMIT;
  55. class DIALOG_BOOK_REPORTER;
  56. class DIALOG_ERC;
  57. class DIALOG_SYMBOL_FIELDS_TABLE;
  58. class DIALOG_SCH_FIND;
  59. class RESCUER;
  60. class HIERARCHY_PANE;
  61. /// Schematic search type used by the socket link with Pcbnew
  62. enum SCH_SEARCH_T
  63. {
  64. HIGHLIGHT_PIN,
  65. HIGHLIGHT_SYMBOL
  66. };
  67. enum SCH_CLEANUP_FLAGS
  68. {
  69. NO_CLEANUP,
  70. LOCAL_CLEANUP,
  71. GLOBAL_CLEANUP
  72. };
  73. wxDECLARE_EVENT( EDA_EVT_SCHEMATIC_CHANGING, wxCommandEvent );
  74. wxDECLARE_EVENT( EDA_EVT_SCHEMATIC_CHANGED, wxCommandEvent );
  75. /**
  76. * Tree view item data for the net navigator.
  77. */
  78. class NET_NAVIGATOR_ITEM_DATA : public wxTreeItemData
  79. {
  80. public:
  81. NET_NAVIGATOR_ITEM_DATA( const SCH_SHEET_PATH& aSheetPath, const SCH_ITEM* aItem ) :
  82. m_sheetPath( aSheetPath ),
  83. m_item( aItem )
  84. {
  85. }
  86. NET_NAVIGATOR_ITEM_DATA() :
  87. m_item( nullptr )
  88. {
  89. }
  90. SCH_SHEET_PATH& GetSheetPath() { return m_sheetPath; }
  91. const SCH_ITEM* GetItem() const { return m_item; }
  92. bool operator==( const NET_NAVIGATOR_ITEM_DATA& aRhs ) const
  93. {
  94. return ( m_sheetPath == aRhs.m_sheetPath ) && ( m_item == aRhs.m_item );
  95. }
  96. NET_NAVIGATOR_ITEM_DATA& operator=( const NET_NAVIGATOR_ITEM_DATA& aItemData )
  97. {
  98. if( this == &aItemData )
  99. return *this;
  100. m_sheetPath = aItemData.m_sheetPath;
  101. m_item = aItemData.m_item;
  102. return *this;
  103. }
  104. private:
  105. SCH_SHEET_PATH m_sheetPath;
  106. const SCH_ITEM* m_item;
  107. };
  108. /**
  109. * Schematic editor (Eeschema) main window.
  110. */
  111. class SCH_EDIT_FRAME : public SCH_BASE_FRAME
  112. {
  113. public:
  114. SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
  115. ~SCH_EDIT_FRAME() override;
  116. SCH_SCREEN* GetScreen() const override;
  117. SELECTION& GetCurrentSelection() override;
  118. SCHEMATIC& Schematic() const;
  119. /**
  120. * Allow edit frame to show/hide hidden pins.
  121. */
  122. bool GetShowAllPins() const override;
  123. /**
  124. * Save changes to the project settings to the project (.pro) file.
  125. */
  126. void SaveProjectLocalSettings() override;
  127. /**
  128. * Load the KiCad project file (*.pro) settings specific to Eeschema.
  129. *
  130. * @return True if the project file was loaded correctly.
  131. */
  132. bool LoadProjectSettings();
  133. void ShowSchematicSetupDialog( const wxString& aInitialPage = wxEmptyString );
  134. void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
  135. void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
  136. void CreateScreens();
  137. void ReCreateHToolbar() override;
  138. void ReCreateVToolbar() override;
  139. void ReCreateOptToolbar() override;
  140. void setupUIConditions() override;
  141. /**
  142. * Get if the current schematic has been modified but not saved.
  143. *
  144. * @return true if the any changes have not been saved
  145. */
  146. bool IsContentModified() const override;
  147. /**
  148. * Must be called after a schematic change in order to set the "modify" flag and update other
  149. * data structures and GUI elements.
  150. */
  151. void OnModify() override;
  152. SEVERITY GetSeverity( int aErrorCode ) const override;
  153. /**
  154. * Return a human-readable description of the current screen.
  155. */
  156. wxString GetScreenDesc() const override;
  157. wxString GetFullScreenDesc() const override;
  158. /**
  159. * Execute a remote command sent via a socket on port KICAD_SCH_PORT_SERVICE_NUMBER (which
  160. * defaults to 4243).
  161. *
  162. * When user selects a footprint or pin in Pcbnew, Eeschema shows that same symbol or pin
  163. * and moves cursor on the item.
  164. *
  165. * Valid commands are:
  166. * \li \c \$PART: \c "reference" Put cursor on symbol.
  167. * \li \c \$PART: \c "reference" \c \$REF: \c "ref" Put cursor on symbol reference.
  168. * \li \c \$PART: \c "reference" \c \$VAL: \c "value" Put cursor on symbol value.
  169. * \li \c \$PART: \c "reference" \c \$PAD: \c "pin name" Put cursor on the symbol pin.
  170. * \li \c \$NET: \c "netname" Highlight a specified net
  171. * \li \c \$CLEAR: \c "HIGHLIGHTED" Clear symbols highlight
  172. * <p>
  173. * They are a keyword followed by a quoted string.
  174. * @param cmdline is the command received from Pcbnew.
  175. */
  176. void ExecuteRemoteCommand( const char* cmdline ) override;
  177. void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
  178. /**
  179. * Refresh the display of any operaintg points. Called after a .op simulation completes.
  180. */
  181. void RefreshOperatingPointDisplay();
  182. /**
  183. * Automatically set the rotation of an item (if the item supports it)
  184. */
  185. void AutoRotateItem( SCH_SCREEN* aScreen, SCH_ITEM* aItem );
  186. /**
  187. * Run the Find or Find & Replace dialog.
  188. */
  189. void ShowFindReplaceDialog( bool aReplace );
  190. /**
  191. * Update the hierarchy navigation tree and history
  192. */
  193. void UpdateHierarchyNavigator();
  194. /**
  195. * Update the hierarchy navigation tree labels.
  196. * No change for the tree, only the labels are updated, after editing a sheet
  197. * name or a sheet number.
  198. */
  199. void UpdateLabelsHierarchyNavigator();
  200. /**
  201. * Update the hierarchy navigation tree selection (cross-probe from schematic to hierarchy
  202. * pane).
  203. */
  204. void UpdateHierarchySelection();
  205. void ShowFindReplaceStatus( const wxString& aMsg, int aStatusTime );
  206. void ClearFindReplaceStatus();
  207. /**
  208. * Notification that the Find dialog has closed.
  209. */
  210. void OnFindDialogClose();
  211. /**
  212. * Break a single segment into two at the specified point.
  213. * @param aCommit Transaction container used to record changes for undo/redo
  214. * @param aSegment Line segment to break
  215. * @param aPoint Point at which to break the segment
  216. * @param aNewSegment Pointer to the newly created segment (if created)
  217. * @param aScreen is the screen to examine
  218. */
  219. void BreakSegment( SCH_COMMIT* aCommit, SCH_LINE* aSegment, const VECTOR2I& aPoint,
  220. SCH_LINE** aNewSegment, SCH_SCREEN* aScreen );
  221. /**
  222. * Check every wire and bus for a intersection at \a aPoint and break into two segments
  223. * at \a aPoint if an intersection is found.
  224. * @param aCommit Transaction container used to record changes for undo/redo
  225. * @param aPoint Test this point for an intersection.
  226. * @param aScreen is the screen to examine.
  227. * @return True if any wires or buses were broken.
  228. */
  229. bool BreakSegments( SCH_COMMIT* aCommit, const VECTOR2I& aPoint, SCH_SCREEN* aScreen );
  230. /**
  231. * Test all junctions and bus entries in the schematic for intersections with wires and
  232. * buses and breaks any intersections into multiple segments.
  233. * @param aCommit Transaction container used to record changes for undo/redo
  234. * @param aScreen is the screen to examine.
  235. * @return True if any wires or buses were broken.
  236. */
  237. bool BreakSegmentsOnJunctions( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen );
  238. /**
  239. * Test all of the connectable objects in the schematic for unused connection points.
  240. * @return True if any connection state changes were made.
  241. */
  242. void TestDanglingEnds();
  243. /**
  244. * Send items to board editor for selection.
  245. *
  246. * This is used for when the eeschema user is using the cross-probe tool.
  247. *
  248. * @param aItems are the items to select
  249. * @param aForce select the element in pcbnew whether or not the user has the select option
  250. * chosen
  251. */
  252. void SendSelectItemsToPcb( const std::vector<EDA_ITEM*>& aItems, bool aForce );
  253. /**
  254. * Send a net name to Pcbnew for highlighting.
  255. *
  256. * @param aNetName is the name of a net, or empty string to clear highlight
  257. */
  258. void SendCrossProbeNetName( const wxString& aNetName );
  259. /**
  260. * Send a connection (net or bus) to Pcbnew for highlighting.
  261. *
  262. * @param aConnection is the connection to highlight
  263. */
  264. void SetCrossProbeConnection( const SCH_CONNECTION* aConnection );
  265. /**
  266. * Tell Pcbnew to clear the existing highlighted net, if one exists
  267. */
  268. void SendCrossProbeClearHighlight();
  269. const wxString& GetHighlightedConnection() const
  270. {
  271. return m_highlightedConn;
  272. }
  273. void SetHighlightedConnection( const wxString& aConnection,
  274. const NET_NAVIGATOR_ITEM_DATA* aSelection = nullptr );
  275. /**
  276. * Check if we are ready to write a netlist file for the current schematic.
  277. *
  278. * Test for some issues (missing or duplicate references and sheet names).
  279. *
  280. * @param aAnnotateMessage a message to put up in case annotation needs to be performed.
  281. * @return true if all is well (i.e. you can call WriteNetListFile next).
  282. */
  283. bool ReadyToNetlist( const wxString& aAnnotateMessage );
  284. /**
  285. * Create a netlist file.
  286. *
  287. * @param aFormat is the netlist format (NET_TYPE_PCBNEW ...).
  288. * @param aFullFileName is the full netlist file name.
  289. * @param aNetlistOptions is the netlist options using OR'ed bits.
  290. * <p>
  291. * For SPICE netlist only:
  292. * if NET_USE_NETNAMES is set, use net names from labels in schematic
  293. * else use net numbers (net codes)
  294. * if NET_USE_X_PREFIX is set : change "U" and "IC" reference prefix to "X"
  295. * </p>
  296. * @param aReporter is a #REPORTER to report error messages, can be a nullptr.
  297. * @return true if success.
  298. */
  299. bool WriteNetListFile( int aFormat, const wxString& aFullFileName, unsigned aNetlistOptions,
  300. REPORTER* aReporter = nullptr );
  301. /**
  302. * Clear the current symbol annotation.
  303. *
  304. * @param aCurrentSheetOnly Where to clear the annotation. See #ANNOTATE_SCOPE_T
  305. */
  306. void DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive );
  307. /**
  308. * Annotate the symbols in the schematic that are not currently annotated. Multi-unit symbols
  309. * are annotated together. E.g. if two symbols were R8A and R8B, they may become R3A and
  310. * R3B, but not R3A and R3C or R3C and R4D.
  311. * @param aCommit Transaction container used to record changes for undo/redo
  312. * @param aAnnotateScope See #ANNOTATE_SCOPE_T
  313. * @param aSortOption Define the annotation order. See #ANNOTATE_ORDER_T.
  314. * @param aAlgoOption Define the annotation style. See #ANNOTATE_ALGO_T.
  315. * @param aRecursive Annotation should descend into and annotate subsheets
  316. * @param aStartNumber The start number for non-sheet-based annotation styles.
  317. * @param aResetAnnotation Clear any previous annotation if true. Otherwise, keep the
  318. * existing symbol annotation.
  319. * @param aRepairTimestamps Test for and repair any duplicate time stamps if true.
  320. * Otherwise, keep the existing time stamps. This option
  321. * could change previous annotation because time stamps are
  322. * used to handle annotation in complex hierarchies.
  323. * @param aReporter A sink for error messages. Use NULL_REPORTER if you don't need errors.
  324. *
  325. * When the sheet number is used in annotation, each sheet annotation starts from sheet
  326. * number * 100. In other words the first sheet uses 100 to 199, the second sheet uses
  327. * 200 to 299, and so on.
  328. */
  329. void AnnotateSymbols( SCH_COMMIT* aCommit, ANNOTATE_SCOPE_T aAnnotateScope,
  330. ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption,
  331. bool aRecursive, int aStartNumber, bool aResetAnnotation,
  332. bool aRepairTimestamps, REPORTER& aReporter );
  333. /**
  334. * Check for annotation errors.
  335. *
  336. * The following list of items are checked:
  337. * - Symbols that are not annotated.
  338. * - Duplicate symbol references.
  339. * - Multiple part per package symbols where the part number is greater number of parts in
  340. * the package.
  341. * - Multiple part per package symbols where the reference designator is different between
  342. * parts.
  343. *
  344. * @return Number of annotation errors found.
  345. * @param aReporter A handler for error reporting.
  346. * @param aAnnotateScope See #ANNOTATE_SCOPE_T Check the current sheet only if true.
  347. * Otherwise check the entire schematic.
  348. */
  349. int CheckAnnotate( ANNOTATION_ERROR_HANDLER aErrorHandler,
  350. ANNOTATE_SCOPE_T aAnnotateScope = ANNOTATE_ALL,
  351. bool aRecursive = true );
  352. /**
  353. * Run a modal version of the annotate dialog for a specific purpose.
  354. *
  355. * @param aMessage A user message indicating the purpose.
  356. * @return the result of ShowModal()
  357. */
  358. int ModalAnnotate( const wxString& aMessage );
  359. // Functions used for hierarchy handling
  360. SCH_SHEET_PATH& GetCurrentSheet() const;
  361. void SetCurrentSheet( const SCH_SHEET_PATH& aSheet );
  362. void UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete = false,
  363. bool aUpdateRtree = false ) override;
  364. /**
  365. * Rebuild the GAL and redraw the screen. Call when something went wrong.
  366. */
  367. void HardRedraw() override;
  368. /**
  369. * Draw the current sheet on the display.
  370. */
  371. void DisplayCurrentSheet();
  372. /**
  373. * Use the wxWidgets print code to draw an image of the current sheet onto the clipboard.
  374. */
  375. void DrawCurrentSheetToClipboard();
  376. /**
  377. * Called when modifying the page settings.
  378. *
  379. * In derived classes it can be used to modify parameters like draw area size, and any other
  380. * local parameter related to the page settings.
  381. */
  382. void OnPageSettingsChange() override;
  383. /**
  384. * Set the m_ScreenNumber and m_NumberOfScreens members for screens.
  385. *
  386. * @note This must be called after deleting or adding a sheet and when entering a sheet.
  387. */
  388. void SetSheetNumberAndCount();
  389. wxPageSetupDialogData& GetPageSetupData() { return m_pageSetupData; }
  390. void NewProject();
  391. void LoadProject();
  392. /**
  393. * Save the currently-open schematic (including its hierarchy) and associated project.
  394. *
  395. * @param aSaveAs is true to perform a Save As operation (rename the schematic and project).
  396. * This may only be done in standalone mode.
  397. * @return true if the schematic was saved
  398. */
  399. bool SaveProject( bool aSaveAs = false );
  400. bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
  401. wxString GetCurrentFileName() const override;
  402. /**
  403. * Import a KiCad schematic into the current sheet.
  404. *
  405. * @return True if the schematic was imported properly.
  406. */
  407. bool AppendSchematic();
  408. /**
  409. * Add a sheet file into the current sheet and updates display
  410. *
  411. * @note Used in AppendSchematic() and SCH_EDIT_TOOL::ddAppendFile() (so it is public)
  412. *
  413. * @param aFullFileName Path and name of sheet
  414. * @return True if the sheet was properly added
  415. */
  416. bool AddSheetAndUpdateDisplay( const wxString aFullFileName );
  417. /**
  418. * Check if any of the screens has unsaved changes and asks the user whether to save or
  419. * drop them.
  420. *
  421. * @return True if user decided to save or drop changes, false if the operation should be
  422. * canceled.
  423. */
  424. bool AskToSaveChanges();
  425. SCH_JUNCTION* AddJunction( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen, const VECTOR2I& aPos );
  426. /**
  427. * Perform routine schematic cleaning including breaking wire and buses and deleting
  428. * identical objects superimposed on top of each other.
  429. * @param aCommit Transaction container used to record changes for undo/redo
  430. * @param aScreen is the screen to examine, or nullptr to examine the current screen
  431. */
  432. void SchematicCleanUp( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen = nullptr );
  433. /**
  434. * If any single wire passes through _both points_, remove the portion between the two points,
  435. * potentially splitting the wire into two.
  436. * @param aCommit Transaction container used to record changes for undo/redo
  437. * @param aStart The starting point for trimmming
  438. * @param aEnd The ending point for trimming
  439. * @return True if any wires were changed by this operation
  440. */
  441. bool TrimWire( SCH_COMMIT* aCommit, const VECTOR2I& aStart, const VECTOR2I& aEnd );
  442. void OnOpenPcbnew( wxCommandEvent& event );
  443. void OnOpenCvpcb( wxCommandEvent& event );
  444. void OnUpdatePCB( wxCommandEvent& event );
  445. void OnAnnotate( wxCommandEvent& event );
  446. /**
  447. * Verify that \a aSheet will not cause a recursion error in \a aCurrentSheet.
  448. *
  449. * @param aSheet is the #SCH_SHEET object to test.
  450. * @param aCurrentSheet is the #SCH_SHEET_PATH where \a aSheet is going to reside.
  451. * @return true if \a aSheet will cause a recursion error in \a aCurrentSheet.
  452. */
  453. bool CheckSheetForRecursion( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurrentSheet );
  454. /**
  455. * Check \a aSchematicFileName for a potential file name case sensitivity clashes.
  456. *
  457. * On platforms where file names are case sensitive, it is possible to schematic sheet
  458. * file names that would cause issues on platforms where file name are case insensitive.
  459. * File names foo.sch and Foo.sch are unique files on Linux and MacOS but on Windows
  460. * this would result in a broken schematic.
  461. *
  462. * @param aSchematicFileName is the absolute path and file name of the file to test.
  463. * @return true if the user accepts the potential file name clash risk.
  464. */
  465. bool AllowCaseSensitiveFileNameClashes( const wxString& aSchematicFileName );
  466. /**
  467. * Edit an existing sheet or add a new sheet to the schematic.
  468. *
  469. * When \a aSheet is a new sheet:
  470. * - and the file name already exists in the schematic hierarchy, the screen associated
  471. * with the sheet found in the hierarchy is associated with \a aSheet.
  472. * - and the file name already exists on the system, then \a aSheet is loaded with the
  473. * existing file.
  474. * - and the file name does not exist in the schematic hierarchy or on the file system,
  475. * then a new screen is created and associated with \a aSheet.
  476. *
  477. * When \a aSheet is an existing sheet:
  478. * - and the file name already exists in the schematic hierarchy, the current associated
  479. * screen is replace by the one found in the hierarchy.
  480. * - and the file name already exists on the system, the current associated screen file
  481. * name is changed and the file is loaded.
  482. * - and the file name does not exist in the schematic hierarchy or on the file system,
  483. * the current associated screen file name is changed and saved to disk.
  484. *
  485. * Note: the screen is not refresh. The caller is responsible to do that
  486. *
  487. * @param aSheet is the sheet to edit
  488. * @param aHierarchy is the current hierarchy containing aSheet
  489. * @param aClearAnnotationNewItems is a reference to a bool to know if the items managed by
  490. * this sheet need to have their annotation cleared i.e. when an existing item list is used.
  491. * it can happens when the edited sheet used an existing file, or becomes a new instance
  492. * of a already existing sheet.
  493. * @param aUpdateHierarchyNavigator is an optional flag to indicate the sheet changes require
  494. * the hierarchy navigator panel to be updated.
  495. */
  496. bool EditSheetProperties( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
  497. bool* aClearAnnotationNewItems,
  498. bool* aUpdateHierarchyNavigator = nullptr );
  499. void InitSheet( SCH_SHEET* aSheet, const wxString& aNewFilename );
  500. /**
  501. * Load a the KiCad schematic file \a aFileName into the sheet \a aSheet.
  502. *
  503. * If \a aSheet does not have a valid #SCH_SCREEN object, the schematic is loaded into
  504. * \a Sheet. Otherwise, it is appended to the current #SCH_SCREEN object.
  505. *
  506. * In order to import a schematic a lot of things have to happen to before the contents
  507. * of the imported schematic can be appended to the current page. The following list
  508. * describes this process:
  509. *
  510. * - Load the schematic into a temporary #SCH_SHEET object.
  511. * - Make sure the imported schematic does not cause any hierarchy recursion issues.
  512. * - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table).
  513. * - Check all of the possible combinations that could cause broken symbol library links
  514. * and give the user the option to cancel the append process. The following conditions
  515. * are check but they still do not guarantee that there will not be any broken symbol
  516. * library links:
  517. * - The source schematic is in the current project path and contains symbol library
  518. * nicknames not found in the project symbol library table. This can happen if the
  519. * schematic is copied to the current project path from another project.
  520. * - The source schematic is in a different path and there are symbol library link nicknames
  521. * that do not exist in either the current symbol library table or the source project
  522. * symbol library table if it exists in the source path.
  523. * - The source schematic is in a different path and contains duplicate symbol library
  524. * nicknames that point to different libraries.
  525. * - Check to see if any symbol libraries need to be added to the current project's symbol
  526. * library table. This includes:
  527. * - Check if the symbol library already exists in the project or global symbol library
  528. * table.
  529. * - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute
  530. * paths. ${KIPRJMOD} will not be the same for this project.
  531. * - Clear all of the annotation in the imported schematic to prevent clashes.
  532. * - Append the objects from the temporary sheet to the current page.
  533. * - Replace any duplicate time stamps.
  534. * - Refresh the symbol library links.
  535. *
  536. * @param aSheet is the sheet to either append or load the schematic.
  537. * @param aCurrentSheet is the current position in the schematic hierarchy used to test for
  538. * possible file recursion issues.
  539. * @param aFileName is the file name to load. The file name is expected to have an absolute
  540. * path.
  541. *
  542. * @return True if the schematic was imported properly.
  543. */
  544. bool LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurrentSheet,
  545. const wxString& aFileName );
  546. /**
  547. * Removes a given junction and heals any wire segments under the junction
  548. *
  549. * @param aItem The junction to delete
  550. */
  551. void DeleteJunction( SCH_COMMIT* aCommit, SCH_ITEM* aItem );
  552. void FlipBodyStyle( SCH_SYMBOL* aSymbol );
  553. void SelectUnit( SCH_SYMBOL* aSymbol, int aUnit );
  554. void SetAltPinFunction( SCH_PIN* aPin, const wxString& aFunction );
  555. /* Undo - redo */
  556. /**
  557. * Create a copy of the current schematic item, and put it in the undo list.
  558. *
  559. * aTypeCommand =
  560. * CHANGED
  561. * NEWITEM
  562. * DELETED
  563. *
  564. * If it is a delete command, items are put on list with the .Flags member
  565. * set to DELETED.
  566. *
  567. * @param aItemToCopy is the schematic item modified by the command to undo.
  568. * @param aTypeCommand is the command type (see enum UNDO_REDO).
  569. * @param aAppend set to true to add the item to the previous undo list.
  570. * @param aDirtyConnectivity set to true if the change can affect connectivity.
  571. */
  572. void SaveCopyInUndoList( SCH_SCREEN* aScreen, SCH_ITEM* aItemToCopy, UNDO_REDO aTypeCommand,
  573. bool aAppend, bool aDirtyConnectivity = true );
  574. /**
  575. * Create a new entry in undo list of commands.
  576. *
  577. * @param aItemsList is the list of items modified by the command to undo/
  578. * @param aTypeCommand is the command type (see enum UNDO_REDO).
  579. * @param aAppend set to true to add the item to the previous undo list.
  580. * @param aDirtyConnectivity set to true if the change can affect connectivity.
  581. */
  582. void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aTypeCommand,
  583. bool aAppend, bool aDirtyConnectivity = true );
  584. /**
  585. * Restore an undo or redo command to put data pointed by \a aList in the previous state.
  586. *
  587. * @param aList a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
  588. */
  589. void PutDataInPreviousState( PICKED_ITEMS_LIST* aList );
  590. /**
  591. * Free the undo or redo list from \a aList element.
  592. *
  593. * - Wrappers are deleted.
  594. * - data pointed by wrappers are deleted if not in use in schematic
  595. * i.e. when they are copy of a schematic item or they are no more in use (DELETED)
  596. *
  597. * @param whichList is the UNDO_REDO_CONTAINER to clear
  598. * @param aItemCount is the count of items to remove. Use < 0 to remove all items from
  599. * the beginning of the list.
  600. */
  601. void ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount = -1 ) override;
  602. /**
  603. * Clone \a aItem and owns that clone in this container.
  604. */
  605. void SaveCopyForRepeatItem( const SCH_ITEM* aItem );
  606. void AddCopyForRepeatItem( const SCH_ITEM* aItem );
  607. /**
  608. * Return the items which are to be repeated with the insert key. Such objects are owned by
  609. * this container, and must be cloned.
  610. */
  611. const std::vector<std::unique_ptr<SCH_ITEM>>& GetRepeatItems() const
  612. {
  613. return m_items_to_repeat;
  614. }
  615. EDA_ITEM* GetItem( const KIID& aId ) const override;
  616. /**
  617. * Perform an undo of the last edit WITHOUT logging a corresponding redo. Used to cancel
  618. * an in-progress operation.
  619. */
  620. void RollbackSchematicFromUndo();
  621. /**
  622. * Create a library \a aFileName that contains all symbols used in the current schematic.
  623. *
  624. * @param aFileName The full path and file name of the archive library.
  625. * @return True if \a aFileName was written successfully.
  626. */
  627. bool CreateArchiveLibrary( const wxString& aFileName );
  628. /**
  629. * Plot or print the current sheet to the clipboard.
  630. */
  631. virtual void PrintPage( const RENDER_SETTINGS* aSettings ) override;
  632. void SetNetListerCommand( const wxString& aCommand ) { m_netListerCommand = aCommand; }
  633. /**
  634. * Reset the execution flags to defaults for external netlist and bom generators.
  635. */
  636. void DefaultExecFlags() { m_exec_flags = wxEXEC_SYNC; }
  637. /**
  638. * Set (adds) specified flags for next execution of external generator of the netlist or bom.
  639. *
  640. * @param aFlags is the wxEXEC_* flags, see wxExecute documentation.
  641. */
  642. void SetExecFlags( const int aFlags ) { m_exec_flags |= aFlags; }
  643. /**
  644. * Clear (removes) specified flags that not needed for next execution of external generator
  645. * of the netlist or bom.
  646. *
  647. * @param aFlags is the wxEXEC_* flags, see wxExecute documentation.
  648. */
  649. void ClearExecFlags( const int aFlags ) { m_exec_flags &= ~( aFlags ); }
  650. wxString GetNetListerCommand() const { return m_netListerCommand; }
  651. /**
  652. * Generate the connection data for the entire schematic hierarchy.
  653. */
  654. void RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS aCleanupFlags );
  655. /**
  656. * Called after the preferences dialog is run.
  657. */
  658. void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
  659. void UpdateNetHighlightStatus();
  660. void ShowChangedLanguage() override;
  661. void SetScreen( BASE_SCREEN* aScreen ) override;
  662. const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override;
  663. int GetSchematicJunctionSize();
  664. void FocusOnItem( SCH_ITEM* aItem );
  665. bool IsSyncingSelection() { return m_syncingPcbToSchSelection; }
  666. /**
  667. * Update a schematic symbol from a LIB_SYMBOL.
  668. *
  669. * This is typically called from the symbol editor when editing symbols in place.
  670. *
  671. * @param aSymbol is the new symbol data.
  672. * @param aSchematicSymbolUUID refers to the schematic symbol to update.
  673. */
  674. void SaveSymbolToSchematic( const LIB_SYMBOL& aSymbol, const KIID& aSchematicSymbolUUID );
  675. /**
  676. * Update the schematic's page reference map for all global labels, and refresh the labels
  677. * so that they are redrawn with up-to-date references.
  678. */
  679. void RecomputeIntersheetRefs();
  680. void ShowAllIntersheetRefs( bool aShow );
  681. /**
  682. * This overloaded version checks if the auto save master file "#auto_saved_files#" exists
  683. * and recovers all of the schematic files listed in it.
  684. *
  685. * @param aFileName is the project auto save master file name.
  686. */
  687. virtual void CheckForAutoSaveFile( const wxFileName& aFileName ) override;
  688. virtual void DeleteAutoSaveFile( const wxFileName& aFileName ) override;
  689. /**
  690. * Toggle the show/hide state of the left side schematic navigation panel
  691. */
  692. void ToggleSchematicHierarchy();
  693. /**
  694. * Toggle the show/hide state of Search pane
  695. */
  696. void ToggleSearch();
  697. void ToggleProperties() override;
  698. DIALOG_BOOK_REPORTER* GetSymbolDiffDialog();
  699. DIALOG_ERC* GetErcDialog();
  700. DIALOG_SYMBOL_FIELDS_TABLE* GetSymbolFieldsTableDialog();
  701. wxTreeCtrl* GetNetNavigator() { return m_netNavigator; }
  702. const SCH_ITEM* GetSelectedNetNavigatorItem() const;
  703. /**
  704. * @return the name of the wxAuiPaneInfo managing the Hierarchy Navigator panel
  705. */
  706. static const wxString SchematicHierarchyPaneName()
  707. {
  708. return wxT( "SchematicHierarchy" );
  709. }
  710. /**
  711. * @return the name of the wxAuiPaneInfo managing the Search panel
  712. */
  713. static const wxString SearchPaneName() { return wxT( "Search" ); }
  714. /**
  715. * Add \a aListener to post #EDA_EVT_SCHEMATIC_CHANGED command events to.
  716. *
  717. * @warning The caller is reponsible for removing any listeners that are no long valid.
  718. *
  719. * @note This only gets called when the schematic editor is in stand alone mode. Changing
  720. * projects in the project manager closes the schematic editor when a new project is
  721. * loaded.
  722. */
  723. void AddSchematicChangeListener( wxEvtHandler* aListener );
  724. /**
  725. * Remove \a aListener to from the schematic changed listener list.
  726. */
  727. void RemoveSchematicChangeListener( wxEvtHandler* aListener );
  728. static const wxString NetNavigatorPaneName()
  729. {
  730. return wxS( "NetNavigator" );
  731. }
  732. void RefreshNetNavigator( const NET_NAVIGATOR_ITEM_DATA* aSelection = nullptr );
  733. void MakeNetNavigatorNode( const wxString& aNetName, wxTreeItemId aParentId,
  734. const NET_NAVIGATOR_ITEM_DATA* aSelection = nullptr );
  735. void SelectNetNavigatorItem( const NET_NAVIGATOR_ITEM_DATA* aSelection = nullptr );
  736. void ToggleNetNavigator();
  737. DECLARE_EVENT_TABLE()
  738. protected:
  739. /**
  740. * Save the schematic files that have been modified and not yet saved.
  741. *
  742. * @return true if the auto save was successful otherwise false.
  743. */
  744. bool doAutoSave() override;
  745. void doReCreateMenuBar() override;
  746. /**
  747. * Send the KiCad netlist over to CVPCB.
  748. */
  749. void sendNetlistToCvpcb();
  750. void onSize( wxSizeEvent& aEvent );
  751. void saveProjectSettings() override;
  752. void onCloseSymbolDiffDialog( wxCommandEvent& aEvent );
  753. void onCloseErcDialog( wxCommandEvent& aEvent );
  754. void onCloseSymbolFieldsTableDialog( wxCommandEvent& aEvent );
  755. void unitsChangeRefresh() override;
  756. void updateSelectionFilterVisbility() override;
  757. private:
  758. // Called when resizing the Hierarchy Navigator panel
  759. void OnResizeHierarchyNavigator( wxSizeEvent& aEvent );
  760. void onResizeNetNavigator( wxSizeEvent& aEvent );
  761. // Sets up the tool framework
  762. void setupTools();
  763. void OnExit( wxCommandEvent& event );
  764. void OnLoadFile( wxCommandEvent& event );
  765. void OnAppendProject( wxCommandEvent& event );
  766. void OnImportProject( wxCommandEvent& event );
  767. void OnClearFileHistory( wxCommandEvent& aEvent );
  768. bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
  769. void doCloseWindow() override;
  770. /**
  771. * Set the main window title bar text.
  772. *
  773. * If file name defined by SCH_SCREEN::m_FileName is not set, the title is set to the
  774. * application name appended with no file.
  775. * Otherwise, the title is set to the hierarchical sheet path and the full file name, and
  776. * read only is appended to the title if the user does not have write access to the file.
  777. */
  778. void updateTitle();
  779. /**
  780. * Initialize the zoom value of the current screen and mark the screen as zoom-initialized.
  781. */
  782. void initScreenZoom();
  783. /**
  784. * Verify that the symbol library links \a aSheet and all of its child sheets have
  785. * been remapped to the symbol library table.
  786. *
  787. * @param aSheet is the #SCH_SHEET object to test.
  788. *
  789. * @return true if \a aSheet and its child sheets have not been remapped.
  790. */
  791. bool checkForNoFullyDefinedLibIds( SCH_SHEET* aSheet );
  792. /**
  793. * Load the given filename but sets the path to the current project path.
  794. *
  795. * @param full filepath of file to be imported.
  796. * @param aFileType SCH_FILE_T value for file type
  797. */
  798. bool importFile( const wxString& aFileName, int aFileType,
  799. const STRING_UTF8_MAP* aProperties = nullptr );
  800. /**
  801. * Save \a aSheet to a schematic file.
  802. *
  803. * @param aSheet is the #SCH_SHEET object to save.
  804. * @param aSavePath is the full path of the destination file
  805. * @return True if the file has been saved.
  806. */
  807. bool saveSchematicFile( SCH_SHEET* aSheet, const wxString& aSavePath );
  808. /**
  809. * Fill a map of uuid -> reference from the currently loaded schematic.
  810. *
  811. * @param aMap is a map to fill
  812. */
  813. void mapExistingAnnotation( std::map<wxString, wxString>& aMap );
  814. bool updateAutoSaveFile();
  815. const wxString& getAutoSaveFileName() const;
  816. wxTreeCtrl* createHighlightedNetNavigator();
  817. void onNetNavigatorSelection( wxTreeEvent& aEvent );
  818. void onNetNavigatorSelChanging( wxTreeEvent& aEvent );
  819. private:
  820. // The schematic editor control class should be able to access some internal
  821. // functions of the editor frame.
  822. friend class SCH_EDITOR_CONTROL;
  823. friend class SCH_FIND_REPLACE_TOOL;
  824. SCHEMATIC* m_schematic; ///< The currently loaded schematic
  825. wxString m_highlightedConn; ///< The highlighted net or bus or empty string.
  826. wxPageSetupDialogData m_pageSetupData;
  827. std::vector<std::unique_ptr<SCH_ITEM>> m_items_to_repeat; ///< For the repeat-last-item cmd
  828. wxString m_netListerCommand; ///< Command line to call a custom net list
  829. ///< generator.
  830. int m_exec_flags; ///< Flags of the wxExecute() function
  831. ///< to call a custom net list generator.
  832. DIALOG_SCH_FIND* m_findReplaceDialog;
  833. DIALOG_ERC* m_ercDialog;
  834. DIALOG_BOOK_REPORTER* m_diffSymbolDialog;
  835. HIERARCHY_PANE* m_hierarchy;
  836. DIALOG_SYMBOL_FIELDS_TABLE* m_symbolFieldsTableDialog;
  837. wxTreeCtrl* m_netNavigator;
  838. bool m_syncingPcbToSchSelection; // Recursion guard when synchronizing selection from PCB
  839. bool m_show_search;
  840. bool m_highlightedConnChanged;
  841. std::vector<wxEvtHandler*> m_schematicChangeListeners;
  842. };
  843. #endif // SCH_EDIT_FRAME_H