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{
60}
61
62namespace KIFONT
63{
64class OUTLINE_FONT;
65}
66
67namespace KIGFX
68{
69class SCH_VIEW;
70}
71
72
73class SCHEMATIC;
74
76{
77public:
79 virtual void OnSchItemsAdded( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) {}
80 virtual void OnSchItemsRemoved( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) {}
81 virtual void OnSchItemsChanged( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) {}
82
83 // This is called when the user changes to a new sheet, not when a sheet is altered.
84 // Sheet alteration events will call OnSchItems*
85 virtual void OnSchSheetChanged( SCHEMATIC& aSch ) {}
86
87 virtual void OnSchSelectionChanged( SCHEMATIC& aSch ) {}
88};
89
96
108{
111
114 std::unique_ptr<SCH_SCREEN> screen;
115
119
121 std::unique_ptr<SCH_SCREEN> screenLibSymbols;
122
124 std::vector<std::unique_ptr<SCH_ITEM>> itemOwners;
125
127 std::vector<SCH_SHEET*> topLevelSheets;
128
130 std::optional<SCH_SHEET_PATH> currentSheet;
131 std::unique_ptr<CONNECTION_GRAPH> connectionGraph;
132
134 bool preserveNetChains = false;
135
136 std::optional<EMBEDDED_FILES> embeddedFiles;
138};
139
147class SCHEMATIC : public EDA_ITEM, public EMBEDDED_FILES, public PROJECT::_ELEM
148{
149public:
150 SCHEMATIC( PROJECT* aPrj );
151
152 virtual ~SCHEMATIC();
153
154 virtual wxString GetClass() const override
155 {
156 return wxT( "SCHEMATIC" );
157 }
158
160 void Reset();
161
163 {
164 return m_importNetMap ? &*m_importNetMap : nullptr;
165 }
166
167 void SetImportNetMap( IMPORT_NET_MAP aMap ) { m_importNetMap = std::move( aMap ); }
168
170 PROJECT& Project() const { return *m_project; }
171 void SetProject( PROJECT* aPrj );
172
173 const std::map<wxString, wxString>* GetProperties() { return &m_properties; }
174
176
178
183
189 bool HasHierarchy() const { return !m_hierarchy.empty(); }
190
191 void RefreshHierarchy();
192
193 SCH_ITEM* ResolveItem( const KIID& aID, SCH_SHEET_PATH* aPathOut = nullptr,
194 bool aAllowNullptrReturn = false ) const
195 {
196 return m_hierarchy.ResolveItem( aID, aPathOut, aAllowNullptrReturn );
197 }
198
200 {
201 return *m_rootSheet;
202 }
203
209 std::vector<SCH_SHEET*> GetTopLevelSheets() const;
210
211 SCH_SHEET* GetTopLevelSheet( int aIndex = 0 ) const;
212
220 bool IsTopLevelSheetUuid( const KIID& aUuid ) const;
221
229 KIID_PATH NormalizeInstancePath( const KIID_PATH& aPath ) const;
230
238 bool IsInstancePathInProject( const KIID_PATH& aPath ) const;
239
249 void SetTopLevelSheets( const std::vector<SCH_SHEET*>& aSheets );
250
262 void AdoptContent( SCHEMATIC_CONTENT&& aContent ) noexcept;
263
269 void AddTopLevelSheet( SCH_SHEET* aSheet );
270
277 bool RemoveTopLevelSheet( SCH_SHEET* aSheet );
278
285 bool IsTopLevelSheet( const SCH_SHEET* aSheet ) const;
286
288 bool IsValid() const
289 {
290 return m_project && m_rootSheet != nullptr;
291 }
292
294 SCH_SCREEN* RootScreen() const;
295
296 void GetContextualTextVars( wxArrayString* aVars ) const;
297
298 bool ResolveTextVar( const SCH_SHEET_PATH* aSheetPath, wxString* token, int aDepth ) const;
299
301 wxString GetFileName() const;
302
304 {
305 return *m_currentSheet;
306 }
307
308 void SetCurrentSheet( const SCH_SHEET_PATH& aPath )
309 {
310 *m_currentSheet = aPath;
311 }
312
314
316
318 {
319 return m_connectionGraph;
320 }
321
322 const wxString& GetHighlightedNetChain() const { return m_highlightedNetChain; }
323 void SetHighlightedNetChain( const wxString& aNetChain ) { m_highlightedNetChain = aNetChain; }
324
326
327 ERC_SETTINGS& ErcSettings() const;
328
329 std::vector<SCH_MARKER*> ResolveERCExclusions();
330
332 const EMBEDDED_FILES* GetEmbeddedFiles() const;
333
338 std::shared_ptr<BUS_ALIAS> GetBusAlias( const wxString& aLabel ) const;
339
340 void AddBusAlias( std::shared_ptr<BUS_ALIAS> aAlias );
341
342 void SetBusAliases( const std::vector<std::shared_ptr<BUS_ALIAS>>& aAliases );
343
344 const std::vector<std::shared_ptr<BUS_ALIAS>>& GetAllBusAliases() const
345 {
346 return m_busAliases;
347 }
348
355 std::set<wxString> GetNetClassAssignmentCandidates();
356
363 bool ResolveCrossReference( wxString* token, int aDepth ) const;
364
365 std::map<wxString, std::set<int>>& GetPageRefsMap() { return m_labelToPageRefsMap; }
366
367 std::map<int, wxString> GetVirtualPageToSheetNamesMap() const;
368 std::map<int, wxString> GetVirtualPageToSheetPagesMap() const;
369
370 wxString ConvertRefsToKIIDs( const wxString& aSource ) const;
371 wxString ConvertKIIDsToRefs( const wxString& aSource ) const;
372
381
394
401
407
408 void SyncLibSymbolPinMaps( const wxString& aSchLibSymbolName, const LIB_SYMBOL& aSource, SCH_COMMIT* aCommit );
409
414 {
415 m_operatingPoints.clear();
416 }
417
423 void SetOperatingPoint( const wxString& aNetChain, double aValue )
424 {
425 m_operatingPoints[ aNetChain ] = aValue;
426 }
427
428 wxString GetOperatingPoint( const wxString& aNetName, int aPrecision, const wxString& aRange );
429
437 int FixupJunctionsAfterImport( const std::function<void( SCH_LINE*, SCH_LINE* )>& aOnSplit = {} );
438
442 void RecordERCExclusions();
443
445
446 void ClearUnresolvedERCExclusions( int aErrorCode = -1 );
447
452
457 void OnItemsAdded( std::vector<SCH_ITEM*>& aNewItems );
458
463 void OnItemsRemoved( std::vector<SCH_ITEM*>& aRemovedItems );
464
469 void OnItemsChanged( std::vector<SCH_ITEM*>& aItems );
470
477 void OnSchSheetChanged();
478
483
493 void AddListener( SCHEMATIC_LISTENER* aListener );
494
500 void RemoveListener( SCHEMATIC_LISTENER* aListener );
501
505 void RemoveAllListeners();
506
507 void RunOnNestedEmbeddedFiles( const std::function<void( EMBEDDED_FILES* )>& aFunction ) override;
508
512 void EmbedFonts() override;
513
517 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
518
525 std::set<const SCH_SCREEN*> GetSchematicsSharedByMultipleProjects() const;
526
532 bool IsComplexHierarchy() const;
533
535
543 void CleanUp( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen = nullptr );
544
546 void CleanUpConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS aCleanupFlags,
547 const std::set<SCH_SCREEN*>& aLocalScreens = {} );
548
550 void RebuildConnectivity( std::function<void( SCH_ITEM* )>* aChangedItemHandler = nullptr,
551 PROGRESS_REPORTER* aProgressReporter = nullptr,
552 KIGFX::SCH_VIEW* aSchView = nullptr );
553
558 void RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS aCleanupFlags,
559 TOOL_MANAGER* aToolManager,
560 PROGRESS_REPORTER* aProgressReporter = nullptr,
561 KIGFX::SCH_VIEW* aSchView = nullptr,
562 std::function<void( SCH_ITEM* )>* aChangedItemHandler = nullptr,
563 PICKED_ITEMS_LIST* aLastChangeList = nullptr,
564 bool aCleanupDone = false );
565
573
580 bool Contains( const SCH_REFERENCE& aRef ) const;
581
583
594 wxArrayString GetVariantNamesForUI() const;
595
601 wxString GetCurrentVariant() const;
602
603 void SetCurrentVariant( const wxString& aVariantName );
604
610 void DeleteVariant( const wxString& aVariantName, SCH_COMMIT* aCommit = nullptr );
611
612 void AddVariant( const wxString& aVariantName );
613
623 void RenameVariant( const wxString& aOldName, const wxString& aNewName,
624 SCH_COMMIT* aCommit = nullptr );
625
636 void CopyVariant( const wxString& aSourceVariant, const wxString& aNewVariant,
637 SCH_COMMIT* aCommit = nullptr );
638
642 const std::set<wxString>& GetVariantNames() const { return m_variantNames; }
643
647 bool HasVariant( const wxString& aVariantName ) const;
648
655 wxString GetVariantDescription( const wxString& aVariantName ) const;
656
663 void SetVariantDescription( const wxString& aVariantName, const wxString& aDescription );
664
671 void LoadVariants();
672
677
678#if defined(DEBUG)
679 void Show( int nestLevel, std::ostream& os ) const override {}
680#endif
681
683
693 void SaveToHistory( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData );
694
699 std::weak_ptr<void> GetHistoryLifetimeToken() const { return m_historyLifetime; }
700
701private:
702 bool resolveCrossReference( wxString* aToken, int aDepth ) const;
703
704 friend class SCH_EDIT_FRAME;
705
706 template <typename Func, typename... Args>
707 void InvokeListeners( Func&& aFunc, Args&&... args )
708 {
709 for( auto&& l : m_listeners )
710 ( l->*aFunc )( std::forward<Args>( args )... );
711 }
712
713 void ensureVirtualRoot();
716 void rebuildHierarchyState( bool aResetConnectionGraph );
717
719 std::optional<IMPORT_NET_MAP> m_importNetMap;
720
722 std::shared_ptr<void> m_historyLifetime = std::make_shared<char>();
723
726
728 std::vector<SCH_SHEET*> m_topLevelSheets;
729
738
741 std::unique_ptr<SCH_CONNECTIVITY::NETCHAIN_MANAGER> m_netChains;
742
744
750 std::map<wxString, std::set<int>> m_labelToPageRefsMap;
751
755 std::map<wxString, wxString> m_properties;
756
760 std::map<wxString, double> m_operatingPoints;
761
766
768 std::vector<ERC_EXCLUSION> m_unresolvedErcExclusions;
769
773 std::vector<SCHEMATIC_LISTENER*> m_listeners;
774
779
781
783
784 std::vector<std::shared_ptr<BUS_ALIAS>> m_busAliases;
785
787
788 std::set<wxString> m_variantNames;
789
793
796 std::unique_ptr<class SCHEMATIC_TEXT_VAR_ADAPTER> m_textVarAdapter;
797
802
803public:
805};
806
807#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.
Class OUTLINE_FONT implements outline font drawing.
Definition kiid.h:46
Define a library symbol object.
Definition lib_symbol.h:119
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 #_ELEMs 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:80
virtual ~SCHEMATIC_LISTENER()
Definition schematic.h:78
virtual void OnSchItemsChanged(SCHEMATIC &aSch, std::vector< SCH_ITEM * > &aSchItem)
Definition schematic.h:81
virtual void OnSchSelectionChanged(SCHEMATIC &aSch)
Definition schematic.h:87
virtual void OnSchSheetChanged(SCHEMATIC &aSch)
Definition schematic.h:85
virtual void OnSchItemsAdded(SCHEMATIC &aSch, std::vector< SCH_ITEM * > &aSchItem)
Definition schematic.h:79
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:148
void SetCurrentVariant(const wxString &aVariantName)
void SetCurrentSheet(const SCH_SHEET_PATH &aPath)
Definition schematic.h:308
bool m_settingTopLevelSheets
Re-entry guard to prevent infinite recursion between ensureDefaultTopLevelSheet and RefreshHierarchy ...
Definition schematic.h:792
std::unique_ptr< SCH_CONNECTIVITY::NETCHAIN_MANAGER > m_netChains
Definition schematic.h:741
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:315
CONNECTION_GRAPH * m_connectionGraph
Hold and calculate connectivity information of this schematic.
Definition schematic.h:740
std::shared_ptr< void > m_historyLifetime
Sentinel whose expiry signals to LOCAL_HISTORY that this schematic has been destroyed.
Definition schematic.h:722
virtual wxString GetClass() const override
Return the class name.
Definition schematic.h:154
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:765
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:344
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:322
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:534
SCH_SHEET_PATH * m_currentSheet
The sheet path of the sheet currently being edited or displayed.
Definition schematic.h:737
std::vector< SCH_SHEET * > m_topLevelSheets
List of top-level sheets (direct children of virtual root)
Definition schematic.h:728
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:413
SCH_SCREEN * GetCurrentScreen() const
Definition schematic.h:313
wxString ConvertKIIDsToRefs(const wxString &aSource) const
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Definition schematic.h:193
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:786
std::map< wxString, std::set< int > > & GetPageRefsMap()
Definition schematic.h:365
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:804
void SetHighlightedNetChain(const wxString &aNetChain)
Definition schematic.h:323
PROJECT & Project() const
Return a reference to the project this schematic is part of.
Definition schematic.h:170
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:750
bool HasHierarchy() const
Check if the hierarchy has been built.
Definition schematic.h:189
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:719
bool Contains(const SCH_REFERENCE &aRef) const
Check if the schematic contains the specified reference.
const IMPORT_NET_MAP * GetImportNetMap() const
Definition schematic.h:162
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:768
size_t GetUnresolvedERCExclusionCount() const
Definition schematic.h:444
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={})
Prepare source geometry and intersheet references before rebuilding connectivity.
std::map< int, wxString > GetVirtualPageToSheetPagesMap() const
EMBEDDED_FILES * GetEmbeddedFiles() override
PROJECT * m_project
Definition schematic.h:718
CONNECTION_GRAPH * ConnectionGraph() const
Definition schematic.h:317
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
SCHEMATIC(PROJECT *aPrj)
Definition schematic.cpp:78
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:784
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition schematic.h:707
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
Definition schematic.h:288
void updateProjectBusAliases()
void SetVariantDescription(const wxString &aVariantName, const wxString &aDescription)
Set the description for a variant.
static bool m_IsSchematicExists
True if a SCHEMATIC exists, false if not.
Definition schematic.h:676
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)
Fully rebuild connectivity without changing source geometry.
std::unique_ptr< class SCHEMATIC_TEXT_VAR_ADAPTER > m_textVarAdapter
Reactive text-variable dependency adapter.
Definition schematic.h:796
PROPERTY_LISTENER_SUBSCRIPTION m_fieldListenerSubscription
PROPERTY_MANAGER listener subscription installed in the ctor.
Definition schematic.h:801
const std::set< wxString > & GetVariantNames() const
Return the set of variant names (without the default placeholder).
Definition schematic.h:642
const std::map< wxString, wxString > * GetProperties()
Definition schematic.h:173
void GetContextualTextVars(wxArrayString *aVars) const
void SetOperatingPoint(const wxString &aNetChain, double aValue)
Set operating points from a .op simulation.
Definition schematic.h:423
friend class SCH_EDIT_FRAME
Definition schematic.h:704
void ensureDefaultTopLevelSheet()
SCH_SHEET & Root() const
Definition schematic.h:199
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.
SCHEMATIC_HOLDER * m_schematicHolder
What currently "Holds" the schematic, i.e.
Definition schematic.h:778
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:699
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void SetImportNetMap(IMPORT_NET_MAP aMap)
Definition schematic.h:167
void SetBusAliases(const std::vector< std::shared_ptr< BUS_ALIAS > > &aAliases)
std::vector< SCHEMATIC_LISTENER * > m_listeners
Currently installed listeners.
Definition schematic.h:773
SCH_SHEET_PATH & CurrentSheet() const
Definition schematic.h:303
bool ResolveCrossReference(wxString *token, int aDepth) const
Resolves text vars that refer to other items.
wxString m_highlightedNetChain
Definition schematic.h:743
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:760
std::map< wxString, wxString > m_properties
Properties for text variable substitution (and perhaps other uses in future).
Definition schematic.h:755
ERC_SETTINGS & ErcSettings() const
std::set< wxString > m_variantNames
Definition schematic.h:788
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:682
SCH_SHEET * m_rootSheet
The virtual root sheet (has no screen, contains all top-level sheets)
Definition schematic.h:725
bool IsInstancePathInProject(const KIID_PATH &aPath) const
Test whether an instance path is rooted in this schematic's top level sheets.
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:165
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
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
SCH_CLEANUP_FLAGS
Definition schematic.h:91
@ LOCAL_CLEANUP
Definition schematic.h:93
@ NO_CLEANUP
Definition schematic.h:92
@ GLOBAL_CLEANUP
Definition schematic.h:94
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:108
std::optional< EMBEDDED_FILES > embeddedFiles
Definition schematic.h:136
std::unique_ptr< SCH_SCREEN > screen
Screen that replaces the target sheet's screen outright.
Definition schematic.h:114
std::optional< SCH_SHEET_PATH > currentSheet
Definition schematic.h:130
std::vector< std::unique_ptr< SCH_ITEM > > itemOwners
Items in screenItems that nothing else owns yet.
Definition schematic.h:124
SCH_SHEET_LIST hierarchy
Definition schematic.h:129
std::unique_ptr< CONNECTION_GRAPH > connectionGraph
Definition schematic.h:131
bool preserveNetChains
Keep the schematic's net chains instead of the staged graph's, for append.
Definition schematic.h:134
std::vector< SCH_SHEET * > topLevelSheets
Replacement top level sheets. Empty leaves the schematic's own in place.
Definition schematic.h:127
SCH_SHEET * targetSheet
Sheet whose screen receives the content. Null names the schematic's virtual root.
Definition schematic.h:110
std::unique_ptr< SCH_SCREEN > screenLibSymbols
Screen holding only the library cache that the target screen adopts.
Definition schematic.h:121
EE_RTREE screenItems
Spatial index that replaces the target screen's own.
Definition schematic.h:118
wxString drawingSheetFileName
Definition schematic.h:137