KiCad PCB EDA Suite
EDA_TEXT Class Reference

Class EDA_TEXT is a mix-in class (via multiple inheritance) that handles texts such as labels, parts, components, or footprints. More...

#include <eda_text.h>

Inheritance diagram for EDA_TEXT:
LIB_FIELD LIB_TEXT SCH_FIELD SCH_TEXT TEXTE_MODULE TEXTE_PCB WS_DRAW_ITEM_TEXT SCH_GLOBALLABEL SCH_HIERLABEL SCH_LABEL SCH_SHEET_PIN

Public Member Functions

 EDA_TEXT (const wxString &text=wxEmptyString)
 
virtual ~EDA_TEXT ()
 
const wxString & GetText () const
 Function GetText returns the string associated with the text object. More...
 
virtual wxString GetShownText () const
 Returns the string actually shown after processing of the base text. More...
 
wxString ShortenedShownText () const
 Returns a shortened version (max 15 characters) of the shown text. More...
 
virtual void SetText (const wxString &aText)
 
void SetThickness (int aNewThickness)
 Function SetThickness sets pen width. More...
 
int GetThickness () const
 Function GetThickness returns pen width. More...
 
void SetTextAngle (double aAngle)
 
double GetTextAngle () const
 
double GetTextAngleDegrees () const
 
double GetTextAngleRadians () const
 
void SetItalic (bool isItalic)
 
bool IsItalic () const
 
void SetBold (bool aBold)
 
bool IsBold () const
 
void SetVisible (bool aVisible)
 
bool IsVisible () const
 
void SetMirrored (bool isMirrored)
 
bool IsMirrored () const
 
void SetMultilineAllowed (bool aAllow)
 Function SetMultiLineAllowed. More...
 
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)
 Function SetEffects sets the text effects from another instance. More...
 
void SwapEffects (EDA_TEXT &aTradingPartner)
 Function SwapEffects swaps the text effects of the two involved instances. 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 wxPointGetTextPos () const
 
void SetTextX (int aX)
 
void SetTextY (int aY)
 
void Offset (const wxPoint &aOffset)
 
void Empty ()
 
void Draw (EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aOffset, COLOR4D aColor, GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aDisplay_mode=FILLED, COLOR4D aAnchor_color=COLOR4D::UNSPECIFIED)
 Function Draw. More...
 
void TransformTextShapeToSegmentList (std::vector< wxPoint > &aCornerBuffer) const
 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. More...
 
virtual bool TextHitTest (const wxPoint &aPoint, int aAccuracy=0) const
 Function TextHitTest Test if aPoint is within the bounds of this object. More...
 
virtual bool TextHitTest (const EDA_RECT &aRect, bool aContains=false, int aAccuracy=0) const
 Function TextHitTest (overloaded) Tests if object bounding box is contained within or intersects aRect. More...
 
int LenSize (const wxString &aLine) const
 Function LenSize. More...
 
EDA_RECT GetTextBox (int aLine=-1, int aThickness=-1, bool aInvertY=false) const
 Function GetTextBox useful in multiline texts to calculate the full text or a line area (for zones filling, locate functions....) More...
 
int GetInterline (int aTextThickness=-1) const
 Return the distance between two lines of text. More...
 
wxString GetTextStyleName ()
 Function GetTextStyleName. More...
 
void GetPositionsOfLinesOfMultilineText (std::vector< wxPoint > &aPositions, int aLineCount) const
 Function GetPositionsOfLinesOfMultilineText Populates 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
 Function Format outputs the object to aFormatter in s-expression form. More...
 

Protected Attributes

wxString m_Text
 

Private Types

enum  TE_FLAGS {
  TE_MIRROR, TE_ITALIC, TE_BOLD, TE_MULTILINE,
  TE_VISIBLE
}
 EDA_TEXT effects bools. More...
 

Private Member Functions

void drawOneLineOfText (EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aOffset, COLOR4D aColor, GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode, const wxString &aText, const wxPoint &aPos)
 Function drawOneLineOfText draws a single text line. More...
 

Private Attributes

TEXT_EFFECTS m_e
 

Detailed Description

Class EDA_TEXT is a mix-in class (via multiple inheritance) that handles texts such as labels, parts, components, or footprints.

Because it's a mix-in class, care is used to provide function names (accessors) that to not collide with function names likely to be seen in the combined derived classes.

Definition at line 112 of file eda_text.h.

Member Enumeration Documentation

enum EDA_TEXT::TE_FLAGS
private

EDA_TEXT effects bools.

Enumerator
TE_MIRROR 
TE_ITALIC 
TE_BOLD 
TE_MULTILINE 
TE_VISIBLE 

Definition at line 369 of file eda_text.h.

369  {
370  // start at zero, sequence is irrelevant
371  TE_MIRROR,
372  TE_ITALIC,
373  TE_BOLD,
374  TE_MULTILINE,
375  TE_VISIBLE,
376  };

Constructor & Destructor Documentation

EDA_TEXT::EDA_TEXT ( const wxString &  text = wxEmptyString)

Definition at line 41 of file eda_text.cpp.

References DEFAULT_SIZE_TEXT, and SetTextSize().

41  :
42  m_Text( text ),
43  m_e( 1<<TE_VISIBLE )
44 {
45  int sz = Mils2iu( DEFAULT_SIZE_TEXT );
46  SetTextSize( wxSize( sz, sz ) );
47 }
#define DEFAULT_SIZE_TEXT
This is the "default-of-the-default" hardcoded text size; individual application define their own def...
Definition: eda_text.h:72
wxString m_Text
Definition: eda_text.h:344
TEXT_EFFECTS m_e
Definition: eda_text.h:366
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:212
EDA_TEXT::~EDA_TEXT ( )
virtual

Definition at line 50 of file eda_text.cpp.

51 {
52 }

Member Function Documentation

void EDA_TEXT::Draw ( EDA_RECT aClipBox,
wxDC *  aDC,
const wxPoint aOffset,
COLOR4D  aColor,
GR_DRAWMODE  aDrawMode,
EDA_DRAW_MODE_T  aDisplay_mode = FILLED,
COLOR4D  aAnchor_color = COLOR4D::UNSPECIFIED 
)

Function Draw.

Parameters
aClipBox= the clipping rect, or NULL if no clipping
aDC= the current Device Context
aOffset= draw offset (usually (0,0))
aColor= text color
aDrawMode= GR_OR, GR_XOR.., -1 to use the current mode.
aDisplay_mode= FILLED or SKETCH
aAnchor_color= anchor color ( COLOR4D::UNSPECIFIED = do not draw anchor ).

Definition at line 279 of file eda_text.cpp.

References DIM_ANCRE_TEXTE, drawOneLineOfText(), GetPositionsOfLinesOfMultilineText(), GetShownText(), GetTextPos(), GRDrawAnchor(), IsMultilineAllowed(), wxStringSplit(), wxPoint::x, and wxPoint::y.

Referenced by TEXTE_PCB::Draw(), SCH_TEXT::Draw(), SCH_GLOBALLABEL::Draw(), SCH_HIERLABEL::Draw(), and WS_DRAW_ITEM_TEXT::DrawWsItem().

