KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_screen.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2009 Jean-Pierre Charras, [email protected]
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef SCREEN_H
22#define SCREEN_H
23
24#include <cstdint>
25#include <memory>
26#include <optional>
27#include <stddef.h>
28#include <unordered_map>
29#include <unordered_set>
30#include <vector>
31#include <wx/arrstr.h>
32#include <wx/chartype.h>
33#include <wx/gdicmn.h>
34#include <wx/string.h>
35
36#include <base_screen.h>
37#include <core/typeinfo.h>
38#include <kiid.h>
39#include <kiway_holder.h>
40#include <layer_ids.h>
41#include <marker_base.h>
42#include <page_info.h>
43#include <template_fieldnames.h>
44#include <title_block.h>
45
46#include <lib_id.h>
47#include <sch_reference_list.h>
48#include <sch_rtree.h>
49#include <sch_sheet.h>
50#include <sch_label.h>
51#include <sch_sheet_path.h> // SCH_SYMBOL_INSTANCE
52
53class BUS_ALIAS;
54class EDA_ITEM;
55class LIB_SYMBOL;
58class SCH_COMMIT;
59class SCH_PIN;
60class SCH_SYMBOL;
61class SCH_LINE;
62class SCH_LABEL_BASE;
63class PLOTTER;
64class REPORTER;
65class SCH_IO_ALTIUM;
66class SCH_IO_PADS;
67class SCH_EDIT_FRAME;
68class SCH_SHEET_LIST;
71class SCHEMATIC;
73
80
81
83{
85 int Unit;
87
90
91 std::vector<std::pair<FIELD_T, wxString>> Fields;
92
94 Unit( 1 ),
95 BodyStyle( 1 ),
96 KeepSymbol( false ),
97 PlaceAllUnits( false )
98 {
99 }
100};
101
103{
104public:
105 SCH_SCREEN( EDA_ITEM* aParent = nullptr );
106 SCH_SCREEN( const SCH_SCREEN& ) = delete;
107
108 ~SCH_SCREEN();
109
110 SCHEMATIC* Schematic() const;
111
122 EE_RTREE& Items() { return m_rtree; }
123 const EE_RTREE& Items() const { return m_rtree; }
124
125 bool IsEmpty() const
126 {
127 return m_rtree.empty();
128 }
129
130 bool HasItems( KICAD_T aItemType ) const;
131
132 bool HasSheets() const { return HasItems( SCH_SHEET_T ); }
133
134 static bool ClassOf( const EDA_ITEM* aItem );
135
136 virtual wxString GetClass() const override
137 {
138 return wxT( "SCH_SCREEN" );
139 }
140
141 void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
143
144 const PAGE_INFO& GetPageSettings() const { return m_paper; }
145 void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
146
155 void SetFileName( const wxString& aFileName );
156
157 const wxString& GetFileName() const { return m_fileName; }
158
159 void SetFileReadOnly( bool aIsReadOnly ) { m_isReadOnly = aIsReadOnly; }
160 bool IsReadOnly() const { return m_isReadOnly; }
161
162 void SetFileExists( bool aFileExists ) { m_fileExists = aFileExists; }
163 bool FileExists() const { return m_fileExists; }
164
165 const VECTOR2I& GetAuxOrigin() const { return m_aux_origin; }
166 void SetAuxOrigin( const VECTOR2I& aPosition ) { m_aux_origin = aPosition; }
167
169 const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
170
171 void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
172
173 void DecRefCount();
174 void IncRefCount();
175 int GetRefCount() const { return m_refCount; }
176
181 uint64_t ConnectivityRevision() const { return m_connectivityRevision; }
182
185
192 void BumpConnectivityRevision( KICAD_T aChangedType = TYPE_NOT_INIT );
193
198 static bool IsConnectivitySource( const SCH_ITEM* aItem );
199
201 uint64_t ConnectivityId() const { return m_connectivityId; }
202
204 {
205 SCH_SCREEN* screen = nullptr;
206 };
207
208 std::weak_ptr<const CONNECTIVITY_SOURCE> ConnectivitySource() const { return m_connectivitySource; }
209
211 SCH_ITEM* GetConnectivityItem( const KIID& aId ) const;
212
226 std::vector<SCH_SHEET_PATH>& GetClientSheetPaths()
227 {
229 }
230
231 void Append( SCH_ITEM* aItem, bool aUpdateLibSymbol = true );
232
241 void Append( SCH_SCREEN* aScreen );
242
246 void Clear( bool aFree = true );
247
253 void FreeDrawList();
254
263 SCH_ITEM* GetItem( const VECTOR2I& aPosition, int aAccuracy = 0,
264 KICAD_T aType = SCH_LOCATE_ANY_T ) const;
265
283 void UpdateSymbolLinks( REPORTER* aReporter = nullptr, LEGACY_SYMBOL_LIBS* aLegacyLibs = nullptr,
284 SYMBOL_LIBRARY_ADAPTER* aLibraries = nullptr );
285
291
301 void Plot( PLOTTER* aPlotter, const SCH_PLOT_OPTS& aPlotOpts ) const;
302
310 void Plot( PLOTTER* aPlotter, const SCH_PLOT_OPTS& aPlotOpts,
311 const std::vector<SCH_ITEM*>& aItems ) const;
312
321 bool Remove( SCH_ITEM* aItem, bool aUpdateLibSymbol = true );
322
329 void Update( SCH_ITEM* aItem, bool aUpdateLibSymbol = true );
330
335 void UpdateDisplayBounds( SCH_ITEM* aItem );
336
348 bool PruneUnusedLibSymbol( const wxString& aName );
349
356 void IncludeVariantSymbols( const SCH_SYMBOL& aSymbol, bool aRefresh = false );
357
366 void DeleteItem( SCH_ITEM* aItem );
367
368 bool CheckIfOnDrawList( const SCH_ITEM* aItem ) const;
369
376 void TestDanglingEnds( const SCH_SHEET_PATH* aPath = nullptr,
377 std::function<void( SCH_ITEM* )>* aChangedHandler = nullptr ) const;
378
387 std::set<SCH_ITEM*> MarkConnections( SCH_ITEM* aItem, bool aSecondPass );
388
392 void ClearDrawingState();
393
394 size_t CountConnectedItems( const VECTOR2I& aPos, bool aTestJunctions ) const;
395
410 bool IsJunction( const VECTOR2I& aPosition ) const;
411
417 bool IsExplicitJunction( const VECTOR2I& aPosition ) const;
418
424 bool IsExplicitJunctionNeeded( const VECTOR2I& aPosition ) const;
425
427 SPIN_STYLE aDefaultOrientation,
428 const SCH_SHEET_PATH* aSheet ) const;
434 bool IsExplicitJunctionAllowed( const VECTOR2I& aPosition ) const;
435
444 bool IsTerminalPoint( const VECTOR2I& aPosition, int aLayer ) const;
445
455 SCH_PIN* GetPin( const VECTOR2I& aPosition, SCH_SYMBOL** aSymbol = nullptr,
456 bool aEndPointOnly = false ) const;
457
464 SCH_SHEET_PIN* GetSheetPin( const VECTOR2I& aPosition ) const;
465
474 void ClearAnnotation( SCH_SHEET_PATH* aSheetPath, bool aResetPrefix );
475
486
492 void GetHierarchicalItems( std::vector<SCH_ITEM*>* aItems ) const;
493
498 void GetSheets( std::vector<SCH_ITEM*>* aItems ) const;
499
510 SCH_LINE* GetLine( const VECTOR2I& aPosition, int aAccuracy = 0, int aLayer = LAYER_NOTES,
511 SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const;
512
513 SCH_LINE* GetWire( const VECTOR2I& aPosition, int aAccuracy = 0,
514 SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const
515 {
516 return GetLine( aPosition, aAccuracy, LAYER_WIRE, aSearchType );
517 }
518
519 SCH_LINE* GetBus( const VECTOR2I& aPosition, int aAccuracy = 0,
520 SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const
521 {
522 return GetLine( aPosition, aAccuracy, LAYER_BUS, aSearchType );
523 }
524
532 std::vector<SCH_LINE*> GetBusesAndWires( const VECTOR2I& aPosition,
533 bool aIgnoreEndpoints = false ) const;
534
540 std::vector<VECTOR2I> GetConnections() const;
541
548 std::vector<VECTOR2I> GetNeededJunctions( const std::deque<EDA_ITEM*>& aItems ) const;
549
557 SCH_LABEL_BASE* GetLabel( const VECTOR2I& aPosition, int aAccuracy = 0 ) const;
558
565 const std::map<wxString, LIB_SYMBOL*>& GetLibSymbols() const { return m_libSymbols; }
566
576 void AddLibSymbol( LIB_SYMBOL* aLibSymbol );
577
578 void AddLibSymbol( const wxString& aKey, std::unique_ptr<LIB_SYMBOL> aLibSymbol );
579
585 void FixupEmbeddedData();
586
590 void AddBusAlias( std::shared_ptr<BUS_ALIAS> aAlias );
591
592 const std::vector<SCH_SYMBOL_INSTANCE>& GetSymbolInstances() const
593 {
594 return m_symbolInstances;
595 }
596
597 const std::vector<SCH_SHEET_INSTANCE>& GetSheetInstances() const
598 {
599 return m_sheetInstances;
600 }
601
602 const KIID& GetUuid() const { return m_uuid; }
603
604 void AssignNewUuid() { m_uuid = KIID(); }
605
610
616
621
623
630 bool InProjectPath() const;
631
632#if defined(DEBUG)
633 void Show( int nestLevel, std::ostream& os ) const override;
634#endif
635
639 void MigrateSimModels();
640
653 void PruneOrphanedSymbolInstances( const wxString& aProjectName,
654 const SCH_SHEET_LIST& aValidSheetPaths );
655
668 void PruneOrphanedSheetInstances( const wxString& aProjectName,
669 const SCH_SHEET_LIST& aValidSheetPaths );
670
674 std::set<wxString> GetSheetNames() const;
675
685
692 wxString GroupsSanityCheck( bool repair = false );
693
699 wxString GroupsSanityCheckInternal( bool repair );
700
701 std::set<wxString> GetVariantNames() const;
702
703 void DeleteVariant( const wxString& aVariantName, SCH_COMMIT* aCommit = nullptr );
704
705 void RenameVariant( const wxString& aOldName, const wxString& aNewName,
706 SCH_COMMIT* aCommit = nullptr );
707
708 void CopyVariant( const wxString& aSourceVariant, const wxString& aNewVariant,
709 SCH_COMMIT* aCommit = nullptr );
710
711private:
712 friend SCH_EDIT_FRAME; // Only to populate m_symbolInstances.
713 friend SCH_IO_KICAD_SEXPR_PARSER; // Only to load instance information from schematic file.
714 friend SCH_IO_KICAD_SEXPR; // Only to save the loaded instance information to schematic file.
717 friend SCHEMATIC; // Only to adopt staged content, see SCHEMATIC::AdoptContent().
719
720 bool doIsJunction( const VECTOR2I& aPosition, bool aBreakCrossings,
721 bool* aHasExplicitJunctionDot, bool* aHasBusEntry ) const;
722
723 void clearLibSymbols();
724
738 size_t getLibSymbolNameMatches( const SCH_SYMBOL& aSymbol, std::vector<wxString>& aMatches );
739
740public:
741 bool IsZoomInitialized() const { return m_zoomInitialized; }
742
748
749private:
750 const uint64_t m_connectivityId;
751 std::shared_ptr<CONNECTIVITY_SOURCE> m_connectivitySource;
754 mutable std::optional<std::unordered_map<KIID, SCH_ITEM*>> m_connectivityItems;
755
756 wxString m_fileName; // File used to load the screen.
758 int m_refCount; // Number of sheets referencing this screen.
759 // Delete when it goes to zero.
767 std::vector<SCH_SHEET_PATH> m_clientSheetPathList;
768
769
770 PAGE_INFO m_paper; // The size of the paper to print or plot on.
772 VECTOR2I m_aux_origin; // Origin used for drill & place files by Pcbnew.
774
775 int m_modification_sync; // Inequality with SYMBOL_LIBS::GetModificationHash()
776 // will trigger ResolveAll().
777
778 bool m_zoomInitialized; // Set to true once the zoom value is initialized with
779 // `InitZoom()`.
780
782
785
787 std::map<wxString, LIB_SYMBOL*> m_libSymbols;
788
803 std::vector<SCH_SYMBOL_INSTANCE> m_symbolInstances;
804 std::vector<SCH_SHEET_INSTANCE> m_sheetInstances;
805
813};
814
815
826{
827public:
828 SCH_SCREENS( SCH_SHEET* aSheet );
829 SCH_SCREENS( SCH_SHEET& aSheet ) : SCH_SCREENS( &aSheet ) {}
830 ~SCH_SCREENS();
831 size_t GetCount() const { return m_screens.size(); }
834 SCH_SCREEN* GetScreen( unsigned int aIndex ) const;
835 SCH_SHEET* GetSheet( unsigned int aIndex ) const;
836
845 void ClearAnnotationOfNewSheetPaths( SCH_SHEET_LIST& aInitialSheetPathList );
846
857
865 void DeleteAllMarkers( enum MARKER_BASE::MARKER_T aMarkerType, bool aIncludeExclusions );
866
870 void DeleteMarkers( enum MARKER_BASE::MARKER_T aMarkerTyp, int aErrorCode,
871 bool aIncludeExclusions = true );
872
876 void DeleteMarker( SCH_MARKER* aMarker );
877
889 void UpdateSymbolLinks( REPORTER* aReporter = nullptr );
890
891 void ClearEditFlags();
892
904
911 size_t GetLibNicknames( wxArrayString& aLibNicknames );
912
920 int ChangeSymbolLibNickname( const wxString& aFrom, const wxString& aTo );
921
931 bool HasSchematic( const wxString& aSchematicFileName );
932
937
942
948
949 void PruneOrphanedSymbolInstances( const wxString& aProjectName,
950 const SCH_SHEET_LIST& aValidSheetPaths );
951
952 void PruneOrphanedSheetInstances( const wxString& aProjectName,
953 const SCH_SHEET_LIST& aValidSheetPaths );
954
956
957 std::set<wxString> GetVariantNames() const;
958
959 void DeleteVariant( const wxString& aVariantName, SCH_COMMIT* aCommit = nullptr );
960
961 void RenameVariant( const wxString& aOldName, const wxString& aNewName,
962 SCH_COMMIT* aCommit = nullptr );
963
964 void CopyVariant( const wxString& aSourceVariant, const wxString& aNewVariant,
965 SCH_COMMIT* aCommit = nullptr );
966
967private:
968 void addScreenToList( SCH_SCREEN* aScreen, SCH_SHEET* aSheet );
969 void buildScreenList( SCH_SHEET* aSheet);
970
971 std::vector< SCH_SCREEN* > m_screens;
972 std::vector< SCH_SHEET* > m_sheets;
973 unsigned int m_index;
974};
975
976#endif /* SCREEN_H */
BASE_SCREEN class implementation.
BASE_SCREEN(EDA_ITEM *aParent, KICAD_T aType=SCREEN_T)
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:84
Implement an R-tree for fast spatial and type indexing of schematic items.
Definition sch_rtree.h:37
Definition kiid.h:46
A collection of LIB_SYMBOL objects.
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
Define a library symbol object.
Definition lib_symbol.h:114
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition page_info.h:75
Base plotter engine class.
Definition plotter.h:138
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:73
Holds all the data relating to one schematic.
Definition schematic.h:149
Commit for the schematic and symbol editors.
Definition sch_commit.h:54
Schematic editor (Eeschema) main window.
Object to parser s-expression symbol library and schematic file formats.
A SCH_IO derivation for loading schematic files using the new s-expression file format.
A SCH_IO derivation for loading PADS Logic schematic files.
Definition sch_io_pads.h:39
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:170
Segment description base class to describe items which have 2 end points (track, wire,...
Definition sch_line.h:39
SCH_SCREEN * GetNext()
unsigned int m_index
Definition sch_screen.h:973
std::vector< SCH_SHEET * > m_sheets
Definition sch_screen.h:972
SCH_SCREEN * GetScreen(unsigned int aIndex) const
void UpdateSymbolLinks(REPORTER *aReporter=nullptr)
Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in the full schematic.
void DeleteMarker(SCH_MARKER *aMarker)
Delete a specific marker.
void DeleteMarkers(enum MARKER_BASE::MARKER_T aMarkerTyp, int aErrorCode, bool aIncludeExclusions=true)
Delete all markers of a particular type and error code.
void buildScreenList(SCH_SHEET *aSheet)
void FixLegacyPowerSymbolMismatches()
Fix legacy power symbols that have mismatched value text fields and invisible power pin names.
void CopyVariant(const wxString &aSourceVariant, const wxString &aNewVariant, SCH_COMMIT *aCommit=nullptr)
SCH_SCREEN * GetFirst()
void DeleteAllMarkers(enum MARKER_BASE::MARKER_T aMarkerType, bool aIncludeExclusions)
Delete all electronic rules check markers of aMarkerType from all the screens in the list.
void PruneOrphanedSheetInstances(const wxString &aProjectName, const SCH_SHEET_LIST &aValidSheetPaths)
int ChangeSymbolLibNickname(const wxString &aFrom, const wxString &aTo)
Change all of the symbol library nicknames.
void RenameVariant(const wxString &aOldName, const wxString &aNewName, SCH_COMMIT *aCommit=nullptr)
SCH_SCREENS(SCH_SHEET *aSheet)
SCH_SCREENS(SCH_SHEET &aSheet)
Definition sch_screen.h:829
void BuildClientSheetPathList()
Build the list of sheet paths sharing a screen for each screen in use.
bool HasSymbolFieldNamesWithWhiteSpace() const
size_t GetCount() const
Definition sch_screen.h:831
void ClearAnnotationOfNewSheetPaths(SCH_SHEET_LIST &aInitialSheetPathList)
Clear the annotation for the symbols inside new sheetpaths when a complex hierarchy is modified and n...
void PruneOrphanedSymbolInstances(const wxString &aProjectName, const SCH_SHEET_LIST &aValidSheetPaths)
bool HasNoFullyDefinedLibIds()
Test all of the schematic symbols to see if all LIB_ID objects library nickname is not set.
void ClearEditFlags()
SCH_SHEET * GetSheet(unsigned int aIndex) const
int ReplaceDuplicateTimeStamps()
Test all sheet and symbol objects in the schematic for duplicate time stamps and replaces them as nec...
std::set< wxString > GetVariantNames() const
std::vector< SCH_SCREEN * > m_screens
Definition sch_screen.h:971
void DeleteVariant(const wxString &aVariantName, SCH_COMMIT *aCommit=nullptr)
bool HasSchematic(const wxString &aSchematicFileName)
Check if one of the schematics in the list of screens is aSchematicFileName.
size_t GetLibNicknames(wxArrayString &aLibNicknames)
Fetch all of the symbol library nicknames into aLibNicknames.
void SetLegacySymbolInstanceData()
Update the symbol value and footprint instance data for legacy designs.
void addScreenToList(SCH_SCREEN *aScreen, SCH_SHEET *aSheet)
void SetFileFormatVersionAtLoad(int aVersion)
Definition sch_screen.h:141
const PAGE_INFO & GetPageSettings() const
Definition sch_screen.h:144
std::set< wxString > GetVariantNames() const
std::shared_ptr< CONNECTIVITY_SOURCE > m_connectivitySource
Definition sch_screen.h:751
uint64_t m_connectivitySymbolRevision
Definition sch_screen.h:753
void DeleteVariant(const wxString &aVariantName, SCH_COMMIT *aCommit=nullptr)
std::map< wxString, LIB_SYMBOL * > m_libSymbols
Library symbols required for this schematic.
Definition sch_screen.h:787
SCH_PIN * GetPin(const VECTOR2I &aPosition, SCH_SYMBOL **aSymbol=nullptr, bool aEndPointOnly=false) const
Test the screen for a symbol pin item at aPosition.
bool m_fileExists
Flag to indicate the file associated with this screen has been created.
Definition sch_screen.h:784
void ClearDrawingState()
Clear the state flags of all the items in the screen.
std::vector< SCH_SHEET_INSTANCE > m_sheetInstances
Definition sch_screen.h:804
SCH_LINE * GetLine(const VECTOR2I &aPosition, int aAccuracy=0, int aLayer=LAYER_NOTES, SCH_LINE_TEST_T aSearchType=ENTIRE_LENGTH_T) const
Return a line item located at aPosition.
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition sch_screen.h:171
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
void AddLibSymbol(LIB_SYMBOL *aLibSymbol)
Add aLibSymbol to the library symbol map.
bool HasSymbolFieldNamesWithWhiteSpace() const
void AddBusAlias(std::shared_ptr< BUS_ALIAS > aAlias)
Add a bus alias definition.
void FixLegacyPowerSymbolMismatches()
Fix legacy power symbols that have mismatched value text fields and invisible power pin names.
bool HasItems(KICAD_T aItemType) const
void Clear(bool aFree=true)
Delete all draw items and clears the project settings.
bool HasInstanceDataFromOtherProjects() const
Check symbols for instance data from other projects.
void PruneOrphanedSymbolInstances(const wxString &aProjectName, const SCH_SHEET_LIST &aValidSheetPaths)
Remove all invalid symbol instance data in this screen object for the project defined by aProjectName...
std::vector< SCH_SHEET_PATH > & GetClientSheetPaths()
Return the number of times this screen is used.
Definition sch_screen.h:226
SCH_LINE * GetWire(const VECTOR2I &aPosition, int aAccuracy=0, SCH_LINE_TEST_T aSearchType=ENTIRE_LENGTH_T) const
Definition sch_screen.h:513
const uint64_t m_connectivityId
Definition sch_screen.h:750
std::set< SCH_ITEM * > MarkConnections(SCH_ITEM *aItem, bool aSecondPass)
Return all wires and junctions connected to aItem which are not connected any symbol pin or all graph...
std::set< wxString > GetSheetNames() const
const EE_RTREE & Items() const
Definition sch_screen.h:123
TITLE_BLOCK m_titles
Definition sch_screen.h:771
void TestDanglingEnds(const SCH_SHEET_PATH *aPath=nullptr, std::function< void(SCH_ITEM *)> *aChangedHandler=nullptr) const
Test all of the connectable objects in the schematic for unused connection points.
static bool IsConnectivitySource(const SCH_ITEM *aItem)
Markers, bitmaps, plain shapes, graphic lines and groups carry nothing captured by connectivity.
void EnsureAlternateReferencesExist()
For screens shared by many sheetpaths (complex hierarchies): to be able to clear or modify any refere...
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition sch_screen.h:145
bool AllSymbolDefaultInstancesNotSet()
Check all symbol default instance to see if they are not set yet.
void PruneOrphanedSheetInstances(const wxString &aProjectName, const SCH_SHEET_LIST &aValidSheetPaths)
Remove all invalid sheet instance data in this screen object for the project defined by aProjectName ...
std::vector< SCH_LINE * > GetBusesAndWires(const VECTOR2I &aPosition, bool aIgnoreEndpoints=false) const
Return buses and wires passing through aPosition.
const std::map< wxString, LIB_SYMBOL * > & GetLibSymbols() const
Fetch a list of unique LIB_SYMBOL object pointers required to properly render each SCH_SYMBOL in this...
Definition sch_screen.h:565
uint64_t ConnectivityId() const
Process-local lifetime identity; file UUIDs can be shared by distinct screens.
Definition sch_screen.h:201
uint64_t ConnectivityRevision() const
The only change signal that the connectivity engine reads from this screen.
Definition sch_screen.h:181
wxString GroupsSanityCheckInternal(bool repair)
int m_modification_sync
Definition sch_screen.h:775
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
Definition sch_screen.h:747
const VECTOR2I & GetAuxOrigin() const
Definition sch_screen.h:165
void SetAuxOrigin(const VECTOR2I &aPosition)
Definition sch_screen.h:166
SCH_SCREEN(const SCH_SCREEN &)=delete
void UpdateDisplayBounds(SCH_ITEM *aItem)
Refresh display bounds only; the item's source and membership must be unchanged.
bool IsExplicitJunction(const VECTOR2I &aPosition) const
Indicate that a junction dot is necessary at the given location.
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Definition sch_screen.h:122
int m_fileFormatVersionAtLoad
Definition sch_screen.h:757
const wxString & GetFileName() const
Definition sch_screen.h:157
void DecRefCount()
const KIID & GetUuid() const
Definition sch_screen.h:602
friend SCH_IO_KICAD_SEXPR_PARSER
Definition sch_screen.h:713
SCH_ITEM * GetItem(const VECTOR2I &aPosition, int aAccuracy=0, KICAD_T aType=SCH_LOCATE_ANY_T) const
Check aPosition within a distance of aAccuracy for items of type aFilter.
bool IsExplicitJunctionAllowed(const VECTOR2I &aPosition) const
Indicate that a junction dot may be placed at the given location.
bool IsZoomInitialized() const
Definition sch_screen.h:741
void clearLibSymbols()
wxString m_fileName
Definition sch_screen.h:756
bool IsTerminalPoint(const VECTOR2I &aPosition, int aLayer) const
Test if aPosition is a connection point on aLayer.
bool IsReadOnly() const
Definition sch_screen.h:160
void UpdateLocalLibSymbolLinks()
Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in this schematic with the local projec...
void IncRefCount()
friend SCH_IO_ALTIUM
Definition sch_screen.h:715
friend TEST_SCH_SCREEN_FIXTURE
Definition sch_screen.h:718
void BumpConnectivityRevision(KICAD_T aChangedType=TYPE_NOT_INIT)
Increment the connectivity revisions of this screen.
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
static bool ClassOf(const EDA_ITEM *aItem)
void SetLegacySymbolInstanceData()
Update the symbol value and footprint instance data for legacy designs.
uint64_t m_connectivityRevision
Definition sch_screen.h:752
const std::vector< SCH_SYMBOL_INSTANCE > & GetSymbolInstances() const
Definition sch_screen.h:592
void UpdateSymbolLinks(REPORTER *aReporter=nullptr, LEGACY_SYMBOL_LIBS *aLegacyLibs=nullptr, SYMBOL_LIBRARY_ADAPTER *aLibraries=nullptr)
Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in this schematic from the project LIBR...
SCH_LINE * GetBus(const VECTOR2I &aPosition, int aAccuracy=0, SCH_LINE_TEST_T aSearchType=ENTIRE_LENGTH_T) const
Definition sch_screen.h:519
bool Remove(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Remove aItem from the schematic associated with this screen.
std::weak_ptr< const CONNECTIVITY_SOURCE > ConnectivitySource() const
Definition sch_screen.h:208
std::vector< SCH_SHEET_PATH > m_clientSheetPathList
The list of sheet paths sharing this screen.
Definition sch_screen.h:767
SCH_SCREEN(EDA_ITEM *aParent=nullptr)
friend SCH_IO_KICAD_SEXPR
Definition sch_screen.h:714
SCHEMATIC * Schematic() const
uint64_t ConnectivitySymbolRevision() const
Changes with every bump except a wire-only bump, so wire edits keep cached text.
Definition sch_screen.h:184
EE_RTREE m_rtree
Definition sch_screen.h:773
void FixupEmbeddedData()
After loading a file from disk, the library symbols do not yet contain the full data for their embedd...
bool HasSheets() const
Definition sch_screen.h:132
SCH_ITEM * GetConnectivityItem(const KIID &aId) const
Resolve a drawing item or a connectable child on this screen; ambiguous IDs return null.
int GetFileFormatVersionAtLoad() const
Definition sch_screen.h:142
VECTOR2I m_aux_origin
Definition sch_screen.h:772
void CopyVariant(const wxString &aSourceVariant, const wxString &aNewVariant, SCH_COMMIT *aCommit=nullptr)
void GetHierarchicalItems(std::vector< SCH_ITEM * > *aItems) const
Add all schematic sheet and symbol objects in the screen to aItems.
TITLE_BLOCK & GetTitleBlock()
Definition sch_screen.h:168
bool IsExplicitJunctionNeeded(const VECTOR2I &aPosition) const
Indicate that a junction dot is necessary at the given location, and does not yet exist.
friend SCHEMATIC
Definition sch_screen.h:717
SCH_SHEET_PIN * GetSheetPin(const VECTOR2I &aPosition) const
Test the screen if aPosition is a sheet label object.
wxString GroupsSanityCheck(bool repair=false)
Consistency check of internal m_groups structure.
bool InProjectPath() const
Check if the schematic file is in the current project path.
const TITLE_BLOCK & GetTitleBlock() const
Definition sch_screen.h:169
void RenameVariant(const wxString &aOldName, const wxString &aNewName, SCH_COMMIT *aCommit=nullptr)
void FreeDrawList()
Free all the items from the schematic associated with the screen.
friend SCH_IO_PADS
Definition sch_screen.h:716
void Plot(PLOTTER *aPlotter, const SCH_PLOT_OPTS &aPlotOpts) const
Plot all the schematic objects to aPlotter.
virtual wxString GetClass() const override
Return the class name.
Definition sch_screen.h:136
friend SCH_EDIT_FRAME
Definition sch_screen.h:712
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Refresh a changed item in the tree and invalidate connectivity.
bool m_zoomInitialized
Definition sch_screen.h:778
std::vector< VECTOR2I > GetNeededJunctions(const std::deque< EDA_ITEM * > &aItems) const
Return the unique set of points belonging to aItems where a junction is needed.
bool FileExists() const
Definition sch_screen.h:163
int GetRefCount() const
Definition sch_screen.h:175
void AssignNewUuid()
Definition sch_screen.h:604
PAGE_INFO m_paper
Definition sch_screen.h:770
bool IsJunction(const VECTOR2I &aPosition) const
Test if a junction is required for the items at aPosition on the screen.
const std::vector< SCH_SHEET_INSTANCE > & GetSheetInstances() const
Definition sch_screen.h:597
bool m_isReadOnly
Read only status of the screen file.
Definition sch_screen.h:781
void GetSheets(std::vector< SCH_ITEM * > *aItems) const
Similar to Items().OfType( SCH_SHEET_T ), but return the sheets in a deterministic order (L-R,...
bool CheckIfOnDrawList(const SCH_ITEM *aItem) const
std::vector< VECTOR2I > GetConnections() const
Collect a unique list of all possible connection points in the schematic.
SPIN_STYLE GetLabelOrientationForPoint(const VECTOR2I &aPosition, SPIN_STYLE aDefaultOrientation, const SCH_SHEET_PATH *aSheet) const
KIID m_uuid
A unique identifier for each schematic file.
Definition sch_screen.h:812
std::vector< SCH_SYMBOL_INSTANCE > m_symbolInstances
The list of symbol instances loaded from the schematic file.
Definition sch_screen.h:803
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear the annotation for the symbols in aSheetPath on the screen.
void SetFileReadOnly(bool aIsReadOnly)
Definition sch_screen.h:159
bool doIsJunction(const VECTOR2I &aPosition, bool aBreakCrossings, bool *aHasExplicitJunctionDot, bool *aHasBusEntry) const
size_t CountConnectedItems(const VECTOR2I &aPos, bool aTestJunctions) const
bool PruneUnusedLibSymbol(const wxString &aName)
Remove the library symbol cached under aName if no symbol on this screen still references that name.
void MigrateSimModels()
Migrate any symbols having V6 simulation models to their V7 equivalents.
void IncludeVariantSymbols(const SCH_SYMBOL &aSymbol, bool aRefresh=false)
Include the alternate symbols that aSymbol's variants select in the library symbols.
void DeleteItem(SCH_ITEM *aItem)
Remove aItem from the linked list and deletes the object.
size_t getLibSymbolNameMatches(const SCH_SYMBOL &aSymbol, std::vector< wxString > &aMatches)
Return a list of potential library symbol matches for aSymbol.
bool IsEmpty() const
Definition sch_screen.h:125
std::optional< std::unordered_map< KIID, SCH_ITEM * > > m_connectivityItems
Definition sch_screen.h:754
void SetFileExists(bool aFileExists)
Definition sch_screen.h:162
SCH_LABEL_BASE * GetLabel(const VECTOR2I &aPosition, int aAccuracy=0) const
Return a label item located at aPosition.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition sch_sheet.h:48
Schematic symbol object.
Definition sch_symbol.h:75
Spin style for labels of all kinds on schematics.
Definition sch_label.h:38
An interface to the global shared library manager that is schematic-specific and linked to one projec...
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition title_block.h:38
@ LAYER_WIRE
Definition layer_ids.h:480
@ LAYER_NOTES
Definition layer_ids.h:495
@ LAYER_BUS
Definition layer_ids.h:481
SCH_LINE_TEST_T
Definition sch_screen.h:75
@ ENTIRE_LENGTH_T
Definition sch_screen.h:76
@ EXCLUDE_END_POINTS_T
Definition sch_screen.h:78
@ END_POINTS_ONLY_T
Definition sch_screen.h:77
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
bool PlaceAllUnits
Definition sch_screen.h:89
std::vector< std::pair< FIELD_T, wxString > > Fields
Definition sch_screen.h:91
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:70
@ TYPE_NOT_INIT
Definition typeinfo.h:73
@ SCH_LOCATE_ANY_T
Definition typeinfo.h:195
@ SCH_SHEET_T
Definition typeinfo.h:171
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708