KiCad PCB EDA Suite
SCH_HIERLABEL Class Reference

#include <sch_label.h>

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

Public Member Functions

 SCH_HIERLABEL (const VECTOR2I &aPos=VECTOR2I(0, 0), const wxString &aText=wxEmptyString, KICAD_T aType=SCH_HIER_LABEL_T)
 
 ~SCH_HIERLABEL ()
 
wxString GetClass () const override
 Return the class name. More...
 
void SetTextSpinStyle (TEXT_SPIN_STYLE aSpinStyle) override
 Set a spin or rotation angle, along with specific horizontal and vertical justification styles with each angle. 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...
 
void CreateGraphicShape (const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
 Calculate the graphic shape (a polygon) associated to the text. More...
 
void CreateGraphicShape (const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos, LABEL_FLAG_SHAPE aShape) const
 
const BOX2I GetBodyBoundingBox () const override
 Return the bounding box of the label only, without taking in account its fields. More...
 
bool IsConnectable () const override
 
wxString GetItemDescription (UNITS_PROVIDER *aUnitsProvider) const override
 Return a user-visible description string of this item. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
EDA_ITEMClone () const override
 Create a duplicate of this item with linked list members set to NULL. More...
 
bool IsPointClickableAnchor (const VECTOR2I &aPos) const override
 
bool AutoRotateOnPlacementSupported () const override
 AutoRotateOnPlacementSupported. 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...
 
void GetContextualTextVars (wxArrayString *aVars) const
 Return the list of system text vars & fields for this label. More...
 
virtual bool ResolveTextVar (wxString *token, int aDepth) const
 Resolve any references to system tokens supported by the label. More...
 
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...
 
bool Replace (const EDA_SEARCH_DATA &aSearchData)
 Helper function used in search and replace dialog. More...
 
int GetLabelBoxExpansion (const RENDER_SETTINGS *aSettings=nullptr) const
 
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...
 
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 AutoRotateOnPlacement () const
 autoRotateOnPlacement More...
 
void SetAutoRotateOnPlacement (bool autoRotate=true)
 setAutoRotateOnPlacement More...
 
bool IsHypertext () const override
 Allow items to support hypertext actions when hovered/clicked. More...
 
void DoHypertextAction (EDA_DRAW_FRAME *aFrame) const override
 
TEXT_SPIN_STYLE GetTextSpinStyle () const
 
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)
 
virtual bool IsReplaceable () const override
 Override this method in any derived object that supports test find and replace. More...
 
VECTOR2I GetPosition () const override
 
void SetPosition (const VECTOR2I &aPosition) override
 
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...
 
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 IsSelected () const
 
bool IsEntered () const
 
bool IsBrightened () const
 
bool IsRollover () const
 
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 XorFlags (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 bool ClassOf (const EDA_ITEM *aItem)
 
static const wxString GetDefaultFieldName (const wxString &aName, bool aUseDefaultName)
 
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

bool doIsConnected (const VECTOR2I &aPosition) const override
 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 391 of file sch_label.h.

Constructor & Destructor Documentation

◆ SCH_HIERLABEL()

SCH_HIERLABEL::SCH_HIERLABEL ( const VECTOR2I aPos = VECTOR2I( 0, 0 ),
const wxString &  aText = wxEmptyString,
KICAD_T  aType = SCH_HIER_LABEL_T 
)

Definition at line 1556 of file sch_label.cpp.

1556 :
1557 SCH_LABEL_BASE( pos, text, aType )
1558{
1561 m_isDangling = true;
1562}
SCH_LAYER_ID m_layer
Definition: sch_item.h:491
SCH_LABEL_BASE(const VECTOR2I &aPos, const wxString &aText, KICAD_T aType)
Definition: sch_label.cpp:155
bool m_isDangling
Definition: sch_label.h:224
LABEL_FLAG_SHAPE m_shape
Definition: sch_label.h:221
@ LAYER_HIERLABEL
Definition: layer_ids.h:349
@ L_INPUT
Definition: sch_text.h:97

References L_INPUT, LAYER_HIERLABEL, SCH_LABEL_BASE::m_isDangling, SCH_ITEM::m_layer, SCH_LABEL_BASE::m_shape, and text.

Referenced by Clone().

◆ ~SCH_HIERLABEL()

SCH_HIERLABEL::~SCH_HIERLABEL ( )
inline

Definition at line 399 of file sch_label.h.

399{ }

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 SCH_LABEL_BASE::UpdateDanglingState(), and CONNECTION_GRAPH::updateItemConnectivity().

◆ AddRenderCacheGlyph()

void EDA_TEXT::AddRenderCacheGlyph ( const SHAPE_POLY_SET aPoly)
inherited

Definition at line 493 of file eda_text.cpp.

494{
495 m_render_cache.emplace_back( std::make_unique<KIFONT::OUTLINE_GLYPH>( aPoly ) );
496}
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 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 
)
overridevirtualinherited

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( field.GetCanonicalName() == wxT( "Intersheetrefs" ) )
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( field.GetCanonicalName() == wxT( "Intersheetrefs" ) )
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( field.GetCanonicalName() == wxT( "Intersheetrefs" ) )
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( field.GetCanonicalName() == wxT( "Intersheetrefs" ) )
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( field.GetCanonicalName() != wxT( "Intersheetrefs" ) )
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
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:493
std::vector< SCH_FIELD > m_fields
Definition: sch_label.h:219
virtual const BOX2I GetBodyBoundingBox() const
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:709
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:425
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:426
@ 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, SCH_LABEL_BASE::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, SCH_LABEL_BASE::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(), SCH_LABEL_BASE::Rotate90(), and SCH_SHEET_PATH::UpdateAllScreenReferences().

◆ AutoRotateOnPlacement()

bool SCH_LABEL_BASE::AutoRotateOnPlacement ( ) const
inherited

autoRotateOnPlacement

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

Definition at line 1043 of file sch_label.cpp.

1044{
1046}
bool m_autoRotateOnPlacement
Definition: sch_label.h:225

References SCH_LABEL_BASE::m_autoRotateOnPlacement.

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

◆ AutoRotateOnPlacementSupported()

bool SCH_HIERLABEL::AutoRotateOnPlacementSupported ( ) const
inlineoverridevirtual

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

Implements SCH_LABEL_BASE.

Definition at line 438 of file sch_label.h.

438{ return true; }

◆ cacheShownText()

void EDA_TEXT::cacheShownText ( )
protectedinherited

Definition at line 410 of file eda_text.cpp.

411{
412 if( m_text.IsEmpty() )
413 {
414 m_shown_text = wxEmptyString;
416 }
417 else
418 {
420 m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
421 }
422
425}
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:440
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
inlineoverridevirtualinherited

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_HIERLABEL::ClassOf ( const EDA_ITEM aItem)
inlinestatic

Definition at line 401 of file sch_label.h.

402 {
403 return aItem && SCH_HIER_LABEL_T == aItem->Type();
404 }

References SCH_HIER_LABEL_T, and EDA_ITEM::Type().

◆ ClearBoundingBoxCache()

void EDA_TEXT::ClearBoundingBoxCache ( )
virtualinherited

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 119 of file eda_item.h.

void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:141
#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 141 of file eda_item.h.

