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
190 bool HasHierarchy() const { return !m_hierarchy.empty(); }
191
192 void RefreshHierarchy();
193
194 SCH_ITEM* ResolveItem( const KIID& aID, SCH_SHEET_PATH* aPathOut = nullptr,
195 bool aAllowNullptrReturn = false ) const
196 {
197 return m_hierarchy.ResolveItem( aID, aPathOut, aAllowNullptrReturn );
198 }
199
201 {
202 return *m_rootSheet;
203 }
204
210 std::vector<SCH_SHEET*> GetTopLevelSheets() const;
211
212 SCH_SHEET* GetTopLevelSheet( int aIndex = 0 ) const;
213
221 bool IsTopLevelSheetUuid( const KIID& aUuid ) const;
222
230 KIID_PATH NormalizeInstancePath( const KIID_PATH& aPath ) const;
231
239 bool IsInstancePathInProject( const KIID_PATH& aPath ) const;
240
250 void SetTopLevelSheets( const std::vector<SCH_SHEET*>& aSheets );
251
263 void AdoptContent( SCHEMATIC_CONTENT&& aContent ) noexcept;
264
270 void AddTopLevelSheet( SCH_SHEET* aSheet );
271
278 bool RemoveTopLevelSheet( SCH_SHEET* aSheet );
279
286 bool IsTopLevelSheet( const SCH_SHEET* aSheet ) const;
287
289 bool IsValid() const
290 {
291 return m_project && m_rootSheet != nullptr;
292 }
293
295 SCH_SCREEN* RootScreen() const;
296
297 void GetContextualTextVars( wxArrayString* aVars ) const;
298
299 bool ResolveTextVar( const SCH_SHEET_PATH* aSheetPath, wxString* token, int aDepth ) const;
300
302 wxString GetFileName() const;
303
305 {
306 return *m_currentSheet;
307 }
308
309 void SetCurrentSheet( const SCH_SHEET_PATH& aPath )
310 {
311 *m_currentSheet = aPath;
312 }
313
315
318
320 {
321 return m_connectionGraph;
322 }
323
324 const wxString& GetHighlightedNetChain() const { return m_highlightedNetChain; }
325 void SetHighlightedNetChain( const wxString& aNetChain ) { m_highlightedNetChain = aNetChain; }
326
328
329 ERC_SETTINGS& ErcSettings() const;
330
331 std::vector<SCH_MARKER*> ResolveERCExclusions();
332
334 const EMBEDDED_FILES* GetEmbeddedFiles() const;
335
340 std::shared_ptr<BUS_ALIAS> GetBusAlias( const wxString& aLabel ) const;
341
342 void AddBusAlias( std::shared_ptr<BUS_ALIAS> aAlias );
343
344 void SetBusAliases( const std::vector<std::shared_ptr<BUS_ALIAS>>& aAliases );
345
346 // An explicit project table, including an empty one, supersedes legacy sheet definitions.
347 bool HasProjectBusAliases() const;
348
349 const std::vector<std::shared_ptr<BUS_ALIAS>>& GetAllBusAliases() const
350 {
351 return m_busAliases;
352 }
353
360 std::set<wxString> GetNetClassAssignmentCandidates();
361
368 bool ResolveCrossReference( wxString* token, int aDepth ) const;
369
370 std::map<wxString, std::set<int>>& GetPageRefsMap() { return m_labelToPageRefsMap; }
371
372 std::map<int, wxString> GetVirtualPageToSheetNamesMap() const;
373 std::map<int, wxString> GetVirtualPageToSheetPagesMap() const;
374
375 wxString ConvertRefsToKIIDs( const wxString& aSource ) const;
376 wxString ConvertKIIDsToRefs( const wxString& aSource ) const;
377
386
399
406
412
413 void SyncLibSymbolPinMaps( const wxString& aSchLibSymbolName, const LIB_SYMBOL& aSource, SCH_COMMIT* aCommit );
414
419 {
420 m_operatingPoints.clear();
421 }
422
428 void SetOperatingPoint( const wxString& aNetChain, double aValue )
429 {
430 m_operatingPoints[ aNetChain ] = aValue;
431 }
432
433 wxString GetOperatingPoint( const wxString& aNetName, int aPrecision, const wxString& aRange );
434
442 int FixupJunctionsAfterImport( const std::function<void( SCH_LINE*, SCH_LINE* )>& aOnSplit = {} );
443
447 void RecordERCExclusions();
448
450
451 void ClearUnresolvedERCExclusions( int aErrorCode = -1 );
452
457
462 void OnItemsAdded( std::vector<SCH_ITEM*>& aNewItems );
463
468 void OnItemsRemoved( std::vector<SCH_ITEM*>& aRemovedItems );
469
474 void OnItemsChanged( std::vector<SCH_ITEM*>& aItems );
475
482 void OnSchSheetChanged();
483
488
498 void AddListener( SCHEMATIC_LISTENER* aListener );
499
505 void RemoveListener( SCHEMATIC_LISTENER* aListener );
506
510 void RemoveAllListeners();
511
512 void RunOnNestedEmbeddedFiles( const std::function<void( EMBEDDED_FILES* )>& aFunction ) override;
513
517 void EmbedFonts() override;
518
522 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
523
530 std::set<const SCH_SCREEN*> GetSchematicsSharedByMultipleProjects() const;
531
537 bool IsComplexHierarchy() const;
538
540
548 void CleanUp( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen = nullptr );
549
550 // Prepare source geometry and intersheet references before rebuilding connectivity.
551 void CleanUpConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS aCleanupFlags,
552 const std::set<SCH_SCREEN*>& aLocalScreens = {} );
553
554 // Fully rebuild the selected connectivity backend without changing source geometry.
555 void RebuildConnectivity( std::function<void( SCH_ITEM* )>* aChangedItemHandler = nullptr,
556 PROGRESS_REPORTER* aProgressReporter = nullptr,
557 KIGFX::SCH_VIEW* aSchView = nullptr );
558
571 void RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS aCleanupFlags,
572 TOOL_MANAGER* aToolManager,
573 PROGRESS_REPORTER* aProgressReporter = nullptr,
574 KIGFX::SCH_VIEW* aSchView = nullptr,
575 std::function<void( SCH_ITEM* )>* aChangedItemHandler = nullptr,
576 PICKED_ITEMS_LIST* aLastChangeList = nullptr,
577 bool aCleanupDone = false );
578
586
593 bool Contains( const SCH_REFERENCE& aRef ) const;
594
596
607 wxArrayString GetVariantNamesForUI() const;
608
614 wxString GetCurrentVariant() const;
615
616 void SetCurrentVariant( const wxString& aVariantName );
617
624 void DeleteVariant( const wxString& aVariantName, SCH_COMMIT* aCommit = nullptr );
625
626 void AddVariant( const wxString& aVariantName );
627
637 void RenameVariant( const wxString& aOldName, const wxString& aNewName,
638 SCH_COMMIT* aCommit = nullptr );
639
650 void CopyVariant( const wxString& aSourceVariant, const wxString& aNewVariant,
651 SCH_COMMIT* aCommit = nullptr );
652
656 const std::set<wxString>& GetVariantNames() const { return m_variantNames; }
657
661 bool HasVariant( const wxString& aVariantName ) const;
662
669 wxString GetVariantDescription( const wxString& aVariantName ) const;
670
677 void SetVariantDescription( const wxString& aVariantName, const wxString& aDescription );
678
685 void LoadVariants();
686
687#if defined(DEBUG)
688 void Show( int nestLevel, std::ostream& os ) const override {}
689#endif
690
692
702 void SaveToHistory( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData );
703
708 std::weak_ptr<void> GetHistoryLifetimeToken() const { return m_historyLifetime; }
709
710private:
711 bool resolveCrossReference( wxString* aToken, int aDepth ) const;
712
713 friend class SCH_EDIT_FRAME;
714
715 template <typename Func, typename... Args>
716 void InvokeListeners( Func&& aFunc, Args&&... args )
717 {
718 for( auto&& l : m_listeners )
719 ( l->*aFunc )( std::forward<Args>( args )... );
720 }
721
722 void ensureVirtualRoot();
725 void rebuildHierarchyState( bool aResetConnectionGraph );
726
728 std::optional<IMPORT_NET_MAP> m_importNetMap;
729
731 std::shared_ptr<void> m_historyLifetime = std::make_shared<char>();
732
735
737 std::vector<SCH_SHEET*> m_topLevelSheets;
738
747
750 std::unique_ptr<SCH_CONNECTIVITY::FACADE> m_connectivity;
751 std::unique_ptr<SCH_CONNECTIVITY::NETCHAIN_MANAGER> m_netChains;
752
754
760 std::map<wxString, std::set<int>> m_labelToPageRefsMap;
761
765 std::map<wxString, wxString> m_properties;
766
770 std::map<wxString, double> m_operatingPoints;
771
776
778 std::vector<ERC_EXCLUSION> m_unresolvedErcExclusions;
779
783 std::vector<SCHEMATIC_LISTENER*> m_listeners;
784
789
791
793
794 std::vector<std::shared_ptr<BUS_ALIAS>> m_busAliases;
795
797
798 std::set<wxString> m_variantNames;
799
803
806 std::unique_ptr<class SCHEMATIC_TEXT_VAR_ADAPTER> m_textVarAdapter;
807
812
813public:
815};
816
817#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:309
bool m_settingTopLevelSheets
Re-entry guard to prevent infinite recursion between ensureDefaultTopLevelSheet and RefreshHierarchy ...
Definition schematic.h:802
std::unique_ptr< SCH_CONNECTIVITY::NETCHAIN_MANAGER > m_netChains
Definition schematic.h:751
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:317
CONNECTION_GRAPH * m_connectionGraph
Hold and calculate connectivity information of this schematic.
Definition schematic.h:749
std::shared_ptr< void > m_historyLifetime
Sentinel whose expiry signals to LOCAL_HISTORY that this schematic has been destroyed.
Definition schematic.h:731
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:775
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:349
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:324
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:539
SCH_SHEET_PATH * m_currentSheet
The sheet path of the sheet currently being edited or displayed.
Definition schematic.h:746
std::vector< SCH_SHEET * > m_topLevelSheets
List of top-level sheets (direct children of virtual root)
Definition schematic.h:737
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:418
SCH_SCREEN * GetCurrentScreen() const
Definition schematic.h:314
wxString ConvertKIIDsToRefs(const wxString &aSource) const
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Definition schematic.h:194
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:796
std::map< wxString, std::set< int > > & GetPageRefsMap()
Definition schematic.h:370
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:814
void SetHighlightedNetChain(const wxString &aNetChain)
Definition schematic.h:325
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:760
bool HasHierarchy() const
Check if the hierarchy has been built.
Definition schematic.h:190
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:728
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:778
SCH_CONNECTIVITY::FACADE & Connectivity() const
Definition schematic.h:316
size_t GetUnresolvedERCExclusionCount() const
Definition schematic.h:449
wxString ConvertRefsToKIIDs(const wxString &aSource) const
void SetProject(PROJECT *aPrj)
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:727
CONNECTION_GRAPH * ConnectionGraph() const
Definition schematic.h:319
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:794
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition schematic.h:716
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
Definition schematic.h:289
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:806
bool HasProjectBusAliases() const
PROPERTY_LISTENER_SUBSCRIPTION m_fieldListenerSubscription
PROPERTY_MANAGER listener subscription installed in the ctor.
Definition schematic.h:811
const std::set< wxString > & GetVariantNames() const
Return the set of variant names (without the default placeholder).
Definition schematic.h:656
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:428
friend class SCH_EDIT_FRAME
Definition schematic.h:713
void ensureDefaultTopLevelSheet()
SCH_SHEET & Root() const
Definition schematic.h:200
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:750
SCHEMATIC_HOLDER * m_schematicHolder
What currently "Holds" the schematic, i.e.
Definition schematic.h:788
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:708
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:783
SCH_SHEET_PATH & CurrentSheet() const
Definition schematic.h:304
bool ResolveCrossReference(wxString *token, int aDepth) const
Resolves text vars that refer to other items.
wxString m_highlightedNetChain
Definition schematic.h:753
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:770
std::map< wxString, wxString > m_properties
Properties for text variable substitution (and perhaps other uses in future).
Definition schematic.h:765
ERC_SETTINGS & ErcSettings() const
std::set< wxString > m_variantNames
Definition schematic.h:798
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:691
SCH_SHEET * m_rootSheet
The virtual root sheet (has no screen, contains all top-level sheets)
Definition schematic.h:734
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