KiCad PCB EDA Suite
Loading...
Searching...
No Matches
lib_text.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) 2004-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 <common.h>
25#include <font/font.h>
26#include <sch_draw_panel.h>
27#include <plotters/plotter.h>
28#include <trigo.h>
29#include <base_units.h>
30#include <widgets/msgpanel.h>
31#include <bitmaps.h>
32#include <eda_draw_frame.h>
33#include <lib_item.h>
34#include <general.h>
35#include <transform.h>
37#include <lib_text.h>
38#include <default_values.h> // For some default values
39#include <string_utils.h>
40
42 LIB_ITEM( LIB_TEXT_T, aParent ),
43 EDA_TEXT( schIUScale, wxEmptyString )
44{
47}
48
49
50void LIB_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
51{
52 aCount = 2;
54 aLayers[1] = LAYER_SELECTION_SHADOWS;
55}
56
57
58bool LIB_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
59{
60 EDA_TEXT tmp_text( *this );
62
63 /* The text orientation may need to be flipped if the
64 * transformation matrix causes xy axes to be flipped.
65 * this simple algo works only for schematic matrix (rot 90 or/and mirror)
66 */
67 bool t1 = ( DefaultTransform.x1 != 0 ) ^ ( GetTextAngle() != ANGLE_HORIZONTAL );
68
70 return tmp_text.TextHitTest( aPosition, aAccuracy );
71}
72
73
75{
76 return new LIB_TEXT( *this );
77}
78
79
80int LIB_TEXT::compare( const LIB_ITEM& aOther, int aCompareFlags ) const
81{
82 wxASSERT( aOther.Type() == LIB_TEXT_T );
83
84 int retv = LIB_ITEM::compare( aOther, aCompareFlags );
85
86 if( retv )
87 return retv;
88
89 const LIB_TEXT* tmp = ( LIB_TEXT* ) &aOther;
90
91 int result = GetText().CmpNoCase( tmp->GetText() );
92
93 if( result != 0 )
94 return result;
95
96 if( GetTextPos().x != tmp->GetTextPos().x )
97 return GetTextPos().x - tmp->GetTextPos().x;
98
99 if( GetTextPos().y != tmp->GetTextPos().y )
100 return GetTextPos().y - tmp->GetTextPos().y;
101
102 if( GetTextWidth() != tmp->GetTextWidth() )
103 return GetTextWidth() - tmp->GetTextWidth();
104
105 if( GetTextHeight() != tmp->GetTextHeight() )
106 return GetTextHeight() - tmp->GetTextHeight();
107
108 return 0;
109}
110
111
112void LIB_TEXT::Offset( const VECTOR2I& aOffset )
113{
114 EDA_TEXT::Offset( aOffset );
115}
116
117
118void LIB_TEXT::MoveTo( const VECTOR2I& newPosition )
119{
120 SetTextPos( newPosition );
121}
122
123
125{
127 return;
128
129 VECTOR2I delta( 0, 0 );
130 BOX2I bbox = GetTextBox();
131
132 if( GetTextAngle().IsHorizontal() )
133 {
135 delta.x = bbox.GetWidth() / 2;
137 delta.x = - bbox.GetWidth() / 2;
138
140 delta.y = - bbox.GetHeight() / 2;
142 delta.y = bbox.GetHeight() / 2;
143 }
144 else
145 {
147 delta.y = bbox.GetWidth() / 2;
149 delta.y = - bbox.GetWidth() / 2;
150
152 delta.x = + bbox.GetHeight() / 2;
154 delta.x = - bbox.GetHeight() / 2;
155 }
156
157 if( inverse )
159 else
161}
162
163
165{
166 NormalizeJustification( false );
167 int x = GetTextPos().x;
168
169 x -= center.x;
170 x *= -1;
171 x += center.x;
172
173 if( GetTextAngle().IsHorizontal() )
174 {
179 }
180 else
181 {
186 }
187
188 SetTextX( x );
190}
191
192
194{
195 NormalizeJustification( false );
196 int y = GetTextPos().y;
197
198 y -= center.y;
199 y *= -1;
200 y += center.y;
201
202 if( GetTextAngle().IsHorizontal() )
203 {
208 }
209 else
210 {
215 }
216
217 SetTextY( y );
219}
220
221
222void LIB_TEXT::Rotate( const VECTOR2I& center, bool aRotateCCW )
223{
224 NormalizeJustification( false );
225 EDA_ANGLE rot_angle = aRotateCCW ? -ANGLE_90 : ANGLE_90;
226
227 VECTOR2I pt = GetTextPos();
228 RotatePoint( pt, center, rot_angle );
229 SetTextPos( pt );
230
231 if( GetTextAngle().IsHorizontal() )
232 {
234 }
235 else
236 {
237 // 180° rotation is a mirror
238
243
248
250 }
251
253}
254
255
256void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
257 const TRANSFORM& aTransform, bool aDimmed ) const
258{
259 wxASSERT( plotter != nullptr );
260
261 if( IsPrivate() )
262 return;
263
264 if( aBackground )
265 return;
266
267 RENDER_SETTINGS* settings = plotter->RenderSettings();
268
269 BOX2I bBox = GetBoundingBox();
270 // convert coordinates from draw Y axis to symbol_editor Y axis
271 bBox.RevertYAxis();
272
273 /*
274 * Calculate the text justification, according to the symbol orientation/mirror. This is
275 * a bit complicated due to cumulative calculations:
276 * - numerous cases (mirrored or not, rotation)
277 * - the plotter's Text() function will also recalculate H and V justifications according
278 * to the text orientation
279 * - when a symbol is mirrored the text is not, and justifications become a nightmare
280 *
281 * So the easier way is to use no justifications (centered text) and use GetBoundingBox to
282 * know the text coordinate considered as centered.
283 */
284 VECTOR2I txtpos = bBox.Centre();
288
289 // The text orientation may need to be flipped if the transformation matrix causes xy
290 // axes to be flipped.
291 int t1 = ( aTransform.x1 != 0 ) ^ ( GetTextAngle() != ANGLE_HORIZONTAL );
292 VECTOR2I pos = aTransform.TransformCoordinate( txtpos ) + offset;
294 COLOR4D bg = settings->GetBackgroundColor();
295
296 if( !plotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
297 color = settings->GetLayerColor( LAYER_DEVICE );
298
299 if( !IsVisible() )
300 bg = settings->GetLayerColor( LAYER_HIDDEN );
301 else if( bg == COLOR4D::UNSPECIFIED || !plotter->GetColorMode() )
302 bg = COLOR4D::WHITE;
303
304 if( aDimmed )
305 {
306 color.Desaturate( );
307 color = color.Mix( bg, 0.5f );
308 }
309
310 int penWidth = std::max( GetEffectiveTextPenWidth(), settings->GetMinPenWidth() );
311
312 KIFONT::FONT* font = GetFont();
313
314 if( !font )
315 font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
316
317 attrs.m_StrokeWidth = penWidth;
319
320 plotter->PlotText( pos, color, GetText(), attrs, font, GetFontMetrics() );
321}
322
323
325{
327}
328
329
331{
333
334 if( !font )
336
337 return font;
338}
339
340
341void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
342 const TRANSFORM& aTransform, bool aDimmed )
343{
344 wxDC* DC = aSettings->GetPrintDC();
346 bool blackAndWhiteMode = GetGRForceBlackPenState();
347 int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
348
349 if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
350 color = aSettings->GetLayerColor( LAYER_DEVICE );
351
352 COLOR4D bg = aSettings->GetBackgroundColor();
353
354 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
355 bg = COLOR4D::WHITE;
356
357 if( !IsVisible() )
358 bg = aSettings->GetLayerColor( LAYER_HIDDEN );
359
360 if( aDimmed )
361 {
362 color.Desaturate( );
363 color = color.Mix( bg, 0.5f );
364 }
365
366 // Calculate the text orientation, according to the symbol orientation/mirror (needed when
367 // draw text in schematic)
368 EDA_ANGLE orient = GetTextAngle();
369
370 if( aTransform.y1 ) // Rotate symbol 90 degrees.
371 {
372 if( orient == ANGLE_HORIZONTAL )
373 orient = ANGLE_VERTICAL;
374 else
375 orient = ANGLE_HORIZONTAL;
376 }
377
378 KIFONT::FONT* font = GetFont();
379
380 if( !font )
381 font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
382
383 /*
384 * Calculate the text justification, according to the symbol orientation/mirror.
385 * This is a bit complicated due to cumulative calculations:
386 * - numerous cases (mirrored or not, rotation)
387 * - the GRText function will also recalculate H and V justifications according to the text
388 * orientation.
389 * - When a symbol is mirrored, the text is not mirrored and justifications are complicated
390 * to calculate so the more easily way is to use no justifications (centered text) and
391 * use GetBoundingBox to know the text coordinate considered as centered
392 */
393 BOX2I bBox = GetBoundingBox();
394
395 // convert coordinates from draw Y axis to symbol_editor Y axis:
396 bBox.RevertYAxis();
397 VECTOR2I txtpos = bBox.Centre();
398
399 // Calculate pos according to mirror/rotation.
400 txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
401
402 GRPrintText( DC, txtpos, color, GetShownText( true ), orient, GetTextSize(),
404 font, GetFontMetrics() );
405}
406
407
408void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
409{
410 wxString msg;
411
412 LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
413
414 // Don't use GetShownText() here; we want to show the user the variable references
415 aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
416
417 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
418
419 aList.emplace_back( _( "Style" ), GetTextStyleName() );
420
421 aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
422
423 switch ( GetHorizJustify() )
424 {
425 case GR_TEXT_H_ALIGN_LEFT: msg = _( "Left" ); break;
426 case GR_TEXT_H_ALIGN_CENTER: msg = _( "Center" ); break;
427 case GR_TEXT_H_ALIGN_RIGHT: msg = _( "Right" ); break;
429 }
430
431 aList.emplace_back( _( "H Justification" ), msg );
432
433 switch ( GetVertJustify() )
434 {
435 case GR_TEXT_V_ALIGN_TOP: msg = _( "Top" ); break;
436 case GR_TEXT_V_ALIGN_CENTER: msg = _( "Center" ); break;
437 case GR_TEXT_V_ALIGN_BOTTOM: msg = _( "Bottom" ); break;
439 }
440
441 aList.emplace_back( _( "V Justification" ), msg );
442}
443
444
446{
447 /* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
448 * calling GetTextBox() that works using top to bottom Y axis orientation.
449 */
450 BOX2I bbox = GetTextBox( -1, true );
451 bbox.RevertYAxis();
452
453 // We are using now a bottom to top Y axis.
454 VECTOR2I orig = bbox.GetOrigin();
455 VECTOR2I end = bbox.GetEnd();
456
457 RotatePoint( orig, GetTextPos(), -GetTextAngle() );
458 RotatePoint( end, GetTextPos(), -GetTextAngle() );
459
460 bbox.SetOrigin( orig );
461 bbox.SetEnd( end );
462
463 // We are using now a top to bottom Y axis:
464 bbox.RevertYAxis();
465
466 return bbox;
467}
468
469
470wxString LIB_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
471{
472 return wxString::Format( _( "Graphic Text '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
473}
474
475
477{
478 return BITMAPS::text;
479}
480
481
482void LIB_TEXT::BeginEdit( const VECTOR2I& aPosition )
483{
484 SetTextPos( aPosition );
485}
486
487
488void LIB_TEXT::CalcEdit( const VECTOR2I& aPosition )
489{
490 SetTextPos( aPosition );
491}
492
493
494bool LIB_TEXT::operator==( const LIB_ITEM& aOther ) const
495{
496 if( Type() != aOther.Type() )
497 return false;
498
499 const LIB_TEXT& other = static_cast<const LIB_TEXT&>( aOther );
500
501 return LIB_ITEM::operator==( aOther ) && EDA_TEXT::operator==( other );
502}
503
504
505double LIB_TEXT::Similarity( const LIB_ITEM& aOther ) const
506{
507 if( m_Uuid == aOther.m_Uuid )
508 return 1.0;
509
510 if( aOther.Type() != Type() )
511 return 0.0;
512
513 const LIB_TEXT& other = static_cast<const LIB_TEXT&>( aOther );
514
515 double similarity = SimilarityBase( other );
516 similarity *= EDA_TEXT::Similarity( other );
517
518 return similarity;
519}
520
521static struct LIB_TEXT_DESC
522{
524 {
531
532 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Mirrored" ) );
533 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Visible" ) );
534 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Width" ) );
535 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Height" ) );
536
537 // Orientation is exposed differently in schematic; mask the base for now
538 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Orientation" ) );
539 }
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
void SetOrigin(const Vec &pos)
Definition: box2.h:203
const Vec & GetOrigin() const
Definition: box2.h:184
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
Definition: box2.h:690
coord_type GetHeight() const
Definition: box2.h:189
coord_type GetWidth() const
Definition: box2.h:188
const Vec GetEnd() const
Definition: box2.h:186
Vec Centre() const
Definition: box2.h:71
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:256
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
const KIID m_Uuid
Definition: eda_item.h:482
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
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:225
BOX2I GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:567
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:231
COLOR4D GetTextColor() const
Definition: eda_text.h:228
wxString GetTextStyleName() const
Definition: eda_text.cpp:824
bool IsItalic() const
Definition: eda_text.h:141
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:131
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
Definition: eda_text.cpp:374
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:95
virtual bool IsVisible() const
Definition: eda_text.h:148
void SetTextPos(const VECTOR2I &aPoint)
Definition: eda_text.cpp:419
void SetTextX(int aX)
Definition: eda_text.cpp:425
KIFONT::FONT * GetFont() const
Definition: eda_text.h:208
void SetTextY(int aY)
Definition: eda_text.cpp:431
int GetTextWidth() const
Definition: eda_text.h:222
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:276
void Offset(const VECTOR2I &aOffset)
Definition: eda_text.cpp:437
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:161
double Similarity(const EDA_TEXT &aOther) const
Definition: eda_text.cpp:1151
virtual bool TextHitTest(const VECTOR2I &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:706
const TEXT_ATTRIBUTES & GetAttributes() const
Definition: eda_text.h:192
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition: eda_text.cpp:324
bool IsBold() const
Definition: eda_text.h:145
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:164
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:205
bool operator==(const EDA_TEXT &aRhs) const
Definition: eda_text.h:354
VECTOR2I GetTextSize() const
Definition: eda_text.h:219
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:268
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
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual const COLOR4D & GetBackgroundColor() const =0
Return current background color settings.
wxDC * GetPrintDC() const
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:68
bool IsPrivate() const
Definition: lib_item.h:349
const wxString & GetDefaultFont() const
Definition: lib_item.cpp:157
virtual bool operator==(const LIB_ITEM &aOther) const
Test LIB_ITEM objects for equivalence.
Definition: lib_item.cpp:113
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:88
double SimilarityBase(const LIB_ITEM &aItem) const
Calculate the boilerplate similarity for all LIB_ITEMs without preventing the use above of a pure vir...
Definition: lib_item.h:227
const KIFONT::METRICS & GetFontMetrics() const
Definition: lib_item.cpp:165
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.
Definition: lib_item.cpp:68
Define a library symbol object.
Definition: lib_symbol.h:99
Define a symbol library graphical text item.
Definition: lib_text.h:40
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: lib_text.cpp:74
void MirrorHorizontal(const VECTOR2I &aCenter) override
Mirror the draw object along the horizontal (X) axis about aCenter point.
Definition: lib_text.cpp:164
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: lib_text.cpp:476
const BOX2I GetBoundingBox() const override
Definition: lib_text.cpp:445
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: lib_text.cpp:50
KIFONT::FONT * getDrawFont() const override
Definition: lib_text.cpp:330
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.
Definition: lib_text.cpp:408
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
Definition: lib_text.cpp:222
bool operator==(const LIB_ITEM &aOther) const override
Test LIB_ITEM objects for equivalence.
Definition: lib_text.cpp:494
double Similarity(const LIB_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: lib_text.cpp:505
void MoveTo(const VECTOR2I &aPosition) override
Move a draw object to aPosition.
Definition: lib_text.cpp:118
LIB_TEXT(LIB_SYMBOL *aParent)
Definition: lib_text.cpp:41
void NormalizeJustification(bool inverse)
Definition: lib_text.cpp:124
int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const override
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_text.cpp:80
void print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed) override
Print the item to aDC.
Definition: lib_text.cpp:341
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: lib_text.cpp:58
int GetPenWidth() const override
Definition: lib_text.cpp:324
void BeginEdit(const VECTOR2I &aStartPoint) override
Begin drawing a symbol library draw item at aPosition.
Definition: lib_text.cpp:482
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: lib_text.cpp:470
void CalcEdit(const VECTOR2I &aPosition) override
Calculate the attributes of an item at aPosition when it is being edited.
Definition: lib_text.cpp:488
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_text.cpp:256
void Offset(const VECTOR2I &aOffset) override
Set the drawing object by aOffset from the current position.
Definition: lib_text.cpp:112
void MirrorVertical(const VECTOR2I &aCenter) override
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
Definition: lib_text.cpp:193
Base plotter engine class.
Definition: plotter.h:104
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
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:85
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
void Mask(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName)
Sets a base class property as masked in a derived class.
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:87
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
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
int x1
Definition: transform.h:48
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
The common library.
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
#define _HKI(x)
#define _(s)
static constexpr EDA_ANGLE ANGLE_0
Definition: eda_angle.h:435
static constexpr EDA_ANGLE ANGLE_90
Definition: eda_angle.h:437
static constexpr EDA_ANGLE ANGLE_VERTICAL
Definition: eda_angle.h:432
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
Definition: eda_angle.h:431
TRANSFORM DefaultTransform
Definition: transform.cpp:32
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:368
@ LAYER_HIDDEN
Definition: layer_ids.h:392
@ LAYER_PRIVATE_NOTES
Definition: layer_ids.h:370
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:393
static struct LIB_TEXT_DESC _LIB_TEXT_DESC
Message panel definition file.
wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
Definition: ui_common.cpp:210
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:192
#define TYPE_HASH(x)
Definition: property.h:67
#define REGISTER_TYPE(x)
Definition: property_mgr.h:366
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
constexpr int delta
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
@ GR_TEXT_H_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
Definition: trigo.cpp:228
@ LIB_TEXT_T
Definition: typeinfo.h:204
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
Definition: ui_common.h:44
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588