KiCad PCB EDA Suite
DS_DRAW_ITEM_TEXT Class Reference

A graphic text. More...

#include <ds_draw_item.h>

Inheritance diagram for DS_DRAW_ITEM_TEXT:
DS_DRAW_ITEM_BASE EDA_TEXT EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Member Functions

 DS_DRAW_ITEM_TEXT (DS_DATA_ITEM *aPeer, int aIndex, wxString &aText, wxPoint aPos, wxSize aSize, int aPenWidth, bool aItalic=false, bool aBold=false)
 
virtual wxString GetClass () const override
 Return the class name. More...
 
void PrintWsItem (const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
 
void SetTextAngle (double aAngle) override
 
wxPoint GetPosition () const override
 
void SetPosition (const wxPoint &aPos) override
 
const EDA_RECT GetBoundingBox () const override
 Return the orthogonal bounding box of this object for display purposes. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Test if aPosition is contained within or on the bounding box of an item. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
 Test if aRect intersects or is contained within the bounding box of an item. More...
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
DS_DATA_ITEMGetPeer () const
 
int GetIndexInPeer () const
 
void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
virtual void SetEnd (wxPoint aPos)
 
virtual int GetPenWidth () const
 
virtual void PrintWsItem (const RENDER_SETTINGS *aSettings)
 
void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, MSG_PANEL_ITEMS &aList) override
 
virtual void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
 Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. 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
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, bool state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag) const
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Check whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual const wxPoint GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual EDA_ITEMClone () const
 Create a duplicate of this item with linked list members set to NULL. More...
 
virtual SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual BITMAPS GetMenuImage () const
 Return a pointer to an image to be used in menus. More...
 
virtual bool Matches (const wxFindReplaceData &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const wxFindReplaceData &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw the parts of the object belonging to layer aLayer. More...
 
virtual double ViewGetLOD (int aLayer, VIEW *aView) const
 Return the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 
virtual const wxString & GetText () const
 Return the string associated with the text object. More...
 
virtual wxString GetShownText (int aDepth=0) const
 Return the string actually shown after processing of the base text. More...
 
wxString GetShownText (bool *processTextVars) const
 A version of GetShownText() which also indicates whether or not the text needs to be processed for text variables. More...
 
wxString ShortenedShownText () const
 Returns a shortened version (max 15 characters) of the shown text. More...
 
virtual void SetText (const wxString &aText)
 
void SetTextThickness (int aWidth)
 The TextThickness is that set by the user. More...
 
int GetTextThickness () const
 
int GetEffectiveTextPenWidth (int aDefaultWidth=0) const
 The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth. More...
 
double GetTextAngle () const
 
double GetTextAngleDegrees () const
 
double GetTextAngleRadians () const
 
void SetItalic (bool isItalic)
 
bool IsItalic () const
 
void SetBold (bool aBold)
 
bool IsBold () const
 
void SetVisible (bool aVisible)
 
bool IsVisible () const
 
void SetMirrored (bool isMirrored)
 
bool IsMirrored () const
 
void SetMultilineAllowed (bool aAllow)
 
bool IsMultilineAllowed () const
 
EDA_TEXT_HJUSTIFY_T GetHorizJustify () const
 
EDA_TEXT_VJUSTIFY_T GetVertJustify () const
 
void SetHorizJustify (EDA_TEXT_HJUSTIFY_T aType)
 
void SetVertJustify (EDA_TEXT_VJUSTIFY_T aType)
 
void SetEffects (const EDA_TEXT &aSrc)
 Set the text effects from another instance. More...
 
void SwapEffects (EDA_TEXT &aTradingPartner)
 Swap the text effects of the two involved instances. More...
 
void SwapText (EDA_TEXT &aTradingPartner)
 
void CopyText (const EDA_TEXT &aSrc)
 
bool Replace (const wxFindReplaceData &aSearchData)
 Helper function used in search and replace dialog. More...
 
bool IsDefaultFormatting () const
 
void SetTextSize (const wxSize &aNewSize)
 
const wxSize & GetTextSize () const
 
void SetTextWidth (int aWidth)
 
int GetTextWidth () const
 
void SetTextHeight (int aHeight)
 
int GetTextHeight () const
 
void SetTextPos (const wxPoint &aPoint)
 
const wxPoint & GetTextPos () const
 
void SetTextX (int aX)
 
void SetTextY (int aY)
 
void Offset (const wxPoint &aOffset)
 
void Empty ()
 
void Print (const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, COLOR4D aColor, OUTLINE_MODE aDisplay_mode=FILLED)
 Print this text object to the device context aDC. More...
 
std::vector< wxPoint > TransformToSegmentList () const
 Convert the text shape to a list of segment. More...
 
void TransformBoundingBoxWithClearanceToPolygon (SHAPE_POLY_SET *aCornerBuffer, int aClearanceValue) const
 Convert the text bounding box to a rectangular polygon depending on the text orientation, the bounding box is not always horizontal or vertical. More...
 
std::shared_ptr< SHAPE_COMPOUNDGetEffectiveTextShape () const
 
virtual bool TextHitTest (const wxPoint &aPoint, int aAccuracy=0) const
 Test if aPoint is within the bounds of this object. More...
 
virtual bool TextHitTest (const EDA_RECT &aRect, bool aContains, int aAccuracy=0) const
 Test if object bounding box is contained within or intersects aRect. More...
 
int LenSize (const wxString &aLine, int aThickness) const
 
EDA_RECT GetTextBox (int aLine=-1, bool aInvertY=false) const
 Useful in multiline texts to calculate the full text or a line area (for zones filling, locate functions....) More...
 
int GetInterline () const
 Return the distance between two lines of text. More...
 
wxString GetTextStyleName () const
 
void GetLinePositions (std::vector< wxPoint > &aPositions, int aLineCount) const
 Populate aPositions with the position of each line of a multiline text, according to the vertical justification and the rotation of the whole text. More...
 
virtual void Format (OUTPUTFORMATTER *aFormatter, int aNestLevel, int aControlBits) const
 Output the object to aFormatter in s-expression form. More...
 
virtual double GetDrawRotation () const
 

Static Public Member Functions

template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const wxFindReplaceData &aSearchData, wxString &aText)
 Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 
static EDA_TEXT_HJUSTIFY_T MapHorizJustify (int aHorizJustify)
 
static EDA_TEXT_VJUSTIFY_T MapVertJustify (int aVertJustify)
 

Public Attributes

const KIID m_Uuid
 

Protected Member Functions

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

Protected Attributes

DS_DATA_ITEMm_peer
 
int m_index
 
int m_penWidth
 
STATUS_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
STATUS_FLAGS m_flags
 

Detailed Description

A graphic text.

It is derived from an EDA_TEXT, so it handle all characteristics of this graphic text (justification, rotation ... ).

Definition at line 297 of file ds_draw_item.h.

Constructor & Destructor Documentation

◆ DS_DRAW_ITEM_TEXT()

DS_DRAW_ITEM_TEXT::DS_DRAW_ITEM_TEXT ( DS_DATA_ITEM aPeer,
int  aIndex,
wxString &  aText,
wxPoint  aPos,
wxSize  aSize,
int  aPenWidth,
bool  aItalic = false,
bool  aBold = false 
)
inline

Definition at line 300 of file ds_draw_item.h.

302  :
303  DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_TEXT_T),
304  EDA_TEXT( aText )
305  {
306  SetTextPos( aPos );
307  SetTextSize( aSize );
308  SetTextThickness( aPenWidth );
309  SetItalic( aItalic );
310  SetBold( aBold );
311  }
EDA_TEXT(const wxString &text=wxEmptyString)
Definition: eda_text.cpp:91
void SetItalic(bool isItalic)
Definition: eda_text.h:186
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:253
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:244
DS_DRAW_ITEM_BASE(DS_DATA_ITEM *aPeer, int aIndex, KICAD_T aType)
Definition: ds_draw_item.h:103
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.h:166
void SetBold(bool aBold)
Definition: eda_text.h:189

References EDA_TEXT::SetBold(), EDA_TEXT::SetItalic(), EDA_TEXT::SetTextPos(), EDA_TEXT::SetTextSize(), and EDA_TEXT::SetTextThickness().

Member Function Documentation

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 204 of file eda_item.h.

204 { m_flags &= ~aMask; }
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References EDA_ITEM::m_flags.

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

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 216 of file eda_item.h.

217  {
219  DO_NOT_DRAW );
220  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: eda_item.h:115
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: eda_item.h:104
#define CANDIDATE
flag indicating that the structure is connected
Definition: eda_item.h:117
#define DO_NOT_DRAW
Used to disable draw function.
Definition: eda_item.h:119
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: eda_item.h:112
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:204
#define ENDPOINT
ends. (Used to support dragging.)
Definition: eda_item.h:113
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: eda_item.h:118

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 148 of file view_item.h.

149  {
150  m_viewPrivData = nullptr;
151  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:156

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * EDA_ITEM::Clone ( ) const
virtualinherited

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 in FP_ZONE, ZONE, SCH_COMPONENT, PAD, FOOTPRINT, SCH_HIERLABEL, CENTER_DIMENSION, LEADER, ORTHOGONAL_DIMENSION, VIA, SCH_GLOBALLABEL, SCH_SHEET, SCH_LABEL, ALIGNED_DIMENSION, PCB_SHAPE, ARC, SCH_TEXT, SCH_LINE, LIB_PIN, FP_TEXT, TRACK, SCH_BUS_BUS_ENTRY, SCH_FIELD, LIB_FIELD, SCH_SHEET_PIN, SCH_BUS_WIRE_ENTRY, FP_SHAPE, SCH_BITMAP, PCB_TEXT, PCB_GROUP, LIB_ARC, LIB_TEXT, SCH_NO_CONNECT, SCH_JUNCTION, SCH_MARKER, LIB_POLYLINE, PCB_TARGET, LIB_CIRCLE, LIB_BEZIER, LIB_RECTANGLE, and KIGFX::ORIGIN_VIEWITEM.

Definition at line 81 of file eda_item.cpp.

82 {
83  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
84  wxT( ". Bad programmer!" ) );
85 }
#define NULL
virtual wxString GetClass() const =0
Return the class name.

References EDA_ITEM::GetClass(), and NULL.

