KiCad PCB EDA Suite
SCH_FIELD Class Reference

Instances are attached to a symbol or sheet and provide a place for the symbol's value, reference designator, footprint, , a sheet's name, filename, and user definable name-value pairs of arbitrary purpose. More...

#include <sch_field.h>

Inheritance diagram for SCH_FIELD:
SCH_ITEM EDA_TEXT EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

const KIID m_Uuid
 

Protected Member Functions

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

Protected Attributes

SCH_LAYER_ID m_layer
 
EDA_ITEMS m_connections
 
FIELDS_AUTOPLACED m_fieldsAutoplaced
 
VECTOR2I m_storedPos
 
std::map< SCH_SHEET_PATH, SCH_ITEM_SET, SHEET_PATH_CMPm_connected_items
 Store pointers to other items that are connected to this one, per sheet. More...
 
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
 Store connectivity information, per sheet. More...
 
bool m_connectivity_dirty
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 
wxString m_hyperlink
 A hyperlink URL. More...
 

Private Member Functions

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

Private Attributes

int m_id
 Field index,. More...
 
wxString m_name
 
bool m_showName
 Render the field name in addition to its value. More...
 
bool m_allowAutoPlace
 This field can be autoplaced. More...
 
bool m_renderCacheValid
 
VECTOR2I m_renderCachePos
 
std::vector< std::unique_ptr< KIFONT::GLYPH > > m_renderCache
 
COLOR4D m_lastResolvedColor
 
KICAD_T m_structType
 Run time identification, keep private so it can never be changed after a ctor sets it. More...
 
VIEW_ITEM_DATA * m_viewPrivData
 
wxString m_text
 
wxString m_shown_text
 
bool m_shown_text_has_text_var_refs
 
std::reference_wrapper< const EDA_IU_SCALEm_IuScale
 
wxString m_render_cache_text
 
EDA_ANGLE m_render_cache_angle
 
VECTOR2I m_render_cache_offset
 
std::vector< std::unique_ptr< KIFONT::GLYPH > > m_render_cache
 
bool m_bounding_box_cache_valid
 
VECTOR2I m_bounding_box_cache_pos
 
int m_bounding_box_cache_line
 
bool m_bounding_box_cache_inverted
 
BOX2I m_bounding_box_cache
 
TEXT_ATTRIBUTES m_attributes
 
VECTOR2I m_pos
 

Detailed Description

Instances are attached to a symbol or sheet and provide a place for the symbol's value, reference designator, footprint, , a sheet's name, filename, and user definable name-value pairs of arbitrary purpose.

  • Field 0 is reserved for the symbol reference.
  • Field 1 is reserved for the symbol value.
  • Field 2 is reserved for the symbol footprint.
  • Field 3 is reserved for the symbol data sheet file.
  • Field 4 and higher are user definable.

Definition at line 49 of file sch_field.h.

Constructor & Destructor Documentation

◆ SCH_FIELD() [1/2]

SCH_FIELD::SCH_FIELD ( const VECTOR2I aPos,
int  aFieldId,
SCH_ITEM aParent,
const wxString &  aName = wxEmptyString 
)

Definition at line 59 of file sch_field.cpp.

60 :
61 SCH_ITEM( aParent, SCH_FIELD_T ),
62 EDA_TEXT( schIUScale, wxEmptyString ),
63 m_id( 0 ),
64 m_name( aName ),
65 m_showName( false ),
66 m_allowAutoPlace( true ),
67 m_renderCacheValid( false ),
68 m_lastResolvedColor( COLOR4D::UNSPECIFIED )
69{
70 SetTextPos( aPos );
71 SetId( aFieldId ); // will also set the layer
72 SetVisible( false );
73}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
void SetTextPos(const VECTOR2I &aPoint)
Definition: eda_text.cpp:371
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:217
EDA_TEXT(const EDA_IU_SCALE &aIuScale, const wxString &aText=wxEmptyString)
Definition: eda_text.cpp:90
COLOR4D m_lastResolvedColor
Definition: sch_field.h:252
bool m_showName
Render the field name in addition to its value.
Definition: sch_field.h:245
bool m_renderCacheValid
Definition: sch_field.h:248
void SetId(int aId)
Definition: sch_field.cpp:132
int m_id
Field index,.
Definition: sch_field.h:241
wxString m_name
Definition: sch_field.h:243
bool m_allowAutoPlace
This field can be autoplaced.
Definition: sch_field.h:246
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
Definition: sch_item.cpp:52
@ SCH_FIELD_T
Definition: typeinfo.h:155

References SetId(), EDA_TEXT::SetTextPos(), EDA_TEXT::SetVisible(), and UNSPECIFIED.

Referenced by Clone().

◆ SCH_FIELD() [2/2]

SCH_FIELD::SCH_FIELD ( const SCH_FIELD aText)

Definition at line 76 of file sch_field.cpp.

76 :
77 SCH_ITEM( aField ),
78 EDA_TEXT( aField )
79{
80 m_id = aField.m_id;
81 m_name = aField.m_name;
82 m_showName = aField.m_showName;
83 m_allowAutoPlace = aField.m_allowAutoPlace;
84
85 m_renderCache.clear();
86
87 for( const std::unique_ptr<KIFONT::GLYPH>& glyph : aField.m_renderCache )
88 {
89 KIFONT::OUTLINE_GLYPH* outline_glyph = static_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() );
90 m_renderCache.emplace_back( std::make_unique<KIFONT::OUTLINE_GLYPH>( *outline_glyph ) );
91 }
92
93 m_renderCacheValid = aField.m_renderCacheValid;
94 m_renderCachePos = aField.m_renderCachePos;
95
96 m_lastResolvedColor = aField.m_lastResolvedColor;
97}
std::vector< std::unique_ptr< KIFONT::GLYPH > > m_renderCache
Definition: sch_field.h:250
VECTOR2I m_renderCachePos
Definition: sch_field.h:249

References m_allowAutoPlace, m_id, m_lastResolvedColor, m_name, m_renderCache, m_renderCachePos, m_renderCacheValid, and m_showName.

◆ ~SCH_FIELD()

SCH_FIELD::~SCH_FIELD ( )
inline

Definition at line 57 of file sch_field.h.

58 { }

Member Function Documentation

◆ AddConnectionTo()

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

Add a connection link between this item and another.

Definition at line 193 of file sch_item.cpp.

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

References SCH_ITEM::m_connected_items.

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

◆ AddRenderCacheGlyph()

void EDA_TEXT::AddRenderCacheGlyph ( const SHAPE_POLY_SET aPoly)
inherited

Definition at line 491 of file eda_text.cpp.

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

References EDA_TEXT::m_render_cache.

◆ AutoAutoplaceFields()

void SCH_ITEM::AutoAutoplaceFields ( SCH_SCREEN aScreen)
inlineinherited

Autoplace fields only if correct to do so automatically.

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

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

Definition at line 436 of file sch_item.h.

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

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

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

◆ AutoplaceFields()

virtual void SCH_ITEM::AutoplaceFields ( SCH_SCREEN aScreen,
bool  aManual 
)
inlinevirtualinherited

◆ cacheShownText()

void EDA_TEXT::cacheShownText ( )
protectedinherited

Definition at line 408 of file eda_text.cpp.

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

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

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

◆ CanAutoplace()

bool SCH_FIELD::CanAutoplace ( ) const
inline

◆ CanConnect()

virtual bool SCH_ITEM::CanConnect ( const SCH_ITEM aItem) const
inlinevirtualinherited

Reimplemented in SCH_BUS_WIRE_ENTRY, SCH_BUS_BUS_ENTRY, SCH_JUNCTION, SCH_LABEL_BASE, SCH_LINE, SCH_NO_CONNECT, SCH_SHEET, and SCH_SYMBOL.

Definition at line 344 of file sch_item.h.

344{ return m_layer == aItem->GetLayer(); }
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:246
SCH_LAYER_ID m_layer
Definition: sch_item.h:491

References SCH_ITEM::GetLayer(), and SCH_ITEM::m_layer.

Referenced by SCH_MOVE_TOOL::getConnectedDragItems().

◆ ClassOf()

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

Definition at line 62 of file sch_field.h.

63 {
64 return aItem && SCH_FIELD_T == aItem->Type();
65 }
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97

References SCH_FIELD_T, and EDA_ITEM::Type().

◆ ClearBoundingBoxCache()

void EDA_TEXT::ClearBoundingBoxCache ( )
virtualinherited

Definition at line 444 of file eda_text.cpp.

445{
447}

References EDA_TEXT::m_bounding_box_cache_valid.

Referenced by ClearCaches().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 122 of file eda_item.h.

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

References BRIGHTENED, and EDA_ITEM::ClearFlags().

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

◆ ClearCaches()

void SCH_FIELD::ClearCaches ( )
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 280 of file sch_field.cpp.

281{
284}
virtual void ClearBoundingBoxCache()
Definition: eda_text.cpp:444
void ClearRenderCache() override
Definition: sch_field.cpp:287

References EDA_TEXT::ClearBoundingBoxCache(), and ClearRenderCache().

◆ ClearConnections()

void SCH_ITEM::ClearConnections ( )
inlineinherited

Clears all of the connection items from the list.

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

Definition at line 372 of file sch_item.h.

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

References SCH_ITEM::m_connections.

◆ ClearEditFlags()

◆ ClearFieldsAutoplaced()

◆ ClearFlags()

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

Definition at line 143 of file eda_item.h.

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

References EDA_ITEM::m_flags.

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

◆ ClearRenderCache()

void SCH_FIELD::ClearRenderCache ( )
overridevirtual

Reimplemented from EDA_TEXT.

Definition at line 287 of file sch_field.cpp.

288{
290 m_renderCacheValid = false;
291}

References EDA_TEXT::ClearRenderCache(), and m_renderCacheValid.

Referenced by ClearCaches().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 155 of file eda_item.h.

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

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

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

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 143 of file view_item.h.

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

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * SCH_FIELD::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 EDA_ITEM.

