2011-10-15 13:25:57 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
2023-01-04 20:39:50 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-15 13:25:57 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 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 08:56:43 +00:00
|
|
|
#ifndef SCREEN_H
|
|
|
|
#define SCREEN_H
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <stddef.h>
|
2019-03-11 21:32:05 +00:00
|
|
|
#include <unordered_set>
|
2019-06-25 23:39:58 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <wx/arrstr.h>
|
|
|
|
#include <wx/chartype.h>
|
|
|
|
#include <wx/gdicmn.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
|
2018-01-29 10:37:29 +00:00
|
|
|
#include <base_screen.h>
|
2019-06-25 23:39:58 +00:00
|
|
|
#include <core/typeinfo.h>
|
2021-04-06 18:27:24 +00:00
|
|
|
#include <kiid.h>
|
2019-06-08 22:14:57 +00:00
|
|
|
#include <kiway_holder.h>
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h>
|
2019-06-25 23:39:58 +00:00
|
|
|
#include <marker_base.h>
|
|
|
|
#include <page_info.h>
|
|
|
|
#include <template_fieldnames.h>
|
|
|
|
#include <title_block.h>
|
|
|
|
|
|
|
|
#include <lib_id.h>
|
2023-01-04 20:39:50 +00:00
|
|
|
#include <sch_symbol.h> // SCH_SYMBOL_INSTANCE
|
2020-04-26 20:53:29 +00:00
|
|
|
#include <sch_reference_list.h>
|
2019-06-25 23:39:58 +00:00
|
|
|
#include <sch_rtree.h>
|
|
|
|
#include <sch_sheet.h>
|
2022-03-26 16:27:45 +00:00
|
|
|
#include <sch_text.h>
|
2019-06-25 23:39:58 +00:00
|
|
|
#include <sch_sheet_path.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
class BUS_ALIAS;
|
2021-06-06 14:41:02 +00:00
|
|
|
class EDA_ITEM;
|
2021-06-10 18:51:46 +00:00
|
|
|
class LIB_SYMBOL;
|
2010-12-13 15:59:00 +00:00
|
|
|
class LIB_PIN;
|
2021-06-10 14:10:55 +00:00
|
|
|
class SCH_SYMBOL;
|
2011-03-10 19:36:30 +00:00
|
|
|
class SCH_LINE;
|
2022-01-25 22:33:37 +00:00
|
|
|
class SCH_LABEL_BASE;
|
2011-06-17 13:24:22 +00:00
|
|
|
class PLOTTER;
|
2020-04-16 16:43:50 +00:00
|
|
|
class REPORTER;
|
2022-10-31 14:03:35 +00:00
|
|
|
class SCH_ALTIUM_PLUGIN;
|
2020-04-26 20:53:29 +00:00
|
|
|
class SCH_EDIT_FRAME;
|
2018-09-03 10:11:39 +00:00
|
|
|
class SCH_SHEET_LIST;
|
2020-04-26 20:53:29 +00:00
|
|
|
class SCH_SEXPR_PARSER;
|
|
|
|
class SCH_SEXPR_PLUGIN;
|
2011-03-25 19:16:05 +00:00
|
|
|
|
|
|
|
enum SCH_LINE_TEST_T
|
|
|
|
{
|
|
|
|
ENTIRE_LENGTH_T,
|
|
|
|
END_POINTS_ONLY_T,
|
|
|
|
EXCLUDE_END_POINTS_T
|
|
|
|
};
|
2011-01-11 20:34:29 +00:00
|
|
|
|
2010-12-13 15:59:00 +00:00
|
|
|
|
2020-11-07 14:31:50 +00:00
|
|
|
struct PICKED_SYMBOL
|
2019-06-25 23:39:58 +00:00
|
|
|
{
|
|
|
|
LIB_ID LibId;
|
|
|
|
int Unit;
|
|
|
|
int Convert;
|
|
|
|
|
|
|
|
std::vector<std::pair<int, wxString>> Fields;
|
|
|
|
|
2020-11-07 14:31:50 +00:00
|
|
|
PICKED_SYMBOL() : Unit( 1 ), Convert( 1 )
|
2019-06-25 23:39:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2020-05-21 02:27:48 +00:00
|
|
|
class SCH_SCREEN : public BASE_SCREEN
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-05-21 02:27:48 +00:00
|
|
|
SCH_SCREEN( EDA_ITEM* aParent = nullptr );
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
~SCH_SCREEN();
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2020-05-13 02:00:37 +00:00
|
|
|
SCHEMATIC* Schematic() const;
|
|
|
|
|
2021-08-20 15:49:43 +00:00
|
|
|
/**
|
|
|
|
* Gets the full RTree, usually for iterating.
|
|
|
|
* N.B. The iteration order of the RTree is not readily apparent and will change
|
|
|
|
* if/when you add or move items and the RTree is re-balanced. Any exposure of the
|
2022-08-20 17:47:43 +00:00
|
|
|
* RTree contents to the user MUST be sorted before being presented. See
|
|
|
|
* SCH_SEXPR_PLUGIN::Format() or SCH_EDITOR_CONTROL::nextMatch() for examples.
|
|
|
|
*
|
2021-08-20 15:49:43 +00:00
|
|
|
* @return Complete RTree of the screen's items
|
|
|
|
*/
|
2020-06-12 10:58:56 +00:00
|
|
|
EE_RTREE& Items() { return m_rtree; }
|
|
|
|
const EE_RTREE& Items() const { return m_rtree; }
|
2019-06-25 23:39:58 +00:00
|
|
|
|
2021-03-06 09:27:41 +00:00
|
|
|
bool IsEmpty() const
|
2019-06-25 23:39:58 +00:00
|
|
|
{
|
|
|
|
return m_rtree.empty();
|
|
|
|
}
|
2018-08-03 12:18:26 +00:00
|
|
|
|
2020-04-26 20:53:29 +00:00
|
|
|
bool HasItems( KICAD_T aItemType ) const;
|
|
|
|
|
|
|
|
bool HasSheets() const { return HasItems( SCH_SHEET_T ); }
|
|
|
|
|
2021-06-06 14:41:02 +00:00
|
|
|
static bool ClassOf( const EDA_ITEM* aItem );
|
2019-08-29 14:59:36 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
virtual wxString GetClass() const override
|
2011-01-11 20:34:29 +00:00
|
|
|
{
|
|
|
|
return wxT( "SCH_SCREEN" );
|
|
|
|
}
|
|
|
|
|
2021-01-31 17:25:38 +00:00
|
|
|
void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
|
|
|
|
int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; }
|
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
const PAGE_INFO& GetPageSettings() const { return m_paper; }
|
|
|
|
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
|
|
|
|
|
2021-05-27 18:36:47 +00:00
|
|
|
/**
|
|
|
|
* Set the file name for this screen to \a aFileName.
|
|
|
|
*
|
|
|
|
* @note Screen file names must be absolute or empty. Absolute file names do not have to
|
|
|
|
* exist yet in the case of a new schematic file but file names cannot be relative.
|
|
|
|
*
|
|
|
|
* @param aFileName is the absolute file name and path of the screen.
|
|
|
|
*/
|
|
|
|
void SetFileName( const wxString& aFileName );
|
2012-08-29 16:59:50 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
const wxString& GetFileName() const { return m_fileName; }
|
2012-08-29 16:59:50 +00:00
|
|
|
|
2021-10-14 13:12:40 +00:00
|
|
|
void SetFileReadOnly( bool aIsReadOnly ) { m_isReadOnly = aIsReadOnly; }
|
|
|
|
bool IsReadOnly() const { return m_isReadOnly; }
|
|
|
|
|
|
|
|
void SetFileExists( bool aFileExists ) { m_fileExists = aFileExists; }
|
|
|
|
bool FileExists() const { return m_fileExists; }
|
|
|
|
|
2022-01-01 18:57:44 +00:00
|
|
|
const VECTOR2I& GetAuxOrigin() const { return m_aux_origin; }
|
|
|
|
void SetAuxOrigin( const VECTOR2I& aPosition ) { m_aux_origin = aPosition; }
|
2012-01-05 08:07:11 +00:00
|
|
|
|
2012-01-09 08:35:06 +00:00
|
|
|
const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
|
2019-06-25 23:39:58 +00:00
|
|
|
|
2012-01-09 08:35:06 +00:00
|
|
|
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
|
|
|
|
|
2011-01-12 21:47:54 +00:00
|
|
|
void DecRefCount();
|
2011-01-20 16:34:57 +00:00
|
|
|
void IncRefCount();
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
int GetRefCount() const { return m_refCount; }
|
2011-01-12 21:47:54 +00:00
|
|
|
|
2021-11-24 13:19:50 +00:00
|
|
|
void SetConnectivityDirty();
|
|
|
|
|
2018-09-03 10:11:39 +00:00
|
|
|
/**
|
2021-03-25 21:13:01 +00:00
|
|
|
* Return the number of times this screen is used.
|
|
|
|
*
|
|
|
|
* In the legacy file formats: if this screen is used only once (not a complex hierarchy)
|
|
|
|
* the reference field can be used to store the symbol reference. If this screen is used
|
|
|
|
* more than once (a complex hierarchy), then symbols must have a full alternate reference
|
|
|
|
* management via sheet paths.
|
|
|
|
*
|
|
|
|
* In the new schematic file format, all instance data is stored in the root sheet even
|
|
|
|
* for simple hierarchies.
|
|
|
|
*
|
|
|
|
* @return the sheet paths sharing this screen.
|
2018-09-03 10:11:39 +00:00
|
|
|
*/
|
2020-02-04 22:37:14 +00:00
|
|
|
std::vector<SCH_SHEET_PATH>& GetClientSheetPaths()
|
|
|
|
{
|
|
|
|
return m_clientSheetPathList;
|
|
|
|
}
|
2012-02-26 18:39:39 +00:00
|
|
|
|
2023-02-02 20:53:57 +00:00
|
|
|
void Append( SCH_ITEM* aItem, bool aUpdateLibSymbol = true );
|
2012-02-26 18:39:39 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Copy the contents of \a aScreen into this #SCH_SCREEN object.
|
|
|
|
*
|
|
|
|
* @warning The contents of \a Screen cannot contain any duplicate sheet names or any
|
|
|
|
* hierarchy recursion issues or bad things will happen.
|
|
|
|
*
|
|
|
|
* @param aScreen is the screen to append to this one.
|
|
|
|
* @return false if there are any duplicate sheet names or any hierarchy recursion issues the
|
|
|
|
* calling this method or KiCad will crash.
|
|
|
|
*/
|
|
|
|
void Append( SCH_SCREEN* aScreen );
|
|
|
|
|
2011-06-15 18:44:24 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Delete all draw items and clears the project settings.
|
2011-06-15 18:44:24 +00:00
|
|
|
*/
|
2019-06-25 23:39:58 +00:00
|
|
|
void Clear( bool aFree = true );
|
2011-06-15 18:44:24 +00:00
|
|
|
|
2010-10-26 20:25:48 +00:00
|
|
|
/**
|
|
|
|
* Free all the items from the schematic associated with the screen.
|
|
|
|
*
|
|
|
|
* This does not delete any sub hierarchies.
|
|
|
|
*/
|
2011-01-11 20:34:29 +00:00
|
|
|
void FreeDrawList();
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Check \a aPosition within a distance of \a aAccuracy for items of type \a aFilter.
|
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[in] aPosition Position in drawing units.
|
2011-03-10 19:36:30 +00:00
|
|
|
* @param aAccuracy The maximum distance within \a Position to check for an item.
|
2019-05-06 02:32:01 +00:00
|
|
|
* @param aType The type of item to find.
|
2011-03-10 19:36:30 +00:00
|
|
|
* @return The item found that meets the search criteria or NULL if none found.
|
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
SCH_ITEM* GetItem( const VECTOR2I& aPosition, int aAccuracy = 0,
|
2021-03-06 09:27:41 +00:00
|
|
|
KICAD_T aType = SCH_LOCATE_ANY_T ) const;
|
2011-03-10 19:36:30 +00:00
|
|
|
|
2014-08-18 16:39:51 +00:00
|
|
|
/**
|
2021-06-10 18:51:46 +00:00
|
|
|
* Initialize the #LIB_SYMBOL reference for each #SCH_SYMBOL found in this schematic
|
2020-04-16 16:43:50 +00:00
|
|
|
* from the project #SYMBOL_LIB_TABLE.
|
2017-10-22 00:48:25 +00:00
|
|
|
*
|
2020-04-16 16:43:50 +00:00
|
|
|
* Symbol library links are set using the symbol library table and will fall back to
|
|
|
|
* the cache only if the cache is loaded. The cache should only be loaded when opening
|
|
|
|
* legacy schematic files.
|
2017-10-22 00:48:25 +00:00
|
|
|
*
|
2020-04-16 16:43:50 +00:00
|
|
|
* @note This should only be called when the user specifically requests all library symbol
|
|
|
|
* links to be updated or when the legacy schematic is opened for the last time. All
|
|
|
|
* subsequent schematic loads with the new s-expression will contain the library
|
|
|
|
* symbols and should call #UpdateLocalLibSymbolLinks.
|
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[in] aReporter Optional #REPORTER object to write status and error messages into.
|
2020-04-16 16:43:50 +00:00
|
|
|
*/
|
|
|
|
void UpdateSymbolLinks( REPORTER* aReporter = nullptr );
|
|
|
|
|
|
|
|
/**
|
2021-06-10 18:51:46 +00:00
|
|
|
* Initialize the #LIB_SYMBOL reference for each #SCH_SYMBOL found in this schematic
|
2021-03-25 21:13:01 +00:00
|
|
|
* with the local project library symbols.
|
2014-08-18 16:39:51 +00:00
|
|
|
*/
|
2020-04-16 16:43:50 +00:00
|
|
|
void UpdateLocalLibSymbolLinks();
|
2014-08-18 16:39:51 +00:00
|
|
|
|
2011-01-11 20:34:29 +00:00
|
|
|
/**
|
2019-05-31 12:15:25 +00:00
|
|
|
* Print all the items in the screen to \a aDC.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
|
|
|
* @note This function is useful only for schematic. The library editor and library viewer
|
|
|
|
* do not use a draw list and therefore draws nothing.
|
2011-01-11 20:34:29 +00:00
|
|
|
*/
|
2020-12-20 18:18:54 +00:00
|
|
|
void Print( const RENDER_SETTINGS* aSettings );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2011-06-17 13:24:22 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Plot all the schematic objects to \a aPlotter.
|
|
|
|
*
|
|
|
|
* @note This function is useful only for schematic. The library editor and library viewer
|
|
|
|
* do not use a draw list and therefore plots nothing.
|
2011-06-17 13:24:22 +00:00
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[in] aPlotter The plotter object to plot to.
|
2011-06-17 13:24:22 +00:00
|
|
|
*/
|
2021-03-06 09:27:41 +00:00
|
|
|
void Plot( PLOTTER* aPlotter ) const;
|
2011-06-17 13:24:22 +00:00
|
|
|
|
2010-10-26 20:25:48 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Remove \a aItem from the schematic associated with this screen.
|
2010-10-26 20:25:48 +00:00
|
|
|
*
|
2012-02-26 18:39:39 +00:00
|
|
|
* @note The removed item is not deleted. It is only unlinked from the item list.
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[in] aItem Item to be removed from schematic.
|
2023-02-02 20:53:57 +00:00
|
|
|
* @param aUpdateLibSymbol removes the library symbol as required when true.
|
2020-01-25 17:32:05 +00:00
|
|
|
* @return True if we successfully removed the item
|
2010-10-26 20:25:48 +00:00
|
|
|
*/
|
2023-02-02 20:53:57 +00:00
|
|
|
bool Remove( SCH_ITEM* aItem, bool aUpdateLibSymbol = true );
|
2010-12-14 15:56:30 +00:00
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
/**
|
2021-03-25 21:13:01 +00:00
|
|
|
* Update \a aItem's bounding box in the tree
|
2019-06-25 23:39:58 +00:00
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[in] aItem Item that needs to be updated.
|
2023-02-02 20:53:57 +00:00
|
|
|
* @param aUpdateLibSymbol removes the library symbol as required when true.
|
2019-06-25 23:39:58 +00:00
|
|
|
*/
|
2023-02-02 20:53:57 +00:00
|
|
|
void Update( SCH_ITEM* aItem, bool aUpdateLibSymbol = true );
|
2019-06-25 23:39:58 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Removes \a aItem from the linked list and deletes the object.
|
|
|
|
*
|
|
|
|
* If \a aItem is a schematic sheet label, it is removed from the screen associated with
|
|
|
|
* the sheet that contains the label to be deleted.
|
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[in] aItem The schematic object to be deleted from the screen.
|
2011-03-10 19:36:30 +00:00
|
|
|
*/
|
|
|
|
void DeleteItem( SCH_ITEM* aItem );
|
|
|
|
|
2021-03-06 09:27:41 +00:00
|
|
|
bool CheckIfOnDrawList( const SCH_ITEM* aItem ) const;
|
2010-12-14 15:56:30 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Test all of the connectable objects in the schematic for unused connection points.
|
2021-03-25 21:13:01 +00:00
|
|
|
*
|
|
|
|
* @param aPath is a sheet path to pass to UpdateDanglingState if desired.
|
|
|
|
* @param aChangedHandler is an optional callback to make on each changed item.
|
2011-01-21 19:30:59 +00:00
|
|
|
*/
|
2020-12-06 21:23:16 +00:00
|
|
|
void TestDanglingEnds( const SCH_SHEET_PATH* aPath = nullptr,
|
2021-03-06 09:27:41 +00:00
|
|
|
std::function<void( SCH_ITEM* )>* aChangedHandler = nullptr ) const;
|
2010-12-14 15:56:30 +00:00
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
/**
|
2019-06-25 23:39:58 +00:00
|
|
|
* Return all wires and junctions connected to \a aSegment which are not connected any
|
2021-06-10 14:10:55 +00:00
|
|
|
* symbol pin.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2011-03-10 19:36:30 +00:00
|
|
|
* @param aSegment The segment to test for connections.
|
|
|
|
*/
|
2022-06-15 15:27:54 +00:00
|
|
|
std::set<SCH_ITEM*> MarkConnections( SCH_LINE* aSegment, bool aSecondPass );
|
2011-03-10 19:36:30 +00:00
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
/**
|
|
|
|
* Clear the state flags of all the items in the screen.
|
|
|
|
*/
|
|
|
|
void ClearDrawingState();
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
size_t CountConnectedItems( const VECTOR2I& aPos, bool aTestJunctions ) const;
|
2010-12-13 15:59:00 +00:00
|
|
|
|
2011-01-11 20:34:29 +00:00
|
|
|
/**
|
2021-11-04 12:38:15 +00:00
|
|
|
* Test if a junction is required for the items at \a aPosition on the screen. Note that
|
|
|
|
* this coule be either an implied junction (bus entry) or an explicit junction (dot).
|
2021-03-25 21:13:01 +00:00
|
|
|
*
|
2017-11-27 19:27:24 +00:00
|
|
|
* A junction is required at \a aPosition if one of the following criteria is satisfied:
|
2021-03-25 21:13:01 +00:00
|
|
|
* - One wire midpoint and one or more wire endpoints.
|
|
|
|
* - Three or more wire endpoints.
|
2021-06-10 14:10:55 +00:00
|
|
|
* - One wire midpoint and a symbol pin.
|
|
|
|
* - Two or more wire endpoints and a symbol pin.
|
2021-11-04 12:38:15 +00:00
|
|
|
* - One bus midpoint or endpoint and a bus entry.
|
2021-03-25 21:13:01 +00:00
|
|
|
*
|
|
|
|
* @param[in] aPosition The position to test.
|
2011-01-11 20:34:29 +00:00
|
|
|
* @return True if a junction is required at \a aPosition.
|
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
bool IsJunction( const VECTOR2I& aPosition ) const;
|
2021-11-04 12:38:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that a junction dot is necessary at the given location. See IsJunctionNeeded
|
|
|
|
* for more info.
|
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
bool IsExplicitJunction( const VECTOR2I& aPosition ) const;
|
2021-11-04 12:38:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that a junction dot is necessary at the given location, and does not yet exist.
|
|
|
|
* See IsJunctionNeeded for more info.
|
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
bool IsExplicitJunctionNeeded( const VECTOR2I& aPosition ) const;
|
2021-11-04 12:38:15 +00:00
|
|
|
|
2022-03-26 16:27:45 +00:00
|
|
|
TEXT_SPIN_STYLE GetLabelOrientationForPoint( const VECTOR2I& aPosition,
|
|
|
|
TEXT_SPIN_STYLE aDefaultOrientation,
|
|
|
|
const SCH_SHEET_PATH* aSheet ) const;
|
2021-11-04 12:38:15 +00:00
|
|
|
/**
|
|
|
|
* Indicates that a juction dot may be placed at the given location. See IsJunctionNeeded
|
|
|
|
* for more info.
|
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
bool IsExplicitJunctionAllowed( const VECTOR2I& aPosition ) const;
|
2011-03-25 19:16:05 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Test if \a aPosition is a connection point on \a aLayer.
|
2011-03-25 19:16:05 +00:00
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[in] aPosition Position to test.
|
2011-03-25 19:16:05 +00:00
|
|
|
* @param aLayer The layer type to test against. Valid layer types are #LAYER_NOTES,
|
|
|
|
* #LAYER_BUS, and #LAYER_WIRE.
|
|
|
|
* @return True if \a Position is a connection point on \a aLayer.
|
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
bool IsTerminalPoint( const VECTOR2I& aPosition, int aLayer ) const;
|
2011-01-11 20:34:29 +00:00
|
|
|
|
2011-01-10 20:35:24 +00:00
|
|
|
/**
|
2021-06-10 14:10:55 +00:00
|
|
|
* Test the screen for a symbol pin item at \a aPosition.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[in] aPosition Position to test.
|
2021-06-10 14:10:55 +00:00
|
|
|
* @param[out] aSymbol The symbol if a pin was found, otherwise NULL.
|
2011-01-10 20:35:24 +00:00
|
|
|
* @param aEndPointOnly Set to true to test if \a aPosition is the connection
|
|
|
|
* point of the pin.
|
|
|
|
* @return The pin item if found, otherwise NULL.
|
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
LIB_PIN* GetPin( const VECTOR2I& aPosition, SCH_SYMBOL** aSymbol = nullptr,
|
2021-03-06 09:27:41 +00:00
|
|
|
bool aEndPointOnly = false ) const;
|
2010-12-13 15:59:00 +00:00
|
|
|
|
2011-01-11 20:34:29 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Test the screen if \a aPosition is a sheet label object.
|
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[in] aPosition The position to test.
|
2011-01-11 20:34:29 +00:00
|
|
|
* @return The sheet label object if found otherwise NULL.
|
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
SCH_SHEET_PIN* GetSheetPin( const VECTOR2I& aPosition ) const;
|
2011-01-11 20:34:29 +00:00
|
|
|
|
2010-12-31 19:47:39 +00:00
|
|
|
/**
|
2021-06-10 14:10:55 +00:00
|
|
|
* Clear the annotation for the symbols in \a aSheetPath on the screen.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2021-06-10 14:10:55 +00:00
|
|
|
* @param[in] aSheetPath The sheet path of the symbol annotation to clear. If NULL then
|
2021-03-25 21:13:01 +00:00
|
|
|
* the entire hierarchy is cleared.
|
2022-04-13 22:37:42 +00:00
|
|
|
* @param[in] aResetPrefix The annotation prefix ('R', 'U', etc.) should be reset to the
|
|
|
|
* symbol library prefix.
|
2010-12-31 19:47:39 +00:00
|
|
|
*/
|
2022-04-13 22:37:42 +00:00
|
|
|
void ClearAnnotation( SCH_SHEET_PATH* aSheetPath, bool aResetPrefix );
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2018-09-03 10:11:39 +00:00
|
|
|
/**
|
|
|
|
* For screens shared by many sheetpaths (complex hierarchies):
|
|
|
|
* to be able to clear or modify any reference related sharing this screen
|
2021-06-10 14:10:55 +00:00
|
|
|
* (i.e. the list of symbols), an entry for each screen path must exist.
|
2018-09-03 10:11:39 +00:00
|
|
|
* This function creates missing entries, using as default reference the current
|
|
|
|
* reference field and unit number
|
|
|
|
* Note: m_clientSheetPathList must be up to date
|
|
|
|
* ( built by SCH_SCREENS::BuildClientSheetPathList() )
|
|
|
|
*/
|
|
|
|
void EnsureAlternateReferencesExist();
|
|
|
|
|
2010-12-31 19:47:39 +00:00
|
|
|
/**
|
2021-06-10 14:10:55 +00:00
|
|
|
* Add all schematic sheet and symbol objects in the screen to \a aItems.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[out] aItems Hierarchical item list to fill.
|
2010-12-31 19:47:39 +00:00
|
|
|
*/
|
2021-03-06 09:27:41 +00:00
|
|
|
void GetHierarchicalItems( std::vector<SCH_ITEM*>* aItems ) const;
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2020-05-03 14:52:31 +00:00
|
|
|
/**
|
2020-11-28 23:26:51 +00:00
|
|
|
* Similar to Items().OfType( SCH_SHEET_T ), but return the sheets in a
|
2020-05-03 14:52:31 +00:00
|
|
|
* deterministic order (L-R, T-B) for sheet numbering.
|
|
|
|
*/
|
2021-03-06 09:27:41 +00:00
|
|
|
void GetSheets( std::vector<SCH_ITEM*>* aItems ) const;
|
2011-03-25 19:16:05 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return a line item located at \a aPosition.
|
2011-03-25 19:16:05 +00:00
|
|
|
*
|
2022-01-01 18:57:44 +00:00
|
|
|
* @param[in] aPosition The VECTOR2I to test for a line item.
|
2011-03-25 19:16:05 +00:00
|
|
|
* @param aAccuracy Amount to inflate the item hit test bounding box.
|
|
|
|
* @param aLayer The layer the line is drawn upon.
|
|
|
|
* @param aSearchType Additional line test criteria.
|
|
|
|
* @return The SCH_LINE* of the wire item found at \a aPosition or NULL if item not
|
|
|
|
* found.
|
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
SCH_LINE* GetLine( const VECTOR2I& aPosition, int aAccuracy = 0, int aLayer = LAYER_NOTES,
|
2021-03-06 09:27:41 +00:00
|
|
|
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const;
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
SCH_LINE* GetWire( const VECTOR2I& aPosition, int aAccuracy = 0,
|
2021-03-06 09:27:41 +00:00
|
|
|
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const
|
2011-03-25 19:16:05 +00:00
|
|
|
{
|
|
|
|
return GetLine( aPosition, aAccuracy, LAYER_WIRE, aSearchType );
|
|
|
|
}
|
|
|
|
|
2021-12-29 21:30:11 +00:00
|
|
|
SCH_LINE* GetBus( const VECTOR2I& aPosition, int aAccuracy = 0,
|
|
|
|
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const
|
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
return GetLine( aPosition, aAccuracy, LAYER_BUS, aSearchType );
|
2021-12-29 21:30:11 +00:00
|
|
|
}
|
|
|
|
|
2022-08-15 19:54:29 +00:00
|
|
|
/**
|
|
|
|
* Return buses and wires passing through aPosition.
|
|
|
|
*
|
|
|
|
* @param aPosition Position to search for
|
|
|
|
* @param aIgnoreEndpoints If true, ignore wires/buses with end points matching aPosition
|
|
|
|
* @return Buses and wires
|
|
|
|
*/
|
2023-02-02 20:53:57 +00:00
|
|
|
std::vector<SCH_LINE*> GetBusesAndWires( const VECTOR2I& aPosition,
|
|
|
|
bool aIgnoreEndpoints = false ) const;
|
2022-08-15 19:54:29 +00:00
|
|
|
|
2022-08-18 18:40:25 +00:00
|
|
|
/**
|
|
|
|
* Collect a unique list of all possible connection points in the schematic.
|
|
|
|
*
|
|
|
|
* @return vector of connections
|
|
|
|
*/
|
|
|
|
std::vector<VECTOR2I> GetConnections() const;
|
|
|
|
|
2022-08-18 19:52:31 +00:00
|
|
|
/**
|
|
|
|
* Return the unique set of points belonging to aItems where a junction is needed.
|
|
|
|
*
|
|
|
|
* @param aItems List of objects to check
|
|
|
|
* @return Points where a junction is needed
|
|
|
|
*/
|
|
|
|
std::vector<VECTOR2I> GetNeededJunctions( const std::deque<EDA_ITEM*>& aItems ) const;
|
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return a label item located at \a aPosition.
|
2011-03-25 19:16:05 +00:00
|
|
|
*
|
2022-01-01 18:57:44 +00:00
|
|
|
* @param[in] aPosition The VECTOR2I to test for label items.
|
2011-03-25 19:16:05 +00:00
|
|
|
* @param aAccuracy Amount to inflate the item hit test bounding box.
|
2022-01-25 22:33:37 +00:00
|
|
|
* @return The SCH_LABEL_BASE* of the label item found or nullptr.
|
2011-03-25 19:16:05 +00:00
|
|
|
*/
|
2022-01-25 22:33:37 +00:00
|
|
|
SCH_LABEL_BASE* GetLabel( const VECTOR2I& aPosition, int aAccuracy = 0 ) const;
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2020-04-16 16:43:50 +00:00
|
|
|
/**
|
2021-06-10 18:51:46 +00:00
|
|
|
* Fetch a list of unique #LIB_SYMBOL object pointers required to properly render each
|
2021-06-10 14:10:55 +00:00
|
|
|
* #SCH_SYMBOL in this schematic.
|
2020-04-16 16:43:50 +00:00
|
|
|
*
|
2021-06-10 18:51:46 +00:00
|
|
|
* @return The list of unique #LIB_SYMBOL object pointers.
|
2020-04-16 16:43:50 +00:00
|
|
|
*/
|
2021-06-10 18:51:46 +00:00
|
|
|
const std::map<wxString, LIB_SYMBOL*>& GetLibSymbols() const { return m_libSymbols; }
|
2020-04-16 16:43:50 +00:00
|
|
|
|
|
|
|
/**
|
2021-06-09 19:32:58 +00:00
|
|
|
* Add \a aLibSymbol to the library symbol map.
|
2020-04-16 16:43:50 +00:00
|
|
|
*
|
|
|
|
* The symbol is mapped to the result of #LIB_ID::Format(). If a symbol is already
|
|
|
|
* mapped, the existing symbol is replaced with \a aLibSymbol. The screen object takes
|
|
|
|
* ownership of the pointer.
|
|
|
|
*
|
2021-06-10 18:51:46 +00:00
|
|
|
* @param aLibSymbol A pointer the #LIB_SYMBOL to be added to the symbol map.
|
2020-04-16 16:43:50 +00:00
|
|
|
*/
|
2021-06-10 18:51:46 +00:00
|
|
|
void AddLibSymbol( LIB_SYMBOL* aLibSymbol );
|
2020-04-16 16:43:50 +00:00
|
|
|
|
2011-01-07 19:24:24 +00:00
|
|
|
/**
|
2021-03-25 21:13:01 +00:00
|
|
|
* Add a bus alias definition (and transfers ownership of the pointer).
|
2019-03-11 21:32:05 +00:00
|
|
|
*/
|
|
|
|
void AddBusAlias( std::shared_ptr<BUS_ALIAS> aAlias );
|
|
|
|
|
|
|
|
/**
|
2021-03-25 21:13:01 +00:00
|
|
|
* Remove all bus alias definitions.
|
2019-03-11 21:32:05 +00:00
|
|
|
*/
|
|
|
|
void ClearBusAliases()
|
|
|
|
{
|
|
|
|
m_aliases.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-03-25 21:13:01 +00:00
|
|
|
* Return a list of bus aliases defined in this screen
|
2019-03-11 21:32:05 +00:00
|
|
|
*/
|
2022-09-11 17:41:54 +00:00
|
|
|
std::set< std::shared_ptr<BUS_ALIAS> > GetBusAliases() const
|
2019-03-11 21:32:05 +00:00
|
|
|
{
|
|
|
|
return m_aliases;
|
|
|
|
}
|
|
|
|
|
2023-01-04 20:39:50 +00:00
|
|
|
const std::vector<SCH_SYMBOL_INSTANCE>& GetSymbolInstances() const
|
2020-05-19 02:40:13 +00:00
|
|
|
{
|
|
|
|
return m_symbolInstances;
|
|
|
|
}
|
|
|
|
|
2020-10-18 20:30:37 +00:00
|
|
|
const std::vector<SCH_SHEET_INSTANCE>& GetSheetInstances() const
|
|
|
|
{
|
|
|
|
return m_sheetInstances;
|
|
|
|
}
|
|
|
|
|
2021-04-06 18:27:24 +00:00
|
|
|
const KIID& GetUuid() const { return m_uuid; }
|
|
|
|
|
|
|
|
void AssignNewUuid() { m_uuid = KIID(); }
|
|
|
|
|
2022-08-17 15:31:49 +00:00
|
|
|
/**
|
|
|
|
* Update the symbol value and footprint instance data for legacy designs.
|
|
|
|
*/
|
|
|
|
void SetLegacySymbolInstanceData();
|
|
|
|
|
2023-02-20 17:55:02 +00:00
|
|
|
/**
|
|
|
|
* Fix legacy power symbols that have mismatched value text fields
|
|
|
|
* and invisible power pin names.
|
|
|
|
*/
|
|
|
|
void FixLegacyPowerSymbolMismatches();
|
|
|
|
|
2022-08-20 17:47:43 +00:00
|
|
|
/**
|
|
|
|
* Check all symbol default instance to see if they are not set yet.
|
|
|
|
*/
|
|
|
|
bool AllSymbolDefaultInstancesNotSet();
|
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
#if defined(DEBUG)
|
2016-09-25 17:06:49 +00:00
|
|
|
void Show( int nestLevel, std::ostream& os ) const override;
|
2011-12-22 21:57:50 +00:00
|
|
|
#endif
|
2021-01-17 08:41:49 +00:00
|
|
|
|
|
|
|
/**
|
2022-12-06 14:00:11 +00:00
|
|
|
* Migrate any symbols having V6 simulation models to their V7 equivalents.
|
2021-01-17 08:41:49 +00:00
|
|
|
*/
|
2022-12-06 14:00:11 +00:00
|
|
|
void MigrateSimModels();
|
2021-11-04 12:38:15 +00:00
|
|
|
|
2021-03-25 21:13:01 +00:00
|
|
|
private:
|
|
|
|
friend SCH_EDIT_FRAME; // Only to populate m_symbolInstances.
|
|
|
|
friend SCH_SEXPR_PARSER; // Only to load instance information from schematic file.
|
|
|
|
friend SCH_SEXPR_PLUGIN; // Only to save the loaded instance information to schematic file.
|
2022-10-31 14:03:35 +00:00
|
|
|
friend SCH_ALTIUM_PLUGIN;
|
2021-03-25 21:13:01 +00:00
|
|
|
|
2022-12-06 14:00:11 +00:00
|
|
|
bool doIsJunction( const VECTOR2I& aPosition, bool aBreakCrossings,
|
|
|
|
bool* aHasExplicitJunctionDot, bool* aHasBusEntry ) const;
|
|
|
|
|
2021-03-25 21:13:01 +00:00
|
|
|
void clearLibSymbols();
|
|
|
|
|
2023-02-02 20:53:57 +00:00
|
|
|
/**
|
|
|
|
* Return a list of potential library symbol matches for \a aSymbol.
|
|
|
|
*
|
|
|
|
* When and existing library symbol named with the full #LIB_ID object is found, there may
|
|
|
|
* be more potential matches if the #SCH_SCREEN::Append() method need to create an alternate
|
|
|
|
* symbol due to differences from the original symbol. This process creates a new library
|
|
|
|
* symbol name by adding a "_#" suffix to the existing #LIB_ID item name.
|
|
|
|
*
|
|
|
|
* @param[in] aSymbol is the schematic symbol to search for potential library symbol matches.
|
|
|
|
* @param[out] aMatches contains library cache names of all of the potential matches.
|
|
|
|
*
|
|
|
|
* @return the number of potential matches found for \a aSymbol.
|
|
|
|
*/
|
|
|
|
size_t getLibSymbolNameMatches( const SCH_SYMBOL& aSymbol, std::vector<wxString>& aMatches );
|
|
|
|
|
2022-12-06 14:00:11 +00:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* last value for the zoom level, useful in Eeschema when changing the current displayed
|
|
|
|
* sheet to reuse the same zoom level when back to the sheet using this screen
|
|
|
|
*/
|
|
|
|
double m_LastZoomLevel;
|
|
|
|
|
|
|
|
private:
|
2021-03-25 21:13:01 +00:00
|
|
|
wxString m_fileName; // File used to load the screen.
|
|
|
|
int m_fileFormatVersionAtLoad;
|
|
|
|
int m_refCount; // Number of sheets referencing this screen.
|
|
|
|
// Delete when it goes to zero.
|
|
|
|
/**
|
|
|
|
* The list of sheet paths sharing this screen. Used in some annotation calculations to
|
|
|
|
* update alternate references.
|
|
|
|
*
|
|
|
|
* Note: a screen having a m_refCount = 1 (only one sheet path using it) can have many
|
|
|
|
* sheet paths sharing this screen if it is inside another sheet having many instances.
|
|
|
|
*/
|
|
|
|
std::vector<SCH_SHEET_PATH> m_clientSheetPathList;
|
|
|
|
|
|
|
|
|
|
|
|
PAGE_INFO m_paper; // The size of the paper to print or plot on.
|
|
|
|
TITLE_BLOCK m_titles;
|
2022-01-01 18:57:44 +00:00
|
|
|
VECTOR2I m_aux_origin; // Origin used for drill & place files by Pcbnew.
|
2021-03-25 21:13:01 +00:00
|
|
|
EE_RTREE m_rtree;
|
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
int m_modification_sync; // Inequality with SYMBOL_LIBS::GetModificationHash()
|
2021-03-25 21:13:01 +00:00
|
|
|
// will trigger ResolveAll().
|
|
|
|
|
|
|
|
bool m_zoomInitialized; // Set to true once the zoom value is initialized with
|
|
|
|
// `InitZoom()`.
|
|
|
|
|
2021-10-14 13:12:40 +00:00
|
|
|
bool m_isReadOnly; ///< Read only status of the screen file.
|
|
|
|
|
|
|
|
///< Flag to indicate the file associated with this screen has been created.
|
|
|
|
bool m_fileExists;
|
|
|
|
|
2021-03-25 21:13:01 +00:00
|
|
|
/// List of bus aliases stored in this screen.
|
2022-09-11 17:41:54 +00:00
|
|
|
std::set< std::shared_ptr< BUS_ALIAS > > m_aliases;
|
2021-03-25 21:13:01 +00:00
|
|
|
|
|
|
|
/// Library symbols required for this schematic.
|
2021-06-10 18:51:46 +00:00
|
|
|
std::map<wxString, LIB_SYMBOL*> m_libSymbols;
|
2021-03-25 21:13:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The list of symbol instances loaded from the schematic file.
|
|
|
|
*
|
|
|
|
* This list is only used to as temporary storage when the schematic file is loaded.
|
|
|
|
* If the screen is the root sheet, then this information is used to update the
|
2021-06-10 14:10:55 +00:00
|
|
|
* #SCH_SYMBOL instance reference and unit information after the entire schematic
|
2021-03-25 21:13:01 +00:00
|
|
|
* is loaded and is never used again. If this screen is not the root sheet, then the
|
|
|
|
* schematic file is the root sheet of another project and this information is saved
|
|
|
|
* unchanged back to the schematic file.
|
|
|
|
*
|
|
|
|
* @warning Under no circumstances is this information to be modified or used after the
|
|
|
|
* schematic file is loaded. It is read only and it is only written to non-root
|
|
|
|
* schematic files.
|
|
|
|
*/
|
2023-01-04 20:39:50 +00:00
|
|
|
std::vector<SCH_SYMBOL_INSTANCE> m_symbolInstances;
|
2021-03-25 21:13:01 +00:00
|
|
|
std::vector<SCH_SHEET_INSTANCE> m_sheetInstances;
|
2021-04-06 18:27:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A unique identifier for each schematic file.
|
|
|
|
*
|
|
|
|
* As of right now, this only has meaning for the root schematic. In the future, it may
|
|
|
|
* be useful to detect unexpected hierarchy changes.
|
|
|
|
*/
|
|
|
|
KIID m_uuid;
|
2007-08-20 01:20:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Container class that holds multiple #SCH_SCREEN objects in a hierarchy.
|
|
|
|
*
|
|
|
|
* Individual #SCH_SCREEN objects are unique and correspond to .sch files.
|
2020-05-13 02:00:37 +00:00
|
|
|
*
|
|
|
|
* NOTE: It may be desirable to fold the functionality of SCH_SCREENS into
|
|
|
|
* the new SCHEMATIC class at some point, since SCHEMATIC can also be thought
|
|
|
|
* of as owning the collection of all the SCH_SCREEN objects.
|
2011-10-07 14:41:30 +00:00
|
|
|
*/
|
2010-10-26 20:25:48 +00:00
|
|
|
class SCH_SCREENS
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-05-13 02:00:37 +00:00
|
|
|
SCH_SCREENS( SCH_SHEET* aSheet );
|
|
|
|
SCH_SCREENS( SCH_SHEET& aSheet ) : SCH_SCREENS( &aSheet ) {}
|
2010-10-26 20:25:48 +00:00
|
|
|
~SCH_SCREENS();
|
2020-04-26 20:53:29 +00:00
|
|
|
size_t GetCount() const { return m_screens.size(); }
|
2008-02-28 19:27:25 +00:00
|
|
|
SCH_SCREEN* GetFirst();
|
|
|
|
SCH_SCREEN* GetNext();
|
2014-04-30 19:16:22 +00:00
|
|
|
SCH_SCREEN* GetScreen( unsigned int aIndex ) const;
|
2020-04-26 20:53:29 +00:00
|
|
|
SCH_SHEET* GetSheet( unsigned int aIndex ) const;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2018-09-03 10:11:39 +00:00
|
|
|
/**
|
2021-06-10 14:10:55 +00:00
|
|
|
* Clear the annotation for the symbols inside new sheetpaths
|
2018-09-03 10:11:39 +00:00
|
|
|
* when a complex hierarchy is modified and new sheetpaths added
|
|
|
|
* when a screen shares more than one sheet path, missing alternate references are added
|
|
|
|
* and alternate references of new sheet paths are cleared
|
|
|
|
*
|
|
|
|
* @param aInitialSheetPathList is the initial sheet paths list of hierarchy before changes.
|
|
|
|
*/
|
|
|
|
void ClearAnnotationOfNewSheetPaths( SCH_SHEET_LIST& aInitialSheetPathList );
|
|
|
|
|
2010-12-31 19:47:39 +00:00
|
|
|
/**
|
2021-06-10 14:10:55 +00:00
|
|
|
* Test all sheet and symbol objects in the schematic for duplicate time stamps
|
2017-10-06 18:07:43 +00:00
|
|
|
* and replaces them as necessary.
|
2021-03-25 21:13:01 +00:00
|
|
|
*
|
2021-06-10 14:10:55 +00:00
|
|
|
* Time stamps must be unique in order for complex hierarchies know which symbols go
|
2017-10-06 18:07:43 +00:00
|
|
|
* to which sheets.
|
2021-03-25 21:13:01 +00:00
|
|
|
*
|
2010-12-31 19:47:39 +00:00
|
|
|
* @return The number of duplicate time stamps replaced.
|
|
|
|
*/
|
|
|
|
int ReplaceDuplicateTimeStamps();
|
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Delete all electronic rules check markers of \a aMarkerType from all the screens in
|
2011-03-10 19:36:30 +00:00
|
|
|
* the list.
|
2021-03-25 21:13:01 +00:00
|
|
|
*
|
2011-03-25 19:16:05 +00:00
|
|
|
* @param aMarkerType Type of markers to be deleted.
|
2011-03-10 19:36:30 +00:00
|
|
|
*/
|
2020-08-02 21:45:06 +00:00
|
|
|
void DeleteAllMarkers( enum MARKER_BASE::TYPEMARKER aMarkerType, bool aIncludeExclusions );
|
2011-03-10 19:36:30 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
2020-03-16 11:05:01 +00:00
|
|
|
* Delete all markers of a particular type and error code.
|
|
|
|
*/
|
2020-08-02 21:45:06 +00:00
|
|
|
void DeleteMarkers( enum MARKER_BASE::TYPEMARKER aMarkerTyp, int aErrorCode,
|
|
|
|
bool aIncludeExclusions = true );
|
2020-03-16 11:05:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete a specific marker.
|
|
|
|
*/
|
|
|
|
void DeleteMarker( SCH_MARKER* aMarker );
|
2011-10-07 14:41:30 +00:00
|
|
|
|
2017-07-09 18:17:18 +00:00
|
|
|
/**
|
2021-06-10 18:51:46 +00:00
|
|
|
* Initialize the #LIB_SYMBOL reference for each #SCH_SYMBOL found in the full schematic.
|
2020-04-16 16:43:50 +00:00
|
|
|
*
|
|
|
|
* @note This should only be called when the user specifically requests all library symbol
|
|
|
|
* links to be update or when the legacy schematic is opened for the last time. All
|
|
|
|
* subsequent schematic loads with the new s-expression will contain the library
|
|
|
|
* symbols.
|
2017-10-06 18:07:43 +00:00
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[in] aReporter An optional #REPORTER object pointer to write warning and error
|
|
|
|
* messages into.
|
2017-07-09 18:17:18 +00:00
|
|
|
*/
|
2020-04-16 16:43:50 +00:00
|
|
|
void UpdateSymbolLinks( REPORTER* aReporter = nullptr );
|
2017-07-09 18:17:18 +00:00
|
|
|
|
2021-07-07 19:04:10 +00:00
|
|
|
void ClearEditFlags();
|
|
|
|
|
2017-03-05 22:31:31 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Test all of the schematic symbols to see if all #LIB_ID objects library nickname is not
|
2017-03-05 22:31:31 +00:00
|
|
|
* set.
|
|
|
|
*
|
|
|
|
* If none of the #LIB_ID object library nicknames are not set, this indicates that the
|
|
|
|
* project was created before the symbol library implementation.
|
|
|
|
*
|
2017-10-06 18:07:43 +00:00
|
|
|
* @return true in there are any symbols and if all of the #LIB_ID object library nicknames
|
|
|
|
* are empty, otherwise false.
|
2017-03-05 22:31:31 +00:00
|
|
|
*/
|
|
|
|
bool HasNoFullyDefinedLibIds();
|
|
|
|
|
2017-11-17 17:00:04 +00:00
|
|
|
/**
|
2021-03-25 21:13:01 +00:00
|
|
|
* Fetch all of the symbol library nicknames into \a aLibNicknames.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[out] aLibNicknames is the array to populate with all of the unique library nicknames.
|
2017-11-17 17:00:04 +00:00
|
|
|
* @return the number of symbol library nicknames found.
|
|
|
|
*/
|
|
|
|
size_t GetLibNicknames( wxArrayString& aLibNicknames );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Change all of the symbol library nicknames.
|
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[in] aFrom the current symbol library name to change.
|
|
|
|
* @param[in] aTo the new symbol library name.
|
2017-11-17 17:00:04 +00:00
|
|
|
* @return the number of symbol library nicknames that were changed.
|
|
|
|
*/
|
|
|
|
int ChangeSymbolLibNickname( const wxString& aFrom, const wxString& aTo );
|
|
|
|
|
2019-07-19 15:39:29 +00:00
|
|
|
/**
|
|
|
|
* Check if one of the schematics in the list of screens is \a aSchematicFileName.
|
|
|
|
*
|
|
|
|
* Schematic file names in SCH_SCREEN object are stored with the absolute path to
|
|
|
|
* the schematic file.
|
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[in] aSchematicFileName is the schematic file name to search.
|
2019-07-19 15:39:29 +00:00
|
|
|
* @return true if the a schematic matching the file name has been found.
|
|
|
|
*/
|
|
|
|
bool HasSchematic( const wxString& aSchematicFileName );
|
|
|
|
|
2018-09-03 10:11:39 +00:00
|
|
|
/**
|
|
|
|
* built the list of sheet paths sharing a screen for each screen in use
|
|
|
|
*/
|
|
|
|
void BuildClientSheetPathList();
|
|
|
|
|
2019-11-17 16:43:05 +00:00
|
|
|
/**
|
|
|
|
* Check \a aSchematicFileName for a potential file name case sensitivity issue.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2021-03-25 21:13:01 +00:00
|
|
|
* @param[in] aSchematicFileName is the absolute path and file name of the file to test.
|
2019-11-17 16:43:05 +00:00
|
|
|
* @return true if \a aSchematicFileName would cause an issue.
|
|
|
|
*/
|
|
|
|
bool CanCauseCaseSensitivityIssue( const wxString& aSchematicFileName ) const;
|
|
|
|
|
2022-08-17 15:31:49 +00:00
|
|
|
/**
|
|
|
|
* Update the symbol value and footprint instance data for legacy designs.
|
|
|
|
*/
|
|
|
|
void SetLegacySymbolInstanceData();
|
|
|
|
|
2023-02-20 17:55:02 +00:00
|
|
|
/**
|
|
|
|
* Fix legacy power symbols that have mismatched value text fields
|
|
|
|
* and invisible power pin names.
|
|
|
|
*/
|
|
|
|
void FixLegacyPowerSymbolMismatches();
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
private:
|
2020-04-26 20:53:29 +00:00
|
|
|
void addScreenToList( SCH_SCREEN* aScreen, SCH_SHEET* aSheet );
|
2017-11-17 17:00:04 +00:00
|
|
|
void buildScreenList( SCH_SHEET* aSheet);
|
2021-03-25 21:13:01 +00:00
|
|
|
|
|
|
|
std::vector< SCH_SCREEN* > m_screens;
|
|
|
|
std::vector< SCH_SHEET* > m_sheets;
|
|
|
|
unsigned int m_index;
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2018-01-30 08:56:43 +00:00
|
|
|
#endif /* SCREEN_H */
|