49#define BITMAP_FONT_SIZE_THRESHOLD 3
65 else if( aBodyStyle == BODY_STYLE::DEMORGAN )
66 return _(
"Alternate" );
67 else if( aBodyStyle == BODY_STYLE::BASE )
68 return _(
"Standard" );
78 EDA_ITEM( aParent, aType, true, false ),
80 m_bodyStyle( aBodyStyle ),
157 return static_cast<SCHEMATIC*
>( parent );
173 return static_cast<const SCH_SYMBOL*
>( parent );
175 return static_cast<const LIB_SYMBOL*
>( parent );
242 conn->SetGraph( aGraph );
244 for(
auto& member : conn->AllMembers() )
245 member->SetGraph( aGraph );
252 static std::shared_ptr<NETCLASS> nullNetclass = std::make_shared<NETCLASS>( wxEmptyString );
262 return netSettings->GetEffectiveNetClass( connection->
Name() );
264 return netSettings->GetDefaultNetclass();
291 if( vec.size() == vec.capacity() )
292 vec.reserve( vec.size() + 4096 );
295 auto it = std::lower_bound( vec.begin(), vec.end(), aItem );
297 if( it == vec.end() || *it != aItem )
298 vec.insert( it, aItem );
343 static wxString s_empty;
377 auto clearTextCaches =
384 text->ClearBoundingBoxCache();
385 text->ClearRenderCache();
389 clearTextCaches(
this );
409 return (
compare( aOther ) < 0 );
469 return schematic->Settings().m_FontMetrics;
502 std::vector<MSG_PANEL_ITEM>& aList )
510 if( parent->GetUnitCount() )
513 if( parent->HasAlternateBodyStyle() )
518 aList.emplace_back(
_(
"Private" ), wxEmptyString );
542 return symbol->IsMulti();
548 auto multiBodyStyle =
554 return symbol->HasAlternateBodyStyle();
581 const auto aPos = a.GetPosition();
582 const auto bPos = b.GetPosition();
583 return aPos.y < bPos.y ? true : ( aPos.y > bPos.y ? false : aPos.x < bPos.x );
593std::vector<DANGLING_END_ITEM>::iterator
598 auto start = aItemListByPos.begin();
599 auto end = aItemListByPos.end();
600 return std::lower_bound( start, end, needle,
lessYX );
604std::vector<DANGLING_END_ITEM>::iterator
609 auto start = aItemListByType.begin();
610 auto end = aItemListByType.end();
611 return std::lower_bound( start, end, needle,
lessType );
616 std::vector<DANGLING_END_ITEM>& aItemListByType,
617 std::vector<DANGLING_END_ITEM>& aItemListByPos )
620 std::stable_sort( aItemListByType.begin(), aItemListByType.end(),
lessType );
622 std::sort( aItemListByPos.begin(), aItemListByPos.end(),
lessYX );
Calculate the connectivity of a schematic and generates netlists.
void RemoveItem(SCH_ITEM *aItem)
static std::vector< DANGLING_END_ITEM >::iterator get_lower_type(std::vector< DANGLING_END_ITEM > &aItemListByType, const DANGLING_END_T &aType)
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
static void sort_dangling_end_items(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos)
Both contain the same information.
Helper class used to store the state of schematic items that can be connected to other schematic item...
DANGLING_END_T GetType() const
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
virtual void ClearEditFlags()
EDA_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
EDA_ITEM_FLAGS GetTempFlags() const
virtual wxString GetFriendlyName() const
EDA_ITEM * GetParent() const
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
virtual void ClearTempFlags()
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Class that other classes need to inherit from, in order to be inspectable.
static const METRICS & Default()
int GetDefaultPenWidth() const
int GetMinPenWidth() const
Define a library symbol object.
static wxString LetterSubReference(int aUnit, int aFirstId)
virtual SETTINGS_MANAGER & GetSettingsManager() const
std::shared_ptr< NET_SETTINGS > m_NetSettings
Net settings for this project (owned here)
virtual PROJECT_FILE & GetProjectFile() const
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
PROPERTY_BASE & SetIsHiddenFromDesignEditors(bool aIsHidden=true)
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
Holds all the data relating to one schematic.
SCH_SHEET_PATH & CurrentSheet() const override
CONNECTION_GRAPH * ConnectionGraph() const override
static bool m_IsSchematicExists
True if a SCHEMATIC exists, false if not.
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
void Reset()
Clears connectivity information.
wxString Name(bool aIgnoreSheet=false) const
void SetGraph(CONNECTION_GRAPH *aGraph)
void SetSheet(SCH_SHEET_PATH aSheet)
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual void SetBodyStyle(int aBodyStyle)
virtual bool IsConnectable() const
virtual bool IsLocked() const
virtual int GetPenWidth() const
const SCH_ITEM_VEC & ConnectedItems(const SCH_SHEET_PATH &aPath)
Retrieve the set of items connected to this item on the given sheet.
SCH_ITEM & operator=(const SCH_ITEM &aPin)
void ClearConnectedItems(const SCH_SHEET_PATH &aPath)
Clear all connections to this item.
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
const wxString & GetDefaultFont() const
const SYMBOL * GetParentSymbol() const
void SetPrivate(bool aPrivate)
virtual const wxString & GetCachedDriverName() const
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
static wxString GetUnitDescription(int aUnit)
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
virtual void SetLocked(bool aLocked)
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
virtual bool operator==(const SCH_ITEM &aOther) const
bool m_connectivity_dirty
virtual void ClearCaches()
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
virtual void SwapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
virtual int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
FIELDS_AUTOPLACED m_fieldsAutoplaced
bool RenderAsBitmap(double aWorldScale) const override
static wxString GetBodyStyleDescription(int aBodyStyle)
void SetConnectionGraph(CONNECTION_GRAPH *aGraph)
Updates the connection graph for all connections in this item.
virtual void SetUnit(int aUnit)
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
virtual bool operator<(const SCH_ITEM &aItem) const
virtual bool IsHypertext() const
Allow items to support hypertext actions when hovered/clicked.
SCH_CONNECTION * GetOrInitConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
wxString GetClass() const override
Return the class name.
const KIFONT::METRICS & GetFontMetrics() const
std::map< SCH_SHEET_PATH, SCH_ITEM_VEC, SHEET_PATH_CMP > m_connected_items
Store pointers to other items that are connected to this one, per sheet.
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
void getSymbolEditorMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
A base class for LIB_SYMBOL and SCH_SYMBOL.
#define BRIGHTENED
item is drawn with a bright contour
#define SELECTED
Item was manually selected by the user.
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
std::uint32_t EDA_ITEM_FLAGS
SCH_LAYER_ID
Eeschema drawing layers.
@ LAYER_DEVICE_BACKGROUND
@ LAYER_SELECTION_SHADOWS
#define UNIMPLEMENTED_FOR(type)
PGM_BASE & Pgm()
The global Program "get" accessor.
#define IMPLEMENT_ENUM_TO_WXANY(type)
static bool lessYX(const DANGLING_END_ITEM &a, const DANGLING_END_ITEM &b)
#define BITMAP_FONT_SIZE_THRESHOLD
static bool lessType(const DANGLING_END_ITEM &a, const DANGLING_END_ITEM &b)
static struct SCH_ITEM_DESC _SCH_ITEM_DESC
std::vector< SCH_ITEM * > SCH_ITEM_VEC
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
bool operator()(const SCH_ITEM *aFirst, const SCH_ITEM *aSecond) const
wxLogTrace helper definitions.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.