KiCad PCB EDA Suite
WS_DRAW_ITEM_TEXT Class Reference

#include <worksheet_shape_builder.h>

Inheritance diagram for WS_DRAW_ITEM_TEXT:
WS_DRAW_ITEM_BASE EDA_TEXT

Public Types

enum  WS_DRAW_TYPE {
  wsg_line, wsg_rect, wsg_poly, wsg_text,
  wsg_bitmap
}
 

Public Member Functions

 WS_DRAW_ITEM_TEXT (WORKSHEET_DATAITEM *aParent, wxString &aText, wxPoint aPos, wxSize aSize, int aPenWidth, COLOR4D aColor, bool aItalic=false, bool aBold=false)
 
virtual void DrawWsItem (EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
 The function to draw a WS_DRAW_ITEM_TEXT. More...
 
int GetPenWidth ()
 
void SetTextAngle (double aAngle)
 
virtual bool HitTest (const wxPoint &aPosition) const override
 Virtual function return true if the point aPosition is on the text. More...
 
virtual bool HitTest (const EDA_RECT &aRect) const override
 Virtual function return true if the rect aRect intersects on the item. More...
 
virtual bool HitTestStartPoint (const wxPoint &aPosition) override
 return true if the point aPosition is on the starting point of this item. More...
 
COLOR4D GetColor () const
 
WS_DRAW_TYPE GetType () const
 
WORKSHEET_DATAITEMGetParent () const
 
virtual void DrawWsItem (EDA_RECT *aClipBox, wxDC *aDC)
 The function to draw a WS_DRAW_ITEM. More...
 
virtual bool HitTestEndPoint (const wxPoint &aPosition)
 return true if the point aPosition is near the ending point of this item This is avirtual function which should be overriden for items defien by 2 points the maxi dist is WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 More...
 
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...
 
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...
 

Public Attributes

int m_Flags
 

Protected Attributes

WS_DRAW_TYPE m_type
 
COLOR4D m_color
 
WORKSHEET_DATAITEMm_parent
 
wxString m_Text
 

Detailed Description

Definition at line 284 of file worksheet_shape_builder.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

WS_DRAW_ITEM_TEXT::WS_DRAW_ITEM_TEXT ( WORKSHEET_DATAITEM aParent,
wxString &  aText,
wxPoint  aPos,
wxSize  aSize,
int  aPenWidth,
COLOR4D  aColor,
bool  aItalic = false,
bool  aBold = false 
)

Definition at line 177 of file page_layout_graphic_items.cpp.

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

180  :
181  WS_DRAW_ITEM_BASE( aParent, wsg_text, aColor ), EDA_TEXT( aText )
182 {
183  SetTextPos( aPos );
184  SetTextSize( aSize );
185  SetThickness( aPenWidth );
186  SetItalic( aItalic );
187  SetBold( aBold );
188 }
EDA_TEXT(const wxString &text=wxEmptyString)
Definition: eda_text.cpp:41
void SetItalic(bool isItalic)
Definition: eda_text.h:169
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:223
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:214
WS_DRAW_ITEM_BASE(WORKSHEET_DATAITEM *aParent, WS_DRAW_TYPE aType, COLOR4D aColor)
void SetBold(bool aBold)
Definition: eda_text.h:172
void SetThickness(int aNewThickness)
Function SetThickness sets pen width.
Definition: eda_text.h:148

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

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, EDA_TEXT::drawOneLineOfText(), EDA_TEXT::GetPositionsOfLinesOfMultilineText(), EDA_TEXT::GetShownText(), EDA_TEXT::GetTextPos(), GRDrawAnchor(), EDA_TEXT::IsMultilineAllowed(), wxStringSplit(), wxPoint::x, and wxPoint::y.

Referenced by TEXTE_PCB::Draw(), SCH_TEXT::Draw(), SCH_GLOBALLABEL::Draw(), SCH_HIERLABEL::Draw(), and 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:137
bool IsMultilineAllowed() const
Definition: eda_text.h:188
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
void GRDrawAnchor(EDA_RECT *aClipBox, wxDC *aDC, int x, int y, int aSize, COLOR4D aColor)
Definition: gr_basic.cpp:1266
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:135
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:75
virtual void WS_DRAW_ITEM_BASE::DrawWsItem ( EDA_RECT aClipBox,
wxDC *  aDC 
)
inlinevirtualinherited

The function to draw a WS_DRAW_ITEM.

Definition at line 91 of file worksheet_shape_builder.h.

References UNSPECIFIED_DRAWMODE.

92  {
93  wxPoint offset( 0, 0 );
94  DrawWsItem( aClipBox, aDC, offset, UNSPECIFIED_DRAWMODE, COLOR4D::UNSPECIFIED );
95  }
virtual void DrawWsItem(EDA_RECT *aClipBox, wxDC *aDC)
The function to draw a WS_DRAW_ITEM.
void WS_DRAW_ITEM_TEXT::DrawWsItem ( EDA_RECT aClipBox,
wxDC *  aDC,
const wxPoint aOffset,
GR_DRAWMODE  aDrawMode,
COLOR4D  aColor = COLOR4D::UNSPECIFIED 
)
overridevirtual

The function to draw a WS_DRAW_ITEM_TEXT.

Implements WS_DRAW_ITEM_BASE.

Definition at line 191 of file page_layout_graphic_items.cpp.

References EDA_TEXT::Draw(), FILLED, WS_DRAW_ITEM_BASE::GetColor(), GR_COPY, and UNSPECIFIED_DRAWMODE.

193 {
194  Draw( aClipBox, aDC, aOffset,
195  aColor == COLOR4D::UNSPECIFIED ? GetColor() : aColor,
196  aDrawMode == UNSPECIFIED_DRAWMODE ? GR_COPY : aDrawMode,
197  FILLED, COLOR4D::UNSPECIFIED );
198 }
COLOR4D GetColor() const
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.
Definition: eda_text.cpp:279
void EDA_TEXT::Empty ( )
inlineinherited

Definition at line 231 of file eda_text.h.

References EDA_TEXT::m_Text.

Referenced by SCH_LEGACY_PLUGIN_CACHE::loadPart().

231 { m_Text.Empty(); }
wxString m_Text
Definition: eda_text.h:346
void EDA_TEXT::Format ( OUTPUTFORMATTER aFormatter,
int  aNestLevel,
int  aControlBits 
) const
virtualinherited

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

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

418 {
419 #ifndef GERBVIEW // Gerbview does not use EDA_TEXT::Format
420  // and does not define FMT_IU, used here
421  // however this function should exist
422  if( !IsDefaultFormatting() )
423  {
424  aFormatter->Print( aNestLevel+1, "(effects" );
425 
426  if( ( GetTextWidth() != Mils2iu( DEFAULT_SIZE_TEXT ) )
427  || ( GetTextHeight() != Mils2iu( DEFAULT_SIZE_TEXT ) )
428  || ( GetThickness() != 0 ) || IsBold() || IsItalic() )
429  {
430  aFormatter->Print( 0, " (font" );
431 
432  // Add font support here at some point in the future.
433 
434  if( GetTextWidth() != Mils2iu( DEFAULT_SIZE_TEXT )
435  || GetTextHeight() != Mils2iu( DEFAULT_SIZE_TEXT ) )
436  {
437  aFormatter->Print( 0, " (size %s %s)",
438  FMT_IU( GetTextHeight() ).c_str(),
439  FMT_IU( GetTextWidth() ).c_str()
440  );
441  }
442 
443  if( GetThickness() )
444  aFormatter->Print( 0, " (thickness %s)", FMT_IU( GetThickness() ).c_str() );
445 
446  if( IsBold() )
447  aFormatter->Print( 0, " bold" );
448 
449  if( IsItalic() )
450  aFormatter->Print( 0, " italic" );
451 
452  aFormatter->Print( 0, ")");
453  }
454 
457  {
458  aFormatter->Print( 0, " (justify");
459 
461  aFormatter->Print( 0, (GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" );
462 
464  aFormatter->Print( 0, (GetVertJustify() == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" );
465 
466  if( IsMirrored() )
467  aFormatter->Print( 0, " mirror" );
468 
469  aFormatter->Print( 0, ")" );
470  }
471 
472  if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() )
473  aFormatter->Print( 0, " hide" );
474 
475  aFormatter->Print( 0, ")\n" );
476  }
477 #endif
478 }
#define DEFAULT_SIZE_TEXT
This is the "default-of-the-default" hardcoded text size; individual application define their own def...
Definition: eda_text.h:74
bool IsItalic() const
Definition: eda_text.h:170
int GetTextWidth() const
Definition: eda_text.h:218
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:190
bool IsBold() const
Definition: eda_text.h:173
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:154
bool IsDefaultFormatting() const
Definition: eda_text.cpp:401
#define FMT_IU
Abbrevation for fomatting internal units to a string.
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:191
bool IsMirrored() const
Definition: eda_text.h:179
bool IsVisible() const
Definition: eda_text.h:176
int GetTextHeight() const
Definition: eda_text.h:221
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
inlineinherited

Definition at line 190 of file eda_text.h.

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

Referenced by CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), CINFO3D_VISU::AddShapeWithClearanceToContainer(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel(), DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD(), TEXTE_MODULE::Draw(), LIB_FIELD::drawGraphic(), EDA_TEXT::drawOneLineOfText(), export_vrml_pcbtext(), export_vrml_text_module(), AUTOPLACER::field_horiz_placement(), EDA_TEXT::Format(), EDA_TEXT::GetTextBox(), hash_eda(), DIALOG_LIB_EDIT_TEXT::initDlg(), EDA_TEXT::IsDefaultFormatting(), SCH_FIELD::IsHorizJustifyFlipped(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), LEGACY_PLUGIN::loadPCB_TEXT(), DRAWING_TOOL::PlaceDXF(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotTextePcb(), BRDITEMS_PLOTTER::PlotTextModule(), PlotWorkSheet(), SCH_LEGACY_PLUGIN::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), KIGFX::GAL::SetTextAttributes(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(), and EDA_TEXT::TransformTextShapeToSegmentList().

190 { return EDA_TEXT_HJUSTIFY_T( m_e.hjustify ); };
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:47
TEXT_EFFECTS m_e
Definition: eda_text.h:368
signed char hjustify
horizontal justification
Definition: eda_text.h:95
int EDA_TEXT::GetInterline ( int  aTextThickness = -1) 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.

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(), EDA_TEXT::GetTextHeight(), EDA_TEXT::GetThickness(), and KiROUND().

Referenced by EDA_TEXT::GetPositionsOfLinesOfMultilineText(), and EDA_TEXT::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:154
int GetTextHeight() const
Definition: eda_text.h:221
WORKSHEET_DATAITEM* WS_DRAW_ITEM_BASE::GetParent ( void  ) const
inlineinherited
int WS_DRAW_ITEM_TEXT::GetPenWidth ( )
inline

Definition at line 298 of file worksheet_shape_builder.h.

References EDA_TEXT::GetThickness().

Referenced by PlotWorkSheet().

298 { return GetThickness(); }
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:154
void EDA_TEXT::GetPositionsOfLinesOfMultilineText ( std::vector< wxPoint > &  aPositions,
int  aLineCount 
) const
inherited

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 EDA_TEXT::GetInterline(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetVertJustify(), GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, RotatePoint(), and wxPoint::y.

Referenced by CINFO3D_VISU::AddShapeWithClearanceToContainer(), EDA_TEXT::Draw(), export_vrml_pcbtext(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotTextePcb(), TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(), and EDA_TEXT::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:224
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
double GetTextAngle() const
Definition: eda_text.h:164
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:191
const wxString& EDA_TEXT::GetText ( ) const
inlineinherited

Function GetText returns the string associated with the text object.

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

Definition at line 130 of file eda_text.h.

References EDA_TEXT::m_Text.

Referenced by NETLIST_EXPORTER_GENERIC::addComponentFields(), AddMenusForComponent(), AddMenusForText(), SIM_PLOT_FRAME::AddTuner(), SCH_EDIT_FRAME::backAnnotateFootprints(), SCH_SHEET::CleanupSheet(), CMP_TREE_NODE_LIB_ID::CMP_TREE_NODE_LIB_ID(), 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(), LIB_EDIT_FRAME::EditField(), SCH_EDIT_FRAME::EditSheetPin(), PCB_IO::format(), FormatProbeItem(), LIB_FIELD::GetFullText(), SCH_COMPONENT::GetRef(), MODULE::GetReference(), NETLIST_EXPORTER_PSPICE::GetSpiceField(), NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal(), DIMENSION::GetText(), MODULE::GetValue(), hash_eda(), SCH_SHEET::HasUndefinedPins(), LIB_FIELD::HitTest(), SCH_EDIT_FRAME::ImportSheetPin(), DIALOG_LABEL_EDITOR::InitDialog(), DIALOG_LIB_EDIT_TEXT::initDlg(), DIALOG_MODULE_MODULE_EDITOR::initModeditProperties(), DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties(), GENERAL_COLLECTOR::Inspect(), SCH_COMPONENT::IsInNetlist(), SCH_SCREEN::IsTerminalPoint(), SCH_EDIT_FRAME::Load_Component(), LEGACY_PLUGIN::loadPCB_TEXT(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::moveUpButtonHandler(), SCH_EDIT_FRAME::OnConvertTextType(), DIALOG_MODULE_MODULE_EDITOR::OnEditReference(), DIALOG_MODULE_BOARD_EDITOR::OnEditReference(), DIALOG_MODULE_MODULE_EDITOR::OnEditValue(), DIALOG_MODULE_BOARD_EDITOR::OnEditValue(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), SCH_COMPONENT::operator==(), PlaceCells(), DRAWING_TOOL::PlaceDXF(), DRAWING_TOOL::PlaceText(), 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(), BOM_TABLE_MODEL::SetComponents(), 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(), DialogEditModuleText::TransferDataToWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow(), TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(), EDA_TEXT::TransformTextShapeToSegmentList(), TUNER_SLIDER::TUNER_SLIDER(), DIALOG_UPDATE_FIELDS::updateFields(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_CADSTAR::WriteNetlist().

130 { return m_Text; }
wxString m_Text
Definition: eda_text.h:346
double EDA_TEXT::GetTextAngle ( ) const
inlineinherited

Definition at line 164 of file eda_text.h.

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

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(), EDA_TEXT::drawOneLineOfText(), export_vrml_pcbtext(), TEXTE_MODULE::Flip(), PCB_IO::format(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), TEXTE_PCB::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), TEXTE_MODULE::GetDrawRotation(), TEXTE_PCB::GetMsgPanelInfo(), EDA_TEXT::GetPositionsOfLinesOfMultilineText(), EDA_TEXT::GetTextAngleDegrees(), EDA_TEXT::GetTextAngleRadians(), 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(), EDA_TEXT::TextHitTest(), DialogEditModuleText::TransferDataFromWindow(), DialogEditModuleText::TransferDataToWindow(), TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(), TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(), and EDA_TEXT::TransformTextShapeToSegmentList().

164 { return m_e.angle; }
TEXT_EFFECTS m_e
Definition: eda_text.h:368
double angle
now: 0.1 degrees; future: degrees
Definition: eda_text.h:99
double EDA_TEXT::GetTextAngleDegrees ( ) const
inlineinherited

Definition at line 166 of file eda_text.h.

References EDA_TEXT::GetTextAngle().

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

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

Definition at line 167 of file eda_text.h.

References EDA_TEXT::GetTextAngle().

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

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

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(), EDA_TEXT::GetHorizJustify(), EDA_TEXT::GetInterline(), EDA_TEXT::GetShownText(), KIGFX::GAL::GetStrokeFont(), EDA_TEXT::GetTextHeight(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetThickness(), 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(), 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(), TEXTE_PCB::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), TEXTE_MODULE::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), DIMENSION::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), PlaceCells(), WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize(), TEXTE_MODULE::TextHitTest(), EDA_TEXT::TextHitTest(), TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(), 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:137
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:188
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
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
void SetOrigin(const wxPoint &pos)
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:190
VECTOR2D ComputeStringBoundaryLimits(const UTF8 &aText, VECTOR2D aGlyphSize, double aGlyphThickness, double *aTopLimit=NULL, double *aBottomLimit=NULL) const
Compute the boundary limits of aText (the bbox of all shapes).
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:154
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:135
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
void SetX(int val)
void SetY(int val)
void Normalize()
Function Normalize ensures that the height ant width are positive.
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:191
void SetSize(const wxSize &size)
#define max(a, b)
Definition: auxiliary.h:86
bool IsMirrored() const
Definition: eda_text.h:179
Class EDA_RECT handles the component boundary box.
int GetX() const
double ComputeOverbarVerticalPosition(double aGlyphHeight, double aGlyphThickness) const
Compute the vertical position of an overbar, sometimes used in texts.
int GetWidth() const
int GetY() const
int GetTextHeight() const
Definition: eda_text.h:221
BASIC_GAL basic_gal(basic_displayOptions)
const wxSize & GetTextSize() const
Definition: eda_text.h:215
const STROKE_FONT & GetStrokeFont() const
const wxPoint& EDA_TEXT::GetTextPos ( ) const
inlineinherited

Definition at line 224 of file eda_text.h.

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

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(), EDA_TEXT::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(), TEXTE_PCB::GetBoundingBox(), SCH_TEXT::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(), EDA_TEXT::GetPositionsOfLinesOfMultilineText(), EDA_TEXT::GetTextBox(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), 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_MODULE_MODULE_EDITOR::OnEditReference(), DIALOG_MODULE_BOARD_EDITOR::OnEditReference(), DIALOG_MODULE_MODULE_EDITOR::OnEditValue(), DIALOG_MODULE_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(), EDA_TEXT::TextHitTest(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow(), TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(), EDA_TEXT::TransformTextShapeToSegmentList(), and TEXTE_MODULE::ViewBBox().

224 { return m_e.pos; }
TEXT_EFFECTS m_e
Definition: eda_text.h:368
wxPoint pos
Definition: eda_text.h:100
const wxSize& EDA_TEXT::GetTextSize ( void  ) const
inlineinherited

Definition at line 215 of file eda_text.h.

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

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(), EDA_TEXT::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(), EDA_TEXT::GetTextBox(), EDA_TEXT::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(), DialogEditModuleText::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(), and EDA_TEXT::TransformTextShapeToSegmentList().

215 { return m_e.size; };
TEXT_EFFECTS m_e
Definition: eda_text.h:368
wxSize size
Definition: eda_text.h:97
wxString EDA_TEXT::GetTextStyleName ( )
inherited

Function GetTextStyleName.

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

Definition at line 380 of file eda_text.cpp.

References EDA_TEXT::IsBold(), and EDA_TEXT::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:170
bool IsBold() const
Definition: eda_text.h:173
int EDA_TEXT::GetThickness ( ) const
inlineinherited

Function GetThickness returns pen width.

Definition at line 154 of file eda_text.h.

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

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(), EDA_TEXT::drawOneLineOfText(), export_vrml_pcbtext(), export_vrml_text_module(), EDA_TEXT::Format(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), SCH_GLOBALLABEL::GetBoundingBox(), SCH_HIERLABEL::GetBoundingBox(), EDA_TEXT::GetInterline(), TEXTE_PCB::GetMsgPanelInfo(), LIB_TEXT::GetMsgPanelInfo(), TEXTE_MODULE::GetMsgPanelInfo(), LIB_TEXT::GetPenSize(), LIB_FIELD::GetPenSize(), SCH_FIELD::GetPenSize(), SCH_TEXT::GetPenSize(), GetPenWidth(), SCH_GLOBALLABEL::GetSchematicTextOffset(), SCH_HIERLABEL::GetSchematicTextOffset(), EDA_TEXT::GetTextBox(), LIB_TEXT::GetWidth(), LIB_FIELD::GetWidth(), EDA_TEXT::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(), DialogEditModuleText::TransferDataToWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(), and EDA_TEXT::TransformTextShapeToSegmentList().

154 { return m_e.penwidth; };
TEXT_EFFECTS m_e
Definition: eda_text.h:368
int penwidth
Definition: eda_text.h:98
WS_DRAW_TYPE WS_DRAW_ITEM_BASE::GetType ( ) const
inlineinherited

Definition at line 85 of file worksheet_shape_builder.h.

References WS_DRAW_ITEM_BASE::m_type.

Referenced by KIGFX::WORKSHEET_VIEWITEM::ViewDraw().

85 { return m_type; };
EDA_TEXT_VJUSTIFY_T EDA_TEXT::GetVertJustify ( ) const
inlineinherited
bool WS_DRAW_ITEM_TEXT::HitTest ( const wxPoint aPosition) const
overridevirtual

Virtual function return true if the point aPosition is on the text.

Implements WS_DRAW_ITEM_BASE.

Definition at line 201 of file page_layout_graphic_items.cpp.

References EDA_TEXT::TextHitTest().

202 {
203  return EDA_TEXT::TextHitTest( aPosition, 0 );
204 }
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Function TextHitTest Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:254
bool WS_DRAW_ITEM_TEXT::HitTest ( const EDA_RECT aRect) const
overridevirtual

Virtual function return true if the rect aRect intersects on the item.

Implements WS_DRAW_ITEM_BASE.

Definition at line 207 of file page_layout_graphic_items.cpp.

References EDA_TEXT::TextHitTest().

208 {
209  return EDA_TEXT::TextHitTest( aRect, 0, 0 );
210 }
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Function TextHitTest Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:254
virtual bool WS_DRAW_ITEM_BASE::HitTestEndPoint ( const wxPoint aPosition)
inlinevirtualinherited

return true if the point aPosition is near the ending point of this item This is avirtual function which should be overriden for items defien by 2 points the maxi dist is WORKSHEET_DATAITEM::GetMarkerSizeUi()/2

Reimplemented in WS_DRAW_ITEM_RECT, and WS_DRAW_ITEM_LINE.

Definition at line 130 of file worksheet_shape_builder.h.

131  {
132  return false;
133  }
bool WS_DRAW_ITEM_TEXT::HitTestStartPoint ( const wxPoint aPosition)
overridevirtual

return true if the point aPosition is on the starting point of this item.

Implements WS_DRAW_ITEM_BASE.

Definition at line 213 of file page_layout_graphic_items.cpp.

References abs, WORKSHEET_DATAITEM::GetMarkerSizeUi(), EDA_TEXT::GetTextPos(), wxPoint::x, and wxPoint::y.

214 {
215  wxPoint pos = GetTextPos();
216 
217  if( std::abs( pos.x - aPosition.x) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 &&
218  std::abs( pos.y - aPosition.y) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 )
219  return true;
220 
221  return false;
222 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
#define abs(a)
Definition: auxiliary.h:84
bool EDA_TEXT::IsBold ( ) const
inlineinherited

Definition at line 173 of file eda_text.h.

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

Referenced by DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel(), SCH_GLOBALLABEL::CreateGraphicShape(), SCH_EDIT_FRAME::CreateNewText(), DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD(), SCH_TEXT::Draw(), SCH_FIELD::Draw(), TEXTE_MODULE::Draw(), SCH_GLOBALLABEL::Draw(), SCH_HIERLABEL::Draw(), LIB_TEXT::drawGraphic(), LIB_FIELD::drawGraphic(), EDA_TEXT::drawOneLineOfText(), EDA_TEXT::Format(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), SCH_TEXT::GetMsgPanelInfo(), LIB_TEXT::GetPenSize(), SCH_FIELD::GetPenSize(), SCH_TEXT::GetPenSize(), SCH_GLOBALLABEL::GetSchematicTextOffset(), EDA_TEXT::GetTextStyleName(), hash_eda(), DIALOG_LABEL_EDITOR::InitDialog(), DIALOG_LIB_EDIT_TEXT::initDlg(), EDA_TEXT::IsDefaultFormatting(), EDA_TEXT::LenSize(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), 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_CACHE::saveText(), and KIGFX::GAL::SetTextAttributes().

173 { return m_e.Bit( TE_BOLD ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:368
void Bit(int aBit, bool aValue)
Definition: eda_text.h:102
bool EDA_TEXT::IsDefaultFormatting ( ) const
inherited

Definition at line 401 of file eda_text.cpp.

References DEFAULT_SIZE_TEXT, EDA_TEXT::GetHorizJustify(), EDA_TEXT::GetTextHeight(), EDA_TEXT::GetTextWidth(), EDA_TEXT::GetThickness(), 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 EDA_TEXT::Format().

402 {
403  return ( GetTextWidth() == Mils2iu( DEFAULT_SIZE_TEXT )
404  && GetTextHeight() == Mils2iu( DEFAULT_SIZE_TEXT )
405  && IsVisible()
406  && !IsMirrored()
409  && GetThickness() == 0
410  && !IsItalic()
411  && !IsBold()
412  && !IsMultilineAllowed()
413  );
414 }
#define DEFAULT_SIZE_TEXT
This is the "default-of-the-default" hardcoded text size; individual application define their own def...
Definition: eda_text.h:74
bool IsMultilineAllowed() const
Definition: eda_text.h:188
bool IsItalic() const
Definition: eda_text.h:170
int GetTextWidth() const
Definition: eda_text.h:218
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:190
bool IsBold() const
Definition: eda_text.h:173
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:154
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:191
bool IsMirrored() const
Definition: eda_text.h:179
bool IsVisible() const
Definition: eda_text.h:176
int GetTextHeight() const
Definition: eda_text.h:221
bool EDA_TEXT::IsItalic ( ) const
inlineinherited

Definition at line 170 of file eda_text.h.

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

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(), EDA_TEXT::drawOneLineOfText(), export_vrml_pcbtext(), export_vrml_text_module(), EDA_TEXT::Format(), SCH_TEXT::GetMsgPanelInfo(), EDA_TEXT::GetTextStyleName(), hash_eda(), DIALOG_LABEL_EDITOR::InitDialog(), DIALOG_LIB_EDIT_TEXT::initDlg(), EDA_TEXT::IsDefaultFormatting(), EDA_TEXT::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(), DialogEditModuleText::TransferDataToWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(), and EDA_TEXT::TransformTextShapeToSegmentList().

170 { return m_e.Bit( TE_ITALIC ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:368
void Bit(int aBit, bool aValue)
Definition: eda_text.h:102
int EDA_TEXT::LenSize ( const wxString &  aLine) const
inherited

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(), EDA_TEXT::GetTextSize(), EDA_TEXT::IsBold(), EDA_TEXT::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:170
bool IsBold() const
Definition: eda_text.h:173
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:215
VECTOR2D GetTextLineSize(const UTF8 &aText) const
Compute the X and Y size of a given text.
void EDA_TEXT::SetEffects ( const EDA_TEXT aSrc)
inherited

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 EDA_TEXT::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:368
void EDA_TEXT::SetMultilineAllowed ( bool  aAllow)
inlineinherited

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

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

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().

187 { m_e.Bit( TE_MULTILINE, aAllow ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:368
void Bit(int aBit, bool aValue)
Definition: eda_text.h:102
virtual void EDA_TEXT::SetText ( const wxString &  aText)
inlinevirtualinherited

Reimplemented in LIB_FIELD, and LIB_TEXT.

Definition at line 141 of file eda_text.h.

References EDA_TEXT::m_Text.

Referenced by DXF2BRD_CONVERTER::addMText(), DXF2BRD_CONVERTER::addText(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), BOM_TABLE_COMPONENT::ApplyFieldChanges(), 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(), 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(), MODULE::SetReference(), DIMENSION::SetText(), MODULE::SetValue(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), DialogEditModuleText::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().

141 { m_Text = aText; }
wxString m_Text
Definition: eda_text.h:346
void WS_DRAW_ITEM_TEXT::SetTextAngle ( double  aAngle)
inline

Definition at line 300 of file worksheet_shape_builder.h.

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

Referenced by WORKSHEET_DATAITEM_TEXT::TransfertSetupToGraphicText().

301  {
303  }
void SetTextAngle(double aAngle)
Definition: eda_text.h:156
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:222
void EDA_TEXT::SetTextHeight ( int  aHeight)
inlineinherited

Definition at line 220 of file eda_text.h.

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

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

220 { m_e.size.y = aHeight; }
TEXT_EFFECTS m_e
Definition: eda_text.h:368
wxSize size
Definition: eda_text.h:97
void EDA_TEXT::SetTextPos ( const wxPoint aPoint)
inlineinherited

Definition at line 223 of file eda_text.h.

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

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().

223 { m_e.pos = aPoint; }
TEXT_EFFECTS m_e
Definition: eda_text.h:368
wxPoint pos
Definition: eda_text.h:100
void EDA_TEXT::SetTextSize ( const wxSize &  aNewSize)
inlineinherited

Definition at line 214 of file eda_text.h.

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

Referenced by 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::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(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), DialogEditModuleText::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_ONE_FIELD::updateText(), and WS_DRAW_ITEM_TEXT().

214 { m_e.size = aNewSize; };
TEXT_EFFECTS m_e
Definition: eda_text.h:368
wxSize size
Definition: eda_text.h:97
void EDA_TEXT::SetTextWidth ( int  aWidth)
inlineinherited

Definition at line 217 of file eda_text.h.

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

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

217 { m_e.size.x = aWidth; }
TEXT_EFFECTS m_e
Definition: eda_text.h:368
wxSize size
Definition: eda_text.h:97
void EDA_TEXT::SetThickness ( int  aNewThickness)
inlineinherited
wxString EDA_TEXT::ShortenedShownText ( ) const
inherited

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

Definition at line 79 of file eda_text.cpp.

References EDA_TEXT::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:135
void EDA_TEXT::SwapEffects ( EDA_TEXT aTradingPartner)
inherited

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 EDA_TEXT::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:368
bool EDA_TEXT::TextHitTest ( const wxPoint aPoint,
int  aAccuracy = 0 
) const
virtualinherited

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(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextBox(), EDA_TEXT::GetTextPos(), EDA_RECT::Inflate(), and RotatePoint().

Referenced by LIB_TEXT::HitTest(), TEXTE_PCB::HitTest(), LIB_FIELD::HitTest(), DIMENSION::HitTest(), and 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:224
bool Contains(const wxPoint &aPoint) const
Function Contains.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
double GetTextAngle() const
Definition: eda_text.h:164
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.
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
virtualinherited

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(), EDA_TEXT::GetTextAngle(), EDA_TEXT::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:164
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.
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
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.

Parameters
aCornerBuffer= a buffer to store the polygon

Definition at line 493 of file eda_text.cpp.

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

Referenced by DRC::testTexts().

494 {
495  wxSize size = GetTextSize();
496 
497  if( IsMirrored() )
498  size.x = -size.x;
499 
500  s_cornerBuffer = &aCornerBuffer;
501  COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by DrawGraphicText
502 
503  if( IsMultilineAllowed() )
504  {
505  wxArrayString strings_list;
506  wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
507  std::vector<wxPoint> positions;
508  positions.reserve( strings_list.Count() );
509  GetPositionsOfLinesOfMultilineText( positions,strings_list.Count() );
510 
511  for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
512  {
513  wxString txt = strings_list.Item( ii );
514  DrawGraphicText( NULL, NULL, positions[ii], color,
515  txt, GetTextAngle(), size,
517  GetThickness(), IsItalic(),
518  true, addTextSegmToBuffer );
519  }
520  }
521  else
522  {
523  DrawGraphicText( NULL, NULL, GetTextPos(), color,
524  GetText(), GetTextAngle(), size,
526  GetThickness(), IsItalic(),
527  true, addTextSegmToBuffer );
528  }
529 }
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Function wxStringSplit splits aString to a string list separated at aSplitter.
Definition: common.cpp:137
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), PLOTTER *aPlotter)
Function DrawGraphicText Draw a graphic text (like module texts)
Definition: drawtxt.cpp:122
bool IsMultilineAllowed() const
Definition: eda_text.h:188
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
bool IsItalic() const
Definition: eda_text.h:170
static std::vector< wxPoint > * s_cornerBuffer
Definition: eda_text.cpp:484
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:190
double GetTextAngle() const
Definition: eda_text.h:164
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:154
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:135
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
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:191
bool IsMirrored() const
Definition: eda_text.h:179
Definition: colors.h:45
const wxSize & GetTextSize() const
Definition: eda_text.h:215
static void addTextSegmToBuffer(int x0, int y0, int xf, int yf)
Definition: eda_text.cpp:487
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

Member Data Documentation

COLOR4D WS_DRAW_ITEM_BASE::m_color
protectedinherited

Definition at line 66 of file worksheet_shape_builder.h.

Referenced by WS_DRAW_ITEM_BASE::GetColor().

int WS_DRAW_ITEM_BASE::m_Flags
inherited

Definition at line 61 of file worksheet_shape_builder.h.

Referenced by PL_EDITOR_FRAME::Locate().

WORKSHEET_DATAITEM* WS_DRAW_ITEM_BASE::m_parent
protectedinherited

Definition at line 67 of file worksheet_shape_builder.h.

Referenced by WS_DRAW_ITEM_BASE::GetParent().

WS_DRAW_TYPE WS_DRAW_ITEM_BASE::m_type
protectedinherited

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