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-2024 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 <general.h>
34#include <transform.h>
36#include <lib_text.h>
37#include <default_values.h> // For some default values
38#include <string_utils.h>
39
41 SCH_ITEM( aParent, LIB_TEXT_T ),
42 EDA_TEXT( schIUScale, wxEmptyString )
43{
46}
47
48
49void LIB_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
50{
51 aCount = 2;
53 aLayers[1] = LAYER_SELECTION_SHADOWS;
54}
55
56
57bool LIB_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
58{
59 EDA_TEXT tmp_text( *this );
61
62 /* The text orientation may need to be flipped if the
63 * transformation matrix causes xy axes to be flipped.
64 * this simple algo works only for schematic matrix (rot 90 or/and mirror)
65 */
66 bool t1 = ( DefaultTransform.x1 != 0 ) ^ ( GetTextAngle() != ANGLE_HORIZONTAL );
67
69 return tmp_text.TextHitTest( aPosition, aAccuracy );
70}
71
72
74{
75 return new LIB_TEXT( *this );
76}
77
78
79int LIB_TEXT::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
80{
81 wxASSERT( aOther.Type() == LIB_TEXT_T );
82
83 int retv = SCH_ITEM::compare( aOther, aCompareFlags );
84
85 if( retv )
86 return retv;
87
88 const LIB_TEXT* tmp = ( LIB_TEXT* ) &aOther;
89
90 int result = GetText().CmpNoCase( tmp->GetText() );
91
92 if( result != 0 )
93 return result;
94
95 if( GetTextPos().x != tmp->GetTextPos().x )
96 return GetTextPos().x - tmp->GetTextPos().x;
97
98 if( GetTextPos().y != tmp->GetTextPos().y )
99 return GetTextPos().y - tmp->GetTextPos().y;
100
101 if( GetTextWidth() != tmp->GetTextWidth() )
102 return GetTextWidth() - tmp->GetTextWidth();
103
104 if( GetTextHeight() != tmp->GetTextHeight() )
105 return GetTextHeight() - tmp->GetTextHeight();
106
107 return 0;
108}
109
110
111void LIB_TEXT::Move( const VECTOR2I& aOffset )
112{
113 EDA_TEXT::Offset( aOffset );
114}
115
116
118{
120 return;
121
122 VECTOR2I delta( 0, 0 );
123 BOX2I bbox = GetTextBox();
124
125 if( GetTextAngle().IsHorizontal() )
126 {
128 delta.x = bbox.GetWidth() / 2;
130 delta.x = - bbox.GetWidth() / 2;
131
133 delta.y = - bbox.GetHeight() / 2;
135 delta.y = bbox.GetHeight() / 2;
136 }
137 else
138 {
140 delta.y = bbox.GetWidth() / 2;
142 delta.y = - bbox.GetWidth() / 2;
143
145 delta.x = + bbox.GetHeight() / 2;
147 delta.x = - bbox.GetHeight() / 2;
148 }
149
150 if( inverse )
152 else
154}
155
156
158{
159 NormalizeJustification( false );
160 int x = GetTextPos().x;
161
162 x -= aCenter;
163 x *= -1;
164 x += aCenter;
165
166 if( GetTextAngle().IsHorizontal() )
167 {
172 }
173 else
174 {
179 }
180
181 SetTextX( x );
183}
184
185
186void LIB_TEXT::MirrorVertically( int aCenter )
187{
188 NormalizeJustification( false );
189 int y = GetTextPos().y;
190
191 y -= aCenter;
192 y *= -1;
193 y += aCenter;
194
195 if( GetTextAngle().IsHorizontal() )
196 {
201 }
202 else
203 {
208 }
209
210 SetTextY( y );
212}
213
214
215void LIB_TEXT::Rotate( const VECTOR2I& center, bool aRotateCCW )
216{
217 NormalizeJustification( false );
218 EDA_ANGLE rot_angle = aRotateCCW ? -ANGLE_90 : ANGLE_90;
219
220 VECTOR2I pt = GetTextPos();
221 RotatePoint( pt, center, rot_angle );
222 SetTextPos( pt );
223
224 if( GetTextAngle().IsHorizontal() )
225 {
227 }
228 else
229 {
230 // 180° rotation is a mirror
231
236
241
243 }
244
246}
247
248
249void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
250 int aUnit, int aBodyStyle, const VECTOR2I& offset, bool aDimmed )
251{
252 wxASSERT( plotter != nullptr );
253
254 if( IsPrivate() )
255 return;
256
257 if( aBackground )
258 return;
259
260 SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( plotter );
261
262 BOX2I bBox = GetBoundingBox();
263 // convert coordinates from draw Y axis to symbol_editor Y axis
264 bBox.RevertYAxis();
265
266 /*
267 * Calculate the text justification, according to the symbol orientation/mirror. This is
268 * a bit complicated due to cumulative calculations:
269 * - numerous cases (mirrored or not, rotation)
270 * - the plotter's Text() function will also recalculate H and V justifications according
271 * to the text orientation
272 * - when a symbol is mirrored the text is not, and justifications become a nightmare
273 *
274 * So the easier way is to use no justifications (centered text) and use GetBoundingBox to
275 * know the text coordinate considered as centered.
276 */
277 VECTOR2I txtpos = bBox.Centre();
281
282 // The text orientation may need to be flipped if the transformation matrix causes xy
283 // axes to be flipped.
284 int t1 = ( renderSettings->m_Transform.x1 != 0 ) ^ ( GetTextAngle() != ANGLE_HORIZONTAL );
285 VECTOR2I pos = renderSettings->TransformCoordinate( txtpos ) + offset;
287 COLOR4D bg = renderSettings->GetBackgroundColor();
288
289 if( !plotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
290 color = renderSettings->GetLayerColor( LAYER_DEVICE );
291
292 if( !IsVisible() )
293 bg = renderSettings->GetLayerColor( LAYER_HIDDEN );
294 else if( bg == COLOR4D::UNSPECIFIED || !plotter->GetColorMode() )
295 bg = COLOR4D::WHITE;
296
297 if( aDimmed )
298 {
299 color.Desaturate( );
300 color = color.Mix( bg, 0.5f );
301 }
302
303 int penWidth = std::max( GetEffectiveTextPenWidth(), renderSettings->GetMinPenWidth() );
304
305 KIFONT::FONT* font = GetFont();
306
307 if( !font )
308 font = KIFONT::FONT::GetFont( renderSettings->GetDefaultFont(), IsBold(), IsItalic() );
309
310 attrs.m_StrokeWidth = penWidth;
312
313 plotter->PlotText( pos, color, GetText(), attrs, font, GetFontMetrics() );
314}
315
316
318{
320}
321
322
324{
326
327 if( !font )
329
330 return font;
331}
332
333
334void LIB_TEXT::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
335 const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
336{
337 wxDC* DC = aSettings->GetPrintDC();
339 bool blackAndWhiteMode = GetGRForceBlackPenState();
340 int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
341
342 if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
343 color = aSettings->GetLayerColor( LAYER_DEVICE );
344
345 COLOR4D bg = aSettings->GetBackgroundColor();
346
347 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
348 bg = COLOR4D::WHITE;
349
350 if( !IsVisible() )
351 bg = aSettings->GetLayerColor( LAYER_HIDDEN );
352
353 if( aDimmed )
354 {
355 color.Desaturate( );
356 color = color.Mix( bg, 0.5f );
357 }
358
359 // Calculate the text orientation, according to the symbol orientation/mirror (needed when
360 // draw text in schematic)
361 EDA_ANGLE orient = GetTextAngle();
362
363 if( aSettings->m_Transform.y1 ) // Rotate symbol 90 degrees.
364 {
365 if( orient == ANGLE_HORIZONTAL )
366 orient = ANGLE_VERTICAL;
367 else
368 orient = ANGLE_HORIZONTAL;
369 }
370
371 KIFONT::FONT* font = GetFont();
372
373 if( !font )
374 font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
375
376 /*
377 * Calculate the text justification, according to the symbol orientation/mirror.
378 * This is a bit complicated due to cumulative calculations:
379 * - numerous cases (mirrored or not, rotation)
380 * - the GRText function will also recalculate H and V justifications according to the text
381 * orientation.
382 * - When a symbol is mirrored, the text is not mirrored and justifications are complicated
383 * to calculate so the more easily way is to use no justifications (centered text) and
384 * use GetBoundingBox to know the text coordinate considered as centered
385 */
386 BOX2I bBox = GetBoundingBox();
387
388 // convert coordinates from draw Y axis to symbol_editor Y axis:
389 bBox.RevertYAxis();
390 VECTOR2I txtpos = bBox.Centre();
391
392 // Calculate pos according to mirror/rotation.
393 txtpos = aSettings->m_Transform.TransformCoordinate( txtpos ) + aOffset;
394
395 GRPrintText( DC, txtpos, color, GetShownText( true ), orient, GetTextSize(),
397 font, GetFontMetrics() );
398}
399
400
401void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
402{
403 wxString msg;
404
405 getSymbolEditorMsgPanelInfo( aFrame, aList );
406
407 // Don't use GetShownText() here; we want to show the user the variable references
408 aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
409
410 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
411
412 aList.emplace_back( _( "Style" ), GetTextStyleName() );
413
414 aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
415
416 switch ( GetHorizJustify() )
417 {
418 case GR_TEXT_H_ALIGN_LEFT: msg = _( "Left" ); break;
419 case GR_TEXT_H_ALIGN_CENTER: msg = _( "Center" ); break;
420 case GR_TEXT_H_ALIGN_RIGHT: msg = _( "Right" ); break;
422 }
423
424 aList.emplace_back( _( "H Justification" ), msg );
425
426 switch ( GetVertJustify() )
427 {
428 case GR_TEXT_V_ALIGN_TOP: msg = _( "Top" ); break;
429 case GR_TEXT_V_ALIGN_CENTER: msg = _( "Center" ); break;
430 case GR_TEXT_V_ALIGN_BOTTOM: msg = _( "Bottom" ); break;
432 }
433
434 aList.emplace_back( _( "V Justification" ), msg );
435}
436
437
439{
440 /* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
441 * calling GetTextBox() that works using top to bottom Y axis orientation.
442 */
443 BOX2I bbox = GetTextBox( -1, true );
444 bbox.RevertYAxis();
445
446 // We are using now a bottom to top Y axis.
447 VECTOR2I orig = bbox.GetOrigin();
448 VECTOR2I end = bbox.GetEnd();
449
450 RotatePoint( orig, GetTextPos(), -GetTextAngle() );
451 RotatePoint( end, GetTextPos(), -GetTextAngle() );
452
453 bbox.SetOrigin( orig );
454 bbox.SetEnd( end );
455
456 // We are using now a top to bottom Y axis:
457 bbox.RevertYAxis();
458
459 return bbox;
460}
461
462
463wxString LIB_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
464{
465 return wxString::Format( _( "Graphic Text '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
466}
467
468
470{
471 return BITMAPS::text;
472}
473
474
475void LIB_TEXT::BeginEdit( const VECTOR2I& aPosition )
476{
477 SetTextPos( aPosition );
478}
479
480
481void LIB_TEXT::CalcEdit( const VECTOR2I& aPosition )
482{
483 SetTextPos( aPosition );
484}
485
486
487bool LIB_TEXT::operator==( const SCH_ITEM& aOther ) const
488{
489 if( Type() != aOther.Type() )
490 return false;
491
492 const LIB_TEXT& other = static_cast<const LIB_TEXT&>( aOther );
493
494 return SCH_ITEM::operator==( aOther ) && EDA_TEXT::operator==( other );
495}
496
497
498double LIB_TEXT::Similarity( const SCH_ITEM& aOther ) const
499{
500 if( m_Uuid == aOther.m_Uuid )
501 return 1.0;
502
503 if( aOther.Type() != Type() )
504 return 0.0;
505
506 const LIB_TEXT& other = static_cast<const LIB_TEXT&>( aOther );
507
508 double similarity = SimilarityBase( other );
509 similarity *= EDA_TEXT::Similarity( other );
510
511 return similarity;
512}
513
514static struct LIB_TEXT_DESC
515{
517 {
524
525 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Mirrored" ) );
526 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Visible" ) );
527 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Width" ) );
528 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Height" ) );
529
530 // Orientation is exposed differently in schematic; mask the base for now
531 propMgr.Mask( TYPE_HASH( LIB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Orientation" ) );
532 }
int color
Definition: DXF_plotter.cpp:58
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:110
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:88
const KIID m_Uuid
Definition: eda_item.h:485
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:83
int GetTextHeight() const
Definition: eda_text.h:228
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:234
COLOR4D GetTextColor() const
Definition: eda_text.h:231
wxString GetTextStyleName() const
Definition: eda_text.cpp:824
bool IsItalic() const
Definition: eda_text.h:144
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:134
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:98
virtual bool IsVisible() const
Definition: eda_text.h:151
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:211
void SetTextY(int aY)
Definition: eda_text.cpp:431
int GetTextWidth() const
Definition: eda_text.h:225
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:164
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:195
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:148
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:167
virtual wxString GetShownText(bool aAllowExtraText, int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:109
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:205
bool operator==(const EDA_TEXT &aRhs) const
Definition: eda_text.h:357
VECTOR2I GetTextSize() const
Definition: eda_text.h:222
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
int GetDefaultPenWidth() const
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxDC * GetPrintDC() const
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:73
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: lib_text.cpp:469
bool operator==(const SCH_ITEM &aOther) const override
Definition: lib_text.cpp:487
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: lib_text.cpp:438
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:49
KIFONT::FONT * getDrawFont() const override
Definition: lib_text.cpp:323
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: lib_text.cpp:401
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW=true) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: lib_text.cpp:215
void Move(const VECTOR2I &aOffset) override
Move the item by aMoveVector to a new position.
Definition: lib_text.cpp:111
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
Definition: lib_text.cpp:249
void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aForceNoFill, bool aDimmed) override
Print an item.
Definition: lib_text.cpp:334
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: lib_text.cpp:186
int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const override
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_text.cpp:79
void NormalizeJustification(bool inverse)
Definition: lib_text.cpp:117
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:57
int GetPenWidth() const override
Definition: lib_text.cpp:317
void BeginEdit(const VECTOR2I &aStartPoint) override
Begin drawing a symbol library draw item at aPosition.
Definition: lib_text.cpp:475
LIB_TEXT(SCH_ITEM *aParent)
Definition: lib_text.cpp:40
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: lib_text.cpp:157
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: lib_text.cpp:463
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: lib_text.cpp:498
void CalcEdit(const VECTOR2I &aPosition) override
Calculate the attributes of an item at aPosition when it is being edited.
Definition: lib_text.cpp:481
Base plotter engine class.
Definition: plotter.h:104
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.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:172
const wxString & GetDefaultFont() const
Definition: sch_item.cpp:435
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition: sch_item.h:655
virtual bool operator==(const SCH_ITEM &aOther) const
Definition: sch_item.cpp:384
bool IsPrivate() const
Definition: sch_item.h:241
virtual int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
Definition: sch_item.cpp:408
const KIFONT::METRICS & GetFontMetrics() const
Definition: sch_item.cpp:443
double SimilarityBase(const SCH_ITEM &aItem) const
Calculate the boilerplate similarity for all LIB_ITEMs without preventing the use above of a pure vir...
Definition: sch_item.h:322
void getSymbolEditorMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Definition: sch_item.cpp:478
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
const KIGFX::COLOR4D & GetBackgroundColor() const override
Return current background color settings.
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
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:369
@ LAYER_HIDDEN
Definition: layer_ids.h:393
@ LAYER_PRIVATE_NOTES
Definition: layer_ids.h:371
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:394
static struct LIB_TEXT_DESC _LIB_TEXT_DESC
Message panel definition file.
KICOMMON_API wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
Definition: ui_common.cpp:210
KICOMMON_API 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:71
#define REGISTER_TYPE(x)
Definition: property_mgr.h:366
constexpr int MilsToIU(int mils) const
Definition: base_units.h:93
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:45
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588