KiCad PCB EDA Suite
SCH_GLOBALLABEL Class Reference

#include <sch_text.h>

Inheritance diagram for SCH_GLOBALLABEL:
SCH_TEXT SCH_ITEM EDA_TEXT EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Member Functions

 SCH_GLOBALLABEL (const wxPoint &aPos=wxPoint(0, 0), const wxString &aText=wxEmptyString)
 
 SCH_GLOBALLABEL (const SCH_GLOBALLABEL &aGlobalLabel)
 
 ~SCH_GLOBALLABEL ()
 
wxString GetClass () const override
 Return the class name. More...
 
EDA_ITEMClone () const override
 Create a duplicate of this item with linked list members set to NULL. More...
 
void SwapData (SCH_ITEM *aItem) override
 Swap the internal data structures aItem with the schematic item. More...
 
SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const 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...
 
void RunOnChildren (const std::function< void(SCH_ITEM *)> &aFunction) override
 
void Rotate (const wxPoint &aCenter) override
 Rotate the item around aCenter 90 degrees in the clockwise direction. More...
 
void Rotate90 (bool aClockwise) override
 
void MirrorSpinStyle (bool aLeftRight) override
 
void MirrorHorizontally (int aCenter) override
 Mirror item horizontally about aCenter. More...
 
void MirrorVertically (int aCenter) override
 Mirror item vertically about aCenter. More...
 
void SetLabelSpinStyle (LABEL_SPIN_STYLE aSpinStyle) override
 Set a spin or rotation angle, along with specific horizontal and vertical justification styles with each angle. More...
 
wxPoint 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...
 
const EDA_RECT GetBoundingBoxBase () const
 Return the bounding box on the global label only, without taking in account the intersheet references. More...
 
const EDA_RECT GetBoundingBox () const override
 Return the bounding box on the global label only, including the intersheet references. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Override basic hit test to allow testing separately for label and intersheet refs which can move independently. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
 Test if aRect intersects or is contained within the bounding box of an item. More...
 
void CreateGraphicShape (const RENDER_SETTINGS *aRenderSettings, std::vector< wxPoint > &aPoints, const wxPoint &aPos) const override
 Calculate the graphic shape (a polygon) associated to the text. More...
 
void UpdateIntersheetRefProps ()
 
void AutoplaceFields (SCH_SCREEN *aScreen, bool aManual) override
 
bool ResolveTextVar (wxString *token, int aDepth) const
 
bool IsConnectable () const override
 
bool CanConnect (const SCH_ITEM *aItem) const override
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
void Print (const RENDER_SETTINGS *aSettings, const wxPoint &offset) override
 Print a schematic item. More...
 
void Plot (PLOTTER *aPlotter) const override
 Plot the schematic item to aPlotter. More...
 
SCH_FIELDGetIntersheetRefs ()
 
void SetIntersheetRefs (const SCH_FIELD &aField)
 
bool IsPointClickableAnchor (const wxPoint &aPos) const override
 
void Move (const wxPoint &aMoveVector) override
 Move the item by aMoveVector to a new position. More...
 
void GetContextualTextVars (wxArrayString *aVars) const
 Return the set of contextual text variable tokens for this text item. More...
 
wxString GetShownText (int aDepth=0) const override
 Return the string actually shown after processing of the base text. More...
 
bool IncrementLabel (int aIncrement)
 Increment the label text, if it ends with a number. More...
 
LABEL_SPIN_STYLE GetLabelSpinStyle () const
 
PINSHEETLABEL_SHAPE GetShape () const
 
void SetShape (PINSHEETLABEL_SHAPE aShape)
 
void Print (const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, const COLOR4D &aColor, OUTLINE_MODE aDisplay_mode=FILLED)
 Print this text object to the device context aDC. More...
 
bool operator< (const SCH_ITEM &aItem) const override
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
int GetTextOffset (const RENDER_SETTINGS *aSettings=nullptr) const
 
int GetLabelBoxExpansion (const RENDER_SETTINGS *aSettings=nullptr) const
 
int GetPenWidth () const override
 
bool Matches (const wxFindReplaceData &aSearchData, void *aAuxData) const override
 Compare the item against the search criteria in aSearchData. More...
 
bool Replace (const wxFindReplaceData &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 wxFindReplaceData &aSearchData)
 Helper function used in search and replace dialog. More...
 
virtual bool IsReplaceable () const override
 Override this method in any derived object that supports test find and replace. More...
 
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)
 
std::vector< wxPoint > GetConnectionPoints () const override
 Add all the connection points for this item to aPoints. More...
 
wxPoint GetPosition () const override
 
void SetPosition (const wxPoint &aPosition) override
 
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...
 
SCH_ITEMDuplicate (bool doClone=false) const
 Routine to create a new copy of given item. More...
 
virtual bool IsMovableFromAnchorPoint () const
 
wxPoint & GetStoredPos ()
 
