20#ifndef KICAD_SCHEMATIC_H 
   21#define KICAD_SCHEMATIC_H 
   96        return wxT( 
"SCHEMATIC" );
 
 
  120                           bool aAllowNullptrReturn = 
false )
 const 
 
  216    std::shared_ptr<BUS_ALIAS> 
GetBusAlias( 
const wxString& aLabel ) 
const;
 
  218    void AddBusAlias( std::shared_ptr<BUS_ALIAS> aAlias );
 
  220    void SetBusAliases( 
const std::vector<std::shared_ptr<BUS_ALIAS>>& aAliases );
 
  304    wxString 
GetOperatingPoint( 
const wxString& aNetName, 
int aPrecision, 
const wxString& aRange );
 
  383    std::set<KIFONT::OUTLINE_FONT*> 
GetFonts() 
const override;
 
  418                                 std::function<
void( 
SCH_ITEM* )>* aChangedItemHandler = 
nullptr,
 
  475    void Show( 
int nestLevel, std::ostream& os )
 const override {}
 
  488    void SaveToHistory( 
const wxString& aProjectPath, std::vector<wxString>& aFiles );
 
  493    template <
typename Func, 
typename... Args>
 
  497            ( l->*aFunc )( std::forward<Args>( args )... );
 
 
 
Calculate the connectivity of a schematic and generates 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)
 
Container for ERC settings.
 
Class OUTLINE_FONT implements outline font drawing.
 
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.
 
Container for project specific data.
 
ELEM
The set of #_ELEMs that a PROJECT can hold.
 
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)
 
virtual ~SCHEMATIC_LISTENER()
 
virtual void OnSchItemsChanged(SCHEMATIC &aSch, std::vector< SCH_ITEM * > &aSchItem)
 
virtual void OnSchSheetChanged(SCHEMATIC &aSch)
 
virtual void OnSchItemsAdded(SCHEMATIC &aSch, std::vector< SCH_ITEM * > &aSchItem)
 
These are loaded from Eeschema settings but then overwritten by the project settings.
 
Holds all the data relating to one schematic.
 
void SetCurrentVariant(const wxString &aVariantName)
 
void SetCurrentSheet(const SCH_SHEET_PATH &aPath)
 
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.
 
CONNECTION_GRAPH * m_connectionGraph
Hold and calculate connectivity information of this schematic.
 
virtual wxString GetClass() const override
Return the class name.
 
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.
 
void SetOperatingPoint(const wxString &aSignal, double aValue)
Set operating points from a .op simulation.
 
SCH_SHEET_LIST m_hierarchy
Cache of the entire schematic hierarchy sorted by sheet page number.
 
void ResolveERCExclusionsPostUpdate()
Update markers to match recorded exclusions.
 
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.
 
SCH_SHEET_LIST BuildSheetListSortedByPageNumbers() const
 
void RemoveListener(SCHEMATIC_LISTENER *aListener)
Remove the specified listener.
 
const std::vector< std::shared_ptr< BUS_ALIAS > > & GetAllBusAliases() 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)
 
SCH_SHEET_PATH * m_currentSheet
The sheet path of the sheet currently being edited or displayed.
 
std::vector< SCH_SHEET * > m_topLevelSheets
List of top-level sheets (direct children of virtual root)
 
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...
 
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)
 
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.
 
std::vector< SCH_MARKER * > ResolveERCExclusions()
 
void EmbedFonts() override
Embed fonts in the schematic.
 
SCHEMATIC_SETTINGS & Settings() const
 
void ClearOperatingPoints()
Clear operating points from a .op simulation.
 
SCH_SCREEN * GetCurrentScreen() const
 
wxString ConvertKIIDsToRefs(const wxString &aSource) const
 
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
 
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
 
std::map< wxString, std::set< int > > & GetPageRefsMap()
 
SCH_SHEET_LIST BuildUnorderedSheetList() const
 
PROJECT & Project() const
Return a reference to the project this schematic is part of.
 
void DeleteVariant(const wxString &aVariantName)
Delete all information for aVariantName.
 
std::map< wxString, std::set< int > > m_labelToPageRefsMap
Holds a map of labels to the page sequence (virtual page number) that they appear on.
 
void FixupJunctionsAfterImport()
Add junctions to this schematic where required.
 
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get a set of fonts used in the schematic.
 
bool RemoveTopLevelSheet(SCH_SHEET *aSheet)
Remove a top-level sheet from the schematic.
 
bool Contains(const SCH_REFERENCE &aRef) const
Check if the schematic contains the specified reference.
 
wxString ConvertRefsToKIIDs(const wxString &aSource) const
 
void SetRoot(SCH_SHEET *aRootSheet)
Initialize the schematic with a new root sheet.
 
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...
 
std::map< int, wxString > GetVirtualPageToSheetPagesMap() const
 
EMBEDDED_FILES * GetEmbeddedFiles() override
 
CONNECTION_GRAPH * ConnectionGraph() const
 
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
 
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
 
void InvokeListeners(Func &&aFunc, Args &&... args)
 
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
 
void updateProjectBusAliases()
 
static bool m_IsSchematicExists
True if a SCHEMATIC exists, false if not.
 
void RemoveAllListeners()
Remove all listeners.
 
const std::map< wxString, wxString > * GetProperties()
 
void GetContextualTextVars(wxArrayString *aVars) const
 
friend class SCH_EDIT_FRAME
 
std::map< int, wxString > GetVirtualPageToSheetNamesMap() const
 
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.
 
wxString GetUniqueFilenameForCurrentSheet()
Get the unique file name for the current sheet.
 
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
 
void SetBusAliases(const std::vector< std::shared_ptr< BUS_ALIAS > > &aAliases)
 
std::vector< SCHEMATIC_LISTENER * > m_listeners
Currently installed listeners.
 
SCH_SHEET_PATH & CurrentSheet() const
 
bool ResolveCrossReference(wxString *token, int aDepth) const
Resolves text vars that refer to other items.
 
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)
Generate the connection data for the entire schematic hierarchy.
 
void SaveToHistory(const wxString &aProjectPath, std::vector< wxString > &aFiles)
Save schematic files to the .history directory.
 
std::map< wxString, double > m_operatingPoints
Simulation operating points for text variable substitution.
 
std::map< wxString, wxString > m_properties
Properties for text variable substitution (and perhaps other uses in future).
 
ERC_SETTINGS & ErcSettings() const
 
std::set< wxString > m_variantNames
 
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
 
SCH_SHEET * m_rootSheet
The virtual root sheet (has no screen, contains all top-level sheets)
 
Base class for any item which can be embedded within the SCHEMATIC container class,...
 
Segment description base class to describe items which have 2 end points (track, wire,...
 
A helper to define a symbol's reference designator in a schematic.
 
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
 
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Fetch a SCH_ITEM by ID.
 
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.
 
The Cairo implementation of the graphics abstraction layer.
 
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.