Definition at line 126 of file sch_field.cpp.

127{
128 return new SCH_FIELD( *this );
129}
SCH_FIELD(const VECTOR2I &aPos, int aFieldId, SCH_ITEM *aParent, const wxString &aName=wxEmptyString)
Definition: sch_field.cpp:59

References SCH_FIELD().

◆ Compare()

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

Definition at line 911 of file eda_text.cpp.

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

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

◆ ConnectedItems()

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

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

Definition at line 187 of file sch_item.cpp.

188{
189 return m_connected_items[ aSheet ];
190}

References SCH_ITEM::m_connected_items.

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

◆ Connection()

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

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

Note
The returned value can be nullptr.

Definition at line 146 of file sch_item.cpp.

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

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

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

◆ ConnectionPropagatesTo()

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

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

Reimplemented in SCH_BUS_WIRE_ENTRY, SCH_LINE, and SCH_PIN.

Definition at line 411 of file sch_item.h.

411{ return true; }

◆ CopyText()

◆ DoHypertextAction()

void SCH_FIELD::DoHypertextAction ( EDA_DRAW_FRAME aFrame) const
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 788 of file sch_field.cpp.

789{
790 constexpr int START_ID = 1;
791
792 if( IsHypertext() )
793 {
794 SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( m_parent );
795 std::vector<std::pair<wxString, wxString>> pages;
796 wxMenu menu;
797 wxString href;
798
799 label->GetIntersheetRefs( &pages );
800
801 for( int i = 0; i < (int) pages.size(); ++i )
802 {
803 menu.Append( i + START_ID, wxString::Format( _( "Go to Page %s (%s)" ),
804 pages[i].first,
805 pages[i].second ) );
806 }
807
808 menu.AppendSeparator();
809 menu.Append( 999 + START_ID, _( "Back to Previous Selected Sheet" ) );
810
811 int sel = aFrame->GetPopupMenuSelectionFromUser( menu ) - START_ID;
812
813 if( sel >= 0 && sel < (int) pages.size() )
814 href = wxT( "#" ) + pages[ sel ].first;
815 else if( sel == 999 )
817
818 if( !href.IsEmpty() )
819 {
821 navTool->HypertextCommand( href );
822 }
823 }
824}
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:498
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_field.h:92
void GetIntersheetRefs(std::vector< std::pair< wxString, wxString > > *pages)
Builds an array of { pageNumber, pageName } pairs.
Definition: sch_label.cpp:447
Handle actions specific to the schematic editor.
static wxString g_BackLink
void HypertextCommand(const wxString &href)
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
#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(), SCH_NAVIGATE_TOOL::g_BackLink, SCH_LABEL_BASE::GetIntersheetRefs(), TOOL_MANAGER::GetTool(), TOOLS_HOLDER::GetToolManager(), SCH_NAVIGATE_TOOL::HypertextCommand(), IsHypertext(), and EDA_ITEM::m_parent.

◆ doIsConnected()

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

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

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

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

Definition at line 488 of file sch_item.h.

488{ return false; }

Referenced by SCH_ITEM::IsConnected().

◆ Duplicate()

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

Routine to create a new copy of given item.

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

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

Definition at line 93 of file sch_item.cpp.

94{
95 SCH_ITEM* newItem = (SCH_ITEM*) Clone();
96
97 if( !doClone )
98 const_cast<KIID&>( newItem->m_Uuid ) = KIID();
99
100 newItem->ClearFlags( SELECTED | BRIGHTENED );
101
102 newItem->RunOnChildren(
103 []( SCH_ITEM* aChild )
104 {
105 aChild->ClearFlags( SELECTED | BRIGHTENED );
106 } );
107
108 return newItem;
109}
const KIID m_Uuid
Definition: eda_item.h:494
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:82
Definition: kiid.h:48
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
Definition: sch_item.h:444

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

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

◆ Empty()

void EDA_TEXT::Empty ( )
inherited

◆ Format()

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

Output the object to aFormatter in s-expression form.

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

Definition at line 781 of file eda_text.cpp.

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

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

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

◆ Get() [1/3]

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

Definition at line 104 of file inspectable.h.

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

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