void SetStoredPos (const wxPoint &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...
 
virtual bool IsHypertext () const
 Allow items to support hypertext actions when hovered/clicked. More...
 
virtual void DoHypertextMenu (EDA_DRAW_FRAME *aFrame)
 
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...
 
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 ClearConnections ()
 Clears all of the connection items from the list. More...
 
bool IsConnected (const wxPoint &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...
 
virtual bool ConnectionPropagatesTo (const EDA_ITEM *aItem) const
 Return true if this item should propagate connection info to aItem. More...
 
bool IsConnectivityDirty ()
 
void SetConnectivityDirty (bool aDirty=true)
 
NETCLASSPTR NetClass (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 bool HasLineStroke () const
 Check if this schematic item has line stoke properties. More...
 
virtual STROKE_PARAMS GetStroke () const
 
virtual void SetStroke (const STROKE_PARAMS &aStroke)
 
KICAD_T Type () const
 Returns the type of object. More...
 
EDA_ITEMGetParent () const
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Check whether the item is one of the listed types. More...
 
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 const wxPoint GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. 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)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 
virtual const wxString & GetText () const
 Return the string associated with the text object. More...
 
wxString ShortenedShownText () const
 Returns a shortened version (max 15 characters) of the shown text. 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 aDefaultWidth=0) const
 The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth. More...
 
virtual void SetTextAngle (double aAngle)
 
double GetTextAngle () const
 
double GetTextAngleDegrees () const
 
double GetTextAngleRadians () const
 
void SetItalic (bool isItalic)
 
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
 
EDA_TEXT_HJUSTIFY_T GetHorizJustify () const
 
EDA_TEXT_VJUSTIFY_T GetVertJustify () const
 
void SetHorizJustify (EDA_TEXT_HJUSTIFY_T aType)
 
void SetVertJustify (EDA_TEXT_VJUSTIFY_T aType)
 
void SetEffects (const EDA_TEXT &aSrc)
 Set the text effects from another instance. More...
 
void SwapEffects (EDA_TEXT &aTradingPartner)
 Swap the text effects of the two involved instances. More...
 
void SwapText (EDA_TEXT &aTradingPartner)
 
void CopyText (const EDA_TEXT &aSrc)
 
bool IsDefaultFormatting () const
 
void SetTextSize (const wxSize &aNewSize)
 
const wxSize & GetTextSize () const
 
void SetTextWidth (int aWidth)
 
int GetTextWidth () const
 
void SetTextHeight (int aHeight)
 
int GetTextHeight () const
 
void SetTextPos (const wxPoint &aPoint)
 
const wxPoint & GetTextPos () const
 
void SetTextX (int aX)
 
void SetTextY (int aY)
 
void Offset (const wxPoint &aOffset)
 
void Empty ()
 
std::vector< wxPoint > TransformToSegmentList () const
 Convert the text shape to a list of segment. More...
 
void TransformBoundingBoxWithClearanceToPolygon (SHAPE_POLY_SET *aCornerBuffer, int aClearanceValue) 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 () const
 
virtual bool TextHitTest (const wxPoint &aPoint, int aAccuracy=0) const
 Test if aPoint is within the bounds of this object. More...
 
virtual bool TextHitTest (const EDA_RECT &aRect, bool aContains, int aAccuracy=0) const
 Test if object bounding box is contained within or intersects aRect. More...
 
int LenSize (const wxString &aLine, int aThickness) const
 
EDA_RECT 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< wxPoint > &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 double GetDrawRotation () const
 
int Compare (const EDA_TEXT *aOther) const
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
static bool Replace (const wxFindReplaceData &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 SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const 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 EDA_TEXT_HJUSTIFY_T MapHorizJustify (int aHorizJustify)
 
static EDA_TEXT_VJUSTIFY_T MapVertJustify (int aVertJustify)
 

Public Attributes

const KIID m_Uuid
 

Protected Member Functions

bool Matches (const wxString &aText, const wxFindReplaceData &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 

Protected Attributes

PINSHEETLABEL_SHAPE m_shape
 
bool m_isDangling
 True if not connected to another object if the object derive from SCH_TEXT supports connections. More...
 
CONNECTION_TYPE m_connectionType
 
LABEL_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
 
wxPoint m_storedPos
 
std::unordered_map< SCH_SHEET_PATH, SCH_ITEM_SETm_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
 

Private Member Functions

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

Private Attributes

SCH_FIELD m_intersheetRefsField
 

Detailed Description

Definition at line 332 of file sch_text.h.

Constructor & Destructor Documentation

◆ SCH_GLOBALLABEL() [1/2]

SCH_GLOBALLABEL::SCH_GLOBALLABEL ( const wxPoint &  aPos = wxPoint( 0, 0 ),
const wxString &  aText = wxEmptyString 
)

Definition at line 921 of file sch_text.cpp.

921  :
923  m_intersheetRefsField( { 0, 0 }, 0, this )
924 {
927  m_isDangling = true;
928  SetMultilineAllowed( false );
929 
931 
932  m_intersheetRefsField.SetText( wxT( "${INTERSHEET_REFS}" ) );
936 }
bool m_isDangling
True if not connected to another object if the object derive from SCH_TEXT supports connections.
Definition: sch_text.h:262
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:483
SCH_LAYER_ID m_layer
Definition: sch_item.h:481
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:124
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:223
void SetLayer(SCH_LAYER_ID aLayer)
Set the layer this item is on.
Definition: sch_item.h:264
void SetMultilineAllowed(bool aAllow)
Definition: eda_text.h:216
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433
PINSHEETLABEL_SHAPE m_shape
Definition: sch_text.h:258
SCH_TEXT(const wxPoint &aPos=wxPoint(0, 0), const wxString &aText=wxEmptyString, KICAD_T aType=SCH_TEXT_T)
Definition: sch_text.cpp:205

References text.

Referenced by Clone().

◆ SCH_GLOBALLABEL() [2/2]

SCH_GLOBALLABEL::SCH_GLOBALLABEL ( const SCH_GLOBALLABEL aGlobalLabel)

Definition at line 939 of file sch_text.cpp.

939  :
940  SCH_TEXT( aGlobalLabel ),
941  m_intersheetRefsField( { 0, 0 }, 0, this )
942 {
944 
945  // Re-parent the fields, which before this had aGlobalLabel as parent
947 
948  m_fieldsAutoplaced = aGlobalLabel.m_fieldsAutoplaced;
949 }
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:483
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:116
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433
SCH_TEXT(const wxPoint &aPos=wxPoint(0, 0), const wxString &aText=wxEmptyString, KICAD_T aType=SCH_TEXT_T)
Definition: sch_text.cpp:205

◆ ~SCH_GLOBALLABEL()

SCH_GLOBALLABEL::~SCH_GLOBALLABEL ( )
inline

Definition at line 339 of file sch_text.h.

339 { }

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 170 of file sch_item.cpp.

171 {
172  m_connected_items[ aSheet ].insert( aItem );
173 }
std::unordered_map< SCH_SHEET_PATH, SCH_ITEM_SET > m_connected_items
Store pointers to other items that are connected to this one, per sheet.
Definition: sch_item.h:488

References SCH_ITEM::m_connected_items.

Referenced by SCH_TEXT::UpdateDanglingState().

◆ 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 430 of file sch_item.h.

431  {
432  if( GetFieldsAutoplaced() )
434  }
FIELDS_AUTOPLACED GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
Definition: sch_item.h:418
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
Definition: sch_item.h:436

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

Referenced by SCH_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Rotate(), and SCH_EDIT_FRAME::SelectUnit().

◆ AutoplaceFields()

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

Reimplemented from SCH_ITEM.

Definition at line 1193 of file sch_text.cpp.

1194 {
1195  int margin = GetTextOffset() * 2;
1196  int labelLen = GetBoundingBoxBase().GetSizeMax();
1197  int penOffset = GetPenWidth() / 2;
1198 
1199  // Set both axes to penOffset; we're going to overwrite the text axis below
1200  wxPoint offset( -penOffset, -penOffset );
1201 
1202  switch( GetLabelSpinStyle() )
1203  {
1204  default:
1208  offset.x = - ( labelLen + margin / 2 );
1209  break;
1210 
1211  case LABEL_SPIN_STYLE::UP:
1214  offset.y = - ( labelLen + margin / 2 );
1215  break;
1216 
1220  offset.x = labelLen + margin /2 ;
1221  break;
1222 
1226  offset.y = labelLen + margin / 2;
1227  break;
1228  }
1229 
1231 
1233 }
const EDA_RECT GetBoundingBoxBase() const
Return the bounding box on the global label only, without taking in account the intersheet references...
Definition: sch_text.cpp:1393
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: eda_text.h:71
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:267
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:483
int GetPenWidth() const override
Definition: sch_text.cpp:430
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:159
int GetTextOffset(const RENDER_SETTINGS *aSettings=nullptr) const
Definition: sch_text.cpp:396
wxPoint GetPosition() const override
Definition: sch_text.h:239
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:222
#define TEXT_ANGLE_VERT
Definition: eda_text.h:72
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:188
int GetSizeMax() const
Definition: eda_rect.h:96

References LABEL_SPIN_STYLE::BOTTOM, FIELDS_AUTOPLACED_AUTO, GetBoundingBoxBase(), SCH_TEXT::GetLabelSpinStyle(), SCH_TEXT::GetPenWidth(), SCH_TEXT::GetPosition(), EDA_RECT::GetSizeMax(), SCH_TEXT::GetTextOffset(), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, LABEL_SPIN_STYLE::LEFT, SCH_ITEM::m_fieldsAutoplaced, m_intersheetRefsField, LABEL_SPIN_STYLE::RIGHT, EDA_TEXT::SetHorizJustify(), EDA_TEXT::SetTextAngle(), EDA_TEXT::SetTextPos(), TEXT_ANGLE_HORIZ, TEXT_ANGLE_VERT, and LABEL_SPIN_STYLE::UP.

Referenced by UpdateIntersheetRefProps().

◆ CanConnect()

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

Reimplemented from SCH_ITEM.

Definition at line 399 of file sch_text.h.

400  {
401  return aItem->Type() == SCH_LINE_T &&
402  ( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
403  }
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:257
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References SCH_ITEM::GetLayer(), LAYER_BUS, LAYER_WIRE, SCH_LINE_T, and EDA_ITEM::Type().

◆ ClassOf()

static bool SCH_GLOBALLABEL::ClassOf ( const EDA_ITEM aItem)
inlinestatic

Definition at line 341 of file sch_text.h.

342  {
343  return aItem && SCH_GLOBAL_LABEL_T == aItem->Type();
344  }
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References SCH_GLOBAL_LABEL_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ 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 370 of file sch_item.h.

370 { m_connections.clear(); }
EDA_ITEMS m_connections
Definition: sch_item.h:482

References SCH_ITEM::m_connections.

◆ ClearEditFlags()

◆ ClearFieldsAutoplaced()

void SCH_ITEM::ClearFieldsAutoplaced ( )
inlineinherited

◆ ClearFlags()

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

Definition at line 154 of file eda_item.h.

154 { m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), FOOTPRINT::BuildPolyCourtyards(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), ConvertOutlineToPolygon(), 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(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), EE_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::narrowSelection(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 166 of file eda_item.h.

167  {
169  DO_NOT_DRAW );
170  }
#define DO_NOT_DRAW
Used to disable draw function.
#define STARTPOINT
When a line is selected, these flags indicate which.
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define CANDIDATE
flag indicating that the structure is connected
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:154
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define TEMP_SELECTED
flag indicating that the structure has already selected

References CANDIDATE, EDA_ITEM::ClearFlags(), DO_NOT_DRAW, ENDPOINT, IS_LINKED, SKIP_STRUCT, STARTPOINT, and TEMP_SELECTED.

Referenced by 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_GLOBALLABEL::Clone ( ) const
overridevirtual

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 SCH_TEXT.

Definition at line 952 of file sch_text.cpp.

953 {
954  return new SCH_GLOBALLABEL( *this );
955 }
SCH_GLOBALLABEL(const wxPoint &aPos=wxPoint(0, 0), const wxString &aText=wxEmptyString)
Definition: sch_text.cpp:921

References SCH_GLOBALLABEL().

◆ Compare()

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

Definition at line 662 of file eda_text.cpp.

663 {
664 #define TEST( a, b ) { if( a != b ) return a - b; }
665 #define TEST_PT( a, b ) { TEST( a.x, b.x ); TEST( a.y, b.y ); }
666 
667  TEST_PT( m_e.pos, aOther->m_e.pos );
668 
669  TEST_PT( m_e.size, aOther->m_e.size );
670  TEST( m_e.penwidth, aOther->m_e.penwidth );
671  TEST( m_e.angle, aOther->m_e.angle );
672 
673  TEST( m_e.hjustify, aOther->m_e.hjustify );
674  TEST( m_e.vjustify, aOther->m_e.vjustify );
675  TEST( m_e.bits, aOther->m_e.bits );
676 
677  return m_text.Cmp( aOther->m_text );
678 }
#define TEST(a, b)
TEXT_EFFECTS m_e
Definition: eda_text.h:412
signed char vjustify
vertical justification
Definition: eda_text.h:123
#define TEST_PT(a, b)
wxPoint pos
Definition: eda_text.h:127
wxSize size
Definition: eda_text.h:124
wxString m_text
Definition: eda_text.h:408
int bits
any set of booleans a client uses.
Definition: eda_text.h:121
double angle
now: 0.1 degrees; future: degrees
Definition: eda_text.h:126
signed char hjustify
horizontal justification
Definition: eda_text.h:122
int penwidth
Definition: eda_text.h:125

References TEXT_EFFECTS::angle, TEXT_EFFECTS::bits, TEXT_EFFECTS::hjustify, EDA_TEXT::m_e, EDA_TEXT::m_text, TEXT_EFFECTS::penwidth, TEXT_EFFECTS::pos, TEXT_EFFECTS::size, TEST, TEST_PT, and TEXT_EFFECTS::vjustify.

◆ 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 164 of file sch_item.cpp.

165 {
166  return m_connected_items[ aSheet ];
167 }
std::unordered_map< SCH_SHEET_PATH, SCH_ITEM_SET > m_connected_items
Store pointers to other items that are connected to this one, per sheet.
Definition: sch_item.h:488

References SCH_ITEM::m_connected_items.

Referenced by addConnections(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), CONNECTION_GRAPH::updateItemConnectivity(), 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 131 of file sch_item.cpp.

132 {
133  if( !aSheet )
134  aSheet = &Schematic()->CurrentSheet();
135 
136  auto it = m_connection_map.find( *aSheet );
137 
138  if( it == m_connection_map.end() )
139  return nullptr;
140  else
141  return it->second;
142 }
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
Definition: sch_item.h:491
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:121

References SCHEMATIC::CurrentSheet(), 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(), SCH_PIN::GetMsgPanelInfo(), SCH_BUS_ENTRY_BASE::GetMsgPanelInfo(), SCH_LINE::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), CONNECTION_SUBGRAPH::GetNetName(), highlightNet(), SCH_ITEM::InitializeConnection(), SCH_ITEM::NetClass(), SCH_TEXT::Plot(), Print(), SCH_HIERLABEL::Print(), SCH_EDIT_FRAME::RecalculateConnections(), CONNECTION_SUBGRAPH::ResolveDrivers(), 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, and SCH_PIN.

Definition at line 407 of file sch_item.h.

407 { return true; }

Referenced by CONNECTION_GRAPH::updateItemConnectivity().

◆ CopyText()

void EDA_TEXT::CopyText ( const EDA_TEXT aSrc)
inherited

Definition at line 131 of file eda_text.cpp.

132 {
133  m_text = aSrc.m_text;
134  m_shown_text = aSrc.m_shown_text;
136 }
wxString m_shown_text
Definition: eda_text.h:409
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:410
wxString m_text
Definition: eda_text.h:408

References EDA_TEXT::m_shown_text, EDA_TEXT::m_shown_text_has_text_var_refs, and EDA_TEXT::m_text.

Referenced by LIB_FIELD::Copy(), and CLIPBOARD_IO::SaveSelection().

◆ CreateGraphicShape()

void SCH_GLOBALLABEL::CreateGraphicShape ( const RENDER_SETTINGS aSettings,
std::vector< wxPoint > &  aPoints,
const wxPoint &  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_TEXT.

Definition at line 1321 of file sch_text.cpp.

1323 {
1324  int margin = GetLabelBoxExpansion( aRenderSettings );
1325  int halfSize = ( GetTextHeight() / 2 ) + margin;
1326  int linewidth = GetPenWidth();
1327  int symb_len = LenSize( GetShownText(), linewidth ) + 2 * margin;
1328 
1329  int x = symb_len + linewidth + 3;
1330  int y = halfSize + linewidth + 3;
1331 
1332  aPoints.clear();
1333 
1334  // Create outline shape : 6 points
1335  aPoints.emplace_back( wxPoint( 0, 0 ) );
1336  aPoints.emplace_back( wxPoint( 0, -y ) ); // Up
1337  aPoints.emplace_back( wxPoint( -x, -y ) ); // left
1338  aPoints.emplace_back( wxPoint( -x, 0 ) ); // Up left
1339  aPoints.emplace_back( wxPoint( -x, y ) ); // left down
1340  aPoints.emplace_back( wxPoint( 0, y ) ); // down
1341 
1342  int x_offset = 0;
1343 
1344  switch( m_shape )
1345  {
1347  x_offset = -halfSize;
1348  aPoints[0].x += halfSize;
1349  break;
1350 
1352  aPoints[3].x -= halfSize;
1353  break;
1354 
1357  x_offset = -halfSize;
1358  aPoints[0].x += halfSize;
1359  aPoints[3].x -= halfSize;
1360  break;
1361 
1363  default:
1364  break;
1365  }
1366 
1367  int angle = 0;
1368 
1369  switch( GetLabelSpinStyle() )
1370  {
1371  default:
1372  case LABEL_SPIN_STYLE::LEFT: break;
1373  case LABEL_SPIN_STYLE::UP: angle = -900; break;
1374  case LABEL_SPIN_STYLE::RIGHT: angle = 1800; break;
1375  case LABEL_SPIN_STYLE::BOTTOM: angle = 900; break;
1376  }
1377 
1378  // Rotate outlines and move corners in real position
1379  for( wxPoint& aPoint : aPoints )
1380  {
1381  aPoint.x += x_offset;
1382 
1383  if( angle )
1384  RotatePoint( &aPoint, angle );
1385 
1386  aPoint += Pos;
1387  }
1388 
1389  aPoints.push_back( aPoints[0] ); // closing
1390 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
int GetTextHeight() const
Definition: eda_text.h:265
int GetPenWidth() const override
Definition: sch_text.cpp:430
int LenSize(const wxString &aLine, int aThickness) const
Definition: eda_text.cpp:204
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:159
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_text.cpp:590
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
int GetLabelBoxExpansion(const RENDER_SETTINGS *aSettings=nullptr) const
Definition: sch_text.cpp:413
PINSHEETLABEL_SHAPE m_shape
Definition: sch_text.h:258

References PNS::angle(), LABEL_SPIN_STYLE::BOTTOM, SCH_TEXT::GetLabelBoxExpansion(), SCH_TEXT::GetLabelSpinStyle(), SCH_TEXT::GetPenWidth(), SCH_TEXT::GetShownText(), EDA_TEXT::GetTextHeight(), LABEL_SPIN_STYLE::LEFT, EDA_TEXT::LenSize(), SCH_TEXT::m_shape, PS_BIDI, PS_INPUT, PS_OUTPUT, PS_TRISTATE, PS_UNSPECIFIED, LABEL_SPIN_STYLE::RIGHT, RotatePoint(), and LABEL_SPIN_STYLE::UP.

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

◆ DoHypertextMenu()

virtual void SCH_ITEM::DoHypertextMenu ( EDA_DRAW_FRAME aFrame)
inlinevirtualinherited

Reimplemented in SCH_FIELD.

Definition at line 252 of file sch_item.h.

252 { }

◆ doIsConnected()

bool SCH_GLOBALLABEL::doIsConnected ( const wxPoint &  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 wxPoint object containing the test position.
Returns
True if connection to aPosition exists.

Reimplemented from SCH_ITEM.

Definition at line 428 of file sch_text.h.

429  {
430  return EDA_TEXT::GetTextPos() == aPosition;
431  }
const wxPoint & GetTextPos() const
Definition: eda_text.h:268

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 78 of file sch_item.cpp.

79 {
80  SCH_ITEM* newItem = (SCH_ITEM*) Clone();
81 
82  if( !doClone )
83  const_cast<KIID&>( newItem->m_Uuid ) = KIID();
84 
85  newItem->ClearFlags( SELECTED | BRIGHTENED );
86 
87  newItem->RunOnChildren(
88  []( SCH_ITEM* aChild )
89  {
90  aChild->ClearFlags( SELECTED | BRIGHTENED );
91  } );
92 
93  return newItem;
94 }
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:83
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
Definition: sch_item.h:438
Definition: kiid.h:44
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:154
#define SELECTED
const KIID m_Uuid
Definition: eda_item.h:475
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
#define BRIGHTENED
item is drawn with a bright contour

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

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

◆ Empty()

void EDA_TEXT::Empty ( )
inlineinherited

Definition at line 275 of file eda_text.h.

275 { m_text.Empty(); }
wxString m_text
Definition: eda_text.h:408

References EDA_TEXT::m_text.

Referenced by SCH_LEGACY_PLUGIN_CACHE::LoadPart().

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

537 {
538 #ifndef GERBVIEW // Gerbview does not use EDA_TEXT::Format
539  // and does not define FormatInternalUnits, used here
540  // however this function should exist
541 
542  aFormatter->Print( aNestLevel + 1, "(effects" );
543 
544  // Text size
545  aFormatter->Print( 0, " (font" );
546 
547  aFormatter->Print( 0, " (size %s %s)",
548  FormatInternalUnits( GetTextHeight() ).c_str(),
549  FormatInternalUnits( GetTextWidth() ).c_str() );
550 
551  if( GetTextThickness() )
552  {
553  aFormatter->Print( 0, " (thickness %s)",
554  FormatInternalUnits( GetTextThickness() ).c_str() );
555  }
556 
557  if( IsBold() )
558  aFormatter->Print( 0, " bold" );
559 
560  if( IsItalic() )
561  aFormatter->Print( 0, " italic" );
562 
563  aFormatter->Print( 0, ")"); // (font
564 
567  {
568  aFormatter->Print( 0, " (justify");
569 
571  aFormatter->Print( 0, GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT ? " left" : " right" );
572 
574  aFormatter->Print( 0, GetVertJustify() == GR_TEXT_VJUSTIFY_TOP ? " top" : " bottom" );
575 
576  if( IsMirrored() )
577  aFormatter->Print( 0, " mirror" );
578 
579  aFormatter->Print( 0, ")" ); // (justify
580  }
581 
582  if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() )
583  aFormatter->Print( 0, " hide" );
584 
585  aFormatter->Print( 0, ")\n" ); // (justify
586 
587 #endif
588 }
bool IsBold() const
Definition: eda_text.h:204
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:220
bool IsMirrored() const
Definition: eda_text.h:210
int GetTextThickness() const
Definition: eda_text.h:181
int GetTextHeight() const
Definition: eda_text.h:265
bool IsItalic() const
Definition: eda_text.h:201
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219
virtual bool IsVisible() const
Definition: eda_text.h:207
int GetTextWidth() const
Definition: eda_text.h:262
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:426
#define CTL_OMIT_HIDE
Definition: eda_text.h:77
std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from internal units to a string appropriate for writing ...
Definition: base_units.cpp:485

References CTL_OMIT_HIDE, FormatInternalUnits(), EDA_TEXT::GetHorizJustify(), EDA_TEXT::GetTextHeight(), EDA_TEXT::GetTextThickness(), EDA_TEXT::GetTextWidth(), EDA_TEXT::GetVertJustify(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), EDA_TEXT::IsMirrored(), EDA_TEXT::IsVisible(), and OUTPUTFORMATTER::Print().

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

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

87  {
89  TYPE_ID thisType = TYPE_HASH( *this );
90  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
91  return object ? aProperty->getter( object ) : wxAny();
92  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual wxAny getter(void *aObject) const =0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [2/3]

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

Definition at line 95 of file inspectable.h.

96  {
98  TYPE_ID thisType = TYPE_HASH( *this );
99  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
100  return object ? aProperty->get<T>( object ) : T();
101  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Get() [3/3]

template<typename T >
boost::optional<T> INSPECTABLE::Get ( const wxString &  aProperty)
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  boost::optional<T> ret = T();
110 
111  if( prop )
112  {
113  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114 
115  if( object )
116  ret = prop->get<T>( object );
117  }
118 
119  return ret;
120  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ GetBoundingBox()

const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox ( ) const
overridevirtual

Return the bounding box on the global label only, including the intersheet references.

Reimplemented from SCH_TEXT.

Definition at line 1443 of file sch_text.cpp.

1444 {
1445  // build the bounding box on the global label only, including the intersheets references
1446  // full bounding box if they are shown
1447 
1448  EDA_RECT box( GetBoundingBoxBase() );
1449 
1450  // Note: Schematic() can be null in preference preview panel
1451  if( Schematic() && Schematic()->Settings().m_IntersheetRefsShow )
1452  {
1453  box.Merge( m_intersheetRefsField.GetBoundingBox() );
1454  box.Normalize();
1455  }
1456 
1457  return box;
1458 }
const EDA_RECT GetBoundingBoxBase() const
Return the bounding box on the global label only, without taking in account the intersheet references...
Definition: sch_text.cpp:1393
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_field.cpp:266
Handle the component boundary box.
Definition: eda_rect.h:42

References SCH_FIELD::GetBoundingBox(), GetBoundingBoxBase(), m_intersheetRefsField, EDA_RECT::Merge(), EDA_RECT::Normalize(), and SCH_ITEM::Schematic().

◆ GetBoundingBoxBase()

const EDA_RECT SCH_GLOBALLABEL::GetBoundingBoxBase ( ) const

Return the bounding box on the global label only, without taking in account the intersheet references.

Definition at line 1393 of file sch_text.cpp.

1394 {
1395  // build the bounding box on the global label only, without taking in account
1396  // the intersheets references, just the bounding box of the graphic shape
1397  int x = GetTextPos().x;
1398  int y = GetTextPos().y;
1399  int penWidth = GetEffectiveTextPenWidth();
1400  int margin = GetTextOffset();
1401  int height = ( ( GetTextHeight() * 15 ) / 10 ) + penWidth + margin;
1402  int length = LenSize( GetShownText(), penWidth )
1403  + height // add height for triangular shapes
1404  - margin; // margin added to height not needed here
1405 
1406  int dx, dy;
1407 
1408  switch( GetLabelSpinStyle() ) // respect orientation
1409  {
1410  default:
1412  dx = -length;
1413  dy = height;
1414  y -= height / 2;
1415  break;
1416 
1417  case LABEL_SPIN_STYLE::UP:
1418  dx = height;
1419  dy = -length;
1420  x -= height / 2;
1421  break;
1422 
1424  dx = length;
1425  dy = height;
1426  y -= height / 2;
1427  break;
1428 
1430  dx = height;
1431  dy = length;
1432  x -= height / 2;
1433  break;
1434  }
1435 
1436  EDA_RECT box( wxPoint( x, y ), wxSize( dx, dy ) );
1437 
1438  box.Normalize();
1439  return box;
1440 }
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:159
int GetTextHeight() const
Definition: eda_text.h:265
int LenSize(const wxString &aLine, int aThickness) const
Definition: eda_text.cpp:204
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:159
int GetTextOffset(const RENDER_SETTINGS *aSettings=nullptr) const
Definition: sch_text.cpp:396
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_text.cpp:590
Handle the component boundary box.
Definition: eda_rect.h:42
const wxPoint & GetTextPos() const
Definition: eda_text.h:268

References LABEL_SPIN_STYLE::BOTTOM, EDA_TEXT::GetEffectiveTextPenWidth(), SCH_TEXT::GetLabelSpinStyle(), SCH_TEXT::GetShownText(), EDA_TEXT::GetTextHeight(), SCH_TEXT::GetTextOffset(), EDA_TEXT::GetTextPos(), LABEL_SPIN_STYLE::LEFT, EDA_TEXT::LenSize(), EDA_RECT::Normalize(), LABEL_SPIN_STYLE::RIGHT, and LABEL_SPIN_STYLE::UP.

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

◆ GetClass()

wxString SCH_GLOBALLABEL::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Reimplemented from SCH_TEXT.

Definition at line 346 of file sch_text.h.

347  {
348  return wxT( "SCH_GLOBALLABEL" );
349  }

◆ GetConnectionPoints()

std::vector< wxPoint > SCH_TEXT::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 535 of file sch_text.cpp.

536 {
537  // Normal text labels do not have connection points. All others do.
538  if( Type() == SCH_TEXT_T )
539  return {};
540 
541  return { GetTextPos() };
542 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References EDA_TEXT::GetTextPos(), SCH_TEXT_T, and EDA_ITEM::Type().

◆ GetContextualTextVars()

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

Return the set of contextual text variable tokens for this text item.

Parameters
[out]aVars

Definition at line 580 of file sch_text.cpp.

581 {
583  aVars->push_back( wxT( "CONNECTION_TYPE" ) );
584 
585  if( Type() == SCH_SHEET_PIN_T && m_parent )
586  static_cast<SCH_SHEET*>( m_parent )->GetContextualTextVars( aVars );
587 }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References EDA_ITEM::m_parent, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_SHEET_PIN_T, and EDA_ITEM::Type().

Referenced by DIALOG_TEXT_AND_LABEL_PROPERTIES::onScintillaCharAdded().

◆ GetDrawRotation()

double EDA_TEXT::GetDrawRotation ( ) const
virtualinherited

Reimplemented in FP_TEXT.

Definition at line 656 of file eda_text.cpp.

657 {
658  return GetTextAngle();
659 }
double GetTextAngle() const
Definition: eda_text.h:195

References EDA_TEXT::GetTextAngle().

Referenced by PCB_TEXT::TextHitTest(), and EDA_TEXT::TransformToSegmentList().

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 158 of file eda_item.h.

159  {
160  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
162 
163  return m_flags & mask;
164  }
#define IS_NEW
New item, just created.
#define IS_RESIZING
Item being resized.
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_MOVING
Item being moved.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

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

Referenced by 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_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), and DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveTextPenWidth()

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

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

Definition at line 159 of file eda_text.cpp.

160 {
161  int width = GetTextThickness();
162 
163  if( width <= 1 )
164  {
165  width = aDefaultWidth;
166 
167  if( IsBold() )
168  width = GetPenSizeForBold( GetTextWidth() );
169  else if( width <= 1 )
170  width = GetPenSizeForNormal( GetTextWidth() );
171  }
172 
173  // Clip pen size for small texts:
175 
176  return width;
177 }
bool IsBold() const
Definition: eda_text.h:204
int GetPenSizeForBold(int aTextSize)
Definition: gr_text.cpp:46
int GetTextThickness() const
Definition: eda_text.h:181
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Don't allow text to become cluttered up in its own fatness.
Definition: gr_text.cpp:67
const wxSize & GetTextSize() const
Definition: eda_text.h:259
int GetPenSizeForNormal(int aTextSize)
Definition: gr_text.cpp:52
#define ALLOW_BOLD_THICKNESS
Definition: base_units.h:56
int GetTextWidth() const
Definition: eda_text.h:262

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

Referenced by BOARD_ADAPTER::addShapeWithClearance(), KIGFX::DS_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), SCH_HIERLABEL::GetBoundingBox(), GetBoundingBoxBase(), EDA_TEXT::GetEffectiveTextShape(), LIB_TEXT::GetPenWidth(), LIB_FIELD::GetPenWidth(), SCH_FIELD::GetPenWidth(), SCH_TEXT::GetPenWidth(), EDA_TEXT::GetTextBox(), KIGFX::SCH_PAINTER::getTextThickness(), LIB_TEXT::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), LIB_TEXT::print(), SCH_FIELD::Print(), EDA_TEXT::printOneLineOfText(), PNS_KICAD_IFACE_BASE::syncTextItem(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), FP_TEXT::TransformTextShapeWithClearanceToPolygon(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), PCB_DIM_ALIGNED::updateText(), and PCB_DIM_ORTHOGONAL::updateText().

◆ GetEffectiveTextShape()

std::shared_ptr< SHAPE_COMPOUND > EDA_TEXT::GetEffectiveTextShape ( ) const
inherited

Definition at line 643 of file eda_text.cpp.

644 {
645  std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
646  int penWidth = GetEffectiveTextPenWidth();
647  std::vector<wxPoint> pts = TransformToSegmentList();
648 
649  for( unsigned jj = 0; jj < pts.size(); jj += 2 )
650  shape->AddShape( new SHAPE_SEGMENT( pts[jj], pts[jj+1], penWidth ) );
651 
652  return shape;
653 }
std::vector< wxPoint > TransformToSegmentList() const
Convert the text shape to a list of segment.
Definition: eda_text.cpp:603
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:159

References EDA_TEXT::GetEffectiveTextPenWidth(), and EDA_TEXT::TransformToSegmentList().

Referenced by PCB_TEXT::GetEffectiveShape(), and FP_TEXT::GetEffectiveShape().

◆ GetEndPoints()

void SCH_TEXT::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.

Definition at line 445 of file sch_text.cpp.

446 {
447  // Normal text labels cannot be tested for dangling ends.
448  if( Type() == SCH_TEXT_T )
449  return;
450 
451  DANGLING_END_ITEM item( LABEL_END, this, GetTextPos() );
452  aItemList.push_back( item );
453 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition: sch_item.h:79
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References EDA_TEXT::GetTextPos(), LABEL_END, SCH_TEXT_T, and EDA_ITEM::Type().

◆ GetFieldsAutoplaced()

FIELDS_AUTOPLACED SCH_ITEM::GetFieldsAutoplaced ( ) const
inlineinherited

Return whether the fields have been automatically placed.

Definition at line 418 of file sch_item.h.

418 { return m_fieldsAutoplaced; }
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:483

References SCH_ITEM::m_fieldsAutoplaced.

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

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

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

Reimplemented in BOARD, PCB_TRACK, and PCB_SHAPE.

Definition at line 259 of file eda_item.h.

259 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: eda_item.h:252

References EDA_ITEM::GetPosition().

Referenced by PCB_BASE_FRAME::FocusOnItem(), and SCH_EDIT_FRAME::FocusOnItem().

◆ GetHorizJustify()

EDA_TEXT_HJUSTIFY_T EDA_TEXT::GetHorizJustify ( ) const
inlineinherited

Definition at line 219 of file eda_text.h.

219 { return EDA_TEXT_HJUSTIFY_T( m_e.hjustify ); };
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:82
TEXT_EFFECTS m_e
Definition: eda_text.h:412
signed char hjustify
horizontal justification
Definition: eda_text.h:122

References TEXT_EFFECTS::hjustify, and EDA_TEXT::m_e.

Referenced by BOARD_ADAPTER::addShapeWithClearance(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), EDA_TEXT_DESC::EDA_TEXT_DESC(), AUTOPLACER::fieldHorizPlacement(), EDA_TEXT::Format(), LIB_TEXT::GetMsgPanelInfo(), LIB_FIELD::GetMsgPanelInfo(), SCH_FIELD::GetMsgPanelInfo(), EDA_TEXT::GetTextBox(), EDA_TEXT::IsDefaultFormatting(), SCH_FIELD::IsHorizJustifyFlipped(), FP_TEXT::KeepUpright(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EDIT_TOOL::Mirror(), LIB_TEXT::MirrorHorizontal(), MirrorHorizontally(), MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), LIB_TEXT::NormalizeJustification(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), positioningChanged(), LIB_FIELD::print(), EDA_TEXT::printOneLineOfText(), LIB_TEXT::Rotate(), Rotate90(), SCH_LEGACY_PLUGIN::saveField(), KIGFX::GAL::SetTextAttributes(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), FP_TEXT::TransformTextShapeWithClearanceToPolygon(), EDA_TEXT::TransformToSegmentList(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

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

234 {
236 }
static double GetInterline(double aGlyphHeight)
Compute the distance (interline) between 2 lines of text (for multiline texts).
int GetTextHeight() const
Definition: eda_text.h:265
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:73

References KIGFX::STROKE_FONT::GetInterline(), EDA_TEXT::GetTextHeight(), and KiROUND().

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

◆ GetIntersheetRefs()

◆ GetLabelBoxExpansion()

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

Definition at line 413 of file sch_text.cpp.

414 {
415  double ratio;
416 
417  if( aSettings )
418  ratio = static_cast<const SCH_RENDER_SETTINGS*>( aSettings )->m_LabelSizeRatio;
419  else if( Schematic() )
420  ratio = Schematic()->Settings().m_LabelSizeRatio;
421  else
422  ratio = DEFAULT_LABEL_SIZE_RATIO; // For previews (such as in Preferences), etc.
423 
424  return KiROUND( ratio * GetTextSize().y );
425 
426  return 0;
427 }
#define DEFAULT_LABEL_SIZE_RATIO
The offset of the pin name string from the end of the pin in mils.
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:167
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
const wxSize & GetTextSize() const
Definition: eda_text.h:259
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:73

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

Referenced by CreateGraphicShape(), and GetSchematicTextOffset().

◆ GetLabelSpinStyle()

◆ GetLayer()

◆ GetLinePositions()

void EDA_TEXT::GetLinePositions ( std::vector< wxPoint > &  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 wxPoint positions.
aLineCountis the number of lines (not recalculated here for efficiency reasons.

Definition at line 440 of file eda_text.cpp.

441 {
442  wxPoint pos = GetTextPos(); // Position of first line of the
443  // multiline text according to
444  // the center of the multiline text block
445 
446  wxPoint offset; // Offset to next line.
447 
448  offset.y = GetInterline();
449 
450  if( aLineCount > 1 )
451  {
452  switch( GetVertJustify() )
453  {
455  break;
456 
458  pos.y -= ( aLineCount - 1 ) * offset.y / 2;
459  break;
460 
462  pos.y -= ( aLineCount - 1 ) * offset.y;
463  break;
464  }
465  }
466 
467  // Rotate the position of the first line
468  // around the center of the multiline text block
469  RotatePoint( &pos, GetTextPos(), GetTextAngle() );
470 
471  // Rotate the offset lines to increase happened in the right direction
472  RotatePoint( &offset, GetTextAngle() );
473 
474  for( int ii = 0; ii < aLineCount; ii++ )
475  {
476  aPositions.push_back( pos );
477  pos += offset;
478  }
479 }
int GetInterline() const
Return the distance between two lines of text.
Definition: eda_text.cpp:233
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:220
double GetTextAngle() const
Definition: eda_text.h:195
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
const wxPoint & GetTextPos() const
Definition: eda_text.h:268

References EDA_TEXT::GetInterline(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetVertJustify(), GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, and RotatePoint().

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

◆ GetMenuImage()

BITMAPS SCH_GLOBALLABEL::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 SCH_TEXT.

Definition at line 1467 of file sch_text.cpp.

1468 {
1469  return BITMAPS::add_glabel;
1470 }

References add_glabel.

◆ GetMsgPanelInfo()

void SCH_TEXT::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 739 of file sch_text.cpp.

740 {
741  wxString msg;
742 
743  switch( Type() )
744  {
745  case SCH_TEXT_T: msg = _( "Graphic Text" ); break;
746  case SCH_LABEL_T: msg = _( "Label" ); break;
747  case SCH_GLOBAL_LABEL_T: msg = _( "Global Label" ); break;
748  case SCH_HIER_LABEL_T: msg = _( "Hierarchical Label" ); break;
749  case SCH_SHEET_PIN_T: msg = _( "Hierarchical Sheet Pin" ); break;
750  default: return;
751  }
752 
753  // Don't use GetShownText() here; we want to show the user the variable references
754  aList.emplace_back( msg, UnescapeString( GetText() ) );
755 
756  // Display electrical type if it is relevant
758  aList.emplace_back( _( "Type" ), getElectricalTypeLabel( GetShape() ) );
759 
760  wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
761  int style = 0;
762 
763  if( IsItalic() )
764  style = 1;
765 
766  if( IsBold() )
767  style += 2;
768 
769  aList.emplace_back( _( "Style" ), textStyle[style] );
770 
771  aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),
772  GetTextWidth() ) );
773 
774  switch( GetLabelSpinStyle() )
775  {
776  case LABEL_SPIN_STYLE::LEFT: msg = _( "Align right" ); break;
777  case LABEL_SPIN_STYLE::UP: msg = _( "Align bottom" ); break;
778  case LABEL_SPIN_STYLE::RIGHT: msg = _( "Align left" ); break;
779  case LABEL_SPIN_STYLE::BOTTOM: msg = _( "Align top" ); break;
780  default: msg = wxT( "???" ); break;
781  }
782 
783  aList.emplace_back( _( "Justification" ), msg );
784 
785  SCH_CONNECTION* conn = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) ? Connection() : nullptr;
786 
787  if( conn )
788  {
789  conn->AppendInfoToMsgPanel( aList );
790 
791  if( !conn->IsBus() )
792  {
793  NET_SETTINGS& netSettings = Schematic()->Prj().GetProjectFile().NetSettings();
794  const wxString& netname = conn->Name( true );
795 
796  if( netSettings.m_NetClassAssignments.count( netname ) )
797  {
798  const wxString& netclassName = netSettings.m_NetClassAssignments[ netname ];
799  aList.emplace_back( _( "Assigned Netclass" ), netclassName );
800  }
801  }
802  }
803 }
bool IsBold() const
Definition: eda_text.h:204
std::map< wxString, wxString > m_NetClassAssignments
Definition: net_settings.h:44
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:145
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
NET_SETTINGS & NetSettings()
Definition: project_file.h:94
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:131
bool IsItalic() const
Definition: eda_text.h:201
wxString Name(bool aIgnoreSheet=false) const
void AppendInfoToMsgPanel(std::vector< MSG_PANEL_ITEM > &aList) const
Adds information about the connection object to aList.
#define _(s)
NET_SETTINGS stores various net-related settings in a project context.
Definition: net_settings.h:32
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:159
wxString UnescapeString(const wxString &aSource)
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:75
int GetTextWidth() const
Definition: eda_text.h:262
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
wxString getElectricalTypeLabel(PINSHEETLABEL_SHAPE aType)
Definition: sch_text.cpp:566
bool IsBus() const
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:154
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:161
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References _, SCH_CONNECTION::AppendInfoToMsgPanel(), LABEL_SPIN_STYLE::BOTTOM, SCH_ITEM::Connection(), getElectricalTypeLabel(), SCH_TEXT::GetLabelSpinStyle(), PROJECT::GetProjectFile(), SCH_TEXT::GetShape(), EDA_TEXT::GetText(), EDA_TEXT::GetTextWidth(), EDA_BASE_FRAME::GetUserUnits(), EDA_TEXT::IsBold(), SCH_CONNECTION::IsBus(), EDA_TEXT::IsItalic(), LABEL_SPIN_STYLE::LEFT, NET_SETTINGS::m_NetClassAssignments, MessageTextFromValue(), SCH_CONNECTION::Name(), PROJECT_FILE::NetSettings(), SCHEMATIC::Prj(), LABEL_SPIN_STYLE::RIGHT, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_SHEET_PIN_T, SCH_TEXT_T, SCH_ITEM::Schematic(), EDA_ITEM::Type(), UnescapeString(), and LABEL_SPIN_STYLE::UP.

◆ 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 430 of file sch_text.cpp.

431 {
432  return GetEffectiveTextPenWidth();
433 }
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:159

References EDA_TEXT::GetEffectiveTextPenWidth().

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

◆ GetPosition()

◆ GetSchematicTextOffset()

wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset ( const RENDER_SETTINGS aSettings) const
overridevirtual

This offset depends on the orientation, the type of text, and the area required to draw the associated graphic symbol or to put the text above a wire.

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

Reimplemented from SCH_TEXT.

Definition at line 1004 of file sch_text.cpp.

1005 {
1006  int horiz = GetLabelBoxExpansion( aSettings );
1007 
1008  // Center the text on the center line of "E" instead of "R" to make room for an overbar
1009  int vert = GetTextHeight() * 0.0715;
1010 
1011  switch( m_shape )
1012  {
1016  horiz += GetTextHeight() * 3 / 4; // Use three-quarters-height as proxy for triangle size
1017  break;
1018 
1021  default:
1022  break;
1023  }
1024 
1025  switch( GetLabelSpinStyle() )
1026  {
1027  default:
1028  case LABEL_SPIN_STYLE::LEFT: return wxPoint( -horiz, vert );
1029  case LABEL_SPIN_STYLE::UP: return wxPoint( vert, -horiz );
1030  case LABEL_SPIN_STYLE::RIGHT: return wxPoint( horiz, vert );
1031  case LABEL_SPIN_STYLE::BOTTOM: return wxPoint( vert, horiz );
1032  }
1033 }
int GetTextHeight() const
Definition: eda_text.h:265
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:159
int GetLabelBoxExpansion(const RENDER_SETTINGS *aSettings=nullptr) const
Definition: sch_text.cpp:413
PINSHEETLABEL_SHAPE m_shape
Definition: sch_text.h:258

References LABEL_SPIN_STYLE::BOTTOM, SCH_TEXT::GetLabelBoxExpansion(), SCH_TEXT::GetLabelSpinStyle(), EDA_TEXT::GetTextHeight(), LABEL_SPIN_STYLE::LEFT, SCH_TEXT::m_shape, PS_BIDI, PS_INPUT, PS_OUTPUT, PS_TRISTATE, PS_UNSPECIFIED, LABEL_SPIN_STYLE::RIGHT, and LABEL_SPIN_STYLE::UP.

Referenced by Print().

◆ GetSelectMenuText()

wxString SCH_GLOBALLABEL::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from SCH_TEXT.

Definition at line 1461 of file sch_text.cpp.

1462 {
1463  return wxString::Format( _( "Global Label '%s'" ), ShortenedShownText() );
1464 }
wxString ShortenedShownText() const
Returns a shortened version (max 15 characters) of the shown text.
Definition: eda_text.cpp:218
#define _(s)
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 _, Format(), and EDA_TEXT::ShortenedShownText().

◆ GetShape()

◆ GetShownText()

wxString SCH_TEXT::GetShownText ( int  aDepth = 0) 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.

Reimplemented from EDA_TEXT.

Definition at line 590 of file sch_text.cpp.

591 {
592  std::function<bool( wxString* )> textResolver =
593  [&]( wxString* token ) -> bool
594  {
595  if( ( Type() == SCH_GLOBAL_LABEL_T
596  || Type() == SCH_HIER_LABEL_T
597  || Type() == SCH_SHEET_PIN_T )
598  && token->IsSameAs( wxT( "CONNECTION_TYPE" ) ) )
599  {
600  *token = getElectricalTypeLabel( GetShape() );
601  return true;
602  }
603 
604  if( Type() == SCH_SHEET_PIN_T && m_parent )
605  {
606  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( m_parent );
607 
608  if( sheet->ResolveTextVar( token, aDepth ) )
609  return true;
610  }
611 
612  if( Type() == SCH_TEXT_T )
613  {
614  if( token->Contains( ':' ) )
615  {
616  if( Schematic()->ResolveCrossReference( token, aDepth ) )
617  return true;
618  }
619  else
620  {
621  SCHEMATIC* schematic = Schematic();
622  SCH_SHEET* sheet = schematic ? schematic->CurrentSheet().Last() : nullptr;
623 
624  if( sheet && sheet->ResolveTextVar( token, aDepth + 1 ) )
625  return true;
626  }
627  }
628 
629  return false;
630  };
631 
632  std::function<bool( wxString* )> schematicTextResolver =
633  [&]( wxString* token ) -> bool
634  {
635  return Schematic()->ResolveTextVar( token, aDepth + 1 );
636  };
637 
638  wxString text = EDA_TEXT::GetShownText();
639 
640  if( text == "~" ) // Legacy placeholder for empty string
641  {
642  text = "";
643  }
644  else if( HasTextVars() )
645  {
646  wxCHECK_MSG( Schematic(), wxEmptyString, "No parent SCHEMATIC set for SCH_TEXT!" );
647 
648  PROJECT* project = nullptr;
649 
650  if( Schematic() )
651  project = &Schematic()->Prj();
652 
653  if( aDepth < 10 )
654  text = ExpandTextVars( text, &textResolver, &schematicTextResolver, project );
655  }
656 
657  return text;
658 }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
Container for project specific data.
Definition: project.h:62
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:57
Holds all the data relating to one schematic.
Definition: schematic.h:59
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: schematic.cpp:123
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition: eda_text.h:172
bool ResolveCrossReference(wxString *token, int aDepth) const
Resolves text vars that refer to other items.
Definition: schematic.cpp:255
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:75
wxString getElectricalTypeLabel(PINSHEETLABEL_SHAPE aType)
Definition: sch_text.cpp:566
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
Definition: sch_sheet.cpp:210
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:121
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:162
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:161
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References SCHEMATIC::CurrentSheet(), ExpandTextVars(), getElectricalTypeLabel(), SCH_TEXT::GetShape(), EDA_TEXT::GetShownText(), EDA_TEXT::HasTextVars(), SCH_SHEET_PATH::Last(), EDA_ITEM::m_parent, SCHEMATIC::Prj(), project, SCHEMATIC::ResolveCrossReference(), SCHEMATIC::ResolveTextVar(), SCH_SHEET::ResolveTextVar(), SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_SHEET_PIN_T, SCH_TEXT_T, SCH_ITEM::Schematic(), text, and EDA_ITEM::Type().

Referenced by CreateGraphicShape(), KIGFX::SCH_PAINTER::draw(), SCH_HIERLABEL::GetBoundingBox(), GetBoundingBoxBase(), and SCH_TEXT::Plot().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 137 of file eda_item.h.

138  {
139  return m_status & type;
140  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 150 of file eda_item.h.

150 { return m_status; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

◆ GetStoredPos()

wxPoint& SCH_ITEM::GetStoredPos ( )
inlineinherited

Definition at line 220 of file sch_item.h.

220 { return m_storedPos; }
wxPoint m_storedPos
Definition: sch_item.h:484

References SCH_ITEM::m_storedPos.

◆ GetStroke()

virtual STROKE_PARAMS SCH_ITEM::GetStroke ( ) const
inlinevirtualinherited

Reimplemented in SCH_LINE, and SCH_BUS_ENTRY_BASE.

Definition at line 449 of file sch_item.h.

449 { wxCHECK( false, STROKE_PARAMS() ); }
Simple container to manage line stroke parameters.
Definition: sch_item.h:140

Referenced by DIALOG_LINE_WIRE_BUS_PROPERTIES::TransferDataToWindow().

◆ 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 154 of file eda_text.h.

154 { return m_text; }
wxString m_text
Definition: eda_text.h:408

References EDA_TEXT::m_text.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), SCH_EAGLE_PLUGIN::addImplicitConnections(), NETLIST_EXPORTER_XML::addSymbolFields(), SIM_PLOT_FRAME::AddTuner(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), CONNECTION_GRAPH::buildConnectionGraph(), LIB_TEXT::Clone(), LIB_TEXT::compare(), LIB_FIELD::compare(), 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(), SCH_FIELD::DoHypertextMenu(), KIGFX::SCH_PAINTER::draw(), EDA_TEXT_DESC::EDA_TEXT_DESC(), CONNECTION_GRAPH::ercCheckHierSheets(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), LIB_SYMBOL::Flatten(), PCB_IO::format(), FormatProbeItem(), SCH_SYMBOL::GetFootprint(), LIB_FIELD::GetFullText(), FOOTPRINT_INFO_GENERATOR::GetHtmlFieldRow(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadNet(), FP_TEXT::GetLength(), getMatchingTextItem(), PCB_TEXT::GetMsgPanelInfo(), LIB_TEXT::GetMsgPanelInfo(), LIB_FIELD::GetMsgPanelInfo(), SCH_FIELD::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_SYMBOL::GetRef(), FOOTPRINT::GetReference(), LIB_SYMBOL::GetSearchText(), PCB_DIMENSION_BASE::GetText(), FOOTPRINT::GetValue(), SCH_SYMBOL::GetValue(), LIB_FIELD::HitTest(), SCH_DRAWING_TOOLS::importHierLabel(), SCH_TEXT::IncrementLabel(), GENERAL_COLLECTOR::Inspect(), SCH_FIELD::IsVoid(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EAGLE_PLUGIN::loadSchematic(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_EAGLE_PLUGIN::loadSegments(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), SCH_TEXT::operator<(), SCH_FIELD::operator<(), LIB_FIELD::operator=(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_SEXPR_PARSER::parseSchematicSymbol(), SCH_EDITOR_CONTROL::Paste(), DRAWING_TOOL::PlaceText(), LIB_TEXT::Plot(), LIB_FIELD::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), DIALOG_RESCUE_EACH::PopulateInstanceList(), LIB_FIELD::print(), DIALOG_CHANGE_SYMBOLS::processSymbol(), processTextItem(), SCH_EDIT_FRAME::RecomputeIntersheetRefs(), ResolveTextVar(), SCH_SEXPR_PLUGIN::saveField(), SCH_LEGACY_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_LEGACY_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SYMBOL_VIEWER_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), EE_INSPECTION_TOOL::ShowDatasheet(), SCH_SHEET::SymbolCount(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), TUNER_SLIDER::TUNER_SLIDER(), SCH_EDITOR_CONTROL::updatePastedSymbol(), SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo(), and FP_TEXT::ViewGetLOD().

◆ GetTextAngle()

double EDA_TEXT::GetTextAngle ( ) const
inlineinherited

Definition at line 195 of file eda_text.h.

195 { return m_e.angle; }
TEXT_EFFECTS m_e
Definition: eda_text.h:412
double angle
now: 0.1 degrees; future: degrees
Definition: eda_text.h:126

References TEXT_EFFECTS::angle, and EDA_TEXT::m_e.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), BOARD_ADAPTER::addShapeWithClearance(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), KIGFX::DS_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), PCB_TEXT::Flip(), FP_TEXT::Flip(), PCB_IO::format(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), FP_TEXT::GetDrawRotation(), EDA_TEXT::GetDrawRotation(), EDA_TEXT::GetLinePositions(), EDA_TEXT::GetTextAngleDegrees(), EDA_TEXT::GetTextAngleRadians(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), FP_TEXT::KeepUpright(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), PCB_DIMENSION_BASE::Mirror(), LIB_TEXT::MirrorHorizontal(), MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), LIB_TEXT::NormalizeJustification(), EAGLE_PLUGIN::orientFPText(), ALTIUM_PCB::ParseTexts6Data(), LIB_TEXT::Plot(), LIB_FIELD::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotPcbText(), positioningChanged(), LIB_TEXT::print(), SCH_FIELD::Print(), LIB_FIELD::print(), EDA_TEXT::printOneLineOfText(), SCH_EDIT_TOOL::Rotate(), PCB_TEXT::Rotate(), LIB_TEXT::Rotate(), FP_TEXT::Rotate(), LIB_FIELD::Rotate(), PCB_DIMENSION_BASE::Rotate(), Rotate90(), SCH_LEGACY_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), EDA_TEXT::TextHitTest(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

◆ GetTextAngleDegrees()

double EDA_TEXT::GetTextAngleDegrees ( ) const
inlineinherited

◆ GetTextAngleRadians()

double EDA_TEXT::GetTextAngleRadians ( ) const
inlineinherited

◆ GetTextBox()

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

240 {
241  EDA_RECT rect;
242  wxArrayString strings;
243  wxString text = GetShownText();
244  int thickness = GetEffectiveTextPenWidth();
245  int linecount = 1;
246  bool hasOverBar = false; // true if the first line of text as an overbar
247 
248  if( IsMultilineAllowed() )
249  {
250  wxStringSplit( text, strings, '\n' );
251 
252  if( strings.GetCount() ) // GetCount() == 0 for void strings
253  {
254  if( aLine >= 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
255  text = strings.Item( aLine );
256  else
257  text = strings.Item( 0 );
258 
259  linecount = strings.GetCount();
260  }
261  }
262 
263  // Search for overbar symbol. Only text is scanned,
264  // because only this line can change the bounding box
265  for( unsigned ii = 1; ii < text.size(); ii++ )
266  {
267  if( text[ii-1] == '~' && text[ii] == '{' )
268  {
269  hasOverBar = true;
270  break;
271  }
272  }
273 
274  // calculate the H and V size
275  const auto& font = basic_gal.GetStrokeFont();
276  VECTOR2D fontSize( GetTextSize() );
277  double penWidth( thickness );
278  int dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
279  int dy = GetInterline();
280 
281  // Creates bounding box (rectangle) for horizontal, left and top justified text. The
282  // bounding box will be moved later according to the actual text options
283  wxSize textsize = wxSize( dx, dy );
284  wxPoint pos = GetTextPos();
285 
286  if( IsMultilineAllowed() && aLine > 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
287  {
288  pos.y -= aLine * GetInterline();
289  }
290 
291  if( aInvertY )
292  pos.y = -pos.y;
293 
294  rect.SetOrigin( pos );
295 
296  if( hasOverBar )
297  { // A overbar adds an extra size to the text
298  // Height from the base line text of chars like [ or {
299  double curr_height = GetTextHeight() * 1.15;
300  double overbarPosition = font.ComputeOverbarVerticalPosition( fontSize.y );
301  int extra_height = KiROUND( overbarPosition - curr_height );
302 
303  extra_height += thickness / 2;
304  textsize.y += extra_height;
305  rect.Move( wxPoint( 0, -extra_height ) );
306  }
307 
308  // for multiline texts and aLine < 0, merge all rectangles
309  // ( if aLine < 0, we want the full text bounding box )
310  if( IsMultilineAllowed() && aLine < 0 )
311  {
312  for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
313  {
314  text = strings.Item( ii );
315  dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
316  textsize.x = std::max( textsize.x, dx );
317  textsize.y += dy;
318  }
319  }
320 
321  rect.SetSize( textsize );
322 
323  /* Now, calculate the rect origin, according to text justification
324  * At this point the rectangle origin is the text origin (m_Pos).
325  * This is true only for left and top text justified texts (using top to bottom Y axis
326  * orientation). and must be recalculated for others justifications
327  * also, note the V justification is relative to the first line
328  */
329  switch( GetHorizJustify() )
330  {
332  if( IsMirrored() )
333  rect.SetX( rect.GetX() - rect.GetWidth() );
334  break;
335 
337  rect.SetX( rect.GetX() - (rect.GetWidth() / 2) );
338  break;
339 
341  if( !IsMirrored() )
342  rect.SetX( rect.GetX() - rect.GetWidth() );
343  break;
344  }
345 
346  switch( GetVertJustify() )
347  {
349  break;
350 
352  rect.SetY( rect.GetY() - ( dy / 2) );
353  break;
354 
356  rect.SetY( rect.GetY() - dy );
357  break;
358  }
359 
360  if( linecount > 1 )
361  {
362  int yoffset;
363  linecount -= 1;
364 
365  switch( GetVertJustify() )
366  {
368  break;
369 
371  yoffset = linecount * GetInterline() / 2;
372  rect.SetY( rect.GetY() - yoffset );
373  break;
374 
376  yoffset = linecount * GetInterline();
377  rect.SetY( rect.GetY() - yoffset );
378  break;
379  }
380  }
381 
382  // Many fonts draw diacriticals, descenders, etc. outside the X-height of the font. This
383  // will cacth most (but probably not all) of them.
384  rect.Inflate( 0, thickness * 1.5 );
385 
386  rect.Normalize(); // Make h and v sizes always >= 0
387 
388  return rect;
389 }
const STROKE_FONT & GetStrokeFont() const
int GetInterline() const
Return the distance between two lines of text.
Definition: eda_text.cpp:233
void Move(const wxPoint &aMoveVector)
Move the rectangle by the aMoveVector.
Definition: eda_rect.cpp:51
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:220
bool IsMirrored() const
Definition: eda_text.h:210
int GetX() const
Definition: eda_rect.h:98
int GetWidth() const
Definition: eda_rect.h:109
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:121
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:159
int GetTextHeight() const
Definition: eda_text.h:265
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219
const wxSize & GetTextSize() const
Definition: eda_text.h:259
void SetX(int val)
Definition: eda_rect.h:158
bool IsMultilineAllowed() const
Definition: eda_text.h:217
void SetY(int val)
Definition: eda_rect.h:164
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
void SetSize(const wxSize &size)
Definition: eda_rect.h:134
Handle the component boundary box.
Definition: eda_rect.h:42
int GetY() const
Definition: eda_rect.h:99
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:73
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
BASIC_GAL basic_gal(basic_displayOptions)
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:162
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References basic_gal, EDA_TEXT::GetEffectiveTextPenWidth(), EDA_TEXT::GetHorizJustify(), EDA_TEXT::GetInterline(), EDA_TEXT::GetShownText(), KIGFX::GAL::GetStrokeFont(), EDA_TEXT::GetTextHeight(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetVertJustify(), EDA_RECT::GetWidth(), EDA_RECT::GetX(), EDA_RECT::GetY(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, EDA_RECT::Inflate(), EDA_TEXT::IsMirrored(), EDA_TEXT::IsMultilineAllowed(), KiROUND(), EDA_RECT::Move(), EDA_RECT::Normalize(), EDA_RECT::SetOrigin(), EDA_RECT::SetSize(), EDA_RECT::SetX(), EDA_RECT::SetY(), text, wxStringSplit(), and VECTOR2< T >::y.

Referenced by LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), FP_TEXT::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), PCB_DIMENSION_BASE::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), DS_DRAW_ITEM_TEXT::GetBoundingBox(), LIB_TEXT::HitTest(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), LIB_TEXT::NormalizeJustification(), PCB_TEXT::TextHitTest(), FP_TEXT::TextHitTest(), EDA_TEXT::TextHitTest(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), and FP_TEXT::ViewBBox().

◆ GetTextHeight()

◆ GetTextOffset()

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

Definition at line 396 of file sch_text.cpp.

397 {
398  double ratio;
399 
400  if( aSettings )
401  ratio = static_cast<const SCH_RENDER_SETTINGS*>( aSettings )->m_TextOffsetRatio;
402  else if( Schematic() )
403  ratio = Schematic()->Settings().m_TextOffsetRatio;
404  else
405  ratio = DEFAULT_TEXT_OFFSET_RATIO; // For previews (such as in Preferences), etc.
406 
407  return KiROUND( ratio * GetTextSize().y );
408 
409  return 0;
410 }
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:167
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
const wxSize & GetTextSize() const
Definition: eda_text.h:259
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:73
#define DEFAULT_TEXT_OFFSET_RATIO
Ratio of the font height to space around global labels.

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

Referenced by AutoplaceFields(), SCH_LABEL::GetBoundingBox(), SCH_HIERLABEL::GetBoundingBox(), GetBoundingBoxBase(), SCH_TEXT::GetSchematicTextOffset(), and SCH_HIERLABEL::GetSchematicTextOffset().

◆ GetTextPos()

const wxPoint& EDA_TEXT::GetTextPos ( ) const
inlineinherited

Definition at line 268 of file eda_text.h.

268 { return m_e.pos; }
TEXT_EFFECTS m_e
Definition: eda_text.h:412
wxPoint pos
Definition: eda_text.h:127

References EDA_TEXT::m_e, and TEXT_EFFECTS::pos.

Referenced by BOARD_ADAPTER::addShapeWithClearance(), LIB_TEXT::compare(), LIB_FIELD::compare(), SCH_SHEET_PIN::ConstrainOnEdge(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), SCH_LABEL::doIsConnected(), doIsConnected(), SCH_HIERLABEL::doIsConnected(), KIGFX::DS_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), PCB_TEXT::Flip(), FP_TEXT::Flip(), PCB_IO::format(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), FP_TEXT::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), SCH_HIERLABEL::GetBoundingBox(), GetBoundingBoxBase(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_TEXT::GetConnectionPoints(), SCH_SHEET_PIN::GetEndPoints(), SCH_TEXT::GetEndPoints(), SCH_FIELD::GetLibPosition(), EDA_TEXT::GetLinePositions(), PCB_TEXT::GetPosition(), FP_TEXT::GetPosition(), LIB_TEXT::GetPosition(), LIB_FIELD::GetPosition(), SCH_FIELD::GetPosition(), SCH_TEXT::GetPosition(), DS_DRAW_ITEM_TEXT::GetPosition(), EDA_TEXT::GetTextBox(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), FP_TEXT::Mirror(), PCB_DIMENSION_BASE::Mirror(), LIB_TEXT::MirrorHorizontal(), LIB_FIELD::MirrorHorizontal(), SCH_SHEET_PIN::MirrorHorizontally(), SCH_TEXT::MirrorHorizontally(), MirrorHorizontally(), MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), LIB_FIELD::MirrorVertical(), SCH_SHEET_PIN::MirrorVertically(), SCH_TEXT::MirrorVertically(), MirrorVertically(), LIB_TEXT::NormalizeJustification(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), DRAWING_TOOL::PlaceText(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), LIB_FIELD::print(), EDA_TEXT::Print(), Print(), SCH_HIERLABEL::Print(), DIALOG_CHANGE_SYMBOLS::processSymbol(), PCB_TEXT::Rotate(), LIB_TEXT::Rotate(), FP_TEXT::Rotate(), SCH_SHEET_PIN::Rotate(), LIB_FIELD::Rotate(), SCH_TEXT::Rotate(), PCB_DIMENSION_BASE::Rotate(), Rotate(), Rotate90(), FP_TEXT::SetDrawCoord(), FP_TEXT::SetLocalCoord(), FP_TEXT::TextHitTest(), EDA_TEXT::TextHitTest(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), FP_TEXT::TransformShapeWithClearanceToPolygon(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), FP_TEXT::TransformTextShapeWithClearanceToPolygon(), EDA_TEXT::TransformToSegmentList(), SCH_TEXT::UpdateDanglingState(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), and FP_TEXT::ViewBBox().

◆ GetTextSize()

◆ GetTextStyleName()

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

Definition at line 501 of file eda_text.cpp.

502 {
503  int style = 0;
504 
505  if( IsItalic() )
506  style = 1;
507 
508  if( IsBold() )
509  style += 2;
510 
511  wxString stylemsg[4] = {
512  _("Normal"),
513  _("Italic"),
514  _("Bold"),
515  _("Bold+Italic")
516  };
517 
518  return stylemsg[style];
519 }
bool IsBold() const
Definition: eda_text.h:204
bool IsItalic() const
Definition: eda_text.h:201
#define _(s)

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

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

◆ GetTextThickness()

◆ GetTextWidth()

◆ GetVertJustify()

◆ HasFlag()

◆ 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_LINE, and SCH_BUS_ENTRY_BASE.

Definition at line 447 of file sch_item.h.

447 { return false; }

Referenced by EE_SELECTION::AllItemsHaveLineStroke(), and SCH_EDIT_TOOL::Properties().

◆ HasTextVars()

bool EDA_TEXT::HasTextVars ( ) const
inlineinherited

Indicates the ShownText has text var references which need to be processed.

Definition at line 172 of file eda_text.h.

bool m_shown_text_has_text_var_refs
Definition: eda_text.h:410

References EDA_TEXT::m_shown_text_has_text_var_refs.

Referenced by PCB_TEXT::GetShownText(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), and FP_TEXT::GetShownText().

◆ HitTest() [1/2]

bool SCH_GLOBALLABEL::HitTest ( const wxPoint &  aPosition,
int  aAccuracy = 0 
) const
overridevirtual

Override basic hit test to allow testing separately for label and intersheet refs which can move independently.

Returns
True if hit in either label or associated intersheet ref

Reimplemented from SCH_TEXT.

Definition at line 1473 of file sch_text.cpp.

1474 {
1475  EDA_RECT bbox = GetBoundingBoxBase();
1476  bbox.Inflate( aAccuracy );
1477 
1478  if( !bbox.Contains( aPosition ) )
1479  {
1481  {
1483  bbox.Inflate( aAccuracy );
1484 
1485  return bbox.Contains( aPosition );
1486  }
1487 
1488  return false;
1489  }
1490 
1491  return true;
1492 }
const EDA_RECT GetBoundingBoxBase() const
Return the bounding box on the global label only, without taking in account the intersheet references...
Definition: sch_text.cpp:1393
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:167
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_field.cpp:266
Handle the component boundary box.
Definition: eda_rect.h:42
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References EDA_RECT::Contains(), SCH_FIELD::GetBoundingBox(), GetBoundingBoxBase(), EDA_RECT::Inflate(), m_intersheetRefsField, SCHEMATIC_SETTINGS::m_IntersheetRefsShow, SCH_ITEM::Schematic(), and SCHEMATIC::Settings().

◆ HitTest() [2/2]

bool SCH_GLOBALLABEL::HitTest ( const EDA_RECT aRect,
bool  aContained,
int  aAccuracy = 0 
) const
overridevirtual

Test if aRect intersects or is contained within the bounding box of an item.

Parameters
aRectA reference to a EDA_RECT 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 SCH_TEXT.

Definition at line 1495 of file sch_text.cpp.

1496 {
1497  EDA_RECT bbox = GetBoundingBoxBase();
1498 
1499  if( aContained )
1500  {
1501  if( Schematic() && Schematic()->Settings().m_IntersheetRefsShow )
1503 
1504  bbox.Inflate( aAccuracy );
1505  return aRect.Contains( bbox );
1506  }
1507 
1508  bbox.Inflate( aAccuracy );
1509 
1510  if( aRect.Intersects( bbox ) )
1511  return true;
1512 
1514  {
1516  bbox.Inflate( aAccuracy );
1517 
1518  return aRect.Intersects( bbox );
1519  }
1520 
1521  return false;
1522 }
const EDA_RECT GetBoundingBoxBase() const
Return the bounding box on the global label only, without taking in account the intersheet references...
Definition: sch_text.cpp:1393
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:432
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:167
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_field.cpp:266
Handle the component boundary box.
Definition: eda_rect.h:42
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References EDA_RECT::Contains(), SCH_FIELD::GetBoundingBox(), GetBoundingBoxBase(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), m_intersheetRefsField, SCHEMATIC_SETTINGS::m_IntersheetRefsShow, EDA_RECT::Merge(), SCH_ITEM::Schematic(), and SCHEMATIC::Settings().

◆ IncrementLabel()

bool SCH_TEXT::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 236 of file sch_text.cpp.

237 {
238  wxString text = GetText();
239  bool ReturnVal = IncrementLabelMember( text, aIncrement );
240 
241  if( ReturnVal )
242  SetText( text );
243 
244  return ReturnVal;
245 }
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:124
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:154
bool IncrementLabelMember(wxString &name, int aIncrement)
Definition: sch_text.cpp:55

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 176 of file sch_item.cpp.

178 {
179  SCH_CONNECTION* connection = Connection( &aSheet );
180 
181  if( connection )
182  {
183  connection->Reset();
184  }
185  else
186  {
187  connection = new SCH_CONNECTION( this );
188  m_connection_map.insert( std::make_pair( aSheet, connection ) );
189  }
190 
191  connection->SetGraph( aGraph );
192  connection->SetSheet( aSheet );
193  return connection;
194 }
void SetSheet(SCH_SHEET_PATH aSheet)
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:131
void Reset()
Clears connectivity information.
void SetGraph(CONNECTION_GRAPH *aGraph)
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
Definition: sch_item.h:491
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).

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

◆ IsBold()

◆ IsBrightened()

◆ IsConnectable()

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

Reimplemented from SCH_ITEM.

Definition at line 397 of file sch_text.h.

397 { return true; }

◆ IsConnected()

bool SCH_ITEM::IsConnected ( const wxPoint &  aPoint) const
inherited

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

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

Definition at line 122 of file sch_item.cpp.

123 {
124  if(( m_flags & STRUCT_DELETED ) || ( m_flags & SKIP_STRUCT ) )
125  return false;
126 
127  return doIsConnected( aPosition );
128 }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
virtual bool doIsConnected(const wxPoint &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_item.h:478

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

Referenced by SCH_SCREEN::IsJunctionNeeded(), and SCH_SCREEN::IsTerminalPoint().

◆ IsConnectivityDirty()

bool SCH_ITEM::IsConnectivityDirty ( )
inlineinherited

Definition at line 409 of file sch_item.h.

409 { return m_connectivity_dirty; }
bool m_connectivity_dirty
Definition: sch_item.h:493

References SCH_ITEM::m_connectivity_dirty.

◆ IsDangling()

bool SCH_TEXT::IsDangling ( ) const
inlineoverridevirtualinherited

Reimplemented from SCH_ITEM.

Definition at line 230 of file sch_text.h.

230 { return m_isDangling; }
bool m_isDangling
True if not connected to another object if the object derive from SCH_TEXT supports connections.
Definition: sch_text.h:262

References SCH_TEXT::m_isDangling.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), and KIGFX::SCH_PAINTER::draw().

◆ IsDefaultFormatting()

bool EDA_TEXT::IsDefaultFormatting ( ) const
inherited

Definition at line 522 of file eda_text.cpp.

523 {
524  return ( IsVisible()
525  && !IsMirrored()
528  && GetTextThickness() == 0
529  && !IsItalic()
530  && !IsBold()
531  && !IsMultilineAllowed()
532  );
533 }
bool IsBold() const
Definition: eda_text.h:204
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:220
bool IsMirrored() const
Definition: eda_text.h:210
int GetTextThickness() const
Definition: eda_text.h:181
bool IsItalic() const
Definition: eda_text.h:201
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219
virtual bool IsVisible() const
Definition: eda_text.h:207
bool IsMultilineAllowed() const
Definition: eda_text.h:217

References EDA_TEXT::GetHorizJustify(), EDA_TEXT::GetTextThickness(), EDA_TEXT::GetVertJustify(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), EDA_TEXT::IsMirrored(), EDA_TEXT::IsMultilineAllowed(), and EDA_TEXT::IsVisible().

Referenced by SCH_SEXPR_PLUGIN::saveField().

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 121 of file eda_item.h.

121 { return m_flags & IS_DRAGGING; }
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 124 of file eda_item.h.

124 { return m_flags & ENTERED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#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 206 of file eda_item.h.

206 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:480

References EDA_ITEM::m_forceVisible.

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

◆ IsHypertext()

virtual bool SCH_ITEM::IsHypertext ( ) const
inlinevirtualinherited

Allow items to support hypertext actions when hovered/clicked.

Reimplemented in SCH_FIELD.

Definition at line 250 of file sch_item.h.

250 { return false; }

◆ IsItalic()

◆ IsLocked()

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

Definition at line 240 of file sch_item.h.

240 { return false; }

◆ IsMirrored()

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 118 of file eda_item.h.

118 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

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_SYMBOL, SCH_BITMAP, SCH_SHEET_PIN, SCH_SHEET, and SCH_BUS_ENTRY_BASE.

Definition at line 218 of file sch_item.h.

218 { return true; }

Referenced by SCH_MOVE_TOOL::Main().

◆ IsMoving()

◆ IsMultilineAllowed()

◆ IsNew()

◆ IsPointClickableAnchor()

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

Reimplemented from SCH_ITEM.

Definition at line 416 of file sch_text.h.

417  {
418  return m_isDangling && GetPosition() == aPos;
419  }
bool m_isDangling
True if not connected to another object if the object derive from SCH_TEXT supports connections.
Definition: sch_text.h:262
wxPoint GetPosition() const override
Definition: sch_text.h:239

References SCH_TEXT::GetPosition(), and SCH_TEXT::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 223 of file sch_text.h.

223 { return true; }

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 125 of file eda_item.h.

125 { return m_flags & IS_RESIZING; }
#define IS_RESIZING
Item being resized.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 123 of file eda_item.h.

123 { return m_flags & SELECTED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define 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_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(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_OPENGL::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsType()

virtual bool EDA_ITEM::IsType ( const KICAD_T  aScanTypes[]) const
inlinevirtualinherited

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 in PCB_VIA, SCH_LABEL, PCB_DIMENSION_BASE, PAD, SCH_FIELD, FP_TEXT, SCH_LINE, PCB_SHAPE, FP_SHAPE, and PCB_TEXT.

Definition at line 183 of file eda_item.h.

184  {
185  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
186  return true;
187 
188  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
189  {
190  if( m_structType == *p )
191  return true;
192  }
193 
194  return false;
195  }
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:488

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by ROUTER_TOOL::CanInlineDrag(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), PCB_TEXT::IsType(), FP_SHAPE::IsType(), PCB_SHAPE::IsType(), SCH_LINE::IsType(), FP_TEXT::IsType(), SCH_FIELD::IsType(), PAD::IsType(), PCB_DIMENSION_BASE::IsType(), SCH_LABEL::IsType(), PCB_VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), SCH_BASE_FRAME::UpdateItem(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsVisible()

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 122 of file eda_item.h.

122 { return m_flags & IS_WIRE_IMAGE; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

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

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

Definition at line 295 of file eda_item.h.

299  {
300  for( auto it : aList )
301  {
302  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
304  return SEARCH_RESULT::QUIT;
305  }
306 
308  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

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

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

Definition at line 314 of file eda_item.h.

316  {
317  for( auto it : aList )
318  {
319  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
321  return SEARCH_RESULT::QUIT;
322  }
323 
325  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

◆ LenSize()

int EDA_TEXT::LenSize ( const wxString &  aLine,
int  aThickness 
) const
inherited
Returns
the text length in internal units.
Parameters
aLinethe line of text to consider. For single line text, this parameter is always m_Text.
aThicknessthe stroke width of the text.

Definition at line 204 of file eda_text.cpp.

205 {
208  basic_gal.SetFontUnderlined( false );
209  basic_gal.SetLineWidth( (float) aThickness );
211 
212  VECTOR2D tsize = basic_gal.GetTextLineSize( aLine );
213 
214  return KiROUND( tsize.x );
215 }
bool IsBold() const
Definition: eda_text.h:204
void SetFontBold(bool aBold)
Set bold property of current font.
VECTOR2D GetTextLineSize(const UTF8 &aText) const
Compute the X and Y size of a given text.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
bool IsItalic() const
Definition: eda_text.h:201
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
const wxSize & GetTextSize() const
Definition: eda_text.h:259
void SetFontItalic(bool aItalic)
Set italic property of current font.
void SetGlyphSize(const VECTOR2D &aSize)
Set the font glyph size.
void SetFontUnderlined(bool aUnderlined)
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:73
BASIC_GAL basic_gal(basic_displayOptions)

References basic_gal, KIGFX::GAL::GetTextLineSize(), EDA_TEXT::GetTextSize(), EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), KiROUND(), KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetFontUnderlined(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetLineWidth(), and VECTOR2< T >::x.

Referenced by CreateGraphicShape(), SCH_HIERLABEL::GetBoundingBox(), and GetBoundingBoxBase().

◆ MapHorizJustify()

EDA_TEXT_HJUSTIFY_T EDA_TEXT::MapHorizJustify ( int  aHorizJustify)
staticinherited

Definition at line 73 of file eda_text.cpp.

74 {
75  wxASSERT( aHorizJustify >= GR_TEXT_HJUSTIFY_LEFT && aHorizJustify <= GR_TEXT_HJUSTIFY_RIGHT );
76 
77  if( aHorizJustify > GR_TEXT_HJUSTIFY_RIGHT )
79 
80  if( aHorizJustify < GR_TEXT_HJUSTIFY_LEFT )
81  return GR_TEXT_HJUSTIFY_LEFT;
82 
83  return static_cast<EDA_TEXT_HJUSTIFY_T>( aHorizJustify );
84 }

References GR_TEXT_HJUSTIFY_LEFT, and GR_TEXT_HJUSTIFY_RIGHT.

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

◆ MapVertJustify()

EDA_TEXT_VJUSTIFY_T EDA_TEXT::MapVertJustify ( int  aVertJustify)
staticinherited

Definition at line 87 of file eda_text.cpp.

88 {
89  wxASSERT( aVertJustify >= GR_TEXT_VJUSTIFY_TOP && aVertJustify <= GR_TEXT_VJUSTIFY_BOTTOM );
90 
91  if( aVertJustify > GR_TEXT_VJUSTIFY_BOTTOM )
93 
94  if( aVertJustify < GR_TEXT_VJUSTIFY_TOP )
95  return GR_TEXT_VJUSTIFY_TOP;
96 
97  return static_cast<EDA_TEXT_VJUSTIFY_T>( aVertJustify );
98 }

References GR_TEXT_VJUSTIFY_BOTTOM, and GR_TEXT_VJUSTIFY_TOP.

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

◆ Matches() [1/2]

bool SCH_TEXT::Matches ( const wxFindReplaceData &  aSearchData,
void *  aAuxData 
) const
inlineoverridevirtualinherited

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.

Definition at line 213 of file sch_text.h.

214  {
215  return SCH_ITEM::Matches( GetText(), aSearchData );
216  }
virtual bool Matches(const wxFindReplaceData &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:365
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:154

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

◆ Matches() [2/2]

bool EDA_ITEM::Matches ( const wxString &  aText,
const wxFindReplaceData &  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 118 of file eda_item.cpp.

119 {
120  wxString text = aText;
121  wxString searchText = aSearchData.GetFindString();
122 
123  // Don't match if searching for replaceable item and the item doesn't support text replace.
124  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
125  return false;
126 
127  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
128  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
129 
130  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
131  {
132  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
133  return text.Matches( searchText );
134 
135  return text.MakeUpper().Matches( searchText.MakeUpper() );
136  }
137 
138  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
139  return aText.Find( searchText ) != wxNOT_FOUND;
140 
141  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
142 }
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:403

References FR_MATCH_WILDCARD, FR_SEARCH_REPLACE, EDA_ITEM::IsReplaceable(), and text.

◆ MirrorHorizontally()

void SCH_GLOBALLABEL::MirrorHorizontally ( int  aCenter)
overridevirtual

Mirror item horizontally about aCenter.

Reimplemented from SCH_TEXT.

Definition at line 1151 of file sch_text.cpp.

1152 {
1153  wxPoint old_pos = GetPosition();
1154  SCH_TEXT::MirrorHorizontally( aCenter );
1155 
1158  else
1160 
1161  wxPoint pos = m_intersheetRefsField.GetTextPos();
1162  wxPoint delta = old_pos - pos;
1163  pos.x = GetPosition().x + delta.x;
1164 
1166 }
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_text.cpp:272
wxPoint GetPosition() const override
Definition: sch_text.h:239
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:222
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
constexpr int delta
void SetPosition(const wxPoint &aPosition) override
Definition: sch_field.cpp:727

References delta, EDA_TEXT::GetHorizJustify(), SCH_TEXT::GetPosition(), EDA_TEXT::GetTextPos(), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, m_intersheetRefsField, SCH_TEXT::MirrorHorizontally(), EDA_TEXT::SetHorizJustify(), and SCH_FIELD::SetPosition().

◆ MirrorSpinStyle()

void SCH_GLOBALLABEL::MirrorSpinStyle ( bool  aLeftRight)
overridevirtual

Reimplemented from SCH_TEXT.

Definition at line 1126 of file sch_text.cpp.

1127 {
1128  SCH_TEXT::MirrorSpinStyle( aLeftRight );
1129 
1130  if( ( aLeftRight && m_intersheetRefsField.GetTextAngle() == TEXT_ANGLE_HORIZ )
1131  || ( !aLeftRight && m_intersheetRefsField.GetTextAngle() == TEXT_ANGLE_VERT ) )
1132  {
1135  else
1137  }
1138 
1139  wxPoint pos = m_intersheetRefsField.GetTextPos();
1140  wxPoint delta = GetPosition() - pos;
1141 
1142  if( aLeftRight )
1143  pos.x = GetPosition().x + delta.x;
1144  else
1145  pos.y = GetPosition().y + delta.y;
1146 
1148 }
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: eda_text.h:71
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:267
double GetTextAngle() const
Definition: eda_text.h:195
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219
wxPoint GetPosition() const override
Definition: sch_text.h:239
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:222
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
constexpr int delta
virtual void MirrorSpinStyle(bool aLeftRight)
Definition: sch_text.cpp:311
#define TEXT_ANGLE_VERT
Definition: eda_text.h:72

References delta, EDA_TEXT::GetHorizJustify(), SCH_TEXT::GetPosition(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextPos(), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, m_intersheetRefsField, SCH_TEXT::MirrorSpinStyle(), EDA_TEXT::SetHorizJustify(), EDA_TEXT::SetTextPos(), TEXT_ANGLE_HORIZ, and TEXT_ANGLE_VERT.

◆ MirrorVertically()

void SCH_GLOBALLABEL::MirrorVertically ( int  aCenter)
overridevirtual

Mirror item vertically about aCenter.

Reimplemented from SCH_TEXT.

Definition at line 1169 of file sch_text.cpp.

1170 {
1171  wxPoint old_pos = GetPosition();
1172  SCH_TEXT::MirrorVertically( aCenter );
1173  wxPoint pos = m_intersheetRefsField.GetTextPos();
1174  wxPoint delta = old_pos - pos;
1175  pos.y = GetPosition().y + delta.y;
1176 
1178 }
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_text.cpp:281
wxPoint GetPosition() const override
Definition: sch_text.h:239
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
constexpr int delta
void SetPosition(const wxPoint &aPosition) override
Definition: sch_field.cpp:727

References delta, SCH_TEXT::GetPosition(), EDA_TEXT::GetTextPos(), m_intersheetRefsField, SCH_TEXT::MirrorVertically(), and SCH_FIELD::SetPosition().

◆ Move()

void SCH_GLOBALLABEL::Move ( const wxPoint &  aMoveVector)
inlineoverridevirtual

Move the item by aMoveVector to a new position.

Reimplemented from SCH_TEXT.

Definition at line 421 of file sch_text.h.

422  {
423  SCH_TEXT::Move( aMoveVector );
424  m_intersheetRefsField.Move( aMoveVector );
425  }
void Move(const wxPoint &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_field.h:147
void Move(const wxPoint &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_text.h:201
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433

References m_intersheetRefsField, SCH_FIELD::Move(), and SCH_TEXT::Move().

◆ NetClass()

NETCLASSPTR SCH_ITEM::NetClass ( const SCH_SHEET_PATH aSheet = nullptr) const
inherited

Definition at line 145 of file sch_item.cpp.

146 {
147  if( m_connection_map.size() )
148  {
149  SCH_CONNECTION* connection = Connection( aSheet );
150 
151  if( connection )
152  {
153  NET_SETTINGS& netSettings = Schematic()->Prj().GetProjectFile().NetSettings();
154  const wxString& netclassName = netSettings.GetNetclassName( connection->Name() );
155 
156  return netSettings.m_NetClasses.Find( netclassName );
157  }
158  }
159 
160  return nullptr;
161 }
NETCLASSPTR Find(const wxString &aName) const
Search this container for a NETCLASS given by aName.
Definition: netclass.cpp:132
const wxString & GetNetclassName(const wxString &aNetName) const
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:145
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
NET_SETTINGS & NetSettings()
Definition: project_file.h:94
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:131
NETCLASSES m_NetClasses
Definition: net_settings.h:40
wxString Name(bool aIgnoreSheet=false) const
NET_SETTINGS stores various net-related settings in a project context.
Definition: net_settings.h:32
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
Definition: sch_item.h:491
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:75
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).

References SCH_ITEM::Connection(), NETCLASSES::Find(), NET_SETTINGS::GetNetclassName(), PROJECT::GetProjectFile(), SCH_ITEM::m_connection_map, NET_SETTINGS::m_NetClasses, SCH_CONNECTION::Name(), PROJECT_FILE::NetSettings(), SCHEMATIC::Prj(), and SCH_ITEM::Schematic().

Referenced by SCH_LINE::GetEffectiveLineStyle(), SCH_JUNCTION::getEffectiveShape(), SCH_JUNCTION::GetJunctionColor(), SCH_LINE::GetLineColor(), SCH_BUS_WIRE_ENTRY::GetPenWidth(), SCH_LINE::GetPenWidth(), SCH_BUS_BUS_ENTRY::GetPenWidth(), SCH_BUS_ENTRY_BASE::GetStrokeColor(), and SCH_BUS_ENTRY_BASE::GetStrokeStyle().

◆ Offset()

◆ operator<() [1/2]

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

Reimplemented from SCH_ITEM.

Definition at line 376 of file sch_text.cpp.

377 {
378  if( Type() != aItem.Type() )
379  return Type() < aItem.Type();
380 
381  auto other = static_cast<const SCH_TEXT*>( &aItem );
382 
383  if( GetLayer() != other->GetLayer() )
384  return GetLayer() < other->GetLayer();
385 
386  if( GetPosition().x != other->GetPosition().x )
387  return GetPosition().x < other->GetPosition().x;
388 
389  if( GetPosition().y != other->GetPosition().y )
390  return GetPosition().y < other->GetPosition().y;
391 
392  return GetText() < other->GetText();
393 }
wxPoint GetPosition() const override
Definition: sch_text.h:239
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:257
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:154
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References SCH_ITEM::GetLayer(), SCH_TEXT::GetPosition(), EDA_TEXT::GetText(), and EDA_ITEM::Type().

◆ operator<() [2/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 171 of file eda_item.cpp.

172 {
173  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
174  GetClass() ) );
175 
176  return false;
177 }
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
virtual wxString GetClass() const =0
Return the class name.

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

◆ Plot()

void SCH_GLOBALLABEL::Plot ( PLOTTER aPlotter) const
overridevirtual

Plot the schematic item to aPlotter.

Parameters
aPlotteris the PLOTTER object to plot to.

Reimplemented from SCH_TEXT.

Definition at line 1310 of file sch_text.cpp.

1311 {
1312  SCH_TEXT::Plot( aPlotter );
1313 
1314  bool show = Schematic()->Settings().m_IntersheetRefsShow;
1315 
1316  if ( show )
1317  m_intersheetRefsField.Plot( aPlotter );
1318 }
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:167
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433
void Plot(PLOTTER *aPlotter) const override
Plot the schematic item to aPlotter.
Definition: sch_text.cpp:693
void Plot(PLOTTER *aPlotter) const override
Plot the schematic item to aPlotter.
Definition: sch_field.cpp:677

References m_intersheetRefsField, SCHEMATIC_SETTINGS::m_IntersheetRefsShow, SCH_FIELD::Plot(), SCH_TEXT::Plot(), SCH_ITEM::Schematic(), and SCHEMATIC::Settings().

◆ Print() [1/2]

void EDA_TEXT::Print ( const RENDER_SETTINGS aSettings,
const wxPoint &  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 417 of file eda_text.cpp.

419 {
420  if( IsMultilineAllowed() )
421  {
422  std::vector<wxPoint> positions;
423  wxArrayString strings;
424  wxStringSplit( GetShownText(), strings, '\n' );
425 
426  positions.reserve( strings.Count() );
427 
428  GetLinePositions( positions, strings.Count() );
429 
430  for( unsigned ii = 0; ii < strings.Count(); ii++ )
431  printOneLineOfText( aSettings, aOffset, aColor, aFillMode, strings[ii], positions[ii] );
432  }
433  else
434  {
435  printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetTextPos() );
436  }
437 }
void printOneLineOfText(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, const COLOR4D &aColor, OUTLINE_MODE aFillMode, const wxString &aText, const wxPoint &aPos)
Print each line of this EDA_TEXT.
Definition: eda_text.cpp:481
bool IsMultilineAllowed() const
Definition: eda_text.h:217
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
void GetLinePositions(std::vector< wxPoint > &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:440
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:162

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

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

◆ Print() [2/2]

void SCH_GLOBALLABEL::Print ( const RENDER_SETTINGS aSettings,
const wxPoint &  aOffset 
)
overridevirtual

Print a schematic item.

Each schematic item should have its own method

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

Reimplemented from SCH_TEXT.

Definition at line 1289 of file sch_text.cpp.

1290 {
1291  static std::vector<wxPoint> s_poly;
1292 
1293  SCH_CONNECTION* connection = Connection();
1294  int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
1295  wxDC* DC = aSettings->GetPrintDC();
1296  COLOR4D color = aSettings->GetLayerColor( layer );
1297  int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
1298  wxPoint text_offset = aOffset + GetSchematicTextOffset( aSettings );
1299 
1300  EDA_TEXT::Print( aSettings, text_offset, color );
1301 
1302  CreateGraphicShape( aSettings, s_poly, GetTextPos() + aOffset );
1303  GRPoly( nullptr, DC, s_poly.size(), &s_poly[0], false, penWidth, color, color );
1304 
1306  m_intersheetRefsField.Print( aSettings, aOffset );
1307 }
wxPoint 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_text.cpp:1004
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, const COLOR4D &aColor, OUTLINE_MODE aDisplay_mode=FILLED)
Print this text object to the device context aDC.
Definition: eda_text.cpp:417
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:167
int color
Definition: DXF_plotter.cpp:57
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
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:131
int GetPenWidth() const override
Definition: sch_text.cpp:430
SCH_LAYER_ID m_layer
Definition: sch_item.h:481
wxDC * GetPrintDC() const
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433
void CreateGraphicShape(const RENDER_SETTINGS *aRenderSettings, std::vector< wxPoint > &aPoints, const wxPoint &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_text.cpp:1321
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
int GetDefaultPenWidth() const
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
void GRPoly(EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *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:497
bool IsBus() const
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a schematic item.
Definition: sch_field.cpp:202
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, SCH_ITEM::Connection(), CreateGraphicShape(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), KIGFX::RENDER_SETTINGS::GetLayerColor(), SCH_TEXT::GetPenWidth(), KIGFX::RENDER_SETTINGS::GetPrintDC(), GetSchematicTextOffset(), EDA_TEXT::GetTextPos(), GRPoly(), SCH_CONNECTION::IsBus(), LAYER_BUS, m_intersheetRefsField, SCHEMATIC_SETTINGS::m_IntersheetRefsShow, SCH_ITEM::m_layer, SCH_FIELD::Print(), EDA_TEXT::Print(), SCH_ITEM::Schematic(), and SCHEMATIC::Settings().

◆ Replace() [1/3]

bool SCH_TEXT::Replace ( const wxFindReplaceData &  aSearchData,
void *  aAuxData 
)
inlineoverridevirtualinherited

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.

Definition at line 218 of file sch_text.h.

219  {
220  return EDA_TEXT::Replace( aSearchData );
221  }
bool Replace(const wxFindReplaceData &aSearchData)
Helper function used in search and replace dialog.
Definition: eda_text.cpp:180

References EDA_TEXT::Replace().

◆ Replace() [2/3]

bool EDA_TEXT::Replace ( const wxFindReplaceData &  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 wxFindReplaceData object containing the search and replace criteria.
Returns
True if the text item was modified, otherwise false.

Definition at line 180 of file eda_text.cpp.

181 {
182  bool retval = EDA_ITEM::Replace( aSearchData, m_text );
183  cacheShownText();
184 
185  return retval;
186 }
void cacheShownText()
Definition: eda_text.cpp:189
wxString m_text
Definition: eda_text.h:408
static bool Replace(const wxFindReplaceData &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:145

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

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

◆ Replace() [3/3]

bool EDA_ITEM::Replace ( const wxFindReplaceData &  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 145 of file eda_item.cpp.

146 {
147  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
148 
149  int result = searchString.Find( ( aSearchData.GetFlags() & wxFR_MATCHCASE ) ?
150  aSearchData.GetFindString() :
151  aSearchData.GetFindString().Upper() );
152 
153  if( result == wxNOT_FOUND )
154  return false;
155 
156  wxString prefix = aText.Left( result );
157  wxString suffix;
158 
159  if( aSearchData.GetFindString().length() + result < aText.length() )
160  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
161 
162  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
163  aText, prefix, aSearchData.GetReplaceString(), suffix );
164 
165  aText = prefix + aSearchData.GetReplaceString() + suffix;
166 
167  return true;
168 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.

References traceFindReplace.

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

◆ ResolveTextVar()

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

Definition at line 1236 of file sch_text.cpp.

1237 {
1238  if( token->IsSameAs( wxT( "INTERSHEET_REFS" ) ) && Schematic() )
1239  {
1240  SCHEMATIC_SETTINGS& settings = Schematic()->Settings();
1241  wxString ref;
1242  auto it = Schematic()->GetPageRefsMap().find( GetText() );
1243 
1244  if( it == Schematic()->GetPageRefsMap().end() )
1245  {
1246  ref = "?";
1247  }
1248  else
1249  {
1250  std::vector<wxString> pageListCopy;
1251 
1252  pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
1253  std::sort( pageListCopy.begin(), pageListCopy.end(),
1254  []( const wxString& a, const wxString& b ) -> bool
1255  {
1256  return StrNumCmp( a, b, true ) <= 0;
1257  } );
1258 
1259  if( !settings.m_IntersheetRefsListOwnPage )
1260  {
1261  wxString currentPage = Schematic()->CurrentSheet().GetPageNumber();
1262  alg::delete_matching( pageListCopy, currentPage );
1263  }
1264 
1265  if( ( settings.m_IntersheetRefsFormatShort ) && ( pageListCopy.size() > 2 ) )
1266  {
1267  ref.Append( wxString::Format( wxT( "%s..%s" ),
1268  pageListCopy.front(),
1269  pageListCopy.back() ) );
1270  }
1271  else
1272  {
1273  for( const wxString& pageNo : pageListCopy )
1274  ref.Append( wxString::Format( wxT( "%s," ), pageNo ) );
1275 
1276  if( !ref.IsEmpty() && ref.Last() == ',' )
1277  ref.RemoveLast();
1278  }
1279  }
1280 
1281  *token = settings.m_IntersheetRefsPrefix + ref + settings.m_IntersheetRefsSuffix;
1282  return true;
1283  }
1284 
1285  return false;
1286 }
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:167
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
wxString GetPageNumber() const
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
These settings were stored in SCH_BASE_FRAME previously.
std::map< wxString, std::set< wxString > > & GetPageRefsMap()
Definition: schematic.h:162
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
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
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:121
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:154

References SCHEMATIC::CurrentSheet(), alg::delete_matching(), Format(), SCH_SHEET_PATH::GetPageNumber(), SCHEMATIC::GetPageRefsMap(), EDA_TEXT::GetText(), SCHEMATIC_SETTINGS::m_IntersheetRefsFormatShort, SCHEMATIC_SETTINGS::m_IntersheetRefsListOwnPage, SCHEMATIC_SETTINGS::m_IntersheetRefsPrefix, SCHEMATIC_SETTINGS::m_IntersheetRefsSuffix, SCH_ITEM::Schematic(), SCHEMATIC::Settings(), and StrNumCmp().

Referenced by SCH_FIELD::GetShownText().

◆ Rotate()

void SCH_GLOBALLABEL::Rotate ( const wxPoint &  aCenter)
overridevirtual

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

Reimplemented from SCH_TEXT.

Definition at line 1070 of file sch_text.cpp.

1071 {
1072  wxPoint pt = GetTextPos();
1073  RotatePoint( &pt, aCenter, 900 );
1074  wxPoint offset = pt - GetTextPos();
1075 
1076  Rotate90( false );
1077 
1078  SetTextPos( GetTextPos() + offset );
1080 }
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:267
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
void Rotate90(bool aClockwise) override
Definition: sch_text.cpp:1083

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

◆ Rotate90()

void SCH_GLOBALLABEL::Rotate90 ( bool  aClockwise)
overridevirtual

Reimplemented from SCH_TEXT.

Definition at line 1083 of file sch_text.cpp.

1084 {
1085  SCH_TEXT::Rotate90( aClockwise );
1086 
1089  {
1090  if( !aClockwise )
1092 
1094  }
1097  {
1098  if( !aClockwise )
1100 
1102  }
1105  {
1106  if( aClockwise )
1108 
1110  }
1113  {
1114  if( aClockwise )
1116 
1118  }
1119 
1120  wxPoint pos = m_intersheetRefsField.GetTextPos();
1121  RotatePoint( &pos, GetPosition(), aClockwise ? -900 : 900 );
1123 }
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: eda_text.h:71
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:267
double GetTextAngle() const
Definition: eda_text.h:195
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219
wxPoint GetPosition() const override
Definition: sch_text.h:239
virtual void Rotate90(bool aClockwise)
Definition: sch_text.cpp:302
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:222
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
#define TEXT_ANGLE_VERT
Definition: eda_text.h:72
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:188

References EDA_TEXT::GetHorizJustify(), SCH_TEXT::GetPosition(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextPos(), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, m_intersheetRefsField, SCH_TEXT::Rotate90(), RotatePoint(), EDA_TEXT::SetHorizJustify(), EDA_TEXT::SetTextAngle(), EDA_TEXT::SetTextPos(), TEXT_ANGLE_HORIZ, and TEXT_ANGLE_VERT.

Referenced by Rotate().

◆ RunOnChildren()

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

Reimplemented from SCH_ITEM.

Definition at line 998 of file sch_text.cpp.

999 {
1000  aFunction( &m_intersheetRefsField );
1001 }
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433

References m_intersheetRefsField.

◆ 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 97 of file sch_item.cpp.

98 {
99  EDA_ITEM* parent = GetParent();
100 
101  while( parent )
102  {
103  if( parent->Type() == SCHEMATIC_T )
104  return static_cast<SCHEMATIC*>( parent );
105  else
106  parent = parent->GetParent();
107  }
108 
109  return nullptr;
110 }
EDA_ITEM * GetParent() const
Definition: eda_item.h:115
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

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

Referenced by SCH_ITEM::Connection(), SCH_DRAWING_TOOLS::createSheetPin(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), SCH_FIELD::DoHypertextMenu(), GetBoundingBox(), SCH_MARKER::GetColorLayer(), SCH_JUNCTION::getEffectiveShape(), SCH_TEXT::GetLabelBoxExpansion(), SCH_BUS_ENTRY_BASE::GetMsgPanelInfo(), SCH_LINE::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_NO_CONNECT::GetPenWidth(), SCH_SHEET_PIN::GetPenWidth(), SCH_BUS_WIRE_ENTRY::GetPenWidth(), SCH_LINE::GetPenWidth(), SCH_BUS_BUS_ENTRY::GetPenWidth(), SCH_SHEET::GetPenWidth(), SCH_SYMBOL::GetPins(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), SCH_TEXT::GetTextOffset(), SCH_PIN::HitTest(), HitTest(), inheritNetclass(), SCH_SHEET::IsRootSheet(), SCH_LABEL::IsType(), SCH_ITEM::NetClass(), DIALOG_SYMBOL_PROPERTIES::OnAddField(), DIALOG_TEXT_AND_LABEL_PROPERTIES::onScintillaCharAdded(), DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded(), Plot(), Print(), SCH_HIERLABEL::Print(), SCH_SHEET::ResolveTextVar(), SCH_SYMBOL::ResolveTextVar(), ResolveTextVar(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), and SCH_MARKER::ViewGetLayers().

◆ Set() [1/3]

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

Definition at line 42 of file inspectable.h.

43  {
45  TYPE_ID thisType = TYPE_HASH( *this );
46  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
47 
48  if( object )
49  aProperty->setter( object, aValue );
50 
51  return object != nullptr;
52  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual void setter(void *aObject, wxAny &aValue)=0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Set() [2/3]

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

Definition at line 55 of file inspectable.h.

56  {
58  TYPE_ID thisType = TYPE_HASH( *this );
59  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
60 
61  if( object )
62  aProperty->set<T>( object, aValue );
63 
64  return object != nullptr;
65  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Set() [3/3]

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

Definition at line 68 of file inspectable.h.

69  {
71  TYPE_ID thisType = TYPE_HASH( *this );
72  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
73  void* object = nullptr;
74 
75  if( prop )
76  {
77  object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
78 
79  if( object )
80  prop->set<T>( object, aValue );
81  }
82 
83  return object != nullptr;
84  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ SetBold()

◆ SetBrightened()

◆ SetConnectivityDirty()

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

Definition at line 411 of file sch_item.h.

411 { m_connectivity_dirty = aDirty; }
bool m_connectivity_dirty
Definition: sch_item.h:493

References SCH_ITEM::m_connectivity_dirty.

Referenced by SCH_EDIT_FRAME::SaveCopyInUndoList().

◆ SetEffects()

void EDA_TEXT::SetEffects ( const EDA_TEXT aSrc)
inherited

Set the text effects from another instance.

TEXT_EFFECTS is not exposed in the public API, but includes everything except the actual text string itself.

Definition at line 139 of file eda_text.cpp.

140 {
141  m_e = aSrc.m_e;
142 }
TEXT_EFFECTS m_e
Definition: eda_text.h:412

References EDA_TEXT::m_e.

Referenced by LIB_TEXT::Clone(), LIB_FIELD::Copy(), SCH_FIELD::ImportValues(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), LIB_FIELD::operator=(), DIALOG_CHANGE_SYMBOLS::processSymbol(), CLIPBOARD_IO::SaveSelection(), and FP_TEXT::SetEffects().

◆ SetFieldsAutoplaced()

void SCH_ITEM::SetFieldsAutoplaced ( )
inlineinherited

Definition at line 420 of file sch_item.h.

References FIELDS_AUTOPLACED_AUTO, and SCH_ITEM::m_fieldsAutoplaced.

◆ SetFlags()

void EDA_ITEM::SetFlags ( EDA_ITEM_FLAGS  aMask)
inlineinherited

Definition at line 153 of file eda_item.h.

153 { m_flags |= aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References EDA_ITEM::m_flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SCH_MOVE_TOOL::AlignElements(), PCB_CONTROL::AppendBoard(), FOOTPRINT::BuildPolyCourtyards(), SCH_EDIT_TOOL::ChangeTextType(), GRAPHICS_CLEANER::cleanupSegments(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), PCB_SELECTION_TOOL::EnterGroup(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), SCH_MOVE_TOOL::getConnectedDragItems(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), EE_SELECTION_TOOL::Main(), TRACKS_CLEANER::mergeCollinearSegments(), SYMBOL_EDITOR_MOVE_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), EE_SELECTION_TOOL::narrowSelection(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), SCH_ALTIUM_PLUGIN::ParseBezier(), SCH_ALTIUM_PLUGIN::ParseBus(), SCH_ALTIUM_PLUGIN::ParseBusEntry(), SCH_ALTIUM_PLUGIN::ParseJunction(), SCH_ALTIUM_PLUGIN::ParseLabel(), SCH_ALTIUM_PLUGIN::ParseLine(), SCH_ALTIUM_PLUGIN::ParseNetLabel(), SCH_ALTIUM_PLUGIN::ParseNoERC(), SCH_ALTIUM_PLUGIN::ParsePolygon(), SCH_ALTIUM_PLUGIN::ParsePolyline(), SCH_ALTIUM_PLUGIN::ParsePort(), SCH_ALTIUM_PLUGIN::ParseRectangle(), SCH_ALTIUM_PLUGIN::ParseRoundRectangle(), SCH_ALTIUM_PLUGIN::ParseSheetSymbol(), SCH_ALTIUM_PLUGIN::ParseWire(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceText(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_SELECTION_TOOL::RebuildSelection(), FOOTPRINT::Remove(), BOARD::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

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.

Parameters
aEnableTrue forces the item to be drawn. False uses the item's visibility setting to determine if the item is to be drawn.

Definition at line 204 of file eda_item.h.

204 { m_forceVisible = aEnable; }
bool m_forceVisible
Definition: eda_item.h:480

References EDA_ITEM::m_forceVisible.

Referenced by SCH_EDITOR_CONTROL::UpdateFind().

◆ SetHorizJustify()

void EDA_TEXT::SetHorizJustify ( EDA_TEXT_HJUSTIFY_T  aType)
inlineinherited

Definition at line 222 of file eda_text.h.

222 { m_e.hjustify = aType; };
TEXT_EFFECTS m_e
Definition: eda_text.h:412
signed char hjustify
horizontal justification
Definition: eda_text.h:122

References TEXT_EFFECTS::hjustify, and EDA_TEXT::m_e.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), GRAPHICS_IMPORTER_PCBNEW::AddText(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), AutoplaceFields(), PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawSpecificationStackup(), eagleToKicadAlignment(), EDA_TEXT_DESC::EDA_TEXT_DESC(), ALTIUM_PCB::HelperParseDimensions6Radial(), AUTOPLACER::justifyField(), FP_TEXT::KeepUpright(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), SCH_LEGACY_PLUGIN::loadSymbol(), SCH_EDIT_TOOL::Mirror(), LIB_TEXT::MirrorHorizontal(), MirrorHorizontally(), MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), ALTIUM_PCB::ParseTexts6Data(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), LIB_TEXT::Rotate(), Rotate90(), SCH_TEXT::SetLabelSpinStyle(), SetLabelSpinStyle(), SCH_HIERLABEL::SetLabelSpinStyle(), PCAD2KICAD::SetTextJustify(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_FIELD_PROPERTIES::updateText().

◆ SetIntersheetRefs()

void SCH_GLOBALLABEL::SetIntersheetRefs ( const SCH_FIELD aField)
inline

Definition at line 414 of file sch_text.h.

414 { m_intersheetRefsField = aField; }
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:433

References m_intersheetRefsField.

Referenced by SCH_SEXPR_PARSER::parseSchText().

◆ SetIsDangling()

void SCH_TEXT::SetIsDangling ( bool  aIsDangling)
inlineinherited

Definition at line 231 of file sch_text.h.

231 { m_isDangling = aIsDangling; }
bool m_isDangling
True if not connected to another object if the object derive from SCH_TEXT supports connections.
Definition: sch_text.h:262

References SCH_TEXT::m_isDangling.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), and PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems().

◆ SetItalic()

void EDA_TEXT::SetItalic ( bool  isItalic)
inlineinherited

Definition at line 200 of file eda_text.h.

200 { m_e.Bit( TE_ITALIC, isItalic ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:412
void Bit(int aBit, bool aValue)
Definition: eda_text.h:129

References TEXT_EFFECTS::Bit(), EDA_TEXT::m_e, and EDA_TEXT::TE_ITALIC.

Referenced by PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), SCH_EDIT_TOOL::ChangeTextType(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), DRAWING_TOOL::DrawBoardCharacteristics(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawSpecificationStackup(), 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(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_LEGACY_PLUGIN::loadSymbol(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParseLabel(), ALTIUM_PCB::ParseTexts6Data(), DRAWING_TOOL::PlaceText(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), UpdateIntersheetRefProps(), and DIALOG_FIELD_PROPERTIES::updateText().

◆ SetLabelSpinStyle()

void SCH_GLOBALLABEL::SetLabelSpinStyle ( LABEL_SPIN_STYLE  aSpinStyle)
overridevirtual

Set a spin or rotation angle, along with specific horizontal and vertical justification styles with each angle.

Parameters
aSpinStyleSpin style as per LABEL_SPIN_STYLE storage class, may be the enum values or int value

Reimplemented from SCH_TEXT.

Definition at line 1036 of file sch_text.cpp.

1037 {
1038  m_spin_style = aSpinStyle;
1039 
1040  switch( aSpinStyle )
1041  {
1042  default:
1043  wxASSERT_MSG( 1, "Bad spin style" );
1046 
1047  case LABEL_SPIN_STYLE::RIGHT: // Horiz Normal Orientation
1050  break;
1051 
1052  case LABEL_SPIN_STYLE::UP: // Vert Orientation UP
1055  break;
1056 
1057  case LABEL_SPIN_STYLE::LEFT: // Horiz Orientation
1060  break;
1061 
1062  case LABEL_SPIN_STYLE::BOTTOM: // Vert Orientation BOTTOM
1065  break;
1066  }
1067 }
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: eda_text.h:71
LABEL_SPIN_STYLE m_spin_style
The orientation of text and any associated drawing elements of derived objects.
Definition: sch_text.h:276
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:222
#define TEXT_ANGLE_VERT
Definition: eda_text.h:72
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:188

References LABEL_SPIN_STYLE::BOTTOM, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, KI_FALLTHROUGH, LABEL_SPIN_STYLE::LEFT, SCH_TEXT::m_spin_style, LABEL_SPIN_STYLE::RIGHT, EDA_TEXT::SetHorizJustify(), EDA_TEXT::SetTextAngle(), TEXT_ANGLE_HORIZ, TEXT_ANGLE_VERT, and LABEL_SPIN_STYLE::UP.

Referenced by SCH_EAGLE_PLUGIN::addImplicitConnections(), PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), and CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances().

◆ SetLayer()

void SCH_ITEM::SetLayer ( SCH_LAYER_ID  aLayer)
inlineinherited

◆ SetLocked()

virtual void SCH_ITEM::SetLocked ( bool  aLocked)
inlinevirtualinherited

Set the 'lock' status to aLocked for of this item.

Definition at line 245 of file sch_item.h.

245 {}

◆ SetMirrored()

◆ SetModified()

void EDA_ITEM::SetModified ( )
inherited

◆ SetMultilineAllowed()

void EDA_TEXT::SetMultilineAllowed ( bool  aAllow)
inlineinherited
Parameters
aAllowtrue if ok to use multiline option, false if ok to use only single line text. (Single line is faster in calculations than multiline.)

Definition at line 216 of file eda_text.h.

216 { m_e.Bit( TE_MULTILINE, aAllow ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:412
void Bit(int aBit, bool aValue)
Definition: eda_text.h:129

References TEXT_EFFECTS::Bit(), EDA_TEXT::m_e, and EDA_TEXT::TE_MULTILINE.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), PCB_TEXT::PCB_TEXT(), SCH_HIERLABEL::SCH_HIERLABEL(), SCH_LABEL::SCH_LABEL(), and SCH_TEXT::SCH_TEXT().

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in PCB_DIMENSION_BASE.

Definition at line 116 of file eda_item.h.

116 { m_parent = aParent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479

References EDA_ITEM::m_parent.

Referenced by FOOTPRINT::Add(), BOARD::Add(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewFootprint(), SCH_SHEET::AddPin(), PAD::AddPrimitive(), PAD::AddPrimitiveArc(), PAD::AddPrimitiveCircle(), PAD::AddPrimitiveCurve(), PAD::AddPrimitivePoly(), PAD::AddPrimitiveRect(), PAD::AddPrimitiveSegment(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), SCH_SCREEN::Append(), LIB_FIELD::Copy(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), PCB_EDIT_FRAME::ExchangeFootprint(), LIB_SYMBOL::Flatten(), FOOTPRINT::FOOTPRINT(), PCB_IO::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), LIB_SYMBOL::LIB_SYMBOL(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), FOOTPRINT::operator=(), LIB_SYMBOL::operator=(), PCB_PARSER::parseFOOTPRINT_unchecked(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_SEXPR_PARSER::ParseSymbol(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PCB_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), pasteFootprintItemsToFootprintEditor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BACK_ANNOTATE::processNetNameChange(), BOARD_COMMIT::Push(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SaveCopyOfZones(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_SYMBOL::SetFields(), PCB_DIMENSION_BASE::SetParent(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), SCH_SHEET::SwapData(), SwapData(), SCH_SYMBOL::SwapData(), and SwapItemData().

◆ SetPosition()

◆ SetSelected()

◆ SetShape()

◆ SetState()

void EDA_ITEM::SetState ( EDA_ITEM_FLAGS  type,
bool  state 
)
inlineinherited

Definition at line 142 of file eda_item.h.

143  {
144  if( state )
145  m_status |= type; // state = ON or OFF
146  else
147  m_status &= ~type;
148  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

Referenced by LEGACY_PLUGIN::loadTrackList(), TRACKS_CLEANER::mergeCollinearSegments(), and BOARD_ITEM::SetLocked().

◆ SetStatus()

void EDA_ITEM::SetStatus ( EDA_ITEM_FLAGS  aStatus)
inlineinherited

Definition at line 151 of file eda_item.h.

151 { m_status = aStatus; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetStoredPos()

void SCH_ITEM::SetStoredPos ( const wxPoint &  aPos)
inlineinherited

Definition at line 221 of file sch_item.h.

221 { m_storedPos = aPos; }
wxPoint m_storedPos
Definition: sch_item.h:484

References SCH_ITEM::m_storedPos.

Referenced by SCH_MOVE_TOOL::Main().

◆ SetStroke()

virtual void SCH_ITEM::SetStroke ( const STROKE_PARAMS aStroke)
inlinevirtualinherited

Reimplemented in SCH_LINE, and SCH_BUS_ENTRY_BASE.

Definition at line 451 of file sch_item.h.

451 { wxCHECK( false, /* void */ ); }

`