282 {
283  if( IsMultilineAllowed() )
284  {
285  std::vector<wxPoint> positions;
286  wxArrayString strings;
287  wxStringSplit( GetShownText(), strings, '\n' );
288 
289  positions.reserve( strings.Count() );
290 
291  GetPositionsOfLinesOfMultilineText( positions, strings.Count() );
292 
293  for( unsigned ii = 0; ii < strings.Count(); ii++ )
294  {
295  wxString& txt = strings.Item( ii );
296  drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
297  aDrawMode, aFillMode, txt, positions[ii] );
298  }
299  }
300  else
301  drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
302  aDrawMode, aFillMode, GetShownText(), GetTextPos() );
303 
304  // Draw text anchor, if requested
305  if( aAnchor_color != COLOR4D::UNSPECIFIED )
306  {
307  GRDrawAnchor( aClipBox, aDC,
308  GetTextPos().x + aOffset.x, GetTextPos().y + aOffset.y,
309  DIM_ANCRE_TEXTE, aAnchor_color );
310  }
311 }
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Function wxStringSplit splits aString to a string list separated at aSplitter.
Definition: common.cpp:138
bool IsMultilineAllowed() const
Definition: eda_text.h:186
const wxPoint & GetTextPos() const
Definition: eda_text.h:222
void GRDrawAnchor(EDA_RECT *aClipBox, wxDC *aDC, int x, int y, int aSize, COLOR4D aColor)
Definition: gr_basic.cpp:1288
void drawOneLineOfText(EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aOffset, COLOR4D aColor, GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode, const wxString &aText, const wxPoint &aPos)
Function drawOneLineOfText draws a single text line.
Definition: eda_text.cpp:356
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:133
void GetPositionsOfLinesOfMultilineText(std::vector< wxPoint > &aPositions, int aLineCount) const
Function GetPositionsOfLinesOfMultilineText Populates aPositions with the position of each line of a ...
Definition: eda_text.cpp:314
#define DIM_ANCRE_TEXTE
Definition: eda_text.h:73
void EDA_TEXT::drawOneLineOfText ( EDA_RECT aClipBox,
wxDC *  aDC,
const wxPoint aOffset,
COLOR4D  aColor,
GR_DRAWMODE  aDrawMode,
EDA_DRAW_MODE_T  aFillMode,
const wxString &  aText,
const wxPoint aPos 
)
private

Function drawOneLineOfText draws a single text line.

Used to draw each line of this EDA_TEXT, that can be multiline

Parameters
aClipBox= the clipping rect, or NULL if no clipping
aDC= the current Device Context
aOffset= draw offset (usually (0,0))
aColor= text color
aDrawMode= GR_OR, GR_XOR.., -1 to use the current mode.
aFillMode= FILLED or SKETCH
aText= the single line of text to draw.
aPos= the position of this line ).

Definition at line 356 of file eda_text.cpp.

References DrawGraphicText(), GetHorizJustify(), GetTextAngle(), GetTextSize(), GetThickness(), GetVertJustify(), GRSetDrawMode(), IsBold(), IsItalic(), IsMirrored(), SKETCH, and UNSPECIFIED_DRAWMODE.

Referenced by Draw().