141{ m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:498

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), SCH_EDIT_TOOL::BreakWire(), 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(), BOARD_COMMIT::dirtyIntersectingZones(), 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(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetIsShownAsBitmap(), BOARD_COMMIT::Stage(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and EE_SELECTION_TOOL::unhighlight().

◆ ClearRenderCache()

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 153 of file eda_item.h.

154 {
156 }
#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 SKIP_STRUCT
flag indicating that the structure should be ignored
#define CANDIDATE
flag indicating that the structure is connected

References CANDIDATE, EDA_ITEM::ClearFlags(), 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_HIERLABEL::Clone ( ) const
inlineoverridevirtual

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.

Reimplemented in SCH_SHEET_PIN.

Definition at line 428 of file sch_label.h.

429 {
430 return new SCH_HIERLABEL( *this );
431 }
SCH_HIERLABEL(const VECTOR2I &aPos=VECTOR2I(0, 0), const wxString &aText=wxEmptyString, KICAD_T aType=SCH_HIER_LABEL_T)
Definition: sch_label.cpp:1556

References SCH_HIERLABEL().

◆ Compare()

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

Definition at line 913 of file eda_text.cpp.

914{
915#define EPSILON 2 // Should be enough for rounding errors on calculated items
916
917#define TEST( a, b ) { if( a != b ) return a - b; }
918#define TEST_E( a, b ) { if( abs( a - b ) > EPSILON ) return a - b; }
919#define TEST_PT( a, b ) { TEST_E( a.x, b.x ); TEST_E( a.y, b.y ); }
920
921 TEST_PT( m_pos, aOther->m_pos );
922
927
937
938 int val = GetFontName().Cmp( aOther->GetFontName() );
939
940 if( val != 0 )
941 return val;
942
943 return m_text.Cmp( aOther->m_text );
944}
double AsDegrees() const
Definition: eda_angle.h:149
VECTOR2I m_pos
Definition: eda_text.h:407
wxString GetFontName() const
Definition: eda_text.cpp:759
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:122
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(), SCH_LABEL_BASE::GetMsgPanelInfo(), SCH_LINE::GetMsgPanelInfo(), SCH_PIN::GetMsgPanelInfo(), CONNECTION_SUBGRAPH::GetNetName(), SCH_ITEM::GetOrInitConnection(), highlightNet(), SCH_ITEM::InitializeConnection(), SCH_LABEL_BASE::Plot(), SCH_LINE::Plot(), SCH_TEXT::Plot(), SCH_LABEL_BASE::Print(), NETLIST_EXPORTER_SPICE_MODEL::readPorts(), SCH_EDIT_FRAME::RecalculateConnections(), SCH_LABEL_BASE::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() [1/2]

void SCH_HIERLABEL::CreateGraphicShape ( const RENDER_SETTINGS aSettings,
std::vector< VECTOR2I > &  aPoints,
const VECTOR2I Pos 
) const
overridevirtual

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 from SCH_LABEL_BASE.

Reimplemented in SCH_SHEET_PIN.

Definition at line 1572 of file sch_label.cpp.

1574{
1575 CreateGraphicShape( aSettings, aPoints, aPos, m_shape );
1576}
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.cpp:1572

References CreateGraphicShape(), and SCH_LABEL_BASE::m_shape.

Referenced by CreateGraphicShape(), SCH_SHEET_PIN::CreateGraphicShape(), and KIGFX::SCH_PAINTER::draw().

◆ CreateGraphicShape() [2/2]

void SCH_HIERLABEL::CreateGraphicShape ( const RENDER_SETTINGS aSettings,
std::vector< VECTOR2I > &  aPoints,
const VECTOR2I aPos,
LABEL_FLAG_SHAPE  aShape 
) const

Definition at line 1579 of file sch_label.cpp.

1582{
1583 int* Template = TemplateShape[static_cast<int>( aShape )][static_cast<int>( m_spin_style )];
1584 int halfSize = GetTextHeight() / 2;
1585 int imax = *Template;
1586 Template++;
1587
1588 aPoints.clear();
1589
1590 for( int ii = 0; ii < imax; ii++ )
1591 {
1592 VECTOR2I corner;
1593 corner.x = ( halfSize * (*Template) ) + aPos.x;
1594 Template++;
1595
1596 corner.y = ( halfSize * (*Template) ) + aPos.y;
1597 Template++;
1598
1599 aPoints.push_back( corner );
1600 }
1601}
TEXT_SPIN_STYLE m_spin_style
The orientation of text and any associated drawing elements of derived objects.
Definition: sch_text.h:238
static int * TemplateShape[5][4]
Definition: sch_label.cpp:131

References EDA_TEXT::GetTextHeight(), SCH_TEXT::m_spin_style, TemplateShape, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ DoHypertextAction()

void SCH_TEXT::DoHypertextAction ( EDA_DRAW_FRAME aFrame) const
overridevirtualinherited

Reimplemented from SCH_ITEM.

Definition at line 372 of file sch_text.cpp.

373{
374 wxCHECK_MSG( IsHypertext(), /* void */,
375 "Calling a hypertext menu on a SCH_TEXT with no hyperlink?" );
376
378 navTool->HypertextCommand( m_hyperlink );
379}
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()

bool SCH_HIERLABEL::doIsConnected ( const VECTOR2I aPosition) const
inlineoverrideprivatevirtual

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 from SCH_ITEM.

Definition at line 441 of file sch_label.h.

442 {
443 return EDA_TEXT::GetTextPos() == aPosition;
444 }

References EDA_TEXT::GetTextPos().

◆ 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:492
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_LINE::BreakAt(), 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 783 of file eda_text.cpp.

784{
785 aFormatter->Print( aNestLevel + 1, "(effects" );
786
787 aFormatter->Print( 0, " (font" );
788
789 if( GetFont() && !GetFont()->GetName().IsEmpty() )
790 aFormatter->Print( 0, " (face \"%s\")", GetFont()->NameAsToken() );
791
792 // Text size
793 aFormatter->Print( 0, " (size %s %s)",
796
797 if( GetLineSpacing() != 1.0 )
798 {
799 aFormatter->Print( 0, " (line_spacing %s)",
800 FormatDouble2Str( GetLineSpacing() ).c_str() );
801 }
802
803 if( GetTextThickness() )
804 {
805 aFormatter->Print( 0, " (thickness %s)",
807 }
808
809 if( IsBold() )
810 aFormatter->Print( 0, " bold" );
811
812 if( IsItalic() )
813 aFormatter->Print( 0, " italic" );
814
815 if( GetTextColor() != COLOR4D::UNSPECIFIED )
816 {
817 aFormatter->Print( 0, " (color %d %d %d %s)",
818 KiROUND( GetTextColor().r * 255.0 ),
819 KiROUND( GetTextColor().g * 255.0 ),
820 KiROUND( GetTextColor().b * 255.0 ),
821 FormatDouble2Str( GetTextColor().a ).c_str() );
822 }
823
824 aFormatter->Print( 0, ")"); // (font
825
828 {
829 aFormatter->Print( 0, " (justify");
830
832 aFormatter->Print( 0, GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT ? " left" : " right" );
833
835 aFormatter->Print( 0, GetVertJustify() == GR_TEXT_V_ALIGN_TOP ? " top" : " bottom" );
836
837 if( IsMirrored() )
838 aFormatter->Print( 0, " mirror" );
839
840 aFormatter->Print( 0, ")" ); // (justify
841 }
842
843 if( !( aControlBits & CTL_OMIT_HIDE ) && !IsVisible() )
844 aFormatter->Print( 0, " hide" );
845
846 if( HasHyperlink() )
847 {
848 aFormatter->Print( 0, " (href %s)", aFormatter->Quotew( GetHyperlink() ).c_str() );
849 }
850
851 aFormatter->Print( 0, ")\n" ); // (effects
852}
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:501
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:433
#define CTL_OMIT_HIDE
Definition: eda_text.h:53
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:142
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(), and OUTPUTFORMATTER::Quotew().

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:352
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:74
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:76
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:63
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:46

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(), PROPERTIES_PANEL::getItemValue(), 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_HIERLABEL::GetBodyBoundingBox ( ) const
overridevirtual

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

Reimplemented from SCH_LABEL_BASE.

Definition at line 1604 of file sch_label.cpp.

1605{
1606 int penWidth = GetEffectiveTextPenWidth();
1607 int margin = GetTextOffset();
1608
1609 int x = GetTextPos().x;
1610 int y = GetTextPos().y;
1611
1612 int height = GetTextHeight() + penWidth + margin;
1613 int length = GetTextBox().GetWidth();
1614
1615 length += height; // add height for triangular shapes
1616
1617 int dx, dy;
1618
1619 switch( GetTextSpinStyle() )
1620 {
1621 default:
1623 dx = -length;
1624 dy = height;
1626 y -= height / 2;
1627 break;
1628
1630 dx = height;
1631 dy = -length;
1632 x -= height / 2;
1634 break;
1635
1637 dx = length;
1638 dy = height;
1640 y -= height / 2;
1641 break;
1642
1644 dx = height;
1645 dy = length;
1646 x -= height / 2;
1648 break;
1649 }
1650
1651 BOX2I box( VECTOR2I( x, y ), VECTOR2I( dx, dy ) );
1652 box.Normalize();
1653 return box;
1654}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
coord_type GetWidth() const
Definition: box2.h:187
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,...
Definition: eda_text.cpp:505
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition: eda_text.cpp:299
#define DANGLING_SYMBOL_SIZE
< The size of the rectangle indicating an unconnected wire or label
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590

References TEXT_SPIN_STYLE::BOTTOM, DANGLING_SYMBOL_SIZE, EDA_TEXT::GetEffectiveTextPenWidth(), EDA_TEXT::GetTextBox(), EDA_TEXT::GetTextHeight(), SCH_TEXT::GetTextOffset(), EDA_TEXT::GetTextPos(), SCH_TEXT::GetTextSpinStyle(), BOX2< Vec >::GetWidth(), TEXT_SPIN_STYLE::LEFT, EDA_IU_SCALE::MilsToIU(), BOX2< Vec >::Normalize(), TEXT_SPIN_STYLE::RIGHT, schIUScale, TEXT_SPIN_STYLE::UP, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ GetBoundingBox()

const BOX2I SCH_LABEL_BASE::GetBoundingBox ( ) const
overridevirtualinherited

Return the bounding box of the label including its fields.

Reimplemented from EDA_ITEM.

Definition at line 727 of file sch_label.cpp.

728{
729 // build the bounding box of the entire label, including its fields
730
732
733 for( const SCH_FIELD& field : m_fields )
734 {
735 if( field.IsVisible() )
736 {
737 BOX2I fieldBBox = field.GetBoundingBox();
738
739 if( Type() == SCH_LABEL_T || Type() == SCH_GLOBAL_LABEL_T )
740 fieldBBox.Offset( GetSchematicTextOffset( nullptr ) );
741
742 box.Merge( fieldBBox );
743 }
744 }
745
746 box.Normalize();
747
748 return box;
749}
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:119
void Offset(coord_type dx, coord_type dy)
Definition: box2.h:224
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:588
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 SCH_LABEL_BASE::GetBodyBoundingBox(), SCH_LABEL_BASE::GetSchematicTextOffset(), SCH_LABEL_BASE::m_fields, BOX2< Vec >::Merge(), BOX2< Vec >::Normalize(), BOX2< Vec >::Offset(), SCH_GLOBAL_LABEL_T, SCH_LABEL_T, and EDA_ITEM::Type().

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

◆ GetClass()

wxString SCH_HIERLABEL::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements SCH_LABEL_BASE.

Reimplemented in SCH_SHEET_PIN.

Definition at line 406 of file sch_label.h.

407 {
408 return wxT( "SCH_HIERLABEL" );
409 }

◆ GetConnectionPoints()

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

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 677 of file sch_label.cpp.

678{
679 return { GetTextPos() };
680}

References EDA_TEXT::GetTextPos().

◆ GetContextualTextVars()

void SCH_LABEL_BASE::GetContextualTextVars ( wxArrayString *  aVars) const
inherited

Return the list of system text vars & fields for this label.

Definition at line 482 of file sch_label.cpp.

483{
484 for( const SCH_FIELD& field : m_fields )
485 aVars->push_back( field.GetCanonicalName().Upper() );
486
487 aVars->push_back( wxT( "OP" ) );
488 aVars->push_back( wxT( "CONNECTION_TYPE" ) );
489 aVars->push_back( wxT( "SHORT_NET_NAME" ) );
490 aVars->push_back( wxT( "NET_NAME" ) );
491 aVars->push_back( wxT( "NET_CLASS" ) );
492}

References SCH_LABEL_BASE::m_fields.

Referenced by DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded().

◆ GetDefaultFieldName()

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

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:138
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 145 of file eda_item.h.

146 {
147 constexpr int mask =
149
150 return m_flags & mask;
151 }
#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_BROKEN
Is a segment just broken by BreakSegment.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_MOVING
Item being moved.

References IS_BROKEN, IS_CHANGED, IS_MOVING, IS_NEW, IS_PASTED, 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:149
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(), SCH_LABEL_BASE::GetLabelColor(), SCH_LINE::GetLineColor(), SCH_BUS_ENTRY_BASE::GetLineStyle(), SCH_BUS_ENTRY_BASE::GetMsgPanelInfo(), SCH_LABEL_BASE::GetMsgPanelInfo(), SCH_LINE::GetMsgPanelInfo(), SCH_BUS_WIRE_ENTRY::GetPenWidth(), SCH_BUS_BUS_ENTRY::GetPenWidth(), SCH_LINE::GetPenWidth(), SCH_LABEL_BASE::Plot(), SCH_LINE::Plot(), and SCH_LABEL_BASE::ResolveTextVar().

◆ GetEffectiveTextPenWidth()

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

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

Definition at line 299 of file eda_text.cpp.

300{
301 int penWidth = GetTextThickness();
302
303 if( penWidth <= 1 )
304 {
305 penWidth = aDefaultPenWidth;
306
307 if( IsBold() )
308 penWidth = GetPenSizeForBold( GetTextWidth() );
309 else if( penWidth <= 1 )
310 penWidth = GetPenSizeForNormal( GetTextWidth() );
311 }
312
313 // Clip pen size for small texts:
314 penWidth = Clamp_Text_PenSize( penWidth, GetTextSize() );
315
316 return penWidth;
317}
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:64
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:87

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(), SCH_LABEL_BASE::GetBodyBoundingBox(), SCH_LABEL::GetBodyBoundingBox(), GetBodyBoundingBox(), FP_TEXT::GetEffectiveShape(), PCB_TEXT::GetEffectiveShape(), 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(), SCH_LABEL_BASE::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 855 of file eda_text.cpp.

857{
858 std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
860 KIFONT::FONT* font = getDrawFont();
861 int penWidth = GetEffectiveTextPenWidth();
863
864 if( aUseTextRotation )
865 attrs.m_Angle = GetDrawRotation();
866 else
867 attrs.m_Angle = ANGLE_0;
868
869 if( aTriangulate )
870 {
871 CALLBACK_GAL callback_gal(
872 empty_opts,
873 // Stroke callback
874 [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
875 {
876 shape->AddShape( new SHAPE_SEGMENT( aPt1, aPt2, penWidth ) );
877 },
878 // Triangulation callback
879 [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
880 {
881 SHAPE_SIMPLE* triShape = new SHAPE_SIMPLE;
882
883 for( const VECTOR2I& point : { aPt1, aPt2, aPt3 } )
884 triShape->Append( point.x, point.y );
885
886 shape->AddShape( triShape );
887 } );
888
889 font->Draw( &callback_gal, GetShownText(), GetDrawPos(), attrs );
890 }
891 else
892 {
893 CALLBACK_GAL callback_gal(
894 empty_opts,
895 // Stroke callback
896 [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
897 {
898 shape->AddShape( new SHAPE_SEGMENT( aPt1, aPt2, penWidth ) );
899 },
900 // Outline callback
901 [&]( const SHAPE_LINE_CHAIN& aPoly )
902 {
903 shape->AddShape( aPoly.Clone() );
904 } );
905
906 font->Draw( &callback_gal, GetShownText(), GetDrawPos(), attrs );
907 }
908
909 return shape;
910}
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:428
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:232
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:429

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 PCB_DIMENSION_BASE::GetEffectiveShape(), 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)
overridevirtualinherited

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 670 of file sch_label.cpp.

671{
672 DANGLING_END_ITEM item( LABEL_END, this, GetTextPos() );
673 aItemList.push_back( item );
674}
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
inlineinherited

Definition at line 91 of file sch_label.h.

91{ return m_fields; }

References SCH_LABEL_BASE::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(), and SCH_SEXPR_PLUGIN::saveText().

◆ 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 256 of file eda_item.h.

256{ return GetPosition(); }
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:249

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(), KIGFX::SCH_PAINTER::getFont(), EDA_TEXT::GetFontName(), LIB_FIELD::GetMsgPanelInfo(), LIB_TEXT::GetMsgPanelInfo(), LIB_TEXTBOX::GetMsgPanelInfo(), SCH_FIELD::GetMsgPanelInfo(), SCH_LABEL_BASE::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(), SCH_LABEL_BASE::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(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow().

◆ GetFontName()

wxString EDA_TEXT::GetFontName ( ) const
inherited

Definition at line 759 of file eda_text.cpp.

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

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

Referenced by 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, PCB_TRACK, 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::rebuildProperties().

◆ 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(), 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(), positioningChanged(), LIB_FIELD::print(), EDA_TEXT::printOneLineOfText(), 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(), DIALOG_DIMENSION_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 499 of file eda_text.cpp.

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

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)
inherited

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:163
std::map< int, wxString > GetVirtualPageToSheetPagesMap() const
Definition: schematic.cpp:374
std::map< int, wxString > GetVirtualPageToSheetNamesMap() const
Definition: schematic.cpp:358
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().

◆ GetItemDescription()

wxString SCH_HIERLABEL::GetItemDescription ( UNITS_PROVIDER aUnitsProvider) const
overridevirtual

Return a user-visible description string of this item.

This description is used in disambiguation menus, the message panel, ERC/DRC reports, etc.

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.

Reimplemented in SCH_SHEET_PIN.

Definition at line 1677 of file sch_label.cpp.

1678{
1679 return wxString::Format( _( "Hierarchical Label '%s'" ),
1681}
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:598
wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
Definition: ui_common.cpp:215
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_LABEL_BASE::GetShownText().

◆ GetLabelBoxExpansion()

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

Definition at line 694 of file sch_label.cpp.

695{
696 double ratio;
697
698 if( aSettings )
699 ratio = static_cast<const SCH_RENDER_SETTINGS*>( aSettings )->m_LabelSizeRatio;
700 else if( Schematic() )
702 else
703 ratio = DEFAULT_LABEL_SIZE_RATIO; // For previews (such as in Preferences), etc.
704
705 return KiROUND( ratio * GetTextSize().y );
706}
Store schematic specific render settings.
Definition: sch_painter.h:71
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:205
#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
inherited

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
COLOR4D m_lastResolvedColor
Definition: sch_label.h:227

References SCH_ITEM::GetEffectiveNetClass(), EDA_TEXT::GetTextColor(), SCH_ITEM::IsConnectivityDirty(), and SCH_LABEL_BASE::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 673 of file eda_text.cpp.

674{
675 VECTOR2I pos = GetDrawPos(); // Position of first line of the multiline text according
676 // to the center of the multiline text block
677
678 VECTOR2I offset; // Offset to next line.
679
680 offset.y = GetInterline();
681
682 if( aLineCount > 1 )
683 {
684 switch( GetVertJustify() )
685 {
687 break;
688
690 pos.y -= ( aLineCount - 1 ) * offset.y / 2;
691 break;
692
694 pos.y -= ( aLineCount - 1 ) * offset.y;
695 break;
696 }
697 }
698
699 // Rotate the position of the first line around the center of the multiline text block
701
702 // Rotate the offset lines to increase happened in the right direction
703 RotatePoint( offset, GetDrawRotation() );
704
705 for( int ii = 0; ii < aLineCount; ii++ )
706 {
707 aPositions.push_back( (VECTOR2I) pos );
708 pos += offset;
709 }
710}
@ 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 EDA_TEXT::Format().

◆ GetMandatoryFieldCount()

virtual int SCH_LABEL_BASE::GetMandatoryFieldCount ( )
inlinevirtualinherited

◆ GetMenuImage()

BITMAPS SCH_HIERLABEL::GetMenuImage ( ) const
overridevirtual

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.

Reimplemented in SCH_SHEET_PIN.

Definition at line 1684 of file sch_label.cpp.

1685{
1687}
@ add_hierarchical_label

References add_hierarchical_label.

◆ GetMsgPanelInfo()

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

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 888 of file sch_label.cpp.

889{
890 wxString msg;
891
892 switch( Type() )
893 {
894 case SCH_LABEL_T: msg = _( "Label" ); break;
895 case SCH_DIRECTIVE_LABEL_T: msg = _( "Directive Label" ); break;
896 case SCH_GLOBAL_LABEL_T: msg = _( "Global Label" ); break;
897 case SCH_HIER_LABEL_T: msg = _( "Hierarchical Label" ); break;
898 case SCH_SHEET_PIN_T: msg = _( "Hierarchical Sheet Pin" ); break;
899 default: return;
900 }
901
902 // Don't use GetShownText() here; we want to show the user the variable references
903 aList.emplace_back( msg, UnescapeString( GetText() ) );
904
905 // Display electrical type if it is relevant
907 aList.emplace_back( _( "Type" ), getElectricalTypeLabel( GetShape() ) );
908
909 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
910
911 wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
912 int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
913 aList.emplace_back( _( "Style" ), textStyle[style] );
914
915 aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
916
917 switch( GetTextSpinStyle() )
918 {
919 case TEXT_SPIN_STYLE::LEFT: msg = _( "Align right" ); break;
920 case TEXT_SPIN_STYLE::UP: msg = _( "Align bottom" ); break;
921 case TEXT_SPIN_STYLE::RIGHT: msg = _( "Align left" ); break;
922 case TEXT_SPIN_STYLE::BOTTOM: msg = _( "Align top" ); break;
923 default: msg = wxT( "???" ); break;
924 }
925
926 aList.emplace_back( _( "Justification" ), msg );
927
928 SCH_CONNECTION* conn = nullptr;
929
930 if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
931 conn = Connection();
932
933 if( conn )
934 {
935 conn->AppendInfoToMsgPanel( aList );
936
937 if( !conn->IsBus() )
938 {
939 aList.emplace_back( _( "Resolved Netclass" ),
940 UnescapeString( GetEffectiveNetClass()->GetName() ) );
941 }
942 }
943}
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(), SCH_LABEL_BASE::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 SCH_LABEL_BASE::AutoplaceFields(), SCH_GLOBALLABEL::CreateGraphicShape(), SCH_LABEL_BASE::GetSchematicTextOffset(), and SCH_LABEL_BASE::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 453 of file eda_text.cpp.

455{
456 if( getDrawFont()->IsOutline() )
457 {
458 EDA_ANGLE resolvedAngle = GetDrawRotation();
459
460 if( m_render_cache.empty()
461 || m_render_cache_text != forResolvedText
462 || m_render_cache_angle != resolvedAngle
463 || m_render_cache_offset != aOffset )
464 {
465 m_render_cache.clear();
466
467 KIFONT::OUTLINE_FONT* font = static_cast<KIFONT::OUTLINE_FONT*>( getDrawFont() );
469
470 attrs.m_Angle = resolvedAngle;
471
472 font->GetLinesAsGlyphs( &m_render_cache, GetShownText(), GetDrawPos() + aOffset, attrs );
473 m_render_cache_angle = resolvedAngle;
474 m_render_cache_text = forResolvedText;
475 m_render_cache_offset = aOffset;
476 }
477
478 return &m_render_cache;
479 }
480
481 return nullptr;
482}
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:52
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_HIERLABEL::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_LABEL_BASE.

Definition at line 1657 of file sch_label.cpp.

1658{
1659 VECTOR2I text_offset;
1660 int dist = GetTextOffset( aSettings );
1661
1662 dist += GetTextWidth();
1663
1664 switch( GetTextSpinStyle() )
1665 {
1666 default:
1667 case TEXT_SPIN_STYLE::LEFT: text_offset.x = -dist; break; // Orientation horiz normale
1668 case TEXT_SPIN_STYLE::UP: text_offset.y = -dist; break; // Orientation vert UP
1669 case TEXT_SPIN_STYLE::RIGHT: text_offset.x = dist; break; // Orientation horiz inverse
1670 case TEXT_SPIN_STYLE::BOTTOM: text_offset.y = dist; break; // Orientation vert BOTTOM
1671 }
1672
1673 return text_offset;
1674}

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

◆ GetShape()

◆ GetShownText()

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

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 598 of file sch_label.cpp.

599{
600 std::function<bool( wxString* )> textResolver =
601 [&]( wxString* token ) -> bool
602 {
603 return ResolveTextVar( token, aDepth );
604 };
605
606 wxString text = EDA_TEXT::GetShownText();
607
608 if( text == wxS( "~" ) ) // Legacy placeholder for empty string
609 {
610 text = wxS( "" );
611 }
612 else if( HasTextVars() )
613 {
614 if( aDepth < 10 )
615 text = ExpandTextVars( text, &textResolver );
616 }
617
618 return text;
619}
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition: eda_text.h:103
virtual bool ResolveTextVar(wxString *token, int aDepth) const
Resolve any references to system tokens supported by the label.
Definition: sch_label.cpp:495
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:58

References ExpandTextVars(), EDA_TEXT::GetShownText(), EDA_TEXT::HasTextVars(), SCH_LABEL_BASE::ResolveTextVar(), and text.

Referenced by SCH_LABEL::GetItemDescription(), SCH_DIRECTIVE_LABEL::GetItemDescription(), SCH_GLOBALLABEL::GetItemDescription(), GetItemDescription(), SCH_SHEET_PIN::GetItemDescription(), SCH_LABEL_BASE::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 265 of file eda_item.h.

265{ return GetPosition(); }

References EDA_ITEM::GetPosition().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 123 of file eda_item.h.

124 {
125 return m_status & type;
126 }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:495

References EDA_ITEM::m_status.

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 136 of file eda_item.h.

136{ 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(), SCH_SHEET_PATH::AddNewSymbolInstances(), NETLIST_EXPORTER_XML::addSymbolFields(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), SCH_EDIT_FRAME::AutoRotateItem(), EE_SELECTION_TOOL::autostartEvent(), CONNECTION_GRAPH::buildConnectionGraph(), SCH_EDIT_TOOL::ChangeTextType(), 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(), KIGFX::SCH_PAINTER::draw(), 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(), SCH_LABEL_BASE::GetIntersheetRefs(), PCB_DIMENSION_BASE::GetItemDescription(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadNet(), FP_TEXT::GetLength(), LIB_FIELD::GetMsgPanelInfo(), LIB_TEXT::GetMsgPanelInfo(), LIB_TEXTBOX::GetMsgPanelInfo(), SCH_FIELD::GetMsgPanelInfo(), SCH_LABEL_BASE::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_TEXTBOX::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), FP_TEXTBOX::GetMsgPanelInfo(), PCB_TEXT::GetMsgPanelInfo(), PCB_TEXTBOX::GetMsgPanelInfo(), LIB_SYMBOL::GetPrefix(), SCH_SYMBOL::GetRef(), FOOTPRINT::GetReference(), LIB_SYMBOL::GetSearchText(), FOOTPRINT::GetValue(), SCH_SYMBOL::GetValueFieldText(), hash_fp_item(), SCH_SHEET::HasUndefinedPins(), LIB_FIELD::HitTest(), SCH_DRAWING_TOOLS::importHierLabel(), SCH_LABEL_BASE::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(), SCH_LABEL_BASE::Matches(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), SCH_TEXTBOX::Matches(), 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_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::processSymbols(), 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_SYMBOL_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(), PCB_DIM_LEADER::updateGeometry(), SCH_EDITOR_CONTROL::updatePastedSymbol(), SCH_SYMBOL::UpdatePrefix(), 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(), 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(), LIB_FIELD::Plot(), LIB_TEXT::Plot(), positioningChanged(), SCH_FIELD::Print(), LIB_FIELD::print(), LIB_TEXT::print(), 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(), FP_TEXTBOX::SetTextAngle(), PCB_TEXTBOX::SetTextAngle(), textsNeedUpdate(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_DIMENSION_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 505 of file eda_text.cpp.

506{
507 VECTOR2I drawPos = GetDrawPos();
508
510 && m_bounding_box_cache_pos == drawPos
511 && m_bounding_box_cache_line == aLine
512 && m_bounding_box_cache_inverted == aInvertY )
513 {
515 }
516
517 BOX2I bbox;
518 wxArrayString strings;
519 wxString text = GetShownText();
520 int thickness = GetEffectiveTextPenWidth();
521
522 if( IsMultilineAllowed() )
523 {
524 wxStringSplit( text, strings, '\n' );
525
526 if( strings.GetCount() ) // GetCount() == 0 for void strings with multilines allowed
527 {
528 if( aLine >= 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
529 text = strings.Item( aLine );
530 else
531 text = strings.Item( 0 );
532 }
533 }
534
535 // calculate the H and V size
536 KIFONT::FONT* font = getDrawFont();
537 VECTOR2D fontSize( GetTextSize() );
538 bool bold = IsBold();
539 bool italic = IsItalic();
540 VECTOR2I extents = font->StringBoundaryLimits( text, fontSize, thickness, bold, italic );
541 int overbarOffset = 0;
542
543 // Creates bounding box (rectangle) for horizontal, left and top justified text. The
544 // bounding box will be moved later according to the actual text options
545 VECTOR2I textsize = VECTOR2I( extents.x, extents.y );
546 VECTOR2I pos = drawPos;
547
548 if( IsMultilineAllowed() && aLine > 0 && aLine < (int) strings.GetCount() )
549 pos.y -= KiROUND( aLine * font->GetInterline( fontSize.y ) );
550
551 if( text.Contains( wxT( "~{" ) ) )
552 overbarOffset = extents.y / 14;
553
554 if( aInvertY )
555 pos.y = -pos.y;
556
557 bbox.SetOrigin( pos );
558
559 // for multiline texts and aLine < 0, merge all rectangles (aLine == -1 signals all lines)
560 if( IsMultilineAllowed() && aLine < 0 && strings.GetCount() )
561 {
562 for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
563 {
564 text = strings.Item( ii );
565 extents = font->StringBoundaryLimits( text, fontSize, thickness, bold, italic );
566 textsize.x = std::max( textsize.x, extents.x );
567 }
568
569 // interline spacing is only *between* lines, so total height is the height of the first
570 // line plus the interline distance (with interline spacing) for all subsequent lines
571 textsize.y += KiROUND( ( strings.GetCount() - 1 ) * font->GetInterline( fontSize.y ) );
572 }
573
574 bbox.SetSize( textsize );
575
576 /*
577 * At this point the rectangle origin is the text origin (m_Pos). This is correct only for
578 * left and top justified, non-mirrored, non-overbarred texts. Recalculate for all others.
579 */
580 int italicOffset = IsItalic() ? KiROUND( fontSize.y * ITALIC_TILT ) : 0;
581
582 switch( GetHorizJustify() )
583 {
585 if( IsMirrored() )
586 bbox.SetX( bbox.GetX() - ( bbox.GetWidth() - italicOffset ) );
587 break;
588
590 bbox.SetX( bbox.GetX() - ( bbox.GetWidth() - italicOffset ) / 2 );
591 break;
592
594 if( !IsMirrored() )
595 bbox.SetX( bbox.GetX() - ( bbox.GetWidth() - italicOffset ) );
596 break;
597 }
598
599 switch( GetVertJustify() )
600 {
602 break;
603
605 bbox.SetY( bbox.GetY() - ( bbox.GetHeight() + overbarOffset ) / 2 );
606 break;
607
609 bbox.SetY( bbox.GetY() - ( bbox.GetHeight() + overbarOffset ) );
610 break;
611 }
612
613 bbox.Normalize(); // Make h and v sizes always >= 0
614
616 m_bounding_box_cache_pos = drawPos;
620
621 return bbox;
622}
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
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:357
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(), 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(), ALTIUM_PCB::HelperParseDimensions6Radial(), 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 SCH_LABEL_BASE::AutoplaceFields(), SCH_DIRECTIVE_LABEL::AutoplaceFields(), SCH_LABEL::GetBodyBoundingBox(), GetBodyBoundingBox(), SCH_LABEL_BASE::GetSchematicTextOffset(), and 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 SCH_LABEL_BASE::AutoplaceFields(), LIB_FIELD::compare(), LIB_TEXT::compare(), PCB_GRID_HELPER::computeAnchors(), SCH_SHEET_PIN::ConstrainOnEdge(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), SCH_LABEL::doIsConnected(), SCH_GLOBALLABEL::doIsConnected(), 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(), SCH_LABEL_BASE::GetBodyBoundingBox(), SCH_LABEL::GetBodyBoundingBox(), GetBodyBoundingBox(), LIB_FIELD::GetBoundingBox(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), FP_TEXT::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_LABEL_BASE::GetConnectionPoints(), EDA_TEXT::GetDrawPos(), SCH_LABEL_BASE::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(), ALTIUM_PCB::HelperParseDimensions6Radial(), LIB_FIELD::HitTest(), LIB_TEXT::HitTest(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), PCB_POINT_EDITOR::makePoints(), 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(), SCH_LABEL_BASE::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), LIB_FIELD::print(), SCH_LABEL_BASE::Print(), DIALOG_CHANGE_SYMBOLS::processSymbols(), SCH_LABEL_BASE::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(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), FP_TEXT::TransformTextToPolySet(), PCB_TEXT::TransformTextToPolySet(), SCH_LABEL_BASE::UpdateDanglingState(), PCB_DIM_RADIAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), PCB_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updatePoints(), PCB_DIM_RADIAL::updateText(), 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 738 of file eda_text.cpp.

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

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(), SCH_LABEL_BASE::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_TEXTBOX::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), FP_TEXTBOX::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_TEXT::GetMsgPanelInfo(), PCB_TEXTBOX::GetMsgPanelInfo(), 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:623

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 1006 of file eda_text.cpp.

1007{
1008 return wxT( "#" ) + aDestination;
1009}

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
overridevirtualinherited

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 779 of file sch_label.cpp.

780{
781 BOX2I rect = aRect;
782
783 rect.Inflate( aAccuracy );
784
785 if( aContained )
786 {
787 return rect.Contains( GetBoundingBox() );
788 }
789 else
790 {
791 if( rect.Intersects( GetBodyBoundingBox() ) )
792 return true;
793
794 for( const SCH_FIELD& field : m_fields )
795 {
796 if( field.IsVisible() )
797 {
798 BOX2I fieldBBox = field.GetBoundingBox();
799
800 if( Type() == SCH_LABEL_T || Type() == SCH_GLOBAL_LABEL_T )
801 fieldBBox.Offset( GetSchematicTextOffset( nullptr ) );
802
803 if( rect.Intersects( fieldBBox ) )
804 return true;
805 }
806 }
807
808 return false;
809 }
810}
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:269
bool Contains(const Vec &aPoint) const
Definition: box2.h:141
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506
const BOX2I GetBoundingBox() const override
Return the bounding box of the label including its fields.
Definition: sch_label.cpp:727

References BOX2< Vec >::Contains(), SCH_LABEL_BASE::GetBodyBoundingBox(), SCH_LABEL_BASE::GetBoundingBox(), SCH_LABEL_BASE::GetSchematicTextOffset(), BOX2< Vec >::Inflate(), BOX2< Vec >::Intersects(), SCH_LABEL_BASE::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
overridevirtualinherited

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 752 of file sch_label.cpp.

753{
754 BOX2I bbox = GetBodyBoundingBox();
755 bbox.Inflate( aAccuracy );
756
757 if( bbox.Contains( aPosition ) )
758 return true;
759
760 for( const SCH_FIELD& field : m_fields )
761 {
762 if( field.IsVisible() )
763 {
764 BOX2I fieldBBox = field.GetBoundingBox();
765 fieldBBox.Inflate( aAccuracy );
766
767 if( Type() == SCH_LABEL_T || Type() == SCH_GLOBAL_LABEL_T )
768 fieldBBox.Offset( GetSchematicTextOffset( nullptr ) );
769
770 if( fieldBBox.Contains( aPosition ) )
771 return true;
772 }
773 }
774
775 return false;
776}

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

◆ IncrementLabel()

bool SCH_LABEL_BASE::IncrementLabel ( int  aIncrement)
inherited

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:165
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(), 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(), KIGFX::SCH_PAINTER::getFont(), LIB_TEXTBOX::GetMsgPanelInfo(), SCH_LABEL_BASE::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(), SCH_LABEL_BASE::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(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow().

◆ IsBrightened()

◆ IsConnectable()

bool SCH_HIERLABEL::IsConnectable ( ) const
inlineoverridevirtual
Returns
true if the schematic item can connect to another schematic item.

Reimplemented from SCH_ITEM.

Reimplemented in SCH_SHEET_PIN.

Definition at line 422 of file sch_label.h.

422{ return true; }

◆ 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
inlineoverridevirtualinherited

Reimplemented from SCH_ITEM.

Definition at line 187 of file sch_label.h.

187{ return m_isDangling; }

References SCH_LABEL_BASE::m_isDangling.

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

◆ IsDefaultFormatting()

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 107 of file eda_item.h.

107{ 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 201 of file eda_item.h.

201{ return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:497

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 1000 of file eda_text.cpp.

1001{
1002 return aHref.StartsWith( wxT( "#" ), aDestination );
1003}

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(), 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(), KIGFX::SCH_PAINTER::getFont(), LIB_TEXTBOX::GetMsgPanelInfo(), SCH_LABEL_BASE::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(), SCH_LABEL_BASE::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(), DIALOG_DIMENSION_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()

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

Reimplemented from SCH_ITEM.

Reimplemented in SCH_SHEET_PIN.

Definition at line 433 of file sch_label.h.

434 {
435 return m_isDangling && GetPosition() == aPos;
436 }
VECTOR2I GetPosition() const override
Definition: sch_text.h:203

References SCH_TEXT::GetPosition(), and SCH_LABEL_BASE::m_isDangling.

◆ 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; }

◆ IsRollover()

bool EDA_ITEM::IsRollover ( ) const
inlineinherited

Definition at line 110 of file eda_item.h.

111 {
112 return ( m_flags & ( IS_ROLLOVER | IS_MOVING ) ) == IS_ROLLOVER;
113 }
#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 106 of file eda_item.h.

106{ 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(), RENDER_3D_OPENGL::get3dModelsFromFootprint(), 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(), SCH_FIND_REPLACE_TOOL::ReplaceAll(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< T >::saveCopyInUndoList(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), SCH_FIND_REPLACE_TOOL::UpdateFind(), HIERARCHY_PANE::UpdateHierarchySelection(), PCB_BASE_FRAME::UpdateUserUnits(), 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 173 of file eda_item.h.

173{ 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
overridevirtualinherited

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 SCH_LABEL_BASE::Visit().

◆ IsVisible()

◆ 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 302 of file eda_item.h.

304 {
305 for( const auto& it : aList )
306 {
307 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
308 testData,
309 scanTypes ) == INSPECT_RESULT::QUIT )
310 {
312 }
313 }
314
316 }
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 322 of file eda_item.h.

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

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

◆ MapHorizJustify()

GR_TEXT_H_ALIGN_T EDA_TEXT::MapHorizJustify ( int  aHorizJustify)
staticinherited

Definition at line 64 of file eda_text.cpp.

65{
66 wxASSERT( aHorizJustify >= GR_TEXT_H_ALIGN_LEFT && aHorizJustify <= GR_TEXT_H_ALIGN_RIGHT );
67
68 if( aHorizJustify > GR_TEXT_H_ALIGN_RIGHT )
70
71 if( aHorizJustify < GR_TEXT_H_ALIGN_LEFT )
73
74 return static_cast<GR_TEXT_H_ALIGN_T>( aHorizJustify );
75}
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 78 of file eda_text.cpp.

79{
80 wxASSERT( aVertJustify >= GR_TEXT_V_ALIGN_TOP && aVertJustify <= GR_TEXT_V_ALIGN_BOTTOM );
81
82 if( aVertJustify > GR_TEXT_V_ALIGN_BOTTOM )
84
85 if( aVertJustify < GR_TEXT_V_ALIGN_TOP )
87
88 return static_cast<GR_TEXT_V_ALIGN_T>( aVertJustify );
89}
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
overridevirtualinherited

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 629 of file sch_label.cpp.

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

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:420
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:379
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:385

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)
inlineoverridevirtualinherited

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 SCH_LABEL_BASE::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}

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
overridevirtualinherited

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 946 of file sch_label.cpp.

947{
948 static std::vector<VECTOR2I> s_poly;
949
950 RENDER_SETTINGS* settings = aPlotter->RenderSettings();
951 SCH_CONNECTION* connection = Connection();
952 int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
953 COLOR4D color = settings->GetLayerColor( layer );
954 int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
955
956 if( aPlotter->GetColorMode() && GetTextColor() != COLOR4D::UNSPECIFIED )
958
959 penWidth = std::max( penWidth, settings->GetMinPenWidth() );
960 aPlotter->SetCurrentLineWidth( penWidth );
961
962 KIFONT::FONT* font = GetFont();
963
964 if( !font )
965 font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
966
967 VECTOR2I textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
968 CreateGraphicShape( aPlotter->RenderSettings(), s_poly, GetTextPos() );
969
971 attrs.m_StrokeWidth = penWidth;
972 attrs.m_Multiline = false;
973
974 if( aBackground )
975 {
976 // No filled shapes (yet)
977 }
978 else
979 {
980 aPlotter->PlotText( textpos, color, GetShownText(), attrs, font );
981
982 if( s_poly.size() )
983 aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
984
985 // Plot attributes to a hypertext menu
986 std::vector<wxString> properties;
987
988 if( connection )
989 {
990 properties.emplace_back(
991 wxString::Format( wxT( "!%s = %s" ), _( "Net" ), connection->Name() ) );
992
993 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), _( "Resolved netclass" ),
994 GetEffectiveNetClass()->GetName() ) );
995 }
996
997 for( const SCH_FIELD& field : GetFields() )
998 {
999 properties.emplace_back(
1000 wxString::Format( wxT( "!%s = %s" ), field.GetName(), field.GetShownText() ) );
1001 }
1002
1003 if( !properties.empty() )
1004 aPlotter->HyperlinkMenu( GetBodyBoundingBox(), properties );
1005
1006 if( Type() == SCH_HIER_LABEL_T )
1007 {
1008 aPlotter->Bookmark( GetBodyBoundingBox(), GetShownText(), _( "Hierarchical Labels" ) );
1009 }
1010 }
1011
1012 for( const SCH_FIELD& field : m_fields )
1013 field.Plot( aPlotter, aBackground );
1014}
int color
Definition: DXF_plotter.cpp:57
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:102
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 Bookmark(const BOX2I &aBox, const wxString &aName, const wxString &aGroupName=wxEmptyString)
Create a bookmark to a symbol.
Definition: plotter.h:477
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, void *aData=nullptr)
Definition: plotter.cpp:758
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:466
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:159
std::vector< SCH_FIELD > & GetFields()
Definition: sch_label.h:90

References _, PLOTTER::Bookmark(), color, SCH_ITEM::Connection(), SCH_LABEL_BASE::CreateGraphicShape(), Format(), EDA_TEXT::GetAttributes(), SCH_LABEL_BASE::GetBodyBoundingBox(), PLOTTER::GetColorMode(), KIGFX::RENDER_SETTINGS::GetDefaultFont(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), SCH_ITEM::GetEffectiveNetClass(), EDA_TEXT::GetEffectiveTextPenWidth(), SCH_LABEL_BASE::GetFields(), EDA_TEXT::GetFont(), KIFONT::FONT::GetFont(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::RENDER_SETTINGS::GetMinPenWidth(), SCH_LABEL_BASE::GetSchematicTextOffset(), SCH_LABEL_BASE::GetShownText(), EDA_TEXT::GetTextColor(), EDA_TEXT::GetTextPos(), PLOTTER::HyperlinkMenu(), EDA_TEXT::IsBold(), SCH_CONNECTION::IsBus(), EDA_TEXT::IsItalic(), LAYER_BUS, SCH_LABEL_BASE::m_fields, SCH_ITEM::m_layer, TEXT_ATTRIBUTES::m_Multiline, TEXT_ATTRIBUTES::m_StrokeWidth, SCH_CONNECTION::Name(), NO_FILL, PLOTTER::PlotPoly(), PLOTTER::PlotText(), PLOTTER::RenderSettings(), SCH_HIER_LABEL_T, PLOTTER::SetCurrentLineWidth(), 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 650 of file eda_text.cpp.

652{
653 if( IsMultilineAllowed() )
654 {
655 std::vector<VECTOR2I> positions;
656 wxArrayString strings;
657 wxStringSplit( GetShownText(), strings, '\n' );
658
659 positions.reserve( strings.Count() );
660
661 GetLinePositions( positions, (int) strings.Count() );
662
663 for( unsigned ii = 0; ii < strings.Count(); ii++ )
664 printOneLineOfText( aSettings, aOffset, aColor, aFillMode, strings[ii], positions[ii] );
665 }
666 else
667 {
668 printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetDrawPos() );
669 }
670}
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:713
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:673

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

Referenced by SCH_LABEL_BASE::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 
)
overridevirtualinherited

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 1017 of file sch_label.cpp.

1018{
1019 static std::vector<VECTOR2I> s_poly;
1020
1021 SCH_CONNECTION* connection = Connection();
1022 int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
1023 wxDC* DC = aSettings->GetPrintDC();
1024 COLOR4D color = aSettings->GetLayerColor( layer );
1025 bool blackAndWhiteMode = GetGRForceBlackPenState();
1026 int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
1027 VECTOR2I text_offset = aOffset + GetSchematicTextOffset( aSettings );
1028
1029 if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
1030 color = GetTextColor();
1031
1032 EDA_TEXT::Print( aSettings, text_offset, color );
1033
1034 CreateGraphicShape( aSettings, s_poly, GetTextPos() + aOffset );
1035
1036 if( !s_poly.empty() )
1037 GRPoly( DC, s_poly.size(), &s_poly[0], false, penWidth, color, color );
1038
1039 for( SCH_FIELD& field : m_fields )
1040 field.Print( aSettings, aOffset );
1041}
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:650
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:341
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:165

References color, SCH_ITEM::Connection(), SCH_LABEL_BASE::CreateGraphicShape(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), GetGRForceBlackPenState(), KIGFX::RENDER_SETTINGS::GetLayerColor(), SCH_TEXT::GetPenWidth(), KIGFX::RENDER_SETTINGS::GetPrintDC(), SCH_LABEL_BASE::GetSchematicTextOffset(), EDA_TEXT::GetTextColor(), EDA_TEXT::GetTextPos(), GRPoly(), SCH_CONNECTION::IsBus(), LAYER_BUS, SCH_LABEL_BASE::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 713 of file eda_text.cpp.

716{
717 wxDC* DC = aSettings->GetPrintDC();
718 int penWidth = GetEffectiveTextPenWidth( aSettings->GetDefaultPenWidth() );
719
720 if( aFillMode == SKETCH )
721 penWidth = -penWidth;
722
723 VECTOR2I size = GetTextSize();
724
725 if( IsMirrored() )
726 size.x = -size.x;
727
728 KIFONT::FONT* font = GetFont();
729
730 if( !font )
731 font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
732
733 GRPrintText( DC, aOffset + aPos, aColor, aText, GetDrawRotation(), size, GetHorizJustify(),
734 GetVertJustify(), penWidth, IsItalic(), IsBold(), font );
735}
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:141
@ 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 320 of file eda_text.cpp.

321{
322 bool retval = EDA_ITEM::Replace( aSearchData, m_text );
323
325
328
329 return retval;
330}
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:410

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(), SCH_LABEL_BASE::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 
)
overridevirtualinherited

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 635 of file sch_label.cpp.

636{
637 EDA_SEARCH_DATA localSearchData( aSearchData );
638 localSearchData.findString = EscapeString( aSearchData.findString, CTX_NETNAME );
639 localSearchData.replaceString = EscapeString( aSearchData.replaceString, CTX_NETNAME );
640
641 return EDA_TEXT::Replace( localSearchData );
642}
bool Replace(const EDA_SEARCH_DATA &aSearchData)
Helper function used in search and replace dialog.
Definition: eda_text.cpp:320
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_FIND_REPLACE_TOOL::ReplaceAll(), and SCH_FIND_REPLACE_TOOL::ReplaceAndFindNext().

◆ ResolveTextVar()

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

Resolve any references to system tokens supported by the label.

Parameters
aDeptha counter to limit recursion and circular references.

Reimplemented in SCH_GLOBALLABEL.

Definition at line 495 of file sch_label.cpp.

496{
497 static wxRegEx operatingPoint( wxT( "^"
498 "OP"
499 "(.([0-9])?([a-zA-Z]*))?"
500 "$" ) );
501
502 if( !Schematic() )
503 return false;
504
505 if( operatingPoint.Matches( *token ) )
506 {
507 int precision = 3;
508 wxString precisionStr( operatingPoint.GetMatch( *token, 2 ) );
509 wxString range( operatingPoint.GetMatch( *token, 3 ) );
510
511 if( !precisionStr.IsEmpty() )
512 precision = precisionStr[0] - '0';
513
514 if( range.IsEmpty() )
515 range = wxS( "~V" );
516
517 const SCH_CONNECTION* connection = Connection();
518 *token = wxS( "?" );
519
520 if( connection )
521 *token = Schematic()->GetOperatingPoint( connection->Name( false ), precision, range );
522
523 return true;
524 }
525
526 if( token->Contains( ':' ) )
527 {
528 if( Schematic()->ResolveCrossReference( token, aDepth + 1 ) )
529 return true;
530 }
531
533 && token->IsSameAs( wxT( "CONNECTION_TYPE" ) ) )
534 {
535 const SCH_LABEL_BASE* label = static_cast<const SCH_LABEL_BASE*>( this );
536 *token = getElectricalTypeLabel( label->GetShape() );
537 return true;
538 }
539 else if( token->IsSameAs( wxT( "SHORT_NET_NAME" ) ) )
540 {
541 const SCH_CONNECTION* connection = Connection();
542 *token = wxEmptyString;
543
544 if( connection )
545 *token = connection->LocalName();
546
547 return true;
548 }
549 else if( token->IsSameAs( wxT( "NET_NAME" ) ) )
550 {
551 const SCH_CONNECTION* connection = Connection();
552 *token = wxEmptyString;
553
554 if( connection )
555 *token = connection->Name();
556
557 return true;
558 }
559 else if( token->IsSameAs( wxT( "NET_CLASS" ) ) )
560 {
561 const SCH_CONNECTION* connection = Connection();
562 *token = wxEmptyString;
563
564 if( connection )
565 *token = GetEffectiveNetClass()->GetName();
566
567 return true;
568 }
569
570 for( const SCH_FIELD& field : m_fields)
571 {
572 if( token->IsSameAs( field.GetName() ) )
573 {
574 *token = field.GetShownText( aDepth + 1 );
575 return true;
576 }
577 }
578
579 // See if parent can resolve it (these will recurse to ancestors)
580
581 if( Type() == SCH_SHEET_PIN_T && m_parent )
582 {
583 SCH_SHEET* sheet = static_cast<SCH_SHEET*>( m_parent );
584
585 if( sheet->ResolveTextVar( token, aDepth + 1 ) )
586 return true;
587 }
588 else if( SCH_SHEET* sheet = Schematic()->CurrentSheet().Last() )
589 {
590 if( sheet->ResolveTextVar( token, aDepth + 1 ) )
591 return true;
592 }
593
594 return false;
595}
wxString GetOperatingPoint(const wxString &aNetName, int aPrecision, const wxString &aRange)
Definition: schematic.cpp:630
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:57
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
Definition: sch_sheet.cpp:237

