KiCad PCB EDA Suite
Loading...
Searching...
No Matches
schematic.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef KICAD_SCHEMATIC_H
21#define KICAD_SCHEMATIC_H
22
23#include <eda_item.h>
24#include <embedded_files.h>
25#include <erc/erc_exclusion.h>
27#include <schematic_holder.h>
28#include <sch_rtree.h>
29#include <sch_sheet_path.h>
30#include <schematic_settings.h>
31#include <project.h>
32#include <import_net_map.h>
33
34#include <memory>
35#include <optional>
36#include <vector>
37
38
40class BUS_ALIAS;
42class EDA_BASE_FRAME;
43class ERC_SETTINGS;
44class LIB_SYMBOL;
45class PROJECT;
46class SCH_COMMIT;
47class SCH_LINE;
48class SCH_SCREEN;
49class SCH_SHEET;
50class SCH_SHEET_LIST;
51class SCH_GLOBALLABEL;
52class SCH_REFERENCE;
54class TOOL_MANAGER;
56
57namespace SCH_CONNECTIVITY
58{
59class FACADE;
61}
62
63namespace KIFONT
64{
65class OUTLINE_FONT;
66}
67
68namespace KIGFX
69{
70class SCH_VIEW;
71}
72
73
74class SCHEMATIC;
75
77{
78public:
80 virtual void OnSchItemsAdded( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) {}
81 virtual void OnSchItemsRemoved( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) {}
82 virtual void OnSchItemsChanged( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) {}
83
84 // This is called when the user changes to a new sheet, not when a sheet is altered.
85 // Sheet alteration events will call OnSchItems*
86 virtual void OnSchSheetChanged( SCHEMATIC& aSch ) {}
87
88 virtual void OnSchSelectionChanged( SCHEMATIC& aSch ) {}
89};
90
97
109{
112
115 std::unique_ptr<SCH_SCREEN> screen;
116
120
122 std::unique_ptr<SCH_SCREEN> screenLibSymbols;
123
125 std::vector<std::unique_ptr<SCH_ITEM>> itemOwners;
126
128 std::vector<SCH_SHEET*> topLevelSheets;
129
131 std::optional<SCH_SHEET_PATH> currentSheet;
132 std::unique_ptr<CONNECTION_GRAPH> connectionGraph;
133
135 bool preserveNetChains = false;
136
137 std::optional<EMBEDDED_FILES> embeddedFiles;
139};
140
148class SCHEMATIC : public EDA_ITEM, public EMBEDDED_FILES, public PROJECT::_ELEM
149{
150public:
151 SCHEMATIC( PROJECT* aPrj );
152
153 virtual ~SCHEMATIC();
154
155 virtual wxString GetClass() const override
156 {
157 return wxT( "SCHEMATIC" );
158 }
159
161 void Reset();
162
164 {
165 return m_importNetMap ? &*m_importNetMap : nullptr;
166 }
167
168 void SetImportNetMap( IMPORT_NET_MAP aMap ) { m_importNetMap = std::move( aMap ); }
169
171 PROJECT& Project() const { return *m_project; }
172 void SetProject( PROJECT* aPrj );
173
174 const std::map<wxString, wxString>* GetProperties() { return &m_properties; }
175
177
179
184
191 bool IsHierarchyModified() const;
192
198 bool HasHierarchy() const { return !m_hierarchy.empty(); }
199
200 void RefreshHierarchy();
201
202 SCH_ITEM* ResolveItem( const KIID& aID, SCH_SHEET_PATH* aPathOut = nullptr,
203 bool aAllowNullptrReturn = false ) const
204 {
205 return m_hierarchy.ResolveItem( aID, aPathOut, aAllowNullptrReturn );
206 }
207
209 {
210 return *m_rootSheet;
211 }
212
218 std::vector<SCH_SHEET*> GetTopLevelSheets() const;
219
220 SCH_SHEET* GetTopLevelSheet( int aIndex = 0 ) const;
221
229 bool IsTopLevelSheetUuid( const KIID& aUuid ) const;
230
238 KIID_PATH NormalizeInstancePath( const KIID_PATH& aPath ) const;
239
247 bool IsInstancePathInProject( const KIID_PATH& aPath ) const;
248
258 void SetTopLevelSheets( const std::vector<SCH_SHEET*>& aSheets );
259
271 void AdoptContent( SCHEMATIC_CONTENT&& aContent ) noexcept;
272
278 void AddTopLevelSheet( SCH_SHEET* aSheet );
279
286 bool RemoveTopLevelSheet( SCH_SHEET* aSheet );
287
294 bool IsTopLevelSheet( const SCH_SHEET* aSheet ) const;
295
297 bool IsValid() const
298 {
299 return m_project && m_rootSheet != nullptr;
300 }
301
303 SCH_SCREEN* RootScreen() const;
304
305 void GetContextualTextVars( wxArrayString* aVars ) const;
306
307 bool ResolveTextVar( const SCH_SHEET_PATH* aSheetPath, wxString* token, int aDepth ) const;
308
310 wxString GetFileName() const;
311
313 {
314 return *m_currentSheet;
315 }
316
317 void SetCurrentSheet( const SCH_SHEET_PATH& aPath )
318 {
319 *m_currentSheet = aPath;
320 }
321
323
326
328 {
329 return m_connectionGraph;
330 }
331
332 const wxString& GetHighlightedNetChain() const { return m_highlightedNetChain; }
333 void SetHighlightedNetChain( const wxString& aNetChain ) { m_highlightedNetChain = aNetChain; }
334
336
337 ERC_SETTINGS& ErcSettings() const;
338
339 std::vector<SCH_MARKER*> ResolveERCExclusions();
340
342 const EMBEDDED_FILES* GetEmbeddedFiles() const;
343
348 std::shared_ptr<BUS_ALIAS> GetBusAlias( const wxString& aLabel ) const;
349
350 void AddBusAlias( std::shared_ptr<BUS_ALIAS> aAlias );
351
352 void SetBusAliases( const std::vector<std::shared_ptr<BUS_ALIAS>>& aAliases );
353
354 // An explicit project table, including an empty one, supersedes legacy sheet definitions.
355 bool HasProjectBusAliases() const;
356
357 const std::vector<std::shared_ptr<BUS_ALIAS>>& GetAllBusAliases() const
358 {
359 return m_busAliases;
360 }
361
368 std::set<wxString> GetNetClassAssignmentCandidates();
369
376 bool ResolveCrossReference( wxString* token, int aDepth ) const;
377
378 std::map<wxString, std::set<int>>& GetPageRefsMap() { return m_labelToPageRefsMap; }
379
380 std::map<int, wxString> GetVirtualPageToSheetNamesMap() const;
381 std::map<int, wxString> GetVirtualPageToSheetPagesMap() const;
382
383 wxString ConvertRefsToKIIDs( const wxString& aSource ) const;
384 wxString ConvertKIIDsToRefs( const wxString& aSource ) const;
385
394
407
414
420
421 void SyncLibSymbolPinMaps( const wxString& aSchLibSymbolName, const LIB_SYMBOL& aSource, SCH_COMMIT* aCommit );
422
427 {
428 m_operatingPoints.clear();
429 }
430
436 void SetOperatingPoint( const wxString& aNetChain, double aValue )
437 {
438 m_operatingPoints[ aNetChain ] = aValue;
439 }
440
441 wxString GetOperatingPoint( const wxString& aNetName, int aPrecision, const wxString& aRange );
442
450 int FixupJunctionsAfterImport( const std::function<void( SCH_LINE*, SCH_LINE* )>& aOnSplit = {} );
451
455 void RecordERCExclusions();
456
458
459 void ClearUnresolvedERCExclusions( int aErrorCode = -1 );
460
465
470 void OnItemsAdded( std::vector<SCH_ITEM*>& aNewItems );
471
476 void OnItemsRemoved( std::vector<SCH_ITEM*>& aRemovedItems );
477
482 void OnItemsChanged( std::vector<SCH_ITEM*>& aItems );
483
490 void OnSchSheetChanged();
491
496
506 void AddListener( SCHEMATIC_LISTENER* aListener );
507
513 void RemoveListener( SCHEMATIC_LISTENER* aListener );
514
518 void RemoveAllListeners();
519
520 void RunOnNestedEmbeddedFiles( const std::function<void( EMBEDDED_FILES* )>& aFunction ) override;
521
525 void EmbedFonts() override;
526
530 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
531
538 std::set<const SCH_SCREEN*> GetSchematicsSharedByMultipleProjects() const;
539
545 bool IsComplexHierarchy() const;
546
548
556 void CleanUp( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen = nullptr );
557
558 // Prepare source geometry and intersheet references before rebuilding connectivity.
559 void CleanUpConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS aCleanupFlags,
560 const std::set<SCH_SCREEN*>& aLocalScreens = {} );
561
562 // Fully rebuild the selected connectivity backend without changing source geometry.
563 void RebuildConnectivity( std::function<void( SCH_ITEM* )>* aChangedItemHandler = nullptr,
564 PROGRESS_REPORTER* aProgressReporter = nullptr,
565 KIGFX::SCH_VIEW* aSchView = nullptr );
566
579 void RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS aCleanupFlags,
580 TOOL_MANAGER* aToolManager,
581 PROGRESS_REPORTER* aProgressReporter = nullptr,
582 KIGFX::SCH_VIEW* aSchView = nullptr,
583 std::function<void( SCH_ITEM* )>* aChangedItemHandler = nullptr,
584 PICKED_ITEMS_LIST* aLastChangeList = nullptr,
585 bool aCleanupDone = false );
586
594
601 bool Contains( const SCH_REFERENCE& aRef ) const;
602
604
615 wxArrayString GetVariantNamesForUI() const;
616
622 wxString GetCurrentVariant() const;
623
624 void SetCurrentVariant( const wxString& aVariantName );
625
632 void DeleteVariant( const wxString& aVariantName, SCH_COMMIT* aCommit = nullptr );
633
634 void AddVariant( const wxString& aVariantName );
635
645 void RenameVariant( const wxString& aOldName, const wxString& aNewName,
646 SCH_COMMIT* aCommit = nullptr );
647
658 void CopyVariant( const wxString& aSourceVariant, const wxString& aNewVariant,
659 SCH_COMMIT* aCommit = nullptr );
660
664 const std::set<wxString>& GetVariantNames() const { return m_variantNames; }
665
669 bool HasVariant( const wxString& aVariantName ) const;
670
677 wxString GetVariantDescription( const wxString& aVariantName ) const;
678
685 void SetVariantDescription( const wxString& aVariantName, const wxString& aDescription );
686
693 void LoadVariants();
694
695#if defined(DEBUG)
696 void Show( int nestLevel, std::ostream& os ) const override {}
697#endif
698
700
710 void SaveToHistory( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData );
711
716 std::weak_ptr<void> GetHistoryLifetimeToken() const { return m_historyLifetime; }
717
718private:
719 bool resolveCrossReference( wxString* aToken, int aDepth ) const;
720
721 friend class SCH_EDIT_FRAME;
722
723 template <typename Func, typename... Args>
724 void InvokeListeners( Func&& aFunc, Args&&... args )
725 {
726 for( auto&& l : m_listeners )
727 ( l->*aFunc )( std::forward<Args>( args )... );
728 }
729
730 void ensureVirtualRoot();
733 void rebuildHierarchyState( bool aResetConnectionGraph );
734
736 std::optional<IMPORT_NET_MAP> m_importNetMap;
737
739 std::shared_ptr<void> m_historyLifetime = std::make_shared<char>();
740
743
745 std::vector<SCH_SHEET*> m_topLevelSheets;
746
755
758 std::unique_ptr<SCH_CONNECTIVITY::FACADE> m_connectivity;
759 std::unique_ptr<SCH_CONNECTIVITY::NETCHAIN_MANAGER> m_netChains;
760
762
768 std::map<wxString, std::set<int>> m_labelToPageRefsMap;
769
773 std::map<wxString, wxString> m_properties;
774
778 std::map<wxString, double> m_operatingPoints;
779
784
786 std::vector<ERC_EXCLUSION> m_unresolvedErcExclusions;
787
791 std::vector<SCHEMATIC_LISTENER*> m_listeners;
792
797
799
801
802 std::vector<std::shared_ptr<BUS_ALIAS>> m_busAliases;
803
805
806 std::set<wxString> m_variantNames;
807
811
814 std::unique_ptr<class SCHEMATIC_TEXT_VAR_ADAPTER> m_textVarAdapter;
815
820
821public:
823};
824
825#endif
Calculate the connectivity of a schematic and generate netlists.
The base frame for deriving all KiCad main window classes.
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
EMBEDDED_FILES()=default
Container for ERC settings.
Implement outline font drawing.
Definition kiid.h:46
Define a library symbol object.
Definition lib_symbol.h:114
A holder to handle information on schematic or board items.
A progress reporter interface for use in multi-threaded environments.
A PROJECT can hold stuff it knows nothing about, in the form of _ELEM derivatives.
Definition project.h:90
Container for project specific data.
Definition project.h:63
ELEM
The set of _ELEM objects that a PROJECT can hold.
Definition project.h:69
Move-only RAII wrapper around a single listener registration.
This is a bridge class to help the schematic be able to affect SCH_EDIT_FRAME without doing anything ...
virtual void OnSchItemsRemoved(SCHEMATIC &aSch, std::vector< SCH_ITEM * > &aSchItem)
Definition schematic.h:81
virtual ~SCHEMATIC_LISTENER()
Definition schematic.h:79
virtual void OnSchItemsChanged(SCHEMATIC &aSch, std::vector< SCH_ITEM * > &aSchItem)
Definition schematic.h:82
virtual void OnSchSelectionChanged(SCHEMATIC &aSch)
Definition schematic.h:88
virtual void OnSchSheetChanged(SCHEMATIC &aSch)
Definition schematic.h:86
virtual void OnSchItemsAdded(SCHEMATIC &aSch, std::vector< SCH_ITEM * > &aSchItem)
Definition schematic.h:80
These are loaded from Eeschema settings but then overwritten by the project settings.
Bridges SCHEMATIC's listener stream into the generic TEXT_VAR_TRACKER.
Holds all the data relating to one schematic.
Definition schematic.h:149
void SetCurrentVariant(const wxString &aVariantName)
void SetCurrentSheet(const SCH_SHEET_PATH &aPath)
Definition schematic.h:317
bool m_settingTopLevelSheets
Re-entry guard to prevent infinite recursion between ensureDefaultTopLevelSheet and RefreshHierarchy ...
Definition schematic.h:810
std::unique_ptr< SCH_CONNECTIVITY::NETCHAIN_MANAGER > m_netChains
Definition schematic.h:759
void Reset()
Initialize this schematic to a blank one, unloading anything existing.
std::set< const SCH_SCREEN * > GetSchematicsSharedByMultipleProjects() const
Return a list of schematic files in the current project that contain instance data for multiple proje...
void CreateDefaultScreens()
void SetLegacySymbolInstanceData()
Update the symbol value and footprint instance data for legacy designs.
void OnItemsAdded(std::vector< SCH_ITEM * > &aNewItems)
Must be used if Add() is used using a BULK_x ADD_MODE to generate a change event for listeners.
SCH_CONNECTIVITY::NETCHAIN_MANAGER & NetChains() const
Definition schematic.h:325
CONNECTION_GRAPH * m_connectionGraph
Hold and calculate connectivity information of this schematic.
Definition schematic.h:757
std::shared_ptr< void > m_historyLifetime
Sentinel whose expiry signals to LOCAL_HISTORY that this schematic has been destroyed.
Definition schematic.h:739
virtual wxString GetClass() const override
Return the class name.
Definition schematic.h:155
bool IsTopLevelSheet(const SCH_SHEET *aSheet) const
Check if a sheet is a top-level sheet (direct child of virtual root).
void loadBusAliasesFromProject()
void AddTopLevelSheet(SCH_SHEET *aSheet)
Add a new top-level sheet to the schematic.
SCH_SHEET_LIST m_hierarchy
Cache of the entire schematic hierarchy sorted by sheet page number.
Definition schematic.h:783
void rebuildHierarchyState(bool aResetConnectionGraph)
void ResolveERCExclusionsPostUpdate()
Update markers to match recorded exclusions.
void DeleteVariant(const wxString &aVariantName, SCH_COMMIT *aCommit=nullptr)
Delete all information for aVariantName.
void RecomputeIntersheetRefs()
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
void CacheExistingAnnotation()
Store all existing annotations in the REFDES_TRACKER.
wxString GetVariantDescription(const wxString &aVariantName) const
Return the description for a variant.
void LoadVariants()
This is a throw away method for variant testing.
SCH_SHEET_LIST BuildSheetListSortedByPageNumbers() const
void RemoveListener(SCHEMATIC_LISTENER *aListener)
Remove the specified listener.
const std::vector< std::shared_ptr< BUS_ALIAS > > & GetAllBusAliases() const
Definition schematic.h:357
bool HasVariant(const wxString &aVariantName) const
Return true if a variant with this name exists in the schematic (case-insensitively).
const wxString & GetHighlightedNetChain() const
Definition schematic.h:332
bool resolveCrossReference(wxString *aToken, int aDepth) const
bool IsComplexHierarchy() const
Test if the schematic is a complex hierarchy.
void OnSchSheetChanged()
Notify the schematic and its listeners that the current sheet has been changed.
wxString GetFileName() const
Helper to retrieve the filename from the root sheet screen.
void SetSchematicHolder(SCHEMATIC_HOLDER *aHolder)
Definition schematic.h:547
SCH_SHEET_PATH * m_currentSheet
The sheet path of the sheet currently being edited or displayed.
Definition schematic.h:754
std::vector< SCH_SHEET * > m_topLevelSheets
List of top-level sheets (direct children of virtual root)
Definition schematic.h:745
wxString GetOperatingPoint(const wxString &aNetName, int aPrecision, const wxString &aRange)
void CleanUp(SCH_COMMIT *aCommit, SCH_SCREEN *aScreen=nullptr)
Perform routine schematic cleaning including breaking wire and buses and deleting identical objects s...
bool IsTopLevelSheetUuid(const KIID &aUuid) const
Check if a UUID names one of this schematic's top level sheets.
void OnItemsRemoved(std::vector< SCH_ITEM * > &aRemovedItems)
Must be used if Remove() is used using a BULK_x REMOVE_MODE to generate a change event for listeners.
void AddVariant(const wxString &aVariantName)
void OnSchSelectionChanged()
Notify the schematic and its listeners that the editor selection has changed.
virtual ~SCHEMATIC()
void AdoptContent(SCHEMATIC_CONTENT &&aContent) noexcept
Take a staged schematic over from an importer in one indivisible step.
std::shared_ptr< BUS_ALIAS > GetBusAlias(const wxString &aLabel) const
Return a pointer to a bus alias object for the given label, or null if one doesn't exist.
void CopyVariant(const wxString &aSourceVariant, const wxString &aNewVariant, SCH_COMMIT *aCommit=nullptr)
Copy a variant from aSourceVariant to aNewVariant.
std::vector< SCH_MARKER * > ResolveERCExclusions()
void SaveToHistory(const wxString &aProjectPath, std::vector< HISTORY_FILE_DATA > &aFileData)
Serialize schematic sheets into HISTORY_FILE_DATA for non-blocking history commit.
void EmbedFonts() override
Embed fonts in the schematic.
SCHEMATIC_SETTINGS & Settings() const
void ClearOperatingPoints()
Clear operating points from a .op simulation.
Definition schematic.h:426
SCH_SCREEN * GetCurrentScreen() const
Definition schematic.h:322
wxString ConvertKIIDsToRefs(const wxString &aSource) const
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Definition schematic.h:202
void ensureVirtualRoot()
void ensureCurrentSheetIsTopLevel()
void SyncLibSymbolPinMaps(const wxString &aSchLibSymbolName, const LIB_SYMBOL &aSource, SCH_COMMIT *aCommit)
void RecordERCExclusions()
Scan existing markers and record data from any that are Excluded.
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
wxString m_currentVariant
Definition schematic.h:804
std::map< wxString, std::set< int > > & GetPageRefsMap()
Definition schematic.h:378
SCH_SHEET_LIST BuildUnorderedSheetList() const
void RenameVariant(const wxString &aOldName, const wxString &aNewName, SCH_COMMIT *aCommit=nullptr)
Rename a variant from aOldName to aNewName.
class SCHEMATIC_TEXT_VAR_ADAPTER * GetTextVarAdapter() const
Definition schematic.h:822
void SetHighlightedNetChain(const wxString &aNetChain)
Definition schematic.h:333
PROJECT & Project() const
Return a reference to the project this schematic is part of.
Definition schematic.h:171
std::map< wxString, std::set< int > > m_labelToPageRefsMap
Holds a map of labels to the page sequence (virtual page number) that they appear on.
Definition schematic.h:768
bool HasHierarchy() const
Check if the hierarchy has been built.
Definition schematic.h:198
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get a set of fonts used in the schematic.
SCH_SHEET * GetTopLevelSheet(int aIndex=0) const
bool RemoveTopLevelSheet(SCH_SHEET *aSheet)
Remove a top-level sheet from the schematic.
std::optional< IMPORT_NET_MAP > m_importNetMap
Definition schematic.h:736
bool Contains(const SCH_REFERENCE &aRef) const
Check if the schematic contains the specified reference.
const IMPORT_NET_MAP * GetImportNetMap() const
Definition schematic.h:163
void ClearUnresolvedERCExclusions(int aErrorCode=-1)
std::vector< ERC_EXCLUSION > m_unresolvedErcExclusions
Exclusions whose saved identity cannot currently be reconstructed as a marker.
Definition schematic.h:786
SCH_CONNECTIVITY::FACADE & Connectivity() const
Definition schematic.h:324
size_t GetUnresolvedERCExclusionCount() const
Definition schematic.h:457
wxString ConvertRefsToKIIDs(const wxString &aSource) const
void SetProject(PROJECT *aPrj)
bool IsHierarchyModified() const
True when any sheet in the hierarchy has unsaved changes.
wxString GetCurrentVariant() const
Return the current variant being edited.
void AddListener(SCHEMATIC_LISTENER *aListener)
Add a listener to the schematic to receive calls whenever something on the schematic has been modifie...
void CleanUpConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, const std::set< SCH_SCREEN * > &aLocalScreens={})
std::map< int, wxString > GetVirtualPageToSheetPagesMap() const
EMBEDDED_FILES * GetEmbeddedFiles() override
PROJECT * m_project
Definition schematic.h:735
CONNECTION_GRAPH * ConnectionGraph() const
Definition schematic.h:327
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
SCHEMATIC(PROJECT *aPrj)
Definition schematic.cpp:79
bool ResolveTextVar(const SCH_SHEET_PATH *aSheetPath, wxString *token, int aDepth) const
std::set< wxString > GetNetClassAssignmentCandidates()
Return the set of netname candidates for netclass assignment.
std::vector< std::shared_ptr< BUS_ALIAS > > m_busAliases
Definition schematic.h:802
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition schematic.h:724
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
Definition schematic.h:297
void updateProjectBusAliases()
void SetVariantDescription(const wxString &aVariantName, const wxString &aDescription)
Set the description for a variant.
void RemoveAllListeners()
Remove all listeners.
void SetTopLevelSheets(const std::vector< SCH_SHEET * > &aSheets)
Replace the top level sheets, rebuilding the hierarchy and connectivity around them.
void RebuildConnectivity(std::function< void(SCH_ITEM *)> *aChangedItemHandler=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr, KIGFX::SCH_VIEW *aSchView=nullptr)
std::unique_ptr< class SCHEMATIC_TEXT_VAR_ADAPTER > m_textVarAdapter
Reactive text-variable dependency adapter.
Definition schematic.h:814
bool HasProjectBusAliases() const
PROPERTY_LISTENER_SUBSCRIPTION m_fieldListenerSubscription
PROPERTY_MANAGER listener subscription installed in the ctor.
Definition schematic.h:819
const std::set< wxString > & GetVariantNames() const
Return the set of variant names (without the default placeholder).
Definition schematic.h:664
const std::map< wxString, wxString > * GetProperties()
Definition schematic.h:174
void GetContextualTextVars(wxArrayString *aVars) const
void SetOperatingPoint(const wxString &aNetChain, double aValue)
Set operating points from a .op simulation.
Definition schematic.h:436
friend class SCH_EDIT_FRAME
Definition schematic.h:721
void ensureDefaultTopLevelSheet()
SCH_SHEET & Root() const
Definition schematic.h:208
std::map< int, wxString > GetVirtualPageToSheetNamesMap() const
void RecalculateConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, TOOL_MANAGER *aToolManager, PROGRESS_REPORTER *aProgressReporter=nullptr, KIGFX::SCH_VIEW *aSchView=nullptr, std::function< void(SCH_ITEM *)> *aChangedItemHandler=nullptr, PICKED_ITEMS_LIST *aLastChangeList=nullptr, bool aCleanupDone=false)
Generate the connection data for the entire schematic hierarchy.
void AddBusAlias(std::shared_ptr< BUS_ALIAS > aAlias)
std::vector< SCH_SHEET * > GetTopLevelSheets() const
Get the list of top-level sheets.
wxArrayString GetVariantNamesForUI() const
Return an array of variant names for using in wxWidgets UI controls.
void RunOnNestedEmbeddedFiles(const std::function< void(EMBEDDED_FILES *)> &aFunction) override
Provide access to nested embedded files, such as symbols in schematics and footprints in boards.
std::unique_ptr< SCH_CONNECTIVITY::FACADE > m_connectivity
Definition schematic.h:758
SCHEMATIC_HOLDER * m_schematicHolder
What currently "Holds" the schematic, i.e.
Definition schematic.h:796
wxString GetUniqueFilenameForCurrentSheet()
Get the unique file name for the current sheet.
std::weak_ptr< void > GetHistoryLifetimeToken() const
Liveness token handed to LOCAL_HISTORY::RegisterSaver so a shared autosave timer skips this schematic...
Definition schematic.h:716
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void SetImportNetMap(IMPORT_NET_MAP aMap)
Definition schematic.h:168
void SetBusAliases(const std::vector< std::shared_ptr< BUS_ALIAS > > &aAliases)
std::vector< SCHEMATIC_LISTENER * > m_listeners
Currently installed listeners.
Definition schematic.h:791
SCH_SHEET_PATH & CurrentSheet() const
Definition schematic.h:312
bool ResolveCrossReference(wxString *token, int aDepth) const
Resolves text vars that refer to other items.
wxString m_highlightedNetChain
Definition schematic.h:761
int FixupJunctionsAfterImport(const std::function< void(SCH_LINE *, SCH_LINE *)> &aOnSplit={})
Add junctions to this schematic where required.
KIID_PATH NormalizeInstancePath(const KIID_PATH &aPath) const
Strip the leading virtual root from a stored instance path, which SCH_SHEET_PATH::Path() omits but st...
std::map< wxString, double > m_operatingPoints
Simulation operating points for text variable substitution.
Definition schematic.h:778
std::map< wxString, wxString > m_properties
Properties for text variable substitution (and perhaps other uses in future).
Definition schematic.h:773
ERC_SETTINGS & ErcSettings() const
std::set< wxString > m_variantNames
Definition schematic.h:806
void RefreshHierarchy()
void OnItemsChanged(std::vector< SCH_ITEM * > &aItems)
Notify the schematic and its listeners that an item on the schematic has been modified in some way.
PROJECT::ELEM ProjectElementType() override
Definition schematic.h:699
SCH_SHEET * m_rootSheet
The virtual root sheet (has no screen, contains all top-level sheets)
Definition schematic.h:742
bool IsInstancePathInProject(const KIID_PATH &aPath) const
Test whether an instance path is rooted in this schematic's top level sheets.
Commit for the schematic and symbol editors.
Definition sch_commit.h:54
Model-owned source resolver.
Persistent chain configuration and the derived chains for one schematic.
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
A helper to define a symbol's reference designator in a schematic.
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...
SCH_SCREEN * LastScreen()
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition sch_sheet.h:48
Master controller class:
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:30
Value keys and the key session of the schematic connectivity engine.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
SCH_CLEANUP_FLAGS
Definition schematic.h:92
@ LOCAL_CLEANUP
Definition schematic.h:94
@ NO_CLEANUP
Definition schematic.h:93
@ GLOBAL_CLEANUP
Definition schematic.h:95
Data produced by a registered saver on the UI thread, consumed by either the background local-history...
Import provenance, held only for the lifetime of the importing SCHEMATIC.
A schematic staged off to the side by an importer, ready to be swapped into a live SCHEMATIC in one s...
Definition schematic.h:109
std::optional< EMBEDDED_FILES > embeddedFiles
Definition schematic.h:137
std::unique_ptr< SCH_SCREEN > screen
Screen that replaces the target sheet's screen outright.
Definition schematic.h:115
std::optional< SCH_SHEET_PATH > currentSheet
Definition schematic.h:131
std::vector< std::unique_ptr< SCH_ITEM > > itemOwners
Items in screenItems that nothing else owns yet.
Definition schematic.h:125
SCH_SHEET_LIST hierarchy
Definition schematic.h:130
std::unique_ptr< CONNECTION_GRAPH > connectionGraph
Definition schematic.h:132
bool preserveNetChains
Keep the schematic's net chains instead of the staged graph's, for append.
Definition schematic.h:135
std::vector< SCH_SHEET * > topLevelSheets
Replacement top level sheets. Empty leaves the schematic's own in place.
Definition schematic.h:128
SCH_SHEET * targetSheet
Sheet whose screen receives the content. Null names the schematic's virtual root.
Definition schematic.h:111
std::unique_ptr< SCH_SCREEN > screenLibSymbols
Screen holding only the library cache that the target screen adopts.
Definition schematic.h:122
EE_RTREE screenItems
Spatial index that replaces the target screen's own.
Definition schematic.h:119
wxString drawingSheetFileName
Definition schematic.h:138