KiCad PCB EDA Suite
Loading...
Searching...
No Matches
lib_textbox.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <base_units.h>
25#include <pgm_base.h>
26#include <sch_edit_frame.h>
27#include <plotters/plotter.h>
28#include <widgets/msgpanel.h>
29#include <bitmaps.h>
30#include <string_utils.h>
31#include <schematic.h>
33#include <sch_painter.h>
37#include <core/kicad_algo.h>
38#include <trigo.h>
39#include <lib_textbox.h>
40
41
43
44
45LIB_TEXTBOX::LIB_TEXTBOX( LIB_SYMBOL* aParent, int aLineWidth, FILL_T aFillType,
46 const wxString& text ) :
47 LIB_SHAPE( aParent, SHAPE_T::RECTANGLE, aLineWidth, aFillType, LIB_TEXTBOX_T ),
49{
54 SetMultilineAllowed( true );
55}
56
57
59 LIB_SHAPE( aText ),
60 EDA_TEXT( aText )
61{ }
62
63
65{
66 return KiROUND( GetTextSize().y * 0.8 );
67}
68
69
71{
72 // Text is NOT really mirrored; it just has its justification flipped
74 {
75 switch( GetHorizJustify() )
76 {
78 case GR_TEXT_H_ALIGN_CENTER: break;
80 }
81 }
82}
83
84
86{
87 // Text is NOT really mirrored; it just has its justification flipped
89 {
90 switch( GetHorizJustify() )
91 {
93 case GR_TEXT_H_ALIGN_CENTER: break;
95 }
96 }
97}
98
99
100void LIB_TEXTBOX::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
101{
102 LIB_SHAPE::Rotate( aCenter, aRotateCCW );
104}
105
106
108{
109 int margin = GetTextMargin();
110 BOX2I bbox( VECTOR2I( std::min( m_start.x, m_end.x ), std::min( -m_start.y, -m_end.y ) ),
111 VECTOR2I( abs( m_end.x - m_start.x ), abs( m_end.y - m_start.y ) ) );
112
113 VECTOR2I pos( bbox.GetLeft() + margin, bbox.GetBottom() - margin );
114
116 {
117 switch( GetHorizJustify() )
118 {
120 pos.y = bbox.GetBottom() - margin;
121 break;
123 pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2;
124 break;
126 pos.y = bbox.GetTop() + margin;
127 break;
128 }
129
130 switch( GetVertJustify() )
131 {
133 pos.x = bbox.GetLeft() + margin;
134 break;
136 pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2;
137 break;
139 pos.x = bbox.GetRight() - margin;
140 break;
141 }
142 }
143 else
144 {
145 switch( GetHorizJustify() )
146 {
148 pos.x = bbox.GetLeft() + margin;
149 break;
151 pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2;
152 break;
154 pos.x = bbox.GetRight() - margin;
155 break;
156 }
157
158 switch( GetVertJustify() )
159 {
161 pos.y = bbox.GetTop() + margin;
162 break;
164 pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2;
165 break;
167 pos.y = bbox.GetBottom() - margin;
168 break;
169 }
170 }
171
172 return pos;
173}
174
175
176int LIB_TEXTBOX::compare( const LIB_ITEM& aOther, int aCompareFlags ) const
177{
178 wxASSERT( aOther.Type() == LIB_TEXTBOX_T );
179
180 int retv = LIB_ITEM::compare( aOther, aCompareFlags );
181
182 if( retv )
183 return retv;
184
185 const LIB_TEXTBOX* tmp = static_cast<const LIB_TEXTBOX*>( &aOther );
186
187 int result = GetText().CmpNoCase( tmp->GetText() );
188
189 if( result != 0 )
190 return result;
191
192 if( GetTextWidth() != tmp->GetTextWidth() )
193 return GetTextWidth() - tmp->GetTextWidth();
194
195 if( GetTextHeight() != tmp->GetTextHeight() )
196 return GetTextHeight() - tmp->GetTextHeight();
197
198 if( IsBold() != tmp->IsBold() )
199 return IsBold() - tmp->IsBold();
200
201 if( IsItalic() != tmp->IsItalic() )
202 return IsItalic() - tmp->IsItalic();
203
204 if( GetHorizJustify() != tmp->GetHorizJustify() )
205 return GetHorizJustify() - tmp->GetHorizJustify();
206
207 if( GetTextAngle().AsTenthsOfADegree() != tmp->GetTextAngle().AsTenthsOfADegree() )
209
210 return EDA_SHAPE::Compare( &static_cast<const LIB_SHAPE&>( aOther ) );
211}
212
213
215{
217
218 if( !font )
220
221 return font;
222}
223
224
225void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
226 const TRANSFORM& aTransform, bool aDimmed )
227{
228 if( IsPrivate() )
229 return;
230
231 bool forceNoFill = static_cast<bool>( aData );
232 bool blackAndWhiteMode = GetGRForceBlackPenState();
233 int penWidth = GetEffectivePenWidth( aSettings );
235 PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
236
237 wxDC* DC = aSettings->GetPrintDC();
238 VECTOR2I pt1 = aTransform.TransformCoordinate( m_start ) + aOffset;
239 VECTOR2I pt2 = aTransform.TransformCoordinate( m_end ) + aOffset;
240
241 if( !forceNoFill && GetFillMode() == FILL_T::FILLED_WITH_COLOR && !blackAndWhiteMode )
242 GRFilledRect( DC, pt1, pt2, penWidth, GetFillColor(), GetFillColor() );
243
244 if( penWidth > 0 )
245 {
246 penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
247
248 if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
249 color = aSettings->GetLayerColor( LAYER_DEVICE );
250
251 COLOR4D bg = aSettings->GetBackgroundColor();
252
253 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
254 bg = COLOR4D::WHITE;
255
256 if( aDimmed )
257 {
258 color.Desaturate( );
259 color = color.Mix( bg, 0.5f );
260 }
261
262 if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
263 lineStyle = PLOT_DASH_TYPE::SOLID;
264
265 if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
266 {
267 GRRect( DC, pt1, pt2, penWidth, color );
268 }
269 else
270 {
271 std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
272
273 for( SHAPE* shape : shapes )
274 {
275 STROKE_PARAMS::Stroke( shape, lineStyle, penWidth, aSettings,
276 [&]( const VECTOR2I& a, const VECTOR2I& b )
277 {
278 VECTOR2I pts = aTransform.TransformCoordinate( a ) + aOffset;
279 VECTOR2I pte = aTransform.TransformCoordinate( b ) + aOffset;
280 GRLine( DC, pts.x, pts.y, pte.x, pte.y, penWidth, color );
281 } );
282 }
283
284 for( SHAPE* shape : shapes )
285 delete shape;
286 }
287 }
288
289 LIB_TEXTBOX text( *this );
290
292
293 if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
294 color = aSettings->GetLayerColor( LAYER_DEVICE );
295
296 COLOR4D bg = aSettings->GetBackgroundColor();
297
298 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
299 bg = COLOR4D::WHITE;
300
301 if( aDimmed )
302 {
303 color.Desaturate( );
304 color = color.Mix( bg, 0.5f );
305 }
306
307 penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetMinPenWidth() );
308
309 if( aTransform.y1 )
310 {
311 text.SetTextAngle( text.GetTextAngle() == ANGLE_HORIZONTAL ? ANGLE_VERTICAL
313 }
314
315 KIFONT::FONT* font = GetFont();
316
317 if( !font )
318 font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
319
320 // NB: GetDrawPos() will want Symbol Editor (upside-down) coordinates
321 text.SetStart( VECTOR2I( pt1.x, -pt1.y ) );
322 text.SetEnd( VECTOR2I( pt2.x, -pt2.y ) );
323
324 GRPrintText( DC, text.GetDrawPos(), color, text.GetShownText( true ), text.GetTextAngle(),
325 text.GetTextSize(), text.GetHorizJustify(), text.GetVertJustify(), penWidth,
326 text.IsItalic(), text.IsBold(), font, GetFontMetrics() );
327}
328
329
330wxString LIB_TEXTBOX::GetShownText( bool aAllowExtraText, int aDepth ) const
331{
332 wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
333
334 KIFONT::FONT* font = GetFont();
335 VECTOR2D size = GetEnd() - GetStart();
336 int colWidth = GetTextAngle() == ANGLE_HORIZONTAL ? size.x : size.y;
337
338 if( !font )
340
341 colWidth = abs( colWidth ) - GetTextMargin() * 2;
342 font->LinebreakText( text, colWidth, GetTextSize(), GetTextThickness(), IsBold(), IsItalic() );
343
344 return text;
345}
346
347
348bool LIB_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
349{
352
353 BOX2I rect = GetBoundingBox();
354
355 rect.Inflate( aAccuracy );
356
357 return rect.Contains( aPosition );
358}
359
360
361bool LIB_TEXTBOX::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
362{
363 BOX2I rect = aRect;
364
365 rect.Inflate( aAccuracy );
366
367 if( aContained )
368 return rect.Contains( GetBoundingBox() );
369
370 return rect.Intersects( GetBoundingBox() );
371}
372
373
374wxString LIB_TEXTBOX::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
375{
376 return wxString::Format( _( "Graphic Text Box" ) );
377}
378
379
381{
382 return BITMAPS::add_textbox;
383}
384
385
386void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
387 const TRANSFORM& aTransform, bool aDimmed ) const
388{
389 wxASSERT( aPlotter != nullptr );
390
391 if( IsPrivate() )
392 return;
393
394 if( aBackground )
395 {
396 LIB_SHAPE::Plot( aPlotter, aBackground, aOffset, aTransform, aDimmed );
397 return;
398 }
399
400 RENDER_SETTINGS* renderSettings = aPlotter->RenderSettings();
401 VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
402 VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
403 COLOR4D bg = renderSettings->GetBackgroundColor();
404
405 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
406 bg = COLOR4D::WHITE;
407
408 int penWidth = GetEffectivePenWidth( renderSettings );
410 PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
411
412 if( penWidth > 0 )
413 {
414 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
415 color = renderSettings->GetLayerColor( LAYER_DEVICE );
416
417 if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
418 lineStyle = PLOT_DASH_TYPE::DASH;
419
420 if( aDimmed )
421 {
422 color.Desaturate( );
423 color = color.Mix( bg, 0.5f );
424 }
425
426 aPlotter->SetColor( color );
427 aPlotter->SetDash( penWidth, lineStyle );
428 aPlotter->Rect( start, end, FILL_T::NO_FILL, penWidth );
429 aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
430 }
431
432 KIFONT::FONT* font = GetFont();
433
434 if( !font )
435 font = KIFONT::FONT::GetFont( renderSettings->GetDefaultFont(), IsBold(), IsItalic() );
436
437 LIB_TEXTBOX text( *this );
438
440
441 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
442 color = renderSettings->GetLayerColor( LAYER_DEVICE );
443
444 if( aDimmed )
445 {
446 color.Desaturate( );
447 color = color.Mix( bg, 0.5f );
448 }
449
450 penWidth = std::max( GetEffectiveTextPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
451
452 if( aTransform.y1 )
453 {
454 text.SetTextAngle( text.GetTextAngle() == ANGLE_HORIZONTAL ? ANGLE_VERTICAL
456 }
457
458 // NB: GetDrawPos() will want Symbol Editor (upside-down) coordinates
459 text.SetStart( VECTOR2I( start.x, -start.y ) );
460 text.SetEnd( VECTOR2I( end.x, -end.y ) );
461
462 std::vector<VECTOR2I> positions;
463 wxArrayString strings_list;
464 wxStringSplit( GetShownText( true ), strings_list, '\n' );
465 positions.reserve( strings_list.Count() );
466
467 text.GetLinePositions( positions, (int) strings_list.Count() );
468
470 attrs.m_StrokeWidth = penWidth;
471 attrs.m_Multiline = false;
472
473 for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
474 {
475 aPlotter->PlotText( positions[ii], color, strings_list.Item( ii ), attrs, font,
476 GetFontMetrics() );
477 }
478}
479
480
481void LIB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
482{
483 // Don't use GetShownText() here; we want to show the user the variable references
484 aList.emplace_back( _( "Text Box" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
485
486 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
487
488 wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
489 int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
490 aList.emplace_back( _( "Style" ), textStyle[style] );
491
492 aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
493
494 aList.emplace_back( _( "Box Width" ),
495 aFrame->MessageTextFromValue( std::abs( GetEnd().x - GetStart().x ) ) );
496
497 aList.emplace_back( _( "Box Height" ),
498 aFrame->MessageTextFromValue( std::abs( GetEnd().y - GetStart().y ) ) );
499
500 m_stroke.GetMsgPanelInfo( aFrame, aList );
501}
502
503
504void LIB_TEXTBOX::ViewGetLayers( int aLayers[], int& aCount ) const
505{
506 aCount = 3;
507 aLayers[0] = IsPrivate() ? LAYER_PRIVATE_NOTES : LAYER_DEVICE;
509 aLayers[2] = LAYER_SELECTION_SHADOWS;
510}
int color
Definition: DXF_plotter.cpp:58
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:270
coord_type GetTop() const
Definition: box2.h:195
bool Contains(const Vec &aPoint) const
Definition: box2.h:142
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:507
coord_type GetRight() const
Definition: box2.h:190
coord_type GetLeft() const
Definition: box2.h:194
coord_type GetBottom() const
Definition: box2.h:191
int AsTenthsOfADegree() const
Definition: eda_angle.h:151
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
FILL_T GetFillMode() const
Definition: eda_shape.h:102
VECTOR2I m_start
Definition: eda_shape.h:387
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:149
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:124
COLOR4D GetFillColor() const
Definition: eda_shape.h:106
VECTOR2I m_end
Definition: eda_shape.h:388
STROKE_PARAMS m_stroke
Definition: eda_shape.h:377
int Compare(const EDA_SHAPE *aOther) const
Definition: eda_shape.cpp:1556
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:80
int GetTextHeight() const
Definition: eda_text.h:213
COLOR4D GetTextColor() const
Definition: eda_text.h:216
void SetTextSize(VECTOR2I aNewSize)
Definition: eda_text.cpp:355
bool IsItalic() const
Definition: eda_text.h:141
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:131
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:95
KIFONT::FONT * GetFont() const
Definition: eda_text.h:199
int GetTextWidth() const
Definition: eda_text.h:210
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:257
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:160
const TEXT_ATTRIBUTES & GetAttributes() const
Definition: eda_text.h:183
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition: eda_text.cpp:305
bool IsBold() const
Definition: eda_text.h:144
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:163
virtual wxString GetShownText(bool aAllowExtraText, int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:106
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:202
int GetTextThickness() const
Definition: eda_text.h:123
void SetMultilineAllowed(bool aAllow)
Definition: eda_text.cpp:241
VECTOR2I GetTextSize() const
Definition: eda_text.h:207
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:249
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:131
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false)
Definition: font.cpp:146
void LinebreakText(wxString &aText, int aColumnWidth, const VECTOR2I &aGlyphSize, int aThickness, bool aBold, bool aItalic) const
Insert characters into text to ensure that no lines are wider than aColumnWidth.
Definition: font.cpp:582
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual const COLOR4D & GetBackgroundColor() const =0
Return current background color settings.
wxDC * GetPrintDC() const
Store schematic specific render settings.
Definition: sch_painter.h:71
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:68
bool IsPrivate() const
Definition: lib_item.h:313
const wxString & GetDefaultFont() const
Definition: lib_item.cpp:142
virtual int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_item.cpp:73
virtual int GetEffectivePenWidth(const RENDER_SETTINGS *aSettings) const
Definition: lib_item.h:189
const KIFONT::METRICS & GetFontMetrics() const
Definition: lib_item.cpp:150
STROKE_PARAMS GetStroke() const
Definition: lib_shape.h:57
void Plot(PLOTTER *aPlotter, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const override
Plot the draw item using the plot object.
Definition: lib_shape.cpp:134
const BOX2I GetBoundingBox() const override
Definition: lib_shape.cpp:438
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
Definition: lib_shape.cpp:126
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const override
Make a set of SHAPE objects representing the LIB_SHAPE.
Definition: lib_shape.h:101
Define a library symbol object.
Definition: lib_symbol.h:99
void print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed) override
Print the item to aDC.
VECTOR2I GetDrawPos() const override
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
int GetTextMargin() const
Definition: lib_textbox.cpp:64
void MirrorHorizontally(const VECTOR2I &center)
Definition: lib_textbox.cpp:70
KIFONT::FONT * getDrawFont() const override
LIB_TEXTBOX(LIB_SYMBOL *aParent, int aLineWidth=0, FILL_T aFillType=FILL_T::NO_FILL, const wxString &aText=wxEmptyString)
Definition: lib_textbox.cpp:45
void Plot(PLOTTER *aPlotter, bool aBackground, const VECTOR2I &offset, const TRANSFORM &aTransform, bool aDimmed) const override
Plot the draw item using the plot object.
int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const override
Provide the draw object specific comparison called by the == and < operators.
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the object about aCenter point.
void MirrorVertically(const VECTOR2I &center)
Definition: lib_textbox.cpp:85
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
Base plotter engine class.
Definition: plotter.h:104
virtual void SetDash(int aLineWidth, PLOT_DASH_TYPE aLineStyle)=0
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:135
bool GetColorMode() const
Definition: plotter.h:132
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr)
Definition: plotter.cpp:753
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void SetColor(const COLOR4D &color)=0
An abstract shape on 2D plane.
Definition: shape.h:126
void GetMsgPanelInfo(UNITS_PROVIDER *aUnitsProvider, std::vector< MSG_PANEL_ITEM > &aList, bool aIncludeStyle=true, bool aIncludeWidth=true)
static void Stroke(const SHAPE *aShape, PLOT_DASH_TYPE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, std::function< void(const VECTOR2I &a, const VECTOR2I &b)> aStroker)
KIGFX::COLOR4D GetColor() const
Definition: stroke_params.h:97
PLOT_DASH_TYPE GetPlotStyle() const
Definition: stroke_params.h:94
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:46
int y1
Definition: transform.h:49
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:44
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
#define _(s)
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
Definition: eda_angle.h:433
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:434
SHAPE_T
Definition: eda_shape.h:42
FILL_T
Definition: eda_shape.h:55
void GRRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor)
Definition: gr_basic.cpp:396
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:171
void GRFilledRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor, const COLOR4D &aBgColor)
Definition: gr_basic.cpp:403
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:165
void GRPrintText(wxDC *aDC, const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics)
Print a graphic text through wxDC.
Definition: gr_text.cpp:142
@ LAYER_DEVICE
Definition: layer_ids.h:362
@ LAYER_PRIVATE_NOTES
Definition: layer_ids.h:364
@ LAYER_DEVICE_BACKGROUND
Definition: layer_ids.h:378
@ LAYER_NOTES_BACKGROUND
Definition: layer_ids.h:365
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:387
#define MINIMUM_SELECTION_DISTANCE
Definition: lib_item.h:53
Message panel definition file.
wxString EllipsizeStatusText(wxWindow *aWindow, const wxString &aString)
Ellipsize text (at the end) to be no more than 1/3 of the window width.
Definition: ui_common.cpp:201
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:426
see class PGM_BASE
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
PLOT_DASH_TYPE
Dashed line types.
Definition: stroke_params.h:48
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP
@ LIB_TEXTBOX_T
Definition: typeinfo.h:200
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588