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 LIB_TEXT* newitem = new LIB_TEXT( nullptr );
77
78 newitem->m_parent = m_parent;
79 newitem->m_unit = m_unit;
80 newitem->m_convert = m_convert;
81 newitem->m_private = m_private;
82 newitem->m_flags = m_flags;
83
84 newitem->SetText( GetText() );
85 newitem->SetAttributes( *this );
86
87 return newitem;
88}
89
90
91int LIB_TEXT::compare( const LIB_ITEM& aOther, int aCompareFlags ) const
92{
93 wxASSERT( aOther.Type() == LIB_TEXT_T );
94
95 int retv = LIB_ITEM::compare( aOther, aCompareFlags );
96
97 if( retv )
98 return retv;
99
100 const LIB_TEXT* tmp = ( LIB_TEXT* ) &aOther;
101
102 int result = GetText().CmpNoCase( tmp->GetText() );
103
104 if( result != 0 )
105 return result;
106
107 if( GetTextPos().x != tmp->GetTextPos().x )
108 return GetTextPos().x - tmp->GetTextPos().x;
109
110 if( GetTextPos().y != tmp->GetTextPos().y )
111 return GetTextPos().y - tmp->GetTextPos().y;
112
113 if( GetTextWidth() != tmp->GetTextWidth() )
114 return GetTextWidth() - tmp->GetTextWidth();
115
116 if( GetTextHeight() != tmp->GetTextHeight() )
117 return GetTextHeight() - tmp->GetTextHeight();
118
119 return 0;
120}
121
122
123void LIB_TEXT::Offset( const VECTOR2I& aOffset )
124{
125 EDA_TEXT::Offset( aOffset );
126}
127
128
129void LIB_TEXT::MoveTo( const VECTOR2I& newPosition )
130{
131 SetTextPos( newPosition );
132}
133
134
136{
138 return;
139
140 VECTOR2I delta( 0, 0 );
141 BOX2I bbox = GetTextBox();
142
143 if( GetTextAngle().IsHorizontal() )
144 {
146 delta.x = bbox.GetWidth() / 2;
148 delta.x = - bbox.GetWidth() / 2;
149
151 delta.y = - bbox.GetHeight() / 2;
153 delta.y = bbox.GetHeight() / 2;
154 }
155 else
156 {
158 delta.y = bbox.GetWidth() / 2;
160 delta.y = - bbox.GetWidth() / 2;
161
163 delta.x = + bbox.GetHeight() / 2;
165 delta.x = - bbox.GetHeight() / 2;
166 }
167
168 if( inverse )
170 else
172}
173
174
176{
177 NormalizeJustification( false );
178 int x = GetTextPos().x;
179
180 x -= center.x;
181 x *= -1;
182 x += center.x;
183
184 if( GetTextAngle().IsHorizontal() )
185 {
190 }
191 else
192 {
197 }
198
199 SetTextX( x );
201}
202
203
205{
206 NormalizeJustification( false );
207 int y = GetTextPos().y;
208
209 y -= center.y;
210 y *= -1;
211 y += center.y;
212
213 if( GetTextAngle().IsHorizontal() )
214 {
219 }
220 else
221 {
226 }
227
228 SetTextY( y );
230}
231
232
233void LIB_TEXT::Rotate( const VECTOR2I& center, bool aRotateCCW )
234{
235 NormalizeJustification( false );
236 EDA_ANGLE rot_angle = aRotateCCW ? -ANGLE_90 : ANGLE_90;
237
238 VECTOR2I pt = GetTextPos();
239 RotatePoint( pt, center, rot_angle );
240 SetTextPos( pt );
241
242 if( GetTextAngle().IsHorizontal() )
243 {
245 }
246 else
247 {
248 // 180° rotation is a mirror
249
254
259
261 }
262
264}
265
266
267void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
268 const TRANSFORM& aTransform, bool aDimmed ) const
269{
270 wxASSERT( plotter != nullptr );
271
272 if( IsPrivate() )
273 return;
274
275 if( aBackground )
276 return;
277
278 RENDER_SETTINGS* settings = plotter->RenderSettings();
279
280 BOX2I bBox = GetBoundingBox();
281 // convert coordinates from draw Y axis to symbol_editor Y axis
282 bBox.RevertYAxis();
283
284 /*
285 * Calculate the text justification, according to the symbol orientation/mirror. This is
286 * a bit complicated due to cumulative calculations:
287 * - numerous cases (mirrored or not, rotation)
288 * - the plotter's Text() function will also recalculate H and V justifications according
289 * to the text orientation
290 * - when a symbol is mirrored the text is not, and justifications become a nightmare
291 *
292 * So the easier way is to use no justifications (centered text) and use GetBoundingBox to
293 * know the text coordinate considered as centered.
294 */
295 VECTOR2I txtpos = bBox.Centre();
299
300 // The text orientation may need to be flipped if the transformation matrix causes xy
301 // axes to be flipped.
302 int t1 = ( aTransform.x1 != 0 ) ^ ( GetTextAngle() != ANGLE_HORIZONTAL );
303 VECTOR2I pos = aTransform.TransformCoordinate( txtpos ) + offset;
305 COLOR4D bg = settings->GetBackgroundColor();
306
307 if( !plotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
308 color = settings->GetLayerColor( LAYER_DEVICE );
309
310 if( !IsVisible() )
311 bg = settings->GetLayerColor( LAYER_HIDDEN );
312 else if( bg == COLOR4D::UNSPECIFIED || !plotter->GetColorMode() )
313 bg = COLOR4D::WHITE;
314
315 if( aDimmed )
316 {
317 color.Desaturate( );
318 color = color.Mix( bg, 0.5f );
319 }
320
321 int penWidth = std::max( GetEffectiveTextPenWidth(), settings->GetMinPenWidth() );
322
323 KIFONT::FONT* font = GetFont();
324
325 if( !font )
326 font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
327
328 attrs.m_StrokeWidth = penWidth;
330
331 plotter->PlotText( pos, color, GetText(), attrs, font, GetFontMetrics() );
332}
333
334
336{
338}
339
340
342{
344
345 if( !font )
347
348 return font;
349}
350
351
352void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
353 const TRANSFORM& aTransform, bool aDimmed )
354{
355 wxDC* DC = aSettings->GetPrintDC();
357 bool blackAndWhiteMode = GetGRForceBlackPenState();
358 int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
359
360 if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
361 color = aSettings->GetLayerColor( LAYER_DEVICE );
362
363 COLOR4D bg = aSettings->GetBackgroundColor();
364
365 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
366 bg = COLOR4D::WHITE;
367
368 if( !IsVisible() )
369 bg = aSettings->GetLayerColor( LAYER_HIDDEN );
370
371 if( aDimmed )
372 {
373 color.Desaturate( );
374 color = color.Mix( bg, 0.5f );
375 }
376
377 // Calculate the text orientation, according to the symbol orientation/mirror (needed when
378 // draw text in schematic)
379 EDA_ANGLE orient = GetTextAngle();
380
381 if( aTransform.y1 ) // Rotate symbol 90 degrees.
382 {
383 if( orient == ANGLE_HORIZONTAL )
384 orient = ANGLE_VERTICAL;
385 else
386 orient = ANGLE_HORIZONTAL;
387 }
388
389 KIFONT::FONT* font = GetFont();
390
391 if( !font )
392 font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
393
394 /*
395 * Calculate the text justification, according to the symbol orientation/mirror.
396 * This is a bit complicated due to cumulative calculations:
397 * - numerous cases (mirrored or not, rotation)
398 * - the GRText function will also recalculate H and V justifications according to the text
399 * orientation.
400 * - When a symbol is mirrored, the text is not mirrored and justifications are complicated
401 * to calculate so the more easily way is to use no justifications (centered text) and
402 * use GetBoundingBox to know the text coordinate considered as centered
403 */
404 BOX2I bBox = GetBoundingBox();
405
406 // convert coordinates from draw Y axis to symbol_editor Y axis:
407 bBox.RevertYAxis();
408 VECTOR2I txtpos = bBox.Centre();
409
410 // Calculate pos according to mirror/rotation.
411 txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
412
413 GRPrintText( DC, txtpos, color, GetShownText( true ), orient, GetTextSize(),
415 font, GetFontMetrics() );
416}
417
418
419void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
420{
421 wxString msg;
422
423 LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
424
425 // Don't use GetShownText() here; we want to show the user the variable references
426 aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
427
428 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
429
430 aList.emplace_back( _( "Style" ), GetTextStyleName() );
431
432 aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
433
434 switch ( GetHorizJustify() )
435 {
436 case GR_TEXT_H_ALIGN_LEFT: msg = _( "Left" ); break;
437 case GR_TEXT_H_ALIGN_CENTER: msg = _( "Center" ); break;
438 case GR_TEXT_H_ALIGN_RIGHT: msg = _( "Right" ); break;
439 }
440
441 aList.emplace_back( _( "H Justification" ), msg );
442
443 switch ( GetVertJustify() )
444 {
445 case GR_TEXT_V_ALIGN_TOP: msg = _( "Top" ); break;
446 case GR_TEXT_V_ALIGN_CENTER: msg = _( "Center" ); break;
447 case GR_TEXT_V_ALIGN_BOTTOM: msg = _( "Bottom" ); break;
448 }
449
450 aList.emplace_back( _( "V Justification" ), msg );
451}
452
453
455{
456 /* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
457 * calling GetTextBox() that works using top to bottom Y axis orientation.
458 */
459 BOX2I bbox = GetTextBox( -1, true );
460 bbox.RevertYAxis();
461
462 // We are using now a bottom to top Y axis.
463 VECTOR2I orig = bbox.GetOrigin();
464 VECTOR2I end = bbox.GetEnd();
465
466 RotatePoint( orig, GetTextPos(), -GetTextAngle() );
467 RotatePoint( end, GetTextPos(), -GetTextAngle() );
468
469 bbox.SetOrigin( orig );
470 bbox.SetEnd( end );
471
472 // We are using now a top to bottom Y axis:
473 bbox.RevertYAxis();
474
475 return bbox;
476}
477
478
479wxString LIB_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
480{
481 return wxString::Format( _( "Graphic Text '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
482}
483
484
486{
487 return BITMAPS::text;
488}
489
490
491void LIB_TEXT::BeginEdit( const VECTOR2I& aPosition )
492{
493 SetTextPos( aPosition );
494}
495
496
497void LIB_TEXT::CalcEdit( const VECTOR2I& aPosition )
498{
499 SetTextPos( aPosition );
500}
501
502
503static struct LIB_TEXT_DESC
504{
506 {
513
514 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Mirrored" ) );
515 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Visible" ) );
516 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Width" ) );
517 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Height" ) );
518
519 // Orientation is exposed differently in schematic; mask the base for now
520 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Orientation" ) );
521 }
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
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:487
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:485
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
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:546
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:219
COLOR4D GetTextColor() const
Definition: eda_text.h:216
wxString GetTextStyleName() const
Definition: eda_text.cpp:791
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
virtual bool IsVisible() const
Definition: eda_text.h:147
void SetTextPos(const VECTOR2I &aPoint)
Definition: eda_text.cpp:398
void SetTextX(int aX)
Definition: eda_text.cpp:404
KIFONT::FONT * GetFont() const
Definition: eda_text.h:199
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
Definition: eda_text.cpp:273
void SetTextY(int aY)
Definition: eda_text.cpp:410
int GetTextWidth() const
Definition: eda_text.h:210
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:257
void Offset(const VECTOR2I &aOffset)
Definition: eda_text.cpp:416
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:160
virtual bool TextHitTest(const VECTOR2I &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:677
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 SetText(const wxString &aText)
Definition: eda_text.cpp:180
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:202
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
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:313
const wxString & GetDefaultFont() const
Definition: lib_item.cpp:142
int m_convert
Shape identification for alternate body styles.
Definition: lib_item.h:372
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
const KIFONT::METRICS & GetFontMetrics() const
Definition: lib_item.cpp:150
bool m_private
Private items are shown only in the Symbol Editor.
Definition: lib_item.h:377
int m_unit
Unit identification for multiple parts per package.
Definition: lib_item.h:366
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:46
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:175
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: lib_text.cpp:485
const BOX2I GetBoundingBox() const override
Definition: lib_text.cpp:454
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:341
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:419
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
Definition: lib_text.cpp:233
void MoveTo(const VECTOR2I &aPosition) override
Move a draw object to aPosition.
Definition: lib_text.cpp:129
LIB_TEXT(LIB_SYMBOL *aParent)
Definition: lib_text.cpp:41
void NormalizeJustification(bool inverse)
Definition: lib_text.cpp:135
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:91
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:352
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:335
void BeginEdit(const VECTOR2I &aStartPoint) override
Begin drawing a symbol library draw item at aPosition.
Definition: lib_text.cpp:491
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: lib_text.cpp:479
void CalcEdit(const VECTOR2I &aPosition) override
Calculate the attributes of an item at aPosition when it is being edited.
Definition: lib_text.cpp:497
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:267
void Offset(const VECTOR2I &aOffset) override
Set the drawing object by aOffset from the current position.
Definition: lib_text.cpp:123
void MirrorVertical(const VECTOR2I &aCenter) override
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
Definition: lib_text.cpp:204
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:74
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:76
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)
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_HORIZONTAL
Definition: eda_angle.h:433
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:434
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:439
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:437
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:362
@ LAYER_HIDDEN
Definition: layer_ids.h:386
@ LAYER_PRIVATE_NOTES
Definition: layer_ids.h:364
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:387
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:219
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
#define TYPE_HASH(x)
Definition: property.h:64
#define REGISTER_TYPE(x)
Definition: property_mgr.h:356
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_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183
@ LIB_TEXT_T
Definition: typeinfo.h:199
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588