kicad/eeschema/sch_edit_frame.h

933 lines
34 KiB
C
Raw Normal View History

/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
2018-01-30 10:49:51 +00:00
#ifndef SCH_EDIT_FRAME_H
#define SCH_EDIT_FRAME_H
#include <stddef.h>
#include <vector>
#include <wx/cmndata.h>
#include <wx/event.h>
#include <wx/gdicmn.h>
#include <wx/string.h>
#include <wx/utils.h>
* 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.
2014-03-20 00:42:08 +00:00
#include <config_params.h>
#include <core/typeinfo.h>
#include <eda_base_frame.h>
#include <eeschema_settings.h>
#include <math/box2.h>
#include <sch_base_frame.h>
#include <sch_text.h> // enum PINSHEETLABEL_SHAPE
#include <template_fieldnames.h>
class STATUS_TEXT_POPUP;
class SCH_ITEM;
class EDA_ITEM;
class SCH_LINE;
class SCH_TEXT;
class SCH_BITMAP;
class SCH_SHEET;
class SCH_SHEET_PATH;
class SCH_SHEET_PIN;
2021-06-10 14:10:55 +00:00
class SCH_SYMBOL;
class SCH_FIELD;
class SCH_JUNCTION;
class SCHEMATIC;
class DIALOG_SCH_FIND;
class wxFindReplaceData;
class RESCUER;
class HIERARCHY_NAVIG_DLG;
Make the new schematic and symbol library file formats the default. This is a very large and potentially disruptive change so this will be an unusually long and detailed commit message. The new file formats are now the default in both the schematic and symbol library editors. Existing symbol libraries will be saved in their current format until new features are added to library symbols. Once this happens, both the legacy schematic and symbol file formats will be no longer be savable and existing libraries will have to be converted. Saving to the legacy file formats is still available for round robin testing and should not be used for normal editing. When loading the legacy schematic file, it is imperative that the schematic library symbols are rescued and/or remapped to valid library identifiers. Otherwise, there will be no way to link to the original library symbol and the user will be required manually set the library identifier. The cached symbol will be saved in the schematic file so the last library symbol in the cache will still be used but there will be no way to update it from the original library. The next save after loading a legacy schematic file will be converted to the s-expression file format. Schematics with hierarchical sheets will automatically have all sheet file name extensions changed to .kicad_sym and saved to the new format as well. Appending schematics requires that the schematic to append has already been converted to the new file format. This is required to ensure that library symbols are guaranteed to be valid for the appended schematic. The schematic symbol library symbol link resolution has been moved out of the SCH_COMPONENT object and move into the SCH_SCREEN object that owns the symbol. This was done to ensure that there is a single place where the library symbol links get resolved rather than the dozen or so different code paths that previously existed. It also removes the necessity of the SCH_COMPONENT object of requiring any knowledge of the symbol library table and/or the cache library. When opening an s-expression schematic, the legacy cache library is not loaded so any library symbols not rescued cannot be loaded. Broken library symbol links will have to be manually resolved by adding the cache library to the symbol library table and changing the links in the schematic symbol. Now that the library symbols are embedded in the schematic file, the SCH_SCREEN object maintains the list of library symbols for the schematic automatically. No external manipulation of this library cache should ever occur. ADDED: S-expression schematic and symbol library file formats.
2020-04-16 16:43:50 +00:00
// @todo Move this to transform alone with all of the transform manipulation code.
* 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.
2014-03-20 00:42:08 +00:00
/// enum used in RotationMiroir()
2021-06-10 14:10:55 +00:00
enum SYMBOL_ORIENTATION_T
{
2021-06-10 14:10:55 +00:00
SYM_NORMAL, // Normal orientation, no rotation or mirror
SYM_ROTATE_CLOCKWISE, // Rotate -90
SYM_ROTATE_COUNTERCLOCKWISE, // Rotate +90
SYM_ORIENT_0, // No rotation and no mirror id SYM_NORMAL
SYM_ORIENT_90, // Rotate 90, no mirror
SYM_ORIENT_180, // Rotate 180, no mirror
SYM_ORIENT_270, // Rotate -90, no mirror
SYM_MIRROR_X = 0x100, // Mirror around X axis
SYM_MIRROR_Y = 0x200 // Mirror around Y axis
};
/** Schematic annotation scope options. */
enum ANNOTATE_SCOPE_T
{
ANNOTATE_ALL, ///< Annotate the full schematic
ANNOTATE_CURRENT_SHEET, ///< Annotate the current sheet
ANNOTATE_SELECTION ///< Annotate the selection
};
/** Schematic annotation order options. */
enum ANNOTATE_ORDER_T
{
SORT_BY_X_POSITION, ///< Annotate by X position from left to right.
SORT_BY_Y_POSITION, ///< Annotate by Y position from top to bottom.
2021-06-10 14:10:55 +00:00
UNSORTED, ///< Annotate by position of symbol in the schematic sheet
///< object list.
};
/** Schematic annotation type options. */
enum ANNOTATE_ALGO_T
{
INCREMENTAL_BY_REF, ///< Annotate incrementally using the first free reference number.
SHEET_NUMBER_X_100, ///< Annotate using the first free reference number starting at
///< the sheet number * 100.
SHEET_NUMBER_X_1000, ///< Annotate using the first free reference number starting at
///< the sheet number * 1000.
};
/// Schematic search type used by the socket link with Pcbnew
enum SCH_SEARCH_T
{
HIGHLIGHT_PIN,
2021-06-10 14:10:55 +00:00
HIGHLIGHT_SYMBOL
};
enum SCH_CLEANUP_FLAGS
{
NO_CLEANUP,
LOCAL_CLEANUP,
GLOBAL_CLEANUP
};
/**
* Schematic editor (Eeschema) main window.
*/
class SCH_EDIT_FRAME : public SCH_BASE_FRAME
{
public:
* 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.
2014-03-20 00:42:08 +00:00
SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
2019-07-02 20:09:23 +00:00
~SCH_EDIT_FRAME() override;
2016-09-25 17:06:49 +00:00
SCH_SCREEN* GetScreen() const override;
SELECTION& GetCurrentSelection() override;
SCHEMATIC& Schematic() const;
/**
* Allow edit frame to show/hide hidden pins.
*/
bool GetShowAllPins() const override;
/**
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
2017-11-17 17:00:04 +00:00
* Save changes to the project settings to the project (.pro) file.
*/
void SaveProjectSettings() override;
/**
2021-03-25 14:07:16 +00:00
* Load the KiCad project file (*.pro) settings specific to Eeschema.
*
* @return True if the project file was loaded correctly.
*/
bool LoadProjectSettings();
void ShowSchematicSetupDialog( const wxString& aInitialPage = wxEmptyString );
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
void CreateScreens();
2016-09-24 18:53:15 +00:00
void ReCreateHToolbar() override;
void ReCreateVToolbar() override;
void ReCreateOptToolbar() override;
2016-09-24 18:53:15 +00:00
void ReCreateMenuBar() override;
void setupUIConditions() override;
/**
* Get if the current schematic has been modified but not saved.
*
* @return true if the any changes have not been saved
*/
bool IsContentModified() const override;
2010-11-12 15:17:10 +00:00
/**
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
2017-11-17 17:00:04 +00:00
* Must be called after a schematic change in order to set the "modify" flag of the
2019-05-08 18:56:03 +00:00
* current screen and update the date in frame reference.
*/
2019-05-08 18:56:03 +00:00
void OnModify() override;
/**
* Scan existing markers and record data from any that are Excluded.
*/
void RecordERCExclusions();
/**
* Update markers to match recorded exclusions.
*/
void ResolveERCExclusions();
2019-07-02 20:09:23 +00:00
/**
* Return a human-readable description of the current screen.
*/
wxString GetScreenDesc() const override;
/**
* Execute a remote command sent by Pcbnew via a socket connection.
2021-06-10 14:10:55 +00:00
*
* When user selects a footprint or pin in Pcbnew, Eeschema shows that same
2021-06-10 14:10:55 +00:00
* symbol or pin and moves cursor on the item. The socket port used
* is #KICAD_SCH_PORT_SERVICE_NUMBER which defaults to 4243.
*
* Valid commands are:
2021-06-10 14:10:55 +00:00
* \li \c \$PART: \c "reference" Put cursor on symbol.
* \li \c \$PART: \c "reference" \c \$REF: \c "ref" Put cursor on symbol reference.
* \li \c \$PART: \c "reference" \c \$VAL: \c "value" Put cursor on symbol value.
* \li \c \$PART: \c "reference" \c \$PAD: \c "pin name" Put cursor on the symbol pin.
* \li \c \$NET: \c "netname" Highlight a specified net
2021-06-10 14:10:55 +00:00
* \li \c \$CLEAR: \c "HIGHLIGHTED" Clear symbols highlight
* <p>
* They are a keyword followed by a quoted string.
2021-03-25 14:07:16 +00:00
* @param cmdline is the command received from Pcbnew.
*/
void ExecuteRemoteCommand( const char* cmdline ) override;
2016-09-25 17:06:49 +00:00
void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
2019-04-15 14:34:58 +00:00
/**
* Add an item to the schematic and adds the changes to the undo/redo container.
* @param aUndoAppend True if the action should be appended to the current undo record.
2019-04-15 14:34:58 +00:00
*/
void AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM* aItem, bool aUndoAppend );
2019-04-15 14:34:58 +00:00
/**
* Run the Find or Find & Replace dialog.
*/
void ShowFindReplaceDialog( bool aReplace );
/**
* Run the Hierarchy Navigator dialog.
* @param aForceUpdate: When true, creates a new dialog. And if a dialog
* already exist, it destroys it first.
*/
void UpdateHierarchyNavigator( bool aForceUpdate = false );
/**
* @return a reference to the Hierarchy Navigator dialog if exists, or nullptr.
*/
HIERARCHY_NAVIG_DLG* FindHierarchyNavigator();
void ShowFindReplaceStatus( const wxString& aMsg, int aStatusTime );
void ClearFindReplaceStatus();
/**
* Get the find criteria (as set by the dialog).
*/
wxFindReplaceData* GetFindReplaceData();
/**
* Notification that the Find dialog has closed.
*/
void OnFindDialogClose();
/**
2021-03-25 14:07:16 +00:00
* Break a single segment into two at the specified point.
*
2021-03-25 14:07:16 +00:00
* @note This always appends to the existing undo state.
*
* @param aSegment Line segment to break
* @param aPoint Point at which to break the segment
* @param aNewSegment Pointer to the newly created segment (if given and created)
2021-03-25 14:07:16 +00:00
* @param aScreen is the screen to examine, or nullptr to examine the current screen.
* @return True if any wires or buses were broken.
*/
bool BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint,
2021-03-25 14:07:16 +00:00
SCH_LINE** aNewSegment = nullptr, SCH_SCREEN* aScreen = nullptr );
/**
2021-03-25 14:07:16 +00:00
* Check every wire and bus for a intersection at \a aPoint and break into two segments
* at \a aPoint if an intersection is found.
*
2021-03-25 14:07:16 +00:00
* @note This always appends to the existing undo state.
*
* @param aPoint Test this point for an intersection.
2021-03-25 14:07:16 +00:00
* @param aScreen is the screen to examine, or nullptr to examine the current screen.
* @return True if any wires or buses were broken.
*/
bool BreakSegments( const wxPoint& aPoint, SCH_SCREEN* aScreen = nullptr );
/**
2021-03-25 14:07:16 +00:00
* Test all junctions and bus entries in the schematic for intersections with wires and
* buses and breaks any intersections into multiple segments.
*
2021-03-25 14:07:16 +00:00
* @note This always appends to the existing undo state.
*
* @param aScreen is the screen to examine, or nullptr to examine the current screen
* @return True if any wires or buses were broken.
*/
bool BreakSegmentsOnJunctions( SCH_SCREEN* aScreen = nullptr );
/**
* Test all of the connectable objects in the schematic for unused connection points.
* @return True if any connection state changes were made.
*/
void TestDanglingEnds();
/**
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
2017-11-17 17:00:04 +00:00
* Send a message to Pcbnew via a socket connection.
*
* Commands are:
* - $PART: reference put cursor on footprint anchor
* - $PIN: number $PART: reference put cursor on the footprint pad
2021-06-10 14:10:55 +00:00
* - $SHEET: time_stamp select all footprints of symbols is the schematic sheet path
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
2017-11-17 17:00:04 +00:00
*
2021-03-25 14:07:16 +00:00
* @param aObjectToSync is the item to be located on board.
* @param aPart is the symbol if \a aObjectToSync is a sub item of a symbol (like a pin).
*/
2021-06-10 14:10:55 +00:00
void SendMessageToPCBNEW( EDA_ITEM* aObjectToSync, SCH_SYMBOL* aPart );
/**
2021-03-25 14:07:16 +00:00
* Sends a net name to Pcbnew for highlighting
*
* @param aNetName is the name of a net, or empty string to clear highlight
*/
void SendCrossProbeNetName( const wxString& aNetName );
/**
2021-03-25 14:07:16 +00:00
* Send a connection (net or bus) to Pcbnew for highlighting.
*
* @param aConnection is the connection to highlight
*/
void SetCrossProbeConnection( const SCH_CONNECTION* aConnection );
/**
2021-03-25 14:07:16 +00:00
* Tell Pcbnew to clear the existing highlighted net, if one exists
*/
void SendCrossProbeClearHighlight();
const SCH_CONNECTION* GetHighlightedConnection() const
{
return m_highlightedConn;
}
void SetHighlightedConnection( const SCH_CONNECTION* aConnection )
{
m_highlightedConn = aConnection;
}
2010-11-12 15:17:10 +00:00
/**
2021-03-25 14:07:16 +00:00
* Check if we are ready to write a netlist file for the current schematic.
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
2017-11-17 17:00:04 +00:00
*
2021-03-25 14:07:16 +00:00
* Test for some issues (missing or duplicate references and sheet names).
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
2017-11-17 17:00:04 +00:00
*
2021-03-25 14:07:16 +00:00
* @param aAnnotateMessage a message to put up in case annotation needs to be performed.
* @return true if all is well (i.e. you can call WriteNetListFile next).
*/
bool ReadyToNetlist( const wxString& aAnnotateMessage );
2010-11-12 15:17:10 +00:00
/**
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
2017-11-17 17:00:04 +00:00
* Create a netlist file.
*
2021-03-25 14:07:16 +00:00
* @param aFormat is the netlist format (NET_TYPE_PCBNEW ...).
* @param aFullFileName is the full netlist file name.
* @param aNetlistOptions is the netlist options using OR'ed bits.
* <p>
* For SPICE netlist only:
* if NET_USE_NETNAMES is set, use net names from labels in schematic
* else use net numbers (net codes)
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
2017-11-17 17:00:04 +00:00
* if NET_USE_X_PREFIX is set : change "U" and "IC" reference prefix to "X"
* </p>
2021-03-25 14:07:16 +00:00
* @param aReporter is a #REPORTER to report error messages, can be a nullptr.
* @return true if success.
*/
2021-03-25 14:07:16 +00:00
bool WriteNetListFile( int aFormat, const wxString& aFullFileName, unsigned aNetlistOptions,
REPORTER* aReporter = nullptr );
/**
2021-06-10 14:10:55 +00:00
* Clear the current symbol annotation.
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
2017-11-17 17:00:04 +00:00
*
* @param aCurrentSheetOnly Where to clear the annotation. See #ANNOTATE_SCOPE_T
* @param appendUndo true to add the action to the previous undo list
*/
void DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool* appendUndo );
/**
* Annotate the symbols in the schematic that are not currently annotated. Multi-unit symbols
2021-06-10 14:10:55 +00:00
* are annotated together. E.g. if two symbols were R8A and R8B, they may become R3A and
* R3B, but not R3A and R3C or R3C and R4D.
*
* @param aAnnotateScope See #ANNOTATE_SCOPE_T
* @param aSortOption Define the annotation order. See #ANNOTATE_ORDER_T.
* @param aAlgoOption Define the annotation style. See #ANNOTATE_ALGO_T.
* @param aStartNumber The start number for non-sheet-based annotation styles.
* @param aResetAnnotation Clear any previous annotation if true. Otherwise, keep the
2021-06-10 14:10:55 +00:00
* existing symbol annotation.
* @param aRepairTimestamps Test for and repair any duplicate time stamps if true.
* Otherwise, keep the existing time stamps. This option
* could change previous annotation because time stamps are
* used to handle annotation in complex hierarchies.
* @param aReporter A sink for error messages. Use NULL_REPORTER if you don't need errors.
*
* When the sheet number is used in annotation, each sheet annotation starts from sheet
* number * 100. In other words the first sheet uses 100 to 199, the second sheet uses
* 200 to 299, and so on.
*/
void AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope, ANNOTATE_ORDER_T aSortOption,
ANNOTATE_ALGO_T aAlgoOption, int aStartNumber, bool aResetAnnotation,
bool aRepairTimestamps, REPORTER& aReporter );
/**
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
2017-11-17 17:00:04 +00:00
* Check for annotation errors.
*
* The following list of items are checked:
2021-03-29 10:46:05 +00:00
* - Symbols that are not annotated.
* - Duplicate symbol references.
* - Multiple part per package symbols where the part number is greater number of parts in
* the package.
* - Multiple part per package symbols where the reference designator is different between
* parts.
*
* @return Number of annotation errors found.
* @param aReporter A handler for error reporting.
* @param aAnnotateScope See #ANNOTATE_SCOPE_T Check the current sheet only if true. Otherwise check the entire
* schematic.
*/
int CheckAnnotate( ANNOTATION_ERROR_HANDLER aErrorHandler,
ANNOTATE_SCOPE_T aAnnotateScope = ANNOTATE_ALL );
/**
2021-03-25 14:07:16 +00:00
* Run a modal version of the annotate dialog for a specific purpose.
*
* @param aMessage A user message indicating the purpose.
* @return the result of ShowModal()
*/
int ModalAnnotate( const wxString& aMessage );
// Functions used for hierarchy handling
SCH_SHEET_PATH& GetCurrentSheet() const;
void SetCurrentSheet( const SCH_SHEET_PATH& aSheet );
/**
* Rebuild the GAL and redraw the screen. Call when something went wrong.
*/
void HardRedraw() override;
/**
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
2017-11-17 17:00:04 +00:00
* Draw the current sheet on the display.
*/
void DisplayCurrentSheet();
2019-05-28 18:44:14 +00:00
/**
* Use the wxWidgets print code to draw an image of the current sheet onto the clipboard.
2019-05-28 18:44:14 +00:00
*/
void DrawCurrentSheetToClipboard();
2019-05-28 18:44:14 +00:00
/**
* Called when modifying the page settings.
2021-03-25 14:07:16 +00:00
*
* In derived classes it can be used to modify parameters like draw area size, and any other
* local parameter related to the page settings.
*/
void OnPageSettingsChange() override;
2010-11-12 15:17:10 +00:00
/**
* @return a filename that can be used in plot and print functions for the current screen
* and sheet path. This filename is unique and must be used instead of the screen filename
* when one must create files for each sheet in the hierarchy.
* Name is &ltroot sheet filename&gt-&ltsheet path&gt and has no extension.
* However if filename is too long name is &ltsheet filename&gt-&ltsheet number&gt
*/
wxString GetUniqueFilenameForCurrentSheet();
/**
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
2017-11-17 17:00:04 +00:00
* Set the m_ScreenNumber and m_NumberOfScreens members for screens.
*
* @note This must be called after deleting or adding a sheet and when entering a sheet.
*/
void SetSheetNumberAndCount();
wxPageSetupDialogData& GetPageSetupData() { return m_pageSetupData; }
void NewProject();
void LoadProject();
void Save_File( bool doSaveAs = false );
bool SaveProject();
2016-09-25 17:06:49 +00:00
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
wxString GetCurrentFileName() const override;
/**
* Import a KiCad schematic into the current sheet.
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
2017-11-17 17:00:04 +00:00
*
* @return True if the schematic was imported properly.
*/
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
2017-11-17 17:00:04 +00:00
bool AppendSchematic();
/**
* Save \a aSheet to a schematic file.
*
2021-03-25 14:07:16 +00:00
* @param aSheet is the #SCH_SHEET object to save. A NULL pointer saves the
* current screen only.
* @param aSaveUnderNewName Controls how the file is to be saved;: using previous name
* or under a new name.
* @return True if the file has been saved.
*/
2021-03-25 14:07:16 +00:00
bool SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName = false );
2017-09-20 14:20:38 +00:00
/**
2021-03-25 14:07:16 +00:00
* Check if any of the screens has unsaved changes and asks the user whether to save or
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
2017-11-17 17:00:04 +00:00
* drop them.
*
2019-07-02 20:09:23 +00:00
* @return True if user decided to save or drop changes, false if the operation should be
* canceled.
2017-09-20 14:20:38 +00:00
*/
bool AskToSaveChanges();
SCH_JUNCTION* AddJunction( SCH_SCREEN* aScreen, const wxPoint& aPos, bool aAppendToUndo,
bool aFinal = true );
/**
2021-03-25 14:07:16 +00:00
* Perform routine schematic cleaning including breaking wire and buses and deleting
2019-07-02 20:09:23 +00:00
* identical objects superimposed on top of each other.
*
2021-03-25 14:07:16 +00:00
* @note This always appends to the existing undo state.
*
* @param aScreen is the screen to examine, or nullptr to examine the current screen
* @return True if any schematic clean up was performed.
*/
bool SchematicCleanUp( SCH_SCREEN* aScreen = nullptr );
/**
* If any single wire passes through _both points_, remove the portion between the two points,
* potentially splitting the wire into two.
*
2021-03-25 14:07:16 +00:00
* @note This always appends to the existing undo state.
*
* @param aStart The starting point for trimmming
* @param aEnd The ending point for trimming
* @return True if any wires were changed by this operation
*/
bool TrimWire( const wxPoint& aStart, const wxPoint& aEnd );
/**
2021-03-25 14:07:16 +00:00
* Collect a unique list of all possible connection points in the schematic.
*
* @return vector of connections
*/
std::vector<wxPoint> GetSchematicConnections();
void OnOpenPcbnew( wxCommandEvent& event );
void OnOpenCvpcb( wxCommandEvent& event );
void OnUpdatePCB( wxCommandEvent& event );
void OnAnnotate( wxCommandEvent& event );
2020-03-06 20:02:58 +00:00
/**
* Verify that \a aSheet will not cause a recursion error in \a aHierarchy.
*
* @param aSheet is the #SCH_SHEET object to test.
* @param aHierarchy is the #SCH_SHEET_PATH where \a aSheet is going to reside.
*
2021-03-25 14:07:16 +00:00
* @return true if \a aSheet will cause a recursion error in \a aHierarchy.
2020-03-06 20:02:58 +00:00
*/
bool CheckSheetForRecursion( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy );
/**
* Check \a aSchematicFileName for a potential file name case sensitivity clashes.
*
* On platforms where file names are case sensitive, it is possible to schematic sheet
* file names that would cause issues on platforms where file name are case insensitive.
* File names foo.sch and Foo.sch are unique files on Linux and MacOS but on Windows
* this would result in a broken schematic.
*
* @param aSchematicFileName is the absolute path and file name of the file to test.
2021-03-25 14:07:16 +00:00
* @return true if the user accepts the potential file name clash risk.
*/
2020-03-06 20:02:58 +00:00
bool AllowCaseSensitiveFileNameClashes( const wxString& aSchematicFileName );
/**
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
2017-11-17 17:00:04 +00:00
* Edit an existing sheet or add a new sheet to the schematic.
*
* When \a aSheet is a new sheet:
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
2017-11-17 17:00:04 +00:00
* - and the file name already exists in the schematic hierarchy, the screen associated
* with the sheet found in the hierarchy is associated with \a aSheet.
* - and the file name already exists on the system, then \a aSheet is loaded with the
* existing file.
* - and the file name does not exist in the schematic hierarchy or on the file system,
* then a new screen is created and associated with \a aSheet.
*
* When \a aSheet is an existing sheet:
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
2017-11-17 17:00:04 +00:00
* - and the file name already exists in the schematic hierarchy, the current associated
* screen is replace by the one found in the hierarchy.
* - and the file name already exists on the system, the current associated screen file
* name is changed and the file is loaded.
* - and the file name does not exist in the schematic hierarchy or on the file system,
* the current associated screen file name is changed and saved to disk.
*
* Note: the screen is not refresh. The caller is responsible to do that
*
* @param aSheet is the sheet to edit
* @param aHierarchy is the current hierarchy containing aSheet
* @param aClearAnnotationNewItems is a reference to a bool to know if the items managed by
* this sheet need to have their annotation cleared i.e. when an existing item list is used.
2021-03-25 14:07:16 +00:00
* it can happens when the edited sheet used an existing file, or becomes a new instance
* of a already existing sheet.
*/
bool EditSheetProperties( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
bool* aClearAnnotationNewItems );
void InitSheet( SCH_SHEET* aSheet, const wxString& aNewFilename );
/**
* Load a the KiCad schematic file \a aFileName into the sheet \a aSheet.
*
* If \a aSheet does not have a valid #SCH_SCREEN object, the schematic is loaded into
* \a Sheet. Otherwise, it is appended to the current #SCH_SCREEN object.
*
* In order to import a schematic a lot of things have to happen to before the contents
* of the imported schematic can be appended to the current page. The following list
* describes this process:
*
* - 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 all of the possible combinations that could cause broken symbol library links
* and give the user the option to cancel the append process. The following conditions
* are check but they still do not guarantee that there will not be any broken symbol
* library links:
* - The source schematic is in the current project path and contains symbol library
* nicknames not found in the project symbol library table. This can happen if the
* schematic is copied to the current project path from another project.
* - The source schematic is in a different path and there are symbol library link nicknames
* that do not exist in either the current symbol library table or the source project
* symbol library table if it exists in the source path.
* - The source schematic is in a different path and contains duplicate symbol library
* nicknames that point to different libraries.
* - 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.
* - 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.
*
* @param aSheet is the sheet to either append or load the schematic.
* @param aHierarchy is the current position in the schematic hierarchy used to test for
* possible file recursion issues.
* @param aFileName is the file name to load. The file name is expected to have an absolute
* path.
*
* @return True if the schematic was imported properly.
*/
bool LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
const wxString& aFileName );
/**
* Removes a given junction and heals any wire segments under the junction
*
* @param aItem The junction to delete
* @param aAppend True if we are updating an ongoing commit
*/
void DeleteJunction( SCH_ITEM* aItem, bool aAppend = false );
2021-06-10 14:10:55 +00:00
void ConvertPart( SCH_SYMBOL* aSymbol );
2021-06-10 14:10:55 +00:00
void SelectUnit( SCH_SYMBOL* aSymbol, int aUnit );
/* Undo - redo */
/**
* Create a new, blank stack for future Undo commands to be pushed to
*/
void StartNewUndo();
2010-11-12 15:17:10 +00:00
/**
* Create a copy of the current schematic item, and put it in the undo list.
*
* aTypeCommand =
2020-08-26 18:04:32 +00:00
* CHANGED
* NEWITEM
* DELETED
*
* If it is a delete command, items are put on list with the .Flags member
2020-08-26 18:04:32 +00:00
* set to DELETED.
*
2021-03-25 14:07:16 +00:00
* @param aItemToCopy is the schematic item modified by the command to undo.
* @param aTypeCommand is the command type (see enum UNDO_REDO).
* @param aAppend set to true to add the item to the previous undo list.
*/
2021-03-25 14:07:16 +00:00
void SaveCopyInUndoList( SCH_SCREEN* aScreen, SCH_ITEM* aItemToCopy, UNDO_REDO aTypeCommand,
bool aAppend );
2010-11-12 15:17:10 +00:00
/**
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
2017-11-17 17:00:04 +00:00
* Create a new entry in undo list of commands.
*
* @param aItemsList is the list of items modified by the command to undo/
2021-03-25 14:07:16 +00:00
* @param aTypeCommand is the command type (see enum UNDO_REDO).
* @param aAppend set to true to add the item to the previous undo list.
*/
2021-03-25 14:07:16 +00:00
void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aTypeCommand,
bool aAppend );
2010-11-12 15:17:10 +00:00
/**
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
2017-11-17 17:00:04 +00:00
* Restore an undo or redo command to put data pointed by \a aList in the previous state.
*
* @param aList a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
2009-08-01 19:26:05 +00:00
*/
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList );
/**
* Free the undo or redo list from \a aList element.
*
* - Wrappers are deleted.
* - data pointed by wrappers are deleted if not in use in schematic
* i.e. when they are copy of a schematic item or they are no more in use (DELETED)
*
2021-03-25 14:07:16 +00:00
* @param whichList is the UNDO_REDO_CONTAINER to clear
* @param aItemCount is the count of items to remove. Use < 0 to remove all items from
* the beginning of the list.
*/
2020-07-13 13:50:35 +00:00
void ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount = -1 ) override;
/**
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
2017-11-17 17:00:04 +00:00
* Clone \a aItem and owns that clone in this container.
*/
void SaveCopyForRepeatItem( const SCH_ITEM* aItem );
/**
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
2017-11-17 17:00:04 +00:00
* Return the item which is to be repeated with the insert key.
*
* Such object is owned by this container, and must be cloned.
*/
SCH_ITEM* GetRepeatItem() const { return m_item_to_repeat; }
EDA_ITEM* GetItem( const KIID& aId ) const override;
/**
2021-03-25 14:07:16 +00:00
* Perform an undo of the last edit WITHOUT logging a corresponding redo. Used to cancel
* an in-progress operation.
*/
void RollbackSchematicFromUndo();
/**
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
2017-11-17 17:00:04 +00:00
* Create a symbol library file with the name of the root document plus the '-cache' suffix,
*
2021-06-10 14:10:55 +00:00
* This file will contain all symbols used in the current schematic.
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
2017-11-17 17:00:04 +00:00
*
2021-03-25 14:07:16 +00:00
* @param aUseCurrentSheetFilename set to false to use the root sheet filename
* (default) or true to use the currently opened sheet.
* @return true if the file was written successfully.
*/
bool CreateArchiveLibraryCacheFile( bool aUseCurrentSheetFilename = false );
/**
2021-06-10 14:10:55 +00:00
* Create a library \a aFileName that contains all symbols used in the current schematic.
*
* @param aFileName The full path and file name of the archive library.
* @return True if \a aFileName was written successfully.
*/
bool CreateArchiveLibrary( const wxString& aFileName );
/**
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
2017-11-17 17:00:04 +00:00
* Plot or print the current sheet to the clipboard.
*/
2020-12-20 18:18:54 +00:00
virtual void PrintPage( const RENDER_SETTINGS* aSettings ) override;
void SetNetListerCommand( const wxString& aCommand ) { m_netListerCommand = aCommand; }
/**
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
2017-11-17 17:00:04 +00:00
* Reset the execution flags to defaults for external netlist and bom generators.
*/
void DefaultExecFlags() { m_exec_flags = wxEXEC_SYNC; }
/**
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
2017-11-17 17:00:04 +00:00
* Set (adds) specified flags for next execution of external generator of the netlist or bom.
*
2021-03-25 14:07:16 +00:00
* @param aFlags is the wxEXEC_* flags, see wxExecute documentation.
*/
void SetExecFlags( const int aFlags ) { m_exec_flags |= aFlags; }
/**
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
2017-11-17 17:00:04 +00:00
* Clear (removes) specified flags that not needed for next execution of external generator
* of the netlist or bom.
*
2021-03-25 14:07:16 +00:00
* @param aFlags is the wxEXEC_* flags, see wxExecute documentation.
*/
void ClearExecFlags( const int aFlags ) { m_exec_flags &= ~( aFlags ); }
wxString GetNetListerCommand() const { return m_netListerCommand; }
/**
2021-03-25 14:07:16 +00:00
* Generate the connection data for the entire schematic hierarchy.
*/
void RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags );
/**
2021-03-25 14:07:16 +00:00
* Allow Eeschema to install its preferences panels into the preferences dialog.
*/
2019-06-09 21:57:23 +00:00
void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
/**
* Called after the preferences dialog is run.
*/
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
void UpdateNetHighlightStatus();
void ShowChangedLanguage() override;
void SetScreen( BASE_SCREEN* aScreen ) override;
const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override;
void FixupJunctions();
void FocusOnItem( SCH_ITEM* aItem );
/**
* Update the #LIB_PART of the currently selected symbol.
*
* This is typically called from the symbol editor when editing symbols in place.
*
* @param aSymbol is the #LIB_PART to update.
*/
void SaveSymbolToSchematic( const LIB_PART& aSymbol );
/**
* Update the schematic's page reference map for all global labels, and refresh the labels
* so that they are redrawn with up-to-date references.
*/
void RecomputeIntersheetRefs();
void ShowAllIntersheetRefs( bool aShow );
DECLARE_EVENT_TABLE()
2021-03-25 14:07:16 +00:00
protected:
/**
* Save the schematic files that have been modified and not yet saved.
*
* @return true if the auto save was successful otherwise false.
*/
bool doAutoSave() override;
/**
* Return true if the schematic has been modified.
*/
bool isAutoSaveRequired() const override;
/**
* Send the KiCad netlist over to CVPCB.
*/
void sendNetlistToCvpcb();
void onSize( wxSizeEvent& aEvent );
private:
// Sets up the tool framework
void setupTools();
void OnExit( wxCommandEvent& event );
void OnLoadFile( wxCommandEvent& event );
void OnAppendProject( wxCommandEvent& event );
void OnImportProject( wxCommandEvent& event );
void OnClearFileHistory( wxCommandEvent& aEvent );
bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
void doCloseWindow() override;
/**
* Set the main window title bar text.
*
* If file name defined by SCH_SCREEN::m_FileName is not set, the title is set to the
* application name appended with no file.
* Otherwise, the title is set to the hierarchical sheet path and the full file name, and
* read only is appended to the title if the user does not have write access to the file.
*/
void UpdateTitle();
/**
* Initialize the zoom value of the current screen and mark the screen as zoom-initialized.
*/
void initScreenZoom();
/**
* Verify that the symbol library links \a aSheet and all of it's child sheets have
* been remapped to the symbol library table.
*
* @param aSheet is the #SCH_SHEET object to test.
*
* @return true if \a aSheet and it's child sheets have not been remapped.
*/
bool checkForNoFullyDefinedLibIds( SCH_SHEET* aSheet );
/**
* Load the given filename but sets the path to the current project path.
*
* @param full filepath of file to be imported.
* @param aFileType SCH_FILE_T value for file type
*/
bool importFile( const wxString& aFileName, int aFileType );
/**
* Fill a map of uuid -> reference from the currently loaded schematic.
*
* @param aMap is a map to fill
*/
void mapExistingAnnotation( std::map<wxString, wxString>& aMap );
private:
// The schematic editor control class should be able to access some internal
// functions of the editor frame.
friend class SCH_EDITOR_CONTROL;
SCHEMATIC* m_schematic; ///< The currently loaded schematic
const SCH_CONNECTION* m_highlightedConn; ///< The highlighted net or bus, or nullptr
wxPageSetupDialogData m_pageSetupData;
SCH_ITEM* m_item_to_repeat; ///< Last item to insert by the repeat command.
wxString m_netListerCommand; ///< Command line to call a custom net list
///< generator.
int m_exec_flags; ///< Flags of the wxExecute() function
///< to call a custom net list generator.
DIALOG_SCH_FIND* m_findReplaceDialog;
};
2018-01-30 10:49:51 +00:00
#endif // SCH_EDIT_FRAME_H