KiCad PCB EDA Suite
SCH_LABEL_BASE Class Referenceabstract

#include <sch_label.h>

Inheritance diagram for SCH_LABEL_BASE:
SCH_TEXT SCH_ITEM EDA_TEXT EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE SCH_DIRECTIVE_LABEL SCH_GLOBALLABEL SCH_HIERLABEL SCH_LABEL SCH_SHEET_PIN

Public Member Functions

 SCH_LABEL_BASE (const VECTOR2I &aPos, const wxString &aText, KICAD_T aType)
 
 SCH_LABEL_BASE (const SCH_LABEL_BASE &aLabel)
 
virtual wxString GetClass () const override=0
 Return the class name. More...
 
bool IsType (const std::vector< KICAD_T > &aScanTypes) const override
 Check whether the item is one of the listed types. More...
 
void SwapData (SCH_ITEM *aItem) override
 Swap the internal data structures aItem with the schematic item. More...
 
bool CanConnect (const SCH_ITEM *aItem) const override
 
LABEL_FLAG_SHAPE GetShape () const override
 
void SetShape (LABEL_FLAG_SHAPE aShape) override
 
COLOR4D GetLabelColor () const
 
void SetLastResolvedState (const SCH_ITEM *aItem) override
 
virtual int GetMandatoryFieldCount ()
 
std::vector< SCH_FIELD > & GetFields ()
 
const std::vector< SCH_FIELD > & GetFields () const
 
void SetFields (const std::vector< SCH_FIELD > &aFields)
 Set multiple schematic fields. More...
 
bool IncrementLabel (int aIncrement)
 Increment the label text, if it ends with a number. More...
 
void Move (const VECTOR2I &aMoveVector) override
 Move the item by aMoveVector to a new position. More...
 
void Rotate (const VECTOR2I &aCenter) override
 Rotate the item around aCenter 90 degrees in the clockwise direction. More...
 
void Rotate90 (bool aClockwise) override
 
void AutoplaceFields (SCH_SCREEN *aScreen, bool aManual) override
 
void GetIntersheetRefs (std::vector< std::pair< wxString, wxString > > *pages)
 Builds an array of { pageNumber, pageName } pairs. More...
 
virtual bool ResolveTextVar (wxString *token, int aDepth) const
 
wxString GetShownText (int aDepth=0, bool aAllowExtraText=true) const override
 Return the string actually shown after processing of the base text. More...
 
void RunOnChildren (const std::function< void(SCH_ITEM *)> &aFunction) override
 