References SCH_ITEM::Connection(), SCHEMATIC::CurrentSheet(), SCH_ITEM::GetEffectiveNetClass(), getElectricalTypeLabel(), SCHEMATIC::GetOperatingPoint(), SCH_LABEL_BASE::GetShape(), SCH_SHEET_PATH::Last(), SCH_CONNECTION::LocalName(), SCH_LABEL_BASE::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_LABEL_BASE::GetShownText(), and SCH_GLOBALLABEL::ResolveTextVar().

◆ Rotate()

void SCH_LABEL_BASE::Rotate ( const VECTOR2I aCenter)
overridevirtualinherited

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:373
void Rotate90(bool aClockwise) override
Definition: sch_label.cpp:309
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:431

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

◆ Rotate90()

void SCH_LABEL_BASE::Rotate90 ( bool  aClockwise)
overridevirtualinherited

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, SCH_LABEL_BASE::AutoplaceFields(), FIELDS_AUTOPLACED_AUTO, SCH_TEXT::GetPosition(), GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, SCH_LABEL_BASE::m_fields, SCH_ITEM::m_fieldsAutoplaced, SCH_TEXT::Rotate90(), and RotatePoint().

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

◆ RunOnChildren()

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

Reimplemented from SCH_ITEM.

Definition at line 622 of file sch_label.cpp.

