From 925b6d9387ec176f3f29f8e08e71e5ccaa119ad3 Mon Sep 17 00:00:00 2001
From: Wayne Stambaugh
Date: Thu, 25 Mar 2021 17:13:01 -0400
Subject: [PATCH] Eeschema header housekeeping round 2.
---
eeschema/sch_line.h | 29 ++---
eeschema/sch_marker.h | 8 +-
eeschema/sch_no_connect.h | 8 +-
eeschema/sch_painter.h | 8 +-
eeschema/sch_pin.h | 34 ++---
eeschema/sch_reference_list.h | 155 +++++++++++-----------
eeschema/sch_rtree.h | 25 ++--
eeschema/sch_screen.h | 227 +++++++++++++++++----------------
eeschema/sch_sheet.h | 113 ++++++++--------
eeschema/sch_sheet_path.h | 54 ++++----
eeschema/sch_symbol.cpp | 86 ++++++-------
eeschema/sch_symbol.h | 222 ++++++++++++++++----------------
eeschema/sch_text.h | 84 +++++++-----
eeschema/sch_validators.h | 13 +-
eeschema/schematic.h | 71 ++++++-----
eeschema/symbol_lib_table.h | 32 ++---
eeschema/symbol_viewer_frame.h | 52 ++++----
17 files changed, 598 insertions(+), 623 deletions(-)
diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h
index 352e54e69e..58dec82c74 100644
--- a/eeschema/sch_line.h
+++ b/eeschema/sch_line.h
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
- * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -36,14 +36,7 @@ class NETLIST_OBJECT_LIST;
*/
class SCH_LINE : public SCH_ITEM
{
- bool m_startIsDangling; ///< True if start point is not connected.
- bool m_endIsDangling; ///< True if end point is not connected.
- wxPoint m_start; ///< Line start point
- wxPoint m_end; ///< Line end point
- STROKE_PARAMS m_stroke; ///< Line stroke properties.
-
public:
-
static const enum wxPenStyle PenStyle[];
SCH_LINE( const wxPoint& pos = wxPoint( 0, 0 ), int layer = LAYER_NOTES );
@@ -188,10 +181,10 @@ public:
* two lines overlap. This method is used to merge multiple line segments into a single
* line.
*
- * @param aScreen - the current screen
- * @param aLine - Line to compare.
- * @param aCheckJunctions - indicates we need to check for a junction if the two segments
- * are colinear and touch
+ * @param aScreen is the current screen.
+ * @param aLine is the line to compare.
+ * @param aCheckJunctions is used to indicate if we need to check for a junction if the two
+ * segments are colinear and touch.
* @return New line that combines the two or NULL on non-overlapping segments.
*/
SCH_LINE* MergeOverlap( SCH_SCREEN* aScreen, SCH_LINE* aLine, bool aCheckJunctions );
@@ -246,21 +239,21 @@ public:
#endif
/**
- * Returns if the line is a graphic (non electrical line)
+ * Return if the line is a graphic (non electrical line)
*
* Currently, anything on the internal NOTES layer is a graphic line
*/
bool IsGraphicLine() const;
/**
- * Returns true if the line is a wire.
+ * Return true if the line is a wire.
*
* @return true if this line is on the wire layer.
*/
bool IsWire() const;
/**
- * Returns true if the line is a bus.
+ * Return true if the line is a bus.
*
* @return true if this line is on the bus layer.
*/
@@ -268,6 +261,12 @@ public:
private:
bool doIsConnected( const wxPoint& aPosition ) const override;
+
+ bool m_startIsDangling; ///< True if start point is not connected.
+ bool m_endIsDangling; ///< True if end point is not connected.
+ wxPoint m_start; ///< Line start point
+ wxPoint m_end; ///< Line end point
+ STROKE_PARAMS m_stroke; ///< Line stroke properties.
};
diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h
index 1f1a7ff6d5..b678e242c3 100644
--- a/eeschema/sch_marker.h
+++ b/eeschema/sch_marker.h
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
- * Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -83,10 +83,8 @@ public:
/**
* Compare DRC marker main and auxiliary text against search string.
*
- * @param aSearchData - Criteria to search against.
- * @param aAuxData A pointer to optional data required for the search or NULL
- * if not used.
- * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
+ * @param[in] aSearchData is the criteria to search against.
+ * @param[in] aAuxData is the optional data required for the search or NULL if not used.
* @return True if the DRC main or auxiliary text matches the search criteria.
*/
bool Matches( const wxFindReplaceData& aSearchData, void* aAuxDat ) const override;
diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h
index a641cec95b..62000810ce 100644
--- a/eeschema/sch_no_connect.h
+++ b/eeschema/sch_no_connect.h
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
- * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -38,9 +38,6 @@ class NETLIST_OBJECT_LIST;
class SCH_NO_CONNECT : public SCH_ITEM
{
- wxPoint m_pos; ///< Position of the no connect object.
- int m_size; ///< Size of the no connect object.
-
public:
SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) );
@@ -119,6 +116,9 @@ public:
private:
bool doIsConnected( const wxPoint& aPosition ) const override;
+
+ wxPoint m_pos; ///< Position of the no connect object.
+ int m_size; ///< Size of the no connect object.
};
diff --git a/eeschema/sch_painter.h b/eeschema/sch_painter.h
index 10bfbcc65f..4648c791a6 100644
--- a/eeschema/sch_painter.h
+++ b/eeschema/sch_painter.h
@@ -65,10 +65,8 @@ class SCH_PAINTER;
/**
- * SCH_RENDER_SETTINGS
- * Stores schematic-specific render settings.
+ * Store schematic specific render settings.
*/
-
class SCH_RENDER_SETTINGS : public RENDER_SETTINGS
{
public:
@@ -130,7 +128,6 @@ public:
/**
- * SCH_PAINTER
* Contains methods for drawing schematic-specific items.
*/
class SCH_PAINTER : public PAINTER
@@ -156,7 +153,8 @@ private:
void draw( const LIB_RECTANGLE* aRect, int aLayer );
void draw( LIB_PIN* aPin, int aLayer );
void draw( const LIB_CIRCLE* aCircle, int aLayer );
- void draw( const LIB_PART* aPart, int, bool aDrawFields = true, int aUnit = 0, int aConvert = 0 );
+ void draw( const LIB_PART* aPart, int, bool aDrawFields = true, int aUnit = 0,
+ int aConvert = 0 );
void draw( const LIB_ARC* aArc, int aLayer );
void draw( const LIB_POLYLINE* aLine, int aLayer );
void draw( const LIB_FIELD* aField, int aLayer );
diff --git a/eeschema/sch_pin.h b/eeschema/sch_pin.h
index d35ca96413..ad7214ef26 100644
--- a/eeschema/sch_pin.h
+++ b/eeschema/sch_pin.h
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 CERN
- * Copyright (C) 2019 KiCad Developers, see change_log.txt for contributors.
+ * Copyright (C) 2019-2021 KiCad Developers, see AUTHOR.txt for contributors.
* @author Jon Evans
*
* This program is free software; you can redistribute it and/or
@@ -34,17 +34,6 @@ class SCH_COMPONENT;
class SCH_PIN : public SCH_ITEM
{
- LIB_PIN* m_libPin;
-
- wxString m_number;
- wxString m_alt;
- wxPoint m_position;
- bool m_isDangling;
-
- /// The name that this pin connection will drive onto a net
- std::recursive_mutex m_netmap_mutex;
- std::map> m_net_name_map;
-
public:
SCH_PIN( LIB_PIN* aLibPin, SCH_COMPONENT* aParentSymbol );
@@ -95,9 +84,12 @@ public:
bool IsDangling() const override { return m_isDangling; }
void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; }
- bool IsPointClickableAnchor( const wxPoint& aPos ) const override { return m_isDangling && GetPosition() == aPos; }
+ bool IsPointClickableAnchor( const wxPoint& aPos ) const override
+ {
+ return m_isDangling && GetPosition() == aPos;
+ }
- /// Returns the pin's position in global coordinates
+ /// @return the pin's position in global coordinates.
wxPoint GetTransformedPosition() const;
bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
@@ -106,7 +98,7 @@ public:
/*
* While many of these are currently simply covers for the equivalent LIB_PIN methods,
- * the new EESchema file format will soon allow us to override them at the SCH level.
+ * the new Eeschema file format will soon allow us to override them at the schematic level.
*/
bool IsVisible() const { return m_libPin->IsVisible(); }
@@ -136,6 +128,18 @@ public:
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override {}
#endif
+
+private:
+ LIB_PIN* m_libPin;
+
+ wxString m_number;
+ wxString m_alt;
+ wxPoint m_position;
+ bool m_isDangling;
+
+ /// The name that this pin connection will drive onto a net.
+ std::recursive_mutex m_netmap_mutex;
+ std::map> m_net_name_map;
};
#endif
diff --git a/eeschema/sch_reference_list.h b/eeschema/sch_reference_list.h
index a9609f427c..4876d81433 100644
--- a/eeschema/sch_reference_list.h
+++ b/eeschema/sch_reference_list.h
@@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2011 jean-pierre Charras
- * Copyright (C) 1992-2011 Wayne Stambaugh
- * Copyright (C) 1992-2021 KiCad Developers, see authors.txt for contributors.
+ * Copyright (C) 2011 Wayne Stambaugh
+ * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -44,27 +44,7 @@
*/
class SCH_REFERENCE
{
- /// Symbol reference prefix, without number (for IC1, this is IC) )
- UTF8 m_ref; // it's private, use the accessors please
- SCH_COMPONENT* m_rootSymbol; ///< The symbol associated the reference object.
- LIB_PART* m_libPart; ///< The source symbol from a library.
- wxPoint m_symbolPos; ///< The physical position of the symbol in schematic
- ///< used to annotate by X or Y position
- int m_unit; ///< The unit number for symbol with multiple parts
- ///< per package.
- wxString m_value; ///< The symbol value.
- wxString m_footprint; ///< The footprint assigned.
- SCH_SHEET_PATH m_sheetPath; ///< The sheet path for this reference.
- bool m_isNew; ///< True if not yet annotated.
- int m_sheetNum; ///< The sheet number for the reference.
- KIID m_symbolUuid; ///< UUID of the symbol.
- int m_numRef; ///< The numeric part of the reference designator.
- int m_flag;
-
- friend class SCH_REFERENCE_LIST;
-
public:
-
SCH_REFERENCE() :
m_sheetPath()
{
@@ -178,6 +158,26 @@ public:
{
return m_libPart->UnitsLocked();
}
+
+private:
+ friend class SCH_REFERENCE_LIST;
+
+ /// Symbol reference prefix, without number (for IC1, this is IC) )
+ UTF8 m_ref; // it's private, use the accessors please
+ SCH_COMPONENT* m_rootSymbol; ///< The symbol associated the reference object.
+ LIB_PART* m_libPart; ///< The source symbol from a library.
+ wxPoint m_symbolPos; ///< The physical position of the symbol in schematic
+ ///< used to annotate by X or Y position
+ int m_unit; ///< The unit number for symbol with multiple parts
+ ///< per package.
+ wxString m_value; ///< The symbol value.
+ wxString m_footprint; ///< The footprint assigned.
+ SCH_SHEET_PATH m_sheetPath; ///< The sheet path for this reference.
+ bool m_isNew; ///< True if not yet annotated.
+ int m_sheetNum; ///< The sheet number for the reference.
+ KIID m_symbolUuid; ///< UUID of the symbol.
+ int m_numRef; ///< The numeric part of the reference designator.
+ int m_flag;
};
@@ -191,8 +191,9 @@ typedef std::function
- * If a the sheet number is 2 and \a aSheetIntervalId is 100, then the first reference
- * designator would be 201 and the last reference designator would be 299 when no overlap
- * occurs with sheet number 3. If there are 150 items in sheet number 2, then items are
- * referenced U201 to U351, and items in sheet 3 start from U352
- *
*/
void Annotate( bool aUseSheetNum, int aSheetIntervalId, int aStartNumber,
SCH_MULTI_UNIT_REFERENCE_MAP aLockedUnitMap );
/**
* Check for annotations errors.
- *
+ *
* The following annotation error conditions are tested:
- *
- * - Symbols not annotated.
- * - Symbols having the same reference designator (duplicates).
- * - Symbols with multiple parts per package having different reference designators.
- * - Symbols with multiple parts per package with invalid part count.
- *
- *
+ * - Symbols not annotated.
+ * - Symbols having the same reference designator (duplicates).
+ * - Symbols with multiple parts per package having different reference designators.
+ * - Symbols with multiple parts per package with invalid part count.
+ *
* @param aErrorHandler A handler for errors.
* @return The number of errors found.
*/
@@ -309,16 +308,13 @@ public:
/**
* Sort the list of references by X position.
- *
+ *
* Symbols are sorted as follows:
- *
- * - Numeric value of reference designator.
- * - Sheet number.
- * - X coordinate position.
- * - Y coordinate position.
- * - Time stamp.
- *
- *
+ * - Numeric value of reference designator.
+ * - Sheet number.
+ * - X coordinate position.
+ * - Y coordinate position.
+ * - Time stamp.
*/
void SortByXCoordinate()
{
@@ -327,16 +323,13 @@ public:
/**
* Sort the list of references by Y position.
- *
+ *
* Symbols are sorted as follows:
- *
- * - Numeric value of reference designator.
- * - Sheet number.
- * - Y coordinate position.
- * - X coordinate position.
- * - Time stamp.
- *
- *
+ * - Numeric value of reference designator.
+ * - Sheet number.
+ * - Y coordinate position.
+ * - X coordinate position.
+ * - Time stamp.
*/
void SortByYCoordinate()
{
@@ -355,17 +348,14 @@ public:
/**
* Sort the list of references by value.
- *
+ *
* Symbols are sorted in the following order:
- *
- * - Numeric value of reference designator.
- * - Value of symbol.
- * - Unit number when symbol has multiple parts.
- * - Sheet number.
- * - X coordinate position.
- * - Y coordinate position.
- *
- *
+ * - Numeric value of reference designator.
+ * - Value of symbol.
+ * - Unit number when symbol has multiple parts.
+ * - Sheet number.
+ * - X coordinate position.
+ * - Y coordinate position.
*/
void SortByRefAndValue()
{
@@ -374,13 +364,10 @@ public:
/**
* Sort the list of references by reference.
- *
+ *
* Symbols are sorted in the following order:
- *
- * - Numeric value of reference designator.
- * - Unit number when symbol has multiple parts.
- *
- *
+ * - Numeric value of reference designator.
+ * - Unit number when symbol has multiple parts.
*/
void SortByReferenceOnly()
{
@@ -396,17 +383,17 @@ public:
* Search the sorted list of symbols for a another symbol with the same reference and a
* given part unit. Use this method to manage symbols with multiple parts per package.
*
- * @param aIndex = index in aSymbolsList for of given SCH_REFERENCE item to test.
- * @param aUnit = the given unit number to search
- * @return index in aSymbolsList if found or -1 if not found
+ * @param aIndex is the index in aSymbolsList for of given #SCH_REFERENCE item to test.
+ * @param aUnit is the given unit number to search.
+ * @return index in aSymbolsList if found or -1 if not found.
*/
int FindUnit( size_t aIndex, int aUnit ) const;
/**
* Search the list for a symbol with the given KIID path.
*
- * @param aPath path to search
- * @return index in aSymbolsList if found or -1 if not found
+ * @param aPath is the path to search.
+ * @return index in aSymbolsList if found or -1 if not found.
*/
int FindRefByPath( const wxString& aPath ) const;
@@ -414,9 +401,9 @@ public:
* Add all the reference designator numbers greater than \a aMinRefId to \a aIdList
* skipping the reference at \a aIndex.
*
- * @param aIndex = the current symbol's index to use for reference prefix filtering.
- * @param aIdList = the buffer to fill
- * @param aMinRefId = the min id value to store. all values < aMinRefId are ignored
+ * @param aIndex is the current symbol's index to use for reference prefix filtering.
+ * @param aIdList is the buffer to fill.
+ * @param aMinRefId is the minimum ID value to store. All values < aMinRefId are ignored.
*/
void GetRefsInUse( int aIndex, std::vector< int >& aIdList, int aMinRefId ) const;
diff --git a/eeschema/sch_rtree.h b/eeschema/sch_rtree.h
index 8ed8c59300..33407a5db3 100644
--- a/eeschema/sch_rtree.h
+++ b/eeschema/sch_rtree.h
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
- * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020 CERN
*
* This program is free software; you can redistribute it and/or
@@ -34,7 +34,6 @@
#include
/**
- * EE_RTREE -
* Implements an R-tree for fast spatial and type indexing of schematic items.
* Non-owning.
*/
@@ -56,8 +55,7 @@ public:
}
/**
- * Function Insert()
- * Inserts an item into the tree. Item's bounding box is taken via its BBox() method.
+ * Insert an item into the tree. Item's bounding box is taken via its BBox() method.
*/
void insert( SCH_ITEM* aItem )
{
@@ -71,8 +69,7 @@ public:
}
/**
- * Function Remove()
- * Removes an item from the tree. Removal is done by comparing pointers, attempting
+ * Remove an item from the tree. Removal is done by comparing pointers, attempting
* to remove a copy of the item will fail.
*/
bool remove( SCH_ITEM* aItem )
@@ -102,8 +99,7 @@ public:
}
/**
- * Function RemoveAll()
- * Removes all items from the RTree
+ * Remove all items from the RTree
*/
void clear()
{
@@ -115,9 +111,9 @@ public:
* Determine if a given item exists in the tree. Note that this does not search the full tree
* so if the item has been moved, this will return false when it should be true.
*
- * @param aItem Item that may potentially exist in the tree
- * @param aRobust If true, search the whole tree, not just the bounding box
- * @return true if the item definitely exists, false if it does not exist within bbox
+ * @param aItem Item that may potentially exist in the tree.
+ * @param aRobust If true, search the whole tree, not just the bounding box.
+ * @return true if the item definitely exists, false if it does not exist within bbox.
*/
bool contains( const SCH_ITEM* aItem, bool aRobust = false ) const
{
@@ -155,8 +151,9 @@ public:
}
/**
- * Returns the number of items in the tree
- * @return number of elements in the tree;
+ * Return the number of items in the tree.
+ *
+ * @return number of elements in the tree.
*/
size_t size() const
{
@@ -171,7 +168,7 @@ public:
using iterator = typename ee_rtree::Iterator;
/**
- * The EE_TYPE struct provides a type-specific auto-range iterator to the RTree. Using
+ * The #EE_TYPE struct provides a type-specific auto-range iterator to the RTree. Using
* this struct, one can write lines like:
*
* for( auto item : rtree.OfType( SCH_COMPONENT_T ) )
diff --git a/eeschema/sch_screen.h b/eeschema/sch_screen.h
index dff55cb636..026a31899f 100644
--- a/eeschema/sch_screen.h
+++ b/eeschema/sch_screen.h
@@ -92,67 +92,7 @@ struct PICKED_SYMBOL
class SCH_SCREEN : public BASE_SCREEN
{
-private:
-
- wxString m_fileName; // File used to load the screen.
- int m_fileFormatVersionAtLoad;
- int m_refCount; // Number of sheets referencing this screen.
- // Delete when it goes to zero.
- /**
- * The list of sheet paths sharing this screen. Used in some annotation calculations to
- * update alternate references.
- *
- * Note: a screen having a m_refCount = 1 (only one sheet path using it) can have many
- * sheet paths sharing this screen if it is inside another sheet having many instances.
- */
- std::vector m_clientSheetPathList;
-
-
- PAGE_INFO m_paper; // The size of the paper to print or plot on
- TITLE_BLOCK m_titles;
- wxPoint m_aux_origin; // Origin used for drill & place files by PCBNew
- EE_RTREE m_rtree;
-
- int m_modification_sync; // inequality with PART_LIBS::GetModificationHash()
- // will trigger ResolveAll().
-
- bool m_zoomInitialized; // Set to true once the zoom value is initialized with
- // `InitZoom()`.
-
- /// List of bus aliases stored in this screen.
- std::unordered_set< std::shared_ptr< BUS_ALIAS > > m_aliases;
-
- /// Library symbols required for this schematic.
- std::map m_libSymbols;
-
- /**
- * The list of symbol instances loaded from the schematic file.
- *
- * This list is only used to as temporary storage when the schematic file is loaded.
- * If the screen is the root sheet, then this information is used to update the
- * #SCH_COMPONENT instance reference and unit information after the entire schematic
- * is loaded and is never used again. If this screen is not the root sheet, then the
- * schematic file is the root sheet of another project and this information is saved
- * unchanged back to the schematic file.
- *
- * @warning Under no circumstances is this information to be modified or used after the
- * schematic file is loaded. It is read only and it is only written to non-root
- * schematic files.
- */
- std::vector m_symbolInstances;
- std::vector m_sheetInstances;
-
- friend SCH_EDIT_FRAME; // Only to populate m_symbolInstances.
- friend SCH_SEXPR_PARSER; // Only to load instance information from schematic file.
- friend SCH_SEXPR_PLUGIN; // Only to save the loaded instance information to schematic file.
-
- void clearLibSymbols();
-
public:
-
- /**
- * Constructor
- */
SCH_SCREEN( EDA_ITEM* aParent = nullptr );
~SCH_SCREEN();
@@ -203,11 +143,17 @@ public:
int GetRefCount() const { return m_refCount; }
/**
- * @return the sheet paths sharing this screen
- * if 1 this screen is not in a complex hierarchy: the reference field can be
- * used to store the component reference
- * if > 1 this screen is in a complex hierarchy, and components must have
- * a full alternate reference management
+ * Return the number of times this screen is used.
+ *
+ * In the legacy file formats: if this screen is used only once (not a complex hierarchy)
+ * the reference field can be used to store the symbol reference. If this screen is used
+ * more than once (a complex hierarchy), then symbols must have a full alternate reference
+ * management via sheet paths.
+ *
+ * In the new schematic file format, all instance data is stored in the root sheet even
+ * for simple hierarchies.
+ *
+ * @return the sheet paths sharing this screen.
*/
std::vector& GetClientSheetPaths()
{
@@ -243,7 +189,7 @@ public:
/**
* Check \a aPosition within a distance of \a aAccuracy for items of type \a aFilter.
*
- * @param aPosition Position in drawing units.
+ * @param[in] aPosition Position in drawing units.
* @param aAccuracy The maximum distance within \a Position to check for an item.
* @param aType The type of item to find.
* @return The item found that meets the search criteria or NULL if none found.
@@ -266,13 +212,13 @@ public:
* subsequent schematic loads with the new s-expression will contain the library
* symbols and should call #UpdateLocalLibSymbolLinks.
*
- * @param aReporter Optional #REPORTER object to write status and error messages into.
+ * @param[in] aReporter Optional #REPORTER object to write status and error messages into.
*/
void UpdateSymbolLinks( REPORTER* aReporter = nullptr );
/**
* Initialize the #LIB_PART reference for each #SCH_COMPONENT found in this schematic
- * with the local project library symbols
+ * with the local project library symbols.
*/
void UpdateLocalLibSymbolLinks();
@@ -292,7 +238,7 @@ public:
* @note This function is useful only for schematic. The library editor and library viewer
* do not use a draw list and therefore plots nothing.
*
- * @param aPlotter The plotter object to plot to.
+ * @param[in] aPlotter The plotter object to plot to.
*/
void Plot( PLOTTER* aPlotter ) const;
@@ -300,15 +246,15 @@ public:
* Remove \a aItem from the schematic associated with this screen.
*
* @note The removed item is not deleted. It is only unlinked from the item list.
- * @param aItem Item to be removed from schematic.
+ * @param[in] aItem Item to be removed from schematic.
* @return True if we successfully removed the item
*/
bool Remove( SCH_ITEM* aItem );
/**
- * Updates \a aItem's bounding box in the tree
+ * Update \a aItem's bounding box in the tree
*
- * @param aItem Item that needs to be updated.
+ * @param[in] aItem Item that needs to be updated.
*/
void Update( SCH_ITEM* aItem );
@@ -318,7 +264,7 @@ public:
* If \a aItem is a schematic sheet label, it is removed from the screen associated with
* the sheet that contains the label to be deleted.
*
- * @param aItem The schematic object to be deleted from the screen.
+ * @param[in] aItem The schematic object to be deleted from the screen.
*/
void DeleteItem( SCH_ITEM* aItem );
@@ -326,15 +272,16 @@ public:
/**
* Test all of the connectable objects in the schematic for unused connection points.
- * @param aPath is a sheet path to pass to UpdateDanglingState if desired
- * @param aChangedHandler an optional callback to make on each changed item
+ *
+ * @param aPath is a sheet path to pass to UpdateDanglingState if desired.
+ * @param aChangedHandler is an optional callback to make on each changed item.
*/
void TestDanglingEnds( const SCH_SHEET_PATH* aPath = nullptr,
std::function* aChangedHandler = nullptr ) const;
/**
* Return all wires and junctions connected to \a aSegment which are not connected any
- * component pin
+ * component pin.
*
* @param aSegment The segment to test for connections.
*/
@@ -349,16 +296,14 @@ public:
/**
* Test if a junction is required for the items at \a aPosition on the screen.
- *
+ *
* A junction is required at \a aPosition if one of the following criteria is satisfied:
- *
- * - one wire midpoint and one or more wire endpoints;
- * - three or more wire endpoints;
- * - one wire midpoint and a component pin;
- * - two or more wire endpoints and a component pin.
- *
- *
- * @param aPosition The position to test.
+ * - One wire midpoint and one or more wire endpoints.
+ * - Three or more wire endpoints.
+ * - One wire midpoint and a component pin.
+ * - Two or more wire endpoints and a component pin.
+ *
+ * @param[in] aPosition The position to test.
* @param aNew Checks if a _new_ junction is needed, i.e. there isn't one already
* @return True if a junction is required at \a aPosition.
*/
@@ -367,7 +312,7 @@ public:
/**
* Test if \a aPosition is a connection point on \a aLayer.
*
- * @param aPosition Position to test.
+ * @param[in] aPosition Position to test.
* @param aLayer The layer type to test against. Valid layer types are #LAYER_NOTES,
* #LAYER_BUS, and #LAYER_WIRE.
* @return True if \a Position is a connection point on \a aLayer.
@@ -377,8 +322,8 @@ public:
/**
* Test the screen for a component pin item at \a aPosition.
*
- * @param aPosition Position to test.
- * @param aSymbol The component if a pin was found, otherwise NULL.
+ * @param[in] aPosition Position to test.
+ * @param[out] aSymbol The component if a pin was found, otherwise NULL.
* @param aEndPointOnly Set to true to test if \a aPosition is the connection
* point of the pin.
* @return The pin item if found, otherwise NULL.
@@ -389,7 +334,7 @@ public:
/**
* Test the screen if \a aPosition is a sheet label object.
*
- * @param aPosition The position to test.
+ * @param[in] aPosition The position to test.
* @return The sheet label object if found otherwise NULL.
*/
SCH_SHEET_PIN* GetSheetPin( const wxPoint& aPosition ) const;
@@ -397,15 +342,15 @@ public:
/**
* Clear the annotation for the components in \a aSheetPath on the screen.
*
- * @param aSheetPath The sheet path of the component annotation to clear. If NULL then
- * the entire hierarchy is cleared.
+ * @param[in] aSheetPath The sheet path of the component annotation to clear. If NULL then
+ * the entire hierarchy is cleared.
*/
void ClearAnnotation( SCH_SHEET_PATH* aSheetPath );
/**
* For screens shared by many sheetpaths (complex hierarchies):
* to be able to clear or modify any reference related sharing this screen
- * (i.e. thie list of components), an entry for each screen path must exist.
+ * (i.e. the list of components), an entry for each screen path must exist.
* This function creates missing entries, using as default reference the current
* reference field and unit number
* Note: m_clientSheetPathList must be up to date
@@ -416,21 +361,20 @@ public:
/**
* Add all schematic sheet and component objects in the screen to \a aItems.
*
- * @param aItems Hierarchical item list to fill.
+ * @param[out] aItems Hierarchical item list to fill.
*/
void GetHierarchicalItems( std::vector* aItems ) const;
/**
* Similar to Items().OfType( SCH_SHEET_T ), but return the sheets in a
* deterministic order (L-R, T-B) for sheet numbering.
- * @param aItems
*/
void GetSheets( std::vector* aItems ) const;
/**
* Return a line item located at \a aPosition.
*
- * @param aPosition The wxPoint to test for a line item.
+ * @param[in] aPosition The wxPoint to test for a line item.
* @param aAccuracy Amount to inflate the item hit test bounding box.
* @param aLayer The layer the line is drawn upon.
* @param aSearchType Additional line test criteria.
@@ -455,7 +399,7 @@ public:
/**
* Return a label item located at \a aPosition.
*
- * @param aPosition The wxPoint to test for label items.
+ * @param[in] aPosition The wxPoint to test for label items.
* @param aAccuracy Amount to inflate the item hit test bounding box.
* @return The SCH_TEXT* of the label item found at \a aPosition or NULL if item not
* found.
@@ -483,12 +427,12 @@ public:
void AddLibSymbol( LIB_PART* aLibSymbol );
/**
- * Adds a bus alias definition (and transfers ownership of the pointer)
+ * Add a bus alias definition (and transfers ownership of the pointer).
*/
void AddBusAlias( std::shared_ptr aAlias );
/**
- * Removes all bus alias definitions
+ * Remove all bus alias definitions.
*/
void ClearBusAliases()
{
@@ -496,7 +440,7 @@ public:
}
/**
- * Returns a list of bus aliases defined in this screen
+ * Return a list of bus aliases defined in this screen
*/
std::unordered_set< std::shared_ptr > GetBusAliases() const
{
@@ -518,10 +462,65 @@ public:
#endif
/**
- * last value for the zoom level, usefull in Eeschema when changing the current displayed
+ * last value for the zoom level, useful in Eeschema when changing the current displayed
* sheet to reuse the same zoom level when back to the sheet using this screen
*/
double m_LastZoomLevel;
+
+private:
+ friend SCH_EDIT_FRAME; // Only to populate m_symbolInstances.
+ friend SCH_SEXPR_PARSER; // Only to load instance information from schematic file.
+ friend SCH_SEXPR_PLUGIN; // Only to save the loaded instance information to schematic file.
+
+ void clearLibSymbols();
+
+ wxString m_fileName; // File used to load the screen.
+ int m_fileFormatVersionAtLoad;
+ int m_refCount; // Number of sheets referencing this screen.
+ // Delete when it goes to zero.
+ /**
+ * The list of sheet paths sharing this screen. Used in some annotation calculations to
+ * update alternate references.
+ *
+ * Note: a screen having a m_refCount = 1 (only one sheet path using it) can have many
+ * sheet paths sharing this screen if it is inside another sheet having many instances.
+ */
+ std::vector m_clientSheetPathList;
+
+
+ PAGE_INFO m_paper; // The size of the paper to print or plot on.
+ TITLE_BLOCK m_titles;
+ wxPoint m_aux_origin; // Origin used for drill & place files by Pcbnew.
+ EE_RTREE m_rtree;
+
+ int m_modification_sync; // Inequality with PART_LIBS::GetModificationHash()
+ // will trigger ResolveAll().
+
+ bool m_zoomInitialized; // Set to true once the zoom value is initialized with
+ // `InitZoom()`.
+
+ /// List of bus aliases stored in this screen.
+ std::unordered_set< std::shared_ptr< BUS_ALIAS > > m_aliases;
+
+ /// Library symbols required for this schematic.
+ std::map m_libSymbols;
+
+ /**
+ * The list of symbol instances loaded from the schematic file.
+ *
+ * This list is only used to as temporary storage when the schematic file is loaded.
+ * If the screen is the root sheet, then this information is used to update the
+ * #SCH_COMPONENT instance reference and unit information after the entire schematic
+ * is loaded and is never used again. If this screen is not the root sheet, then the
+ * schematic file is the root sheet of another project and this information is saved
+ * unchanged back to the schematic file.
+ *
+ * @warning Under no circumstances is this information to be modified or used after the
+ * schematic file is loaded. It is read only and it is only written to non-root
+ * schematic files.
+ */
+ std::vector m_symbolInstances;
+ std::vector m_sheetInstances;
};
@@ -536,11 +535,6 @@ public:
*/
class SCH_SCREENS
{
-private:
- std::vector< SCH_SCREEN* > m_screens;
- std::vector< SCH_SHEET* > m_sheets;
- unsigned int m_index;
-
public:
SCH_SCREENS( SCH_SHEET* aSheet );
SCH_SCREENS( SCH_SHEET& aSheet ) : SCH_SCREENS( &aSheet ) {}
@@ -564,8 +558,10 @@ public:
/**
* Test all sheet and component objects in the schematic for duplicate time stamps
* and replaces them as necessary.
+ *
* Time stamps must be unique in order for complex hierarchies know which components go
* to which sheets.
+ *
* @return The number of duplicate time stamps replaced.
*/
int ReplaceDuplicateTimeStamps();
@@ -573,6 +569,7 @@ public:
/**
* Delete all electronic rules check markers of \a aMarkerType from all the screens in
* the list.
+ *
* @param aMarkerType Type of markers to be deleted.
*/
void DeleteAllMarkers( enum MARKER_BASE::TYPEMARKER aMarkerType, bool aIncludeExclusions );
@@ -596,8 +593,8 @@ public:
* subsequent schematic loads with the new s-expression will contain the library
* symbols.
*
- * @param aReporter An optional #REPORTER object pointer to write warning and error
- * messages into.
+ * @param[in] aReporter An optional #REPORTER object pointer to write warning and error
+ * messages into.
*/
void UpdateSymbolLinks( REPORTER* aReporter = nullptr );
@@ -614,9 +611,9 @@ public:
bool HasNoFullyDefinedLibIds();
/**
- * Fetch all of the symbol library nickames into \a aLibNicknames.
+ * Fetch all of the symbol library nicknames into \a aLibNicknames.
*
- * @param aLibNicknames is the array to populate with all of the unique library nicknames.
+ * @param[out] aLibNicknames is the array to populate with all of the unique library nicknames.
* @return the number of symbol library nicknames found.
*/
size_t GetLibNicknames( wxArrayString& aLibNicknames );
@@ -624,8 +621,8 @@ public:
/**
* Change all of the symbol library nicknames.
*
- * @param aFrom the current symbol library name to change.
- * @param aTo the new symbol library name.
+ * @param[in] aFrom the current symbol library name to change.
+ * @param[in] aTo the new symbol library name.
* @return the number of symbol library nicknames that were changed.
*/
int ChangeSymbolLibNickname( const wxString& aFrom, const wxString& aTo );
@@ -636,7 +633,7 @@ public:
* Schematic file names in SCH_SCREEN object are stored with the absolute path to
* the schematic file.
*
- * @param aSchematicFileName is the schematic file name to search.
+ * @param[in] aSchematicFileName is the schematic file name to search.
* @return true if the a schematic matching the file name has been found.
*/
bool HasSchematic( const wxString& aSchematicFileName );
@@ -654,7 +651,7 @@ public:
* File names foo.sch and Foo.sch are unique files on Linux and MacOS but on Windows
* this would result in a broken schematic.
*
- * @param aSchematicFileName is the absolute path and file name of the file to test.
+ * @param[in] aSchematicFileName is the absolute path and file name of the file to test.
* @return true if \a aSchematicFileName would cause an issue.
*/
bool CanCauseCaseSensitivityIssue( const wxString& aSchematicFileName ) const;
@@ -662,6 +659,10 @@ public:
private:
void addScreenToList( SCH_SCREEN* aScreen, SCH_SHEET* aSheet );
void buildScreenList( SCH_SHEET* aSheet);
+
+ std::vector< SCH_SCREEN* > m_screens;
+ std::vector< SCH_SHEET* > m_sheets;
+ unsigned int m_index;
};
#endif /* SCREEN_H */
diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h
index c9b27df0ed..a8f1cb02f3 100644
--- a/eeschema/sch_sheet.h
+++ b/eeschema/sch_sheet.h
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
- * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -45,7 +45,8 @@ class NETLIST_OBJECT_LIST;
/**
- * Defines the edge of the sheet that the sheet pin is positioned
+ * Define the edge of the sheet that the sheet pin is positioned.
+ *
* SHEET_LEFT_SIDE = 0: pin on left side
* SHEET_RIGHT_SIDE = 1: pin on right side
* SHEET_TOP_SIDE = 2: pin on top side
@@ -84,17 +85,8 @@ enum SHEET_FIELD_TYPE {
*/
class SCH_SHEET_PIN : public SCH_HIERLABEL
{
-private:
- int m_number; ///< Label number use for saving sheet label to file.
- ///< Sheet label numbering begins at 2.
- ///< 0 is reserved for the sheet name.
- ///< 1 is reserve for the sheet file name.
-
- SHEET_SIDE m_edge;
-
public:
- SCH_SHEET_PIN( SCH_SHEET* parent,
- const wxPoint& pos = wxPoint( 0, 0 ),
+ SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
// Do not create a copy constructor. The one generated by the compiler is adequate.
@@ -115,9 +107,9 @@ public:
/**
* Return true for items which are moved with the anchor point at mouse cursor
- * and false for items moved with no reference to anchor (usually large items)
+ * and false for items moved with no reference to anchor (usually large items).
*
- * @return true for a hierarchical sheet pin
+ * @return true for a hierarchical sheet pin.
*/
bool IsMovableFromAnchorPoint() const override { return true; }
@@ -126,8 +118,8 @@ public:
/**
* Calculate the graphic shape (a polygon) associated to the text.
*
- * @param aPoints = a buffer to fill with polygon corners coordinates
- * @param aPos = Position of the shape
+ * @param aPoints is a buffer to fill with polygon corners coordinates.
+ * @param aPos is the position of the shape.
*/
void CreateGraphicShape( const RENDER_SETTINGS* aSettings,
std::vector & aPoints, const wxPoint& aPos ) const override;
@@ -146,7 +138,7 @@ public:
/**
* Set the sheet label number.
*
- * @param aNumber - New sheet number label.
+ * @param aNumber New sheet number label.
*/
void SetNumber( int aNumber );
@@ -205,11 +197,22 @@ public:
void SetPosition( const wxPoint& aPosition ) override { ConstrainOnEdge( aPosition ); }
- bool IsPointClickableAnchor( const wxPoint& aPos ) const override { return m_isDangling && GetPosition() == aPos; }
+ bool IsPointClickableAnchor( const wxPoint& aPos ) const override
+ {
+ return m_isDangling && GetPosition() == aPos;
+ }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
EDA_ITEM* Clone() const override;
+
+private:
+ int m_number; ///< Label number use for saving sheet label to file.
+ ///< Sheet label numbering begins at 2.
+ ///< 0 is reserved for the sheet name.
+ ///< 1 is reserve for the sheet file name.
+
+ SHEET_SIDE m_edge;
};
@@ -218,23 +221,6 @@ public:
*/
class SCH_SHEET : public SCH_ITEM
{
- friend class SCH_SHEET_PIN;
-
-
- SCH_SCREEN* m_screen; // Screen that contains the physical data for the sheet. In
- // complex hierarchies multiple sheets can share a common screen.
-
- std::vector m_pins; // The list of sheet connection points.
- std::vector m_fields;
-
- wxPoint m_pos; // The position of the sheet.
- wxSize m_size; // The size of the sheet.
- int m_borderWidth;
- KIGFX::COLOR4D m_borderColor;
- KIGFX::COLOR4D m_backgroundColor;
-
- std::vector m_instances;
-
public:
SCH_SHEET( EDA_ITEM* aParent = nullptr, const wxPoint& pos = wxPoint( 0, 0 ) );
@@ -261,9 +247,9 @@ public:
* and false for items moved with no reference to anchor.
*
* Usually return true for small items (labels, junctions) and false for
- * items which can be large (hierarchical sheets, symbols)
+ * items which can be large (hierarchical sheets, symbols).
*
- * @return false for a hierarchical sheet
+ * @return false for a hierarchical sheet.
*/
bool IsMovableFromAnchorPoint() const override { return false; }
@@ -304,7 +290,7 @@ public:
* * The outline style is set to #PLOT_DASH_TYPE::DEFAULT or #PLOT_DASH_TYPE::SOLID.
* * The outline color is set to #COLOR4D::UNSPECIFIED.
*
- * @return True if the outline stroke meets the default criteria.
+ * @return True if the outline stroke meets the default criteria.
*/
bool UsesDefaultStroke() const;
@@ -340,7 +326,8 @@ public:
/**
* Resolve any references to system tokens supported by the sheet.
- * @param aDepth a counter to limit recursion and circular references.
+ *
+ * @param aDepth is a counter to limit recursion and circular references.
*/
bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
@@ -354,7 +341,7 @@ public:
/**
* Add aSheetPin to the sheet.
*
- * Note: Once a sheet pin is added to the sheet, it is owned by the sheet.
+ * @note Once a sheet pin is added to the sheet, it is owned by the sheet.
* Do not delete the sheet pin object or you will likely get a segfault
* when the sheet is destroyed.
*
@@ -379,7 +366,7 @@ public:
/**
* Delete sheet label which do not have a corresponding hierarchical label.
*
- * Note: Make sure you save a copy of the sheet in the undo list before calling
+ * @note Make sure you save a copy of the sheet in the undo list before calling
* CleanupSheet() otherwise any unreferenced sheet labels will be lost.
*/
void CleanupSheet();
@@ -397,7 +384,6 @@ public:
* Checks if the sheet already has a sheet pin named \a aName.
*
* @param aName Name of the sheet pin to search for.
- *
* @return True if sheet pin with \a aName is found, otherwise false.
*/
bool HasPin( const wxString& aName ) const;
@@ -464,9 +450,9 @@ public:
/**
* Search the existing hierarchy for an instance of screen loaded from \a aFileName.
*
- * @param aFilename = the filename to find (MUST be absolute, and in wxPATH_NATIVE encoding)
- * @param aScreen = a location to return a pointer to the screen (if found)
- * @return bool if found, and a pointer to the screen
+ * @param aFilename The filename to find (MUST be absolute, and in wxPATH_NATIVE encoding).
+ * @param aScreen A location to return a pointer to the screen (if found).
+ * @return true if found, and a pointer to the screen
*/
bool SearchHierarchy( const wxString& aFilename, SCH_SCREEN** aScreen );
@@ -476,9 +462,9 @@ public:
* Don't bother looking at the root sheet, it must be unique. No other references to
* its m_screen otherwise there would be loops in the hierarchy.
*
- * @param aScreen = the SCH_SCREEN* screen that we search for
- * @param aList = the SCH_SHEET_PATH* that must be used
- * @return true if found
+ * @param[in] aScreen The SCH_SCREEN* screen that we search for.
+ * @param[in] aList The SCH_SHEET_PATH* that must be used.
+ * @return true if found.
*/
bool LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList );
@@ -531,7 +517,7 @@ public:
/**
* Resize this sheet to aSize and adjust all of the labels accordingly.
*
- * @param aSize - The new size for this sheet.
+ * @param[in] aSize The new size for this sheet.
*/
void Resize( const wxSize& aSize );
@@ -589,7 +575,7 @@ public:
* in the list, do nothing. Sheet instances allow for the sharing in complex hierarchies
* which allows for per instance data such as page number for sheets to stored.
*
- * @param aInstance is the #KIID_PATH of the sheet instanceadd to the instance list.
+ * @param[in] aInstance is the #KIID_PATH of the sheet instance to the instance list.
* @return false if the instance already exists, true if the instance was added.
*/
bool AddInstance( const KIID_PATH& aInstance );
@@ -604,15 +590,14 @@ public:
/**
* Set the page number for the sheet instance \a aInstance.
*
- * @param aInstance is the hierarchical path of the sheet.
- * @param aReference is the new page number for the sheet.
+ * @param[in] aInstance is the hierarchical path of the sheet.
+ * @param[in] aReference is the new page number for the sheet.
*/
void SetPageNumber( const SCH_SHEET_PATH& aInstance, const wxString& aPageNumber );
/**
- * @brief Compares page numbers of schematic sheets. Currently a basic
- * @param aPageNumberA
- * @param aPageNumberB
+ * Compares page numbers of schematic sheets.
+ *
* @return 0 if the page numbers are equal, -1 if aPageNumberA < aPageNumberB, 1 otherwise
*/
static int ComparePageNum( const wxString& aPageNumberA, const wxString aPageNumberB );
@@ -635,9 +620,23 @@ protected:
private:
bool doIsConnected( const wxPoint& aPosition ) const override;
+
+ friend class SCH_SHEET_PIN;
+
+ SCH_SCREEN* m_screen; // Screen that contains the physical data for the sheet. In
+ // complex hierarchies multiple sheets can share a common screen.
+
+ std::vector m_pins; // The list of sheet connection points.
+ std::vector m_fields;
+
+ wxPoint m_pos; // The position of the sheet.
+ wxSize m_size; // The size of the sheet.
+ int m_borderWidth;
+ KIGFX::COLOR4D m_borderColor;
+ KIGFX::COLOR4D m_backgroundColor;
+
+ std::vector m_instances;
};
-//typedef std::vector< SCH_SHEET* > SCH_SHEETS; // no ownership over contained SCH_SHEETs
-
#endif // SCH_SHEEET_H
diff --git a/eeschema/sch_sheet_path.h b/eeschema/sch_sheet_path.h
index 56364c37a3..7ea4083d1e 100644
--- a/eeschema/sch_sheet_path.h
+++ b/eeschema/sch_sheet_path.h
@@ -120,24 +120,13 @@ typedef std::map SCH_MULTI_UNIT_REFERENCE_MAP;
* Handle access to a stack of flattened #SCH_SHEET objects by way of a path for
* creating a flattened schematic hierarchy.
*
- *
* The #SCH_SHEET objects are stored in a list from first (usually the root sheet) to a
* given sheet in last position. The _last_ sheet is usually the sheet we want to select
* or reach (which is what the function Last() returns). Others sheets constitute the
* "path" from the first to the last sheet.
- *
*/
class SCH_SHEET_PATH
{
-protected:
- std::vector< SCH_SHEET* > m_sheets;
-
- size_t m_current_hash;
-
- int m_virtualPageNumber; /// Page numbers are maintained by the sheet load order.
-
- std::map, bool> m_recursion_test_cache;
-
public:
SCH_SHEET_PATH();
@@ -214,9 +203,9 @@ public:
}
/**
- * Compare if this is the same sheet path as aSheetPathToTest
+ * Compare if this is the same sheet path as \a aSheetPathToTest.
*
- * @param aSheetPathToTest = sheet path to compare
+ * @param aSheetPathToTest is the sheet path to compare.
* @return 1 if this sheet path has more sheets than aSheetPathToTest,
* -1 if this sheet path has fewer sheets than aSheetPathToTest,
* or 0 if same
@@ -250,7 +239,6 @@ public:
* Get the sheet path as an #KIID_PATH.
*
* @note This #KIID_PATH includes the root sheet UUID prefixed to the path.
- * @return
*/
KIID_PATH Path() const;
@@ -258,7 +246,6 @@ public:
* Get the sheet path as an #KIID_PATH without the root sheet UUID prefix.
*
* @note This #KIID_PATH does not include the root sheet UUID prefixed to the path.
- * @return
*/
KIID_PATH PathWithoutRootUuid() const;
@@ -282,10 +269,10 @@ public:
* Adds #SCH_REFERENCE object to \a aReferences for each symbol in the sheet.
*
* @param aReferences List of references to populate.
- * @param aIncludePowerSymbols : false to only get normal symbols.
- * @param aForceIncludeOrphanSymbols : true to include symbols having no symbol found in lib.
- * The normal option is false, and set to true only to
- * build the full list of symbols.
+ * @param aIncludePowerSymbols set to false to only get normal symbols.
+ * @param aForceIncludeOrphanSymbols set to true to include symbols having no symbol found
+ * in lib. The normal option is false, and set to true
+ * only to build the full list of symbols.
*/
void GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols = true,
bool aForceIncludeOrphanSymbols = false ) const;
@@ -297,7 +284,7 @@ public:
* The map key for each element will be the reference designator.
*
* @param aRefList Map of reference designators to reference lists
- * @param aIncludePowerSymbols : false to only get normal symbols.
+ * @param aIncludePowerSymbols Set to false to only get normal symbols.
*/
void GetMultiUnitSymbols( SCH_MULTI_UNIT_REFERENCE_MAP &aRefList,
bool aIncludePowerSymbols = true ) const;
@@ -320,8 +307,16 @@ public:
bool operator<( const SCH_SHEET_PATH& d1 ) const { return m_sheets < d1.m_sheets; }
private:
-
void initFromOther( const SCH_SHEET_PATH& aOther );
+
+protected:
+ std::vector< SCH_SHEET* > m_sheets;
+
+ size_t m_current_hash;
+
+ int m_virtualPageNumber; /// Page numbers are maintained by the sheet load order.
+
+ std::map, bool> m_recursion_test_cache;
};
@@ -348,11 +343,7 @@ typedef SCH_SHEET_PATHS::iterator SCH_SHEET_PATHS_ITER;
*/
class SCH_SHEET_LIST : public SCH_SHEET_PATHS
{
-private:
- SCH_SHEET_PATH m_currentSheetPath;
-
public:
-
/**
* Construct a flattened list of SCH_SHEET_PATH objects from \a aSheet.
*
@@ -396,9 +387,9 @@ public:
*
* @param aReferences List of references to populate.
* @param aIncludePowerSymbols Set to false to only get normal symbols.
- * @param aForceIncludeOrphanSymbols : true to include symbols having no symbol found in lib.
- * The normal option is false, and set to true only to
- * build the full list of symbols.
+ * @param aForceIncludeOrphanSymbols Set to true to include symbols having no symbol found
+ * in lib. The normal option is false, and set to true
+ * only to build the full list of symbols.
*/
void GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols = true,
bool aForceIncludeOrphanSymbols = false ) const;
@@ -448,7 +439,7 @@ public:
void BuildSheetList( SCH_SHEET* aSheet, bool aCheckIntegrity );
/**
- * Sorts the list of sheets by page number. This should be called after #BuildSheetList
+ * Sort the list of sheets by page number. This should be called after #BuildSheetList
*
* @param aUpdateVirtualPageNums If true, updates the virtual page numbers to match the new
* ordering
@@ -490,10 +481,13 @@ public:
/**
* Set initial sheet page numbers.
*
- * The number scheme is base on the old psuedo sheet numbering algorithm prior to
+ * The number scheme is base on the old pseudo sheet numbering algorithm prior to
* the implementation of user definable sheet page numbers.
*/
void SetInitialPageNumbers();
+
+private:
+ SCH_SHEET_PATH m_currentSheetPath;
};
#endif // CLASS_DRAWSHEET_PATH_H
diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp
index a6c2751e19..da70535e0f 100644
--- a/eeschema/sch_symbol.cpp
+++ b/eeschema/sch_symbol.cpp
@@ -116,7 +116,7 @@ SCH_COMPONENT::SCH_COMPONENT( const LIB_PART& aPart, const LIB_ID& aLibId,
part->SetParent();
SetLibSymbol( part.release() );
- // Copy fields from the library component
+ // Copy fields from the library symbol
UpdateFields( true, true );
// Update the reference -- just the prefix for now.
@@ -135,7 +135,7 @@ SCH_COMPONENT::SCH_COMPONENT( const LIB_PART& aPart, const SCH_SHEET_PATH* aShee
const PICKED_SYMBOL& aSel, const wxPoint& pos ) :
SCH_COMPONENT( aPart, aSel.LibId, aSheet, aSel.Unit, aSel.Convert, pos )
{
- // Set any fields that were modified as part of the component selection
+ // Set any fields that were modified as part of the symbol selection
for( const std::pair& i : aSel.Fields )
{
SCH_FIELD* field = GetFieldById( i.first );
@@ -146,34 +146,34 @@ SCH_COMPONENT::SCH_COMPONENT( const LIB_PART& aPart, const SCH_SHEET_PATH* aShee
}
-SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aComponent ) :
- SCH_ITEM( aComponent )
+SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aSymbol ) :
+ SCH_ITEM( aSymbol )
{
- m_parent = aComponent.m_parent;
- m_pos = aComponent.m_pos;
- m_unit = aComponent.m_unit;
- m_convert = aComponent.m_convert;
- m_lib_id = aComponent.m_lib_id;
- m_isInNetlist = aComponent.m_isInNetlist;
- m_inBom = aComponent.m_inBom;
- m_onBoard = aComponent.m_onBoard;
+ m_parent = aSymbol.m_parent;
+ m_pos = aSymbol.m_pos;
+ m_unit = aSymbol.m_unit;
+ m_convert = aSymbol.m_convert;
+ m_lib_id = aSymbol.m_lib_id;
+ m_isInNetlist = aSymbol.m_isInNetlist;
+ m_inBom = aSymbol.m_inBom;
+ m_onBoard = aSymbol.m_onBoard;
- if( aComponent.m_part )
- SetLibSymbol( new LIB_PART( *aComponent.m_part.get() ) );
+ if( aSymbol.m_part )
+ SetLibSymbol( new LIB_PART( *aSymbol.m_part.get() ) );
- const_cast( m_Uuid ) = aComponent.m_Uuid;
+ const_cast( m_Uuid ) = aSymbol.m_Uuid;
- m_transform = aComponent.m_transform;
- m_prefix = aComponent.m_prefix;
- m_instanceReferences = aComponent.m_instanceReferences;
- m_fields = aComponent.m_fields;
+ m_transform = aSymbol.m_transform;
+ m_prefix = aSymbol.m_prefix;
+ m_instanceReferences = aSymbol.m_instanceReferences;
+ m_fields = aSymbol.m_fields;
- // Re-parent the fields, which before this had aComponent as parent
+ // Re-parent the fields, which before this had aSymbol as parent
for( SCH_FIELD& field : m_fields )
field.SetParent( this );
- m_fieldsAutoplaced = aComponent.m_fieldsAutoplaced;
- m_schLibSymbolName = aComponent.m_schLibSymbolName;
+ m_fieldsAutoplaced = aSymbol.m_fieldsAutoplaced;
+ m_schLibSymbolName = aSymbol.m_schLibSymbolName;
}
@@ -441,7 +441,7 @@ const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet, bool aInclude
// If it was not found in m_Paths array, then see if it is in m_Field[REFERENCE] -- if so,
// use this as a default for this path. This will happen if we load a version 1 schematic
// file. It will also mean that multiple instances of the same sheet by default all have
- // the same component references, but perhaps this is best.
+ // the same symbol references, but perhaps this is best.
if( ref.IsEmpty() && !GetField( REFERENCE_FIELD )->GetText().IsEmpty() )
{
const_cast( this )->SetRef( sheet, GetField( REFERENCE_FIELD )->GetText() );
@@ -524,7 +524,7 @@ void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
if( m_prefix != prefix )
m_prefix = prefix;
- // Power components have references starting with # and are not included in netlists
+ // Power symbols have references starting with # and are not included in netlists
m_isInNetlist = ! ref.StartsWith( wxT( "#" ) );
}
@@ -866,7 +866,7 @@ std::vector SCH_COMPONENT::GetPins( const SCH_SHEET_PATH* aSheet ) con
if( aSheet == nullptr )
{
- wxCHECK_MSG( Schematic(), pins, "Can't call GetPins on a component with no schematic" );
+ wxCHECK_MSG( Schematic(), pins, "Can't call GetPins on a symbol with no schematic" );
aSheet = &Schematic()->CurrentSheet();
}
@@ -888,7 +888,7 @@ std::vector SCH_COMPONENT::GetPins( const SCH_SHEET_PATH* aSheet ) con
void SCH_COMPONENT::SwapData( SCH_ITEM* aItem )
{
wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_COMPONENT_T),
- wxT( "Cannot swap data with invalid component." ) );
+ wxT( "Cannot swap data with invalid symbol." ) );
SCH_COMPONENT* component = (SCH_COMPONENT*) aItem;
@@ -1377,12 +1377,12 @@ void SCH_COMPONENT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aL
aList.push_back( MSG_PANEL_ITEM( msg, GetValue( currentSheet, true ) ) );
-#if 0 // Display component flags, for debug only
+#if 0 // Display symbol flags, for debug only
aList.push_back( MSG_PANEL_ITEM( _( "flags" ), wxString::Format( "%X",
GetEditFlags() ) ) );
#endif
- // Display component reference in library and library
+ // Display symbol reference in library and library
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetLibId().GetLibItemName() ) );
if( !m_part->IsRoot() )
@@ -1413,7 +1413,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aL
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), msg ) );
- // Display description of the component, and keywords found in lib
+ // Display description of the symbol, and keywords found in lib
aList.push_back( MSG_PANEL_ITEM( _( "Description" ), m_part->GetDescription(),
DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Keywords" ), m_part->GetKeyWords() ) );
@@ -1457,7 +1457,7 @@ void SCH_COMPONENT::MirrorHorizontally( int aCenter )
for( SCH_FIELD& field : m_fields )
{
- // Move the fields to the new position because the component itself has moved.
+ // Move the fields to the new position because the symbol itself has moved.
wxPoint pos = field.GetTextPos();
pos.x -= dx;
field.SetTextPos( pos );
@@ -1475,7 +1475,7 @@ void SCH_COMPONENT::MirrorVertically( int aCenter )
for( SCH_FIELD& field : m_fields )
{
- // Move the fields to the new position because the component itself has moved.
+ // Move the fields to the new position because the symbol itself has moved.
wxPoint pos = field.GetTextPos();
pos.y -= dy;
field.SetTextPos( pos );
@@ -1493,7 +1493,7 @@ void SCH_COMPONENT::Rotate( wxPoint aCenter )
for( SCH_FIELD& field : m_fields )
{
- // Move the fields to the new position because the component itself has moved.
+ // Move the fields to the new position because the symbol itself has moved.
wxPoint pos = field.GetTextPos();
pos.x -= prev.x - m_pos.x;
pos.y -= prev.y - m_pos.y;
@@ -1506,7 +1506,7 @@ bool SCH_COMPONENT::Matches( const wxFindReplaceData& aSearchData, void* aAuxDat
{
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
- // Components are searchable via the child field and pin item text.
+ // Symbols are searchable via the child field and pin item text.
return false;
}
@@ -1593,7 +1593,7 @@ std::vector SCH_COMPONENT::GetConnectionPoints() const
for( const std::unique_ptr& pin : m_pins )
{
// Collect only pins attached to the current unit and convert.
- // others are not associated to this component instance
+ // others are not associated to this symbol instance
int pin_unit = pin->GetLibPin()->GetUnit();
int pin_convert = pin->GetLibPin()->GetConvert();
@@ -1614,7 +1614,7 @@ LIB_ITEM* SCH_COMPONENT::GetDrawItem( const wxPoint& aPosition, KICAD_T aType )
{
if( m_part )
{
- // Calculate the position relative to the component.
+ // Calculate the position relative to the symbol.
wxPoint libPosition = aPosition - m_pos;
return m_part->LocateDrawItem( m_unit, m_convert, aType, libPosition, m_transform );
@@ -1686,7 +1686,7 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData,
for( const std::unique_ptr& pin : m_pins )
{
// Collect only pins attached to the current unit and convert.
- // others are not associated to this component instance
+ // others are not associated to this symbol instance
int pin_unit = pin->GetLibPin()->GetUnit();
int pin_convert = pin->GetLibPin()->GetConvert();
@@ -1728,14 +1728,14 @@ bool SCH_COMPONENT::operator <( const SCH_ITEM& aItem ) const
}
-bool SCH_COMPONENT::operator==( const SCH_COMPONENT& aComponent ) const
+bool SCH_COMPONENT::operator==( const SCH_COMPONENT& aSymbol ) const
{
- if( GetFieldCount() != aComponent.GetFieldCount() )
+ if( GetFieldCount() != aSymbol.GetFieldCount() )
return false;
for( int i = VALUE_FIELD; i < GetFieldCount(); i++ )
{
- if( GetFields()[i].GetText().Cmp( aComponent.GetFields()[i].GetText() ) != 0 )
+ if( GetFields()[i].GetText().Cmp( aSymbol.GetFields()[i].GetText() ) != 0 )
return false;
}
@@ -1743,9 +1743,9 @@ bool SCH_COMPONENT::operator==( const SCH_COMPONENT& aComponent ) const
}
-bool SCH_COMPONENT::operator!=( const SCH_COMPONENT& aComponent ) const
+bool SCH_COMPONENT::operator!=( const SCH_COMPONENT& aSymbol ) const
{
- return !( *this == aComponent );
+ return !( *this == aSymbol );
}
@@ -1775,7 +1775,7 @@ SCH_COMPONENT& SCH_COMPONENT::operator=( const SCH_ITEM& aItem )
m_fields = c->m_fields; // std::vector's assignment operator
- // Reparent fields after assignment to new component.
+ // Reparent fields after assignment to new symbol.
for( SCH_FIELD& field : m_fields )
field.SetParent( this );
@@ -1824,7 +1824,7 @@ bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const
continue;
// Collect only pins attached to the current unit and convert.
- // others are not associated to this component instance
+ // others are not associated to this symbol instance
int pin_unit = pin->GetLibPin()->GetUnit();
int pin_convert = pin->GetLibPin()->GetConvert();
diff --git a/eeschema/sch_symbol.h b/eeschema/sch_symbol.h
index d92af47ed8..8075390157 100644
--- a/eeschema/sch_symbol.h
+++ b/eeschema/sch_symbol.h
@@ -4,7 +4,7 @@
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2015 Wayne Stambaugh
- * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -77,60 +77,19 @@ extern std::string toUTFTildaText( const wxString& txt );
*/
class SCH_COMPONENT : public SCH_ITEM
{
-private:
- wxPoint m_pos;
- LIB_ID m_lib_id; ///< Name and library the symbol was loaded from, i.e. 74xx:74LS00.
- int m_unit; ///< The unit for multiple part per package components.
- int m_convert; ///< The alternate body style for components that have more than
- ///< one body style defined. Primarily used for components that
- ///< have a De Morgan conversion.
- wxString m_prefix; ///< C, R, U, Q etc - the first character which typically indicates
- ///< what the component is. Determined, upon placement, from the
- ///< library component. Created upon file load, by the first
- ///< non-digits in the reference fields.
-
- /**
- * The name used to look up a symbol in the symbol library embedded in a schematic.
- *
- * By default this is the same as #LIB_ID::GetLibItemName(). However, schematics allow for
- * multiple variants of the same library symbol. Set this member in order to preserve the
- * link to the original symbol library. If empty, #LIB_ID::GetLibItemName() should be used.
- */
- wxString m_schLibSymbolName;
-
- TRANSFORM m_transform; ///< The rotation/mirror transformation matrix.
- SCH_FIELDS m_fields; ///< Variable length list of fields.
-
- std::unique_ptr< LIB_PART > m_part; // a flattened copy of the LIB_PART from
- // the PROJECT's libraries.
- std::vector> m_pins; // a SCH_PIN for every LIB_PIN (all units)
- std::unordered_map m_pinMap; // library pin pointer to SCH_PIN's index
-
- bool m_isInNetlist; ///< True if the component should appear in the netlist
- bool m_inBom; ///< True to include in bill of materials export.
- bool m_onBoard; ///< True to include in netlist when updating board.
-
- // Defines the hierarchical path and reference of the component. This allows support
- // for multiple references to a single sub-sheet.
- std::vector m_instanceReferences;
-
- void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
-
public:
SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = NULL );
/**
- * Create schematic component from library component object.
+ * Create schematic symbol from library symbol object.
*
- * @param aPart - library part to create schematic component from.
- * @param aLibId - libId of alias to create.
- * @param aSheet - Schematic sheet the component is place into.
- * @param unit - Part for components that have multiple parts per
- * package.
- * @param convert - Use the alternate body style for the schematic
- * component.
- * @param pos - Position to place new component.
- * @param setNewItemFlag - Set the component IS_NEW and IS_MOVED flags.
+ * @param aPart is the library part to create schematic symbol from.
+ * @param aLibId is the #LIB_ID of alias to create.
+ * @param aSheet is the schematic sheet the symbol is place into.
+ * @param unit is unit for symbols that have multiple parts per package.
+ * @param convert is the alternate body style for the schematic symbols.
+ * @param pos is the position of the symbol.
+ * @param setNewItemFlag is used to set the symbol #IS_NEW and #IS_MOVED flags.
*/
SCH_COMPONENT( const LIB_PART& aPart, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
int unit = 0, int convert = 0,
@@ -139,15 +98,15 @@ public:
SCH_COMPONENT( const LIB_PART& aPart, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
const wxPoint& pos = wxPoint( 0, 0 ) );
/**
- * Clones \a aComponent into a new schematic symbol object.
+ * Clone \a aSymbol into a new schematic symbol object.
*
* All fields are copied as is except for the linked list management pointers
* which are set to NULL, and the SCH_FIELD's m_Parent pointers which are set
* to the new object.
*
- * @param aComponent is the schematic symbol to clone.
+ * @param aSymbol is the schematic symbol to clone.
*/
- SCH_COMPONENT( const SCH_COMPONENT& aComponent );
+ SCH_COMPONENT( const SCH_COMPONENT& aSymbol );
~SCH_COMPONENT() { }
@@ -173,13 +132,13 @@ public:
* and false for items moved with no reference to anchor.
*
* Usually return true for small items (labels, junctions) and false for items which can
- * be large (hierarchical sheets, components).
+ * be large (hierarchical sheets, symbols).
*
- * Note: we used to try and be smart about this and return false for components in case
- * they are big. However, this annoyed some users and we now have a preference which
- * controls warping on move in general, so this was switched to true for components.
+ * @note We used to try and be smart about this and return false for symbols in case
+ * they are big. However, this annoyed some users and we now have a preference which
+ * controls warping on move in general, so this was switched to true for symbols.
*
- * @return true for a component
+ * @return true for a symbol.
*/
bool IsMovableFromAnchorPoint() const override { return true; }
@@ -312,7 +271,8 @@ public:
void GetContextualTextVars( wxArrayString* aVars ) const;
/**
- * Resolve any references to system tokens supported by the component.
+ * Resolve any references to system tokens supported by the symbol.
+ *
* @param aDepth a counter to limit recursion and circular references.
*/
bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
@@ -320,7 +280,7 @@ public:
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override;
/**
- * Clear exiting component annotation.
+ * Clear exiting symbol annotation.
*
* For example, IC23 would be changed to IC? and unit number would be reset.
*
@@ -332,12 +292,12 @@ public:
/**
* Add an instance to the alternate references list (m_instanceReferences), if this entry
* does not already exist.
- * Do nothing if already exists.
- * In component lists shared by more than one sheet path, an entry for each
- * sheet path must exist to manage references
- * @param aSheetPath is the candidate sheet path
- * this sheet path is the sheet path of the sheet containing the component,
- * not the full component sheet path
+ *
+ * Do nothing if already exists. In symbol lists shared by more than one sheet path, an
+ * entry for each sheet path must exist to manage references.
+ *
+ * @param aSheetPath is the candidate sheet path of the sheet containing the symbol not the
+ * full symbol sheet path.
* @return false if the alternate reference was existing, true if added.
*/
bool AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheetPath );
@@ -366,23 +326,21 @@ public:
//----------------------------------------------------------------
/**
- * Returns a mandatory field in this symbol.
+ * Return a mandatory field in this symbol.
*
- * NB: If you need to fetch a user field, use GetFieldById.
+ * @note If you need to fetch a user field, use GetFieldById.
*
* @param aFieldType is one of the mandatory field types (REFERENCE_FIELD, VALUE_FIELD, etc.).
- *
* @return is the field at \a aFieldType or NULL if the field does not exist.
*/
SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldType );
const SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldNdx ) const;
/**
- * Returns a field in this symbol.
+ * Return a field in this symbol.
*
* @param aFieldId is the id of the field requested. Note that this id ONLY SOMETIMES equates
- * to the field's position in the vector.
- *
+ * to the field's position in the vector.
* @return is the field at \a aFieldType or NULL if the field does not exist.
*/
SCH_FIELD* GetFieldById( int aFieldId );
@@ -395,7 +353,7 @@ public:
wxString GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME* aFrame ) const;
/**
- * Populates a std::vector with SCH_FIELDs.
+ * Populate a std::vector with SCH_FIELDs.
*
* @param aVector is the vector to populate.
* @param aVisibleOnly is used to add only the fields that are visible and contain text.
@@ -403,7 +361,7 @@ public:
void GetFields( std::vector& aVector, bool aVisibleOnly );
/**
- * Returns a vector of fields from the component
+ * Return a vector of fields from the symbol
*/
std::vector& GetFields() { return m_fields; }
const std::vector& GetFields() const { return m_fields; }
@@ -418,7 +376,7 @@ public:
SCH_FIELD* AddField( const SCH_FIELD& aField );
/**
- * Removes a user field from the symbol.
+ * Remove a user field from the symbol.
* @param aFieldName is the user fieldName to remove. Attempts to remove a mandatory
* field or a non-existant field are silently ignored.
*/
@@ -445,7 +403,8 @@ public:
}
/**
- * Restores fields to the original library values.
+ * Restore fields to the original library values.
+ *
* @param aResetStyle selects whether fields should reset the position and text attribute.
* @param aResetRef selects whether the reference field should be restored.
*/
@@ -457,13 +416,13 @@ public:
int GetFieldCount() const { return (int)m_fields.size(); }
/**
- * Automatically orient all the fields in the component.
+ * Automatically orient all the fields in the symbol.
*
* @param aScreen is the SCH_SCREEN associated with the current instance of the
- * component. This can be NULL when aManual is false.
+ * symbol. This can be NULL when aManual is false.
* @param aManual should be true if the autoplace was manually initiated (e.g. by a hotkey
- * or a menu item). Some more 'intelligent' routines will be used that would be
- * annoying if done automatically during moves.
+ * or a menu item). Some more 'intelligent' routines will be used that would be
+ * annoying if done automatically during moves.
*/
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
@@ -477,7 +436,6 @@ public:
* Find a symbol pin by number.
*
* @param number is the number of the pin to find.
- *
* @return Pin object if found, otherwise NULL.
*/
SCH_PIN* GetPin( const wxString& number ) const;
@@ -492,9 +450,11 @@ public:
SCH_PIN* GetPin( LIB_PIN* aLibPin );
/**
- * Retrieves a list of the SCH_PINs for the given sheet path.
- * Since a component can have a different unit on a different instance of a sheet,
+ * Retrieve a list of the SCH_PINs for the given sheet path.
+ *
+ * Since a symbol can have a different unit on a different instance of a sheet,
* this list returns the subset of pins that exist on a given sheet.
+ *
* @return a vector of pointers (non-owning) to SCH_PINs
*/
std::vector GetPins( const SCH_SHEET_PATH* aSheet = nullptr ) const;
@@ -502,23 +462,22 @@ public:
std::vector>& GetRawPins() { return m_pins; }
/**
- * Print a component
+ * Print a symbol.
*
- * @param aDC is the device context (can be null)
- * @param aOffset is the drawing offset (usually wxPoint(0,0),
- * but can be different when moving an object)
+ * @param aDC is the device context (can be null).
+ * @param aOffset is the drawing offset (usually wxPoint(0,0), but can be different when
+ * moving an object)
*/
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
void SwapData( SCH_ITEM* aItem ) override;
/**
- * Tests for an acceptable reference string.
+ * Test for an acceptable reference string.
*
* An acceptable reference string must support unannotation i.e starts by letter
*
* @param aReferenceString is the reference string to validate
- *
* @return true if reference string is valid.
*/
static bool IsReferenceStringValid( const wxString& aReferenceString );
@@ -539,22 +498,23 @@ public:
void SetRef( const SCH_SHEET_PATH* aSheet, const wxString& aReference );
/**
- * Checks if the component has a valid annotation (reference) for the given sheet path
- * @param aSheet is the sheet path to test
- * @return true if the component exists on that sheet and has a valid reference
+ * Check if the symbol has a valid annotation (reference) for the given sheet path.
+ *
+ * @param aSheet is the sheet path to test.
+ * @return true if the symbol exists on that sheet and has a valid reference.
*/
bool IsAnnotated( const SCH_SHEET_PATH* aSheet );
/**
* Add a full hierarchical reference to this symbol.
*
- * @param aPath is the hierarchical path (/<sheet timestamp>/<component
- * timestamp> like /05678E50/A23EF560)
- * @param aRef is the local reference like C45, R56
+ * @param aPath is the hierarchical path (/<sheet timestamp>/<symbol
+ * timestamp> like /05678E50/A23EF560).
+ * @param aRef is the local reference like C45, R56.
* @param aUnit is the unit selection used for symbols with multiple units per package.
- * @param aValue is the value used for this instance
+ * @param aValue is the value used for this instance.
* @param aFootprint is the footprint used for this instance (which might have different
- * hole spacing or other board-specific changes from other intances)
+ * hole spacing or other board-specific changes from other instances).
*/
void AddHierarchicalReference( const KIID_PATH& aPath,
const wxString& aRef,
@@ -562,30 +522,30 @@ public:
const wxString& aValue = wxEmptyString,
const wxString& aFootprint = wxEmptyString );
- // Returns the instance-specific unit selection for the given sheet path.
+ /// Return the instance-specific unit selection for the given sheet path.
int GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const;
- // Set the selected unit of this symbol on one sheet
+ /// Set the selected unit of this symbol on one sheet.
void SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSelection );
- // Set the selected unit of this symbol for all sheets
+ /// Set the selected unit of this symbol for all sheets.
void SetUnitSelection( int aUnitSelection );
- // Returns the instance-specific value for the given sheet path.
+ /// Return the instance-specific value for the given sheet path.
const wxString GetValue( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
void SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValue );
- // Set the value for all instances (the default GUI behaviour)
+ /// Set the value for all instances (the default GUI behavior).
void SetValue( const wxString& aValue )
{
SetValue( nullptr, aValue );
}
- // Returns the instance-specific footprint assignment for the given sheet path.
+ /// Return the instance-specific footprint assignment for the given sheet path.
const wxString GetFootprint( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
void SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& aFootprint );
- // Set the value for all instances (the default GUI behaviour)
+ /// Set the value for all instances (the default GUI behavior).
void SetFootprint( const wxString& aFootprint )
{
SetFootprint( nullptr, aFootprint );
@@ -615,14 +575,13 @@ public:
void GetEndPoints( std::vector& aItemList ) override;
/**
- * Test if the component's dangling state has changed for all pins.
+ * Test if the symbol's dangling state has changed for all pins.
*
* As a side effect, actually update the dangling status for all pins.
*
* @note This does not test for short circuits.
*
* @param aItemList is list of all #DANGLING_END_ITEM items to be tested.
- *
* @return true if any pin's state has changed.
*/
bool UpdateDanglingState( std::vector& aItemList,
@@ -644,9 +603,7 @@ public:
}
/**
- * @return true if the component is in netlist
- * which means this is not a power component, or something
- * like a component reference starting by #
+ * @return true if the symbol is in netlist.
*/
bool IsInNetlist() const;
@@ -655,11 +612,10 @@ public:
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
/**
- * Return the component library item at \a aPosition that is part of this component.
+ * Return the symbol library item at \a aPosition that is part of this symbol.
*
- * @param aPosition is the schematic position of the component library object.
+ * @param aPosition is the schematic position of the symbol library object.
* @param aType is the type of symbol library object to find or any if set to TYPE_NOT_INIT.
- *
* @return is the symbol library object if found otherwise NULL.
*/
LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT );
@@ -670,8 +626,8 @@ public:
bool operator <( const SCH_ITEM& aItem ) const override;
- bool operator==( const SCH_COMPONENT& aComponent) const;
- bool operator!=( const SCH_COMPONENT& aComponent) const;
+ bool operator==( const SCH_COMPONENT& aSymbol) const;
+ bool operator!=( const SCH_COMPONENT& aSymbol) const;
SCH_COMPONENT& operator=( const SCH_ITEM& aItem );
@@ -705,6 +661,44 @@ public:
private:
bool doIsConnected( const wxPoint& aPosition ) const override;
+
+ void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
+
+ wxPoint m_pos;
+ LIB_ID m_lib_id; ///< Name and library the symbol was loaded from, i.e. 74xx:74LS00.
+ int m_unit; ///< The unit for multiple part per package symbols.
+ int m_convert; ///< The alternate body style for symbols that have more than
+ ///< one body style defined. Primarily used for symbols that
+ ///< have a De Morgan conversion.
+ wxString m_prefix; ///< C, R, U, Q etc - the first character which typically indicates
+ ///< what the symbol is. Determined, upon placement, from the
+ ///< library symbol. Created upon file load, by the first
+ ///< non-digits in the reference fields.
+
+ /**
+ * The name used to look up a symbol in the symbol library embedded in a schematic.
+ *
+ * By default this is the same as #LIB_ID::GetLibItemName(). However, schematics allow for
+ * multiple variants of the same library symbol. Set this member in order to preserve the
+ * link to the original symbol library. If empty, #LIB_ID::GetLibItemName() should be used.
+ */
+ wxString m_schLibSymbolName;
+
+ TRANSFORM m_transform; ///< The rotation/mirror transformation matrix.
+ SCH_FIELDS m_fields; ///< Variable length list of fields.
+
+ std::unique_ptr< LIB_PART > m_part; // a flattened copy of the LIB_PART from
+ // the PROJECT's libraries.
+ std::vector> m_pins; // a SCH_PIN for every LIB_PIN (all units)
+ std::unordered_map m_pinMap; // library pin pointer to SCH_PIN's index
+
+ bool m_isInNetlist; ///< True if the symbol should appear in the netlist
+ bool m_inBom; ///< True to include in bill of materials export.
+ bool m_onBoard; ///< True to include in netlist when updating board.
+
+ // Defines the hierarchical path and reference of the symbol. This allows support
+ // for multiple references to a single sub-sheet.
+ std::vector m_instanceReferences;
};
#endif /* COMPONENT_CLASS_H */
diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h
index b04b4836b8..26fa200826 100644
--- a/eeschema/sch_text.h
+++ b/eeschema/sch_text.h
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
- * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -145,8 +145,8 @@ private:
SPIN m_spin;
};
-/* Shape/Type of SCH_HIERLABEL and SCH_GLOBALLABEL
- * mainly used to handle the graphic associated shape
+/*
+ * Shape/Type of #SCH_HIERLABEL and #SCH_GLOBALLABEL.
*/
enum class PINSHEETLABEL_SHAPE
{
@@ -164,26 +164,6 @@ extern const char* SheetLabelType[]; /* names of types of labels */
class SCH_TEXT : public SCH_ITEM, public EDA_TEXT
{
-protected:
- PINSHEETLABEL_SHAPE m_shape;
-
- /// True if not connected to another object if the object derive from SCH_TEXT
- /// supports connections.
- bool m_isDangling;
-
- CONNECTION_TYPE m_connectionType;
-
- /**
- * The orientation of text and any associated drawing elements of derived objects.
- * 0 is the horizontal and left justified.
- * 1 is vertical and top justified.
- * 2 is horizontal and right justified. It is the equivalent of the mirrored 0 orentation.
- * 3 is veritcal and bottom justifiend. It is the equivalent of the mirrored 1 orentation.
- * This is a duplicattion of m_Orient, m_HJustified, and m_VJustified in #EDA_TEXT but is
- * easier to handle than 3 parameters when editing and reading and saving files.
- */
- LABEL_SPIN_STYLE m_spin_style;
-
public:
SCH_TEXT( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString,
KICAD_T aType = SCH_TEXT_T );
@@ -210,7 +190,8 @@ public:
/**
* Returns the set of contextual text variable tokens for this text item.
- * @param aVars [out]
+ *
+ * @param[out] aVars
*/
void GetContextualTextVars( wxArrayString* aVars ) const;
@@ -227,7 +208,8 @@ public:
* Set a spin or rotation angle, along with specific horizontal and vertical justification
* styles with each angle.
*
- * @param aSpinStyle Spin style as per LABEL_SPIN_STYLE storage class, may be the enum values or int value
+ * @param aSpinStyle Spin style as per #LABEL_SPIN_STYLE storage class, may be the enum
+ * values or int value
*/
virtual void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle );
LABEL_SPIN_STYLE GetLabelSpinStyle() const { return m_spin_style; }
@@ -237,10 +219,10 @@ public:
void SetShape( PINSHEETLABEL_SHAPE aShape ) { m_shape = aShape; }
/**
- * @return the offset between the SCH_TEXT position and the text itself position
- *
* This offset depends on the orientation, the type of text, and the area required to
* draw the associated graphic symbol or to put the text above a wire.
+ *
+ * @return the offset between the SCH_TEXT position and the text itself position
*/
virtual wxPoint GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const;
@@ -251,7 +233,6 @@ public:
*
* @param aPoints A buffer to fill with polygon corners coordinates
* @param Pos Position of the shape, for texts and labels: do nothing
- * Mainly for derived classes (SCH_SHEET_PIN and Hierarchical labels)
*/
virtual void CreateGraphicShape( const RENDER_SETTINGS* aSettings,
std::vector& aPoints, const wxPoint& Pos ) const
@@ -326,6 +307,27 @@ public:
#endif
static HTML_MESSAGE_BOX* ShowSyntaxHelp( wxWindow* aParentWindow );
+
+protected:
+ PINSHEETLABEL_SHAPE m_shape;
+
+ /// True if not connected to another object if the object derive from SCH_TEXT
+ /// supports connections.
+ bool m_isDangling;
+
+ CONNECTION_TYPE m_connectionType;
+
+ /**
+ * The orientation of text and any associated drawing elements of derived objects.
+ * - 0 is the horizontal and left justified.
+ * - 1 is vertical and top justified.
+ * - 2 is horizontal and right justified. It is the equivalent of the mirrored 0 orientation.
+ * - 3 is vertical and bottom justified. It is the equivalent of the mirrored 1 orientation.
+ *
+ * This is a duplication of m_Orient, m_HJustified, and m_VJustified in #EDA_TEXT but is
+ * easier to handle than 3 parameters when editing and reading and saving files.
+ */
+ LABEL_SPIN_STYLE m_spin_style;
};
@@ -368,10 +370,16 @@ public:
EDA_ITEM* Clone() const override;
- bool IsPointClickableAnchor( const wxPoint& aPos ) const override { return m_isDangling && GetPosition() == aPos; }
+ bool IsPointClickableAnchor( const wxPoint& aPos ) const override
+ {
+ return m_isDangling && GetPosition() == aPos;
+ }
private:
- bool doIsConnected( const wxPoint& aPosition ) const override { return EDA_TEXT::GetTextPos() == aPosition; }
+ bool doIsConnected( const wxPoint& aPosition ) const override
+ {
+ return EDA_TEXT::GetTextPos() == aPosition;
+ }
};
@@ -414,13 +422,13 @@ public:
wxPoint GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
/**
- * Returns the bounding box on the global label only, without taking in account
- * the intersheets references
+ * Return the bounding box on the global label only, without taking in account
+ * the intersheet references.
*/
const EDA_RECT GetBoundingBoxBase() const;
/**
- * Returns the bounding box on the global label only, including the intersheets references
+ * Return the bounding box on the global label only, including the intersheet references.
*/
const EDA_RECT GetBoundingBox() const override;
@@ -519,10 +527,16 @@ public:
EDA_ITEM* Clone() const override;
- bool IsPointClickableAnchor( const wxPoint& aPos ) const override { return m_isDangling && GetPosition() == aPos; }
+ bool IsPointClickableAnchor( const wxPoint& aPos ) const override
+ {
+ return m_isDangling && GetPosition() == aPos;
+ }
private:
- bool doIsConnected( const wxPoint& aPosition ) const override { return EDA_TEXT::GetTextPos() == aPosition; }
+ bool doIsConnected( const wxPoint& aPosition ) const override
+ {
+ return EDA_TEXT::GetTextPos() == aPosition;
+ }
};
#endif /* CLASS_TEXT_LABEL_H */
diff --git a/eeschema/sch_validators.h b/eeschema/sch_validators.h
index f53a0a034a..4ca52b3744 100644
--- a/eeschema/sch_validators.h
+++ b/eeschema/sch_validators.h
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Wayne Stambaugh, stambaughw@gmail.com
- * Copyright (C) 2016-2019 KiCad Developers, see change_log.txt for contributors.
+ * Copyright (C) 2016-2021 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -50,9 +50,6 @@
*/
class SCH_FIELD_VALIDATOR : public wxTextValidator
{
- int m_fieldId;
- bool m_isLibEditor;
-
public:
SCH_FIELD_VALIDATOR( bool aIsLibEditor, int aFieldId, wxString* aValue = NULL );
@@ -64,10 +61,14 @@ public:
* Override the default Validate() function provided by wxTextValidator to provide
* better error messages.
*
- * @param aParent - a pointer to the parent window of the error message dialog.
+ * @param aParent is the parent window of the error message dialog.
* @return true if the text in the control is valid otherwise false.
*/
virtual bool Validate( wxWindow *aParent ) override;
+
+private:
+ int m_fieldId;
+ bool m_isLibEditor;
};
@@ -90,7 +91,7 @@ public:
{ }
protected:
- // returns the error message if the contents of 'val' are invalid
+ /// @return the error message if the contents of \a aVal are invalid.
wxString IsValid( const wxString& aVal ) const override;
};
diff --git a/eeschema/schematic.h b/eeschema/schematic.h
index abd864a9c1..27b96583d0 100644
--- a/eeschema/schematic.h
+++ b/eeschema/schematic.h
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
- * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -50,38 +50,14 @@ public:
};
/**
- * Holds all the data relating to one schematic
+ * Holds all the data relating to one schematic.
+ *
* A schematic may consist of one or more sheets (and one root sheet)
- * Right now, eeschema can have only one schematic open at a time, but this could change.
+ * Right now, Eeschema can have only one schematic open at a time, but this could change.
* Please keep this possibility in mind when adding to this object.
*/
class SCHEMATIC : public SCHEMATIC_IFACE, public EDA_ITEM
{
- friend class SCH_EDIT_FRAME;
-
-private:
- PROJECT* m_project;
-
- /// The top-level sheet in this schematic hierarchy (or potentially the only one)
- SCH_SHEET* m_rootSheet;
-
- /**
- * The sheet path of the sheet currently being edited or displayed.
- * Note that this was moved here from SCH_EDIT_FRAME because currently many places in the code
- * want to know the current sheet. Potentially this can be moved back to the UI code once
- * the only places that want to know it are UI-related
- */
- SCH_SHEET_PATH* m_currentSheet;
-
- /// Holds and calculates connectivity information of this schematic
- CONNECTION_GRAPH* m_connectionGraph;
-
- /**
- * Holds a map of labels to the page numbers that they appear on. Used to update global
- * label intersheet references.
- */
- std::map> m_labelToPageRefsMap;
-
public:
SCHEMATIC( PROJECT* aPrj );
@@ -92,7 +68,7 @@ public:
return wxT( "SCHEMATIC" );
}
- /// Initializes this schematic to a blank one, unloading anything existing
+ /// Initialize this schematic to a blank one, unloading anything existing.
void Reset();
/// Return a reference to the project this schematic is part of
@@ -119,9 +95,11 @@ public:
}
/**
- * Initializes the schematic with a new root sheet.
+ * Initialize the schematic with a new root sheet.
+ *
* This is typically done by calling a file loader that returns the new root sheet
* As a side-effect, takes care of some post-load initialization.
+ *
* @param aRootSheet is the new root sheet for this schematic.
*/
void SetRoot( SCH_SHEET* aRootSheet );
@@ -132,7 +110,7 @@ public:
return m_rootSheet != nullptr;
}
- /// Helper to retreive the screen of the root sheet
+ /// Helper to retrieve the screen of the root sheet
SCH_SCREEN* RootScreen() const;
/// Helper to retrieve the filename from the root sheet screen
@@ -160,13 +138,13 @@ public:
std::vector ResolveERCExclusions();
/**
- * Returns a pointer to a bus alias object for the given label, or null if one
+ * Return a pointer to a bus alias object for the given label, or null if one
* doesn't exist.
*/
std::shared_ptr GetBusAlias( const wxString& aLabel ) const;
/**
- * Returns a list of name candidates for netclass assignment. The list will include both
+ * Return a list of name candidates for netclass assignment. The list will include both
* composite names (buses) and atomic net names. Names are fetched from available labels,
* power pins, etc.
*/
@@ -185,7 +163,7 @@ public:
wxString ConvertKIIDsToRefs( const wxString& aSource ) const;
/**
- * Return the full schematic flattened hiearchical sheet list.
+ * Return the full schematic flattened hierarchical sheet list.
*/
SCH_SHEET_LIST& GetFullHierarchy() const;
@@ -193,6 +171,31 @@ public:
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override {}
#endif
+
+private:
+ friend class SCH_EDIT_FRAME;
+
+ PROJECT* m_project;
+
+ /// The top-level sheet in this schematic hierarchy (or potentially the only one)
+ SCH_SHEET* m_rootSheet;
+
+ /**
+ * The sheet path of the sheet currently being edited or displayed.
+ * Note that this was moved here from SCH_EDIT_FRAME because currently many places in the code
+ * want to know the current sheet. Potentially this can be moved back to the UI code once
+ * the only places that want to know it are UI-related
+ */
+ SCH_SHEET_PATH* m_currentSheet;
+
+ /// Holds and calculates connectivity information of this schematic
+ CONNECTION_GRAPH* m_connectionGraph;
+
+ /**
+ * Holds a map of labels to the page numbers that they appear on. Used to update global
+ * label intersheet references.
+ */
+ std::map> m_labelToPageRefsMap;
};
#endif
diff --git a/eeschema/symbol_lib_table.h b/eeschema/symbol_lib_table.h
index c30c9ea9f8..879d8943d9 100644
--- a/eeschema/symbol_lib_table.h
+++ b/eeschema/symbol_lib_table.h
@@ -40,8 +40,6 @@ class DIALOG_SYMBOL_LIB_TABLE;
*/
class SYMBOL_LIB_TABLE_ROW : public LIB_TABLE_ROW
{
- friend class SYMBOL_LIB_TABLE;
-
public:
typedef SCH_IO_MGR::SCH_FILE_T LIB_T;
@@ -76,8 +74,9 @@ public:
/**
* Attempt to reload the library.
+ *
* @return true if a reload was required.
- * @throws IO_ERROR if the reload was unsuccessful.
+ * @throw IO_ERROR if the reload was unsuccessful.
*/
bool Refresh();
@@ -90,6 +89,7 @@ protected:
}
private:
+ friend class SYMBOL_LIB_TABLE;
virtual LIB_TABLE_ROW* do_clone() const override
{
@@ -108,11 +108,6 @@ private:
class SYMBOL_LIB_TABLE : public LIB_TABLE
{
- friend class SYMBOL_LIB_TABLE_GRID;
- friend class PANEL_SYM_LIB_TABLE;
-
- static int m_modifyHash; ///< helper for GetModifyHash()
-
public:
KICAD_T Type() override { return SYMBOL_LIB_TABLE_T; }
@@ -156,7 +151,6 @@ public:
* @param aNickname is a locator for the "library", it is a "name" in LIB_TABLE_ROW.
* @param aAliasNames is a reference to an array for the alias names.
* @param aPowerSymbolsOnly is a flag to enumerate only power symbols.
- *
* @throw IO_ERROR if the library cannot be found or loaded.
*/
void EnumerateSymbolLib( const wxString& aNickname, wxArrayString& aAliasNames,
@@ -171,9 +165,7 @@ public:
* @param aNickname is a locator for the "library", it is a "name" in #LIB_TABLE_ROW
* @param aName is the name of the #LIB_PART to load.
* @param aFlatten set to true to flatten derived parts.
- *
* @return the symbol alias if found or NULL if not found.
- *
* @throw IO_ERROR if the library cannot be found or read. No exception
* is thrown in the case where \a aNickname cannot be found.
*/
@@ -198,7 +190,7 @@ public:
*
* If a #LIB_PART by the same name already exists or there are any conflicting alias
* names, the new #LIB_PART will silently overwrite any existing aliases and/or part
- * becaue libraries cannot have duplicate alias names. It is the responsibility of
+ * because libraries cannot have duplicate alias names. It is the responsibility of
* the caller to check the library for conflicts before saving.
*
* @param aNickname is a locator for the "library", it is a "name" in LIB_TABLE_ROW
@@ -206,9 +198,7 @@ public:
* call.
* @param aOverwrite when true means overwrite any existing symbol by the same name,
* else if false means skip the write and return SAVE_SKIPPED.
- *
* @return SAVE_T - SAVE_OK or SAVE_SKIPPED. If error saving, then IO_ERROR is thrown.
- *
* @throw IO_ERROR if there is a problem saving the symbol.
*/
SAVE_T SaveSymbol( const wxString& aNickname, const LIB_PART* aSymbol,
@@ -218,9 +208,7 @@ public:
* Deletes the @a aSymbolName from the library given by @a aNickname.
*
* @param aNickname is a locator for the "library", it is a "name" in LIB_TABLE_ROW.
- *
* @param aSymbolName is the name of a symbol to delete from the specified library.
- *
* @throw IO_ERROR if there is a problem finding the footprint or the library, or deleting it.
*/
void DeleteSymbol( const wxString& aNickname, const wxString& aSymbolName );
@@ -232,7 +220,6 @@ public:
* installed.
*
* @param aNickname is the library nickname in the symbol library table.
- *
* @throw IO_ERROR if no library at @a aNickname exists.
*/
bool IsSymbolLibWritable( const wxString& aNickname );
@@ -241,7 +228,6 @@ public:
* Return true if the library given by @a aNickname was successfully loaded.
*
* @param aNickname is the library nickname in the symbol library table.
- *
* @throw IO_ERROR if no library at @a aNickname exists.
*/
bool IsSymbolLibLoaded( const wxString& aNickname );
@@ -256,9 +242,7 @@ public:
* Load a #LIB_PART having @a aFootprintId with possibly an empty library nickname.
*
* @param aId the library nickname and name of the symbol to load.
- *
* @return the library symbol if found (the library owns it) or NULL if not found.
- *
* @throw IO_ERROR if the library cannot be found or read. No exception
* is thrown in the case where aId cannot be found.
* @throw PARSE_ERROR if @a aId is not parsed OK.
@@ -273,9 +257,7 @@ public:
* time being.
*
* @param aTable the #SYMBOL_LIB_TABLE object to load.
- *
* @return true if the global library table exists and is loaded properly.
- *
* @throw IO_ERROR if an error occurs attempting to load the symbol library table.
*/
static bool LoadGlobalTable( SYMBOL_LIB_TABLE& aTable );
@@ -301,6 +283,12 @@ public:
static SYMBOL_LIB_TABLE& GetGlobalLibTable();
static const wxString& GetSymbolLibTableFileName();
+
+private:
+ friend class SYMBOL_LIB_TABLE_GRID;
+ friend class PANEL_SYM_LIB_TABLE;
+
+ static int m_modifyHash; ///< helper for GetModifyHash()
};
diff --git a/eeschema/symbol_viewer_frame.h b/eeschema/symbol_viewer_frame.h
index 6ee0565184..b3d9555e76 100644
--- a/eeschema/symbol_viewer_frame.h
+++ b/eeschema/symbol_viewer_frame.h
@@ -3,7 +3,7 @@
*
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh
- * Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -45,11 +45,10 @@ class SYMBOL_VIEWER_FRAME : public SCH_BASE_FRAME
public:
/**
- * Constructor
* @param aKiway
- * @param aParent = the parent frame
- * @param aFrameType must be either FRAME_SCH_LIB_VIEWER or FRAME_SCH_LIB_VIEWER_MODAL
- * @param aLibrary = the library to open when starting (default = NULL)
+ * @param aParent is the parent frame of the viewer.
+ * @param aFrameType must be either #FRAME_SCH_LIB_VIEWER or #FRAME_SCH_LIB_VIEWER_MODAL.
+ * @param aLibrary is the library to open when starting (default = NULL).
*/
SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
const wxString& aLibraryName = wxEmptyString );
@@ -57,9 +56,8 @@ public:
~SYMBOL_VIEWER_FRAME();
/**
- * Function ShowModal
+ * Runs the symbol viewer as a modal dialog.
*
- * Runs the Symbol Viewer as a modal dialog.
* @param aSymbol an optional FPID string to initialize the viewer with and to
* return a selected footprint through.
*/
@@ -73,18 +71,18 @@ public:
void OnSize( wxSizeEvent& event ) override;
/**
- * Creates or recreates a sorted list of currently loaded libraries.
+ * Create o recreates a sorted list of currently loaded libraries.
*
- * @return whether the selection of either library or component was changed (i.e. because the
- * selected library no longer exists)
+ * @return whether the selection of either library or symbol was changed (i.e. because the
+ * selected library no longer exists).
*/
bool ReCreateLibList();
/**
- * Create or recreate the list of components in the currently selected library.
+ * Create or recreate the list of symbols in the currently selected library.
*
- * @return whether the selection was changed (i.e. because the selected component no longer
- * exists)
+ * @return whether the selection was changed (i.e. because the selected symbol no longer
+ * exists).
*/
bool ReCreateSymbolList();
@@ -108,11 +106,11 @@ public:
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
/**
- * Set a filter to display only libraries and/or components which match the filter.
+ * Set a filter to display only libraries and/or symbols which match the filter.
*
* @param aFilter is a filter to pass the allowed library name list and/or some other filter
* see SCH_BASE_FRAME::SelectComponentFromLibrary() for details.
- * if aFilter == NULL, remove all filtering
+ * if aFilter == NULL, remove all filtering.
*/
void SetFilter( const SCHLIB_FILTER* aFilter );
@@ -122,16 +120,16 @@ public:
void SetSelectedLibrary( const wxString& aLibName );
/**
- * Set the selected component.
+ * Set the selected symbol.
*/
void SetSelectedSymbol( const wxString& aSymbolName );
// Accessors:
/**
- * Set unit and convert, and set flag preventing them from automatically resetting to 1
+ * Set unit and convert, and set flag preventing them from automatically resetting to 1.
*
- * @param aUnit - unit; if invalid will be set to 1
- * @param aConvert - convert; if invalid will be set to 1
+ * @param aUnit is the unit, if invalid will be set to 1.
+ * @param aConvert is the alternate body style, if invalid will be set to 1.
*/
void SetUnitAndConvert( int aUnit, int aConvert );
int GetUnit() const { return m_unit; }
@@ -147,11 +145,11 @@ protected:
void setupUIConditions() override;
private:
- // Sets up the tool framework
+ // Set up the tool framework.
void setupTools();
/**
- * Called when the frame is activated to reload the libraries and component lists
+ * Called when the frame is activated to reload the libraries and symbol lists
* that can be changed by the schematic editor or the library editor.
*/
void OnActivate( wxActivateEvent& event );
@@ -169,13 +167,13 @@ private:
private:
wxChoice* m_unitChoice;
- wxListBox* m_libList; // The list of libs
- int m_libListWidth; // Last width of the window
+ wxListBox* m_libList; // The list of libraries.
+ int m_libListWidth; // Last width of the window.
- wxListBox* m_symbolList; // The list of components
- int m_symbolListWidth; // Last width of the window
+ wxListBox* m_symbolList; // The list of symbols.
+ int m_symbolListWidth; // Last width of the window.
- // Filters to build list of libs/list of parts
+ // Filters to build list of libs/list of symbols.
bool m_listPowerCmpOnly;
wxArrayString m_allowedLibs;
@@ -186,7 +184,7 @@ private:
static int m_convert;
/**
- * Updated to `true` if a list rewrite on GUI activation resulted in the component
+ * Updated to `true` if a list rewrite on GUI activation resulted in the symbol
* selection changing, or if the user has changed the selection manually.
*/
bool m_selection_changed;