◆ Get() [2/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 84 of file inspectable.h.

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

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

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

◆ Get() [3/3]

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

Definition at line 92 of file inspectable.h.

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

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

◆ GetAttributes()

◆ GetBoundingBox()

const BOX2I SCH_FIELD::GetBoundingBox ( ) const
overridevirtual

Return the orthogonal bounding box of this object for display purposes.

This box should be an enclosing perimeter for visible components of this object, and the units should be in the pcb or schematic coordinate system. It is OK to overestimate the size by a few counts.

Reimplemented from EDA_ITEM.

Definition at line 462 of file sch_field.cpp.

463{
464 // Calculate the text bounding box:
465 BOX2I bbox = GetTextBox();
466
467 // Calculate the bounding box position relative to the parent:
468 VECTOR2I origin = GetParentPosition();
469 VECTOR2I pos = GetTextPos() - origin;
470 VECTOR2I begin = bbox.GetOrigin() - origin;
471 VECTOR2I end = bbox.GetEnd() - origin;
472 RotatePoint( begin, pos, GetTextAngle() );
473 RotatePoint( end, pos, GetTextAngle() );
474
475 // Now, apply the symbol transform (mirror/rot)
476 TRANSFORM transform;
477
478 if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
479 {
480 SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
481
482 // Due to the Y axis direction, we must mirror the bounding box,
483 // relative to the text position:
484 MIRROR( begin.y, pos.y );
485 MIRROR( end.y, pos.y );
486
487 transform = parentSymbol->GetTransform();
488 }
489 else
490 {
491 transform = TRANSFORM( 1, 0, 0, 1 ); // identity transform
492 }
493
494 bbox.SetOrigin( transform.TransformCoordinate( begin ) );
495 bbox.SetEnd( transform.TransformCoordinate( end ) );
496
497 bbox.Move( origin );
498 bbox.Normalize();
499
500 return bbox;
501}
void SetOrigin(const Vec &pos)
Definition: box2.h:202
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:119
const Vec & GetOrigin() const
Definition: box2.h:183
const Vec GetEnd() const
Definition: box2.h:185
void Move(const Vec &aMoveVector)
Move the rectangle by the aMoveVector.
Definition: box2.h:111
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:255
BOX2I GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:503
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:201
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:120
VECTOR2I GetParentPosition() const
Definition: sch_field.cpp:1086
Schematic symbol object.
Definition: sch_symbol.h:80
TRANSFORM & GetTransform()
Definition: sch_symbol.h:277
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:47
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:40
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183
@ SCH_SYMBOL_T
Definition: typeinfo.h:156

References BOX2< Vec >::GetEnd(), BOX2< Vec >::GetOrigin(), GetParentPosition(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextBox(), EDA_TEXT::GetTextPos(), SCH_SYMBOL::GetTransform(), EDA_ITEM::m_parent, MIRROR(), BOX2< Vec >::Move(), BOX2< Vec >::Normalize(), RotatePoint(), SCH_SYMBOL_T, BOX2< Vec >::SetEnd(), BOX2< Vec >::SetOrigin(), TRANSFORM::TransformCoordinate(), EDA_ITEM::Type(), and VECTOR2< T >::y.

Referenced by KIGFX::SCH_PAINTER::draw(), AUTOPLACER::fieldVPlacement(), HitTest(), IsHorizJustifyFlipped(), IsVertJustifyFlipped(), Plot(), and Print().

◆ GetCanonicalName()

wxString SCH_FIELD::GetCanonicalName ( ) const

Get a non-language-specific name for a field which can be used for storage, variable look-up, etc.

Definition at line 859 of file sch_field.cpp.

860{
861 if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
862 {
863 switch( m_id )
864 {
865 case REFERENCE_FIELD: return wxT( "Reference" );
866 case VALUE_FIELD: return wxT( "Value" );
867 case FOOTPRINT_FIELD: return wxT( "Footprint" );
868 case DATASHEET_FIELD: return wxT( "Datasheet" );
869 default: return m_name;
870 }
871 }
872 else if( m_parent && m_parent->Type() == SCH_SHEET_T )
873 {
874 switch( m_id )
875 {
876 case SHEETNAME: return wxT( "Sheetname" );
877 case SHEETFILENAME: return wxT( "Sheetfile" );
878 default: return m_name;
879 }
880 }
881 else if( m_parent && m_parent->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
882 {
883 // These should be stored in canonical format, but just in case:
884 if( m_name == _( "Net Class" ) )
885 return wxT( "Netclass" );
886 else if (m_name == _( "Sheet References" ) )
887 return wxT( "Intersheetrefs" );
888 else
889 return m_name;
890 }
891 else
892 {
893 if( m_parent )
894 {
895 wxFAIL_MSG( wxString::Format( "Unhandled field owner type (id %d, parent type %d).",
896 m_id, m_parent->Type() ) );
897 }
898
899 return m_name;
900 }
901}
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:183
@ SHEETNAME
Definition: sch_sheet.h:43
@ SHEETFILENAME
Definition: sch_sheet.h:44
@ DATASHEET_FIELD
name of datasheet
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
@ SCH_SHEET_T
Definition: typeinfo.h:158

References _, DATASHEET_FIELD, FOOTPRINT_FIELD, Format(), EDA_ITEM::IsType(), m_id, m_name, EDA_ITEM::m_parent, REFERENCE_FIELD, SCH_SHEET_T, SCH_SYMBOL_T, SHEETFILENAME, SHEETNAME, EDA_ITEM::Type(), and VALUE_FIELD.

Referenced by DIALOG_CHANGE_SYMBOLS::processSymbol(), SCH_SEXPR_PLUGIN::saveField(), and SetId().

◆ GetClass()

wxString SCH_FIELD::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Reimplemented from SCH_ITEM.

Definition at line 67 of file sch_field.h.

68 {
69 return wxT( "SCH_FIELD" );
70 }

◆ GetConnectionPoints()

virtual std::vector< VECTOR2I > SCH_ITEM::GetConnectionPoints ( ) const
inlinevirtualinherited

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 in SCH_BUS_ENTRY_BASE, SCH_JUNCTION, SCH_LABEL_BASE, SCH_LINE, SCH_NO_CONNECT, SCH_SHEET, and SCH_SYMBOL.

Definition at line 364 of file sch_item.h.

364{ return {}; }

Referenced by SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), SCH_MOVE_TOOL::AlignElements(), EE_GRID_HELPER::computeAnchors(), SCH_EDIT_TOOL::DoDelete(), SCH_MOVE_TOOL::Main(), SCH_EDITOR_CONTROL::Paste(), and SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires().

◆ GetDefaultFont()

const wxString & SCH_ITEM::GetDefaultFont ( ) const
inherited

Definition at line 286 of file sch_item.cpp.

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

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

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

◆ getDrawFont()

KIFONT::FONT * SCH_FIELD::getDrawFont ( ) const
overrideprotectedvirtual

Reimplemented from EDA_TEXT.

Definition at line 269 of file sch_field.cpp.

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

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

◆ GetDrawPos()

◆ GetDrawRotation()

EDA_ANGLE SCH_FIELD::GetDrawRotation ( ) const
overridevirtual

Adjusters to allow EDA_TEXT to draw/print/etc.

text in absolute coords.

Reimplemented from EDA_TEXT.

Definition at line 440 of file sch_field.cpp.

441{
442 // Calculate the text orientation according to the symbol orientation.
443 EDA_ANGLE orient = GetTextAngle();
444
445 if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
446 {
447 SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
448
449 if( parentSymbol && parentSymbol->GetTransform().y1 ) // Rotate symbol 90 degrees.
450 {
451 if( orient.IsHorizontal() )
452 orient = ANGLE_VERTICAL;
453 else
454 orient = ANGLE_HORIZONTAL;
455 }
456 }
457
458 return orient;
459}
bool IsHorizontal() const
Definition: eda_angle.h:174
int y1
Definition: transform.h:50
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
Definition: eda_angle.h:408
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:409

References ANGLE_HORIZONTAL, ANGLE_VERTICAL, EDA_TEXT::GetTextAngle(), SCH_SYMBOL::GetTransform(), EDA_ANGLE::IsHorizontal(), EDA_ITEM::m_parent, SCH_SYMBOL_T, EDA_ITEM::Type(), and TRANSFORM::y1.

Referenced by IsHorizJustifyFlipped(), and IsVertJustifyFlipped().

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 147 of file eda_item.h.

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

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

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

◆ GetEffectiveHorizJustify()

GR_TEXT_H_ALIGN_T SCH_FIELD::GetEffectiveHorizJustify ( ) const

Definition at line 527 of file sch_field.cpp.

528{
529 switch( GetHorizJustify() )
530 {
535 default:
537 }
538}
bool IsHorizJustifyFlipped() const
Return whether the field will be rendered with the horizontal justification inverted due to rotation ...
Definition: sch_field.cpp:504
@ GR_TEXT_H_ALIGN_RIGHT

References EDA_TEXT::GetHorizJustify(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, and IsHorizJustifyFlipped().

Referenced by DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

◆ GetEffectiveNetClass()

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

Definition at line 166 of file sch_item.cpp.

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

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

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

◆ GetEffectiveTextPenWidth()

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

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

Definition at line 297 of file eda_text.cpp.

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

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

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

◆ GetEffectiveTextShape()

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

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

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

Definition at line 853 of file eda_text.cpp.

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

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

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

◆ GetEffectiveVertJustify()

◆ GetEndPoints()

virtual void SCH_ITEM::GetEndPoints ( std::vector< DANGLING_END_ITEM > &  aItemList)
inlinevirtualinherited

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 in SCH_BUS_WIRE_ENTRY, SCH_BUS_BUS_ENTRY, SCH_JUNCTION, SCH_LABEL_BASE, SCH_LINE, SCH_NO_CONNECT, SCH_SHEET, SCH_SHEET_PIN, and SCH_SYMBOL.

Definition at line 318 of file sch_item.h.

318{}

Referenced by PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems().

◆ GetFieldColor()

COLOR4D SCH_FIELD::GetFieldColor ( ) const

Definition at line 422 of file sch_field.cpp.

423{
424 if( GetTextColor() != COLOR4D::UNSPECIFIED )
425 {
427 }
428 else
429 {
430 SCH_LABEL_BASE* parentLabel = dynamic_cast<SCH_LABEL_BASE*>( GetParent() );
431
432 if( parentLabel && !parentLabel->IsConnectivityDirty() )
433 m_lastResolvedColor = parentLabel->GetEffectiveNetClass()->GetSchematicColor();
434 }
435
436 return m_lastResolvedColor;
437}
EDA_ITEM * GetParent() const
Definition: eda_item.h:99
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition: sch_item.cpp:166

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

◆ GetFieldsAutoplaced()

FIELDS_AUTOPLACED SCH_ITEM::GetFieldsAutoplaced ( ) const
inlineinherited

Return whether the fields have been automatically placed.

Definition at line 424 of file sch_item.h.

424{ return m_fieldsAutoplaced; }

References SCH_ITEM::m_fieldsAutoplaced.

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

◆ GetFlags()

◆ GetFocusPosition()

virtual const VECTOR2I EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

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

Reimplemented in BOARD, PCB_SHAPE, and PCB_TRACK.

Definition at line 258 of file eda_item.h.

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

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetFont()

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

Definition at line 181 of file eda_text.h.

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

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

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

◆ GetFontName()

wxString EDA_TEXT::GetFontName ( ) const
inherited

Definition at line 757 of file eda_text.cpp.

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

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

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

◆ GetFriendlyName()

wxString EDA_ITEM::GetFriendlyName ( ) const
virtualinherited

Reimplemented in PCB_SHAPE, and ZONE.

Definition at line 310 of file eda_item.cpp.

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

References EDA_ITEM::GetTypeDesc().

Referenced by PROPERTIES_PANEL::update().

◆ GetHorizJustify()

GR_TEXT_H_ALIGN_T EDA_TEXT::GetHorizJustify ( ) const
inlineinherited

Definition at line 142 of file eda_text.h.

142{ return m_attributes.m_Halign; };

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

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

◆ GetHyperlink()

wxString EDA_TEXT::GetHyperlink ( ) const
inlineinherited

◆ GetId()

◆ GetInterline()

int EDA_TEXT::GetInterline ( ) const
inherited

Return the distance between two lines of text.

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

Definition at line 497 of file eda_text.cpp.

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

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

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

◆ GetLayer()

◆ GetLibPosition()

VECTOR2I SCH_FIELD::GetLibPosition ( ) const
inline

Definition at line 217 of file sch_field.h.

217{ return EDA_TEXT::GetTextPos(); }

References EDA_TEXT::GetTextPos().

Referenced by operator<(), and SCH_LEGACY_PLUGIN::saveField().

◆ GetLinePositions()

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

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

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

Definition at line 671 of file eda_text.cpp.

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

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

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

◆ GetLineSpacing()

double EDA_TEXT::GetLineSpacing ( ) const
inlineinherited

Definition at line 186 of file eda_text.h.

186{ return m_attributes.m_LineSpacing; }

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

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

◆ GetMenuImage()

BITMAPS SCH_FIELD::GetMenuImage ( ) const
overridevirtual

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

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

Returns
The menu image associated with the item.

Reimplemented from EDA_ITEM.

Definition at line 904 of file sch_field.cpp.

905{
906 if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
907 {
908 switch( m_id )
909 {
913 default: return BITMAPS::text;
914 }
915 }
916
917 return BITMAPS::text;
918}
@ edit_comp_value
@ edit_comp_footprint
@ edit_comp_ref

References edit_comp_footprint, edit_comp_ref, edit_comp_value, FOOTPRINT_FIELD, m_id, EDA_ITEM::m_parent, REFERENCE_FIELD, SCH_SYMBOL_T, text, EDA_ITEM::Type(), and VALUE_FIELD.

◆ GetMsgPanelInfo()

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

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

Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 751 of file sch_field.cpp.

752{
753 wxString msg;
754
755 aList.emplace_back( _( "Symbol Field" ), GetName() );
756
757 // Don't use GetShownText() here; we want to show the user the variable references
758 aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
759
760 aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
761
762 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
763
764 aList.emplace_back( _( "Style" ), GetTextStyleName() );
765
766 aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
767
768 switch ( GetHorizJustify() )
769 {
770 case GR_TEXT_H_ALIGN_LEFT: msg = _( "Left" ); break;
771 case GR_TEXT_H_ALIGN_CENTER: msg = _( "Center" ); break;
772 case GR_TEXT_H_ALIGN_RIGHT: msg = _( "Right" ); break;
773 }
774
775 aList.emplace_back( _( "H Justification" ), msg );
776
777 switch ( GetVertJustify() )
778 {
779 case GR_TEXT_V_ALIGN_TOP: msg = _( "Top" ); break;
780 case GR_TEXT_V_ALIGN_CENTER: msg = _( "Center" ); break;
781 case GR_TEXT_V_ALIGN_BOTTOM: msg = _( "Bottom" ); break;
782 }
783
784 aList.emplace_back( _( "V Justification" ), msg );
785}
wxString GetTextStyleName() const
Definition: eda_text.cpp:736
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Definition: sch_field.cpp:827
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().

References _, EDA_TEXT::GetFont(), EDA_TEXT::GetHorizJustify(), GetName(), EDA_TEXT::GetText(), EDA_TEXT::GetTextStyleName(), EDA_TEXT::GetTextWidth(), EDA_TEXT::GetVertJustify(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, EDA_TEXT::IsVisible(), UNITS_PROVIDER::MessageTextFromValue(), and UnescapeString().

◆ GetName()

wxString SCH_FIELD::GetName ( bool  aUseDefaultName = true) const

Return the field name (not translated).

Parameters
aUseDefaultNameWhen true return the default field name if the field name is empty. Otherwise the default field name is returned.
Returns
the name of the field.

Definition at line 827 of file sch_field.cpp.

828{
829 if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
830 {
831 if( m_id >= 0 && m_id < MANDATORY_FIELDS )
833 else if( m_name.IsEmpty() && aUseDefaultName )
835 else
836 return m_name;
837 }
838 else if( m_parent && m_parent->Type() == SCH_SHEET_T )
839 {
840 if( m_id >= 0 && m_id < SHEET_MANDATORY_FIELDS )
842 else if( m_name.IsEmpty() && aUseDefaultName )
844 else
845 return m_name;
846 }
847 else if( m_parent && m_parent->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
848 {
849 return SCH_LABEL_BASE::GetDefaultFieldName( m_name, aUseDefaultName );
850 }
851 else
852 {
853 wxFAIL_MSG( "Unhandled field owner type." );
854 return m_name;
855 }
856}
static const wxString GetDefaultFieldName(const wxString &aName, bool aUseDefaultName)
Definition: sch_label.cpp:183
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslated=true)
Definition: sch_sheet.cpp:55
@ SHEET_MANDATORY_FIELDS
The first 2 are mandatory, and must be instantiated in SCH_SHEET.
Definition: sch_sheet.h:47
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslateForHI=false)
Return a default symbol field name for field aFieldNdx for all components.
@ MANDATORY_FIELDS
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.

References SCH_LABEL_BASE::GetDefaultFieldName(), SCH_SHEET::GetDefaultFieldName(), TEMPLATE_FIELDNAME::GetDefaultFieldName(), EDA_ITEM::IsType(), m_id, m_name, EDA_ITEM::m_parent, MANDATORY_FIELDS, SCH_SHEET_T, SCH_SYMBOL_T, SHEET_MANDATORY_FIELDS, and EDA_ITEM::Type().

Referenced by NETLIST_EXPORTER_XML::addSymbolFields(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), SCH_EDIT_TOOL::editFieldText(), GetMsgPanelInfo(), GetSelectMenuText(), GetShownText(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), operator<(), DIALOG_CHANGE_SYMBOLS::processSymbol(), SCH_LEGACY_PLUGIN::saveField(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PROPERTIES::Validate(), DIALOG_SYMBOL_PROPERTIES::Validate(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetOrInitConnection()

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

Definition at line 228 of file sch_item.cpp.

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

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

◆ GetParent()

◆ GetParentPosition()

VECTOR2I SCH_FIELD::GetParentPosition ( ) const

Definition at line 1086 of file sch_field.cpp.

1087{
1088 return m_parent ? m_parent->GetPosition() : VECTOR2I( 0, 0 );
1089}
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

References EDA_ITEM::GetPosition(), and EDA_ITEM::m_parent.

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

◆ GetPenWidth()

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

Reimplemented from SCH_ITEM.

Definition at line 263 of file sch_field.cpp.

264{
266}

References EDA_TEXT::GetEffectiveTextPenWidth().

◆ GetPosition()

VECTOR2I SCH_FIELD::GetPosition ( ) const
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 1070 of file sch_field.cpp.

1071{
1072 if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
1073 {
1074 SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
1075 VECTOR2I relativePos = GetTextPos() - parentSymbol->GetPosition();
1076
1077 relativePos = parentSymbol->GetTransform().TransformCoordinate( relativePos );
1078
1079 return relativePos + parentSymbol->GetPosition();
1080 }
1081
1082 return GetTextPos();
1083}
VECTOR2I GetPosition() const override
Definition: sch_symbol.h:697

References SCH_SYMBOL::GetPosition(), EDA_TEXT::GetTextPos(), SCH_SYMBOL::GetTransform(), EDA_ITEM::m_parent, SCH_SYMBOL_T, TRANSFORM::TransformCoordinate(), and EDA_ITEM::Type().

Referenced by DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), IsHorizJustifyFlipped(), IsVertJustifyFlipped(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), positioningChanged(), DIALOG_CHANGE_SYMBOLS::processSymbol(), Rotate(), SCH_SEXPR_PLUGIN::saveField(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

◆ GetRenderCache() [1/2]

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

Definition at line 451 of file eda_text.cpp.

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

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

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

◆ GetRenderCache() [2/2]

std::vector< std::unique_ptr< KIFONT::GLYPH > > * SCH_FIELD::GetRenderCache ( const wxString &  forResolvedText,
const VECTOR2I forPosition,
TEXT_ATTRIBUTES aAttrs 
) const

Definition at line 295 of file sch_field.cpp.

297{
298 KIFONT::FONT* font = GetFont();
299
300 if( !font )
302
303 if( font->IsOutline() )
304 {
305 KIFONT::OUTLINE_FONT* outlineFont = static_cast<KIFONT::OUTLINE_FONT*>( font );
306
307 if( m_renderCache.empty() || !m_renderCacheValid )
308 {
309 m_renderCache.clear();
310
311 outlineFont->GetLinesAsGlyphs( &m_renderCache, forResolvedText, forPosition, aAttrs );
312
313 m_renderCachePos = forPosition;
314 m_renderCacheValid = true;
315 }
316
317 if( m_renderCachePos != forPosition )
318 {
319 VECTOR2I delta = forPosition - m_renderCachePos;
320
321 for( std::unique_ptr<KIFONT::GLYPH>& glyph : m_renderCache )
322 static_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() )->Move( delta );
323
324 m_renderCachePos = forPosition;
325 }
326
327 return &m_renderCache;
328 }
329
330 return nullptr;
331}
virtual bool IsOutline() const
Definition: font.h:113
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_field.h:177
constexpr int delta

References delta, SCH_ITEM::GetDefaultFont(), EDA_TEXT::GetFont(), KIFONT::FONT::GetFont(), KIFONT::OUTLINE_FONT::GetLinesAsGlyphs(), EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), KIFONT::FONT::IsOutline(), m_renderCache, m_renderCachePos, m_renderCacheValid, and Move().

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

◆ GetSelectMenuText()

wxString SCH_FIELD::GetSelectMenuText ( UNITS_PROVIDER aUnitsProvider) 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 EDA_ITEM.

Definition at line 745 of file sch_field.cpp.

746{
748}
wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
Definition: sch_field.cpp:169
wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
Definition: ui_common.cpp:203

References KIUI::EllipsizeMenuText(), Format(), GetName(), and GetShownText().

◆ GetShownText()

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

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

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

Reimplemented from EDA_TEXT.

Definition at line 169 of file sch_field.cpp.

170{
171 std::function<bool( wxString* )> symbolResolver =
172 [&]( wxString* token ) -> bool
173 {
174 if( token->Contains( ':' ) )
175 {
176 if( Schematic()->ResolveCrossReference( token, aDepth ) )
177 return true;
178 }
179 else
180 {
181 SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
182
183 if( parentSymbol->ResolveTextVar( token, aDepth + 1 ) )
184 return true;
185
186 SCHEMATIC* schematic = parentSymbol->Schematic();
187 SCH_SHEET* sheet = schematic ? schematic->CurrentSheet().Last() : nullptr;
188
189 if( sheet && sheet->ResolveTextVar( token, aDepth + 1 ) )
190 return true;
191 }
192
193 return false;
194 };
195
196 std::function<bool( wxString* )> sheetResolver =
197 [&]( wxString* token ) -> bool
198 {
199 SCH_SHEET* sheet = static_cast<SCH_SHEET*>( m_parent );
200 return sheet->ResolveTextVar( token, aDepth + 1 );
201 };
202
203 std::function<bool( wxString* )> labelResolver =
204 [&]( wxString* token ) -> bool
205 {
206 SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( m_parent );
207 return label->ResolveTextVar( token, aDepth + 1 );
208 };
209
210 PROJECT* project = nullptr;
211 wxString text = EDA_TEXT::GetShownText();
212
213 if( IsNameShown() )
214 text = GetName() << wxS( ": " ) << text;
215
216 if( text == wxS( "~" ) ) // Legacy placeholder for empty string
217 {
218 text = wxS( "" );
219 }
220 else if( HasTextVars() )
221 {
222 if( Schematic() )
223 project = &Schematic()->Prj();
224
225 if( aDepth < 10 )
226 {
227 if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
228 text = ExpandTextVars( text, &symbolResolver, nullptr, project );
229 else if( m_parent && m_parent->Type() == SCH_SHEET_T )
230 text = ExpandTextVars( text, &sheetResolver, nullptr, project );
231 else if( m_parent && m_parent->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
232 text = ExpandTextVars( text, &labelResolver, nullptr, project );
233 else
235 }
236 }
237
238 // WARNING: the IDs of FIELDS and SHEETS overlap, so one must check *both* the
239 // id and the parent's type.
240
241 if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
242 {
243 SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
244
245 if( m_id == REFERENCE_FIELD )
246 {
247 // For more than one part per package, we must add the part selection
248 // A, B, ... or 1, 2, .. to the reference.
249 if( parentSymbol->GetUnitCount() > 1 )
250 text << LIB_SYMBOL::SubReference( parentSymbol->GetUnit() );
251 }
252 }
253 else if( m_parent && m_parent->Type() == SCH_SHEET_T )
254 {
255 if( m_id == SHEETFILENAME && aAllowExtraText )
256 text = _( "File:" ) + wxS( " " )+ text;
257 }
258
259 return text;
260}
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition: eda_text.h:103
static wxString SubReference(int aUnit, bool aAddSeparator=true)
Definition: lib_symbol.cpp:588
Container for project specific data.
Definition: project.h:63
bool ResolveCrossReference(wxString *token, int aDepth) const
Resolves text vars that refer to other items.
Definition: schematic.cpp:259
bool IsNameShown() const
Definition: sch_field.h:149
virtual bool ResolveTextVar(wxString *token, int aDepth) const
Definition: sch_label.cpp:482
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:55
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
Definition: sch_sheet.cpp:233
int GetUnitCount() const
Return the number of units per package of the symbol.
Definition: sch_symbol.cpp:419
int GetUnit() const
Definition: sch_symbol.h:227
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:57

References _, SCHEMATIC::CurrentSheet(), ExpandTextVars(), GetName(), EDA_TEXT::GetShownText(), SCH_SYMBOL::GetUnit(), SCH_SYMBOL::GetUnitCount(), EDA_TEXT::HasTextVars(), IsNameShown(), EDA_ITEM::IsType(), SCH_SHEET_PATH::Last(), m_id, EDA_ITEM::m_parent, SCHEMATIC::Prj(), project, REFERENCE_FIELD, SCHEMATIC::ResolveCrossReference(), SCH_LABEL_BASE::ResolveTextVar(), SCH_SHEET::ResolveTextVar(), SCH_SYMBOL::ResolveTextVar(), SCH_SHEET_T, SCH_SYMBOL_T, SCH_ITEM::Schematic(), SHEETFILENAME, LIB_SYMBOL::SubReference(), text, and EDA_ITEM::Type().

Referenced by NETLIST_EXPORTER_XML::addSymbolFields(), SIM_PLOT_FRAME::AddTuner(), KIGFX::SCH_PAINTER::draw(), SCH_SYMBOL::GetFootprintFieldText(), GetSelectMenuText(), SCH_SYMBOL::GetValueFieldText(), HitTest(), Matches(), DIALOG_SHEET_PROPERTIES::OnUpdateUI(), Plot(), Print(), EE_INSPECTION_TOOL::ShowDatasheet(), and TUNER_SLIDER::TUNER_SLIDER().

◆ GetSortPosition()

virtual VECTOR2I EDA_ITEM::GetSortPosition ( ) const
inlinevirtualinherited

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

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

Returns
X,Y coordinate of the sort point

Reimplemented in SCH_LINE.

Definition at line 267 of file eda_item.h.

267{ return GetPosition(); }

References EDA_ITEM::GetPosition().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 126 of file eda_item.h.

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

References EDA_ITEM::m_status.

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 139 of file eda_item.h.

139{ return m_status; }

References EDA_ITEM::m_status.

◆ GetStoredPos()

VECTOR2I & SCH_ITEM::GetStoredPos ( )
inlineinherited

Definition at line 209 of file sch_item.h.

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

References SCH_ITEM::m_storedPos.

◆ GetStroke()

virtual STROKE_PARAMS SCH_ITEM::GetStroke ( ) const
inlinevirtualinherited

Reimplemented in SCH_BUS_ENTRY_BASE, SCH_LINE, and SCH_SHAPE.

Definition at line 457 of file sch_item.h.

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

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem().

◆ GetText()

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

Return the string associated with the text object.

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

Definition at line 87 of file eda_text.h.

87{ return m_text; }

References EDA_TEXT::m_text.

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

◆ GetTextAngle()

const EDA_ANGLE & EDA_TEXT::GetTextAngle ( ) const
inlineinherited

Definition at line 120 of file eda_text.h.

120{ return m_attributes.m_Angle; }

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

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

◆ GetTextBox()

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

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

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

Definition at line 503 of file eda_text.cpp.

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

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

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

◆ GetTextColor()

◆ GetTextHeight()

◆ GetTextPos()

const VECTOR2I & EDA_TEXT::GetTextPos ( ) const
inlineinherited

Definition at line 201 of file eda_text.h.

201{ return m_pos; }

References EDA_TEXT::m_pos.

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

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

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

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

◆ GetTextThickness()

◆ GetTextWidth()

int EDA_TEXT::GetTextWidth ( ) const
inlineinherited

Definition at line 192 of file eda_text.h.

192{ return m_attributes.m_Size.x; }

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

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

◆ GetTypeDesc()

wxString EDA_ITEM::GetTypeDesc ( ) const
inherited

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

Definition at line 301 of file eda_item.cpp.

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

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

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

◆ GetVertJustify()

◆ GotoPageHref()

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

Generate a href to a page in the current schematic.

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

Definition at line 1004 of file eda_text.cpp.

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

Referenced by SCH_SHEET::Plot().

◆ HasFlag()

◆ HasHyperlink()

virtual bool EDA_TEXT::HasHyperlink ( ) const
inlinevirtualinherited

◆ HasLineStroke()

virtual bool SCH_ITEM::HasLineStroke ( ) const
inlinevirtualinherited

Check if this schematic item has line stoke properties.

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

Reimplemented in SCH_BUS_ENTRY_BASE, SCH_LINE, and SCH_SHAPE.

Definition at line 455 of file sch_item.h.

455{ return false; }

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

◆ HasTextVars()

bool EDA_TEXT::HasTextVars ( ) const
inlineinherited

◆ HitTest() [1/2]

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

Test if aRect intersects this item.

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

Reimplemented from EDA_ITEM.

Definition at line 941 of file sch_field.cpp.

942{
943 // Do not hit test hidden fields.
944 if( !IsVisible() || GetShownText().IsEmpty() )
945 return false;
946
947 BOX2I rect = aRect;
948
949 rect.Inflate( aAccuracy );
950
951 if( GetParent() && GetParent()->Type() == SCH_GLOBAL_LABEL_T )
952 {
953 SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( GetParent() );
954 rect.Offset( label->GetSchematicTextOffset( nullptr ) );
955 }
956
957 if( aContained )
958 return rect.Contains( GetBoundingBox() );
959
960 return rect.Intersects( GetBoundingBox() );
961}
void Offset(coord_type dx, coord_type dy)
Definition: box2.h:224
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:269
bool Contains(const Vec &aPoint) const
Definition: box2.h:141
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_field.cpp:462
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_label.cpp:1271
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:152

References BOX2< Vec >::Contains(), GetBoundingBox(), EDA_ITEM::GetParent(), SCH_GLOBALLABEL::GetSchematicTextOffset(), GetShownText(), BOX2< Vec >::Inflate(), BOX2< Vec >::Intersects(), EDA_TEXT::IsVisible(), BOX2< Vec >::Offset(), SCH_GLOBAL_LABEL_T, and EDA_ITEM::Type().

◆ HitTest() [2/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 921 of file sch_field.cpp.

922{
923 // Do not hit test hidden or empty fields.
924 if( !IsVisible() || GetShownText().IsEmpty() )
925 return false;
926
927 BOX2I rect = GetBoundingBox();
928
929 rect.Inflate( aAccuracy );
930
931 if( GetParent() && GetParent()->Type() == SCH_GLOBAL_LABEL_T )
932 {
933 SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( GetParent() );
934 rect.Offset( label->GetSchematicTextOffset( nullptr ) );
935 }
936
937 return rect.Contains( aPosition );
938}

References BOX2< Vec >::Contains(), GetBoundingBox(), EDA_ITEM::GetParent(), SCH_GLOBALLABEL::GetSchematicTextOffset(), GetShownText(), BOX2< Vec >::Inflate(), EDA_TEXT::IsVisible(), BOX2< Vec >::Offset(), SCH_GLOBAL_LABEL_T, and EDA_ITEM::Type().

◆ ImportValues()

void SCH_FIELD::ImportValues ( const LIB_FIELD aSource)

Copy parameters from a LIB_FIELD source.

Pointers and specific values (position) are not copied.

Parameters
aSourceis the LIB_FIELD to read.

Definition at line 397 of file sch_field.cpp.

398{
399 SetAttributes( aSource );
400 SetNameShown( aSource.IsNameShown() );
401 SetCanAutoplace( aSource.CanAutoplace() );
402}
void SetAttributes(const EDA_TEXT &aSrc)
Set the text attributes from another instance.
Definition: eda_text.cpp:264
bool CanAutoplace() const
Definition: lib_field.h:184
bool IsNameShown() const
Definition: lib_field.h:181
void SetCanAutoplace(bool aCanPlace)
Definition: sch_field.h:153
void SetNameShown(bool aShown=true)
Definition: sch_field.h:150

References LIB_FIELD::CanAutoplace(), LIB_FIELD::IsNameShown(), EDA_TEXT::SetAttributes(), SetCanAutoplace(), and SetNameShown().

Referenced by SCH_SYMBOL::UpdateFields().

◆ InitializeConnection()

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

Create a new connection object associated with this object.

Parameters
aPathis the sheet path to initialize.

Definition at line 205 of file sch_item.cpp.

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

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

Referenced by SCH_ITEM::GetOrInitConnection().

◆ IsBold()

bool EDA_TEXT::IsBold ( ) const
inlineinherited

Definition at line 126 of file eda_text.h.

126{ return m_attributes.m_Bold; }

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

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

◆ IsBrightened()

◆ IsConnectable()

◆ IsConnected()

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

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

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

Definition at line 137 of file sch_item.cpp.

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

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

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

◆ IsConnectivityDirty()

◆ IsDangling()

virtual bool SCH_ITEM::IsDangling ( ) const
inlinevirtualinherited

Reimplemented in SCH_BUS_ENTRY_BASE, SCH_LABEL_BASE, SCH_LINE, and SCH_PIN.

Definition at line 342 of file sch_item.h.

342{ return false; }

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

◆ IsDefaultFormatting()

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 105 of file eda_item.h.

105{ return m_flags & IS_DRAGGING; }

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 108 of file eda_item.h.

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

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 203 of file eda_item.h.

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

References EDA_ITEM::m_forceVisible.

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

◆ IsGotoPageHref()

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

Check if aHref is a valid internal hyperlink.

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

Definition at line 998 of file eda_text.cpp.

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

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

◆ IsHorizJustifyFlipped()

bool SCH_FIELD::IsHorizJustifyFlipped ( ) const

Return whether the field will be rendered with the horizontal justification inverted due to rotation or mirroring of the parent.

Definition at line 504 of file sch_field.cpp.

505{
506 VECTOR2I render_center = GetBoundingBox().Centre();
507 VECTOR2I pos = GetPosition();
508
509 switch( GetHorizJustify() )
510 {
512 if( GetDrawRotation().IsVertical() )
513 return render_center.y > pos.y;
514 else
515 return render_center.x < pos.x;
517 if( GetDrawRotation().IsVertical() )
518 return render_center.y < pos.y;
519 else
520 return render_center.x > pos.x;
521 default:
522 return false;
523 }
524}
Vec Centre() const
Definition: box2.h:70
VECTOR2I GetPosition() const override
Definition: sch_field.cpp:1070
EDA_ANGLE GetDrawRotation() const override
Adjusters to allow EDA_TEXT to draw/print/etc.
Definition: sch_field.cpp:440

References BOX2< Vec >::Centre(), GetBoundingBox(), GetDrawRotation(), EDA_TEXT::GetHorizJustify(), GetPosition(), GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by AUTOPLACER::fieldHPlacement(), GetEffectiveHorizJustify(), AUTOPLACER::justifyField(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

◆ IsHypertext()

bool SCH_FIELD::IsHypertext ( ) const
inlineoverridevirtual

Allow items to support hypertext actions when hovered/clicked.

Reimplemented from SCH_ITEM.

Definition at line 92 of file sch_field.h.

93 {
94 return m_id == 0 && m_parent && m_parent->Type() == SCH_GLOBAL_LABEL_T;
95 }

References m_id, EDA_ITEM::m_parent, SCH_GLOBAL_LABEL_T, and EDA_ITEM::Type().

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

◆ IsItalic()

bool EDA_TEXT::IsItalic ( ) const
inlineinherited

Definition at line 123 of file eda_text.h.

123{ return m_attributes.m_Italic; }

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

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

◆ IsKeepUpright()

bool EDA_TEXT::IsKeepUpright ( ) const
inlineinherited

◆ IsLocked()

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

Definition at line 229 of file sch_item.h.

229{ return false; }

◆ IsMirrored()

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 102 of file eda_item.h.

102{ return m_flags & IS_CHANGED; }

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMovableFromAnchorPoint()

virtual bool SCH_ITEM::IsMovableFromAnchorPoint ( ) const
inlinevirtualinherited
Returns
true for items which are moved with the anchor point at mouse cursor and false for items moved with no reference to anchor Usually return true for small items (labels, junctions) and false for items which can be large (hierarchical sheets, symbols)

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

Definition at line 207 of file sch_item.h.

207{ return true; }

Referenced by SCH_MOVE_TOOL::Main().

◆ IsMoving()

◆ IsMultilineAllowed()

bool EDA_TEXT::IsMultilineAllowed ( ) const
inlineinherited

◆ IsNameShown()

bool SCH_FIELD::IsNameShown ( ) const
inline

◆ IsNew()

◆ IsPointClickableAnchor()

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

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

Definition at line 355 of file sch_item.h.

355{ return false; }

Referenced by EE_SELECTION_TOOL::autostartEvent().

◆ IsReplaceable()

bool SCH_FIELD::IsReplaceable ( ) const
overridevirtual

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.

Definition at line 626 of file sch_field.cpp.

627{
628 if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
629 {
630 SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
631
632 if( m_id == VALUE_FIELD )
633 {
634 if( parentSymbol->GetLibSymbolRef() && parentSymbol->GetLibSymbolRef()->IsPower() )
635 return false;
636 }
637 }
638 else if( m_parent && m_parent->Type() == SCH_SHEET_T )
639 {
640 // See comments in SCH_FIELD::Replace(), below.
641 if( m_id == SHEETFILENAME )
642 return false;
643 }
644 else if( m_parent && m_parent->Type() == SCH_GLOBAL_LABEL_T )
645 {
646 if( m_id == 0 /* IntersheetRefs */ )
647 return false;
648 }
649
650 return true;
651}
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:191

References SCH_SYMBOL::GetLibSymbolRef(), m_id, EDA_ITEM::m_parent, SCH_GLOBAL_LABEL_T, SCH_SHEET_T, SCH_SYMBOL_T, SHEETFILENAME, EDA_ITEM::Type(), and VALUE_FIELD.

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 109 of file eda_item.h.

109{ return m_flags & IS_RESIZING; }

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsRollover()

bool EDA_ITEM::IsRollover ( ) const
inlineinherited

Definition at line 112 of file eda_item.h.

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

References IS_MOVING, IS_ROLLOVER, and EDA_ITEM::m_flags.

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

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 107 of file eda_item.h.

107{ return m_flags & SELECTED; }

References EDA_ITEM::m_flags, and SELECTED.

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

◆ IsShownAsBitmap()

bool EDA_ITEM::IsShownAsBitmap ( ) const
inlineinherited

Definition at line 175 of file eda_item.h.

175{ return m_flags & IS_SHOWN_AS_BITMAP; }
#define IS_SHOWN_AS_BITMAP

References IS_SHOWN_AS_BITMAP, and EDA_ITEM::m_flags.

◆ IsType()

bool SCH_FIELD::IsType ( const std::vector< KICAD_T > &  aScanTypes) const
inlineoverridevirtual

Check whether the item is one of the listed types.

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

Reimplemented from EDA_ITEM.

Definition at line 72 of file sch_field.h.

73 {
74 if( SCH_ITEM::IsType( aScanTypes ) )
75 return true;
76
77 for( KICAD_T scanType : aScanTypes )
78 {
80 return true;
81 else if ( scanType == SCH_FIELD_LOCATE_VALUE_T && m_id == VALUE_FIELD )
82 return true;
83 else if ( scanType == SCH_FIELD_LOCATE_FOOTPRINT_T && m_id == FOOTPRINT_FIELD )
84 return true;
85 else if ( scanType == SCH_FIELD_LOCATE_DATASHEET_T && m_id == DATASHEET_FIELD )
86 return true;
87 }
88
89 return false;
90 }
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: sch_item.h:162
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_FIELD_LOCATE_REFERENCE_T
Definition: typeinfo.h:164
@ SCH_FIELD_LOCATE_FOOTPRINT_T
Definition: typeinfo.h:166
@ SCH_FIELD_LOCATE_VALUE_T
Definition: typeinfo.h:165
@ SCH_FIELD_LOCATE_DATASHEET_T
Definition: typeinfo.h:167

References DATASHEET_FIELD, FOOTPRINT_FIELD, SCH_ITEM::IsType(), m_id, REFERENCE_FIELD, SCH_FIELD_LOCATE_DATASHEET_T, SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_FIELD_LOCATE_REFERENCE_T, SCH_FIELD_LOCATE_VALUE_T, and VALUE_FIELD.

◆ IsVertJustifyFlipped()

bool SCH_FIELD::IsVertJustifyFlipped ( ) const

Definition at line 541 of file sch_field.cpp.

542{
543 VECTOR2I render_center = GetBoundingBox().Centre();
544 VECTOR2I pos = GetPosition();
545
546 switch( GetVertJustify() )
547 {
549 if( GetDrawRotation().IsVertical() )
550 return render_center.x < pos.x;
551 else
552 return render_center.y < pos.y;
554 if( GetDrawRotation().IsVertical() )
555 return render_center.x > pos.x;
556 else
557 return render_center.y > pos.y;
558 default:
559 return false;
560 }
561}

References BOX2< Vec >::Centre(), GetBoundingBox(), GetDrawRotation(), GetPosition(), EDA_TEXT::GetVertJustify(), GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_TOP, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by GetEffectiveVertJustify(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

◆ IsVisible()

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 106 of file eda_item.h.

106{ return m_flags & IS_WIRE_IMAGE; }

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

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

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

Definition at line 304 of file eda_item.h.

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

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

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

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

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

Definition at line 324 of file eda_item.h.

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

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

◆ MapHorizJustify()

GR_TEXT_H_ALIGN_T EDA_TEXT::MapHorizJustify ( int  aHorizJustify)
staticinherited

Definition at line 62 of file eda_text.cpp.

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

References GR_TEXT_H_ALIGN_LEFT, and GR_TEXT_H_ALIGN_RIGHT.

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

◆ MapVertJustify()

GR_TEXT_V_ALIGN_T EDA_TEXT::MapVertJustify ( int  aVertJustify)
staticinherited

Definition at line 76 of file eda_text.cpp.

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

References GR_TEXT_V_ALIGN_BOTTOM, and GR_TEXT_V_ALIGN_TOP.

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

◆ Matches() [1/2]

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

Compare the item against the search criteria in aSearchData.

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

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

Reimplemented from EDA_ITEM.

Definition at line 578 of file sch_field.cpp.

579{
580 bool searchHiddenFields = false;
581 bool searchAndReplace = false;
582 bool replaceReferences = false;
583
584 try
585 {
586 const SCH_SEARCH_DATA& schSearchData = dynamic_cast<const SCH_SEARCH_DATA&>( aSearchData ); // downcast
587 searchHiddenFields = schSearchData.searchAllFields;
588 searchAndReplace = schSearchData.searchAndReplace;
589 replaceReferences = schSearchData.replaceReferences;
590 }
591 catch( const std::bad_cast& )
592 {
593 }
594
595 wxString text = GetShownText();
596
597 if( !IsVisible() && !searchHiddenFields )
598 return false;
599
601 {
602 if( searchAndReplace && !replaceReferences )
603 return false;
604
605 SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
606 wxASSERT( aAuxData );
607
608 // Take sheet path into account which effects the reference field and the unit for
609 // symbols with multiple parts.
610 if( aAuxData )
611 {
612 text = parentSymbol->GetRef((SCH_SHEET_PATH*) aAuxData );
613
614 if( SCH_ITEM::Matches( text, aSearchData ) )
615 return true;
616
617 if( parentSymbol->GetUnitCount() > 1 )
618 text << LIB_SYMBOL::SubReference( parentSymbol->GetUnit() );
619 }
620 }
621
622 return SCH_ITEM::Matches( text, aSearchData );
623}
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:384
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:624

References SCH_SYMBOL::GetRef(), GetShownText(), SCH_SYMBOL::GetUnit(), SCH_SYMBOL::GetUnitCount(), EDA_TEXT::IsVisible(), m_id, EDA_ITEM::m_parent, EDA_ITEM::Matches(), REFERENCE_FIELD, SCH_SEARCH_DATA::replaceReferences, SCH_SYMBOL_T, SCH_SEARCH_DATA::searchAllFields, EDA_SEARCH_DATA::searchAndReplace, LIB_SYMBOL::SubReference(), text, and EDA_ITEM::Type().

◆ Matches() [2/2]

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

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 117 of file eda_item.cpp.

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

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

◆ MirrorHorizontally()

void SCH_FIELD::MirrorHorizontally ( int  aCenter)
inlineoverridevirtual

Mirror item horizontally about aCenter.

This overload does nothing. Fields are never mirrored alone. They are moved when the parent symbol is mirrored. This function is only needed by the pure function of the master class.

Implements SCH_ITEM.

Definition at line 202 of file sch_field.h.

203 {
204 }

◆ MirrorVertically()

void SCH_FIELD::MirrorVertically ( int  aCenter)
inlineoverridevirtual

Mirror item vertically about aCenter.

This overload does nothing. Fields are never mirrored alone. They are moved when the parent symbol is mirrored. This function is only needed by the pure function of the master class.

Implements SCH_ITEM.

Definition at line 191 of file sch_field.h.

192 {
193 }

◆ Move()

void SCH_FIELD::Move ( const VECTOR2I aMoveVector)
inlineoverridevirtual

Move the item by aMoveVector to a new position.

Implements SCH_ITEM.

Definition at line 177 of file sch_field.h.

178 {
179 Offset( aMoveVector );
180 }
void Offset(const VECTOR2I &aOffset)
Definition: eda_text.cpp:389

References EDA_TEXT::Offset().

Referenced by GetRenderCache().

◆ Offset()

◆ operator<() [1/2]

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

Test if another item is less than this object.

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

Definition at line 231 of file eda_item.cpp.

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

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

◆ operator<() [2/2]

bool SCH_FIELD::operator< ( const SCH_ITEM aItem) const
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 1092 of file sch_field.cpp.

1093{
1094 if( Type() != aItem.Type() )
1095 return Type() < aItem.Type();
1096
1097 auto field = static_cast<const SCH_FIELD*>( &aItem );
1098
1099 if( GetId() != field->GetId() )
1100 return GetId() < field->GetId();
1101
1102 if( GetText() != field->GetText() )
1103 return GetText() < field->GetText();
1104
1105 if( GetLibPosition().x != field->GetLibPosition().x )
1106 return GetLibPosition().x < field->GetLibPosition().x;
1107
1108 if( GetLibPosition().y != field->GetLibPosition().y )
1109 return GetLibPosition().y < field->GetLibPosition().y;
1110
1111 return GetName() < field->GetName();
1112}
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:50
int GetId() const
Definition: sch_field.h:116
VECTOR2I GetLibPosition() const
Definition: sch_field.h:217

References GetId(), GetLibPosition(), GetName(), EDA_TEXT::GetText(), EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ operator=()

SCH_FIELD & SCH_FIELD::operator= ( const SCH_FIELD aField)

Definition at line 100 of file sch_field.cpp.

101{
102 EDA_TEXT::operator=( aField );
103
104 m_id = aField.m_id;
105 m_name = aField.m_name;
106 m_showName = aField.m_showName;
108
109 m_renderCache.clear();
110
111 for( const std::unique_ptr<KIFONT::GLYPH>& glyph : aField.m_renderCache )
112 {
113 KIFONT::OUTLINE_GLYPH* outline_glyph = static_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() );
114 m_renderCache.emplace_back( std::make_unique<KIFONT::OUTLINE_GLYPH>( *outline_glyph ) );
115 }
116
119
121
122 return *this;
123}
EDA_TEXT & operator=(const EDA_TEXT &aItem)
Definition: eda_text.cpp:136

References m_allowAutoPlace, m_id, m_lastResolvedColor, m_name, m_renderCache, m_renderCachePos, m_renderCacheValid, m_showName, and EDA_TEXT::operator=().

◆ Plot()

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

Plot the schematic item to aPlotter.

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

Reimplemented from SCH_ITEM.

Definition at line 964 of file sch_field.cpp.

965{
966 if( GetShownText().IsEmpty() || aBackground )
967 return;
968
969 RENDER_SETTINGS* settings = aPlotter->RenderSettings();
970 COLOR4D color = settings->GetLayerColor( GetLayer() );
971 int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
972
973 COLOR4D bg = settings->GetBackgroundColor();;
974
975 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
976 bg = COLOR4D::WHITE;
977
978 if( aPlotter->GetColorMode() && GetTextColor() != COLOR4D::UNSPECIFIED )
980
981 penWidth = std::max( penWidth, settings->GetMinPenWidth() );
982
983 if( !IsVisible() )
984 return;
985
986 // Calculate the text orientation, according to the symbol orientation/mirror
987 EDA_ANGLE orient = GetTextAngle();
988 VECTOR2I textpos = GetTextPos();
991
992 if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
993 {
994 SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
995
996 if( parentSymbol->GetDNP() )
997 color = color.Mix( bg, 0.5f );
998
999 if( parentSymbol->GetTransform().y1 ) // Rotate symbol 90 deg.
1000 {
1001 if( orient.IsHorizontal() )
1002 orient = ANGLE_VERTICAL;
1003 else
1004 orient = ANGLE_HORIZONTAL;
1005 }
1006
1007 /*
1008 * Calculate the text justification, according to the symbol orientation/mirror. This is
1009 * a bit complicated due to cumulative calculations:
1010 * - numerous cases (mirrored or not, rotation)
1011 * - the plotter's Text() function will also recalculate H and V justifications according
1012 * to the text orientation
1013 * - when a symbol is mirrored the text is not, and justifications become a nightmare
1014 *
1015 * So the easier way is to use no justifications (centered text) and use GetBoundingBox to
1016 * know the text coordinate considered as centered.
1017 */
1018 hjustify = GR_TEXT_H_ALIGN_CENTER;
1019 vjustify = GR_TEXT_V_ALIGN_CENTER;
1020 textpos = GetBoundingBox().Centre();
1021 }
1022
1023 KIFONT::FONT* font = GetFont();
1024
1025 if( !font )
1026 font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
1027
1028 aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
1029 penWidth, IsItalic(), IsBold(), false, font );
1030
1031 if( IsHypertext() )
1032 {
1033 SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( m_parent );
1034 std::vector<std::pair<wxString, wxString>> pages;
1035 std::vector<wxString> pageHrefs;
1036 BOX2I bbox = GetBoundingBox();
1037
1038 label->GetIntersheetRefs( &pages );
1039
1040 for( const std::pair<wxString, wxString>& page : pages )
1041 pageHrefs.push_back( wxT( "#" ) + page.first );
1042
1043 bbox.Offset( label->GetSchematicTextOffset( settings ) );
1044
1045 aPlotter->HyperlinkMenu( bbox, pageHrefs );
1046 }
1047}
int color
Definition: DXF_plotter.cpp:57
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual const COLOR4D & GetBackgroundColor() const =0
Return current background color settings.
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
virtual void Text(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aPenWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, void *aData=nullptr)
Draw text with the plotter.
Definition: plotter.cpp:714
bool GetColorMode() const
Definition: plotter.h:138
virtual void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
Create a clickable hyperlink menu with a rectangular click area.
Definition: plotter.h:446
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_label.cpp:274
bool GetDNP() const
Definition: sch_symbol.h:730
@ WHITE
Definition: color4d.h:48

References ANGLE_HORIZONTAL, ANGLE_VERTICAL, BOX2< Vec >::Centre(), color, KIGFX::RENDER_SETTINGS::GetBackgroundColor(), GetBoundingBox(), PLOTTER::GetColorMode(), KIGFX::RENDER_SETTINGS::GetDefaultFont(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), SCH_SYMBOL::GetDNP(), EDA_TEXT::GetEffectiveTextPenWidth(), EDA_TEXT::GetFont(), KIFONT::FONT::GetFont(), EDA_TEXT::GetHorizJustify(), SCH_LABEL_BASE::GetIntersheetRefs(), SCH_ITEM::GetLayer(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::RENDER_SETTINGS::GetMinPenWidth(), SCH_LABEL_BASE::GetSchematicTextOffset(), GetShownText(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextColor(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetTextSize(), SCH_SYMBOL::GetTransform(), EDA_TEXT::GetVertJustify(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_CENTER, PLOTTER::HyperlinkMenu(), EDA_TEXT::IsBold(), EDA_ANGLE::IsHorizontal(), IsHypertext(), EDA_TEXT::IsItalic(), EDA_TEXT::IsVisible(), EDA_ITEM::m_parent, BOX2< Vec >::Offset(), PLOTTER::RenderSettings(), SCH_SYMBOL_T, PLOTTER::Text(), EDA_ITEM::Type(), WHITE, and TRANSFORM::y1.

◆ Print() [1/2]

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

Print a schematic item.

Each schematic item should have its own method

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

Implements SCH_ITEM.

Definition at line 334 of file sch_field.cpp.

335{
336 wxDC* DC = aSettings->GetPrintDC();
338 bool blackAndWhiteMode = GetGRForceBlackPenState();
339 VECTOR2I textpos;
340 int penWidth = GetEffectiveTextPenWidth( aSettings->GetDefaultPenWidth() );
341
342 if( ( !IsVisible() && !IsForceVisible() ) || GetShownText().IsEmpty() )
343 return;
344
345 COLOR4D bg = aSettings->GetBackgroundColor();
346
347 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
348 bg = COLOR4D::WHITE;
349
350 if( IsForceVisible() )
351 bg = aSettings->GetLayerColor( LAYER_HIDDEN );
352
353 if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
355
356 // Calculate the text orientation according to the symbol orientation.
357 EDA_ANGLE orient = GetTextAngle();
358
359 if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
360 {
361 SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
362
363 if( parentSymbol && parentSymbol->GetTransform().y1 ) // Rotate symbol 90 degrees.
364 {
365 if( orient == ANGLE_HORIZONTAL )
366 orient = ANGLE_VERTICAL;
367 else
368 orient = ANGLE_HORIZONTAL;
369 }
370
371 if( parentSymbol && parentSymbol->GetDNP() )
372 color = color.Mix( bg, 0.5f );
373 }
374
375 KIFONT::FONT* font = GetFont();
376
377 if( !font )
378 font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
379
380 /*
381 * Calculate the text justification, according to the symbol orientation/mirror.
382 * This is a bit complicated due to cumulative calculations:
383 * - numerous cases (mirrored or not, rotation)
384 * - the GRText function will also recalculate H and V justifications according to the text
385 * orientation.
386 * - When a symbol is mirrored, the text is not mirrored and justifications are complicated
387 * to calculate so the more easily way is to use no justifications (centered text) and use
388 * GetBoundingBox to know the text coordinate considered as centered
389 */
390 textpos = GetBoundingBox().Centre() + aOffset;
391
393 GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(), font );
394}
bool IsForceVisible() const
Definition: eda_item.h:203
wxDC * GetPrintDC() const
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:156
void GRPrintText(wxDC *aDC, const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, KIFONT::FONT *aFont)
Print a graphic text through wxDC.
Definition: gr_text.cpp:129
@ LAYER_HIDDEN
Definition: layer_ids.h:380

References ANGLE_HORIZONTAL, ANGLE_VERTICAL, BOX2< Vec >::Centre(), color, KIGFX::RENDER_SETTINGS::GetBackgroundColor(), GetBoundingBox(), KIGFX::RENDER_SETTINGS::GetDefaultFont(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), SCH_SYMBOL::GetDNP(), EDA_TEXT::GetEffectiveTextPenWidth(), EDA_TEXT::GetFont(), KIFONT::FONT::GetFont(), GetGRForceBlackPenState(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::RENDER_SETTINGS::GetPrintDC(), GetShownText(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextColor(), EDA_TEXT::GetTextSize(), SCH_SYMBOL::GetTransform(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_CENTER, GRPrintText(), EDA_TEXT::IsBold(), EDA_ITEM::IsForceVisible(), EDA_TEXT::IsItalic(), EDA_TEXT::IsVisible(), LAYER_HIDDEN, SCH_ITEM::m_layer, EDA_ITEM::m_parent, SCH_SYMBOL_T, EDA_ITEM::Type(), WHITE, and TRANSFORM::y1.

◆ Print() [2/2]

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

Print this text object to the device context aDC.

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

Definition at line 648 of file eda_text.cpp.

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

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

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

◆ PrintBackground()

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

Print the (optional) backaground elements if they exist.

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

Reimplemented in SCH_SHAPE, and SCH_SYMBOL.

Definition at line 286 of file sch_item.h.

286{};

◆ printOneLineOfText()

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

Print each line of this EDA_TEXT.

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

Definition at line 711 of file eda_text.cpp.

714{
715 wxDC* DC = aSettings->GetPrintDC();
716 int penWidth = GetEffectiveTextPenWidth( aSettings->GetDefaultPenWidth() );
717
718 if( aFillMode == SKETCH )
719 penWidth = -penWidth;
720
721 VECTOR2I size = GetTextSize();
722
723 if( IsMirrored() )
724 size.x = -size.x;
725
726 KIFONT::FONT* font = GetFont();
727
728 if( !font )
729 font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
730
731 GRPrintText( DC, aOffset + aPos, aColor, aText, GetDrawRotation(), size, GetHorizJustify(),
732 GetVertJustify(), penWidth, IsItalic(), IsBold(), font );
733}
@ SKETCH
Definition: outline_mode.h:26

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

Referenced by EDA_TEXT::Print().

◆ RemoveHyperlink()

void EDA_TEXT::RemoveHyperlink ( )
inlineinherited

Definition at line 329 of file eda_text.h.

329{ m_hyperlink = wxEmptyString; }

References EDA_TEXT::m_hyperlink.

◆ RenderAsBitmap()

bool SCH_ITEM::RenderAsBitmap ( double  aWorldScale) const
overridevirtualinherited

Reimplemented from EDA_ITEM.

Definition at line 294 of file sch_item.cpp.

295{
296 if( IsHypertext() )
297 return false;
298
299 if( const EDA_TEXT* text = dynamic_cast<const EDA_TEXT*>( this ) )
300 return text->GetTextHeight() * aWorldScale < BITMAP_FONT_SIZE_THRESHOLD;
301
302 return false;
303}
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
virtual bool IsHypertext() const
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_item.h:239
#define BITMAP_FONT_SIZE_THRESHOLD
Definition: sch_item.cpp:46

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

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

◆ Replace() [1/3]

bool EDA_TEXT::Replace ( const EDA_SEARCH_DATA aSearchData)
inherited

Helper function used in search and replace dialog.

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

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

Definition at line 318 of file eda_text.cpp.

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

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

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

◆ Replace() [2/3]

bool SCH_FIELD::Replace ( const EDA_SEARCH_DATA aSearchData,
void *  aAuxData = nullptr 
)
overridevirtual

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 654 of file sch_field.cpp.

655{
656 bool replaceReferences = false;
657
658 try
659 {
660 const SCH_SEARCH_DATA& schSearchData = dynamic_cast<const SCH_SEARCH_DATA&>( aSearchData );
661 replaceReferences = schSearchData.replaceReferences;
662 }
663 catch( const std::bad_cast& )
664 {
665 }
666
667 wxString text;
668 bool resolve = false; // Replace in source text, not shown text
669 bool isReplaced = false;
670
671 if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
672 {
673 SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
674
675 switch( m_id )
676 {
677 case REFERENCE_FIELD:
678 wxCHECK_MSG( aAuxData, false, wxT( "Need sheetpath to replace in refdes." ) );
679
680 if( !replaceReferences )
681 return false;
682
683 text = parentSymbol->GetRef( (SCH_SHEET_PATH*) aAuxData );
684 isReplaced = EDA_ITEM::Replace( aSearchData, text );
685
686 if( isReplaced )
687 parentSymbol->SetRef( (SCH_SHEET_PATH*) aAuxData, text );
688
689 break;
690
691 case VALUE_FIELD:
692 wxCHECK_MSG( aAuxData, false, wxT( "Need sheetpath to replace in value field." ) );
693
694 text = parentSymbol->GetValueFieldText( resolve );
695 isReplaced = EDA_ITEM::Replace( aSearchData, text );
696
697 if( isReplaced )
698 parentSymbol->SetValueFieldText( text );
699
700 break;
701
702 case FOOTPRINT_FIELD:
703 wxCHECK_MSG( aAuxData, false, wxT( "Need sheetpath to replace in footprint field." ) );
704
705 text = parentSymbol->GetFootprintFieldText( resolve );
706 isReplaced = EDA_ITEM::Replace( aSearchData, text );
707
708 if( isReplaced )
709 parentSymbol->SetFootprintFieldText( text );
710
711 break;
712
713 default:
714 isReplaced = EDA_TEXT::Replace( aSearchData );
715 }
716 }
717 else if( m_parent && m_parent->Type() == SCH_SHEET_T )
718 {
719 isReplaced = EDA_TEXT::Replace( aSearchData );
720
721 if( m_id == SHEETFILENAME && isReplaced )
722 {
723 // If we allowed this we'd have a bunch of work to do here, including warning
724 // about it not being undoable, checking for recursive hierarchies, reloading
725 // sheets, etc. See DIALOG_SHEET_PROPERTIES::TransferDataFromWindow().
726 }
727 }
728 else
729 {
730 isReplaced = EDA_TEXT::Replace( aSearchData );
731 }
732
733 return isReplaced;
734}
bool Replace(const EDA_SEARCH_DATA &aSearchData)
Helper function used in search and replace dialog.
Definition: eda_text.cpp:318
void SetValueFieldText(const wxString &aValue)
Definition: sch_symbol.cpp:767
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
Definition: sch_symbol.cpp:666
const wxString GetFootprintFieldText(bool aResolve) const
Definition: sch_symbol.cpp:773
void SetFootprintFieldText(const wxString &aFootprint)
Definition: sch_symbol.cpp:782
const wxString GetValueFieldText(bool aResolve) const
Definition: sch_symbol.cpp:758

References FOOTPRINT_FIELD, SCH_SYMBOL::GetFootprintFieldText(), SCH_SYMBOL::GetRef(), SCH_SYMBOL::GetValueFieldText(), m_id, EDA_ITEM::m_parent, REFERENCE_FIELD, EDA_TEXT::Replace(), EDA_ITEM::Replace(), SCH_SEARCH_DATA::replaceReferences, SCH_SHEET_T, SCH_SYMBOL_T, SCH_SYMBOL::SetFootprintFieldText(), SCH_SYMBOL::SetRef(), SCH_SYMBOL::SetValueFieldText(), SHEETFILENAME, text, EDA_ITEM::Type(), and VALUE_FIELD.

◆ Replace() [3/3]

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

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

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

Definition at line 168 of file eda_item.cpp.

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

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

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

◆ Rotate()

void SCH_FIELD::Rotate ( const VECTOR2I aCenter)
overridevirtual

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

Implements SCH_ITEM.

Definition at line 737 of file sch_field.cpp.

738{
739 VECTOR2I pt = GetPosition();
740 RotatePoint( pt, aCenter, ANGLE_90 );
741 SetPosition( pt );
742}
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_field.cpp:1050
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:414

References ANGLE_90, GetPosition(), RotatePoint(), and SetPosition().

Referenced by SCH_EDIT_TOOL::Rotate().

◆ RunOnChildren()

virtual void SCH_ITEM::RunOnChildren ( const std::function< void(SCH_ITEM *)> &  aFunction)
inlinevirtualinherited

◆ Schematic()

SCHEMATIC * SCH_ITEM::Schematic ( ) const
inherited

Searches the item hierarchy to find a SCHEMATIC.

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

Every SCH_SCREEN should be parented to the SCHEMATIC.

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

Definition at line 112 of file sch_item.cpp.

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

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

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

◆ Set() [1/3]

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

Definition at line 66 of file inspectable.h.

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

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