623{
624 for( SCH_FIELD& field : m_fields )
625 aFunction( &field );
626}

References SCH_LABEL_BASE::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 EE_SELECTION_TOOL::autostartEvent(), 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_SHEET::GetContextualTextVars(), SCH_ITEM::GetEffectiveNetClass(), SCH_JUNCTION::getEffectiveShape(), SCH_LABEL_BASE::GetIntersheetRefs(), SCH_LABEL_BASE::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(), SCH_TEXT::GetShownText(), SCH_TEXTBOX::GetShownText(), SCH_TEXT::GetTextOffset(), SCH_PIN::HitTest(), SCH_SHEET::IsRootSheet(), SCH_LABEL_BASE::IsType(), DIALOG_SYMBOL_PROPERTIES::OnAddField(), DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded(), DIALOG_TEXT_PROPERTIES::onScintillaCharAdded(), SCH_LABEL_BASE::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:325

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)
inherited

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 1048 of file sch_label.cpp.

1049{
1050 m_autoRotateOnPlacement = autoRotate;
1051}

References SCH_LABEL_BASE::m_autoRotateOnPlacement.

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

◆ SetBold()

void EDA_TEXT::SetBold ( bool  aBold)
inherited

Definition at line 211 of file eda_text.cpp.

212{
213 m_attributes.m_Bold = aBold;
216}

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(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), and DIALOG_FIELD_PROPERTIES::updateText().

◆ SetBrightened()

◆ SetConnectivityDirty()

void SCH_ITEM::SetConnectivityDirty ( bool  aDirty = true)
inlineinherited