INSPECT_RESULT Visit (INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes) override
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
bool Matches (const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
 Compare the item against the search criteria in aSearchData. More...
 
bool Replace (const EDA_SEARCH_DATA &aSearchData, void *aAuxData) override
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
VECTOR2I GetSchematicTextOffset (const RENDER_SETTINGS *aSettings) const override
 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. More...
 
virtual void CreateGraphicShape (const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &Pos) const
 Calculate the graphic shape (a polygon) associated to the text. More...
 
int GetLabelBoxExpansion (const RENDER_SETTINGS *aSettings=nullptr) const
 
virtual const BOX2I GetBodyBoundingBox () const
 Return the bounding box of the label only, without taking in account its fields. More...
 
const BOX2I GetBoundingBox () const override
 Return the bounding box of the label including its fields. More...
 
bool HitTest (const VECTOR2I &aPosition, int aAccuracy=0) const override
 Test if aPosition is inside or on the boundary of this item. More...
 
bool HitTest (const BOX2I &aRect, bool aContained, int aAccuracy=0) const override
 Test if aRect intersects this item. More...
 
std::vector< VECTOR2IGetConnectionPoints () const override
 Add all the connection points for this item to aPoints. More...
 
void GetEndPoints (std::vector< DANGLING_END_ITEM > &aItemList) override
 Add the schematic item end points to aItemList if the item has end points. More...
 
bool UpdateDanglingState (std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr) override
 Test the schematic item to aItemList to check if it's dangling state has changed. More...
 
bool IsDangling () const override
 
void SetIsDangling (bool aIsDangling)
 
void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the layers the item is drawn on (which may be more than its "home" layer) More...
 
void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
 Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
void Plot (PLOTTER *aPlotter, bool aBackground) const override
 Plot the schematic item to aPlotter. More...
 
void Print (const RENDER_SETTINGS *aSettings, const VECTOR2I &offset) override
 Print a schematic item. More...
 
bool AutoRotateOnPlacement () const
 autoRotateOnPlacement More...
 
void SetAutoRotateOnPlacement (bool autoRotate=true)
 setAutoRotateOnPlacement More...
 
virtual bool AutoRotateOnPlacementSupported () const =0
 AutoRotateOnPlacementSupported. More...
 
bool IsHypertext () const override
 Allow items to support hypertext actions when hovered/clicked. More...
 
void DoHypertextAction (EDA_DRAW_FRAME *aFrame) const override
 
virtual void SetTextSpinStyle (TEXT_SPIN_STYLE aSpinStyle)
 Set a spin or rotation angle, along with specific horizontal and vertical justification styles with each angle. More...
 
TEXT_SPIN_STYLE GetTextSpinStyle () const
 
void Print (const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, const COLOR4D &aColor, OUTLINE_MODE aDisplay_mode=FILLED)
 Print this text object to the device context aDC. More...
 
bool operator< (const SCH_ITEM &aItem) const override
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
int GetTextOffset (const RENDER_SETTINGS *aSettings=nullptr) const
 
int GetPenWidth () const override
 
void MirrorHorizontally (int aCenter) override
 Mirror item horizontally about aCenter. More...
 
void MirrorVertically (int aCenter) override
 Mirror item vertically about aCenter. More...
 
virtual void MirrorSpinStyle (bool aLeftRight)
 
bool Replace (const EDA_SEARCH_DATA &aSearchData)
 Helper function used in search and replace dialog. More...
 
virtual bool IsReplaceable () const override
 Override this method in any derived object that supports test find and replace. More...
 
wxString GetSelectMenuText (UNITS_PROVIDER *aUnitsProvider) const override
 Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
VECTOR2I GetPosition () const override
 
void SetPosition (const VECTOR2I &aPosition) override
 
EDA_ITEMClone () const override
 Create a duplicate of this item with linked list members set to NULL. More...
 
SCH_ITEMDuplicate (bool doClone=false) const
 Routine to create a new copy of given item. More...
 
virtual bool IsMovableFromAnchorPoint () const
 
VECTOR2IGetStoredPos ()
 
void SetStoredPos (const VECTOR2I &aPos)
 
SCHEMATICSchematic () const
 Searches the item hierarchy to find a SCHEMATIC. More...
 
virtual bool IsLocked () const
 
virtual void SetLocked (bool aLocked)
 Set the 'lock' status to aLocked for of this item. More...
 
SCH_LAYER_ID GetLayer () const
 Return the layer this item is on. More...
 
void SetLayer (SCH_LAYER_ID aLayer)
 Set the layer this item is on. More...
 
const wxString & GetDefaultFont () const
 
bool RenderAsBitmap (double aWorldScale) const override
 
virtual void PrintBackground (const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset)
 Print the (optional) backaground elements if they exist. More...
 
virtual bool IsConnectable () const
 
virtual bool IsPointClickableAnchor (const VECTOR2I &aPos) const
 
void ClearConnections ()
 Clears all of the connection items from the list. More...
 
bool IsConnected (const VECTOR2I &aPoint) const
 Test the item to see if it is connected to aPoint. More...
 
SCH_CONNECTIONConnection (const SCH_SHEET_PATH *aSheet=nullptr) const
 Retrieve the connection associated with this object in the given sheet. More...
 
SCH_ITEM_SETConnectedItems (const SCH_SHEET_PATH &aPath)
 Retrieve the set of items connected to this item on the given sheet. More...
 
void AddConnectionTo (const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
 Add a connection link between this item and another. More...
 
SCH_CONNECTIONInitializeConnection (const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
 Create a new connection object associated with this object. More...
 
SCH_CONNECTIONGetOrInitConnection (const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
 
virtual bool ConnectionPropagatesTo (const EDA_ITEM *aItem) const
 Return true if this item should propagate connection info to aItem. More...
 
bool IsConnectivityDirty () const
 
void SetConnectivityDirty (bool aDirty=true)
 
std::shared_ptr< NETCLASSGetEffectiveNetClass (const SCH_SHEET_PATH *aSheet=nullptr) const
 
FIELDS_AUTOPLACED GetFieldsAutoplaced () const
 Return whether the fields have been automatically placed. More...
 
void SetFieldsAutoplaced ()
 
void ClearFieldsAutoplaced ()
 
void AutoAutoplaceFields (SCH_SCREEN *aScreen)
 Autoplace fields only if correct to do so automatically. More...
 
virtual void ClearCaches ()
 
virtual bool HasLineStroke () const
 Check if this schematic item has line stoke properties. More...
 
virtual STROKE_PARAMS GetStroke () const
 
virtual void SetStroke (const STROKE_PARAMS &aStroke)
 
KICAD_T Type () const
 Returns the type of object. More...
 
EDA_ITEMGetParent () const
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
bool IsRollover () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
void SetIsShownAsBitmap (bool aBitmap)
 
bool IsShownAsBitmap () const
 
void SetForceVisible (bool aEnable)
 Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual wxString GetFriendlyName () const
 
virtual const VECTOR2I GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual VECTOR2I GetSortPosition () const
 Return the coordinates that should be used for sorting this element visually compared to other elements. More...
 
wxString GetTypeDesc () const
 Return a translated description of the type for this EDA_ITEM for display in user facing messages. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw the parts of the object belonging to layer aLayer. More...
 
virtual double ViewGetLOD (int aLayer, VIEW *aView) const
 Return the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
std::optional< T > Get (const wxString &aProperty) const
 
virtual const wxString & GetText () const
 Return the string associated with the text object. More...
 
bool HasTextVars () const
 Indicates the ShownText has text var references which need to be processed. More...
 
virtual void SetText (const wxString &aText)
 
void SetTextThickness (int aWidth)
 The TextThickness is that set by the user. More...
 
int GetTextThickness () const
 
int GetEffectiveTextPenWidth (int aDefaultPenWidth=0) const
 The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth. More...
 
virtual void SetTextAngle (const EDA_ANGLE &aAngle)
 
const EDA_ANGLEGetTextAngle () const
 
void SetTextAngleDegrees (double aOrientation)
 
double GetTextAngleDegrees () const
 
void SetItalic (bool aItalic)
 
bool IsItalic () const
 
void SetBold (bool aBold)
 
bool IsBold () const
 
virtual void SetVisible (bool aVisible)
 
virtual bool IsVisible () const
 
void SetMirrored (bool isMirrored)
 
bool IsMirrored () const
 
void SetMultilineAllowed (bool aAllow)
 
bool IsMultilineAllowed () const
 
void SetHorizJustify (GR_TEXT_H_ALIGN_T aType)
 
GR_TEXT_H_ALIGN_T GetHorizJustify () const
 
void SetVertJustify (GR_TEXT_V_ALIGN_T aType)
 
GR_TEXT_V_ALIGN_T GetVertJustify () const
 
void SetKeepUpright (bool aKeepUpright)
 
bool IsKeepUpright () const
 
void SetAttributes (const EDA_TEXT &aSrc)
 Set the text attributes from another instance. More...
 
void SetAttributes (const TEXT_ATTRIBUTES &aTextAttrs)
 
void SwapAttributes (EDA_TEXT &aTradingPartner)
 Swap the text attributes of the two involved instances. More...
 
void SwapText (EDA_TEXT &aTradingPartner)
 
void CopyText (const EDA_TEXT &aSrc)
 
const TEXT_ATTRIBUTESGetAttributes () const
 
bool IsDefaultFormatting () const
 
void SetFont (KIFONT::FONT *aFont)
 
KIFONT::FONTGetFont () const
 
wxString GetFontName () const
 
void SetLineSpacing (double aLineSpacing)
 
double GetLineSpacing () const
 
void SetTextSize (const VECTOR2I &aNewSize)
 
VECTOR2I GetTextSize () const
 
void SetTextWidth (int aWidth)
 
int GetTextWidth () const
 
void SetTextHeight (int aHeight)
 
int GetTextHeight () const
 
void SetTextColor (const COLOR4D &aColor)
 
COLOR4D GetTextColor () const
 
void SetTextPos (const VECTOR2I &aPoint)
 
const VECTOR2IGetTextPos () const
 
void SetTextX (int aX)
 
void SetTextY (int aY)
 
void Offset (const VECTOR2I &aOffset)
 
void Empty ()
 
void TransformBoundingBoxToPolygon (SHAPE_POLY_SET *aBuffer, int aClearance) const
 Convert the text bounding box to a rectangular polygon depending on the text orientation, the bounding box is not always horizontal or vertical. More...
 
std::shared_ptr< SHAPE_COMPOUNDGetEffectiveTextShape (bool aTriangulate=true, bool aUseTextRotation=true) const
 build a list of segments (SHAPE_SEGMENT) to describe a text shape. More...
 
virtual bool TextHitTest (const VECTOR2I &aPoint, int aAccuracy=0) const
 Test if aPoint is within the bounds of this object. More...
 
virtual bool TextHitTest (const BOX2I &aRect, bool aContains, int aAccuracy=0) const
 Test if object bounding box is contained within or intersects aRect. More...
 
BOX2I GetTextBox (int aLine=-1, bool aInvertY=false) const
 Useful in multiline texts to calculate the full text or a line area (for zones filling, locate functions....) More...
 
int GetInterline () const
 Return the distance between two lines of text. More...
 
wxString GetTextStyleName () const
 
void GetLinePositions (std::vector< VECTOR2I > &aPositions, int aLineCount) const
 Populate aPositions with the position of each line of a multiline text, according to the vertical justification and the rotation of the whole text. More...
 
virtual void Format (OUTPUTFORMATTER *aFormatter, int aNestLevel, int aControlBits) const
 Output the object to aFormatter in s-expression form. More...
 
virtual EDA_ANGLE GetDrawRotation () const
 
virtual VECTOR2I GetDrawPos () const
 
virtual void ClearRenderCache ()
 
virtual void ClearBoundingBoxCache ()
 
std::vector< std::unique_ptr< KIFONT::GLYPH > > * GetRenderCache (const KIFONT::FONT *aFont, const wxString &forResolvedText, const VECTOR2I &aOffset={ 0, 0 }) const
 
void SetupRenderCache (const wxString &aResolvedText, const EDA_ANGLE &aAngle)
 
void AddRenderCacheGlyph (const SHAPE_POLY_SET &aPoly)
 
int Compare (const EDA_TEXT *aOther) const
 
virtual bool HasHyperlink () const
 
wxString GetHyperlink () const
 
void SetHyperlink (wxString aLink)
 
void RemoveHyperlink ()
 

Static Public Member Functions

static const wxString GetDefaultFieldName (const wxString &aName, bool aUseDefaultName)
 
static bool ClassOf (const EDA_ITEM *aItem)
 
static bool Replace (const EDA_SEARCH_DATA &aSearchData, wxString &aText)
 Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static HTML_MESSAGE_BOXShowSyntaxHelp (wxWindow *aParentWindow)
 
template<class T >
static INSPECT_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static INSPECT_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 
static GR_TEXT_H_ALIGN_T MapHorizJustify (int aHorizJustify)
 
static GR_TEXT_V_ALIGN_T MapVertJustify (int aVertJustify)
 
static bool ValidateHyperlink (const wxString &aURL)
 Check if aURL is a valid hyperlink. More...
 
static bool IsGotoPageHref (const wxString &aHref, wxString *aDestination=nullptr)
 Check if aHref is a valid internal hyperlink. More...
 
static wxString GotoPageHref (const wxString &aDestination)
 Generate a href to a page in the current schematic. More...
 

Public Attributes

const KIID m_Uuid
 

Protected Member Functions

bool Matches (const wxString &aText, const EDA_SEARCH_DATA &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 
KIFONT::FONTgetDrawFont () const override
 
void cacheShownText ()
 
void printOneLineOfText (const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, const COLOR4D &aColor, OUTLINE_MODE aFillMode, const wxString &aText, const VECTOR2I &aPos)
 Print each line of this EDA_TEXT. More...
 

Protected Attributes

std::vector< SCH_FIELDm_fields
 
LABEL_FLAG_SHAPE m_shape
 
CONNECTION_TYPE m_connectionType
 
bool m_isDangling
 
bool m_autoRotateOnPlacement = false
 
COLOR4D m_lastResolvedColor
 
TEXT_SPIN_STYLE m_spin_style
 The orientation of text and any associated drawing elements of derived objects. More...
 
SCH_LAYER_ID m_layer
 
EDA_ITEMS m_connections
 
FIELDS_AUTOPLACED m_fieldsAutoplaced
 
VECTOR2I m_storedPos
 
std::map< SCH_SHEET_PATH, SCH_ITEM_SET, SHEET_PATH_CMPm_connected_items
 Store pointers to other items that are connected to this one, per sheet. More...
 
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
 Store connectivity information, per sheet. More...
 
bool m_connectivity_dirty
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 
wxString m_hyperlink
 A hyperlink URL. More...
 

Private Member Functions

virtual bool doIsConnected (const VECTOR2I &aPosition) const
 Provide the object specific test to see if it is connected to aPosition. More...
 

Private Attributes

KICAD_T m_structType
 Run time identification, keep private so it can never be changed after a ctor sets it. More...
 
VIEW_ITEM_DATA * m_viewPrivData
 
wxString m_text
 
wxString m_shown_text
 
bool m_shown_text_has_text_var_refs
 
std::reference_wrapper< const EDA_IU_SCALEm_IuScale
 
wxString m_render_cache_text
 
EDA_ANGLE m_render_cache_angle
 
VECTOR2I m_render_cache_offset
 
std::vector< std::unique_ptr< KIFONT::GLYPH > > m_render_cache
 
bool m_bounding_box_cache_valid
 
VECTOR2I m_bounding_box_cache_pos
 
int m_bounding_box_cache_line
 
bool m_bounding_box_cache_inverted
 
BOX2I m_bounding_box_cache
 
TEXT_ATTRIBUTES m_attributes
 
VECTOR2I m_pos
 

Detailed Description

Definition at line 34 of file sch_label.h.

Constructor & Destructor Documentation

◆ SCH_LABEL_BASE() [1/2]

SCH_LABEL_BASE::SCH_LABEL_BASE ( const VECTOR2I aPos,
const wxString &  aText,
KICAD_T  aType 
)

Definition at line 155 of file sch_label.cpp.

155 :
156 SCH_TEXT( aPos, aText, aType ),
159 m_isDangling( true ),
160 m_lastResolvedColor( COLOR4D::UNSPECIFIED )
161{
162 SetMultilineAllowed( false );
163 ClearFieldsAutoplaced(); // fiels are not yet autoplaced.
164}
void SetMultilineAllowed(bool aAllow)
Definition: eda_text.cpp:232
void ClearFieldsAutoplaced()
Definition: sch_item.h:427
COLOR4D m_lastResolvedColor
Definition: sch_label.h:217
bool m_isDangling
Definition: sch_label.h:214
CONNECTION_TYPE m_connectionType
Definition: sch_label.h:213
LABEL_FLAG_SHAPE m_shape
Definition: sch_label.h:211
SCH_TEXT(const VECTOR2I &aPos={ 0, 0 }, const wxString &aText=wxEmptyString, KICAD_T aType=SCH_TEXT_T)
Definition: sch_text.cpp:115
@ NONE
No connection to this item.
@ L_UNSPECIFIED
Definition: sch_text.h:101

References SCH_ITEM::ClearFieldsAutoplaced(), EDA_TEXT::SetMultilineAllowed(), and UNSPECIFIED.

◆ SCH_LABEL_BASE() [2/2]

SCH_LABEL_BASE::SCH_LABEL_BASE ( const SCH_LABEL_BASE aLabel)

Definition at line 167 of file sch_label.cpp.

167 :
168 SCH_TEXT( aLabel ),
169 m_shape( aLabel.m_shape ),
171 m_isDangling( aLabel.m_isDangling ),
173{
174 SetMultilineAllowed( false );
175
176 m_fields = aLabel.m_fields;
177
178 for( SCH_FIELD& field : m_fields )
179 field.SetParent( this );
180}
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:50
std::vector< SCH_FIELD > m_fields
Definition: sch_label.h:209

References m_fields, and EDA_TEXT::SetMultilineAllowed().

Member Function Documentation

◆ AddConnectionTo()

void SCH_ITEM::AddConnectionTo ( const SCH_SHEET_PATH aPath,
SCH_ITEM aItem 
)
inherited

Add a connection link between this item and another.

Definition at line 193 of file sch_item.cpp.

194{
195 SCH_ITEM_SET& set = m_connected_items[ aSheet ];
196
197 // The vector elements are small, so reserve 1k at a time to prevent re-allocations
198 if( set.size() == set.capacity() )
199 set.reserve( set.size() + 4096 );
200
201 set.emplace_back( aItem );
202}
std::map< SCH_SHEET_PATH, SCH_ITEM_SET, SHEET_PATH_CMP > m_connected_items
Store pointers to other items that are connected to this one, per sheet.
Definition: sch_item.h:498
std::vector< SCH_ITEM * > SCH_ITEM_SET
Definition: sch_item.h:136

References SCH_ITEM::m_connected_items.

Referenced by UpdateDanglingState(), and CONNECTION_GRAPH::updateItemConnectivity().

◆ AddRenderCacheGlyph()

void EDA_TEXT::AddRenderCacheGlyph ( const SHAPE_POLY_SET aPoly)
inherited

Definition at line 491 of file eda_text.cpp.

492{
493 m_render_cache.emplace_back( std::make_unique<KIFONT::OUTLINE_GLYPH>( aPoly ) );
494}
std::vector< std::unique_ptr< KIFONT::GLYPH > > m_render_cache
Definition: eda_text.h:398

References EDA_TEXT::m_render_cache.

◆ AutoAutoplaceFields()

void SCH_ITEM::AutoAutoplaceFields ( SCH_SCREEN aScreen)
inlineinherited

Autoplace fields only if correct to do so automatically.

Fields that have been moved by hand are not automatically placed.

Parameters
aScreenis the SCH_SCREEN associated with the current instance of the symbol.

Definition at line 436 of file sch_item.h.

437 {
438 if( GetFieldsAutoplaced() )
440 }
FIELDS_AUTOPLACED GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
Definition: sch_item.h:424
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
Definition: sch_item.h:442
@ FIELDS_AUTOPLACED_MANUAL
Definition: sch_item.h:58

References SCH_ITEM::AutoplaceFields(), FIELDS_AUTOPLACED_MANUAL, and SCH_ITEM::GetFieldsAutoplaced().

Referenced by DIALOG_CHANGE_SYMBOLS::processSymbol(), SCH_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Rotate(), SCH_SHEET::SCH_SHEET(), SCH_EDIT_FRAME::SelectUnit(), and DIALOG_LABEL_PROPERTIES::TransferDataFromWindow().

◆ AutoplaceFields()

void SCH_LABEL_BASE::AutoplaceFields ( SCH_SCREEN aScreen,
bool  aManual 
)
overridevirtual

Reimplemented from SCH_ITEM.

Reimplemented in SCH_DIRECTIVE_LABEL.

Definition at line 376 of file sch_label.cpp.

377{
378 int margin = GetTextOffset() * 2;
379 int labelLen = GetBodyBoundingBox().GetSizeMax();
380 int accumulated = GetTextHeight() / 2;
381
382 if( Type() == SCH_GLOBAL_LABEL_T )
383 accumulated += margin + GetPenWidth() + margin;
384
385 for( SCH_FIELD& field : m_fields )
386 {
387 VECTOR2I offset( 0, 0 );
388
389 switch( GetTextSpinStyle() )
390 {
391 default:
393 field.SetTextAngle( ANGLE_HORIZONTAL );
394 field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
395
396 if( Type() == SCH_GLOBAL_LABEL_T && field.GetId() == 0 )
397 offset.x = - ( labelLen + margin );
398 else
399 offset.y = accumulated + field.GetTextHeight() / 2;
400
401 break;
402
404 field.SetTextAngle( ANGLE_VERTICAL );
405 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
406
407 if( Type() == SCH_GLOBAL_LABEL_T && field.GetId() == 0 )
408 offset.y = - ( labelLen + margin );
409 else
410 offset.x = accumulated + field.GetTextHeight() / 2;
411
412 break;
413
415 field.SetTextAngle( ANGLE_HORIZONTAL );
416 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
417
418 if( Type() == SCH_GLOBAL_LABEL_T && field.GetId() == 0 )
419 offset.x = labelLen + margin;
420 else
421 offset.y = accumulated + field.GetTextHeight() / 2;
422
423 break;
424
426 field.SetTextAngle( ANGLE_VERTICAL );
427 field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
428
429 if( Type() == SCH_GLOBAL_LABEL_T && field.GetId() == 0 )
430 offset.y = labelLen + margin;
431 else
432 offset.x = accumulated + field.GetTextHeight() / 2;
433
434 break;
435 }
436
437 field.SetTextPos( GetTextPos() + offset );
438
439 if( Type() != SCH_GLOBAL_LABEL_T || field.GetId() > 0 )
440 accumulated += field.GetTextHeight() + margin;
441 }
442
444}
int GetSizeMax() const
Definition: box2.h:200
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
int GetTextHeight() const
Definition: eda_text.h:202
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:208
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:493
virtual const BOX2I GetBodyBoundingBox() const
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:682
TEXT_SPIN_STYLE GetTextSpinStyle() const
Definition: sch_text.h:148
int GetPenWidth() const override
Definition: sch_text.cpp:273
int GetTextOffset(const RENDER_SETTINGS *aSettings=nullptr) const
Definition: sch_text.cpp:258
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
Definition: eda_angle.h:408
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:409
@ FIELDS_AUTOPLACED_AUTO
Definition: sch_item.h:57
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:152

References ANGLE_HORIZONTAL, ANGLE_VERTICAL, TEXT_SPIN_STYLE::BOTTOM, FIELDS_AUTOPLACED_AUTO, GetBodyBoundingBox(), SCH_TEXT::GetPenWidth(), BOX2< Vec >::GetSizeMax(), EDA_TEXT::GetTextHeight(), SCH_TEXT::GetTextOffset(), EDA_TEXT::GetTextPos(), SCH_TEXT::GetTextSpinStyle(), GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, TEXT_SPIN_STYLE::LEFT, m_fields, SCH_ITEM::m_fieldsAutoplaced, TEXT_SPIN_STYLE::RIGHT, SCH_GLOBAL_LABEL_T, EDA_ITEM::Type(), TEXT_SPIN_STYLE::UP, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SCH_EDIT_FRAME::AutoRotateItem(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_ALTIUM_PLUGIN::ParsePort(), and Rotate90().

◆ AutoRotateOnPlacement()

bool SCH_LABEL_BASE::AutoRotateOnPlacement ( ) const

autoRotateOnPlacement

Returns
Returns true if the label rotation will be automatically set on the placement

Definition at line 1014 of file sch_label.cpp.

1015{
1017}
bool m_autoRotateOnPlacement
Definition: sch_label.h:215

References m_autoRotateOnPlacement.

Referenced by SCH_DRAWING_TOOLS::createNewText(), and DIALOG_LABEL_PROPERTIES::TransferDataToWindow().

◆ AutoRotateOnPlacementSupported()

virtual bool SCH_LABEL_BASE::AutoRotateOnPlacementSupported ( ) const
pure virtual

AutoRotateOnPlacementSupported.

Returns
true if the automated rotation of the label is supported after the placement At the moment it is supported for global and hierarchial labels

Implemented in SCH_LABEL, SCH_DIRECTIVE_LABEL, SCH_GLOBALLABEL, and SCH_HIERLABEL.

Referenced by DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), and DIALOG_LABEL_PROPERTIES::TransferDataToWindow().

◆ cacheShownText()

void EDA_TEXT::cacheShownText ( )
protectedinherited

Definition at line 408 of file eda_text.cpp.

409{
410 if( m_text.IsEmpty() )
411 {
412 m_shown_text = wxEmptyString;
414 }
415 else
416 {
418 m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
419 }
420
423}
wxString m_text
Definition: eda_text.h:389
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:391
wxString m_shown_text
Definition: eda_text.h:390
bool m_bounding_box_cache_valid
Definition: eda_text.h:400
virtual void ClearRenderCache()
Definition: eda_text.cpp:438
wxString UnescapeString(const wxString &aSource)

References EDA_TEXT::ClearRenderCache(), EDA_TEXT::m_bounding_box_cache_valid, EDA_TEXT::m_shown_text, EDA_TEXT::m_shown_text_has_text_var_refs, EDA_TEXT::m_text, and UnescapeString().

Referenced by EDA_TEXT::EDA_TEXT(), EDA_TEXT::Replace(), and EDA_TEXT::SetText().

◆ CanConnect()

bool SCH_LABEL_BASE::CanConnect ( const SCH_ITEM aItem) const
inlineoverridevirtual

Reimplemented from SCH_ITEM.

Definition at line 48 of file sch_label.h.

49 {
50 switch( aItem->Type() )
51 {
52 case SCH_LINE_T:
53 return aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS;
54
56 return true;
57
58 case SCH_SYMBOL_T:
59 return true;
60
61 case SCH_LABEL_T:
65 case SCH_SHEET_PIN_T:
66 return true;
67
68 default:
69 return false;
70 }
71 }
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:246
@ LAYER_WIRE
Definition: layer_ids.h:344
@ LAYER_BUS
Definition: layer_ids.h:345
@ SCH_LINE_T
Definition: typeinfo.h:146
@ SCH_SYMBOL_T
Definition: typeinfo.h:156
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:154
@ SCH_LABEL_T
Definition: typeinfo.h:151
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:153
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:157
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:144

References SCH_ITEM::GetLayer(), LAYER_BUS, LAYER_WIRE, SCH_BUS_WIRE_ENTRY_T, SCH_DIRECTIVE_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_LINE_T, SCH_SHEET_PIN_T, SCH_SYMBOL_T, and EDA_ITEM::Type().

Referenced by SCH_MOVE_TOOL::getConnectedDragItems().

◆ ClassOf()

static bool SCH_TEXT::ClassOf ( const EDA_ITEM aItem)
inlinestaticinherited

Definition at line 121 of file sch_text.h.

122 {
123 return aItem && SCH_TEXT_T == aItem->Type();
124 }
@ SCH_TEXT_T
Definition: typeinfo.h:150

References SCH_TEXT_T, and EDA_ITEM::Type().

◆ ClearBoundingBoxCache()

void EDA_TEXT::ClearBoundingBoxCache ( )
virtualinherited

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 122 of file eda_item.h.

void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:143
#define BRIGHTENED
item is drawn with a bright contour

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by SCH_EDIT_FRAME::FocusOnItem(), PCB_BASE_FRAME::FocusOnItems(), EE_SELECTION_TOOL::unhighlight(), PL_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearCaches()

void SCH_ITEM::ClearCaches ( )
virtualinherited

Reimplemented in SCH_FIELD.

Definition at line 251 of file sch_item.cpp.

252{
253 auto clearTextCaches =
254 []( SCH_ITEM* aItem )
255 {
256 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
257
258 if( text )
259 {
260 text->ClearBoundingBoxCache();
261 text->ClearRenderCache();
262 }
263 };
264
265 clearTextCaches( this );
266
267 RunOnChildren( clearTextCaches );
268}
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
Definition: sch_item.h:444

References SCH_ITEM::RunOnChildren(), and text.

◆ ClearConnections()

void SCH_ITEM::ClearConnections ( )
inlineinherited

Clears all of the connection items from the list.

The vector release method is used to prevent the item pointers from being deleted. Do not use the vector erase method on the connection list.

Definition at line 372 of file sch_item.h.

372{ m_connections.clear(); }
EDA_ITEMS m_connections
Definition: sch_item.h:492

References SCH_ITEM::m_connections.

◆ ClearEditFlags()

◆ ClearFieldsAutoplaced()

◆ ClearFlags()

void EDA_ITEM::ClearFlags ( EDA_ITEM_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 143 of file eda_item.h.

143{ m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:500

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), FOOTPRINT::BuildCourtyardCaches(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), SYMBOL_EDITOR_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), PCB_TOOL_BASE::doInteractiveItemPlacement(), KIGFX::SCH_PAINTER::draw(), SCH_ITEM::Duplicate(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), DRC_INTERACTIVE_COURTYARD_CLEARANCE::Init(), EE_COLLECTOR::Inspect(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), DIALOG_SYMBOL_PROPERTIES::OnUnitChoice(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::RecombinePad(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), DRC_TEST_PROVIDER_DISALLOW::Run(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetIsShownAsBitmap(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and EE_SELECTION_TOOL::unhighlight().

◆ ClearRenderCache()

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 155 of file eda_item.h.

156 {
158 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define SELECTED_BY_DRAG
Item was algorithmically selected as a dragged item.
#define DO_NOT_DRAW
Used to disable draw function.
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define CANDIDATE
flag indicating that the structure is connected

References CANDIDATE, EDA_ITEM::ClearFlags(), DO_NOT_DRAW, IS_LINKED, SELECTED_BY_DRAG, and SKIP_STRUCT.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles(), and SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 143 of file view_item.h.

144 {
145 m_viewPrivData = nullptr;
146 }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:151

References KIGFX::VIEW_ITEM::m_viewPrivData.

Referenced by KIGFX::VIEW::OnDestroy().

◆ Clone()

EDA_ITEM * SCH_TEXT::Clone ( ) const
inlineoverridevirtualinherited

Create a duplicate of this item with linked list members set to NULL.

The default version will return NULL in release builds and likely crash the program. In debug builds, a warning message indicating the derived class has not implemented cloning. This really should be a pure virtual function. Due to the fact that there are so many objects derived from EDA_ITEM, the decision was made to return NULL until all the objects derived from EDA_ITEM implement cloning. Once that happens, this function should be made pure.

Returns
A clone of the item.

Reimplemented from EDA_ITEM.

Definition at line 211 of file sch_text.h.

212 {
213 return new SCH_TEXT( *this );
214 }

References SCH_TEXT::SCH_TEXT().

◆ Compare()

int EDA_TEXT::Compare ( const EDA_TEXT aOther) const
inherited

Definition at line 911 of file eda_text.cpp.

912{
913#define EPSILON 2 // Should be enough for rounding errors on calculated items
914
915#define TEST( a, b ) { if( a != b ) return a - b; }
916#define TEST_E( a, b ) { if( abs( a - b ) > EPSILON ) return a - b; }
917#define TEST_PT( a, b ) { TEST_E( a.x, b.x ); TEST_E( a.y, b.y ); }
918
919 TEST_PT( m_pos, aOther->m_pos );
920
925
935
936 int val = GetFontName().Cmp( aOther->GetFontName() );
937
938 if( val != 0 )
939 return val;
940
941 return m_text.Cmp( aOther->m_text );
942}
double AsDegrees() const
Definition: eda_angle.h:149
VECTOR2I m_pos
Definition: eda_text.h:407
wxString GetFontName() const
Definition: eda_text.cpp:757
TEXT_ATTRIBUTES m_attributes
Definition: eda_text.h:406
bool m_KeepUpright
If true, keep rotation angle between -90...90 degrees for readability.
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
#define TEST_PT(a, b)
#define TEST(a, b)
#define TEST_E(a, b)

References EDA_ANGLE::AsDegrees(), EDA_TEXT::GetFontName(), TEXT_ATTRIBUTES::m_Angle, EDA_TEXT::m_attributes, TEXT_ATTRIBUTES::m_Bold, TEXT_ATTRIBUTES::m_Halign, TEXT_ATTRIBUTES::m_Italic, TEXT_ATTRIBUTES::m_KeepUpright, TEXT_ATTRIBUTES::m_LineSpacing, TEXT_ATTRIBUTES::m_Mirrored, TEXT_ATTRIBUTES::m_Multiline, EDA_TEXT::m_pos, TEXT_ATTRIBUTES::m_Size, TEXT_ATTRIBUTES::m_StrokeWidth, EDA_TEXT::m_text, TEXT_ATTRIBUTES::m_Underlined, TEXT_ATTRIBUTES::m_Valign, TEXT_ATTRIBUTES::m_Visible, TEST, TEST_E, and TEST_PT.

◆ ConnectedItems()

SCH_ITEM_SET & SCH_ITEM::ConnectedItems ( const SCH_SHEET_PATH aPath)
inherited

Retrieve the set of items connected to this item on the given sheet.

Definition at line 187 of file sch_item.cpp.

188{
189 return m_connected_items[ aSheet ];
190}

References SCH_ITEM::m_connected_items.

Referenced by addConnections(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_LINE::FindWireSegmentNetNameRecursive(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ Connection()

SCH_CONNECTION * SCH_ITEM::Connection ( const SCH_SHEET_PATH aSheet = nullptr) const
inherited

Retrieve the connection associated with this object in the given sheet.

Note
The returned value can be nullptr.

Definition at line 146 of file sch_item.cpp.

147{
148 if( !IsConnectable() )
149 return nullptr;
150
151 wxCHECK_MSG( !IsConnectivityDirty(), nullptr,
152 wxT( "Shouldn't be asking for connection if connectivity is dirty!" ) );
153
154 if( !aSheet )
155 aSheet = &Schematic()->CurrentSheet();
156
157 auto it = m_connection_map.find( *aSheet );
158
159 if( it == m_connection_map.end() )
160 return nullptr;
161 else
162 return it->second;
163}
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:120
virtual bool IsConnectable() const
Definition: sch_item.h:349
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:112
bool IsConnectivityDirty() const
Definition: sch_item.h:413
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
Definition: sch_item.h:501

References SCHEMATIC::CurrentSheet(), SCH_ITEM::IsConnectable(), SCH_ITEM::IsConnectivityDirty(), SCH_ITEM::m_connection_map, and SCH_ITEM::Schematic().

Referenced by CONNECTION_SUBGRAPH::Absorb(), CONNECTION_SUBGRAPH::AddItem(), CONNECTION_GRAPH::buildConnectionGraph(), KIGFX::SCH_PAINTER::draw(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::GetBusesNeedingMigration(), SCH_ITEM::GetEffectiveNetClass(), SCH_BUS_ENTRY_BASE::GetMsgPanelInfo(), GetMsgPanelInfo(), SCH_LINE::GetMsgPanelInfo(), SCH_PIN::GetMsgPanelInfo(), CONNECTION_SUBGRAPH::GetNetName(), SCH_ITEM::GetOrInitConnection(), highlightNet(), SCH_ITEM::InitializeConnection(), Plot(), SCH_LINE::Plot(), SCH_TEXT::Plot(), Print(), NETLIST_EXPORTER_SPICE_MODEL::readPorts(), SCH_EDIT_FRAME::RecalculateConnections(), ResolveTextVar(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), BUS_UNFOLD_MENU::update(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ ConnectionPropagatesTo()

virtual bool SCH_ITEM::ConnectionPropagatesTo ( const EDA_ITEM aItem) const
inlinevirtualinherited

Return true if this item should propagate connection info to aItem.

Reimplemented in SCH_BUS_WIRE_ENTRY, SCH_LINE, and SCH_PIN.

Definition at line 411 of file sch_item.h.

411{ return true; }

◆ CopyText()

◆ CreateGraphicShape()

virtual void SCH_LABEL_BASE::CreateGraphicShape ( const RENDER_SETTINGS aSettings,
std::vector< VECTOR2I > &  aPoints,
const VECTOR2I Pos 
) const
inlinevirtual

Calculate the graphic shape (a polygon) associated to the text.

Parameters
aPointsA buffer to fill with polygon corners coordinates
PosPosition of the shape, for texts and labels: do nothing

Reimplemented in SCH_GLOBALLABEL, SCH_DIRECTIVE_LABEL, SCH_HIERLABEL, and SCH_SHEET_PIN.

Definition at line 149 of file sch_label.h.

151 {
152 aPoints.clear();
153 }

Referenced by GetBodyBoundingBox(), Plot(), and Print().

◆ DoHypertextAction()

void SCH_TEXT::DoHypertextAction ( EDA_DRAW_FRAME aFrame) const
overridevirtualinherited

Reimplemented from SCH_ITEM.

Definition at line 391 of file sch_text.cpp.

392{
393 wxCHECK_MSG( IsHypertext(), /* void */,
394 "Calling a hypertext menu on a SCH_TEXT with no hyperlink?" );
395
397 navTool->HypertextCommand( m_hyperlink );
398}
wxString m_hyperlink
A hyperlink URL.
Definition: eda_text.h:386
Handle actions specific to the schematic editor.
void HypertextCommand(const wxString &href)
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_text.h:133
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54

References TOOL_MANAGER::GetTool(), TOOLS_HOLDER::GetToolManager(), SCH_NAVIGATE_TOOL::HypertextCommand(), SCH_TEXT::IsHypertext(), and EDA_TEXT::m_hyperlink.

◆ doIsConnected()

virtual bool SCH_ITEM::doIsConnected ( const VECTOR2I aPosition) const
inlineprivatevirtualinherited

Provide the object specific test to see if it is connected to aPosition.

Note
Override this function if the derived object can be connect to another object such as a wire, bus, or junction. Do not override this function for objects that cannot have connections. The default will always return false. This functions is call through the public function IsConnected() which performs tests common to all schematic items before calling the item specific connection testing.
Parameters
aPositionis a reference to a VECTOR2I object containing the test position.
Returns
True if connection to aPosition exists.

Reimplemented in SCH_BUS_ENTRY_BASE, SCH_JUNCTION, SCH_LABEL, SCH_GLOBALLABEL, SCH_HIERLABEL, SCH_LINE, SCH_NO_CONNECT, SCH_SHEET, and SCH_SYMBOL.

Definition at line 488 of file sch_item.h.

488{ return false; }

Referenced by SCH_ITEM::IsConnected().

◆ Duplicate()

SCH_ITEM * SCH_ITEM::Duplicate ( bool  doClone = false) const
inherited

Routine to create a new copy of given item.

The new object is not put in draw list (not linked).

Parameters
doClone(default = false) indicates unique values (such as timestamp and sheet name) should be duplicated. Use only for undo/redo operations.

Definition at line 93 of file sch_item.cpp.

94{
95 SCH_ITEM* newItem = (SCH_ITEM*) Clone();
96
97 if( !doClone )
98 const_cast<KIID&>( newItem->m_Uuid ) = KIID();
99
100 newItem->ClearFlags( SELECTED | BRIGHTENED );
101
102 newItem->RunOnChildren(
103 []( SCH_ITEM* aChild )
104 {
105 aChild->ClearFlags( SELECTED | BRIGHTENED );
106 } );
107
108 return newItem;
109}
const KIID m_Uuid
Definition: eda_item.h:494
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:82
Definition: kiid.h:48

References BRIGHTENED, EDA_ITEM::ClearFlags(), EDA_ITEM::Clone(), EDA_ITEM::m_Uuid, SCH_ITEM::RunOnChildren(), and SELECTED.

Referenced by SCH_EDIT_FRAME::BreakSegment(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), CADSTAR_SCH_ARCHIVE_LOADER::loadItemOntoKiCadSheet(), SCH_EAGLE_PLUGIN::loadSchematic(), SCH_DRAWING_TOOLS::PlaceSymbol(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_EDIT_FRAME::SaveCopyInUndoList(), and SCH_LINE_WIRE_BUS_TOOL::startSegments().

◆ Empty()

void EDA_TEXT::Empty ( )
inherited

◆ Format()

void EDA_TEXT::Format ( OUTPUTFORMATTER aFormatter,
int  aNestLevel,
int  aControlBits 
) const
virtualinherited

Output the object to aFormatter in s-expression form.

Parameters
aFormatterThe OUTPUTFORMATTER object to write to.
aNestLevelThe indentation next level.
aControlBitsThe control bit definition for object specific formatting.
Exceptions
IO_ERRORon write error.

Definition at line 781 of file eda_text.cpp.

782{
783 aFormatter->Print( aNestLevel + 1, "(effects" );
784
785 aFormatter->Print( 0, " (font" );
786
787 if( GetFont() && !GetFont()->GetName().IsEmpty() )
788 aFormatter->Print( 0, " (face \"%s\")", GetFont()->NameAsToken() );
789
790 // Text size
791 aFormatter->Print( 0, " (size %s %s)",
794
795 if( GetLineSpacing() != 1.0 )
796 {
797 aFormatter->Print( 0, " (line_spacing %s)",
798 FormatDouble2Str( GetLineSpacing() ).c_str() );
799 }
800
801 if( GetTextThickness() )
802 {
803 aFormatter->Print( 0, " (thickness %s)",
805 }
806
807 if( IsBold() )
808 aFormatter->Print( 0, " bold" );
809
810 if( IsItalic() )
811 aFormatter->Print( 0, " italic" );
812
813 if( GetTextColor() != COLOR4D::UNSPECIFIED )
814 {
815 aFormatter->Print( 0, " (color %d %d %d %s)",
816 KiROUND( GetTextColor().r * 255.0 ),
817 KiROUND( GetTextColor().g * 255.0 ),
818 KiROUND( GetTextColor().b * 255.0 ),
819 FormatDouble2Str( GetTextColor().a ).c_str() );
820 }
821
822 aFormatter->Print( 0, ")"); // (font
823
826 {
827 aFormatter->Print( 0, " (justify");
828
830 aFormatter->Print( 0, GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT ? " left" : " right" );
831
833 aFormatter->Print( 0, GetVertJustify() == GR_TEXT_V_ALIGN_TOP ? " top" : " bottom" );
834
835 if( IsMirrored() )
836 aFormatter->Print( 0, " mirror" );
837
838 aFormatter->Print( 0, ")" ); // (justify
839 }
840
841 if( !( aControlBits & CTL_OMIT_HIDE ) && !IsVisible() )
842 aFormatter->Print( 0, " hide" );
843
844 if( HasHyperlink() )
845 {
846 aFormatter->Print( 0, " (href %s)", aFormatter->Quotew( GetHyperlink() ).c_str() );
847 }
848
849 aFormatter->Print( 0, ")\n" ); // (effects
850}
COLOR4D GetTextColor() const
Definition: eda_text.h:205
bool IsItalic() const
Definition: eda_text.h:130
virtual bool IsVisible() const
Definition: eda_text.h:136
KIFONT::FONT * GetFont() const
Definition: eda_text.h:188
int GetTextWidth() const
Definition: eda_text.h:199
virtual bool HasHyperlink() const
Definition: eda_text.h:333
wxString GetHyperlink() const
Definition: eda_text.h:334
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:149
std::reference_wrapper< const EDA_IU_SCALE > m_IuScale
Definition: eda_text.h:393
double GetLineSpacing() const
Definition: eda_text.h:193
bool IsMirrored() const
Definition: eda_text.h:139
bool IsBold() const
Definition: eda_text.h:133
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:152
int GetTextThickness() const
Definition: eda_text.h:112
std::string Quotew(const wxString &aWrapee) const
Definition: richio.cpp:499
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:431
#define CTL_OMIT_HIDE
Definition: eda_text.h:53
E_SERIE r
Definition: eserie.cpp:41
std::string FormatInternalUnits(const EDA_IU_SCALE &aIuScale, int aValue)
Converts aValue from internal units to a string appropriate for writing to file.
Definition: eda_units.cpp:139
std::string FormatDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 This function is intended in...
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85

References CTL_OMIT_HIDE, FormatDouble2Str(), EDA_UNIT_UTILS::FormatInternalUnits(), EDA_TEXT::GetFont(), EDA_TEXT::GetHorizJustify(), EDA_TEXT::GetHyperlink(), EDA_TEXT::GetLineSpacing(), EDA_TEXT::GetTextColor(), EDA_TEXT::GetTextHeight(), EDA_TEXT::GetTextThickness(), EDA_TEXT::GetTextWidth(), EDA_TEXT::GetVertJustify(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, EDA_TEXT::HasHyperlink(), EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), EDA_TEXT::IsMirrored(), EDA_TEXT::IsVisible(), KiROUND(), EDA_TEXT::m_IuScale, OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), and r.

Referenced by SCH_SEXPR_PLUGIN_CACHE::saveField(), and SCH_SEXPR_PLUGIN::saveField().

◆ Get() [1/3]

template<typename T >
std::optional< T > INSPECTABLE::Get ( const wxString &  aProperty) const
inlineinherited

Definition at line 104 of file inspectable.h.

105 {
107 TYPE_ID thisType = TYPE_HASH( *this );
108 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
109 std::optional<T> ret;
110
111 if( prop )
112 {
113 const void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114
115 if( object )
116 ret = prop->get<T>( object );
117 }
118
119 return ret;
120 }
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.
T get(const void *aObject) const
Definition: property.h:294
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:67
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:69
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
#define TYPE_HASH(x)
Definition: property.h:61
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:44

References PROPERTY_BASE::get(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Get() [2/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 84 of file inspectable.h.

85 {
87 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
88 return object ? aProperty->getter( object ) : wxAny();
89 }
virtual wxAny getter(const void *aObject) const =0

References PROPERTY_BASE::getter(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by BOOST_AUTO_TEST_CASE(), CLASS_D_DESC::CLASS_D_DESC(), EDA_SHAPE_DESC::EDA_SHAPE_DESC(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [3/3]

template<typename T >
T INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 92 of file inspectable.h.

93 {
95 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
96
97 if( !object )
98 throw std::runtime_error( "Could not cast INSPECTABLE to the requested type" );
99
100 return aProperty->get<T>( object );
101 }

References PROPERTY_BASE::get(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ GetAttributes()

◆ GetBodyBoundingBox()

const BOX2I SCH_LABEL_BASE::GetBodyBoundingBox ( ) const
virtual

Return the bounding box of the label only, without taking in account its fields.

Reimplemented in SCH_LABEL, and SCH_HIERLABEL.

Definition at line 682 of file sch_label.cpp.

683{
684 // build the bounding box of the label only, without taking into account its fields
685
686 BOX2I box;
687 std::vector<VECTOR2I> pts;
688
689 CreateGraphicShape( nullptr, pts, GetTextPos() );
690
691 for( const VECTOR2I& pt : pts )
692 box.Merge( pt );
693
695 box.Normalize();
696 return box;
697}
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:119
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:588
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition: eda_text.cpp:297
virtual void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &Pos) const
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.h:149

References CreateGraphicShape(), EDA_TEXT::GetEffectiveTextPenWidth(), EDA_TEXT::GetTextPos(), BOX2< Vec >::Inflate(), BOX2< Vec >::Merge(), and BOX2< Vec >::Normalize().

Referenced by AutoplaceFields(), GetBoundingBox(), HitTest(), and Plot().

◆ GetBoundingBox()

const BOX2I SCH_LABEL_BASE::GetBoundingBox ( ) const
overridevirtual

Return the bounding box of the label including its fields.

Reimplemented from EDA_ITEM.

Definition at line 700 of file sch_label.cpp.

701{
702 // build the bounding box of the entire label, including its fields
703
705
706 for( const SCH_FIELD& field : m_fields )
707 {
708 if( field.IsVisible() )
709 {
710 BOX2I fieldBBox = field.GetBoundingBox();
711
712 if( Type() == SCH_LABEL_T || Type() == SCH_GLOBAL_LABEL_T )
713 fieldBBox.Offset( GetSchematicTextOffset( nullptr ) );
714
715 box.Merge( fieldBBox );
716 }
717 }
718
719 box.Normalize();
720
721 return box;
722}
void Offset(coord_type dx, coord_type dy)
Definition: box2.h:224
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_label.cpp:274

References GetBodyBoundingBox(), GetSchematicTextOffset(), m_fields, BOX2< Vec >::Merge(), BOX2< Vec >::Normalize(), BOX2< Vec >::Offset(), SCH_GLOBAL_LABEL_T, SCH_LABEL_T, and EDA_ITEM::Type().

Referenced by HitTest(), and SCH_SHEET_PIN::HitTest().

◆ GetClass()

virtual wxString SCH_LABEL_BASE::GetClass ( ) const
overridepure virtual

Return the class name.

Reimplemented from SCH_TEXT.

Implemented in SCH_LABEL, SCH_DIRECTIVE_LABEL, SCH_GLOBALLABEL, SCH_HIERLABEL, and SCH_SHEET_PIN.

Referenced by DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES().

◆ GetConnectionPoints()

std::vector< VECTOR2I > SCH_LABEL_BASE::GetConnectionPoints ( ) const
overridevirtual

Add all the connection points for this item to aPoints.

Not all schematic items have connection points so the default method does nothing.

Parameters
aPointsis the list of connection points to add to.

Reimplemented from SCH_ITEM.

Definition at line 650 of file sch_label.cpp.

651{
652 return { GetTextPos() };
653}

References EDA_TEXT::GetTextPos().

◆ GetDefaultFieldName()

const wxString SCH_LABEL_BASE::GetDefaultFieldName ( const wxString &  aName,
bool  aUseDefaultName 
)
static

Definition at line 183 of file sch_label.cpp.

184{
185 if( aName == wxT( "Intersheetrefs" ) )
186 return _( "Sheet References" );
187 else if( aName == wxT( "Netclass" ) )
188 return _( "Net Class" );
189 else if( aName.IsEmpty() && aUseDefaultName )
190 return _( "Field" );
191 else
192 return aName;
193}
#define _(s)

References _.

Referenced by SCH_FIELD::GetName(), FIELDS_GRID_TABLE< T >::GetValue(), and DIALOG_LABEL_PROPERTIES::OnAddField().

◆ GetDefaultFont()

const wxString & SCH_ITEM::GetDefaultFont ( ) const
inherited

Definition at line 286 of file sch_item.cpp.

287{
288 EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
289
290 return cfg->m_Appearance.default_font;
291}
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References EESCHEMA_SETTINGS::APPEARANCE::default_font, EESCHEMA_SETTINGS::m_Appearance, and Pgm().

Referenced by SCH_FIELD::getDrawFont(), SCH_TEXT::getDrawFont(), SCH_TEXTBOX::getDrawFont(), SCH_FIELD::GetRenderCache(), and SCH_TEXTBOX::GetShownText().

◆ getDrawFont()

KIFONT::FONT * SCH_TEXT::getDrawFont ( ) const
overrideprotectedvirtualinherited

Reimplemented from EDA_TEXT.

Definition at line 279 of file sch_text.cpp.

280{
282
283 if( !font )
285
286 return font;
287}
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:105
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false)
Definition: font.cpp:65
const wxString & GetDefaultFont() const
Definition: sch_item.cpp:286

References SCH_ITEM::GetDefaultFont(), EDA_TEXT::GetFont(), KIFONT::FONT::GetFont(), EDA_TEXT::IsBold(), and EDA_TEXT::IsItalic().

◆ GetDrawPos()

◆ GetDrawRotation()

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 147 of file eda_item.h.

148 {
149 constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
151
152 return m_flags & mask;
153 }
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_CHANGED
Item was edited, and modified.
#define IS_NEW
New item, just created.
#define IS_DRAGGING
Item being dragged.
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_MOVING
Item being moved.
#define IS_RESIZING
Item being resized.

References IS_CHANGED, IS_DRAGGING, IS_MOVING, IS_NEW, IS_PASTED, IS_RESIZING, IS_WIRE_IMAGE, EDA_ITEM::m_flags, and STRUCT_DELETED.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_SYMBOL::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_IMAGE_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveNetClass()

std::shared_ptr< NETCLASS > SCH_ITEM::GetEffectiveNetClass ( const SCH_SHEET_PATH aSheet = nullptr) const
inherited

Definition at line 166 of file sch_item.cpp.

167{
168 static std::shared_ptr<NETCLASS> nullNetclass = std::make_shared<NETCLASS>( wxEmptyString );
169
170 SCHEMATIC* schematic = Schematic();
171
172 if( schematic )
173 {
174 std::shared_ptr<NET_SETTINGS>& netSettings = schematic->Prj().GetProjectFile().m_NetSettings;
175 SCH_CONNECTION* connection = Connection( aSheet );
176
177 if( connection )
178 return netSettings->GetEffectiveNetClass( connection->Name() );
179 else
180 return netSettings->m_DefaultNetClass;
181 }
182
183 return nullNetclass;
184}
std::shared_ptr< NET_SETTINGS > m_NetSettings
Net settings for this project (owned here)
Definition: project_file.h:168
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:148
Holds all the data relating to one schematic.
Definition: schematic.h:61
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:76
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
wxString Name(bool aIgnoreSheet=false) const
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition: sch_item.cpp:146

References SCH_ITEM::Connection(), PROJECT::GetProjectFile(), PROJECT_FILE::m_NetSettings, SCH_CONNECTION::Name(), SCHEMATIC::Prj(), and SCH_ITEM::Schematic().

Referenced by SCH_BUS_ENTRY_BASE::GetBusEntryColor(), SCH_LINE::GetEffectiveLineStyle(), SCH_JUNCTION::getEffectiveShape(), SCH_FIELD::GetFieldColor(), SCH_JUNCTION::GetJunctionColor(), GetLabelColor(), SCH_LINE::GetLineColor(), SCH_BUS_ENTRY_BASE::GetLineStyle(), SCH_BUS_ENTRY_BASE::GetMsgPanelInfo(), GetMsgPanelInfo(), SCH_LINE::GetMsgPanelInfo(), SCH_BUS_WIRE_ENTRY::GetPenWidth(), SCH_BUS_BUS_ENTRY::GetPenWidth(), SCH_LINE::GetPenWidth(), Plot(), SCH_LINE::Plot(), and ResolveTextVar().

◆ GetEffectiveTextPenWidth()

int EDA_TEXT::GetEffectiveTextPenWidth ( int  aDefaultPenWidth = 0) const
inherited

The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.

Definition at line 297 of file eda_text.cpp.

298{
299 int penWidth = GetTextThickness();
300
301 if( penWidth <= 1 )
302 {
303 penWidth = aDefaultPenWidth;
304
305 if( IsBold() )
306 penWidth = GetPenSizeForBold( GetTextWidth() );
307 else if( penWidth <= 1 )
308 penWidth = GetPenSizeForNormal( GetTextWidth() );
309 }
310
311 // Clip pen size for small texts:
312 penWidth = Clamp_Text_PenSize( penWidth, GetTextSize() );
313
314 return penWidth;
315}
VECTOR2I GetTextSize() const
Definition: eda_text.h:196
int GetPenSizeForBold(int aTextSize)
Definition: gr_text.cpp:40
int GetPenSizeForNormal(int aTextSize)
Definition: gr_text.cpp:52
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
Definition: gr_text.cpp:75

References Clamp_Text_PenSize(), GetPenSizeForBold(), GetPenSizeForNormal(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetTextThickness(), EDA_TEXT::GetTextWidth(), and EDA_TEXT::IsBold().

Referenced by BOARD_ADAPTER::addText(), KIGFX::DS_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), GetBodyBoundingBox(), SCH_LABEL::GetBodyBoundingBox(), SCH_HIERLABEL::GetBodyBoundingBox(), EDA_TEXT::GetEffectiveTextShape(), LIB_FIELD::GetPenWidth(), LIB_TEXT::GetPenWidth(), SCH_FIELD::GetPenWidth(), SCH_DIRECTIVE_LABEL::GetPenWidth(), SCH_TEXT::GetPenWidth(), EDA_TEXT::GetTextBox(), SCH_FIELD::Plot(), Plot(), SCH_TEXT::Plot(), SCH_TEXTBOX::Plot(), LIB_TEXT::Plot(), LIB_TEXTBOX::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), SCH_FIELD::Print(), LIB_TEXT::print(), LIB_TEXTBOX::print(), EDA_TEXT::printOneLineOfText(), FP_TEXT::TransformTextToPolySet(), FP_TEXTBOX::TransformTextToPolySet(), PCB_TEXT::TransformTextToPolySet(), PCB_TEXTBOX::TransformTextToPolySet(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_RADIAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), PCB_DIM_ALIGNED::updateText(), and PCB_DIM_ORTHOGONAL::updateText().

◆ GetEffectiveTextShape()

std::shared_ptr< SHAPE_COMPOUND > EDA_TEXT::GetEffectiveTextShape ( bool  aTriangulate = true,
bool  aUseTextRotation = true 
) const
inherited

build a list of segments (SHAPE_SEGMENT) to describe a text shape.

Parameters
aTriangulatetrue to build also the triangulation of each shape
aUseTextRotationtrue to use the actual text draw rotation. false to build a list of shape for a not rotated text ("native" shapes).

Definition at line 853 of file eda_text.cpp.

855{
856 std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
858 KIFONT::FONT* font = getDrawFont();
859 int penWidth = GetEffectiveTextPenWidth();
861
862 if( aUseTextRotation )
863 attrs.m_Angle = GetDrawRotation();
864 else
865 attrs.m_Angle = ANGLE_0;
866
867 if( aTriangulate )
868 {
869 CALLBACK_GAL callback_gal(
870 empty_opts,
871 // Stroke callback
872 [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
873 {
874 shape->AddShape( new SHAPE_SEGMENT( aPt1, aPt2, penWidth ) );
875 },
876 // Triangulation callback
877 [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
878 {
879 SHAPE_SIMPLE* triShape = new SHAPE_SIMPLE;
880
881 for( const VECTOR2I& point : { aPt1, aPt2, aPt3 } )
882 triShape->Append( point.x, point.y );
883
884 shape->AddShape( triShape );
885 } );
886
887 font->Draw( &callback_gal, GetShownText(), GetDrawPos(), attrs );
888 }
889 else
890 {
891 CALLBACK_GAL callback_gal(
892 empty_opts,
893 // Stroke callback
894 [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
895 {
896 shape->AddShape( new SHAPE_SEGMENT( aPt1, aPt2, penWidth ) );
897 },
898 // Outline callback
899 [&]( const SHAPE_LINE_CHAIN& aPoly )
900 {
901 shape->AddShape( aPoly.Clone() );
902 } );
903
904 font->Draw( &callback_gal, GetShownText(), GetDrawPos(), attrs );
905 }
906
907 return shape;
908}
virtual EDA_ANGLE GetDrawRotation() const
Definition: eda_text.h:317
virtual VECTOR2I GetDrawPos() const
Definition: eda_text.h:318
virtual KIFONT::FONT * getDrawFont() const
Definition: eda_text.cpp:426
const TEXT_ATTRIBUTES & GetAttributes() const
Definition: eda_text.h:172
virtual wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:98
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttrs) const
Draw a string.
Definition: font.cpp:159
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
Definition: shape_simple.h:42
void Append(int aX, int aY)
Append a new point at the end of the polygon.
Definition: shape_simple.h:135
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:412

References ANGLE_0, SHAPE_SIMPLE::Append(), KIFONT::FONT::Draw(), EDA_TEXT::GetAttributes(), EDA_TEXT::getDrawFont(), EDA_TEXT::GetDrawPos(), EDA_TEXT::GetDrawRotation(), EDA_TEXT::GetEffectiveTextPenWidth(), EDA_TEXT::GetShownText(), and TEXT_ATTRIBUTES::m_Angle.

Referenced by FP_TEXT::GetEffectiveShape(), FP_TEXTBOX::GetEffectiveShape(), PCB_TEXT::GetEffectiveShape(), PCB_TEXTBOX::GetEffectiveShape(), PCB_SELECTION_TOOL::hitTestDistance(), PNS_KICAD_IFACE_BASE::syncTextItem(), and EDA_TEXT::TransformBoundingBoxToPolygon().

◆ GetEndPoints()

void SCH_LABEL_BASE::GetEndPoints ( std::vector< DANGLING_END_ITEM > &  aItemList)
overridevirtual

Add the schematic item end points to aItemList if the item has end points.

The default version doesn't do anything since many of the schematic object cannot be tested for dangling ends. If you add a new schematic item that can have a dangling end ( no connect ), override this method to provide the correct end points.

Parameters
aItemListis the list of DANGLING_END_ITEMS to add to.

Reimplemented from SCH_ITEM.

Reimplemented in SCH_SHEET_PIN.

Definition at line 643 of file sch_label.cpp.

644{
645 DANGLING_END_ITEM item( LABEL_END, this, GetTextPos() );
646 aItemList.push_back( item );
647}
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition: sch_item.h:82
@ LABEL_END
Definition: sch_item.h:69

References EDA_TEXT::GetTextPos(), and LABEL_END.

◆ GetFields() [1/2]

◆ GetFields() [2/2]

const std::vector< SCH_FIELD > & SCH_LABEL_BASE::GetFields ( ) const
inline

Definition at line 91 of file sch_label.h.

91{ return m_fields; }

References m_fields.

◆ GetFieldsAutoplaced()

FIELDS_AUTOPLACED SCH_ITEM::GetFieldsAutoplaced ( ) const
inlineinherited

Return whether the fields have been automatically placed.

Definition at line 424 of file sch_item.h.

424{ return m_fieldsAutoplaced; }

References SCH_ITEM::m_fieldsAutoplaced.

Referenced by SCH_ITEM::AutoAutoplaceFields(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveText(), and EE_POINT_EDITOR::updateParentItem().

◆ GetFlags()

◆ GetFocusPosition()

virtual const VECTOR2I EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in BOARD, PCB_SHAPE, and PCB_TRACK.

Definition at line 258 of file eda_item.h.

258{ return GetPosition(); }
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:251

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetFont()

KIFONT::FONT * EDA_TEXT::GetFont ( ) const
inlineinherited

Definition at line 188 of file eda_text.h.

188{ return m_attributes.m_Font; }
KIFONT::FONT * m_Font

References EDA_TEXT::m_attributes, and TEXT_ATTRIBUTES::m_Font.

Referenced by BOARD_ADAPTER::addText(), SCH_EDIT_TOOL::ChangeTextType(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), KIGFX::DS_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), PCB_PLUGIN::format(), EDA_TEXT::Format(), PCB_PLUGIN::formatRenderCache(), EDA_TEXT::getDrawFont(), LIB_FIELD::getDrawFont(), LIB_TEXT::getDrawFont(), LIB_TEXTBOX::getDrawFont(), SCH_FIELD::getDrawFont(), SCH_TEXT::getDrawFont(), SCH_TEXTBOX::getDrawFont(), EDA_TEXT::GetFontName(), LIB_FIELD::GetMsgPanelInfo(), LIB_TEXT::GetMsgPanelInfo(), LIB_TEXTBOX::GetMsgPanelInfo(), SCH_FIELD::GetMsgPanelInfo(), GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_TEXTBOX::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), FP_TEXTBOX::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_TEXT::GetMsgPanelInfo(), PCB_TEXTBOX::GetMsgPanelInfo(), SCH_FIELD::GetRenderCache(), LIB_TEXTBOX::GetShownText(), SCH_TEXTBOX::GetShownText(), SCH_FIELD::Plot(), Plot(), SCH_TEXT::Plot(), SCH_TEXTBOX::Plot(), LIB_FIELD::Plot(), LIB_TEXT::Plot(), LIB_TEXTBOX::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), SCH_FIELD::Print(), LIB_FIELD::print(), LIB_TEXT::print(), LIB_TEXTBOX::print(), SCH_TEXT::Print(), EDA_TEXT::printOneLineOfText(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow().

◆ GetFontName()

wxString EDA_TEXT::GetFontName ( ) const
inherited

Definition at line 757 of file eda_text.cpp.

758{
759 if( GetFont() )
760 return GetFont()->GetName();
761 else
762 return wxEmptyString;
763}
const wxString & GetName() const
Definition: font.h:121

References EDA_TEXT::GetFont(), and KIFONT::FONT::GetName().

Referenced by KI_TEST::CheckFpText(), EDA_TEXT::Compare(), EDA_TEXT::IsDefaultFormatting(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem().

◆ GetFriendlyName()

wxString EDA_ITEM::GetFriendlyName ( ) const
virtualinherited

Reimplemented in PCB_SHAPE, and ZONE.

Definition at line 310 of file eda_item.cpp.

311{
312 return GetTypeDesc();
313}
wxString GetTypeDesc() const
Return a translated description of the type for this EDA_ITEM for display in user facing messages.
Definition: eda_item.cpp:301

References EDA_ITEM::GetTypeDesc().

Referenced by PROPERTIES_PANEL::update().

◆ GetHorizJustify()

GR_TEXT_H_ALIGN_T EDA_TEXT::GetHorizJustify ( ) const
inlineinherited

Definition at line 149 of file eda_text.h.

149{ return m_attributes.m_Halign; };

References EDA_TEXT::m_attributes, and TEXT_ATTRIBUTES::m_Halign.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), KI_TEST::CheckFpText(), LIB_TEXTBOX::compare(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), EDA_TEXT_DESC::EDA_TEXT_DESC(), AUTOPLACER::fieldHPlacement(), EDA_TEXT::Format(), LIB_TEXTBOX::GetDrawPos(), SCH_TEXTBOX::GetDrawPos(), FP_TEXTBOX::GetDrawPos(), PCB_TEXTBOX::GetDrawPos(), SCH_FIELD::GetEffectiveHorizJustify(), LIB_FIELD::GetMsgPanelInfo(), LIB_TEXT::GetMsgPanelInfo(), SCH_FIELD::GetMsgPanelInfo(), EDA_TEXT::GetTextBox(), hash_fp_item(), EDA_TEXT::IsDefaultFormatting(), SCH_FIELD::IsHorizJustifyFlipped(), FP_TEXT::KeepUpright(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EDIT_TOOL::Mirror(), FP_TEXT::Mirror(), PCB_TEXT::Mirror(), LIB_TEXT::MirrorHorizontal(), LIB_TEXTBOX::MirrorHorizontally(), SCH_TEXTBOX::MirrorHorizontally(), LIB_TEXT::MirrorVertical(), LIB_TEXTBOX::MirrorVertically(), SCH_TEXTBOX::MirrorVertically(), LIB_TEXT::NormalizeJustification(), SCH_FIELD::Plot(), Plot(), SCH_TEXT::Plot(), SCH_TEXTBOX::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), positioningChanged(), LIB_FIELD::print(), EDA_TEXT::printOneLineOfText(), processTextItem(), LIB_TEXT::Rotate(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), textsNeedUpdate(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow().

◆ GetHyperlink()

wxString EDA_TEXT::GetHyperlink ( ) const
inlineinherited

◆ GetInterline()

int EDA_TEXT::GetInterline ( ) const
inherited

Return the distance between two lines of text.

Calculates the distance (pitch) between two lines of text. This distance includes the interline distance plus room for characters like j, {, and [. It also used for single line text, to calculate the text bounding box.

Definition at line 497 of file eda_text.cpp.

498{
500}
int GetInterline() const
Return the distance between two lines of text.
Definition: eda_text.cpp:497

References EDA_TEXT::getDrawFont(), EDA_TEXT::GetInterline(), EDA_TEXT::GetTextHeight(), and KiROUND().

Referenced by CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), EDA_TEXT::GetInterline(), and EDA_TEXT::GetLinePositions().

◆ GetIntersheetRefs()

void SCH_LABEL_BASE::GetIntersheetRefs ( std::vector< std::pair< wxString, wxString > > *  pages)

Builds an array of { pageNumber, pageName } pairs.

Parameters
pages[out] Array of { pageNumber, pageName } pairs.

Definition at line 447 of file sch_label.cpp.

448{
449 wxCHECK( pages, /* void */ );
450
451 if( Schematic() )
452 {
453 auto it = Schematic()->GetPageRefsMap().find( GetText() );
454
455 if( it != Schematic()->GetPageRefsMap().end() )
456 {
457 std::vector<int> pageListCopy;
458
459 pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
460
461 if( !Schematic()->Settings().m_IntersheetRefsListOwnPage )
462 {
463 int currentPage = Schematic()->CurrentSheet().GetVirtualPageNumber();
464 alg::delete_matching( pageListCopy, currentPage );
465
466 if( pageListCopy.empty() )
467 return;
468 }
469
470 std::sort( pageListCopy.begin(), pageListCopy.end() );
471
472 std::map<int, wxString> sheetPages = Schematic()->GetVirtualPageToSheetPagesMap();
473 std::map<int, wxString> sheetNames = Schematic()->GetVirtualPageToSheetNamesMap();
474
475 for( int pageNum : pageListCopy )
476 pages->push_back( { sheetPages[ pageNum ], sheetNames[ pageNum ] } );
477 }
478 }
479}
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
std::map< wxString, std::set< int > > & GetPageRefsMap()
Definition: schematic.h:161
std::map< int, wxString > GetVirtualPageToSheetPagesMap() const
Definition: schematic.cpp:308
std::map< int, wxString > GetVirtualPageToSheetNamesMap() const
Definition: schematic.cpp:292
int GetVirtualPageNumber() const
void delete_matching(_Container &__c, _Value __value)
Covers for the horrifically named std::remove and std::remove_if (neither of which remove anything).
Definition: kicad_algo.h:164

References SCHEMATIC::CurrentSheet(), alg::delete_matching(), SCHEMATIC::GetPageRefsMap(), EDA_TEXT::GetText(), SCH_SHEET_PATH::GetVirtualPageNumber(), SCHEMATIC::GetVirtualPageToSheetNamesMap(), SCHEMATIC::GetVirtualPageToSheetPagesMap(), and SCH_ITEM::Schematic().

Referenced by SCH_FIELD::DoHypertextAction(), and SCH_FIELD::Plot().

◆ GetLabelBoxExpansion()

int SCH_LABEL_BASE::GetLabelBoxExpansion ( const RENDER_SETTINGS aSettings = nullptr) const

Definition at line 667 of file sch_label.cpp.

668{
669 double ratio;
670
671 if( aSettings )
672 ratio = static_cast<const SCH_RENDER_SETTINGS*>( aSettings )->m_LabelSizeRatio;
673 else if( Schematic() )
675 else
676 ratio = DEFAULT_LABEL_SIZE_RATIO; // For previews (such as in Preferences), etc.
677
678 return KiROUND( ratio * GetTextSize().y );
679}
Store schematic specific render settings.
Definition: sch_painter.h:71
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:172
#define DEFAULT_LABEL_SIZE_RATIO
The offset of the pin name string from the end of the pin in mils.

References DEFAULT_LABEL_SIZE_RATIO, EDA_TEXT::GetTextSize(), KiROUND(), SCHEMATIC_SETTINGS::m_LabelSizeRatio, SCH_ITEM::Schematic(), and SCHEMATIC::Settings().

Referenced by SCH_GLOBALLABEL::CreateGraphicShape(), and SCH_GLOBALLABEL::GetSchematicTextOffset().

◆ GetLabelColor()

COLOR4D SCH_LABEL_BASE::GetLabelColor ( ) const

Definition at line 263 of file sch_label.cpp.

264{
265 if( GetTextColor() != COLOR4D::UNSPECIFIED )
267 else if( !IsConnectivityDirty() )
268 m_lastResolvedColor = GetEffectiveNetClass()->GetSchematicColor();
269
270 return m_lastResolvedColor;
271}
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition: sch_item.cpp:166

References SCH_ITEM::GetEffectiveNetClass(), EDA_TEXT::GetTextColor(), SCH_ITEM::IsConnectivityDirty(), and m_lastResolvedColor.

◆ GetLayer()

◆ GetLinePositions()

void EDA_TEXT::GetLinePositions ( std::vector< VECTOR2I > &  aPositions,
int  aLineCount 
) const
inherited

Populate aPositions with the position of each line of a multiline text, according to the vertical justification and the rotation of the whole text.

Parameters
aPositionsis the list to populate by the VECTOR2I positions.
aLineCountis the number of lines (not recalculated here for efficiency reasons.

Definition at line 671 of file eda_text.cpp.

672{
673 VECTOR2I pos = GetDrawPos(); // Position of first line of the multiline text according
674 // to the center of the multiline text block
675
676 VECTOR2I offset; // Offset to next line.
677
678 offset.y = GetInterline();
679
680 if( aLineCount > 1 )
681 {
682 switch( GetVertJustify() )
683 {
685 break;
686
688 pos.y -= ( aLineCount - 1 ) * offset.y / 2;
689 break;
690
692 pos.y -= ( aLineCount - 1 ) * offset.y;
693 break;
694 }
695 }
696
697 // Rotate the position of the first line around the center of the multiline text block
699
700 // Rotate the offset lines to increase happened in the right direction
701 RotatePoint( offset, GetDrawRotation() );
702
703 for( int ii = 0; ii < aLineCount; ii++ )
704 {
705 aPositions.push_back( (VECTOR2I) pos );
706 pos += offset;
707 }
708}
@ GR_TEXT_V_ALIGN_BOTTOM
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183

References EDA_TEXT::GetDrawPos(), EDA_TEXT::GetDrawRotation(), EDA_TEXT::GetInterline(), EDA_TEXT::GetVertJustify(), GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, RotatePoint(), and VECTOR2< T >::y.

Referenced by SCH_TEXT::Plot(), SCH_TEXTBOX::Plot(), BRDITEMS_PLOTTER::PlotPcbText(), and EDA_TEXT::Print().

◆ GetLineSpacing()

double EDA_TEXT::GetLineSpacing ( ) const
inlineinherited

Definition at line 193 of file eda_text.h.

193{ return m_attributes.m_LineSpacing; }

References EDA_TEXT::m_attributes, and TEXT_ATTRIBUTES::m_LineSpacing.

Referenced by KI_TEST::CheckFpText(), and EDA_TEXT::Format().

◆ GetMandatoryFieldCount()

virtual int SCH_LABEL_BASE::GetMandatoryFieldCount ( )
inlinevirtual

◆ GetMenuImage()

BITMAPS SCH_TEXT::GetMenuImage ( ) const
overridevirtualinherited

Return a pointer to an image to be used in menus.

The default version returns the right arrow image. Override this function to provide object specific menu images.

Returns
The menu image associated with the item.

Reimplemented from EDA_ITEM.

Definition at line 407 of file sch_text.cpp.

408{
409 return BITMAPS::text;
410}

References text.

◆ GetMsgPanelInfo()

void SCH_LABEL_BASE::GetMsgPanelInfo ( EDA_DRAW_FRAME aFrame,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 861 of file sch_label.cpp.

862{
863 wxString msg;
864
865 switch( Type() )
866 {
867 case SCH_LABEL_T: msg = _( "Label" ); break;
868 case SCH_DIRECTIVE_LABEL_T: msg = _( "Directive Label" ); break;
869 case SCH_GLOBAL_LABEL_T: msg = _( "Global Label" ); break;
870 case SCH_HIER_LABEL_T: msg = _( "Hierarchical Label" ); break;
871 case SCH_SHEET_PIN_T: msg = _( "Hierarchical Sheet Pin" ); break;
872 default: return;
873 }
874
875 // Don't use GetShownText() here; we want to show the user the variable references
876 aList.emplace_back( msg, UnescapeString( GetText() ) );
877
878 // Display electrical type if it is relevant
880 aList.emplace_back( _( "Type" ), getElectricalTypeLabel( GetShape() ) );
881
882 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
883
884 wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
885 int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
886 aList.emplace_back( _( "Style" ), textStyle[style] );
887
888 aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
889
890 switch( GetTextSpinStyle() )
891 {
892 case TEXT_SPIN_STYLE::LEFT: msg = _( "Align right" ); break;
893 case TEXT_SPIN_STYLE::UP: msg = _( "Align bottom" ); break;
894 case TEXT_SPIN_STYLE::RIGHT: msg = _( "Align left" ); break;
895 case TEXT_SPIN_STYLE::BOTTOM: msg = _( "Align top" ); break;
896 default: msg = wxT( "???" ); break;
897 }
898
899 aList.emplace_back( _( "Justification" ), msg );
900
901 SCH_CONNECTION* conn = nullptr;
902
903 if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
904 conn = Connection();
905
906 if( conn )
907 {
908 conn->AppendInfoToMsgPanel( aList );
909
910 if( !conn->IsBus() )
911 {
912 aList.emplace_back( _( "Resolved Netclass" ),
913 UnescapeString( GetEffectiveNetClass()->GetName() ) );
914 }
915 }
916}
bool IsBus() const
void AppendInfoToMsgPanel(std::vector< MSG_PANEL_ITEM > &aList) const
Adds information about the connection object to aList.
Schematic editor (Eeschema) main window.
LABEL_FLAG_SHAPE GetShape() const override
Definition: sch_label.h:73
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
wxString getElectricalTypeLabel(LABEL_FLAG_SHAPE aType)
Definition: sch_label.cpp:141

References _, SCH_CONNECTION::AppendInfoToMsgPanel(), TEXT_SPIN_STYLE::BOTTOM, SCH_ITEM::Connection(), SCH_ITEM::GetEffectiveNetClass(), getElectricalTypeLabel(), EDA_TEXT::GetFont(), GetShape(), EDA_TEXT::GetText(), SCH_TEXT::GetTextSpinStyle(), EDA_TEXT::GetTextWidth(), EDA_TEXT::IsBold(), SCH_CONNECTION::IsBus(), SCH_ITEM::IsConnectivityDirty(), EDA_TEXT::IsItalic(), TEXT_SPIN_STYLE::LEFT, UNITS_PROVIDER::MessageTextFromValue(), TEXT_SPIN_STYLE::RIGHT, SCH_DIRECTIVE_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_SHEET_PIN_T, EDA_ITEM::Type(), UnescapeString(), and TEXT_SPIN_STYLE::UP.

◆ GetOrInitConnection()

SCH_CONNECTION * SCH_ITEM::GetOrInitConnection ( const SCH_SHEET_PATH aPath,
CONNECTION_GRAPH aGraph 
)
inherited

Definition at line 228 of file sch_item.cpp.

230{
231 if( !IsConnectable() )
232 return nullptr;
233
234 SetConnectivityDirty( false );
235
236 SCH_CONNECTION* connection = Connection( &aSheet );
237
238 if( connection )
239 return connection;
240 else
241 return InitializeConnection( aSheet, aGraph );
242}
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
Definition: sch_item.cpp:205
void SetConnectivityDirty(bool aDirty=true)
Definition: sch_item.h:415

References SCH_ITEM::Connection(), SCH_ITEM::InitializeConnection(), SCH_ITEM::IsConnectable(), and SCH_ITEM::SetConnectivityDirty().

◆ GetParent()

◆ GetPenWidth()

int SCH_TEXT::GetPenWidth ( ) const
overridevirtualinherited
Returns
the size of the "pen" that be used to draw or plot this item

Reimplemented from SCH_ITEM.

Definition at line 273 of file sch_text.cpp.

274{
276}

References EDA_TEXT::GetEffectiveTextPenWidth().

Referenced by AutoplaceFields(), SCH_GLOBALLABEL::CreateGraphicShape(), GetSchematicTextOffset(), and Print().

◆ GetPosition()

◆ GetRenderCache()

std::vector< std::unique_ptr< KIFONT::GLYPH > > * EDA_TEXT::GetRenderCache ( const KIFONT::FONT aFont,
const wxString &  forResolvedText,
const VECTOR2I aOffset = { 0, 0 } 
) const
inherited

Definition at line 451 of file eda_text.cpp.

453{
454 if( getDrawFont()->IsOutline() )
455 {
456 EDA_ANGLE resolvedAngle = GetDrawRotation();
457
458 if( m_render_cache.empty()
459 || m_render_cache_text != forResolvedText
460 || m_render_cache_angle != resolvedAngle
461 || m_render_cache_offset != aOffset )
462 {
463 m_render_cache.clear();
464
465 KIFONT::OUTLINE_FONT* font = static_cast<KIFONT::OUTLINE_FONT*>( getDrawFont() );
467
468 attrs.m_Angle = resolvedAngle;
469
470 font->GetLinesAsGlyphs( &m_render_cache, GetShownText(), GetDrawPos() + aOffset, attrs );
471 m_render_cache_angle = resolvedAngle;
472 m_render_cache_text = forResolvedText;
473 m_render_cache_offset = aOffset;
474 }
475
476 return &m_render_cache;
477 }
478
479 return nullptr;
480}
VECTOR2I m_render_cache_offset
Definition: eda_text.h:397
EDA_ANGLE m_render_cache_angle
Definition: eda_text.h:396
wxString m_render_cache_text
Definition: eda_text.h:395
Class OUTLINE_FONT implements outline font drawing.
Definition: outline_font.h:50
void GetLinesAsGlyphs(std::vector< std::unique_ptr< GLYPH > > *aGlyphs, const wxString &aText, const VECTOR2I &aPosition, const TEXT_ATTRIBUTES &aAttrs) const

References EDA_TEXT::GetAttributes(), EDA_TEXT::getDrawFont(), EDA_TEXT::GetDrawPos(), EDA_TEXT::GetDrawRotation(), KIFONT::OUTLINE_FONT::GetLinesAsGlyphs(), EDA_TEXT::GetShownText(), TEXT_ATTRIBUTES::m_Angle, EDA_TEXT::m_render_cache, EDA_TEXT::m_render_cache_angle, EDA_TEXT::m_render_cache_offset, and EDA_TEXT::m_render_cache_text.

Referenced by KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), and PCB_PLUGIN::formatRenderCache().

◆ GetSchematicTextOffset()

VECTOR2I SCH_LABEL_BASE::GetSchematicTextOffset ( const RENDER_SETTINGS aSettings) const
overridevirtual

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.

Returns
the offset between the SCH_TEXT position and the text itself position

Reimplemented from SCH_TEXT.

Reimplemented in SCH_GLOBALLABEL, and SCH_HIERLABEL.

Definition at line 274 of file sch_label.cpp.

275{
276 VECTOR2I text_offset;
277
278 // add an offset to x (or y) position to aid readability of text on a wire or line
279 int dist = GetTextOffset( aSettings ) + GetPenWidth();
280
281 switch( GetTextSpinStyle() )
282 {
284 case TEXT_SPIN_STYLE::BOTTOM: text_offset.x = -dist; break; // Vert Orientation
285 default:
287 case TEXT_SPIN_STYLE::RIGHT: text_offset.y = -dist; break; // Horiz Orientation
288 }
289
290 return text_offset;
291}

References TEXT_SPIN_STYLE::BOTTOM, SCH_TEXT::GetPenWidth(), SCH_TEXT::GetTextOffset(), SCH_TEXT::GetTextSpinStyle(), TEXT_SPIN_STYLE::LEFT, TEXT_SPIN_STYLE::RIGHT, TEXT_SPIN_STYLE::UP, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by GetBoundingBox(), HitTest(), SCH_FIELD::Plot(), Plot(), and Print().

◆ GetSelectMenuText()

wxString SCH_TEXT::GetSelectMenuText ( UNITS_PROVIDER aUnitsProvider) const
overridevirtualinherited

Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position.

The default version of this function raises an assertion in the debug mode and returns a string to indicate that it was not overridden to provide the object specific text.

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 401 of file sch_text.cpp.

402{
403 return wxString::Format( _( "Graphic Text '%s'" ), KIUI::EllipsizeMenuText( GetShownText() ) );
404}
wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
Definition: sch_text.cpp:342
wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
Definition: ui_common.cpp:203
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References _, KIUI::EllipsizeMenuText(), Format(), and SCH_TEXT::GetShownText().

◆ GetShape()

◆ GetShownText()

wxString SCH_LABEL_BASE::GetShownText ( int  aDepth = 0,
bool  aAllowExtraText = true 
) const
overridevirtual

Return the string actually shown after processing of the base text.

Parameters
aDepthis used to prevent infinite recursions and loops when expanding text variables.
aAllowExtraTextis true to allow adding more text than the initial expanded text, for intance a title, a prefix for texts in display functions. False to disable any added text (for instance when writing the shown text in netlists).

Reimplemented from EDA_TEXT.

Definition at line 560 of file sch_label.cpp.

561{
562 std::function<bool( wxString* )> textResolver =
563 [&]( wxString* token ) -> bool
564 {
565 return ResolveTextVar( token, aDepth );
566 };
567
568 std::function<bool( wxString* )> schematicTextResolver =
569 [&]( wxString* token ) -> bool
570 {
571 return Schematic()->ResolveTextVar( token, aDepth + 1 );
572 };
573
574 wxString text = EDA_TEXT::GetShownText();
575
576 if( text == wxS( "~" ) ) // Legacy placeholder for empty string
577 {
578 text = wxS( "" );
579 }
580 else if( HasTextVars() )
581 {
582 PROJECT* project = nullptr;
583
584 if( Schematic() )
585 project = &Schematic()->Prj();
586
587 if( aDepth < 10 )
588 text = ExpandTextVars( text, &textResolver, &schematicTextResolver, project );
589 }
590
591 return text;
592}
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition: eda_text.h:103
Container for project specific data.
Definition: project.h:63
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: schematic.cpp:123
virtual bool ResolveTextVar(wxString *token, int aDepth) const
Definition: sch_label.cpp:482
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:57

References ExpandTextVars(), EDA_TEXT::GetShownText(), EDA_TEXT::HasTextVars(), SCHEMATIC::Prj(), project, ResolveTextVar(), SCHEMATIC::ResolveTextVar(), SCH_ITEM::Schematic(), and text.

Referenced by SCH_LABEL::GetSelectMenuText(), SCH_DIRECTIVE_LABEL::GetSelectMenuText(), SCH_GLOBALLABEL::GetSelectMenuText(), SCH_HIERLABEL::GetSelectMenuText(), SCH_SHEET_PIN::GetSelectMenuText(), Plot(), and ERC_TESTER::TestSimilarLabels().

◆ GetSortPosition()

virtual VECTOR2I EDA_ITEM::GetSortPosition ( ) const
inlinevirtualinherited

Return the coordinates that should be used for sorting this element visually compared to other elements.

For instance, for lines the midpoint might be a better sorting point than either end.

Returns
X,Y coordinate of the sort point

Reimplemented in SCH_LINE.

Definition at line 267 of file eda_item.h.

267{ return GetPosition(); }

References EDA_ITEM::GetPosition().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 126 of file eda_item.h.

127 {
128 return m_status & type;
129 }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:497

References EDA_ITEM::m_status.

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 139 of file eda_item.h.

139{ return m_status; }

References EDA_ITEM::m_status.

◆ GetStoredPos()

VECTOR2I & SCH_ITEM::GetStoredPos ( )
inlineinherited

Definition at line 209 of file sch_item.h.

209{ return m_storedPos; }
VECTOR2I m_storedPos
Definition: sch_item.h:494

References SCH_ITEM::m_storedPos.

◆ GetStroke()

virtual STROKE_PARAMS SCH_ITEM::GetStroke ( ) const
inlinevirtualinherited

Reimplemented in SCH_BUS_ENTRY_BASE, SCH_LINE, and SCH_SHAPE.

Definition at line 457 of file sch_item.h.

457{ wxCHECK( false, STROKE_PARAMS() ); }
Simple container to manage line stroke parameters.
Definition: stroke_params.h:88

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem().

◆ GetText()

virtual const wxString & EDA_TEXT::GetText ( ) const
inlinevirtualinherited

Return the string associated with the text object.

Returns
a const wxString reference containing the string of the item.

Definition at line 87 of file eda_text.h.

87{ return m_text; }

References EDA_TEXT::m_text.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), SCH_EAGLE_PLUGIN::addImplicitConnections(), NETLIST_EXPORTER_XML::addSymbolFields(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), SCH_EDIT_FRAME::AutoRotateItem(), CONNECTION_GRAPH::buildConnectionGraph(), SCH_EDIT_TOOL::ChangeTextType(), KI_TEST::CheckFpText(), CheckLibSymbol(), SCH_SHEET::CleanupSheet(), LIB_TEXT::Clone(), LIB_FIELD::compare(), LIB_TEXT::compare(), LIB_TEXTBOX::compare(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), DIALOG_LIB_FIELD_PROPERTIES::DIALOG_LIB_FIELD_PROPERTIES(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), KIGFX::SCH_VIEW::DisplaySymbol(), EDA_TEXT_DESC::EDA_TEXT_DESC(), CONNECTION_GRAPH::ercCheckHierSheets(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), LIB_SYMBOL::Flatten(), PCB_PLUGIN::format(), LIB_SYMBOL::GetFootprint(), SCH_SYMBOL::GetFootprintFieldText(), LIB_FIELD::GetFullText(), FOOTPRINT_INFO_GENERATOR::GetHtmlFieldRow(), GetIntersheetRefs(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadNet(), FP_TEXT::GetLength(), getMatchingTextItem(), LIB_FIELD::GetMsgPanelInfo(), LIB_TEXT::GetMsgPanelInfo(), LIB_TEXTBOX::GetMsgPanelInfo(), SCH_FIELD::GetMsgPanelInfo(), GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_TEXTBOX::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), FP_TEXTBOX::GetMsgPanelInfo(), PCB_TEXT::GetMsgPanelInfo(), PCB_TEXTBOX::GetMsgPanelInfo(), SCH_SYMBOL::GetRef(), FOOTPRINT::GetReference(), LIB_SYMBOL::GetSearchText(), PCB_DIMENSION_BASE::GetText(), FOOTPRINT::GetValue(), SCH_SYMBOL::GetValueFieldText(), hash_fp_item(), SCH_SHEET::HasUndefinedPins(), LIB_FIELD::HitTest(), SCH_DRAWING_TOOLS::importHierLabel(), IncrementLabel(), GENERAL_COLLECTOR::Inspect(), CADSTAR_SCH_ARCHIVE_LOADER::Load(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EAGLE_PLUGIN::loadSchematic(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_EAGLE_PLUGIN::loadSegments(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), LIB_TEXTBOX::Matches(), Matches(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), SCH_TEXTBOX::Matches(), SCH_SHEET_LIST::migrateSimModel(), DIALOG_SHEET_PIN_PROPERTIES::onComboBox(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), SCH_FIELD::operator<(), SCH_TEXT::operator<(), SCH_TEXTBOX::operator<(), LIB_FIELD::operator=(), PCB_PARSER::parseEDA_TEXT(), SCH_SEXPR_PARSER::parseEDA_TEXT(), SCH_SEXPR_PARSER::parseSchematicSymbol(), SCH_EDITOR_CONTROL::Paste(), DRAWING_TOOL::PlaceText(), LIB_FIELD::Plot(), LIB_TEXT::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), DIALOG_RESCUE_EACH::PopulateInstanceList(), LIB_FIELD::print(), DIALOG_CHANGE_SYMBOLS::processSymbol(), processTextItem(), SCH_EDIT_FRAME::PutDataInPreviousState(), NETLIST_EXPORTER_SPICE_MODEL::readPorts(), SCHEMATIC::RecomputeIntersheetRefs(), SCH_GLOBALLABEL::ResolveTextVar(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN::saveField(), SCH_SEXPR_PLUGIN::saveField(), CLIPBOARD_IO::SaveSelection(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), SCH_LEGACY_PLUGIN::saveSymbol(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN::saveText(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveTextBox(), SCH_SEXPR_PLUGIN::saveTextBox(), SCH_EDIT_FRAME::SendSelectItemsToPcb(), SYMBOL_EDIT_FRAME::setupUIConditions(), SYMBOL_VIEWER_FRAME::setupUIConditions(), EE_INSPECTION_TOOL::ShowDatasheet(), SCH_SHEET::SymbolCount(), textsNeedUpdate(), DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow(), EDA_TEXT::TransformBoundingBoxToPolygon(), SCH_EDITOR_CONTROL::updatePastedSymbol(), SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo(), and FP_TEXT::ViewGetLOD().

◆ GetTextAngle()

const EDA_ANGLE & EDA_TEXT::GetTextAngle ( ) const
inlineinherited

Definition at line 120 of file eda_text.h.

120{ return m_attributes.m_Angle; }

References TEXT_ATTRIBUTES::m_Angle, and EDA_TEXT::m_attributes.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), SCH_EDIT_TOOL::ChangeTextType(), KI_TEST::CheckFpText(), LIB_TEXTBOX::compare(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), FP_TEXT::Flip(), FP_TEXTBOX::Flip(), PCB_TEXT::Flip(), PCB_TEXTBOX::Flip(), PCB_PLUGIN::format(), SCH_LABEL::GetBodyBoundingBox(), LIB_FIELD::GetBoundingBox(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), LIB_TEXTBOX::GetDrawPos(), SCH_TEXTBOX::GetDrawPos(), EDA_TEXT::GetDrawRotation(), SCH_FIELD::GetDrawRotation(), FP_TEXT::GetDrawRotation(), FP_TEXTBOX::GetDrawRotation(), FP_TEXT::GetMsgPanelInfo(), FP_TEXTBOX::GetMsgPanelInfo(), PCB_TEXT::GetMsgPanelInfo(), PCB_TEXTBOX::GetMsgPanelInfo(), LIB_TEXTBOX::GetShownText(), SCH_TEXTBOX::GetShownText(), hash_fp_item(), LIB_FIELD::HitTest(), LIB_TEXT::HitTest(), FP_TEXT::KeepUpright(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), FP_TEXT::Mirror(), PCB_TEXT::Mirror(), PCB_DIMENSION_BASE::Mirror(), LIB_TEXT::MirrorHorizontal(), LIB_TEXTBOX::MirrorHorizontally(), SCH_TEXTBOX::MirrorHorizontally(), LIB_TEXT::MirrorVertical(), LIB_TEXTBOX::MirrorVertically(), SCH_TEXTBOX::MirrorVertically(), LIB_TEXT::NormalizeJustification(), KI_TEST::kitest_cmp_drawings::operator()(), EAGLE_PLUGIN::orientFPText(), SCH_FIELD::Plot(), Plot(), SCH_TEXT::Plot(), SCH_TEXTBOX::Plot(), LIB_FIELD::Plot(), LIB_TEXT::Plot(), positioningChanged(), SCH_FIELD::Print(), LIB_FIELD::print(), LIB_TEXT::print(), processTextItem(), SCH_EDIT_TOOL::Rotate(), SCH_TEXTBOX::Rotate(), LIB_TEXTBOX::Rotate(), LIB_FIELD::Rotate(), LIB_TEXT::Rotate(), FP_TEXT::Rotate(), FP_TEXTBOX::Rotate(), PCB_DIMENSION_BASE::Rotate(), PCB_TEXT::Rotate(), PCB_TEXTBOX::Rotate(), SCH_TEXTBOX::Rotate90(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN::saveField(), SCH_SEXPR_PLUGIN::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveTextBox(), SCH_SEXPR_PLUGIN::saveTextBox(), textsNeedUpdate(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_RADIAL::updateGeometry(), and PCB_DIM_LEADER::updateGeometry().

◆ GetTextAngleDegrees()

double EDA_TEXT::GetTextAngleDegrees ( ) const
inlineinherited

◆ GetTextBox()

BOX2I EDA_TEXT::GetTextBox ( int  aLine = -1,
bool  aInvertY = false 
) const
inherited

Useful in multiline texts to calculate the full text or a line area (for zones filling, locate functions....)

Parameters
aLineThe line of text to consider. Pass -1 for all lines.
aInvertYInvert the Y axis when calculating bounding box.
Returns
the rect containing the line of text (i.e. the position and the size of one line) this rectangle is calculated for 0 orient text. If orientation is not 0 the rect must be rotated to match the physical area

Definition at line 503 of file eda_text.cpp.

504{
505 VECTOR2I drawPos = GetDrawPos();
506
508 && m_bounding_box_cache_pos == drawPos
509 && m_bounding_box_cache_line == aLine
510 && m_bounding_box_cache_inverted == aInvertY )
511 {
513 }
514
515 BOX2I bbox;
516 wxArrayString strings;
517 wxString text = GetShownText();
518 int thickness = GetEffectiveTextPenWidth();
519
520 if( IsMultilineAllowed() )
521 {
522 wxStringSplit( text, strings, '\n' );
523
524 if( strings.GetCount() ) // GetCount() == 0 for void strings with multilines allowed
525 {
526 if( aLine >= 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
527 text = strings.Item( aLine );
528 else
529 text = strings.Item( 0 );
530 }
531 }
532
533 // calculate the H and V size
534 KIFONT::FONT* font = getDrawFont();
535 VECTOR2D fontSize( GetTextSize() );
536 bool bold = IsBold();
537 bool italic = IsItalic();
538 VECTOR2I extents = font->StringBoundaryLimits( text, fontSize, thickness, bold, italic );
539 int overbarOffset = 0;
540
541 // Creates bounding box (rectangle) for horizontal, left and top justified text. The
542 // bounding box will be moved later according to the actual text options
543 wxSize textsize = wxSize( extents.x, extents.y );
544 VECTOR2I pos = drawPos;
545
546 if( IsMultilineAllowed() && aLine > 0 && aLine < (int) strings.GetCount() )
547 pos.y -= KiROUND( aLine * font->GetInterline( fontSize.y ) );
548
549 if( text.Contains( wxT( "~{" ) ) )
550 overbarOffset = extents.y / 14;
551
552 if( aInvertY )
553 pos.y = -pos.y;
554
555 bbox.SetOrigin( pos );
556
557 // for multiline texts and aLine < 0, merge all rectangles (aLine == -1 signals all lines)
558 if( IsMultilineAllowed() && aLine < 0 && strings.GetCount() )
559 {
560 for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
561 {
562 text = strings.Item( ii );
563 extents = font->StringBoundaryLimits( text, fontSize, thickness, bold, italic );
564 textsize.x = std::max( textsize.x, extents.x );
565 }
566
567 // interline spacing is only *between* lines, so total height is the height of the first
568 // line plus the interline distance (with interline spacing) for all subsequent lines
569 textsize.y += KiROUND( ( strings.GetCount() - 1 ) * font->GetInterline( fontSize.y ) );
570 }
571
572 bbox.SetSize( textsize );
573
574 /*
575 * At this point the rectangle origin is the text origin (m_Pos). This is correct only for
576 * left and top justified, non-mirrored, non-overbarred texts. Recalculate for all others.
577 */
578 int italicOffset = IsItalic() ? fontSize.y * ITALIC_TILT : 0;
579
580 switch( GetHorizJustify() )
581 {
583 if( IsMirrored() )
584 bbox.SetX( bbox.GetX() - ( bbox.GetWidth() - italicOffset ) );
585 break;
586
588 bbox.SetX( bbox.GetX() - ( bbox.GetWidth() - italicOffset ) / 2 );
589 break;
590
592 if( !IsMirrored() )
593 bbox.SetX( bbox.GetX() - ( bbox.GetWidth() - italicOffset ) );
594 break;
595 }
596
597 switch( GetVertJustify() )
598 {
600 break;
601
603 bbox.SetY( bbox.GetY() - ( bbox.GetHeight() + overbarOffset ) / 2 );
604 break;
605
607 bbox.SetY( bbox.GetY() - ( bbox.GetHeight() + overbarOffset ) );
608 break;
609 }
610
611 bbox.Normalize(); // Make h and v sizes always >= 0
612
614 m_bounding_box_cache_pos = drawPos;
618
619 return bbox;
620}
void SetOrigin(const Vec &pos)
Definition: box2.h:202
void SetX(coord_type val)
Definition: box2.h:235
void SetY(coord_type val)
Definition: box2.h:240
coord_type GetHeight() const
Definition: box2.h:188
coord_type GetY() const
Definition: box2.h:181
coord_type GetWidth() const
Definition: box2.h:187
void SetSize(const Vec &size)
Definition: box2.h:213
coord_type GetX() const
Definition: box2.h:180
BOX2I m_bounding_box_cache
Definition: eda_text.h:404
bool IsMultilineAllowed() const
Definition: eda_text.h:146
int m_bounding_box_cache_line
Definition: eda_text.h:402
bool m_bounding_box_cache_inverted
Definition: eda_text.h:403
VECTOR2I m_bounding_box_cache_pos
Definition: eda_text.h:401
virtual double GetInterline(double aGlyphHeight, double aLineSpacing=1.0) const =0
Compute the distance (interline) between 2 lines of text (for multiline texts).
VECTOR2I StringBoundaryLimits(const wxString &aText, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic) const
Compute the boundary limits of aText (the bounding box of all shapes).
Definition: font.cpp:271
static constexpr double ITALIC_TILT
Tilt factor for italic style (this is the scaling factor on dY relative coordinates to give a tilted ...
Definition: font.h:60
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.

References EDA_TEXT::getDrawFont(), EDA_TEXT::GetDrawPos(), EDA_TEXT::GetEffectiveTextPenWidth(), BOX2< Vec >::GetHeight(), EDA_TEXT::GetHorizJustify(), KIFONT::FONT::GetInterline(), EDA_TEXT::GetShownText(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetVertJustify(), BOX2< Vec >::GetWidth(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), EDA_TEXT::IsMirrored(), EDA_TEXT::IsMultilineAllowed(), ITALIC_TILT, KiROUND(), EDA_TEXT::m_bounding_box_cache, EDA_TEXT::m_bounding_box_cache_inverted, EDA_TEXT::m_bounding_box_cache_line, EDA_TEXT::m_bounding_box_cache_pos, EDA_TEXT::m_bounding_box_cache_valid, BOX2< Vec >::Normalize(), BOX2< Vec >::SetOrigin(), BOX2< Vec >::SetSize(), BOX2< Vec >::SetX(), BOX2< Vec >::SetY(), KIFONT::FONT::StringBoundaryLimits(), text, wxStringSplit(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SCH_GLOBALLABEL::CreateGraphicShape(), KIGFX::SCH_PAINTER::draw(), SCH_LABEL::GetBodyBoundingBox(), SCH_HIERLABEL::GetBodyBoundingBox(), LIB_FIELD::GetBoundingBox(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), DS_DRAW_ITEM_TEXT::GetBoundingBox(), FP_TEXT::GetBoundingBox(), PCB_DIMENSION_BASE::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), LIB_TEXT::HitTest(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), LIB_TEXT::NormalizeJustification(), SCH_TEXT::Plot(), SCH_TEXT::Print(), EDA_TEXT::TextHitTest(), FP_TEXT::TextHitTest(), EDA_TEXT::TransformBoundingBoxToPolygon(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_RADIAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), and FP_TEXT::ViewBBox().

◆ GetTextColor()

◆ GetTextHeight()

◆ GetTextOffset()

int SCH_TEXT::GetTextOffset ( const RENDER_SETTINGS aSettings = nullptr) const
inherited

Definition at line 258 of file sch_text.cpp.

259{
260 double ratio;
261
262 if( aSettings )
263 ratio = static_cast<const SCH_RENDER_SETTINGS*>( aSettings )->m_TextOffsetRatio;
264 else if( Schematic() )
266 else
267 ratio = DEFAULT_TEXT_OFFSET_RATIO; // For previews (such as in Preferences), etc.
268
269 return KiROUND( ratio * GetTextSize().y );
270}
#define DEFAULT_TEXT_OFFSET_RATIO
Ratio of the font height to space around global labels.

References DEFAULT_TEXT_OFFSET_RATIO, EDA_TEXT::GetTextSize(), KiROUND(), SCHEMATIC_SETTINGS::m_TextOffsetRatio, SCH_ITEM::Schematic(), and SCHEMATIC::Settings().

Referenced by AutoplaceFields(), SCH_DIRECTIVE_LABEL::AutoplaceFields(), SCH_LABEL::GetBodyBoundingBox(), SCH_HIERLABEL::GetBodyBoundingBox(), GetSchematicTextOffset(), and SCH_HIERLABEL::GetSchematicTextOffset().

◆ GetTextPos()

const VECTOR2I & EDA_TEXT::GetTextPos ( ) const
inlineinherited

Definition at line 208 of file eda_text.h.

208{ return m_pos; }

References EDA_TEXT::m_pos.

Referenced by AutoplaceFields(), LIB_FIELD::compare(), LIB_TEXT::compare(), SCH_SHEET_PIN::ConstrainOnEdge(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), SCH_LABEL::doIsConnected(), SCH_GLOBALLABEL::doIsConnected(), SCH_HIERLABEL::doIsConnected(), KIGFX::DS_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), FP_TEXT::Flip(), FP_TEXTBOX::Flip(), PCB_TEXT::Flip(), PCB_PLUGIN::format(), GetBodyBoundingBox(), SCH_LABEL::GetBodyBoundingBox(), SCH_HIERLABEL::GetBodyBoundingBox(), LIB_FIELD::GetBoundingBox(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), FP_TEXT::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), SCH_MOVE_TOOL::getConnectedDragItems(), GetConnectionPoints(), EDA_TEXT::GetDrawPos(), GetEndPoints(), SCH_SHEET_PIN::GetEndPoints(), SCH_FIELD::GetLibPosition(), LIB_FIELD::GetPosition(), LIB_TEXT::GetPosition(), SCH_FIELD::GetPosition(), SCH_TEXT::GetPosition(), DS_DRAW_ITEM_TEXT::GetPosition(), FP_TEXT::GetPosition(), PCB_TEXT::GetPosition(), LIB_FIELD::HitTest(), LIB_TEXT::HitTest(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), FP_TEXT::Mirror(), PCB_TEXT::Mirror(), PCB_DIMENSION_BASE::Mirror(), LIB_FIELD::MirrorHorizontal(), LIB_TEXT::MirrorHorizontal(), SCH_SHEET_PIN::MirrorHorizontally(), SCH_TEXT::MirrorHorizontally(), LIB_FIELD::MirrorVertical(), LIB_TEXT::MirrorVertical(), SCH_SHEET_PIN::MirrorVertically(), SCH_TEXT::MirrorVertically(), LIB_TEXT::NormalizeJustification(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), DRAWING_TOOL::PlaceText(), SCH_FIELD::Plot(), Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), LIB_FIELD::print(), Print(), DIALOG_CHANGE_SYMBOLS::processSymbol(), Rotate(), SCH_SHEET_PIN::Rotate(), SCH_TEXT::Rotate(), LIB_FIELD::Rotate(), LIB_TEXT::Rotate(), FP_TEXT::Rotate(), PCB_DIMENSION_BASE::Rotate(), PCB_TEXT::Rotate(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), FP_TEXT::SetDrawCoord(), FP_TEXT::SetLocalCoord(), FP_TEXT::TextHitTest(), FP_TEXT::TransformTextToPolySet(), PCB_TEXT::TransformTextToPolySet(), UpdateDanglingState(), and FP_TEXT::ViewBBox().

◆ GetTextSize()

◆ GetTextSpinStyle()

◆ GetTextStyleName()

wxString EDA_TEXT::GetTextStyleName ( ) const
inherited
Returns
a wxString with the style name( Normal, Italic, Bold, Bold+Italic).

Definition at line 736 of file eda_text.cpp.

737{
738 int style = 0;
739
740 if( IsItalic() )
741 style = 1;
742
743 if( IsBold() )
744 style += 2;
745
746 wxString stylemsg[4] = {
747 _("Normal"),
748 _("Italic"),
749 _("Bold"),
750 _("Bold+Italic")
751 };
752
753 return stylemsg[style];
754}

References _, EDA_TEXT::IsBold(), and EDA_TEXT::IsItalic().

Referenced by LIB_FIELD::GetMsgPanelInfo(), LIB_TEXT::GetMsgPanelInfo(), and SCH_FIELD::GetMsgPanelInfo().

◆ GetTextThickness()

◆ GetTextWidth()

int EDA_TEXT::GetTextWidth ( ) const
inlineinherited

Definition at line 199 of file eda_text.h.

199{ return m_attributes.m_Size.x; }

References EDA_TEXT::m_attributes, TEXT_ATTRIBUTES::m_Size, and VECTOR2< T >::x.

Referenced by LIB_FIELD::compare(), LIB_TEXT::compare(), LIB_TEXTBOX::compare(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), EDA_TEXT_DESC::EDA_TEXT_DESC(), EDA_TEXT::Format(), EDA_TEXT::GetEffectiveTextPenWidth(), PCB_TEXT::getKnockoutMargin(), LIB_FIELD::GetMsgPanelInfo(), LIB_TEXT::GetMsgPanelInfo(), LIB_TEXTBOX::GetMsgPanelInfo(), SCH_FIELD::GetMsgPanelInfo(), GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_TEXTBOX::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), FP_TEXTBOX::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_TEXT::GetMsgPanelInfo(), PCB_TEXTBOX::GetMsgPanelInfo(), SCH_HIERLABEL::GetSchematicTextOffset(), hash_fp_item(), CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols(), SCH_EAGLE_PLUGIN::loadTextAttributes(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN::saveText(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_RADIAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), and DIALOG_FIELD_PROPERTIES::updateText().

◆ GetTypeDesc()

wxString EDA_ITEM::GetTypeDesc ( ) const
inherited

Return a translated description of the type for this EDA_ITEM for display in user facing messages.

Definition at line 301 of file eda_item.cpp.

302{
303 //@see EDA_ITEM_DESC for definition of ENUM_MAP<KICAD_T>
304 wxString typeDescr = ENUM_MAP<KICAD_T>::Instance().ToString( Type() );
305
306 return wxGetTranslation( typeDescr );
307}
static ENUM_MAP< T > & Instance()
Definition: property.h:546

References ENUM_MAP< T >::Instance(), and EDA_ITEM::Type().

Referenced by PCB_GROUP::AddItem(), EDIT_TOOL::doMoveSelection(), and EDA_ITEM::GetFriendlyName().

◆ GetVertJustify()

◆ GotoPageHref()

wxString EDA_TEXT::GotoPageHref ( const wxString &  aDestination)
staticinherited

Generate a href to a page in the current schematic.

Parameters
aDestinationDestination sheet's page number.
Returns
A hyperlink href string that goes to the specified page.

Definition at line 1004 of file eda_text.cpp.

1005{
1006 return wxT( "#" ) + aDestination;
1007}

Referenced by SCH_SHEET::Plot().

◆ HasFlag()

◆ HasHyperlink()

virtual bool EDA_TEXT::HasHyperlink ( ) const
inlinevirtualinherited

◆ HasLineStroke()

virtual bool SCH_ITEM::HasLineStroke ( ) const
inlinevirtualinherited

Check if this schematic item has line stoke properties.

See also
STROKE_PARAMS
Returns
true if this schematic item support line stroke properties. Otherwise, false.

Reimplemented in SCH_BUS_ENTRY_BASE, SCH_LINE, and SCH_SHAPE.

Definition at line 455 of file sch_item.h.

455{ return false; }

Referenced by SCH_EDIT_TOOL::Init(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem().

◆ HasTextVars()

bool EDA_TEXT::HasTextVars ( ) const
inlineinherited

◆ HitTest() [1/2]

bool SCH_LABEL_BASE::HitTest ( const BOX2I aRect,
bool  aContained,
int  aAccuracy = 0 
) const
overridevirtual

Test if aRect intersects this item.

Parameters
aRectA reference to a BOX2I object containing the rectangle to test.
aContainedSet to true to test for containment instead of an intersection.
aAccuracyIncrease aRect by this amount.
Returns
True if aRect contains or intersects the item bounding box.

Reimplemented from EDA_ITEM.

Definition at line 752 of file sch_label.cpp.

753{
754 BOX2I rect = aRect;
755
756 rect.Inflate( aAccuracy );
757
758 if( aContained )
759 {
760 return rect.Contains( GetBoundingBox() );
761 }
762 else
763 {
764 if( rect.Intersects( GetBodyBoundingBox() ) )
765 return true;
766
767 for( const SCH_FIELD& field : m_fields )
768 {
769 if( field.IsVisible() )
770 {
771 BOX2I fieldBBox = field.GetBoundingBox();
772
773 if( Type() == SCH_LABEL_T || Type() == SCH_GLOBAL_LABEL_T )
774 fieldBBox.Offset( GetSchematicTextOffset( nullptr ) );
775
776 if( rect.Intersects( fieldBBox ) )
777 return true;
778 }
779 }
780
781 return false;
782 }
783}
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:269
bool Contains(const Vec &aPoint) const
Definition: box2.h:141
const BOX2I GetBoundingBox() const override
Return the bounding box of the label including its fields.
Definition: sch_label.cpp:700

References BOX2< Vec >::Contains(), GetBodyBoundingBox(), GetBoundingBox(), GetSchematicTextOffset(), BOX2< Vec >::Inflate(), BOX2< Vec >::Intersects(), m_fields, BOX2< Vec >::Offset(), SCH_GLOBAL_LABEL_T, SCH_LABEL_T, and EDA_ITEM::Type().

◆ HitTest() [2/2]

bool SCH_LABEL_BASE::HitTest ( const VECTOR2I aPosition,
int  aAccuracy = 0 
) const
overridevirtual

Test if aPosition is inside or on the boundary of this item.

Parameters
aPositionA reference to a VECTOR2I object containing the coordinates to test.
aAccuracyIncrease the item bounding box by this amount.
Returns
True if aPosition is within the item bounding box.

Reimplemented from EDA_ITEM.

Reimplemented in SCH_SHEET_PIN.

Definition at line 725 of file sch_label.cpp.

726{
727 BOX2I bbox = GetBodyBoundingBox();
728 bbox.Inflate( aAccuracy );
729
730 if( bbox.Contains( aPosition ) )
731 return true;
732
733 for( const SCH_FIELD& field : m_fields )
734 {
735 if( field.IsVisible() )
736 {
737 BOX2I fieldBBox = field.GetBoundingBox();
738 fieldBBox.Inflate( aAccuracy );
739
740 if( Type() == SCH_LABEL_T || Type() == SCH_GLOBAL_LABEL_T )
741 fieldBBox.Offset( GetSchematicTextOffset( nullptr ) );
742
743 if( fieldBBox.Contains( aPosition ) )
744 return true;
745 }
746 }
747
748 return false;
749}

References BOX2< Vec >::Contains(), GetBodyBoundingBox(), GetSchematicTextOffset(), BOX2< Vec >::Inflate(), m_fields, BOX2< Vec >::Offset(), SCH_GLOBAL_LABEL_T, SCH_LABEL_T, and EDA_ITEM::Type().

◆ IncrementLabel()

bool SCH_LABEL_BASE::IncrementLabel ( int  aIncrement)

Increment the label text, if it ends with a number.

Parameters
aIncrement= the increment value to add to the number ending the text.

Definition at line 362 of file sch_label.cpp.

363{
364 wxString text = GetText();
365
366 if( IncrementLabelMember( text, aIncrement ) )
367 {
368 SetText( text );
369 return true;
370 }
371
372 return false;
373}
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:163
bool IncrementLabelMember(wxString &name, int aIncrement)
Definition: sch_label.cpp:49

References EDA_TEXT::GetText(), IncrementLabelMember(), EDA_TEXT::SetText(), and text.

◆ InitializeConnection()

SCH_CONNECTION * SCH_ITEM::InitializeConnection ( const SCH_SHEET_PATH aPath,
CONNECTION_GRAPH aGraph 
)
inherited

Create a new connection object associated with this object.

Parameters
aPathis the sheet path to initialize.

Definition at line 205 of file sch_item.cpp.

207{
208 SetConnectivityDirty( false );
209
210 SCH_CONNECTION* connection = Connection( &aSheet );
211
212 if( connection )
213 {
214 connection->Reset();
215 }
216 else
217 {
218 connection = new SCH_CONNECTION( this );
219 m_connection_map.insert( std::make_pair( aSheet, connection ) );
220 }
221
222 connection->SetGraph( aGraph );
223 connection->SetSheet( aSheet );
224 return connection;
225}
void Reset()
Clears connectivity information.
void SetGraph(CONNECTION_GRAPH *aGraph)
void SetSheet(SCH_SHEET_PATH aSheet)

References SCH_ITEM::Connection(), SCH_ITEM::m_connection_map, SCH_CONNECTION::Reset(), SCH_ITEM::SetConnectivityDirty(), SCH_CONNECTION::SetGraph(), and SCH_CONNECTION::SetSheet().

Referenced by SCH_ITEM::GetOrInitConnection().

◆ IsBold()

bool EDA_TEXT::IsBold ( ) const
inlineinherited

Definition at line 133 of file eda_text.h.

133{ return m_attributes.m_Bold; }

References EDA_TEXT::m_attributes, and TEXT_ATTRIBUTES::m_Bold.

Referenced by BOARD_ADAPTER::addText(), SCH_EDIT_TOOL::ChangeTextType(), KI_TEST::CheckFpText(), LIB_TEXTBOX::compare(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), KIGFX::DS_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), EDA_TEXT_DESC::EDA_TEXT_DESC(), EDA_TEXT::Format(), EDA_TEXT::getDrawFont(), LIB_FIELD::getDrawFont(), LIB_TEXT::getDrawFont(), LIB_TEXTBOX::getDrawFont(), SCH_FIELD::getDrawFont(), SCH_TEXT::getDrawFont(), SCH_TEXTBOX::getDrawFont(), EDA_TEXT::GetEffectiveTextPenWidth(), LIB_TEXTBOX::GetMsgPanelInfo(), GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_TEXTBOX::GetMsgPanelInfo(), SCH_FIELD::GetRenderCache(), LIB_TEXTBOX::GetShownText(), SCH_TEXTBOX::GetShownText(), FP_TEXTBOX::GetShownText(), PCB_TEXTBOX::GetShownText(), EDA_TEXT::GetTextBox(), EDA_TEXT::GetTextStyleName(), hash_fp_item(), EDA_TEXT::IsDefaultFormatting(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), PCB_PARSER::parseEDA_TEXT(), SCH_SEXPR_PARSER::parseEDA_TEXT(), SCH_FIELD::Plot(), Plot(), SCH_TEXT::Plot(), SCH_TEXTBOX::Plot(), LIB_FIELD::Plot(), LIB_TEXT::Plot(), LIB_TEXTBOX::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), SCH_FIELD::Print(), LIB_FIELD::print(), LIB_TEXT::print(), LIB_TEXTBOX::print(), SCH_TEXT::Print(), EDA_TEXT::printOneLineOfText(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), textsNeedUpdate(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow().

◆ IsBrightened()

◆ IsConnectable()

◆ IsConnected()

bool SCH_ITEM::IsConnected ( const VECTOR2I aPoint) const
inherited

Test the item to see if it is connected to aPoint.

Parameters
aPointis a reference to a VECTOR2I object containing the coordinates to test.
Returns
True if connection to aPoint exists.

Definition at line 137 of file sch_item.cpp.

138{
139 if(( m_flags & STRUCT_DELETED ) || ( m_flags & SKIP_STRUCT ) )
140 return false;
141
142 return doIsConnected( aPosition );
143}
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_item.h:488

References SCH_ITEM::doIsConnected(), EDA_ITEM::m_flags, SKIP_STRUCT, and STRUCT_DELETED.

Referenced by SCH_SCREEN::doIsJunction(), SCH_MOVE_TOOL::getConnectedItems(), SCH_SCREEN::IsTerminalPoint(), and SCH_SCREEN::MarkConnections().

◆ IsConnectivityDirty()

◆ IsDangling()

bool SCH_LABEL_BASE::IsDangling ( ) const
inlineoverridevirtual

Reimplemented from SCH_ITEM.

Definition at line 177 of file sch_label.h.

177{ return m_isDangling; }

References m_isDangling.

Referenced by KIGFX::SCH_PAINTER::draw().

◆ IsDefaultFormatting()

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 105 of file eda_item.h.

105{ return m_flags & IS_DRAGGING; }

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 108 of file eda_item.h.

108{ return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered

References ENTERED, and EDA_ITEM::m_flags.

Referenced by KIGFX::PCB_PAINTER::draw().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 203 of file eda_item.h.

203{ return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:499

References EDA_ITEM::m_forceVisible.

Referenced by KIGFX::SCH_PAINTER::draw(), and SCH_FIELD::Print().

◆ IsGotoPageHref()

bool EDA_TEXT::IsGotoPageHref ( const wxString &  aHref,
wxString *  aDestination = nullptr 
)
staticinherited

Check if aHref is a valid internal hyperlink.

Parameters
aHrefString to validate
aDestination[optional] pointer to populate with the destination page
Returns
true if aHref is a valid internal hyperlink. Does not check if the destination page actually exists.

Definition at line 998 of file eda_text.cpp.

999{
1000 return aHref.StartsWith( wxT( "#" ), aDestination );
1001}

Referenced by PDF_PLOTTER::EndPlot(), SCH_NAVIGATE_TOOL::HypertextCommand(), and EDA_TEXT::ValidateHyperlink().

◆ IsHypertext()

bool SCH_TEXT::IsHypertext ( ) const
inlineoverridevirtualinherited

Allow items to support hypertext actions when hovered/clicked.

Reimplemented from SCH_ITEM.

Definition at line 133 of file sch_text.h.

134 {
135 return HasHyperlink();
136 }

References EDA_TEXT::HasHyperlink().

Referenced by SCH_TEXT::DoHypertextAction(), and KIGFX::SCH_PAINTER::draw().

◆ IsItalic()

bool EDA_TEXT::IsItalic ( ) const
inlineinherited

Definition at line 130 of file eda_text.h.

130{ return m_attributes.m_Italic; }

References EDA_TEXT::m_attributes, and TEXT_ATTRIBUTES::m_Italic.

Referenced by BOARD_ADAPTER::addText(), SCH_DIRECTIVE_LABEL::AutoplaceFields(), SCH_EDIT_TOOL::ChangeTextType(), KI_TEST::CheckFpText(), LIB_TEXTBOX::compare(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), KIGFX::DS_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), EDA_TEXT_DESC::EDA_TEXT_DESC(), EDA_TEXT::Format(), EDA_TEXT::getDrawFont(), LIB_FIELD::getDrawFont(), LIB_TEXT::getDrawFont(), LIB_TEXTBOX::getDrawFont(), SCH_FIELD::getDrawFont(), SCH_TEXT::getDrawFont(), SCH_TEXTBOX::getDrawFont(), LIB_TEXTBOX::GetMsgPanelInfo(), GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_TEXTBOX::GetMsgPanelInfo(), SCH_FIELD::GetRenderCache(), LIB_TEXTBOX::GetShownText(), SCH_TEXTBOX::GetShownText(), FP_TEXTBOX::GetShownText(), PCB_TEXTBOX::GetShownText(), EDA_TEXT::GetTextBox(), EDA_TEXT::GetTextStyleName(), hash_fp_item(), EDA_TEXT::IsDefaultFormatting(), PCB_PARSER::parseEDA_TEXT(), SCH_SEXPR_PARSER::parseEDA_TEXT(), SCH_FIELD::Plot(), Plot(), SCH_TEXT::Plot(), SCH_TEXTBOX::Plot(), LIB_FIELD::Plot(), LIB_TEXT::Plot(), LIB_TEXTBOX::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), SCH_FIELD::Print(), LIB_FIELD::print(), LIB_TEXT::print(), LIB_TEXTBOX::print(), SCH_TEXT::Print(), EDA_TEXT::printOneLineOfText(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN::saveText(), textsNeedUpdate(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow().

◆ IsKeepUpright()

bool EDA_TEXT::IsKeepUpright ( ) const
inlineinherited

◆ IsLocked()

virtual bool SCH_ITEM::IsLocked ( ) const
inlinevirtualinherited
Returns
true if the object is locked, else false.

Definition at line 229 of file sch_item.h.

229{ return false; }

◆ IsMirrored()

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 102 of file eda_item.h.

102{ return m_flags & IS_CHANGED; }

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMovableFromAnchorPoint()

virtual bool SCH_ITEM::IsMovableFromAnchorPoint ( ) const
inlinevirtualinherited
Returns
true for items which are moved with the anchor point at mouse cursor 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)

Reimplemented in SCH_BITMAP, SCH_BUS_ENTRY_BASE, SCH_SHEET, SCH_SHEET_PIN, and SCH_SYMBOL.

Definition at line 207 of file sch_item.h.

207{ return true; }

Referenced by SCH_MOVE_TOOL::Main().

◆ IsMoving()

◆ IsMultilineAllowed()

bool EDA_TEXT::IsMultilineAllowed ( ) const
inlineinherited

◆ IsNew()

◆ IsPointClickableAnchor()

virtual bool SCH_ITEM::IsPointClickableAnchor ( const VECTOR2I aPos) const
inlinevirtualinherited
Returns
true if the given point can start drawing (usually means the anchor is unused/free/dangling).

Reimplemented in SCH_BUS_ENTRY_BASE, SCH_JUNCTION, SCH_LABEL, SCH_GLOBALLABEL, SCH_HIERLABEL, SCH_LINE, SCH_PIN, SCH_SHEET_PIN, and SCH_SYMBOL.

Definition at line 355 of file sch_item.h.

355{ return false; }

Referenced by EE_SELECTION_TOOL::autostartEvent().

◆ IsReplaceable()

virtual bool SCH_TEXT::IsReplaceable ( ) const
inlineoverridevirtualinherited

Override this method in any derived object that supports test find and replace.

Returns
True if the item has replaceable text that can be modified using the find and replace dialog.

Reimplemented from EDA_ITEM.

Reimplemented in SCH_LABEL, and SCH_SHEET_PIN.

Definition at line 195 of file sch_text.h.

195{ return true; }

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 109 of file eda_item.h.

109{ return m_flags & IS_RESIZING; }

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsRollover()

bool EDA_ITEM::IsRollover ( ) const
inlineinherited

Definition at line 112 of file eda_item.h.

113 {
114 return ( m_flags & ( IS_ROLLOVER | IS_MOVING ) ) == IS_ROLLOVER;
115 }
#define IS_ROLLOVER
Rollover active. Used for hyperlink highlighting.

References IS_MOVING, IS_ROLLOVER, and EDA_ITEM::m_flags.

Referenced by KIGFX::SCH_PAINTER::draw().

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 107 of file eda_item.h.

107{ return m_flags & SELECTED; }

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_TOOL::ChangeTextType(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), EDIT_TOOL::doMoveSelection(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_SCREEN::MarkConnections(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), KIGFX::SCH_PAINTER::nonCached(), SCH_MOVE_TOOL::orthoLineDrag(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), EE_SELECTION_TOOL::RebuildSelection(), PCB_SELECTION_TOOL::RebuildSelection(), RENDER_3D_OPENGL::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< T >::saveCopyInUndoList(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), PCB_BASE_EDIT_FRAME::unitsChangeRefresh(), GERBVIEW_SELECTION_TOOL::unselect(), HIERARCHY_NAVIG_PANEL::UpdateHierarchySelection(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ IsShownAsBitmap()

bool EDA_ITEM::IsShownAsBitmap ( ) const
inlineinherited

Definition at line 175 of file eda_item.h.

175{ return m_flags & IS_SHOWN_AS_BITMAP; }
#define IS_SHOWN_AS_BITMAP

References IS_SHOWN_AS_BITMAP, and EDA_ITEM::m_flags.

◆ IsType()

bool SCH_LABEL_BASE::IsType ( const std::vector< KICAD_T > &  aScanTypes) const
overridevirtual

Check whether the item is one of the listed types.

Parameters
aScanTypesList of item types
Returns
true if the item type is contained in the list aScanTypes

Reimplemented from SCH_ITEM.

Definition at line 196 of file sch_label.cpp.

197{
198 if( SCH_TEXT::IsType( aScanTypes ) )
199 return true;
200
201 for( KICAD_T scanType : aScanTypes )
202 {
203 if( scanType == SCH_LABEL_LOCATE_ANY_T )
204 return true;
205 }
206
207 wxCHECK_MSG( Schematic(), false, wxT( "No parent SCHEMATIC set for SCH_LABEL!" ) );
208
209 // Ensure m_connected_items for Schematic()->CurrentSheet() exists.
210 // Can be not the case when "this" is living in clipboard
211 if( m_connected_items.find( Schematic()->CurrentSheet() ) == m_connected_items.end() )
212 return false;
213
214 const SCH_ITEM_SET& item_set = m_connected_items.at( Schematic()->CurrentSheet() );
215
216 for( KICAD_T scanType : aScanTypes )
217 {
218 if( scanType == SCH_LABEL_LOCATE_WIRE_T )
219 {
220 for( SCH_ITEM* connection : item_set )
221 {
222 if( connection->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_PIN_T } ) )
223 return true;
224 }
225 }
226
227 if ( scanType == SCH_LABEL_LOCATE_BUS_T )
228 {
229 for( SCH_ITEM* connection : item_set )
230 {
231 if( connection->IsType( { SCH_ITEM_LOCATE_BUS_T } ) )
232 return true;
233 }
234 }
235 }
236
237 return false;
238}
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: sch_item.h:162
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_LABEL_LOCATE_ANY_T
Definition: typeinfo.h:175
@ SCH_LABEL_LOCATE_WIRE_T
Definition: typeinfo.h:176
@ SCH_LABEL_LOCATE_BUS_T
Definition: typeinfo.h:177

References SCH_ITEM::IsType(), SCH_ITEM::m_connected_items, SCH_LABEL_LOCATE_ANY_T, SCH_LABEL_LOCATE_BUS_T, SCH_LABEL_LOCATE_WIRE_T, and SCH_ITEM::Schematic().

Referenced by Visit().

◆ IsVisible()

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 106 of file eda_item.h.

106{ return m_flags & IS_WIRE_IMAGE; }

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

template<class T >
static INSPECT_RESULT EDA_ITEM::IterateForward ( std::deque< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  scanTypes 
)
inlinestaticinherited

This changes first parameter to avoid the DList and use the main queue instead.

Definition at line 304 of file eda_item.h.

306 {
307 for( const auto& it : aList )
308 {
309 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
310 testData,
311 scanTypes ) == INSPECT_RESULT::QUIT )
312 {
314 }
315 }
316
318 }
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

References CONTINUE, QUIT, and EDA_ITEM::Visit().

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

template<class T >
static INSPECT_RESULT EDA_ITEM::IterateForward ( std::vector< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  scanTypes 
)
inlinestaticinherited

Change first parameter to avoid the DList and use std::vector instead.

Definition at line 324 of file eda_item.h.

326 {
327 for( const auto& it : aList )
328 {
329 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
330 testData,
331 scanTypes ) == INSPECT_RESULT::QUIT )
332 {
334 }
335 }
336
338 }

References CONTINUE, QUIT, and EDA_ITEM::Visit().

◆ MapHorizJustify()

GR_TEXT_H_ALIGN_T EDA_TEXT::MapHorizJustify ( int  aHorizJustify)
staticinherited

Definition at line 62 of file eda_text.cpp.

63{
64 wxASSERT( aHorizJustify >= GR_TEXT_H_ALIGN_LEFT && aHorizJustify <= GR_TEXT_H_ALIGN_RIGHT );
65
66 if( aHorizJustify > GR_TEXT_H_ALIGN_RIGHT )
68
69 if( aHorizJustify < GR_TEXT_H_ALIGN_LEFT )
71
72 return static_cast<GR_TEXT_H_ALIGN_T>( aHorizJustify );
73}
GR_TEXT_H_ALIGN_T

References GR_TEXT_H_ALIGN_LEFT, and GR_TEXT_H_ALIGN_RIGHT.

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_LIB_FIELD_PROPERTIES::UpdateField(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

◆ MapVertJustify()

GR_TEXT_V_ALIGN_T EDA_TEXT::MapVertJustify ( int  aVertJustify)
staticinherited

Definition at line 76 of file eda_text.cpp.

77{
78 wxASSERT( aVertJustify >= GR_TEXT_V_ALIGN_TOP && aVertJustify <= GR_TEXT_V_ALIGN_BOTTOM );
79
80 if( aVertJustify > GR_TEXT_V_ALIGN_BOTTOM )
82
83 if( aVertJustify < GR_TEXT_V_ALIGN_TOP )
85
86 return static_cast<GR_TEXT_V_ALIGN_T>( aVertJustify );
87}
GR_TEXT_V_ALIGN_T

References GR_TEXT_V_ALIGN_BOTTOM, and GR_TEXT_V_ALIGN_TOP.

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_LIB_FIELD_PROPERTIES::UpdateField(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

◆ Matches() [1/2]

bool SCH_LABEL_BASE::Matches ( const EDA_SEARCH_DATA aSearchData,
void *  aAuxData 
) const
overridevirtual

Compare the item against the search criteria in aSearchData.

The base class returns false since many of the objects derived from EDA_ITEM do not have any text to search.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented from EDA_ITEM.

Reimplemented in SCH_SHEET_PIN.

Definition at line 602 of file sch_label.cpp.

603{
604 return SCH_ITEM::Matches( UnescapeString( GetText() ), aSearchData );
605}
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:384

References EDA_TEXT::GetText(), EDA_ITEM::Matches(), and UnescapeString().

◆ Matches() [2/2]

bool EDA_ITEM::Matches ( const wxString &  aText,
const EDA_SEARCH_DATA aSearchData 
) const
protectedinherited

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

Parameters
aTextA reference to a wxString object containing the string to test.
aSearchDataThe criteria to search against.
Returns
True if aText matches the search criteria in aSearchData.

Definition at line 117 of file eda_item.cpp.

118{
119 wxString text = aText;
120 wxString searchText = aSearchData.findString;
121
122 // Don't match if searching for replaceable item and the item doesn't support text replace.
123 if( aSearchData.searchAndReplace && !IsReplaceable() )
124 return false;
125
126 if( !aSearchData.matchCase )
127 {
128 text.MakeUpper();
129 searchText.MakeUpper();
130 }
131
133 {
134 int ii = 0;
135
136 while( ii < (int) text.length() )
137 {
138 int next = text.find( searchText, ii );
139
140 if( next == wxNOT_FOUND )
141 return false;
142
143 ii = next;
144 next += searchText.length();
145
146 bool startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
147 bool endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
148
149 if( startOK && endOK )
150 return true;
151 else
152 ii++;
153 }
154
155 return false;
156 }
157 else if( aSearchData.matchMode == EDA_SEARCH_MATCH_MODE::WILDCARD )
158 {
159 return text.Matches( searchText );
160 }
161 else
162 {
163 return text.Find( searchText ) != wxNOT_FOUND;
164 }
165}
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:422
CITER next(CITER it)
Definition: ptree.cpp:126
EDA_SEARCH_MATCH_MODE matchMode

References EDA_SEARCH_DATA::findString, EDA_ITEM::IsReplaceable(), EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::searchAndReplace, text, WHOLEWORD, and WILDCARD.

◆ MirrorHorizontally()

void SCH_TEXT::MirrorHorizontally ( int  aCenter)
overridevirtualinherited

Mirror item horizontally about aCenter.

Implements SCH_ITEM.

Definition at line 140 of file sch_text.cpp.

141{
142 // Text is NOT really mirrored; it is moved to a suitable horizontal position
143 SetTextSpinStyle( GetTextSpinStyle().MirrorY() );
144
145 SetTextX( MIRRORVAL( GetTextPos().x, aCenter ) );
146}
void SetTextX(int aX)
Definition: eda_text.cpp:377
virtual void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:188
T MIRRORVAL(T aPoint, T aMirrorRef)
Returns the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:31

References EDA_TEXT::GetTextPos(), SCH_TEXT::GetTextSpinStyle(), MIRRORVAL(), SCH_TEXT::SetTextSpinStyle(), and EDA_TEXT::SetTextX().

Referenced by SCH_GLOBALLABEL::MirrorHorizontally().

◆ MirrorSpinStyle()

void SCH_TEXT::MirrorSpinStyle ( bool  aLeftRight)
virtualinherited

Reimplemented in SCH_GLOBALLABEL.

Definition at line 179 of file sch_text.cpp.

180{
181 if( aLeftRight )
182 SetTextSpinStyle( GetTextSpinStyle().MirrorY() );
183 else
184 SetTextSpinStyle( GetTextSpinStyle().MirrorX() );
185}

References SCH_TEXT::GetTextSpinStyle(), and SCH_TEXT::SetTextSpinStyle().

Referenced by SCH_EDIT_TOOL::Mirror(), and SCH_GLOBALLABEL::MirrorSpinStyle().

◆ MirrorVertically()

void SCH_TEXT::MirrorVertically ( int  aCenter)
overridevirtualinherited

Mirror item vertically about aCenter.

Implements SCH_ITEM.

Definition at line 149 of file sch_text.cpp.

150{
151 // Text is NOT really mirrored; it is moved to a suitable vertical position
152 SetTextSpinStyle( GetTextSpinStyle().MirrorX() );
153
154 SetTextY( MIRRORVAL( GetTextPos().y, aCenter ) );
155}
void SetTextY(int aY)
Definition: eda_text.cpp:383

References EDA_TEXT::GetTextPos(), SCH_TEXT::GetTextSpinStyle(), MIRRORVAL(), SCH_TEXT::SetTextSpinStyle(), and EDA_TEXT::SetTextY().

Referenced by SCH_GLOBALLABEL::MirrorVertically().

◆ Move()

void SCH_LABEL_BASE::Move ( const VECTOR2I aMoveVector)
inlineoverridevirtual

Move the item by aMoveVector to a new position.

Implements SCH_ITEM.

Reimplemented in SCH_SHEET_PIN.

Definition at line 110 of file sch_label.h.

111 {
112 SCH_TEXT::Move( aMoveVector );
113
114 for( SCH_FIELD& field : m_fields )
115 field.Offset( aMoveVector );
116 }
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_text.h:173

References m_fields, and SCH_TEXT::Move().

Referenced by SCH_MOVE_TOOL::moveItem().

◆ Offset()

◆ operator<() [1/2]

bool EDA_ITEM::operator< ( const EDA_ITEM aItem) const
inherited

Test if another item is less than this object.

Parameters
aItem- Item to compare against.
Returns
- True if aItem is less than the item.

Definition at line 231 of file eda_item.cpp.

232{
233 wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
234 GetClass() ) );
235
236 return false;
237}
virtual wxString GetClass() const =0
Return the class name.

References Format(), and EDA_ITEM::GetClass().

◆ operator<() [2/2]

bool SCH_TEXT::operator< ( const SCH_ITEM aItem) const
overridevirtualinherited

Reimplemented from SCH_ITEM.

Definition at line 238 of file sch_text.cpp.

239{
240 if( Type() != aItem.Type() )
241 return Type() < aItem.Type();
242
243 auto other = static_cast<const SCH_TEXT*>( &aItem );
244
245 if( GetLayer() != other->GetLayer() )
246 return GetLayer() < other->GetLayer();
247
248 if( GetPosition().x != other->GetPosition().x )
249 return GetPosition().x < other->GetPosition().x;
250
251 if( GetPosition().y != other->GetPosition().y )
252 return GetPosition().y < other->GetPosition().y;
253
254 return GetText() < other->GetText();
255}
VECTOR2I GetPosition() const override
Definition: sch_text.h:203

References SCH_ITEM::GetLayer(), SCH_TEXT::GetPosition(), EDA_TEXT::GetText(), EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ Plot()

void SCH_LABEL_BASE::Plot ( PLOTTER aPlotter,
bool  aBackground 
) const
overridevirtual

Plot the schematic item to aPlotter.

Parameters
aPlotteris the PLOTTER object to plot to.
aBackgrounda poor-man's Z-order. The routine will get called twice, first with aBackground true and then with aBackground false.

Reimplemented from SCH_ITEM.

Definition at line 919 of file sch_label.cpp.

920{
921 static std::vector<VECTOR2I> s_poly;
922
923 RENDER_SETTINGS* settings = aPlotter->RenderSettings();
924 SCH_CONNECTION* connection = Connection();
925 int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
926 COLOR4D color = settings->GetLayerColor( layer );
927 int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
928
929 if( aPlotter->GetColorMode() && GetTextColor() != COLOR4D::UNSPECIFIED )
931
932 penWidth = std::max( penWidth, settings->GetMinPenWidth() );
933 aPlotter->SetCurrentLineWidth( penWidth );
934
935 KIFONT::FONT* font = GetFont();
936
937 if( !font )
938 font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
939
940 VECTOR2I textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
941 CreateGraphicShape( aPlotter->RenderSettings(), s_poly, GetTextPos() );
942
943 if( aBackground )
944 {
945 // No filled shapes (yet)
946 }
947 else
948 {
949 aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
950 GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold(),
951 false, font );
952
953 if( s_poly.size() )
954 aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
955
956 // Plot attributes to a hypertext menu
957 std::vector<wxString> properties;
958
959 if( connection )
960 {
961 properties.emplace_back(
962 wxString::Format( wxT( "!%s = %s" ), _( "Net" ), connection->Name() ) );
963
964 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), _( "Resolved netclass" ),
965 GetEffectiveNetClass()->GetName() ) );
966 }
967
968 for( const SCH_FIELD& field : GetFields() )
969 {
970 properties.emplace_back(
971 wxString::Format( wxT( "!%s = %s" ), field.GetName(), field.GetShownText() ) );
972 }
973
974 if( !properties.empty() )
975 aPlotter->HyperlinkMenu( GetBodyBoundingBox(), properties );
976
977 if( Type() == SCH_HIER_LABEL_T )
978 {
979 aPlotter->Bookmark( GetBodyBoundingBox(), GetShownText(), _( "Hierarchical Labels" ) );
980 }
981 }
982
983 for( const SCH_FIELD& field : m_fields )
984 field.Plot( aPlotter, aBackground );
985}
int color
Definition: DXF_plotter.cpp:57
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
virtual void Text(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aPenWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, void *aData=nullptr)
Draw text with the plotter.
Definition: plotter.cpp:714
virtual void Bookmark(const BOX2I &aBox, const wxString &aName, const wxString &aGroupName=wxEmptyString)
Create a bookmark to a symbol.
Definition: plotter.h:457
bool GetColorMode() const
Definition: plotter.h:138
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)=0
Draw a polygon ( filled or not ).
virtual void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
Create a clickable hyperlink menu with a rectangular click area.
Definition: plotter.h:446
wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
Definition: sch_label.cpp:560
std::vector< SCH_FIELD > & GetFields()
Definition: sch_label.h:90

References _, PLOTTER::Bookmark(), color, SCH_ITEM::Connection(), CreateGraphicShape(), Format(), GetBodyBoundingBox(), PLOTTER::GetColorMode(), KIGFX::RENDER_SETTINGS::GetDefaultFont(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), SCH_ITEM::GetEffectiveNetClass(), EDA_TEXT::GetEffectiveTextPenWidth(), GetFields(), EDA_TEXT::GetFont(), KIFONT::FONT::GetFont(), EDA_TEXT::GetHorizJustify(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::RENDER_SETTINGS::GetMinPenWidth(), GetSchematicTextOffset(), GetShownText(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextColor(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetVertJustify(), PLOTTER::HyperlinkMenu(), EDA_TEXT::IsBold(), SCH_CONNECTION::IsBus(), EDA_TEXT::IsItalic(), LAYER_BUS, m_fields, SCH_ITEM::m_layer, SCH_CONNECTION::Name(), NO_FILL, PLOTTER::PlotPoly(), PLOTTER::RenderSettings(), SCH_HIER_LABEL_T, PLOTTER::SetCurrentLineWidth(), PLOTTER::Text(), and EDA_ITEM::Type().

◆ Print() [1/2]

void EDA_TEXT::Print ( const RENDER_SETTINGS aSettings,
const VECTOR2I aOffset,
const COLOR4D aColor,
OUTLINE_MODE  aDisplay_mode = FILLED 
)
inherited

Print this text object to the device context aDC.

Parameters
aDCthe current Device Context.
aOffsetdraw offset (usually (0,0)).
aColortext color.
aDisplay_modeFILLED or SKETCH.

Definition at line 648 of file eda_text.cpp.

650{
651 if( IsMultilineAllowed() )
652 {
653 std::vector<VECTOR2I> positions;
654 wxArrayString strings;
655 wxStringSplit( GetShownText(), strings, '\n' );
656
657 positions.reserve( strings.Count() );
658
659 GetLinePositions( positions, strings.Count() );
660
661 for( unsigned ii = 0; ii < strings.Count(); ii++ )
662 printOneLineOfText( aSettings, aOffset, aColor, aFillMode, strings[ii], positions[ii] );
663 }
664 else
665 {
666 printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetDrawPos() );
667 }
668}
void printOneLineOfText(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, const COLOR4D &aColor, OUTLINE_MODE aFillMode, const wxString &aText, const VECTOR2I &aPos)
Print each line of this EDA_TEXT.
Definition: eda_text.cpp:711
void GetLinePositions(std::vector< VECTOR2I > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
Definition: eda_text.cpp:671

References EDA_TEXT::GetDrawPos(), EDA_TEXT::GetLinePositions(), EDA_TEXT::GetShownText(), EDA_TEXT::IsMultilineAllowed(), EDA_TEXT::printOneLineOfText(), and wxStringSplit().

Referenced by Print(), SCH_TEXT::Print(), SCH_TEXTBOX::Print(), and DS_DRAW_ITEM_TEXT::PrintWsItem().

◆ Print() [2/2]

void SCH_LABEL_BASE::Print ( const RENDER_SETTINGS aSettings,
const VECTOR2I aOffset 
)
overridevirtual

Print a schematic item.

Each schematic item should have its own method

Parameters
aOffsetis the drawing offset (usually {0,0} but can be different when moving an object).

Implements SCH_ITEM.

Reimplemented in SCH_SHEET_PIN.

Definition at line 988 of file sch_label.cpp.

989{
990 static std::vector<VECTOR2I> s_poly;
991
992 SCH_CONNECTION* connection = Connection();
993 int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
994 wxDC* DC = aSettings->GetPrintDC();
995 COLOR4D color = aSettings->GetLayerColor( layer );
996 bool blackAndWhiteMode = GetGRForceBlackPenState();
997 int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
998 VECTOR2I text_offset = aOffset + GetSchematicTextOffset( aSettings );
999
1000 if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
1001 color = GetTextColor();
1002
1003 EDA_TEXT::Print( aSettings, text_offset, color );
1004
1005 CreateGraphicShape( aSettings, s_poly, GetTextPos() + aOffset );
1006
1007 if( !s_poly.empty() )
1008 GRPoly( DC, s_poly.size(), &s_poly[0], false, penWidth, color, color );
1009
1010 for( SCH_FIELD& field : m_fields )
1011 field.Print( aSettings, aOffset );
1012}
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, const COLOR4D &aColor, OUTLINE_MODE aDisplay_mode=FILLED)
Print this text object to the device context aDC.
Definition: eda_text.cpp:648
wxDC * GetPrintDC() const
void GRPoly(wxDC *DC, int n, const VECTOR2I *Points, bool Fill, int width, const COLOR4D &Color, const COLOR4D &BgColor)
Draw a new polyline and fill it if Fill, in drawing space.
Definition: gr_basic.cpp:332
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:156

References color, SCH_ITEM::Connection(), CreateGraphicShape(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), GetGRForceBlackPenState(), KIGFX::RENDER_SETTINGS::GetLayerColor(), SCH_TEXT::GetPenWidth(), KIGFX::RENDER_SETTINGS::GetPrintDC(), GetSchematicTextOffset(), EDA_TEXT::GetTextColor(), EDA_TEXT::GetTextPos(), GRPoly(), SCH_CONNECTION::IsBus(), LAYER_BUS, m_fields, SCH_ITEM::m_layer, and EDA_TEXT::Print().

Referenced by SCH_SHEET_PIN::Print().

◆ PrintBackground()

virtual void SCH_ITEM::PrintBackground ( const RENDER_SETTINGS aSettings,
const VECTOR2I aOffset 
)
inlinevirtualinherited

Print the (optional) backaground elements if they exist.

Parameters
aSettingsPrint settings
aOffsetis the drawing offset (usually {0,0} but can be different when moving an object).

Reimplemented in SCH_SHAPE, and SCH_SYMBOL.

Definition at line 286 of file sch_item.h.

286{};

◆ printOneLineOfText()

void EDA_TEXT::printOneLineOfText ( const RENDER_SETTINGS aSettings,
const VECTOR2I aOffset,
const COLOR4D aColor,
OUTLINE_MODE  aFillMode,
const wxString &  aText,
const VECTOR2I aPos 
)
protectedinherited

Print each line of this EDA_TEXT.

Parameters
aOffsetdraw offset (usually (0,0)).
aColortext color.
aFillModeFILLED or SKETCH
aTextthe single line of text to draw.
aPosthe position of this line ).

Definition at line 711 of file eda_text.cpp.

714{
715 wxDC* DC = aSettings->GetPrintDC();
716 int penWidth = GetEffectiveTextPenWidth( aSettings->GetDefaultPenWidth() );
717
718 if( aFillMode == SKETCH )
719 penWidth = -penWidth;
720
721 VECTOR2I size = GetTextSize();
722
723 if( IsMirrored() )
724 size.x = -size.x;
725
726 KIFONT::FONT* font = GetFont();
727
728 if( !font )
729 font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
730
731 GRPrintText( DC, aOffset + aPos, aColor, aText, GetDrawRotation(), size, GetHorizJustify(),
732 GetVertJustify(), penWidth, IsItalic(), IsBold(), font );
733}
void GRPrintText(wxDC *aDC, const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, KIFONT::FONT *aFont)
Print a graphic text through wxDC.
Definition: gr_text.cpp:129
@ SKETCH
Definition: outline_mode.h:26

References KIGFX::RENDER_SETTINGS::GetDefaultFont(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), EDA_TEXT::GetDrawRotation(), EDA_TEXT::GetEffectiveTextPenWidth(), EDA_TEXT::GetFont(), KIFONT::FONT::GetFont(), EDA_TEXT::GetHorizJustify(), KIGFX::RENDER_SETTINGS::GetPrintDC(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetVertJustify(), GRPrintText(), EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), EDA_TEXT::IsMirrored(), SKETCH, and VECTOR2< T >::x.

Referenced by EDA_TEXT::Print().

◆ RemoveHyperlink()

void EDA_TEXT::RemoveHyperlink ( )
inlineinherited

Definition at line 336 of file eda_text.h.

336{ m_hyperlink = wxEmptyString; }

References EDA_TEXT::m_hyperlink.

◆ RenderAsBitmap()

bool SCH_ITEM::RenderAsBitmap ( double  aWorldScale) const
overridevirtualinherited

Reimplemented from EDA_ITEM.

Definition at line 294 of file sch_item.cpp.

295{
296 if( IsHypertext() )
297 return false;
298
299 if( const EDA_TEXT* text = dynamic_cast<const EDA_TEXT*>( this ) )
300 return text->GetTextHeight() * aWorldScale < BITMAP_FONT_SIZE_THRESHOLD;
301
302 return false;
303}
virtual bool IsHypertext() const
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_item.h:239
#define BITMAP_FONT_SIZE_THRESHOLD
Definition: sch_item.cpp:46

References BITMAP_FONT_SIZE_THRESHOLD, SCH_ITEM::IsHypertext(), and text.

Referenced by KIGFX::SCH_PAINTER::draw().

◆ Replace() [1/3]

bool EDA_TEXT::Replace ( const EDA_SEARCH_DATA aSearchData)
inherited

Helper function used in search and replace dialog.

Perform a text replace using the find and replace criteria in aSearchData.

Parameters
aSearchDataA reference to a EDA_SEARCH_DATA object containing the search and replace criteria.
Returns
True if the text item was modified, otherwise false.

Definition at line 318 of file eda_text.cpp.

319{
320 bool retval = EDA_ITEM::Replace( aSearchData, m_text );
321
323
326
327 return retval;
328}
static bool Replace(const EDA_SEARCH_DATA &aSearchData, wxString &aText)
Perform a text replace on aText using the find and replace criteria in aSearchData on items that supp...
Definition: eda_item.cpp:168
void cacheShownText()
Definition: eda_text.cpp:408

References EDA_TEXT::cacheShownText(), EDA_TEXT::ClearRenderCache(), EDA_TEXT::m_bounding_box_cache_valid, EDA_TEXT::m_text, and EDA_ITEM::Replace().

Referenced by LIB_TEXTBOX::Replace(), Replace(), SCH_TEXT::Replace(), SCH_TEXTBOX::Replace(), SCH_FIELD::Replace(), and SCH_SHEET_PIN::Replace().

◆ Replace() [2/3]

bool SCH_LABEL_BASE::Replace ( const EDA_SEARCH_DATA aSearchData,
void *  aAuxData 
)
overridevirtual

Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

This function must be overridden for items that support text replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item text was modified, otherwise false.

Reimplemented from EDA_ITEM.

Reimplemented in SCH_SHEET_PIN.

Definition at line 608 of file sch_label.cpp.

609{
610 EDA_SEARCH_DATA localSearchData( aSearchData );
611 localSearchData.findString = EscapeString( aSearchData.findString, CTX_NETNAME );
612 localSearchData.replaceString = EscapeString( aSearchData.replaceString, CTX_NETNAME );
613
614 return EDA_TEXT::Replace( localSearchData );
615}
bool Replace(const EDA_SEARCH_DATA &aSearchData)
Helper function used in search and replace dialog.
Definition: eda_text.cpp:318
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_NETNAME
Definition: string_utils.h:54
wxString replaceString

References CTX_NETNAME, EscapeString(), EDA_SEARCH_DATA::findString, EDA_TEXT::Replace(), and EDA_SEARCH_DATA::replaceString.

◆ Replace() [3/3]

bool EDA_ITEM::Replace ( const EDA_SEARCH_DATA aSearchData,
wxString &  aText 
)
staticinherited

Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aTextA reference to a wxString object containing the text to be replaced.
Returns
True if aText was modified, otherwise false.

Definition at line 168 of file eda_item.cpp.

169{
170 wxString text = aText;
171 wxString searchText = aSearchData.findString;
172 wxString result;
173 bool replaced = false;
174
175 if( !aSearchData.matchCase )
176 {
177 text = text.Upper();
178 searchText = searchText.Upper();
179 }
180
181 int ii = 0;
182
183 while( ii < (int) text.length() )
184 {
185 int next = text.find( searchText, ii );
186
187 if( next == wxNOT_FOUND )
188 {
189 result += aText.Mid( ii, wxString::npos );
190 break;
191 }
192
193 if( next > ii )
194 result += aText.Mid( ii, next - ii );
195
196 ii = next;
197 next += searchText.length();
198
199 bool startOK;
200 bool endOK;
201
203 {
204 startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
205 endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
206 }
207 else
208 {
209 startOK = true;
210 endOK = true;
211 }
212
213 if( startOK && endOK )
214 {
215 result += aSearchData.replaceString;
216 replaced = true;
217 ii = next;
218 }
219 else
220 {
221 result += aText.GetChar( ii );
222 ii++;
223 }
224 }
225
226 aText = result;
227 return replaced;
228}

References EDA_SEARCH_DATA::findString, EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::replaceString, text, and WHOLEWORD.

Referenced by EDA_TEXT::Replace(), SCH_FIELD::Replace(), SCH_EDITOR_CONTROL::ReplaceAll(), and SCH_EDITOR_CONTROL::ReplaceAndFindNext().

◆ ResolveTextVar()

bool SCH_LABEL_BASE::ResolveTextVar ( wxString *  token,
int  aDepth 
) const
virtual

Reimplemented in SCH_GLOBALLABEL.

Definition at line 482 of file sch_label.cpp.

483{
484 if( token->Contains( ':' ) )
485 {
486 if( !Schematic() )
487 return false;
488
489 if( Schematic()->ResolveCrossReference( token, aDepth ) )
490 return true;
491 }
492
494 && token->IsSameAs( wxT( "CONNECTION_TYPE" ) ) )
495 {
496 const SCH_LABEL_BASE* label = static_cast<const SCH_LABEL_BASE*>( this );
497 *token = getElectricalTypeLabel( label->GetShape() );
498 return true;
499 }
500 else if( token->IsSameAs( wxT( "SHORT_NET_NAME" ) ) )
501 {
502 const SCH_CONNECTION* connection = Connection();
503 *token = wxEmptyString;
504
505 if( connection )
506 *token = connection->LocalName();
507
508 return true;
509 }
510 else if( token->IsSameAs( wxT( "NET_NAME" ) ) )
511 {
512 const SCH_CONNECTION* connection = Connection();
513 *token = wxEmptyString;
514
515 if( connection )
516 *token = connection->Name();
517
518 return true;
519 }
520 else if( token->IsSameAs( wxT( "NET_CLASS" ) ) )
521 {
522 const SCH_CONNECTION* connection = Connection();
523 *token = wxEmptyString;
524
525 if( connection )
526 *token = GetEffectiveNetClass()->GetName();
527
528 return true;
529 }
530
531 for( size_t i = 0; i < m_fields.size(); ++i )
532 {
533 if( token->IsSameAs( m_fields[i].GetName() ) )
534 {
535 *token = m_fields[i].GetShownText( aDepth + 1 );
536 return true;
537 }
538 }
539
540 if( Type() == SCH_SHEET_PIN_T && m_parent )
541 {
542 SCH_SHEET* sheet = static_cast<SCH_SHEET*>( m_parent );
543
544 if( sheet->ResolveTextVar( token, aDepth ) )
545 return true;
546 }
547 else if( Schematic() )
548 {
549 if( SCH_SHEET* sheet = Schematic()->CurrentSheet().Last() )
550 {
551 if( sheet->ResolveTextVar( token, aDepth ) )
552 return true;
553 }
554 }
555
556 return false;
557}
wxString LocalName() const
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:55
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
Definition: sch_sheet.cpp:233

References SCH_ITEM::Connection(), SCHEMATIC::CurrentSheet(), SCH_ITEM::GetEffectiveNetClass(), getElectricalTypeLabel(), GetShape(), SCH_SHEET_PATH::Last(), SCH_CONNECTION::LocalName(), m_fields, EDA_ITEM::m_parent, SCH_CONNECTION::Name(), SCH_SHEET::ResolveTextVar(), SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_SHEET_PIN_T, SCH_ITEM::Schematic(), and EDA_ITEM::Type().

Referenced by SCH_FIELD::GetShownText(), GetShownText(), and SCH_GLOBALLABEL::ResolveTextVar().

◆ Rotate()

void SCH_LABEL_BASE::Rotate ( const VECTOR2I aCenter)
overridevirtual

Rotate the item around aCenter 90 degrees in the clockwise direction.

Implements SCH_ITEM.

Reimplemented in SCH_SHEET_PIN.

Definition at line 294 of file sch_label.cpp.

295{
296 VECTOR2I pt = GetTextPos();
297 RotatePoint( pt, aCenter, ANGLE_90 );
298 VECTOR2I offset = pt - GetTextPos();
299
300 Rotate90( false );
301
302 SetTextPos( GetTextPos() + offset );
303
304 for( SCH_FIELD& field : m_fields )
305 field.SetTextPos( field.GetTextPos() + offset );
306}
void SetTextPos(const VECTOR2I &aPoint)
Definition: eda_text.cpp:371
void Rotate90(bool aClockwise) override
Definition: sch_label.cpp:309
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:414

References ANGLE_90, EDA_TEXT::GetTextPos(), m_fields, Rotate90(), RotatePoint(), and EDA_TEXT::SetTextPos().

◆ Rotate90()

void SCH_LABEL_BASE::Rotate90 ( bool  aClockwise)
overridevirtual

Reimplemented from SCH_TEXT.

Definition at line 309 of file sch_label.cpp.

310{
311 SCH_TEXT::Rotate90( aClockwise );
312
314 {
315 AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
316 }
317 else
318 {
319 for( SCH_FIELD& field : m_fields )
320 {
321 if( field.GetTextAngle().IsVertical()
322 && field.GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
323 {
324 if( !aClockwise )
325 field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
326
327 field.SetTextAngle( ANGLE_HORIZONTAL );
328 }
329 else if( field.GetTextAngle().IsVertical()
330 && field.GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
331 {
332 if( !aClockwise )
333 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
334
335 field.SetTextAngle( ANGLE_HORIZONTAL );
336 }
337 else if( field.GetTextAngle().IsHorizontal()
338 && field.GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
339 {
340 if( aClockwise )
341 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
342
343 field.SetTextAngle( ANGLE_VERTICAL );
344 }
345 else if( field.GetTextAngle().IsHorizontal()
346 && field.GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
347 {
348 if( aClockwise )
349 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
350
351 field.SetTextAngle( ANGLE_VERTICAL );
352 }
353
354 VECTOR2I pos = field.GetTextPos();
355 RotatePoint( pos, GetPosition(), aClockwise ? -ANGLE_90 : ANGLE_90 );
356 field.SetTextPos( pos );
357 }
358 }
359}
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_label.cpp:376
virtual void Rotate90(bool aClockwise)
Definition: sch_text.cpp:170

References ANGLE_90, ANGLE_HORIZONTAL, ANGLE_VERTICAL, AutoplaceFields(), FIELDS_AUTOPLACED_AUTO, SCH_TEXT::GetPosition(), GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, m_fields, SCH_ITEM::m_fieldsAutoplaced, SCH_TEXT::Rotate90(), and RotatePoint().

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), and Rotate().

◆ RunOnChildren()

void SCH_LABEL_BASE::RunOnChildren ( const std::function< void(SCH_ITEM *)> &  aFunction)
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 595 of file sch_label.cpp.

596{
597 for( SCH_FIELD& field : m_fields )
598 aFunction( &field );
599}

References m_fields.

◆ Schematic()

SCHEMATIC * SCH_ITEM::Schematic ( ) const
inherited

Searches the item hierarchy to find a SCHEMATIC.

Every SCH_ITEM that lives on a SCH_SCREEN should be parented to either that screen or another SCH_ITEM on the same screen (for example, pins to their symbols).

Every SCH_SCREEN should be parented to the SCHEMATIC.

Note
This hierarchy is not the same as the sheet hierarchy!
Returns
the parent schematic this item lives on, or nullptr.

Definition at line 112 of file sch_item.cpp.

113{
114 EDA_ITEM* parent = GetParent();
115
116 while( parent )
117 {
118 if( parent->Type() == SCHEMATIC_T )
119 return static_cast<SCHEMATIC*>( parent );
120 else
121 parent = parent->GetParent();
122 }
123
124 return nullptr;
125}
EDA_ITEM * GetParent() const
Definition: eda_item.h:99
@ SCHEMATIC_T
Definition: typeinfo.h:188

References EDA_ITEM::GetParent(), SCHEMATIC_T, and EDA_ITEM::Type().

Referenced by SCH_EDIT_TOOL::ChangeTextType(), SCH_ITEM::Connection(), SCH_DRAWING_TOOLS::createSheetPin(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), SCH_SHEET::findSelf(), SCH_MARKER::GetColorLayer(), SCH_ITEM::GetEffectiveNetClass(), SCH_JUNCTION::getEffectiveShape(), GetIntersheetRefs(), GetLabelBoxExpansion(), SCH_DIRECTIVE_LABEL::GetPenWidth(), SCH_LINE::GetPenWidth(), SCH_NO_CONNECT::GetPenWidth(), SCH_SHAPE::GetPenWidth(), SCH_SHEET::GetPenWidth(), SCH_SHEET_PIN::GetPenWidth(), SCH_SYMBOL::GetPins(), SCH_MARKER::GetSeverity(), SCH_FIELD::GetShownText(), GetShownText(), SCH_TEXT::GetShownText(), SCH_TEXTBOX::GetShownText(), SCH_TEXT::GetTextOffset(), SCH_PIN::HitTest(), SCH_SHEET::IsRootSheet(), IsType(), DIALOG_SYMBOL_PROPERTIES::OnAddField(), DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded(), DIALOG_TEXT_PROPERTIES::onScintillaCharAdded(), ResolveTextVar(), SCH_GLOBALLABEL::ResolveTextVar(), SCH_SHEET::ResolveTextVar(), SCH_SYMBOL::ResolveTextVar(), SCH_SYMBOL::SetRef(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), and SCH_MARKER::ViewGetLayers().

◆ Set() [1/3]

template<typename T >
bool INSPECTABLE::Set ( const wxString &  aProperty,
aValue 
)
inlineinherited

Definition at line 66 of file inspectable.h.

67 {
69 TYPE_ID thisType = TYPE_HASH( *this );
70 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
71 void* object = nullptr;
72
73 if( prop )
74 {
75 object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
76
77 if( object )
78 prop->set<T>( object, aValue );
79 }
80
81 return object != nullptr;
82 }
void set(void *aObject, T aValue)
Definition: property.h:275

References PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [2/3]

template<typename T >
bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
aValue 
)
inlineinherited

Definition at line 54 of file inspectable.h.

55 {
57 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
58
59 if( object )
60 aProperty->set<T>( object, aValue );
61
62 return object != nullptr;
63 }

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [3/3]

bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
wxAny &  aValue 
)
inlineinherited

Definition at line 42 of file inspectable.h.

43 {
45 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
46
47 if( object )
48 aProperty->setter( object, aValue );
49
50 return object != nullptr;
51 }
virtual void setter(void *aObject, wxAny &aValue)=0

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::setter(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by PCB_PROPERTIES_PANEL::valueChanged().

◆ SetAttributes() [1/2]

◆ SetAttributes() [2/2]

void EDA_TEXT::SetAttributes ( const TEXT_ATTRIBUTES aTextAttrs)
inlineinherited

Definition at line 171 of file eda_text.h.

171{ m_attributes = aTextAttrs; }

References EDA_TEXT::m_attributes.

◆ SetAutoRotateOnPlacement()

void SCH_LABEL_BASE::SetAutoRotateOnPlacement ( bool  autoRotate = true)

setAutoRotateOnPlacement

Parameters
autoRotateIf set to true when the label is placed in the connection to a pin/net the direction will be automatically set according to the positioning of the net/pin

Definition at line 1019 of file sch_label.cpp.

1020{
1021 m_autoRotateOnPlacement = autoRotate;
1022}

References m_autoRotateOnPlacement.

Referenced by SCH_DRAWING_TOOLS::createNewText(), and DIALOG_LABEL_PROPERTIES::TransferDataFromWindow().

◆ SetBold()

void EDA_TEXT::SetBold ( bool  aBold)
inherited

Definition at line 209 of file eda_text.cpp.

210{
211 m_attributes.m_Bold = aBold;
214}

References EDA_TEXT::ClearRenderCache(), EDA_TEXT::m_attributes, TEXT_ATTRIBUTES::m_Bold, and EDA_TEXT::m_bounding_box_cache_valid.

Referenced by SCH_ALTIUM_PLUGIN::AddTextBox(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), SCH_EDIT_TOOL::ChangeTextType(), ALTIUM_PCB::ConvertTexts6ToEdaTextSettings(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), DS_DRAW_ITEM_TEXT::DS_DRAW_ITEM_TEXT(), EDA_TEXT_DESC::EDA_TEXT_DESC(), ALTIUM_PCB::HelperParseDimensions6Linear(), ALTIUM_PCB::HelperParseDimensions6Radial(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), SCH_LEGACY_PLUGIN::loadSymbol(), SCH_EAGLE_PLUGIN::loadTextAttributes(), DIALOG_LABEL_PROPERTIES::OnAddField(), PCB_PARSER::parseEDA_TEXT(), SCH_SEXPR_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParseHarnessPort(), SCH_ALTIUM_PLUGIN::ParseLabel(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and DIALOG_FIELD_PROPERTIES::updateText().

◆ SetBrightened()

◆ SetConnectivityDirty()

◆ SetFields()

void SCH_LABEL_BASE::SetFields ( const std::vector< SCH_FIELD > &  aFields)
inline

Set multiple schematic fields.

Parameters
aFieldsare the fields to set in this symbol.

Definition at line 98 of file sch_label.h.

99 {
100 m_fields = aFields; // vector copying, length is changed possibly
101 }

References m_fields.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), and DIALOG_LABEL_PROPERTIES::TransferDataFromWindow().

◆ SetFieldsAutoplaced()

void SCH_ITEM::SetFieldsAutoplaced ( )
inlineinherited

◆ SetFlags()