360 {
361  int width = GetThickness();
362 
363  if( aDrawMode != UNSPECIFIED_DRAWMODE )
364  GRSetDrawMode( aDC, aDrawMode );
365 
366  if( aFillMode == SKETCH )
367  width = -width;
368 
369  wxSize size = GetTextSize();
370 
371  if( IsMirrored() )
372  size.x = -size.x;
373 
374  DrawGraphicText( aClipBox, aDC, aOffset + aPos, aColor, aText, GetTextAngle(), size,
376  width, IsItalic(), IsBold() );
377 }
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:318
bool IsItalic() const
Definition: eda_text.h:168
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:188
void DrawGraphicText(EDA_RECT *aClipBox, 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 DrawGraphicText Draw a graphic text (like module texts)
bool IsBold() const
Definition: eda_text.h:171
double GetTextAngle() const
Definition: eda_text.h:162
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:152
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:189
bool IsMirrored() const
Definition: eda_text.h:177
const wxSize & GetTextSize() const
Definition: eda_text.h:213
void EDA_TEXT::Empty ( )
inline

Definition at line 229 of file eda_text.h.

References FILLED, and Format().

Referenced by SCH_LEGACY_PLUGIN_CACHE::loadPart().

229 { m_Text.Empty(); }
wxString m_Text
Definition: eda_text.h:344
void EDA_TEXT::Format ( OUTPUTFORMATTER aFormatter,
int  aNestLevel,
int  aControlBits 
) const
virtual

Function Format outputs 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 415 of file eda_text.cpp.

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

416 {
417 #ifndef GERBVIEW // Gerbview does not use EDA_TEXT::Format
418  // and does not define FMT_IU, used here
419  // however this function should exist
420 
421  aFormatter->Print( aNestLevel + 1, "(effects" );
422 
423  // Text size
424  aFormatter->Print( 0, " (font" );
425 
426  aFormatter->Print( 0, " (size %s %s)",
427  FMT_IU( GetTextHeight() ).c_str(),
428  FMT_IU( GetTextWidth() ).c_str() );
429 
430  if( GetThickness() )
431  aFormatter->Print( 0, " (thickness %s)", FMT_IU( GetThickness() ).c_str() );
432 
433  if( IsBold() )
434  aFormatter->Print( 0, " bold" );
435 
436  if( IsItalic() )
437  aFormatter->Print( 0, " italic" );
438 
439  aFormatter->Print( 0, ")"); // (font
440 
441  if( IsMirrored() ||
444  {
445  aFormatter->Print( 0, " (justify");
446 
448  aFormatter->Print( 0, (GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" );
449 
451  aFormatter->Print( 0, (GetVertJustify() == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" );
452 
453  if( IsMirrored() )
454  aFormatter->Print( 0, " mirror" );
455  aFormatter->Print( 0, ")" ); // (justify
456  }
457 
458  if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() )
459  aFormatter->Print( 0, " hide" );
460 
461  aFormatter->Print( 0, ")\n" ); // (justify
462 
463 #endif
464 }
bool IsItalic() const
Definition: eda_text.h:168
int GetTextWidth() const
Definition: eda_text.h:216
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:188
bool IsBold() const
Definition: eda_text.h:171
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:152
#define FMT_IU
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:189
bool IsMirrored() const
Definition: eda_text.h:177
bool IsVisible() const
Definition: eda_text.h:174
int GetTextHeight() const
Definition: eda_text.h:219
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:404
#define CTL_OMIT_HIDE
Definition: eda_text.h:42
EDA_TEXT_HJUSTIFY_T EDA_TEXT::GetHorizJustify ( ) const
inline
int EDA_TEXT::GetInterline ( int  aTextThickness = -1) const

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.

Parameters
aTextThicknessOverrides the current thickness when greater than 0. this is needed when the current m_Thickness is 0 and a default line thickness is used

Definition at line 94 of file eda_text.cpp.

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

Referenced by GetPositionsOfLinesOfMultilineText(), and GetTextBox().

95 {
96  int thickness = aTextThickness <= 0 ? GetThickness() : aTextThickness;
97 
98  return KiROUND( KIGFX::STROKE_FONT::GetInterline( GetTextHeight(), thickness ) );
99 }
static double GetInterline(double aGlyphHeight, double aGlyphThickness)
Compute the distance (interline) between 2 lines of text (for multiline texts).
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:152
int GetTextHeight() const
Definition: eda_text.h:219
void EDA_TEXT::GetPositionsOfLinesOfMultilineText ( std::vector< wxPoint > &  aPositions,
int  aLineCount 
) const

Function GetPositionsOfLinesOfMultilineText Populates 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 314 of file eda_text.cpp.

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

Referenced by CINFO3D_VISU::AddShapeWithClearanceToContainer(), Draw(), export_vrml_pcbtext(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotTextePcb(), and TransformTextShapeToSegmentList().

316 {
317  wxPoint pos = GetTextPos(); // Position of first line of the
318  // multiline text according to
319  // the center of the multiline text block
320 
321  wxPoint offset; // Offset to next line.
322 
323  offset.y = GetInterline();
324 
325  if( aLineCount > 1 )
326  {
327  switch( GetVertJustify() )
328  {
330  break;
331 
333  pos.y -= ( aLineCount - 1 ) * offset.y / 2;
334  break;
335 
337  pos.y -= ( aLineCount - 1 ) * offset.y;
338  break;
339  }
340  }
341 
342  // Rotate the position of the first line
343  // around the center of the multiline text block
344  RotatePoint( &pos, GetTextPos(), GetTextAngle() );
345 
346  // Rotate the offset lines to increase happened in the right direction
347  RotatePoint( &offset, GetTextAngle() );
348 
349  for( int ii = 0; ii < aLineCount; ii++ )
350  {
351  aPositions.push_back( pos );
352  pos += offset;
353  }
354 }
int GetInterline(int aTextThickness=-1) const
Return the distance between two lines of text.
Definition: eda_text.cpp:94
const wxPoint & GetTextPos() const
Definition: eda_text.h:222
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
double GetTextAngle() const
Definition: eda_text.h:162
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:189
const wxString& EDA_TEXT::GetText ( ) const
inline

Function GetText returns the string associated with the text object.

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

Definition at line 128 of file eda_text.h.

Referenced by NETLIST_EXPORTER_GENERIC::addComponentFields(), SCH_EAGLE_PLUGIN::addImplicitConnections(), AddMenusForComponent(), AddMenusForText(), SIM_PLOT_FRAME::AddTuner(), SCH_EDIT_FRAME::backAnnotateFootprints(), SCH_SHEET::CleanupSheet(), SCH_REFERENCE::CompareValue(), SCH_SHEET::ComponentCount(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel(), CreateComponentsSection(), LIB_EDIT_FRAME::CreateGraphicItem(), SCH_EDIT_FRAME::CreateNewText(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD(), TEXTE_MODULE::Draw(), SCH_EDIT_FRAME::EditSheetPin(), PCB_IO::format(), FormatProbeItem(), LIB_FIELD::GetFullText(), SCH_COMPONENT::GetRef(), SCH_COMPONENT::GetScreenCoord(), NETLIST_EXPORTER_PSPICE::GetSpiceField(), NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal(), DIMENSION::GetText(), hash_eda(), SCH_SHEET::HasUndefinedPins(), LIB_FIELD::HitTest(), SCH_EDIT_FRAME::ImportSheetPin(), DIALOG_LABEL_EDITOR::InitDialog(), DIALOG_LIB_EDIT_TEXT::initDlg(), DIALOG_FOOTPRINT_FP_EDITOR::initModeditProperties(), DIALOG_FOOTPRINT_BOARD_EDITOR::InitModeditProperties(), GENERAL_COLLECTOR::Inspect(), SCH_COMPONENT::IsInNetlist(), SCH_SCREEN::IsTerminalPoint(), SCH_EDIT_FRAME::Load_Component(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EAGLE_PLUGIN::loadSchematic(), SCH_EAGLE_PLUGIN::loadSegments(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::moveUpButtonHandler(), SCH_EDIT_FRAME::OnConvertTextType(), DIALOG_FOOTPRINT_FP_EDITOR::OnEditReference(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditReference(), DIALOG_FOOTPRINT_FP_EDITOR::OnEditValue(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditValue(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), SCH_COMPONENT::operator==(), PlaceCells(), DRAWING_TOOL::PlaceDXF(), DRAWING_TOOL::PlaceText(), BRDITEMS_PLOTTER::PlotAllTextsModule(), DIALOG_RESCUE_EACH::PopulateInstanceList(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), LIB_EDIT_FRAME::RedrawComponent(), SCH_EDIT_FRAME::RotateField(), SCH_LEGACY_PLUGIN::saveComponent(), SCH_LEGACY_PLUGIN::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveSymbol(), SCH_LEGACY_PLUGIN::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_COMPONENT::SCH_COMPONENT(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SCREEN::SetComponentFootprint(), LIB_PART::SetName(), SCH_COMPONENT::SetRef(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setRowItem(), LIB_FIELD::SetText(), SCH_REFERENCE_LIST::sortByReferenceOnly(), TestMultiunitFootprints(), DIALOG_EDIT_FPTEXT::TransferDataToWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow(), TransformTextShapeToSegmentList(), TUNER_SLIDER::TUNER_SLIDER(), CMP_TREE_NODE_LIB_ID::Update(), DIALOG_UPDATE_FIELDS::updateFields(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_CADSTAR::WriteNetlist().

128 { return m_Text; }
wxString m_Text
Definition: eda_text.h:344
double EDA_TEXT::GetTextAngle ( ) const
inline

Definition at line 162 of file eda_text.h.

Referenced by CINFO3D_VISU::AddShapeWithClearanceToContainer(), LIB_TEXT::calcEdit(), LIB_FIELD::calcEdit(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel(), CreateComponentsSection(), DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD(), SCH_FIELD::Draw(), KIGFX::WORKSHEET_VIEWITEM::draw(), LIB_TEXT::drawGraphic(), LIB_FIELD::drawGraphic(), drawOneLineOfText(), export_vrml_pcbtext(), TEXTE_MODULE::Flip(), PCB_IO::format(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), TEXTE_PCB::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), TEXTE_MODULE::GetDrawRotation(), TEXTE_PCB::GetMsgPanelInfo(), GetPositionsOfLinesOfMultilineText(), hash_eda(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), DIALOG_LIB_EDIT_TEXT::initDlg(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), DIMENSION::Mirror(), EAGLE_PLUGIN::orientModuleText(), PCB_PARSER::parseMODULE_unchecked(), PlaceCells(), DRAWING_TOOL::PlaceDXF(), PCB_BASE_FRAME::PlaceTexteModule(), LIB_TEXT::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), LIB_FIELD::Plot(), BRDITEMS_PLOTTER::PlotTextePcb(), PlotWorkSheet(), TEXTE_PCB::Rotate(), TEXTE_MODULE::Rotate(), LIB_TEXT::Rotate(), DIMENSION::Rotate(), LIB_FIELD::Rotate(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_EDIT_FRAME::RotateField(), PCB_BASE_FRAME::RotateTextModule(), SCH_LEGACY_PLUGIN::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SCREEN::SetComponentFootprint(), PCB_BASE_FRAME::StartMoveTexteModule(), TextHitTest(), DIALOG_EDIT_FPTEXT::TransferDataFromWindow(), DIALOG_EDIT_FPTEXT::TransferDataToWindow(), TransformTextShapeToSegmentList(), and DIALOG_SCH_EDIT_ONE_FIELD::UpdateField().

162 { return m_e.angle; }
TEXT_EFFECTS m_e
Definition: eda_text.h:366
double angle
now: 0.1 degrees; future: degrees
Definition: eda_text.h:97
double EDA_TEXT::GetTextAngleDegrees ( ) const
inline

Definition at line 164 of file eda_text.h.

Referenced by TEXTE_MODULE::GetMsgPanelInfo(), and DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow().

164 { return GetTextAngle() / 10.0; }
double GetTextAngle() const
Definition: eda_text.h:162
double EDA_TEXT::GetTextAngleRadians ( ) const
inline

Definition at line 165 of file eda_text.h.

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

165 { return GetTextAngle() * M_PI/1800; }
double GetTextAngle() const
Definition: eda_text.h:162
EDA_RECT EDA_TEXT::GetTextBox ( int  aLine = -1,
int  aThickness = -1,
bool  aInvertY = false 
) const

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

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
Parameters
aLineThe line of text to consider. for single line text, aLine is unused If aLine == -1, the full area (considering all lines) is returned
aThicknessOverrides the current penwidth when greater than 0. This is needed when the current penwidth is 0 and a default penwidth is used.
aInvertYInvert the Y axis when calculating bounding box.

Definition at line 102 of file eda_text.cpp.

References basic_gal, KIGFX::STROKE_FONT::ComputeOverbarVerticalPosition(), KIGFX::STROKE_FONT::ComputeStringBoundaryLimits(), GetHorizJustify(), GetInterline(), GetShownText(), KIGFX::GAL::GetStrokeFont(), GetTextHeight(), GetTextPos(), GetTextSize(), GetThickness(), 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, IsMirrored(), IsMultilineAllowed(), KiROUND(), max, EDA_RECT::Move(), EDA_RECT::Normalize(), EDA_RECT::SetOrigin(), EDA_RECT::SetSize(), EDA_RECT::SetX(), EDA_RECT::SetY(), wxStringSplit(), VECTOR2< T >::x, and wxPoint::y.

Referenced by LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), TEXTE_PCB::GetBoundingBox(), TEXTE_MODULE::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), DIMENSION::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), PlaceCells(), WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize(), TEXTE_MODULE::TextHitTest(), TextHitTest(), and TEXTE_MODULE::ViewBBox().

103 {
104  EDA_RECT rect;
105  wxArrayString strings;
106  wxString text = GetShownText();
107  int thickness = ( aThickness < 0 ) ? GetThickness() : aThickness;
108  int linecount = 1;
109  bool hasOverBar = false; // true if the first line of text as an overbar
110 
111  if( IsMultilineAllowed() )
112  {
113  wxStringSplit( text, strings, '\n' );
114 
115  if( strings.GetCount() ) // GetCount() == 0 for void strings
116  {
117  if( aLine >= 0 && (aLine < (int)strings.GetCount()) )
118  text = strings.Item( aLine );
119  else
120  text = strings.Item( 0 );
121 
122  linecount = strings.GetCount();
123  }
124  }
125 
126  // Search for overbar symbol. Only text is scanned,
127  // because only this line can change the bounding box
128  for( unsigned ii = 1; ii < text.size(); ii++ )
129  {
130  if( text[ii-1] == '~' && text[ii] != '~' )
131  {
132  hasOverBar = true;
133  break;
134  }
135  }
136 
137  // calculate the H and V size
139  text, VECTOR2D( GetTextSize() ), double( thickness ) ).x );
140  int dy = GetInterline( thickness );
141 
142  // Creates bounding box (rectangle) for an horizontal
143  // and left and top justified text. the bounding box will be moved later
144  // according to the actual text options
145  wxSize textsize = wxSize( dx, dy );
146  wxPoint pos = GetTextPos();
147 
148  if( aInvertY )
149  pos.y = -pos.y;
150 
151  rect.SetOrigin( pos );
152 
153  // The bbox vertical size returned by GetInterline( aThickness )
154  // includes letters like j and y and ] + interval between lines.
155  // The interval below the last line is not usefull, and we can use its half value
156  // as vertical margin above the text
157  // the full interval is roughly GetTextHeight() * 0.4 - aThickness/2
158  rect.Move( wxPoint( 0, thickness/4 - KiROUND( GetTextHeight() * 0.22 ) ) );
159 
160  if( hasOverBar )
161  { // A overbar adds an extra size to the text
162  // Height from the base line text of chars like [ or {
163  double curr_height = GetTextHeight() * 1.15;
164  int extra_height = KiROUND(
165  basic_gal.GetStrokeFont().ComputeOverbarVerticalPosition( GetTextHeight(), thickness ) - curr_height );
166  extra_height += thickness/2;
167  textsize.y += extra_height;
168  rect.Move( wxPoint( 0, -extra_height ) );
169  }
170 
171  // for multiline texts and aLine < 0, merge all rectangles
172  // ( if aLine < 0, we want the full text bounding box )
173  if( IsMultilineAllowed() && aLine < 0 )
174  {
175  for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
176  {
177  text = strings.Item( ii );
179  text, VECTOR2D( GetTextSize() ), double( thickness ) ).x );
180  textsize.x = std::max( textsize.x, dx );
181  textsize.y += dy;
182  }
183  }
184 
185  rect.SetSize( textsize );
186 
187  /* Now, calculate the rect origin, according to text justification
188  * At this point the rectangle origin is the text origin (m_Pos).
189  * This is true only for left and top text justified texts (using top to bottom Y axis
190  * orientation). and must be recalculated for others justifications
191  * also, note the V justification is relative to the first line
192  */
193  switch( GetHorizJustify() )
194  {
196  if( IsMirrored() )
197  rect.SetX( rect.GetX() - rect.GetWidth() );
198  break;
199 
201  rect.SetX( rect.GetX() - (rect.GetWidth() / 2) );
202  break;
203 
205  if( !IsMirrored() )
206  rect.SetX( rect.GetX() - rect.GetWidth() );
207  break;
208  }
209 
210  dy = GetTextHeight() + thickness;
211 
212  switch( GetVertJustify() )
213  {
215  break;
216 
218  rect.SetY( rect.GetY() - ( dy / 2) );
219  break;
220 
222  rect.SetY( rect.GetY() - dy );
223  break;
224  }
225 
226  if( linecount > 1 )
227  {
228  int yoffset;
229  linecount -= 1;
230 
231  switch( GetVertJustify() )
232  {
234  break;
235 
237  yoffset = linecount * GetInterline() / 2;
238  rect.SetY( rect.GetY() - yoffset );
239  break;
240 
242  yoffset = linecount * GetInterline( aThickness );
243  rect.SetY( rect.GetY() - yoffset );
244  break;
245  }
246  }
247 
248  rect.Normalize(); // Make h and v sizes always >= 0
249 
250  return rect;
251 }
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Function wxStringSplit splits aString to a string list separated at aSplitter.
Definition: common.cpp:138
int GetInterline(int aTextThickness=-1) const
Return the distance between two lines of text.
Definition: eda_text.cpp:94
void Move(const wxPoint &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
bool IsMultilineAllowed() const
Definition: eda_text.h:186
const wxPoint & GetTextPos() const
Definition: eda_text.h:222
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
VECTOR2D ComputeStringBoundaryLimits(const UTF8 &aText, const VECTOR2D &aGlyphSize, double aGlyphThickness) const
Compute the boundary limits of aText (the bounding box of all shapes).
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:124
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:188
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:152
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:133
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
void SetX(int val)
Definition: eda_rect.h:130
void SetY(int val)
Definition: eda_rect.h:131
void Normalize()
Function Normalize ensures that the height ant width are positive.
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:189
void SetSize(const wxSize &size)
Definition: eda_rect.h:126
#define max(a, b)
Definition: auxiliary.h:86
bool IsMirrored() const
Definition: eda_text.h:177
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetX() const
Definition: eda_rect.h:109
double ComputeOverbarVerticalPosition(double aGlyphHeight, double aGlyphThickness) const
Compute the vertical position of an overbar, sometimes used in texts.
int GetWidth() const
Definition: eda_rect.h:117
int GetY() const
Definition: eda_rect.h:110
int GetTextHeight() const
Definition: eda_text.h:219
BASIC_GAL basic_gal(basic_displayOptions)
const wxSize & GetTextSize() const
Definition: eda_text.h:213
const STROKE_FONT & GetStrokeFont() const
const wxPoint& EDA_TEXT::GetTextPos ( ) const
inline

Definition at line 222 of file eda_text.h.

Referenced by CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), CINFO3D_VISU::AddShapeWithClearanceToContainer(), LIB_TEXT::BeginEdit(), LIB_FIELD::BeginEdit(), PCB_EDIT_FRAME::BeginMoveDimensionText(), LIB_TEXT::compare(), LIB_FIELD::compare(), SCH_SHEET_PIN::ConstrainOnEdge(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel(), DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), SCH_LABEL::doIsConnected(), SCH_GLOBALLABEL::doIsConnected(), SCH_HIERLABEL::doIsConnected(), SCH_TEXT::Draw(), SCH_FIELD::Draw(), KIGFX::WORKSHEET_VIEWITEM::draw(), TEXTE_MODULE::Draw(), KIGFX::PCB_PAINTER::draw(), Draw(), SCH_GLOBALLABEL::Draw(), SCH_HIERLABEL::Draw(), WS_DRAW_ITEM_LIST::Draw(), LIB_FIELD::drawGraphic(), TEXTE_MODULE::DrawUmbilical(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::EditSpiceModel(), export_vrml_pcbtext(), export_vrml_text_module(), TEXTE_PCB::Flip(), TEXTE_MODULE::Flip(), PCB_EDIT_FRAME::FlipTextePcb(), PCB_IO::format(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), TEXTE_PCB::GetBoundingBox(), TEXTE_MODULE::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), SCH_GLOBALLABEL::GetBoundingBox(), SCH_HIERLABEL::GetBoundingBox(), SCH_TEXT::GetConnectionPoints(), SCH_TEXT::GetEndPoints(), SCH_SHEET_PIN::GetEndPoints(), SCH_FIELD::GetLibPosition(), SCH_TEXT::GetNetListItem(), TEXTE_PCB::GetPosition(), TEXTE_MODULE::GetPosition(), DIMENSION::GetPosition(), LIB_TEXT::GetPosition(), SCH_FIELD::GetPosition(), SCH_TEXT::GetPosition(), LIB_FIELD::GetPosition(), GetPositionsOfLinesOfMultilineText(), GetTextBox(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), WS_DRAW_ITEM_TEXT::HitTestStartPoint(), SCH_TEXT::IsDanglingStateChanged(), SCH_TEXT::IsSelectStateChanged(), MarkItemsInBloc(), TEXTE_MODULE::Mirror(), DIMENSION::Mirror(), LIB_TEXT::MirrorHorizontal(), LIB_FIELD::MirrorHorizontal(), LIB_TEXT::MirrorVertical(), LIB_FIELD::MirrorVertical(), SCH_TEXT::MirrorX(), SCH_SHEET_PIN::MirrorX(), SCH_LABEL::MirrorX(), SCH_GLOBALLABEL::MirrorX(), SCH_HIERLABEL::MirrorX(), SCH_COMPONENT::MirrorX(), SCH_TEXT::MirrorY(), SCH_SHEET_PIN::MirrorY(), SCH_GLOBALLABEL::MirrorY(), SCH_HIERLABEL::MirrorY(), SCH_COMPONENT::MirrorY(), DIALOG_FOOTPRINT_FP_EDITOR::OnEditReference(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditReference(), DIALOG_FOOTPRINT_FP_EDITOR::OnEditValue(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditValue(), PCB_PARSER::parseDIMENSION(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_EDIT_FRAME::PlaceDimensionText(), DRAWING_TOOL::PlaceDXF(), PCB_BASE_FRAME::PlaceTexteModule(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotTextePcb(), BRDITEMS_PLOTTER::PlotTextModule(), PlotWorkSheet(), TEXTE_PCB::Rotate(), TEXTE_MODULE::Rotate(), LIB_TEXT::Rotate(), SCH_FIELD::Rotate(), SCH_TEXT::Rotate(), SCH_SHEET_PIN::Rotate(), DIMENSION::Rotate(), LIB_FIELD::Rotate(), SCH_LABEL::Rotate(), SCH_GLOBALLABEL::Rotate(), SCH_HIERLABEL::Rotate(), SCH_COMPONENT::Rotate(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SCREEN::SetComponentFootprint(), TEXTE_MODULE::SetDrawCoord(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), TEXTE_MODULE::SetLocalCoord(), SCH_COMPONENT::SetRef(), PCB_BASE_FRAME::StartMoveTexteModule(), PCB_EDIT_FRAME::StartMoveTextePcb(), TEXTE_MODULE::TextHitTest(), TextHitTest(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), TransformTextShapeToSegmentList(), and TEXTE_MODULE::ViewBBox().

222 { return m_e.pos; }
TEXT_EFFECTS m_e
Definition: eda_text.h:366
wxPoint pos
Definition: eda_text.h:98
const wxSize& EDA_TEXT::GetTextSize ( void  ) const
inline

Definition at line 213 of file eda_text.h.

Referenced by CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), CINFO3D_VISU::AddShapeWithClearanceToContainer(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel(), SCH_GLOBALLABEL::CreateGraphicShape(), MWAVE::CreateMicrowaveInductor(), SCH_EDIT_FRAME::CreateSheetPin(), SCH_TEXT::Draw(), SCH_FIELD::Draw(), TEXTE_MODULE::Draw(), SCH_GLOBALLABEL::Draw(), SCH_HIERLABEL::Draw(), DRAWING_TOOL::DrawDimension(), LIB_TEXT::drawGraphic(), LIB_FIELD::drawGraphic(), drawOneLineOfText(), PCB_EDIT_FRAME::EditDimension(), export_vrml_pcbtext(), export_vrml_text_module(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), LIB_TEXT::GetPenSize(), SCH_FIELD::GetPenSize(), SCH_TEXT::GetPenSize(), SCH_GLOBALLABEL::GetSchematicTextOffset(), GetTextBox(), LenSize(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), EAGLE_PLUGIN::loadPlain(), SCH_EDIT_FRAME::OnConvertTextType(), DIALOG_DIMENSION_EDITOR::OnOKClick(), EAGLE_PLUGIN::orientModuleText(), DRAWING_TOOL::PlaceDXF(), LIB_TEXT::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), LIB_FIELD::Plot(), BRDITEMS_PLOTTER::PlotTextePcb(), BRDITEMS_PLOTTER::PlotTextModule(), PlotWorkSheet(), PCB_BASE_FRAME::ResetModuleTextSizes(), PCB_BASE_FRAME::ResetTextSize(), SCH_SCREEN::SetComponentFootprint(), KIGFX::GAL::SetTextAttributes(), DIALOG_EDIT_FPTEXT::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), and TransformTextShapeToSegmentList().

213 { return m_e.size; };
TEXT_EFFECTS m_e
Definition: eda_text.h:366
wxSize size
Definition: eda_text.h:95
wxString EDA_TEXT::GetTextStyleName ( )

Function GetTextStyleName.

Returns
a wxString with the style name( Normal, Italic, Bold, Bold+Italic)

Definition at line 380 of file eda_text.cpp.

References IsBold(), and IsItalic().

Referenced by LIB_FIELD::GetMsgPanelInfo().

381 {
382  int style = 0;
383 
384  if( IsItalic() )
385  style = 1;
386 
387  if( IsBold() )
388  style += 2;
389 
390  wxString stylemsg[4] = {
391  _("Normal"),
392  _("Italic"),
393  _("Bold"),
394  _("Bold+Italic")
395  };
396 
397  return stylemsg[style];
398 }
bool IsItalic() const
Definition: eda_text.h:168
bool IsBold() const
Definition: eda_text.h:171
int EDA_TEXT::GetThickness ( ) const
inline

Function GetThickness returns pen width.

Definition at line 152 of file eda_text.h.

Referenced by CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), CINFO3D_VISU::AddShapeWithClearanceToContainer(), DIMENSION::AdjustDimensionDetails(), SCH_GLOBALLABEL::CreateGraphicShape(), SCH_TEXT::Draw(), SCH_FIELD::Draw(), KIGFX::WORKSHEET_VIEWITEM::draw(), TEXTE_MODULE::Draw(), KIGFX::PCB_PAINTER::draw(), SCH_GLOBALLABEL::Draw(), SCH_HIERLABEL::Draw(), drawOneLineOfText(), export_vrml_pcbtext(), export_vrml_text_module(), Format(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), SCH_GLOBALLABEL::GetBoundingBox(), SCH_HIERLABEL::GetBoundingBox(), GetInterline(), TEXTE_PCB::GetMsgPanelInfo(), LIB_TEXT::GetMsgPanelInfo(), TEXTE_MODULE::GetMsgPanelInfo(), LIB_TEXT::GetPenSize(), SCH_FIELD::GetPenSize(), LIB_FIELD::GetPenSize(), SCH_TEXT::GetPenSize(), SCH_GLOBALLABEL::GetSchematicTextOffset(), SCH_HIERLABEL::GetSchematicTextOffset(), GetTextBox(), LIB_TEXT::GetWidth(), LIB_FIELD::GetWidth(), IsDefaultFormatting(), SCH_EDIT_FRAME::OnConvertTextType(), DRAWING_TOOL::PlaceDXF(), BRDITEMS_PLOTTER::PlotTextePcb(), BRDITEMS_PLOTTER::PlotTextModule(), PCB_BASE_FRAME::ResetModuleTextSizes(), PCB_BASE_FRAME::ResetTextSize(), SCH_LEGACY_PLUGIN::saveText(), DRC::testTexts(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_FPTEXT::TransferDataToWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), and TransformTextShapeToSegmentList().

152 { return m_e.penwidth; };
TEXT_EFFECTS m_e
Definition: eda_text.h:366
int penwidth
Definition: eda_text.h:96
bool EDA_TEXT::IsDefaultFormatting ( ) const

Definition at line 401 of file eda_text.cpp.

References GetHorizJustify(), GetThickness(), GetVertJustify(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, IsBold(), IsItalic(), IsMirrored(), IsMultilineAllowed(), and IsVisible().

402 {
403  return ( IsVisible()
404  && !IsMirrored()
407  && GetThickness() == 0
408  && !IsItalic()
409  && !IsBold()
410  && !IsMultilineAllowed()
411  );
412 }
bool IsMultilineAllowed() const
Definition: eda_text.h:186
bool IsItalic() const
Definition: eda_text.h:168
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:188
bool IsBold() const
Definition: eda_text.h:171
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:152
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:189
bool IsMirrored() const
Definition: eda_text.h:177
bool IsVisible() const
Definition: eda_text.h:174
bool EDA_TEXT::IsItalic ( ) const
inline

Definition at line 168 of file eda_text.h.

Referenced by CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), CINFO3D_VISU::AddShapeWithClearanceToContainer(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel(), SCH_EDIT_FRAME::CreateNewText(), DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD(), SCH_FIELD::Draw(), TEXTE_MODULE::Draw(), LIB_TEXT::drawGraphic(), LIB_FIELD::drawGraphic(), drawOneLineOfText(), export_vrml_pcbtext(), export_vrml_text_module(), Format(), SCH_TEXT::GetMsgPanelInfo(), GetTextStyleName(), hash_eda(), DIALOG_LABEL_EDITOR::InitDialog(), DIALOG_LIB_EDIT_TEXT::initDlg(), IsDefaultFormatting(), LenSize(), SCH_EDIT_FRAME::OnConvertTextType(), DRAWING_TOOL::PlaceDXF(), LIB_TEXT::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), LIB_FIELD::Plot(), BRDITEMS_PLOTTER::PlotTextePcb(), BRDITEMS_PLOTTER::PlotTextModule(), PlotWorkSheet(), SCH_LEGACY_PLUGIN::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), KIGFX::GAL::SetTextAttributes(), DIALOG_EDIT_FPTEXT::TransferDataToWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), and TransformTextShapeToSegmentList().

168 { return m_e.Bit( TE_ITALIC ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:366
void Bit(int aBit, bool aValue)
Definition: eda_text.h:100
int EDA_TEXT::LenSize ( const wxString &  aLine) const

Function LenSize.

Returns
the text length in internal units
Parameters
aLine: the line of text to consider. For single line text, this parameter is always m_Text

Definition at line 67 of file eda_text.cpp.

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

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

68 {
72 
73  VECTOR2D tsize = basic_gal.GetTextLineSize( aLine );
74 
75  return KiROUND( tsize.x );
76 }
void SetFontItalic(const bool aItalic)
Set italic property of current font.
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
bool IsItalic() const
Definition: eda_text.h:168
bool IsBold() const
Definition: eda_text.h:171
void SetFontBold(const bool aBold)
Set bold property of current font.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
void SetGlyphSize(const VECTOR2D aGlyphSize)
Set the font glyph size.
BASIC_GAL basic_gal(basic_displayOptions)
const wxSize & GetTextSize() const
Definition: eda_text.h:213
VECTOR2D GetTextLineSize(const UTF8 &aText) const
Compute the X and Y size of a given text.
void EDA_TEXT::SetEffects ( const EDA_TEXT aSrc)

Function SetEffects sets 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 55 of file eda_text.cpp.

References m_e.

Referenced by LIB_TEXT::Clone(), LIB_FIELD::Copy(), SCH_FIELD::ExportValues(), SCH_FIELD::ImportValues(), LIB_FIELD::operator=(), and TEXTE_MODULE::SetEffects().

56 {
57  m_e = aSrc.m_e;
58 }
TEXT_EFFECTS m_e
Definition: eda_text.h:366
void EDA_TEXT::SetMultilineAllowed ( bool  aAllow)
inline

Function SetMultiLineAllowed.

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

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), DRAWING_TOOL::PlaceDXF(), SCH_GLOBALLABEL::SCH_GLOBALLABEL(), SCH_HIERLABEL::SCH_HIERLABEL(), SCH_LABEL::SCH_LABEL(), SCH_TEXT::SCH_TEXT(), WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize(), and TEXTE_PCB::TEXTE_PCB().

185 { m_e.Bit( TE_MULTILINE, aAllow ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:366
void Bit(int aBit, bool aValue)
Definition: eda_text.h:100
virtual void EDA_TEXT::SetText ( const wxString &  aText)
inlinevirtual

Reimplemented in LIB_FIELD, and LIB_TEXT.

Definition at line 139 of file eda_text.h.

Referenced by SCH_EAGLE_PLUGIN::addImplicitConnections(), DXF2BRD_CONVERTER::addMText(), DXF2BRD_CONVERTER::addText(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), SCH_EDIT_FRAME::backAnnotateFootprints(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField(), SCH_EDIT_FRAME::EditSheetPin(), SCH_FIELD::GetBoundingBox(), LIB_FIELD::HitTest(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers(), SCH_EDIT_FRAME::Load_Component(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), TUNER_SLIDER::onSave(), EAGLE_PLUGIN::orientModuleText(), EAGLE_PLUGIN::packageText(), DRAWING_TOOL::PlaceDXF(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile(), SCH_COMPONENT::SCH_COMPONENT(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SCREEN::SetComponentFootprint(), SCH_COMPONENT::SetRef(), DIMENSION::SetText(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), DIALOG_EDIT_FPTEXT::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SPICE_MODEL::TransferDataFromWindow(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), DIALOG_UPDATE_FIELDS::updateFields(), and SCH_COMPONENT::UpdateFields().

139 { m_Text = aText; }
wxString m_Text
Definition: eda_text.h:344
void EDA_TEXT::SetTextHeight ( int  aHeight)
inline

Definition at line 218 of file eda_text.h.

Referenced by DXF2BRD_CONVERTER::addMText(), DXF2BRD_CONVERTER::addText(), LIB_FIELD::Init(), and DIALOG_DIMENSION_EDITOR::OnOKClick().

218 { m_e.size.y = aHeight; }
TEXT_EFFECTS m_e
Definition: eda_text.h:366
wxSize size
Definition: eda_text.h:95
void EDA_TEXT::SetTextPos ( const wxPoint aPoint)
inline

Definition at line 221 of file eda_text.h.

Referenced by AbortMoveDimensionText(), DXF2BRD_CONVERTER::addMText(), DXF2BRD_CONVERTER::addText(), PCAD2KICAD::PCB_TEXT::AddToBoard(), DIMENSION::AdjustDimensionDetails(), LIB_TEXT::BeginEdit(), LIB_FIELD::BeginEdit(), LIB_TEXT::calcEdit(), LIB_FIELD::calcEdit(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField(), PCB_EDIT_FRAME::CreateTextePcb(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), DIMENSION::Mirror(), SCH_COMPONENT::MirrorX(), SCH_COMPONENT::MirrorY(), LIB_TEXT::Move(), LIB_FIELD::Move(), Move_Texte_Pcb(), MoveDimensionText(), DIALOG_DIMENSION_EDITOR::OnOKClick(), EAGLE_PLUGIN::orientModuleText(), EAGLE_PLUGIN::packageText(), PCB_EDIT_FRAME::PlaceDimensionText(), DRAWING_TOOL::PlaceDXF(), DRAWING_TOOL::PlaceText(), PCB_BASE_FRAME::PlaceTexteModule(), TEXTE_PCB::Rotate(), TEXTE_MODULE::Rotate(), LIB_TEXT::Rotate(), SCH_FIELD::Rotate(), SCH_TEXT::Rotate(), SCH_SHEET_PIN::Rotate(), DIMENSION::Rotate(), LIB_FIELD::Rotate(), SCH_LABEL::Rotate(), SCH_GLOBALLABEL::Rotate(), SCH_HIERLABEL::Rotate(), SCH_COMPONENT::Rotate(), SCH_FIELD::SCH_FIELD(), SCH_SHEET_PIN::SCH_SHEET_PIN(), SCH_TEXT::SCH_TEXT(), SCH_SCREEN::SetComponentFootprint(), TEXTE_MODULE::SetDrawCoord(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), TEXTE_PCB::SetPosition(), TEXTE_MODULE::SetPosition(), DIMENSION::SetPosition(), SCH_FIELD::SetPosition(), SCH_TEXT::SetPosition(), SCH_COMPONENT::SetRef(), TEXTE_MODULE::TEXTE_MODULE(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), SCH_COMPONENT::UpdateFields(), and WS_DRAW_ITEM_TEXT::WS_DRAW_ITEM_TEXT().

221 { m_e.pos = aPoint; }
TEXT_EFFECTS m_e
Definition: eda_text.h:366
wxPoint pos
Definition: eda_text.h:98
void EDA_TEXT::SetTextSize ( const wxSize &  aNewSize)
inline

Definition at line 212 of file eda_text.h.

Referenced by SCH_EAGLE_PLUGIN::addImplicitConnections(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField(), LIB_EDIT_FRAME::CreateGraphicItem(), PCB_EDIT_FRAME::CreateMuWaveBaseFootprint(), PCB_BASE_FRAME::CreateNewModule(), SCH_EDIT_FRAME::CreateNewText(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), DRAWING_TOOL::DrawDimension(), DrawGraphicText(), dummy(), EDA_TEXT(), PCB_EDIT_FRAME::EditDimension(), SCH_EDIT_FRAME::EditSheetPin(), SCH_EDIT_FRAME::ImportSheetPin(), LIB_TEXT::LIB_TEXT(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), SCH_EAGLE_PLUGIN::loadTextAttributes(), SCH_EDIT_FRAME::OnConvertTextType(), DIALOG_LIB_EDIT_TEXT::OnOkClick(), EAGLE_PLUGIN::orientModuleText(), EAGLE_PLUGIN::packageText(), PCB_PARSER::parseEDA_TEXT(), DRAWING_TOOL::PlaceDXF(), DRAWING_TOOL::PlaceText(), PCB_BASE_FRAME::ResetModuleTextSizes(), PCB_BASE_FRAME::ResetTextSize(), SCH_SCREEN::SetComponentFootprint(), DIMENSION::SetTextSize(), PCAD2KICAD::SetTextSizeFromStrokeFontHeight(), PCAD2KICAD::SetTextSizeFromTrueTypeFontHeight(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), DIALOG_EDIT_FPTEXT::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_ONE_FIELD::updateText(), and WS_DRAW_ITEM_TEXT::WS_DRAW_ITEM_TEXT().

212 { m_e.size = aNewSize; };
TEXT_EFFECTS m_e
Definition: eda_text.h:366
wxSize size
Definition: eda_text.h:95
void EDA_TEXT::SetTextWidth ( int  aWidth)
inline

Definition at line 215 of file eda_text.h.

Referenced by DXF2BRD_CONVERTER::addMText(), DXF2BRD_CONVERTER::addText(), LIB_FIELD::Init(), and DIALOG_DIMENSION_EDITOR::OnOKClick().

215 { m_e.size.x = aWidth; }
TEXT_EFFECTS m_e
Definition: eda_text.h:366
wxSize size
Definition: eda_text.h:95
wxString EDA_TEXT::ShortenedShownText ( ) const

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

Definition at line 79 of file eda_text.cpp.

References GetShownText().

Referenced by LIB_TEXT::GetSelectMenuText(), TEXTE_PCB::GetSelectMenuText(), SCH_TEXT::GetSelectMenuText(), SCH_SHEET_PIN::GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), LIB_FIELD::GetSelectMenuText(), SCH_LABEL::GetSelectMenuText(), SCH_GLOBALLABEL::GetSelectMenuText(), and SCH_HIERLABEL::GetSelectMenuText().

80 {
81  wxString tmp = GetShownText();
82 
83  tmp.Replace( wxT( "\n" ), wxT( " " ) );
84  tmp.Replace( wxT( "\r" ), wxT( " " ) );
85  tmp.Replace( wxT( "\t" ), wxT( " " ) );
86 
87  if( tmp.Length() > 15 )
88  tmp = tmp.Left( 12 ) + wxT( "..." );
89 
90  return tmp;
91 }
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:133
void EDA_TEXT::SwapEffects ( EDA_TEXT aTradingPartner)

Function SwapEffects swaps the text effects of the two involved instances.

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

Definition at line 61 of file eda_text.cpp.

References m_e.

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

62 {
63  std::swap( m_e, aTradingPartner.m_e );
64 }
TEXT_EFFECTS m_e
Definition: eda_text.h:366
bool EDA_TEXT::TextHitTest ( const wxPoint aPoint,
int  aAccuracy = 0 
) const
virtual

Function TextHitTest Test if aPoint is within the bounds of this object.

Parameters
aPoint-A wxPoint to test
aAccuracy- Amount to inflate the bounding box.
Returns
bool - true if a hit, else false

Reimplemented in TEXTE_MODULE.

Definition at line 254 of file eda_text.cpp.

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

Referenced by LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), DIMENSION::HitTest(), and WS_DRAW_ITEM_TEXT::HitTest().

255 {
256  EDA_RECT rect = GetTextBox( -1 ); // Get the full text area.
257  wxPoint location = aPoint;
258 
259  rect.Inflate( aAccuracy );
260  RotatePoint( &location, GetTextPos(), -GetTextAngle() );
261 
262  return rect.Contains( location );
263 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:222
bool Contains(const wxPoint &aPoint) const
Function Contains.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
double GetTextAngle() const
Definition: eda_text.h:162
EDA_RECT GetTextBox(int aLine=-1, int aThickness=-1, bool aInvertY=false) const
Function GetTextBox useful in multiline texts to calculate the full text or a line area (for zones fi...
Definition: eda_text.cpp:102
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
bool EDA_TEXT::TextHitTest ( const EDA_RECT aRect,
bool  aContains = false,
int  aAccuracy = 0 
) const
virtual

Function TextHitTest (overloaded) Tests if object bounding box is contained within or intersects aRect.

Parameters
aRect- Rect to test against.
aContains- Test for containment instead of intersection if true.
aAccuracy- Amount to inflate the bounding box.
Returns
bool - true if a hit, else false

Reimplemented in TEXTE_MODULE.

Definition at line 266 of file eda_text.cpp.

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

267 {
268  EDA_RECT rect = aRect;
269 
270  rect.Inflate( aAccuracy );
271 
272  if( aContains )
273  return rect.Contains( GetTextBox( -1 ) );
274 
275  return rect.Intersects( GetTextBox( -1 ), GetTextAngle() );
276 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
double GetTextAngle() const
Definition: eda_text.h:162
EDA_RECT GetTextBox(int aLine=-1, int aThickness=-1, bool aInvertY=false) const
Function GetTextBox useful in multiline texts to calculate the full text or a line area (for zones fi...
Definition: eda_text.cpp:102
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
void EDA_TEXT::TransformTextShapeToSegmentList ( std::vector< wxPoint > &  aCornerBuffer) const

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.

Parameters
aCornerBuffer= a buffer to store the polygon

Definition at line 479 of file eda_text.cpp.

References addTextSegmToBuffer(), BLACK, color, DrawGraphicText(), GetHorizJustify(), GetPositionsOfLinesOfMultilineText(), GetShownText(), GetText(), GetTextAngle(), GetTextPos(), GetTextSize(), GetThickness(), GetVertJustify(), IsItalic(), IsMirrored(), IsMultilineAllowed(), and wxStringSplit().

Referenced by DRC::testTexts().

480 {
481  wxSize size = GetTextSize();
482 
483  if( IsMirrored() )
484  size.x = -size.x;
485 
486  COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by DrawGraphicText
487 
488  if( IsMultilineAllowed() )
489  {
490  wxArrayString strings_list;
491  wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
492  std::vector<wxPoint> positions;
493  positions.reserve( strings_list.Count() );
494  GetPositionsOfLinesOfMultilineText( positions,strings_list.Count() );
495 
496  for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
497  {
498  wxString txt = strings_list.Item( ii );
499  DrawGraphicText( NULL, NULL, positions[ii], color,
500  txt, GetTextAngle(), size,
502  GetThickness(), IsItalic(),
503  true, addTextSegmToBuffer, &aCornerBuffer );
504  }
505  }
506  else
507  {
508  DrawGraphicText( NULL, NULL, GetTextPos(), color,
509  GetText(), GetTextAngle(), size,
511  GetThickness(), IsItalic(),
512  true, addTextSegmToBuffer, &aCornerBuffer );
513  }
514 }
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Function wxStringSplit splits aString to a string list separated at aSplitter.
Definition: common.cpp:138
bool IsMultilineAllowed() const
Definition: eda_text.h:186
const wxPoint & GetTextPos() const
Definition: eda_text.h:222
bool IsItalic() const
Definition: eda_text.h:168
int color
Definition: DXF_plotter.cpp:62
static void addTextSegmToBuffer(int x0, int y0, int xf, int yf, void *aData)
Definition: eda_text.cpp:472
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:188
void DrawGraphicText(EDA_RECT *aClipBox, 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 DrawGraphicText Draw a graphic text (like module texts)
double GetTextAngle() const
Definition: eda_text.h:162
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:152
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:133
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
void GetPositionsOfLinesOfMultilineText(std::vector< wxPoint > &aPositions, int aLineCount) const
Function GetPositionsOfLinesOfMultilineText Populates aPositions with the position of each line of a ...
Definition: eda_text.cpp:314
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:189
bool IsMirrored() const
Definition: eda_text.h:177
Definition: colors.h:45
const wxSize & GetTextSize() const
Definition: eda_text.h:213
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

Member Data Documentation

TEXT_EFFECTS EDA_TEXT::m_e
private

Definition at line 366 of file eda_text.h.

Referenced by SetEffects(), and SwapEffects().


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