Referenced by DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), DIMENSION_BASE::GetEffectiveShape(), LIB_PART::LIB_PART(), new_clone(), LIB_PART::operator=(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), LIB_PART::SetConversion(), LIB_PART::SetUnitCount(), SCH_DRAWING_TOOLS::SingleClickPlace(), COMMIT::Stage(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ CopyText()

void EDA_TEXT::CopyText ( const EDA_TEXT aSrc)
inherited

Definition at line 129 of file eda_text.cpp.

130 {
131  m_text = aSrc.m_text;
132  m_shown_text = aSrc.m_shown_text;
134 }
wxString m_shown_text
Definition: eda_text.h:390
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:391
wxString m_text
Definition: eda_text.h:389

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

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

◆ Empty()

void EDA_TEXT::Empty ( )
inlineinherited

Definition at line 261 of file eda_text.h.

261 { m_text.Empty(); }
wxString m_text
Definition: eda_text.h:389

References EDA_TEXT::m_text.

Referenced by SCH_LEGACY_PLUGIN_CACHE::LoadPart().

◆ Format()

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

Output the object to aFormatter in s-expression form.

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

Definition at line 516 of file eda_text.cpp.

517 {
518 #ifndef GERBVIEW // Gerbview does not use EDA_TEXT::Format
519  // and does not define FormatInternalUnits, used here
520  // however this function should exist
521 
522  aFormatter->Print( aNestLevel + 1, "(effects" );
523 
524  // Text size
525  aFormatter->Print( 0, " (font" );
526 
527  aFormatter->Print( 0, " (size %s %s)",
528  FormatInternalUnits( GetTextHeight() ).c_str(),
529  FormatInternalUnits( GetTextWidth() ).c_str() );
530 
531  if( GetTextThickness() )
532  aFormatter->Print( 0, " (thickness %s)", FormatInternalUnits( GetTextThickness() ).c_str() );
533 
534  if( IsBold() )
535  aFormatter->Print( 0, " bold" );
536 
537  if( IsItalic() )
538  aFormatter->Print( 0, " italic" );
539 
540  aFormatter->Print( 0, ")"); // (font
541 
542  if( IsMirrored() ||
545  {
546  aFormatter->Print( 0, " (justify");
547 
549  aFormatter->Print( 0, (GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" );
550 
552  aFormatter->Print( 0, (GetVertJustify() == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" );
553 
554  if( IsMirrored() )
555  aFormatter->Print( 0, " mirror" );
556  aFormatter->Print( 0, ")" ); // (justify
557  }
558 
559  if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() )
560  aFormatter->Print( 0, " hide" );
561 
562  aFormatter->Print( 0, ")\n" ); // (justify
563 
564 #endif
565 }
bool IsBold() const
Definition: eda_text.h:190
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
bool IsMirrored() const
Definition: eda_text.h:196
bool IsVisible() const
Definition: eda_text.h:193
int GetTextThickness() const
Definition: eda_text.h:167
int GetTextHeight() const
Definition: eda_text.h:251
bool IsItalic() const
Definition: eda_text.h:187
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
int GetTextWidth() const
Definition: eda_text.h:248
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:408
#define CTL_OMIT_HIDE
Definition: eda_text.h:56
std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from internal units to a string appropriate for writing ...
Definition: base_units.cpp:471

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

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

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

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

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

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

◆ Get() [2/3]

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

Definition at line 95 of file inspectable.h.

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

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

◆ Get() [3/3]

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

Definition at line 104 of file inspectable.h.

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

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

◆ GetBoundingBox()

const EDA_RECT DS_DRAW_ITEM_TEXT::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.

Implements DS_DRAW_ITEM_BASE.

Definition at line 167 of file ds_draw_item.cpp.

168 {
169  return EDA_TEXT::GetTextBox();
170 }
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:223

References EDA_TEXT::GetTextBox().

◆ GetClass()

virtual wxString DS_DRAW_ITEM_TEXT::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 313 of file ds_draw_item.h.

313 { return wxT( "DS_DRAW_ITEM_TEXT" ); }

◆ GetDrawRotation()

double EDA_TEXT::GetDrawRotation ( ) const
virtualinherited

Reimplemented in FP_TEXT.

Definition at line 633 of file eda_text.cpp.

634 {
635  return GetTextAngle();
636 }
double GetTextAngle() const
Definition: eda_text.h:181

References EDA_TEXT::GetTextAngle().

Referenced by EDA_TEXT::TransformToSegmentList().

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 208 of file eda_item.h.

209  {
210  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
212 
213  return m_flags & mask;
214  }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:108
#define STRUCT_DELETED
flag indication structures to be erased
Definition: eda_item.h:116
#define IS_MOVED
Item being moved.
Definition: eda_item.h:106
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:109
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: eda_item.h:120
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:111
STATUS_FLAGS m_flags
Definition: eda_item.h:531
#define IS_NEW
New item, just created.
Definition: eda_item.h:107

References IS_DRAGGED, IS_MOVED, IS_NEW, IS_PASTED, IS_RESIZED, IS_WIRE_IMAGE, EDA_ITEM::m_flags, and STRUCT_DELETED.

Referenced by EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_COMPONENT::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveTextPenWidth()

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

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

Definition at line 157 of file eda_text.cpp.

158 {
159  int width = GetTextThickness();
160 
161  if( width <= 1 )
162  {
163  width = aDefaultWidth;
164 
165  if( IsBold() )
166  width = GetPenSizeForBold( GetTextWidth() );
167  else if( width <= 1 )
168  width = GetPenSizeForNormal( GetTextWidth() );
169  }
170 
171  // Clip pen size for small texts:
173 
174  return width;
175 }
bool IsBold() const
Definition: eda_text.h:190
int GetPenSizeForBold(int aTextSize)
Function GetPensizeForBold.
Definition: gr_text.cpp:48
int GetTextThickness() const
Definition: eda_text.h:167
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Function Clamp_Text_PenSize Don't allow text to become cluttered up in its own fatness.
Definition: gr_text.cpp:69
const wxSize & GetTextSize() const
Definition: eda_text.h:245
int GetPenSizeForNormal(int aTextSize)
Definition: gr_text.cpp:54
#define ALLOW_BOLD_THICKNESS
Definition: base_units.h:57
int GetTextWidth() const
Definition: eda_text.h:248

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

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

◆ GetEffectiveTextShape()

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

Definition at line 620 of file eda_text.cpp.

621 {
622  std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
623  int penWidth = GetEffectiveTextPenWidth();
624  std::vector<wxPoint> pts = TransformToSegmentList();
625 
626  for( unsigned jj = 0; jj < pts.size(); jj += 2 )
627  shape->AddShape( new SHAPE_SEGMENT( pts[jj], pts[jj+1], penWidth ) );
628 
629  return shape;
630 }
std::vector< wxPoint > TransformToSegmentList() const
Convert the text shape to a list of segment.
Definition: eda_text.cpp:580
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:157

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

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

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

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

Reimplemented in BOARD, PCB_SHAPE, and TRACK.

Definition at line 309 of file eda_item.h.

309 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: eda_item.h:302

References EDA_ITEM::GetPosition().

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

◆ GetHorizJustify()

EDA_TEXT_HJUSTIFY_T EDA_TEXT::GetHorizJustify ( ) const
inlineinherited

Definition at line 205 of file eda_text.h.

205 { return EDA_TEXT_HJUSTIFY_T( m_e.hjustify ); };
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:61
TEXT_EFFECTS m_e
Definition: eda_text.h:393
signed char hjustify
horizontal justification
Definition: eda_text.h:101

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

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

◆ GetIndexInPeer()

int DS_DRAW_ITEM_BASE::GetIndexInPeer ( ) const
inlineinherited

Definition at line 64 of file ds_draw_item.h.

64 { return m_index; }

References DS_DRAW_ITEM_BASE::m_index.

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

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

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

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

◆ GetLinePositions()

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

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

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

Definition at line 420 of file eda_text.cpp.

421 {
422  wxPoint pos = GetTextPos(); // Position of first line of the
423  // multiline text according to
424  // the center of the multiline text block
425 
426  wxPoint offset; // Offset to next line.
427 
428  offset.y = GetInterline();
429 
430  if( aLineCount > 1 )
431  {
432  switch( GetVertJustify() )
433  {
435  break;
436 
438  pos.y -= ( aLineCount - 1 ) * offset.y / 2;
439  break;
440 
442  pos.y -= ( aLineCount - 1 ) * offset.y;
443  break;
444  }
445  }
446 
447  // Rotate the position of the first line
448  // around the center of the multiline text block
449  RotatePoint( &pos, GetTextPos(), GetTextAngle() );
450 
451  // Rotate the offset lines to increase happened in the right direction
452  RotatePoint( &offset, GetTextAngle() );
453 
454  for( int ii = 0; ii < aLineCount; ii++ )
455  {
456  aPositions.push_back( pos );
457  pos += offset;
458  }
459 }
int GetInterline() const
Return the distance between two lines of text.
Definition: eda_text.cpp:217
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
double GetTextAngle() const
Definition: eda_text.h:181
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
const wxPoint & GetTextPos() const
Definition: eda_text.h:254

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

Referenced by BOARD_ADAPTER::addShapeWithClearance(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotPcbText(), EDA_TEXT::Print(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), and EDA_TEXT::TransformToSegmentList().

◆ GetMenuImage()

BITMAPS EDA_ITEM::GetMenuImage ( ) const
virtualinherited

◆ GetMsgPanelInfo() [1/2]

void DS_DRAW_ITEM_BASE::GetMsgPanelInfo ( EDA_DRAW_FRAME aFrame,
MSG_PANEL_ITEMS aList 
)
overrideinherited

Definition at line 101 of file ds_draw_item.cpp.

102 {
103  wxString msg;
104  DS_DATA_ITEM* dataItem = GetPeer();
105 
106  if( dataItem == nullptr ) // Is only a pure graphic item used in drawing sheet editor to
107  // handle the page limits
108  return;
109 
110  switch( dataItem->GetType() )
111  {
113  aList.push_back( MSG_PANEL_ITEM( _( "Line" ), msg ) );
114  break;
115 
117  aList.push_back( MSG_PANEL_ITEM( _( "Rectangle" ), msg ) );
118  break;
119 
121  msg = static_cast<DS_DRAW_ITEM_TEXT*>( this )->GetShownText();
122  aList.push_back( MSG_PANEL_ITEM( _( "Text" ), msg ) );
123  break;
124 
126  aList.push_back( MSG_PANEL_ITEM( _( "Imported Shape" ), msg ) );
127  break;
128 
130  aList.push_back( MSG_PANEL_ITEM( _( "Image" ), msg ) );
131  break;
132  }
133 
134  switch( dataItem->GetPage1Option() )
135  {
136  case FIRST_PAGE_ONLY: msg = _( "First Page Only" ); break;
137  case SUBSEQUENT_PAGES: msg = _( "Subsequent Pages" ); break;
138  default: msg = _( "All Pages" ); break;
139  }
140 
141  aList.push_back( MSG_PANEL_ITEM( _( "First Page Option" ), msg ) );
142 
144  aList.push_back( MSG_PANEL_ITEM( _( "Repeat Count" ), msg ) );
145 
147  aList.push_back( MSG_PANEL_ITEM( _( "Repeat Label Increment" ), msg ) );
148 
149  msg.Printf( wxT( "(%s, %s)" ),
150  MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.x ),
151  MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.y ) );
152 
153  aList.push_back( MSG_PANEL_ITEM( _( "Repeat Position Increment" ), msg ) );
154 
155  aList.push_back( MSG_PANEL_ITEM( _( "Comment" ), dataItem->m_Info ) );
156 }
wxString m_Info
Definition: ds_data_item.h:208
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:90
DPOINT m_IncrementVector
Definition: ds_data_item.h:213
DS_ITEM_TYPE GetType() const
Definition: ds_data_item.h:129
int m_IncrementLabel
Definition: ds_data_item.h:215
DS_DATA_ITEM * GetPeer() const
Definition: ds_draw_item.h:63
Drawing sheet structure type definitions.
Definition: ds_data_item.h:95
#define _(s)
Definition: 3d_actions.cpp:33
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:54
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
PAGE_OPTION GetPage1Option() const
Definition: ds_data_item.h:134

References _, DS_DATA_ITEM::DS_BITMAP, DS_DATA_ITEM::DS_POLYPOLYGON, DS_DATA_ITEM::DS_RECT, DS_DATA_ITEM::DS_SEGMENT, DS_DATA_ITEM::DS_TEXT, FIRST_PAGE_ONLY, DS_DATA_ITEM::GetPage1Option(), DS_DRAW_ITEM_BASE::GetPeer(), DS_DATA_ITEM::GetType(), EDA_BASE_FRAME::GetUserUnits(), DS_DATA_ITEM::m_IncrementLabel, DS_DATA_ITEM::m_IncrementVector, DS_DATA_ITEM::m_Info, DS_DATA_ITEM::m_RepeatCount, MessageTextFromValue(), SUBSEQUENT_PAGES, UNSCALED, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ GetMsgPanelInfo() [2/2]

◆ GetParent()

◆ GetPeer()

◆ GetPenWidth()

virtual int DS_DRAW_ITEM_BASE::GetPenWidth ( ) const
inlinevirtualinherited

◆ GetPosition()

wxPoint DS_DRAW_ITEM_TEXT::GetPosition ( ) const
inlineoverridevirtual

Reimplemented from EDA_ITEM.

Definition at line 319 of file ds_draw_item.h.

319 { return GetTextPos(); }
const wxPoint & GetTextPos() const
Definition: eda_text.h:254

References EDA_TEXT::GetTextPos().

◆ GetSelectMenuText()

wxString DS_DRAW_ITEM_TEXT::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 185 of file ds_draw_item.cpp.

186 {
187  return wxString::Format( _( "Text '%s'" ),
188  GetShownText() );
189 }
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
#define _(s)
Definition: 3d_actions.cpp:33
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:141

References _, Format(), and EDA_TEXT::GetShownText().

◆ GetShownText() [1/2]

virtual wxString EDA_TEXT::GetShownText ( int  aDepth = 0) const
inlinevirtualinherited

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

Parameters
aDepthis used to prevent infinite recursions and loops when expanding text variables.

Reimplemented in FP_TEXT, SCH_TEXT, SCH_FIELD, and PCB_TEXT.

Definition at line 141 of file eda_text.h.

141 { return m_shown_text; }
wxString m_shown_text
Definition: eda_text.h:390

References EDA_TEXT::m_shown_text.

Referenced by KIGFX::DS_PAINTER::draw(), LIB_FIELD::GetMsgPanelInfo(), GetSelectMenuText(), PCB_TEXT::GetShownText(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), FP_TEXT::GetShownText(), EDA_TEXT::GetTextBox(), LIB_FIELD::Plot(), LIB_PART::PlotLibFields(), LIB_TEXT::print(), EDA_TEXT::Print(), EDA_TEXT::ShortenedShownText(), and EDA_TEXT::TransformToSegmentList().

◆ GetShownText() [2/2]

wxString EDA_TEXT::GetShownText ( bool *  processTextVars) const
inlineinherited

A version of GetShownText() which also indicates whether or not the text needs to be processed for text variables.

Parameters
processTextVars[out]

Definition at line 149 of file eda_text.h.

150  {
151  *processTextVars = m_shown_text_has_text_var_refs;
152  return m_shown_text;
153  }
wxString m_shown_text
Definition: eda_text.h:390
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:391

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

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 187 of file eda_item.h.

188  {
189  return m_status & type;
190  }
STATUS_FLAGS m_status
Definition: eda_item.h:528

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 200 of file eda_item.h.

200 { return m_status; }
STATUS_FLAGS m_status
Definition: eda_item.h:528

References EDA_ITEM::m_status.

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

133 { return m_text; }
wxString m_text
Definition: eda_text.h:389

References EDA_TEXT::m_text.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), SCH_EAGLE_PLUGIN::addImplicitConnections(), NETLIST_EXPORTER_XML::addSymbolFields(), SIM_PLOT_FRAME::AddTuner(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), CONNECTION_GRAPH::buildConnectionGraph(), LIB_TEXT::Clone(), LIB_TEXT::compare(), LIB_FIELD::compare(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), KIGFX::SCH_VIEW::DisplayComponent(), SYMBOL_EDIT_FRAME::DisplaySymbolDatasheet(), SCH_FIELD::DoHypertextMenu(), KIGFX::SCH_PAINTER::draw(), SCH_EDIT_TOOL::Duplicate(), EDA_TEXT_DESC::EDA_TEXT_DESC(), CONNECTION_GRAPH::ercCheckHierSheets(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), LIB_PART::Flatten(), PCB_IO::format(), FormatProbeItem(), SCH_COMPONENT::GetFootprint(), LIB_FIELD::GetFullText(), FOOTPRINT_INFO_GENERATOR::GetHtmlFieldRow(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadNet(), FP_TEXT::GetLength(), getMatchingTextItem(), PCB_TEXT::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_COMPONENT::GetRef(), LIB_PART::GetSearchText(), DIMENSION_BASE::GetText(), SCH_COMPONENT::GetValue(), LIB_FIELD::HitTest(), SCH_DRAWING_TOOLS::importHierLabel(), SCH_TEXT::IncrementLabel(), GENERAL_COLLECTOR::Inspect(), SCH_FIELD::IsVoid(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EAGLE_PLUGIN::loadSchematic(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_EAGLE_PLUGIN::loadSegments(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), SCH_FIELD::operator<(), SCH_TEXT::operator<(), LIB_FIELD::operator=(), SCH_SEXPR_PARSER::parseSchematicSymbol(), SCH_EDITOR_CONTROL::Paste(), DRAWING_TOOL::PlaceText(), LIB_TEXT::Plot(), LIB_FIELD::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), DIALOG_RESCUE_EACH::PopulateInstanceList(), LIB_FIELD::print(), DIALOG_CHANGE_SYMBOLS::processSymbol(), processTextItem(), SCH_EDIT_FRAME::RecomputeIntersheetRefs(), SCH_GLOBALLABEL::ResolveTextVar(), SCH_LEGACY_PLUGIN::saveComponent(), SCH_SEXPR_PLUGIN::saveField(), SCH_LEGACY_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_LEGACY_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SYMBOL_VIEWER_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), EE_INSPECTION_TOOL::ShowDatasheet(), SCH_SHEET::SymbolCount(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow(), DIALOG_LIB_EDIT_TEXT::TransferDataToWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), TUNER_SLIDER::TUNER_SLIDER(), and FP_TEXT::ViewGetLOD().

◆ GetTextAngle()

double EDA_TEXT::GetTextAngle ( ) const
inlineinherited

Definition at line 181 of file eda_text.h.

181 { return m_e.angle; }
TEXT_EFFECTS m_e
Definition: eda_text.h:393
double angle
now: 0.1 degrees; future: degrees
Definition: eda_text.h:105

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

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

◆ GetTextAngleDegrees()

double EDA_TEXT::GetTextAngleDegrees ( ) const
inlineinherited

◆ GetTextAngleRadians()

double EDA_TEXT::GetTextAngleRadians ( ) const
inlineinherited

◆ GetTextBox()

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

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

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

Definition at line 223 of file eda_text.cpp.

224 {
225  EDA_RECT rect;
226  wxArrayString strings;
227  wxString text = GetShownText();
228  int thickness = GetEffectiveTextPenWidth();
229  int linecount = 1;
230  bool hasOverBar = false; // true if the first line of text as an overbar
231 
232  if( IsMultilineAllowed() )
233  {
234  wxStringSplit( text, strings, '\n' );
235 
236  if( strings.GetCount() ) // GetCount() == 0 for void strings
237  {
238  if( aLine >= 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
239  text = strings.Item( aLine );
240  else
241  text = strings.Item( 0 );
242 
243  linecount = strings.GetCount();
244  }
245  }
246 
247  // Search for overbar symbol. Only text is scanned,
248  // because only this line can change the bounding box
249  for( unsigned ii = 1; ii < text.size(); ii++ )
250  {
251  if( text[ii-1] == '~' && text[ii] != '~' )
252  {
253  hasOverBar = true;
254  break;
255  }
256  }
257 
258  // calculate the H and V size
259  const auto& font = basic_gal.GetStrokeFont();
260  VECTOR2D fontSize( GetTextSize() );
261  double penWidth( thickness );
262  int dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
263  int dy = GetInterline();
264 
265  // Creates bounding box (rectangle) for horizontal, left and top justified text. The
266  // bounding box will be moved later according to the actual text options
267  wxSize textsize = wxSize( dx, dy );
268  wxPoint pos = GetTextPos();
269 
270  if( IsMultilineAllowed() && aLine > 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
271  {
272  pos.y -= aLine * GetInterline();
273  }
274 
275  if( aInvertY )
276  pos.y = -pos.y;
277 
278  rect.SetOrigin( pos );
279 
280  if( hasOverBar )
281  { // A overbar adds an extra size to the text
282  // Height from the base line text of chars like [ or {
283  double curr_height = GetTextHeight() * 1.15;
284  double overbarPosition = font.ComputeOverbarVerticalPosition( fontSize.y );
285  int extra_height = KiROUND( overbarPosition - curr_height );
286 
287  extra_height += thickness / 2;
288  textsize.y += extra_height;
289  rect.Move( wxPoint( 0, -extra_height ) );
290  }
291 
292  // for multiline texts and aLine < 0, merge all rectangles
293  // ( if aLine < 0, we want the full text bounding box )
294  if( IsMultilineAllowed() && aLine < 0 )
295  {
296  for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
297  {
298  text = strings.Item( ii );
299  dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
300  textsize.x = std::max( textsize.x, dx );
301  textsize.y += dy;
302  }
303  }
304 
305  rect.SetSize( textsize );
306 
307  /* Now, calculate the rect origin, according to text justification
308  * At this point the rectangle origin is the text origin (m_Pos).
309  * This is true only for left and top text justified texts (using top to bottom Y axis
310  * orientation). and must be recalculated for others justifications
311  * also, note the V justification is relative to the first line
312  */
313  switch( GetHorizJustify() )
314  {
316  if( IsMirrored() )
317  rect.SetX( rect.GetX() - rect.GetWidth() );
318  break;
319 
321  rect.SetX( rect.GetX() - (rect.GetWidth() / 2) );
322  break;
323 
325  if( !IsMirrored() )
326  rect.SetX( rect.GetX() - rect.GetWidth() );
327  break;
328  }
329 
330  switch( GetVertJustify() )
331  {
333  break;
334 
336  rect.SetY( rect.GetY() - ( dy / 2) );
337  break;
338 
340  rect.SetY( rect.GetY() - dy );
341  break;
342  }
343 
344  if( linecount > 1 )
345  {
346  int yoffset;
347  linecount -= 1;
348 
349  switch( GetVertJustify() )
350  {
352  break;
353 
355  yoffset = linecount * GetInterline() / 2;
356  rect.SetY( rect.GetY() - yoffset );
357  break;
358 
360  yoffset = linecount * GetInterline();
361  rect.SetY( rect.GetY() - yoffset );
362  break;
363  }
364  }
365 
366  rect.Normalize(); // Make h and v sizes always >= 0
367 
368  return rect;
369 }
const STROKE_FONT & GetStrokeFont() const
int GetInterline() const
Return the distance between two lines of text.
Definition: eda_text.cpp:217
void Move(const wxPoint &aMoveVector)
Move the rectangle by the aMoveVector.
Definition: eda_rect.cpp:51
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
bool IsMirrored() const
Definition: eda_text.h:196
int GetX() const
Definition: eda_rect.h:103
int GetWidth() const
Definition: eda_rect.h:114
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:126
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:157
int GetTextHeight() const
Definition: eda_text.h:251
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
const wxSize & GetTextSize() const
Definition: eda_text.h:245
void SetX(int val)
Definition: eda_rect.h:163
bool IsMultilineAllowed() const
Definition: eda_text.h:203
void SetY(int val)
Definition: eda_rect.h:169
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
Definition: string.cpp:827
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
void SetSize(const wxSize &size)
Definition: eda_rect.h:139
Handle the component boundary box.
Definition: eda_rect.h:42
int GetY() const
Definition: eda_rect.h:104
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:68
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
BASIC_GAL basic_gal(basic_displayOptions)
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:141

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

Referenced by LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), FP_TEXT::GetBoundingBox(), DIMENSION_BASE::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), GetBoundingBox(), SCH_LABEL::GetBoundingBox(), LIB_TEXT::HitTest(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), LIB_TEXT::NormalizeJustification(), FP_TEXT::TextHitTest(), EDA_TEXT::TextHitTest(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), ALIGNED_DIMENSION::updateGeometry(), ORTHOGONAL_DIMENSION::updateGeometry(), LEADER::updateGeometry(), and FP_TEXT::ViewBBox().

◆ GetTextHeight()

◆ GetTextPos()

const wxPoint& EDA_TEXT::GetTextPos ( ) const
inlineinherited

Definition at line 254 of file eda_text.h.

254 { return m_e.pos; }
TEXT_EFFECTS m_e
Definition: eda_text.h:393
wxPoint pos
Definition: eda_text.h:106

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

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

◆ GetTextSize()

◆ GetTextStyleName()

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

Definition at line 481 of file eda_text.cpp.

482 {
483  int style = 0;
484 
485  if( IsItalic() )
486  style = 1;
487 
488  if( IsBold() )
489  style += 2;
490 
491  wxString stylemsg[4] = {
492  _("Normal"),
493  _("Italic"),
494  _("Bold"),
495  _("Bold+Italic")
496  };
497 
498  return stylemsg[style];
499 }
bool IsBold() const
Definition: eda_text.h:190
bool IsItalic() const
Definition: eda_text.h:187
#define _(s)
Definition: 3d_actions.cpp:33

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

Referenced by LIB_FIELD::GetMsgPanelInfo().

◆ GetTextThickness()

◆ GetTextWidth()

◆ GetVertJustify()

◆ HasFlag()

◆ HitTest() [1/2]

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

Test if aPosition is contained within or on the bounding box of an item.

Parameters
aPositionA reference to a wxPoint 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 DS_DRAW_ITEM_BASE.

Definition at line 173 of file ds_draw_item.cpp.

174 {
175  return EDA_TEXT::TextHitTest( aPosition, aAccuracy );
176 }
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:372

References EDA_TEXT::TextHitTest().

◆ HitTest() [2/2]

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

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

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

Reimplemented from DS_DRAW_ITEM_BASE.

Definition at line 179 of file ds_draw_item.cpp.

180 {
181  return EDA_TEXT::TextHitTest( aRect, aContains, aAccuracy );
182 }
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:372

References EDA_TEXT::TextHitTest().

◆ IsBold()

◆ IsBrightened()

◆ IsDefaultFormatting()

bool EDA_TEXT::IsDefaultFormatting ( ) const
inherited

Definition at line 502 of file eda_text.cpp.

503 {
504  return ( IsVisible()
505  && !IsMirrored()
508  && GetTextThickness() == 0
509  && !IsItalic()
510  && !IsBold()
511  && !IsMultilineAllowed()
512  );
513 }
bool IsBold() const
Definition: eda_text.h:190
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
bool IsMirrored() const
Definition: eda_text.h:196
bool IsVisible() const
Definition: eda_text.h:193
int GetTextThickness() const
Definition: eda_text.h:167
bool IsItalic() const
Definition: eda_text.h:187
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
bool IsMultilineAllowed() const
Definition: eda_text.h:203

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

Referenced by SCH_SEXPR_PLUGIN::saveField().

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 171 of file eda_item.h.

171 { return m_flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:109
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_DRAGGED, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 174 of file eda_item.h.

174 { return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered
Definition: eda_item.h:138
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 256 of file eda_item.h.

256 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:530

References EDA_ITEM::m_forceVisible.

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

◆ IsItalic()

◆ IsMirrored()

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 168 of file eda_item.h.

168 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
Definition: eda_item.h:103
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsMultilineAllowed()

◆ IsNew()

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

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 in SCH_COMPONENT, SCH_LABEL, SCH_SHEET, SCH_TEXT, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 453 of file eda_item.h.

453 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 175 of file eda_item.h.

175 { return m_flags & IS_RESIZED; }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:108
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_RESIZED, and EDA_ITEM::m_flags.

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 173 of file eda_item.h.

173 { return m_flags & SELECTED; }
#define SELECTED
Definition: eda_item.h:114
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_LEGACY::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), and GERBVIEW_SELECTION_TOOL::unselect().

◆ IsType()

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

Check whether the item is one of the listed types.

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

Reimplemented in VIA, SCH_LABEL, DIMENSION_BASE, PAD, PCB_SHAPE, SCH_FIELD, FP_TEXT, SCH_LINE, FP_SHAPE, and PCB_TEXT.

Definition at line 233 of file eda_item.h.

234  {
235  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
236  return true;
237 
238  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
239  {
240  if( m_structType == *p )
241  return true;
242  }
243 
244  return false;
245  }
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:538

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

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

◆ IsVisible()

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 172 of file eda_item.h.

172 { return m_flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:111
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

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

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

Definition at line 345 of file eda_item.h.

349  {
350  for( auto it : aList )
351  {
352  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
354  return SEARCH_RESULT::QUIT;
355  }
356 
358  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

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

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

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

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

Definition at line 364 of file eda_item.h.

366  {
367  for( auto it : aList )
368  {
369  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
371  return SEARCH_RESULT::QUIT;
372  }
373 
375  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

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

◆ LenSize()

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

Definition at line 188 of file eda_text.cpp.

189 {
192  basic_gal.SetFontUnderlined( false );
193  basic_gal.SetLineWidth( (float) aThickness );
195 
196  VECTOR2D tsize = basic_gal.GetTextLineSize( aLine );
197 
198  return KiROUND( tsize.x );
199 }
bool IsBold() const
Definition: eda_text.h:190
VECTOR2D GetTextLineSize(const UTF8 &aText) const
Compute the X and Y size of a given text.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
bool IsItalic() const
Definition: eda_text.h:187
void SetFontBold(const bool aBold)
Set bold property of current font.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
const wxSize & GetTextSize() const
Definition: eda_text.h:245
void SetFontItalic(bool aItalic)
Set italic property of current font.
void SetGlyphSize(const VECTOR2D aSize)
Set the font glyph size.
void SetFontUnderlined(bool aUnderlined)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
BASIC_GAL basic_gal(basic_displayOptions)

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

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

◆ MapHorizJustify()

EDA_TEXT_HJUSTIFY_T EDA_TEXT::MapHorizJustify ( int  aHorizJustify)
staticinherited

Definition at line 63 of file eda_text.cpp.

64 {
65  wxASSERT( aHorizJustify >= GR_TEXT_HJUSTIFY_LEFT && aHorizJustify <= GR_TEXT_HJUSTIFY_RIGHT );
66 
67  if( aHorizJustify > GR_TEXT_HJUSTIFY_RIGHT )
69 
70  if( aHorizJustify < GR_TEXT_HJUSTIFY_LEFT )
71  return GR_TEXT_HJUSTIFY_LEFT;
72 
73  return static_cast<EDA_TEXT_HJUSTIFY_T>( aHorizJustify );
74 }

References GR_TEXT_HJUSTIFY_LEFT, and GR_TEXT_HJUSTIFY_RIGHT.

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), and DIALOG_EDIT_ONE_FIELD::updateText().

◆ MapVertJustify()

EDA_TEXT_VJUSTIFY_T EDA_TEXT::MapVertJustify ( int  aVertJustify)
staticinherited

Definition at line 77 of file eda_text.cpp.

78 {
79  wxASSERT( aVertJustify >= GR_TEXT_VJUSTIFY_TOP && aVertJustify <= GR_TEXT_VJUSTIFY_BOTTOM );
80 
81  if( aVertJustify > GR_TEXT_VJUSTIFY_BOTTOM )
83 
84  if( aVertJustify < GR_TEXT_VJUSTIFY_TOP )
85  return GR_TEXT_VJUSTIFY_TOP;
86 
87  return static_cast<EDA_TEXT_VJUSTIFY_T>( aVertJustify );
88 }

References GR_TEXT_VJUSTIFY_BOTTOM, and GR_TEXT_VJUSTIFY_TOP.

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), and DIALOG_EDIT_ONE_FIELD::updateText().

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( const wxFindReplaceData &  aSearchData,
void *  aAuxData 
) const
inlinevirtualinherited

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 in SCH_COMPONENT, SCH_SHEET, SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, ZONE, SCH_PIN, SCH_MARKER, PCB_MARKER, FP_TEXT, and PCB_TEXT.

Definition at line 415 of file eda_item.h.

416  {
417  return false;
418  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), PCB_TEXT::Matches(), FP_TEXT::Matches(), PCB_MARKER::Matches(), SCH_MARKER::Matches(), SCH_PIN::Matches(), ZONE::Matches(), SCH_SHEET_PIN::Matches(), SCH_FIELD::Matches(), SCH_TEXT::Matches(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Matches() [2/2]

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

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 116 of file eda_item.cpp.

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

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

◆ Offset()

◆ operator<()

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 169 of file eda_item.cpp.

170 {
171  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
172  GetClass() ) );
173 
174  return false;
175 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
virtual wxString GetClass() const =0
Return the class name.

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

◆ Print()

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

399 {
400  if( IsMultilineAllowed() )
401  {
402  std::vector<wxPoint> positions;
403  wxArrayString strings;
404  wxStringSplit( GetShownText(), strings, '\n' );
405 
406  positions.reserve( strings.Count() );
407 
408  GetLinePositions( positions, strings.Count() );
409 
410  for( unsigned ii = 0; ii < strings.Count(); ii++ )
411  printOneLineOfText( aSettings, aOffset, aColor, aFillMode, strings[ii], positions[ii] );
412  }
413  else
414  {
415  printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetTextPos() );
416  }
417 }
bool IsMultilineAllowed() const
Definition: eda_text.h:203
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
Definition: string.cpp:827
void printOneLineOfText(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, COLOR4D aColor, OUTLINE_MODE aFillMode, const wxString &aText, const wxPoint &aPos)
Print each line of this EDA_TEXT.
Definition: eda_text.cpp:461
void GetLinePositions(std::vector< wxPoint > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
Definition: eda_text.cpp:420
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:141

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

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

◆ PrintWsItem() [1/2]

virtual void DS_DRAW_ITEM_BASE::PrintWsItem ( const RENDER_SETTINGS aSettings)
inlinevirtualinherited

Definition at line 79 of file ds_draw_item.h.

80  {
81  PrintWsItem( aSettings, wxPoint( 0, 0 ) );
82  }
virtual void PrintWsItem(const RENDER_SETTINGS *aSettings)
Definition: ds_draw_item.h:79

◆ PrintWsItem() [2/2]

void DS_DRAW_ITEM_TEXT::PrintWsItem ( const RENDER_SETTINGS aSettings,
const wxPoint &  aOffset 
)
overridevirtual

Implements DS_DRAW_ITEM_BASE.

Definition at line 161 of file ds_draw_item.cpp.

162 {
163  Print( aSettings, aOffset, aSettings->GetLayerColor( LAYER_DRAWINGSHEET ), FILLED );
164 }
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, COLOR4D aColor, OUTLINE_MODE aDisplay_mode=FILLED)
Print this text object to the device context aDC.
Definition: eda_text.cpp:397
drawingsheet frame and titleblock

References FILLED, KIGFX::RENDER_SETTINGS::GetLayerColor(), LAYER_DRAWINGSHEET, and EDA_TEXT::Print().

◆ Replace() [1/3]

bool EDA_TEXT::Replace ( const wxFindReplaceData &  aSearchData)
inherited

Helper function used in search and replace dialog.

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

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

Definition at line 178 of file eda_text.cpp.

179 {
180  bool retval = EDA_ITEM::Replace( aSearchData, m_text );
182  m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
183 
184  return retval;
185 }
wxString m_shown_text
Definition: eda_text.h:390
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:391
wxString m_text
Definition: eda_text.h:389
static bool Replace(const wxFindReplaceData &aSearchData, wxString &aText)
Perform a text replace on aText using the find and replace criteria in aSearchData on items that supp...
Definition: eda_item.cpp:143
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:151

References EDA_TEXT::m_shown_text, EDA_TEXT::m_shown_text_has_text_var_refs, EDA_TEXT::m_text, EDA_ITEM::Replace(), and UnescapeString().

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

◆ Replace() [2/3]

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

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

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

Definition at line 143 of file eda_item.cpp.

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

References traceFindReplace.

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

◆ Replace() [3/3]

virtual bool EDA_ITEM::Replace ( const wxFindReplaceData &  aSearchData,
void *  aAuxData = nullptr 
)
inlinevirtualinherited

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 in SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, and SCH_PIN.

Definition at line 442 of file eda_item.h.

443  {
444  return false;
445  }

◆ Set() [1/3]

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

Definition at line 42 of file inspectable.h.

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

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

Referenced by isCoupledDiffPair().

◆ Set() [2/3]

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

Definition at line 55 of file inspectable.h.

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

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

◆ Set() [3/3]

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

Definition at line 68 of file inspectable.h.

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

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

◆ SetBold()

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

◆ SetEffects()

void EDA_TEXT::SetEffects ( const EDA_TEXT aSrc)
inherited

Set the text effects from another instance.

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

Definition at line 137 of file eda_text.cpp.

138 {
139  m_e = aSrc.m_e;
140 }
TEXT_EFFECTS m_e
Definition: eda_text.h:393

References EDA_TEXT::m_e.

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

◆ SetEnd()

virtual void DS_DRAW_ITEM_BASE::SetEnd ( wxPoint  aPos)
inlinevirtualinherited

Reimplemented in DS_DRAW_ITEM_RECT, and DS_DRAW_ITEM_LINE.

Definition at line 68 of file ds_draw_item.h.

68 { /* not all types will need this */ }

◆ SetFlags()

void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 203 of file eda_item.h.

203 { m_flags |= aMask; }
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References EDA_ITEM::m_flags.

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

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible.

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

Definition at line 254 of file eda_item.h.

254 { m_forceVisible = aEnable; }
bool m_forceVisible
Definition: eda_item.h:530

References EDA_ITEM::m_forceVisible.

Referenced by SCH_EDITOR_CONTROL::UpdateFind().

◆ SetHorizJustify()

void EDA_TEXT::SetHorizJustify ( EDA_TEXT_HJUSTIFY_T  aType)
inlineinherited

Definition at line 208 of file eda_text.h.

208 { m_e.hjustify = aType; };
TEXT_EFFECTS m_e
Definition: eda_text.h:393
signed char hjustify
horizontal justification
Definition: eda_text.h:101

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

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

◆ SetItalic()

◆ SetMirrored()

◆ SetModified()

void EDA_ITEM::SetModified ( )
inherited

◆ SetMultilineAllowed()

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

Definition at line 202 of file eda_text.h.

202 { m_e.Bit( TE_MULTILINE, aAllow ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:393
void Bit(int aBit, bool aValue)
Definition: eda_text.h:108

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

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

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in DIMENSION_BASE.

Definition at line 166 of file eda_item.h.

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

References EDA_ITEM::m_parent.

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

◆ SetPosition()

void DS_DRAW_ITEM_TEXT::SetPosition ( const wxPoint &  aPos)
inlineoverridevirtual

Reimplemented from EDA_ITEM.

Definition at line 320 of file ds_draw_item.h.

320 { SetTextPos( aPos ); }
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:253

References EDA_TEXT::SetTextPos().

◆ SetSelected()

◆ SetState()

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

Definition at line 192 of file eda_item.h.

193  {
194  if( state )
195  m_status |= type; // state = ON or OFF
196  else
197  m_status &= ~type;
198  }
STATUS_FLAGS m_status
Definition: eda_item.h:528

References EDA_ITEM::m_status.

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

◆ SetStatus()

void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited

Definition at line 201 of file eda_item.h.

201 { m_status = aStatus; }
STATUS_FLAGS m_status
Definition: eda_item.h:528

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetText()

void EDA_TEXT::SetText ( const wxString &  aText)
virtualinherited

Definition at line 121 of file eda_text.cpp.

122 {
123  m_text = aText;
124  m_shown_text = UnescapeString( aText );
125  m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
126 }
wxString m_shown_text
Definition: eda_text.h:390
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:391
wxString m_text
Definition: eda_text.h:389
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:151

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

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), SCH_EAGLE_PLUGIN::addImplicitConnections(), GRAPHICS_IMPORTER_PCBNEW::AddText(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), LIB_TEXT::Clone(), createBoard(), PCB_BASE_FRAME::CreateNewFootprint(), SYMBOL_EDIT_FRAME::CreateNewPart(), PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawSpecificationStackup(), SCH_EDIT_TOOL::Duplicate(), FOOTPRINT::DuplicateItem(), EDA_TEXT_DESC::EDA_TEXT_DESC(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), LIB_FIELD::HitTest(), SCH_TEXT::IncrementLabel(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), CADSTAR_SCH_ARCHIVE_LOADER::loadBusses(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), SCH_LEGACY_PLUGIN::loadComponent(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), SCH_LEGACY_PLUGIN_CACHE::loadField(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), FABMASTER::loadFootprints(), SCH_EAGLE_PLUGIN::loadFrame(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), SCH_EAGLE_PLUGIN::loadLibrary(), LEGACY_PLUGIN::loadMODULE_TEXT(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), SCH_LEGACY_PLUGIN_CACHE::LoadPart(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_EAGLE_PLUGIN::loadSheet(), SCH_LEGACY_PLUGIN::loadSheet(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), TUNER_SLIDER::onSave(), DIALOG_SHEET_PROPERTIES::OnUpdateUI(), LIB_FIELD::operator=(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_ALTIUM_PLUGIN::ParseFileName(), SCH_ALTIUM_PLUGIN::ParseParameter(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), SCH_ALTIUM_PLUGIN::ParseSheetEntry(), SCH_ALTIUM_PLUGIN::ParseSheetName(), ALTIUM_PCB::ParseTexts6Data(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), LIB_PART::PlotLibFields(), DIALOG_CHANGE_SYMBOLS::processSymbol(), processTextItem(), SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields(), CLIPBOARD_IO::SaveSelection(), SCH_COMPONENT::SCH_COMPONENT(), LIB_PART::SetName(), SCH_COMPONENT::SetRef(), DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_SPICE_MODEL::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_LIB_EDIT_ONE_FIELD::UpdateField(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), SCH_COMPONENT::UpdateFields(), SCH_SHEET_LIST::UpdateSymbolInstances(), and DIMENSION_BASE::updateText().

◆ SetTextAngle()

void DS_DRAW_ITEM_TEXT::SetTextAngle ( double  aAngle)
overridevirtual

Reimplemented from EDA_TEXT.

Definition at line 192 of file ds_draw_item.cpp.

193 {
195 }
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:174
T NormalizeAngle360Min(T Angle)
Normalize angle to be > -360.0 and < 360.0 Angle equal to -360 or +360 are set to 0.
Definition: trigo.h:254

References NormalizeAngle360Min(), and EDA_TEXT::SetTextAngle().

◆ SetTextHeight()

void EDA_TEXT::SetTextHeight ( int  aHeight)
inlineinherited

◆ SetTextPos()

void EDA_TEXT::SetTextPos ( const wxPoint &  aPoint)
inlineinherited

Definition at line 253 of file eda_text.h.

253 { m_e.pos = aPoint; }
TEXT_EFFECTS m_e
Definition: eda_text.h:393
wxPoint pos
Definition: eda_text.h:106

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

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), GRAPHICS_IMPORTER_PCBNEW::AddText(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), CADSTAR_SCH_ARCHIVE_LOADER::applyToLibraryFieldAttribute(), SCH_GLOBALLABEL::AutoplaceFields(), LIB_TEXT::BeginEdit(), LIB_FIELD::BeginEdit(), LIB_FIELD::CalcEdit(), LIB_TEXT::CalcEdit(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawSpecificationStackup(), DS_DRAW_ITEM_TEXT(), FP_TEXT::FP_TEXT(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), SCH_LEGACY_PLUGIN::loadComponent(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), DIMENSION_BASE::Mirror(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MoveTo(), LIB_FIELD::MoveTo(), LIB_TEXT::NormalizeJustification(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseSchText(), DRAWING_TOOL::PlaceText(), DIALOG_CHANGE_SYMBOLS::processSymbol(), PCB_TEXT::Rotate(), LIB_TEXT::Rotate(), FP_TEXT::Rotate(), LIB_FIELD::Rotate(), DIMENSION_BASE::Rotate(), SCH_TEXT::Rotate(), SCH_GLOBALLABEL::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_FIELD::SCH_FIELD(), SCH_SHEET_PIN::SCH_SHEET_PIN(), SCH_TEXT::SCH_TEXT(), FP_TEXT::SetDrawCoord(), PCB_TEXT::SetPosition(), FP_TEXT::SetPosition(), SCH_FIELD::SetPosition(), SCH_TEXT::SetPosition(), SetPosition(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), SCH_COMPONENT::UpdateFields(), DIALOG_EDIT_ONE_FIELD::updateText(), ALIGNED_DIMENSION::updateText(), and ORTHOGONAL_DIMENSION::updateText().

◆ SetTextSize()

void EDA_TEXT::SetTextSize ( const wxSize &  aNewSize)
inlineinherited

Definition at line 244 of file eda_text.h.

244 { m_e.size = aNewSize; }
TEXT_EFFECTS m_e
Definition: eda_text.h:393
wxSize size
Definition: eda_text.h:103

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

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), SCH_EAGLE_PLUGIN::addImplicitConnections(), CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings(), SCH_EDIT_TOOL::ChangeTextType(), MICROWAVE_TOOL::createBaseFootprint(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawSpecificationStackup(), DS_DRAW_ITEM_TEXT(), EDA_TEXT::EDA_TEXT(), ALTIUM_PCB::HelperParseDimensions6Linear(), LIB_TEXT::LIB_TEXT(), SCH_LEGACY_PLUGIN::loadComponent(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), SCH_EAGLE_PLUGIN::loadFrame(), LEGACY_PLUGIN::loadMODULE_TEXT(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_LEGACY_PLUGIN::loadSheet(), SCH_EAGLE_PLUGIN::loadTextAttributes(), DIALOG_LIB_SYMBOL_PROPERTIES::OnAddField(), DIALOG_SYMBOL_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), ALTIUM_PCB::ParseTexts6Data(), DRAWING_TOOL::PlaceText(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BACK_ANNOTATE::processNetNameChange(), DIMENSION_BASE::SetTextSize(), PCAD2KICAD::SetTextSizeFromStrokeFontHeight(), PCAD2KICAD::SetTextSizeFromTrueTypeFontHeight(), DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), SCH_GLOBALLABEL::UpdateIntersheetRefProps(), and DIALOG_EDIT_ONE_FIELD::updateText().

◆ SetTextThickness()

void EDA_TEXT::SetTextThickness ( int  aWidth)
inlineinherited

The TextThickness is that set by the user.

The EffectiveTextPenWidth also factors in bold text and thickness clamping.

Definition at line 166 of file eda_text.h.

166 { m_e.penwidth = aWidth; };
TEXT_EFFECTS m_e
Definition: eda_text.h:393
int penwidth
Definition: eda_text.h:104

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

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), GRAPHICS_IMPORTER_PCBNEW::AddText(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), SCH_EDIT_TOOL::ChangeTextType(), MICROWAVE_TOOL::createBaseFootprint(), PCB_BASE_FRAME::CreateNewFootprint(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawSpecificationStackup(), DS_DRAW_ITEM_TEXT(), EDA_TEXT_DESC::EDA_TEXT_DESC(), FP_TEXT::FP_TEXT(), ALTIUM_PCB::HelperParseDimensions6Linear(), CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), SCH_EAGLE_PLUGIN::loadTextAttributes(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), ALTIUM_PCB::ParseTexts6Data(), DRAWING_TOOL::PlaceText(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), LIB_TEXT::SetWidth(), LIB_FIELD::SetWidth(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and SCH_GLOBALLABEL::UpdateIntersheetRefProps().

◆ SetTextWidth()

void EDA_TEXT::SetTextWidth ( int  aWidth)
inlineinherited

◆ SetTextX()

◆ SetTextY()

◆ SetVertJustify()

void EDA_TEXT::SetVertJustify ( EDA_TEXT_VJUSTIFY_T  aType)
inlineinherited

◆ SetVisible()

void EDA_TEXT::SetVisible ( bool  aVisible)
inlineinherited

Definition at line 192 of file eda_text.h.

192 { m_e.Bit( TE_VISIBLE, aVisible ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:393
void Bit(int aBit, bool aValue)
Definition: eda_text.h:108

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

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), SCH_EDITOR_CONTROL::AssignFootprints(), PCB_BASE_FRAME::CreateNewFootprint(), EDA_TEXT_DESC::EDA_TEXT_DESC(), LIB_FIELD::Init(), CADSTAR_SCH_ARCHIVE_LOADER::loadBusses(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), SCH_LEGACY_PLUGIN::loadComponent(), EAGLE_PLUGIN::loadElements(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), FABMASTER::loadFootprints(), SCH_EAGLE_PLUGIN::loadInstance(), SCH_EAGLE_PLUGIN::loadLibrary(), LEGACY_PLUGIN::loadMODULE_TEXT(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), SCH_LEGACY_PLUGIN_CACHE::LoadPart(), EAGLE_PLUGIN::loadPlain(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), ALTIUM_PCB::ParseComponents6Data(), SCH_ALTIUM_PLUGIN::ParseDesignator(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParseFileName(), SCH_ALTIUM_PLUGIN::ParseParameter(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), SCH_ALTIUM_PLUGIN::ParseSheetName(), SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_CHANGE_SYMBOLS::processSymbol(), processTextItem(), SCH_EDIT_FRAME::RecomputeIntersheetRefs(), SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields(), SCH_FIELD::SCH_FIELD(), SCH_EDIT_FRAME::ShowAllIntersheetRefs(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow(), and DIALOG_EDIT_ONE_FIELD::updateText().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 178 of file eda_item.h.

178 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:203
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:111

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ ShortenedShownText()

wxString EDA_TEXT::ShortenedShownText ( ) const
inherited

Returns a shortened version (max 15 characters) of the shown text.

Definition at line 202 of file eda_text.cpp.

203 {
204  wxString tmp = GetShownText();
205 
206  tmp.Replace( wxT( "\n" ), wxT( " " ) );
207  tmp.Replace( wxT( "\r" ), wxT( " " ) );
208  tmp.Replace( wxT( "\t" ), wxT( " " ) );
209 
210  if( tmp.Length() > 36 )
211  tmp = tmp.Left( 34 ) + wxT( "..." );
212 
213  return tmp;
214 }
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:141

References EDA_TEXT::GetShownText().

Referenced by LIB_TEXT::GetSelectMenuText(), PCB_TEXT::GetSelectMenuText(), SCH_SHEET_PIN::GetSelectMenuText(), SCH_FIELD::GetSelectMenuText(), LIB_FIELD::GetSelectMenuText(), FP_TEXT::GetSelectMenuText(), SCH_TEXT::GetSelectMenuText(), SCH_LABEL::GetSelectMenuText(), SCH_GLOBALLABEL::GetSelectMenuText(), and SCH_HIERLABEL::GetSelectMenuText().

◆ Sort()

static bool EDA_ITEM::Sort ( const EDA_ITEM aLeft,
const EDA_ITEM aRight 
)
inlinestaticinherited

Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers.

Parameters
aLeftThe left hand item to compare.
aRightThe right hand item to compare.
Returns
True if aLeft is less than aRight.

Definition at line 471 of file eda_item.h.

471 { return *aLeft < *aRight; }

◆ SwapEffects()

void EDA_TEXT::SwapEffects ( EDA_TEXT aTradingPartner)
inherited

Swap the text effects of the two involved instances.

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

Definition at line 151 of file eda_text.cpp.

152 {
153  std::swap( m_e, aTradingPartner.m_e );
154 }
TEXT_EFFECTS m_e
Definition: eda_text.h:393

References EDA_TEXT::m_e.

Referenced by SCH_FIELD::SwapData(), SCH_TEXT::SwapData(), and FP_TEXT::SwapEffects().

◆ SwapText()

void EDA_TEXT::SwapText ( EDA_TEXT aTradingPartner)
inherited

Definition at line 143 of file eda_text.cpp.

144 {
145  std::swap( m_text, aTradingPartner.m_text );
146  std::swap( m_shown_text, aTradingPartner.m_shown_text );
148 }
wxString m_shown_text
Definition: eda_text.h:390
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:391
wxString m_text
Definition: eda_text.h:389

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

Referenced by SCH_FIELD::SwapData(), and SCH_TEXT::SwapData().

◆ TextHitTest() [1/2]

bool EDA_TEXT::TextHitTest ( const wxPoint &  aPoint,
int  aAccuracy = 0 
) const
virtualinherited

Test if aPoint is within the bounds of this object.

Parameters
aPointA wxPoint to test.
aAccuracyAmount to inflate the bounding box.
Returns
true if a hit, else false.

Reimplemented in FP_TEXT.

Definition at line 372 of file eda_text.cpp.

373 {
374  EDA_RECT rect = GetTextBox();
375  wxPoint location = aPoint;
376 
377  rect.Inflate( aAccuracy );
378  RotatePoint( &location, GetTextPos(), -GetTextAngle() );
379 
380  return rect.Contains( location );
381 }
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:223
double GetTextAngle() const
Definition: eda_text.h:181
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
Handle the component boundary box.
Definition: eda_rect.h:42
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363

References EDA_RECT::Contains(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextBox(), EDA_TEXT::GetTextPos(), EDA_RECT::Inflate(), and RotatePoint().

Referenced by LIB_TEXT::HitTest(), PCB_TEXT::HitTest(), LIB_FIELD::HitTest(), DIMENSION_BASE::HitTest(), and HitTest().

◆ TextHitTest() [2/2]

bool EDA_TEXT::TextHitTest ( const EDA_RECT aRect,
bool  aContains,
int  aAccuracy = 0 
) const
virtualinherited

Test if object bounding box is contained within or intersects aRect.

Parameters
aRectRect to test against.
aContainsTest for containment instead of intersection if true.
aAccuracyAmount to inflate the bounding box.
Returns
true if a hit, else false.

Reimplemented in FP_TEXT.

Definition at line 384 of file eda_text.cpp.

385 {
386  EDA_RECT rect = aRect;
387 
388  rect.Inflate( aAccuracy );
389 
390  if( aContains )
391  return rect.Contains( GetTextBox() );
392 
393  return rect.Intersects( GetTextBox(), GetTextAngle() );
394 }
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:223
double GetTextAngle() const
Definition: eda_text.h:181
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
Handle the component boundary box.
Definition: eda_rect.h:42
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363

References EDA_RECT::Contains(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextBox(), EDA_RECT::Inflate(), and EDA_RECT::Intersects().

◆ TransformBoundingBoxWithClearanceToPolygon()

void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon ( SHAPE_POLY_SET aCornerBuffer,
int  aClearanceValue 
) const
inherited

Convert the text bounding box to a rectangular polygon depending on the text orientation, the bounding box is not always horizontal or vertical.

Used in filling zones calculations Circles and arcs are approximated by segments

Parameters
aCornerBuffera buffer to store the polygon.
aClearanceValuethe clearance around the text bounding box to the real clearance value (usually near from 1.0).

Definition at line 353 of file board_items_to_polygon_shape_transform.cpp.

355 {
356  if( GetText().Length() == 0 )
357  return;
358 
359  wxPoint corners[4]; // Buffer of polygon corners
360 
361  EDA_RECT rect = GetTextBox();
362  rect.Inflate( aClearanceValue + Millimeter2iu( DEFAULT_TEXT_WIDTH ) );
363  corners[0].x = rect.GetOrigin().x;
364  corners[0].y = rect.GetOrigin().y;
365  corners[1].y = corners[0].y;
366  corners[1].x = rect.GetRight();
367  corners[2].x = corners[1].x;
368  corners[2].y = rect.GetBottom();
369  corners[3].y = corners[2].y;
370  corners[3].x = corners[0].x;
371 
372  aCornerBuffer->NewOutline();
373 
374  for( wxPoint& corner : corners )
375  {
376  // Rotate polygon
377  RotatePoint( &corner.x, &corner.y, GetTextPos().x, GetTextPos().y, GetTextAngle() );
378  aCornerBuffer->Append( corner.x, corner.y );
379  }
380 }
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:223
double GetTextAngle() const
Definition: eda_text.h:181
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
int GetBottom() const
Definition: eda_rect.h:119
#define DEFAULT_TEXT_WIDTH
const wxPoint GetOrigin() const
Definition: eda_rect.h:106
int GetRight() const
Definition: eda_rect.h:116
int NewOutline()
Creates a new hole in a given outline.
Handle the component boundary box.
Definition: eda_rect.h:42
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
static constexpr int Millimeter2iu(double mm)
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...

References SHAPE_POLY_SET::Append(), DEFAULT_TEXT_WIDTH, EDA_RECT::GetBottom(), EDA_RECT::GetOrigin(), EDA_RECT::GetRight(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextBox(), EDA_TEXT::GetTextPos(), EDA_RECT::Inflate(), Millimeter2iu(), SHAPE_POLY_SET::NewOutline(), and RotatePoint().

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

◆ TransformToSegmentList()

std::vector< wxPoint > EDA_TEXT::TransformToSegmentList ( ) const
inherited

Convert the text shape to a list of segment.

Each segment is stored as 2 wxPoints: the starting point and the ending point there are therefore 2*n points.

Definition at line 580 of file eda_text.cpp.

581 {
582  std::vector<wxPoint> cornerBuffer;
583  wxSize size = GetTextSize();
584 
585  if( IsMirrored() )
586  size.x = -size.x;
587 
588  bool forceBold = true;
589  int penWidth = 0; // use max-width for bold text
590 
591  COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by GRText
592 
593  if( IsMultilineAllowed() )
594  {
595  wxArrayString strings_list;
596  wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
597  std::vector<wxPoint> positions;
598  positions.reserve( strings_list.Count() );
599  GetLinePositions( positions, strings_list.Count() );
600 
601  for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
602  {
603  wxString txt = strings_list.Item( ii );
604  GRText( NULL, positions[ii], color, txt, GetDrawRotation(), size, GetHorizJustify(),
605  GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
606  &cornerBuffer );
607  }
608  }
609  else
610  {
612  GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), forceBold,
613  addTextSegmToBuffer, &cornerBuffer );
614  }
615 
616  return cornerBuffer;
617 }
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
bool IsMirrored() const
Definition: eda_text.h:196
int color
Definition: DXF_plotter.cpp:60
static void addTextSegmToBuffer(int x0, int y0, int xf, int yf, void *aData)
Definition: eda_text.cpp:572
virtual double GetDrawRotation() const
Definition: eda_text.cpp:633
Definition: color4d.h:44
bool IsItalic() const
Definition: eda_text.h:187
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
#define NULL
const wxSize & GetTextSize() const
Definition: eda_text.h:245
bool IsMultilineAllowed() const
Definition: eda_text.h:203
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
Definition: string.cpp:827
void GRText(wxDC *aDC, const wxPoint &aPos, COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Function GRText Draw a graphic text (like footprint texts)
Definition: gr_text.cpp:131
void GetLinePositions(std::vector< wxPoint > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
Definition: eda_text.cpp:420
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:141
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

References addTextSegmToBuffer(), BLACK, color, EDA_TEXT::GetDrawRotation(), EDA_TEXT::GetHorizJustify(), EDA_TEXT::GetLinePositions(), EDA_TEXT::GetShownText(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetVertJustify(), GRText(), EDA_TEXT::IsItalic(), EDA_TEXT::IsMirrored(), EDA_TEXT::IsMultilineAllowed(), NULL, and wxStringSplit().

Referenced by EDA_TEXT::GetEffectiveTextShape(), and PNS_KICAD_IFACE_BASE::syncTextItem().

◆ Type()

KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Returns the type of object.

This attribute should never be changed after a ctor sets it, so there is no public "setter" method.

Returns
the type of object.

Definition at line 163 of file eda_item.h.

163 { return m_structType; }
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:538

References EDA_ITEM::m_structType.

Referenced by KIGFX::PCB_VIEW::Add(), FOOTPRINT::Add(), CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), CN_CLUSTER::Add(), PCB_POINT_EDITOR::addCorner(), CONNECTION_SUBGRAPH::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), ZONE_FILLER::addKnockout(), SCH_SHEET::AddPin(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CN_ITEM::AnchorCount(), SCH_SCREEN::Append(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), PNS::TOPOLOGY::AssembleTuningPath(), CONNECTION_GRAPH::buildConnectionGraph(), DIALOG_NET_INSPECTOR::buildNewItem(), SCH_SCREENS::buildScreenList(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), PCB_POINT_EDITOR::canAddCorner(), SCH_JUNCTION::CanConnect(), SCH_NO_CONNECT::CanConnect(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_LINE::CanConnect(), SCH_SHEET::CanConnect(), SCH_LABEL::CanConnect(), SCH_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_COMPONENT::CanConnect(), CN_VISITOR::checkZoneItemConnection(), SCH_MARKER::ClassOf(), SCH_JUNCTION::ClassOf(), SCH_PIN::ClassOf(), PCB_TEXT::ClassOf(), PCB_MARKER::ClassOf(), SCH_NO_CONNECT::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), FP_SHAPE::ClassOf(), SCH_LINE::ClassOf(), PCB_GROUP::ClassOf(), PCB_TARGET::ClassOf(), SCH_FIELD::ClassOf(), FP_TEXT::ClassOf(), SCH_SHEET::ClassOf(), NETINFO_ITEM::ClassOf(), PCB_SHAPE::ClassOf(), SCH_SHEET_PIN::ClassOf(), ZONE::ClassOf(), SCH_BITMAP::ClassOf(), PAD::ClassOf(), TRACK::ClassOf(), SCH_COMPONENT::ClassOf(), SCH_SCREEN::ClassOf(), FOOTPRINT::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), SCH_TEXT::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), BOARD::ClassOf(), ARC::ClassOf(), SCH_LABEL::ClassOf(), VIA::ClassOf(), ALIGNED_DIMENSION::ClassOf(), SCH_GLOBALLABEL::ClassOf(), ORTHOGONAL_DIMENSION::ClassOf(), LEADER::ClassOf(), SCH_HIERLABEL::ClassOf(), CENTER_DIMENSION::ClassOf(), TRACKS_CLEANER::cleanup(), LIB_BEZIER::compare(), LIB_RECTANGLE::compare(), LIB_CIRCLE::compare(), LIB_POLYLINE::compare(), LIB_TEXT::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), LIB_ITEM::compare(), LIB_PART::Compare(), EE_GRID_HELPER::computeAnchors(), PCB_GRID_HELPER::computeAnchors(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), EE_RTREE::contains(), BOARD::ConvertKIIDsToCrossReferences(), SCHEMATIC::ConvertKIIDsToRefs(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), FOOTPRINT::CoverageRatio(), EDIT_TOOL::CreateArray(), BOARD_ADAPTER::createLayers(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), ZONE_CREATE_HELPER::createNewZone(), BOARD_ADAPTER::createTrack(), SCH_SCREEN::DeleteItem(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally(), ALIGN_DISTRIBUTE_TOOL::DistributeVertically(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDIT_TOOL::DoDelete(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), APPEARANCE_CONTROLS::doesBoardItemNeedRebuild(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawVia(), CONNECTION_SUBGRAPH::driverName(), CN_ITEM::Dump(), EDIT_TOOL::Duplicate(), FOOTPRINT::DuplicateItem(), EDA_ITEM_DESC::EDA_ITEM_DESC(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_EDIT_TOOL::editTextProperties(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckFloatingWires(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), DRC_ENGINE::EvalRules(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::FilterCollectorForGroups(), NETLIST_EXPORTER_BASE::findNextSymbol(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), EDIT_TOOL::Flip(), PCB_BASE_FRAME::FocusOnItem(), EDIT_TOOL::FootprintFilter(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), FP_TEXT::FP_TEXT(), PCB_POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), BOARD_ITEM::GetBoard(), SCH_FIELD::GetBoundingBox(), TRACK::GetBoundingBox(), SCH_FIELD::GetCanonicalName(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_TEXT::GetConnectionPoints(), SCH_TEXT::GetContextualTextVars(), FOOTPRINT::GetCoverageArea(), CONNECTION_GRAPH::getDefaultConnection(), getDrilledHoleShape(), CONNECTION_SUBGRAPH::GetDriverPriority(), SCH_TEXT::GetEndPoints(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), SCH_FIELD::GetMenuImage(), TRACK::GetMsgPanelInfo(), DIMENSION_BASE::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_FIELD::GetName(), CONNECTIVITY_DATA::GetNetItems(), LIB_PART::GetNextDrawItem(), PCB_SHAPE::GetParentFootprint(), LIB_PART::GetPin(), SCH_COMPONENT::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), KIGFX::SCH_PAINTER::getRenderColor(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), TRACK::GetSelectMenuText(), DRC_ENGINE::GetShape(), PCB_TEXT::GetShownText(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), CONVERT_TOOL::getStartEndPoints(), getTopLevelGroup(), GROUP_TOOL::Group(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), EE_SELECTION_TOOL::GuessSelectionCandidates(), hash_fp_item(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlightInternal(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::highlightNet(), highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EE_RTREE::insert(), DRC_RTREE::Insert(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFootprintCourtyard(), insideFrontCourtyard(), EE_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), ARRAY_CREATOR::Invoke(), isCopper(), CN_ANCHOR::IsDangling(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), PNS_KICAD_IFACE::IsFlashedOnLayer(), CADSTAR_PCB_ARCHIVE_LOADER::isFootprint(), SCH_FIELD::IsHypertext(), isKeepoutZone(), DRC_ENGINE::IsNetTie(), TRACK::IsNull(), SCH_LINE::IsParallel(), isPlated(), SCH_FIELD::IsReplaceable(), PNS::ROUTER::isStartingPointRoutable(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), PCB_SELECTION_TOOL::itemPassesFilter(), CONVERT_TOOL::LinesToPoly(), CLIPBOARD_IO::Load(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), NETLIST_EXPORTER_XML::makeListOfNets(), PCB_POINT_EDITOR::makePoints(), SCH_SCREEN::MarkConnections(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), SCH_FIELD::Matches(), memberOf(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), SCH_EDITOR_CONTROL::nextMatch(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), EDA_3D_CANVAS::OnMouseMove(), TRACK::cmp_tracks::operator()(), CN_VISITOR::operator()(), BOARD_ITEM::ptr_cmp::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), SCH_BUS_ENTRY_BASE::operator<(), SCH_JUNCTION::operator<(), SCH_FIELD::operator<(), SCH_LINE::operator<(), SCH_TEXT::operator<(), SCH_SHEET::operator<(), SCH_ITEM::operator<(), SCH_COMPONENT::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_COMPONENT::operator=(), PAD::PAD(), EDIT_TOOL::PadFilter(), BOARD_COMMIT::parentObject(), PCB_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_FIELD::Plot(), SCH_SCREEN::Plot(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), CONVERT_TOOL::PolyToLines(), POSITION_RELATIVE_TOOL::PositionRelative(), SCH_FIELD::Print(), SCH_SCREEN::Print(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), BACK_ANNOTATE::processNetNameChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_GRID_HELPER::queryVisible(), SCH_CONNECTION::recacheName(), SCH_BASE_FRAME::RefreshSelection(), KIGFX::PCB_VIEW::Remove(), EE_RTREE::remove(), FOOTPRINT::Remove(), CN_CONNECTIVITY_ALGO::Remove(), SCH_SCREEN::Remove(), BOARD::Remove(), PCB_POINT_EDITOR::removeCorner(), PCB_POINT_EDITOR::removeCornerCondition(), LIB_PART::RemoveDrawItem(), SCH_SHEET::RemovePin(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_FIELD::Replace(), PCB_SELECTION_TOOL::RequestSelection(), SCHEMATIC::ResolveCrossReference(), PCB_PARSER::resolveGroups(), DS_PROXY_UNDO_ITEM::Restore(), PL_EDITOR_FRAME::RollbackFromUndo(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), SCH_SEXPR_PLUGIN_CACHE::saveArc(), SCH_LEGACY_PLUGIN_CACHE::saveArc(), SCH_SEXPR_PLUGIN_CACHE::saveBezier(), SCH_LEGACY_PLUGIN_CACHE::saveBezier(), SCH_SEXPR_PLUGIN_CACHE::saveCircle(), SCH_LEGACY_PLUGIN_CACHE::saveCircle(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_SEXPR_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_SEXPR_PLUGIN_CACHE::savePolyLine(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), SCH_SEXPR_PLUGIN_CACHE::saveRectangle(), SCH_LEGACY_PLUGIN_CACHE::saveRectangle(), CLIPBOARD_IO::SaveSelection(), SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SCREEN::Schematic(), SCH_ITEM::Schematic(), CONVERT_TOOL::SegmentToArc(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectConnectedTracks(), SCH_FIELD::SetId(), ITEM_PICKER::SetItem(), SCH_FIELD::SetPosition(), DIALOG_LABEL_EDITOR::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), BOARD_COMMIT::Stage(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), SCH_SHEET_PIN::SwapData(), SCH_FIELD::SwapData(), PCB_TEXT::SwapData(), PCB_GROUP::SwapData(), TRACK::SwapData(), SCH_SHEET::SwapData(), ARC::SwapData(), ALIGNED_DIMENSION::SwapData(), ORTHOGONAL_DIMENSION::SwapData(), SCH_COMPONENT::SwapData(), LEADER::SwapData(), VIA::SwapData(), CENTER_DIMENSION::SwapData(), FOOTPRINT::SwapData(), PAD::SwapData(), ZONE::SwapData(), SwapItemData(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), ERC_TESTER::TestMultUnitPinConflicts(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), ERC_TESTER::TestPinToPin(), ERC_TESTER::TestSimilarLabels(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), TRACK::TransformShapeWithClearanceToPolygon(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), KIGFX::PCB_VIEW::Update(), SCH_TEXT::UpdateDanglingState(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_BASE_FRAME::UpdateItem(), CONNECTION_GRAPH::updateItemConnectivity(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), SCH_EDITOR_CONTROL::updatePastedInstances(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), SCH_BUS_ENTRY_BASE::ViewGetLayers(), PCB_GROUP::Visit(), TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), SCH_SHEET::Visit(), SCH_GLOBALLABEL::Visit(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and NETLIST_EXPORTER_CADSTAR::writeListOfNets().

◆ ViewBBox()

const BOX2I EDA_ITEM::ViewBBox ( ) const
overridevirtualinherited

Return the bounding box of the item covering all its layers.

Returns
the current bounding box.

Implements KIGFX::VIEW_ITEM.

Reimplemented in PAD, FOOTPRINT, CENTER_DIMENSION, EDIT_POINTS, PCB_SHAPE, DIMENSION_BASE, GERBER_DRAW_ITEM, FP_TEXT, TRACK, DS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, PCB_MARKER, MY_DRAWING, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::POLYGON_ITEM, RATSNEST_VIEW_ITEM, KIGFX::PREVIEW::RULER_ITEM, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 190 of file eda_item.cpp.

191 {
192  // Basic fallback
193  EDA_RECT bbox = GetBoundingBox();
194 
195  return BOX2I( bbox.GetOrigin(), bbox.GetSize() );
196 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:522
const wxPoint GetOrigin() const
Definition: eda_rect.h:106
Handle the component boundary box.
Definition: eda_rect.h:42
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:73
const wxSize GetSize() const
Definition: eda_rect.h:96

References EDA_ITEM::GetBoundingBox(), EDA_RECT::GetOrigin(), and EDA_RECT::GetSize().

Referenced by GERBVIEW_FRAME::GetDocumentExtents(), DIMENSION_BASE::ViewBBox(), and PCB_SHAPE::ViewBBox().

◆ ViewDraw()

virtual void KIGFX::VIEW_ITEM::ViewDraw ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Draw the parts of the object belonging to layer aLayer.

An alternative way for drawing objects if there is no #PAINTER assigned for the view or if the PAINTER doesn't know how to paint this particular implementation of VIEW_ITEM. The preferred way of drawing is to design an appropriate PAINTER object, the method below is intended only for quick hacks and debugging purposes.

Parameters
aLayeris the current drawing layer.
aViewis a pointer to the VIEW device we are drawing on.

Reimplemented in EDIT_POINTS, DS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, KIGFX::VIEW_GROUP, KIGFX::PREVIEW::SELECTION_AREA, MY_DRAWING, KIGFX::VIEW_OVERLAY, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::ARC_ASSISTANT, KIGFX::PREVIEW::RULER_ITEM, and RATSNEST_VIEW_ITEM.

Definition at line 111 of file view_item.h.

112  {}

Referenced by KIGFX::VIEW::draw(), and KIGFX::VIEW::updateItemGeometry().

◆ ViewGetLayers()

void DS_DRAW_ITEM_BASE::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
overridevirtualinherited

Return the all the layers within the VIEW the object is painted on.

For instance, a PAD spans zero or more copper layers and a few technical layers. ViewDraw() or PAINTER::Draw() is repeatedly called for each of the layers returned by ViewGetLayers(), depending on the rendering order.

Parameters
aLayers[]is the output layer index array.
aCountis the number of layer indices in aLayers[].

Reimplemented from EDA_ITEM.

Definition at line 65 of file ds_draw_item.cpp.

66 {
67  aCount = 1;
68 
69  DS_DATA_ITEM* dataItem = GetPeer();
70 
71  if( !dataItem ) // No peer: this item is like a DS_DRAW_ITEM_PAGE
72  {
73  aLayers[0] = LAYER_DRAWINGSHEET;
74  return;
75  }
76 
77  if( dataItem->GetPage1Option() == FIRST_PAGE_ONLY )
78  aLayers[0] = LAYER_DRAWINGSHEET_PAGE1;
79  else if( dataItem->GetPage1Option() == SUBSEQUENT_PAGES )
80  aLayers[0] = LAYER_DRAWINGSHEET_PAGEn;
81  else
82  aLayers[0] = LAYER_DRAWINGSHEET;
83 }
for drawingsheetEditor previewing
for drawingsheetEditor previewing
DS_DATA_ITEM * GetPeer() const
Definition: ds_draw_item.h:63
Drawing sheet structure type definitions.
Definition: ds_data_item.h:95
drawingsheet frame and titleblock
PAGE_OPTION GetPage1Option() const
Definition: ds_data_item.h:134

References FIRST_PAGE_ONLY, DS_DATA_ITEM::GetPage1Option(), DS_DRAW_ITEM_BASE::GetPeer(), LAYER_DRAWINGSHEET, LAYER_DRAWINGSHEET_PAGE1, LAYER_DRAWINGSHEET_PAGEn, and SUBSEQUENT_PAGES.

◆ ViewGetLOD()

virtual double KIGFX::VIEW_ITEM::ViewGetLOD ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Return the level of detail (LOD) of the item.

A level of detail is the minimal VIEW scale that is sufficient for an item to be shown on a given layer.

Parameters
aLayeris the current drawing layer.
aViewis a pointer to the VIEW device we are drawing on.
Returns
the level of detail. 0 always show the item, because the actual zoom level (or VIEW scale) is always > 0

Reimplemented in FP_ZONE, PAD, FOOTPRINT, VIA, GERBER_DRAW_ITEM, FP_TEXT, TRACK, ZONE, PCB_GROUP, and FP_SHAPE.

Definition at line 137 of file view_item.h.

138  {
139  // By default always show the item
140  return 0.0;
141  }

Referenced by PNS_KICAD_IFACE::IsItemVisible(), KIGFX::VIEW::DRAW_ITEM_VISITOR::operator()(), EE_GRID_HELPER::queryVisible(), PCB_GRID_HELPER::queryVisible(), and PCB_SELECTION_TOOL::Selectable().

◆ viewPrivData()

◆ Visit()

SEARCH_RESULT EDA_ITEM::Visit ( INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
virtualinherited

May be re-implemented for each derived class in order to handle all the types given by its member data.

Implementations should call inspector->Inspect() on types in scanTypes[], and may use IterateForward() to do so on lists of such data.

Parameters
inspectorAn INSPECTOR instance to use in the inspection.
testDataArbitrary data used by the inspector.
scanTypesWhich# KICAD_T types are of interest and the order is significant too, terminated by EOT.
Returns
SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else #SCAN_CONTINUE, and determined by the inspector.

Reimplemented in BOARD, SCH_COMPONENT, FOOTPRINT, LIB_PART, SCH_GLOBALLABEL, SCH_SHEET, GERBER_FILE_IMAGE, GERBER_DRAW_ITEM, TRACK, PCB_GROUP, and GBR_LAYOUT.

Definition at line 91 of file eda_item.cpp.

92 {
93 #if 0 && defined(DEBUG)
94  std::cout << GetClass().mb_str() << ' ';
95 #endif
96 
97  if( IsType( scanTypes ) )
98  {
99  if( SEARCH_RESULT::QUIT == inspector( this, testData ) )
100  return SEARCH_RESULT::QUIT;
101  }
102 
104 }
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
Definition: eda_item.h:233
virtual wxString GetClass() const =0
Return the class name.

References CONTINUE, EDA_ITEM::GetClass(), EDA_ITEM::IsType(), and QUIT.

Referenced by GERBER_COLLECTOR::Collect(), GENERAL_COLLECTOR::Collect(), PCB_TYPE_COLLECTOR::Collect(), PCB_LAYER_COLLECTOR::Collect(), and EDA_ITEM::IterateForward().

Member Data Documentation

◆ m_flags

◆ m_forceVisible

bool EDA_ITEM::m_forceVisible
protectedinherited

◆ m_index

int DS_DRAW_ITEM_BASE::m_index
protectedinherited

◆ m_parent

◆ m_peer

DS_DATA_ITEM* DS_DRAW_ITEM_BASE::m_peer
protectedinherited

◆ m_penWidth

◆ m_status

STATUS_FLAGS EDA_ITEM::m_status
protectedinherited

◆ m_Uuid

const KIID EDA_ITEM::m_Uuid
inherited

Definition at line 525 of file eda_item.h.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), SCH_COMPONENT::AddHierarchicalReference(), RC_ITEM::AddItem(), SCH_EDIT_FRAME::AnnotateSymbols(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), SCH_SHEET_PATH::Cmp(), SCHEMATIC::ConvertRefsToKIIDs(), MICROWAVE_TOOL::createMicrowaveInductor(), DRAWING_TOOL::DrawVia(), LIB_PART::Duplicate(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), FOOTPRINT::Duplicate(), FOOTPRINT::DuplicateItem(), PCB_EDIT_FRAME::ExchangeFootprint(), PAD_TOOL::explodePad(), BOARD_EDITOR_CONTROL::ExportNetlist(), SCH_SHEET_LIST::FillItemMap(), BOARD::FillItemMap(), PCB_BASE_FRAME::FocusOnItem(), SCH_EDIT_FRAME::FocusOnItem(), PCB_IO::format(), FormatProbeItem(), SCH_PIN::GetDefaultNetName(), SCH_SHEET_LIST::GetItem(), BOARD::GetItem(), PAD::GetMsgPanelInfo(), DIALOG_BOARD_REANNOTATE::GetNewRefDes(), FP_TEXT::GetParentAsString(), PAD::GetParentAsString(), FP_SHAPE::GetParentAsString(), SCH_REFERENCE::GetPath(), SCH_MARKER::GetUUID(), PCB_MARKER::GetUUID(), FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch(), SCH_LEGACY_PLUGIN::loadComponent(), LEGACY_PLUGIN::loadFOOTPRINT(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), PCB_EDIT_FRAME::LoadFootprints(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), LEGACY_PLUGIN::loadTrackList(), NETLIST_EXPORTER_XML::makeSymbols(), SCH_EDIT_FRAME::mapExistingAnnotation(), TRACK::cmp_tracks::operator()(), BOARD_ITEM::ptr_cmp::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), FOOTPRINT::cmp_pads::operator()(), SCH_ITEM::operator<(), SCH_COMPONENT::operator<(), PAD::PAD(), SCH_SEXPR_PARSER::parseSchSheetInstances(), SCH_EDITOR_CONTROL::Paste(), SCH_SHEET_PATH::PathAsString(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_COMPONENT::ReplaceInstanceSheetPath(), PCB_PARSER::resolveGroups(), SCH_SEXPR_PLUGIN::saveBitmap(), SCH_SEXPR_PLUGIN::saveBusEntry(), SCH_LEGACY_PLUGIN::saveComponent(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN::saveLine(), SCH_SEXPR_PLUGIN::saveNoConnect(), SCH_EDIT_FRAME::SaveProject(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_COMPONENT::SCH_COMPONENT(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SHEET::SCH_SHEET(), RC_ITEM::SetItems(), SwapItemData(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), testGroupEqual(), SCH_EDITOR_CONTROL::updatePastedInstances(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().


The documentation for this class was generated from the following files: