KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_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) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2015 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include <base_units.h>
27#include <pgm_base.h>
28#include <sch_edit_frame.h>
29#include <plotters/plotter.h>
30#include <widgets/msgpanel.h>
31#include <bitmaps.h>
32#include <string_utils.h>
33#include <sch_text.h>
34#include <schematic.h>
36#include <sch_painter.h>
37#include <default_values.h>
38#include <wx/debug.h>
39#include <wx/log.h>
43#include <core/mirror.h>
44#include <core/kicad_algo.h>
46#include <trigo.h>
47
49
50
51SCH_TEXT::SCH_TEXT( const VECTOR2I& pos, const wxString& text, KICAD_T aType ) :
52 SCH_ITEM( nullptr, aType ),
54{
56
57 SetTextPos( pos );
58 SetMultilineAllowed( true );
59
60 m_excludedFromSim = false;
61}
62
63
65 SCH_ITEM( aText ),
66 EDA_TEXT( aText )
67{
69}
70
71
73{
74 // Fudge factor to match KiCad 6
75 return VECTOR2I( 0, -2500 );
76}
77
78
80{
85}
86
87
89{
91 {
93
95 SetTextX( MIRRORVAL( GetTextPos().x, aCenter ) );
96 }
97}
98
99
100void SCH_TEXT::MirrorVertically( int aCenter )
101{
103 {
104 FlipHJustify();
105
107 SetTextY( MIRRORVAL( GetTextPos().y, aCenter ) );
108 }
109}
110
111
112void SCH_TEXT::Rotate( const VECTOR2I& aCenter )
113{
114 VECTOR2I pt = GetTextPos();
115 RotatePoint( pt, aCenter, ANGLE_90 );
116 VECTOR2I offset = pt - GetTextPos();
117
118 Rotate90( false );
119
120 SetTextPos( GetTextPos() + offset );
121}
122
123
124void SCH_TEXT::Rotate90( bool aClockwise )
125{
126 if( ( GetTextAngle() == ANGLE_HORIZONTAL && aClockwise )
127 || ( GetTextAngle() == ANGLE_VERTICAL && !aClockwise ) )
128 {
129 FlipHJustify();
130 }
131
133}
134
135
136void SCH_TEXT::MirrorSpinStyle( bool aLeftRight )
137{
138 if( ( GetTextAngle() == ANGLE_HORIZONTAL && aLeftRight )
139 || ( GetTextAngle() == ANGLE_VERTICAL && !aLeftRight ) )
140 {
141 FlipHJustify();
142 }
143}
144
145
147{
148 SCH_ITEM::SwapFlags( aItem );
149
150 SCH_TEXT* item = static_cast<SCH_TEXT*>( aItem );
151
152 std::swap( m_layer, item->m_layer );
153
154 SwapText( *item );
155 SwapAttributes( *item );
156}
157
158
159bool SCH_TEXT::operator<( const SCH_ITEM& aItem ) const
160{
161 if( Type() != aItem.Type() )
162 return Type() < aItem.Type();
163
164 auto other = static_cast<const SCH_TEXT*>( &aItem );
165
166 if( GetLayer() != other->GetLayer() )
167 return GetLayer() < other->GetLayer();
168
169 if( GetPosition().x != other->GetPosition().x )
170 return GetPosition().x < other->GetPosition().x;
171
172 if( GetPosition().y != other->GetPosition().y )
173 return GetPosition().y < other->GetPosition().y;
174
175 if( GetExcludedFromSim() != other->GetExcludedFromSim() )
176 return GetExcludedFromSim() - other->GetExcludedFromSim();
177
178 return GetText() < other->GetText();
179}
180
181
182int SCH_TEXT::GetTextOffset( const RENDER_SETTINGS* aSettings ) const
183{
184 double ratio;
185
186 if( aSettings )
187 ratio = static_cast<const SCH_RENDER_SETTINGS*>( aSettings )->m_TextOffsetRatio;
188 else if( Schematic() )
190 else
191 ratio = DEFAULT_TEXT_OFFSET_RATIO; // For previews (such as in Preferences), etc.
192
193 return KiROUND( ratio * GetTextSize().y );
194}
195
196
198{
200}
201
202
204{
206
207 if( !font )
209
210 return font;
211}
212
213
214void SCH_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
215{
217 bool blackAndWhiteMode = GetGRForceBlackPenState();
218 VECTOR2I text_offset = aOffset + GetSchematicTextOffset( aSettings );
219
220 if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
221 color = aSettings->GetLayerColor( m_layer );
222
223 KIFONT::FONT* font = GetFont();
224
225 if( !font )
226 font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
227
228 // Adjust text drawn in an outline font to more closely mimic the positioning of
229 // SCH_FIELD text.
230 if( font->IsOutline() )
231 {
232 BOX2I firstLineBBox = GetTextBox( 0 );
233 int sizeDiff = firstLineBBox.GetHeight() - GetTextSize().y;
234 int adjust = KiROUND( sizeDiff * 0.4 );
235 VECTOR2I adjust_offset( 0, - adjust );
236
237 RotatePoint( adjust_offset, GetDrawRotation() );
238 text_offset += adjust_offset;
239 }
240
241 EDA_TEXT::Print( aSettings, text_offset, color );
242}
243
244
246{
247 BOX2I bbox = GetTextBox();
248
249 if( !GetTextAngle().IsZero() ) // Rotate bbox.
250 {
251 VECTOR2I pos = bbox.GetOrigin();
252 VECTOR2I end = bbox.GetEnd();
253
256
257 bbox.SetOrigin( pos );
258 bbox.SetEnd( end );
259 }
260
261 bbox.Normalize();
262 return bbox;
263}
264
265
266wxString SCH_TEXT::GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
267 int aDepth ) const
268{
269 SCH_SHEET* sheet = nullptr;
270
271 if( aPath )
272 sheet = aPath->Last();
273 else if( SCHEMATIC* schematic = Schematic() )
274 sheet = schematic->CurrentSheet().Last();
275
276 std::function<bool( wxString* )> textResolver =
277 [&]( wxString* token ) -> bool
278 {
279 if( sheet )
280 {
281 if( sheet->ResolveTextVar( aPath, token, aDepth + 1 ) )
282 return true;
283 }
284
285 return false;
286 };
287
288 wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
289
290 if( text == wxS( "~" ) ) // Legacy placeholder for empty string
291 {
292 text = wxS( "" );
293 }
294 else if( HasTextVars() )
295 {
296 if( aDepth < 10 )
297 text = ExpandTextVars( text, &textResolver );
298 }
299
300 return text;
301}
302
303
305{
306 wxCHECK_MSG( IsHypertext(), /* void */,
307 "Calling a hypertext menu on a SCH_TEXT with no hyperlink?" );
308
310 navTool->HypertextCommand( m_hyperlink );
311}
312
313
314wxString SCH_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
315{
316 return wxString::Format( _( "Graphic Text '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
317}
318
319
321{
322 return BITMAPS::text;
323}
324
325
326bool SCH_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
327{
328 BOX2I bBox = GetBoundingBox();
329 bBox.Inflate( aAccuracy );
330 return bBox.Contains( aPosition );
331}
332
333
334bool SCH_TEXT::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
335{
336 BOX2I bBox = GetBoundingBox();
337 bBox.Inflate( aAccuracy );
338
339 if( aContained )
340 return aRect.Contains( bBox );
341
342 return aRect.Intersects( bBox );
343}
344
345
346void SCH_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
347{
348 aCount = 2;
349 aLayers[0] = m_layer;
350 aLayers[1] = LAYER_SELECTION_SHADOWS;
351}
352
353
354void SCH_TEXT::Plot( PLOTTER* aPlotter, bool aBackground ) const
355{
356 if( aBackground )
357 return;
358
359 RENDER_SETTINGS* settings = aPlotter->RenderSettings();
360 SCH_CONNECTION* connection = Connection();
361 int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
363 int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
364 VECTOR2I text_offset = GetSchematicTextOffset( aPlotter->RenderSettings() );
365
366 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
367 color = settings->GetLayerColor( layer );
368
369 penWidth = std::max( penWidth, settings->GetMinPenWidth() );
370 aPlotter->SetCurrentLineWidth( penWidth );
371
372 KIFONT::FONT* font = GetFont();
373
374 if( !font )
375 font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
376
377 // Adjust text drawn in an outline font to more closely mimic the positioning of
378 // SCH_FIELD text.
379 if( font->IsOutline() )
380 {
381 BOX2I firstLineBBox = GetTextBox( 0 );
382 int sizeDiff = firstLineBBox.GetHeight() - GetTextSize().y;
383 int adjust = KiROUND( sizeDiff * 0.4 );
384 VECTOR2I adjust_offset( 0, - adjust );
385
386 RotatePoint( adjust_offset, GetDrawRotation() );
387 text_offset += adjust_offset;
388 }
389
390 std::vector<VECTOR2I> positions;
391 wxArrayString strings_list;
392 wxStringSplit( GetShownText( true ), strings_list, '\n' );
393 positions.reserve( strings_list.Count() );
394
395 GetLinePositions( positions, (int) strings_list.Count() );
396
398 attrs.m_StrokeWidth = penWidth;
399 attrs.m_Multiline = false;
400
401 for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
402 {
403 VECTOR2I textpos = positions[ii] + text_offset;
404 wxString& txt = strings_list.Item( ii );
405 aPlotter->PlotText( textpos, color, txt, attrs, font, GetFontMetrics() );
406 }
407
408 if( HasHyperlink() )
409 aPlotter->HyperlinkBox( GetBoundingBox(), GetHyperlink() );
410}
411
412
413void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
414{
415 wxString msg;
416
417 // Don't use GetShownText() here; we want to show the user the variable references
418 aList.emplace_back( _( "Graphic Text" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
419
421 aList.emplace_back( _( "Exclude from" ), _( "Simulation" ) );
422
423 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
424
425 wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
426 int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
427 aList.emplace_back( _( "Style" ), textStyle[style] );
428
429 aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
430
431 switch( GetHorizJustify() )
432 {
433 case GR_TEXT_H_ALIGN_LEFT: msg = _( "Align left" ); break;
434 case GR_TEXT_H_ALIGN_CENTER: msg = _( "Align center" ); break;
435 case GR_TEXT_H_ALIGN_RIGHT: msg = _( "Align right" ); break;
436 }
437
438 aList.emplace_back( _( "Justification" ), msg );
439}
440
441
442#if defined(DEBUG)
443
444void SCH_TEXT::Show( int nestLevel, std::ostream& os ) const
445{
446 // XML output:
447 wxString s = GetClass();
448
449 NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str()
450 << " layer=\"" << m_layer << '"'
451 << '>'
452 << TO_UTF8( GetText() )
453 << "</" << s.Lower().mb_str() << ">\n";
454}
455
456#endif
457
458
459static struct SCH_TEXT_DESC
460{
462 {
469
470 propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Mirrored" ) );
471 propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Visible" ) );
472 propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Width" ) );
473 propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Height" ) );
474
475 // Orientation is exposed differently in schematic; mask the base for now
476 propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Orientation" ) );
477 }
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
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:120
const Vec & GetOrigin() const
Definition: box2.h:184
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:270
coord_type GetHeight() const
Definition: box2.h:189
const Vec GetEnd() const
Definition: box2.h:186
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
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:256
The base class for create windows for drawing purpose.
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
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
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
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 SetTextY(int aY)
Definition: eda_text.cpp:410
virtual EDA_ANGLE GetDrawRotation() const
Definition: eda_text.h:315
wxString m_hyperlink
A hyperlink URL.
Definition: eda_text.h:390
int GetTextWidth() const
Definition: eda_text.h:210
virtual bool HasHyperlink() const
Definition: eda_text.h:335
wxString GetHyperlink() const
Definition: eda_text.h:336
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:160
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition: eda_text.h:114
void GetLinePositions(std::vector< VECTOR2I > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
Definition: eda_text.cpp:726
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
void SwapAttributes(EDA_TEXT &aTradingPartner)
Swap the text attributes of the two involved instances.
Definition: eda_text.cpp:292
bool IsBold() const
Definition: eda_text.h:144
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
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, const COLOR4D &aColor, OUTLINE_MODE aDisplay_mode=FILLED)
Print this text object to the device context aDC.
Definition: eda_text.cpp:702
void SwapText(EDA_TEXT &aTradingPartner)
Definition: eda_text.cpp:285
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
virtual bool IsOutline() const
Definition: font.h:139
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.
Store schematic specific render settings.
Definition: sch_painter.h:71
Base plotter engine class.
Definition: plotter.h:104
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:135
virtual void HyperlinkBox(const BOX2I &aBox, const wxString &aDestinationURL)
Create a clickable hyperlink with a rectangular click area.
Definition: plotter.h:452
bool GetColorMode() const
Definition: plotter.h:132
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
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.
Holds all the data relating to one schematic.
Definition: schematic.h:75
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:209
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
bool IsBus() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:150
const wxString & GetDefaultFont() const
Definition: sch_item.cpp:323
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:113
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:257
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition: sch_item.cpp:267
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition: sch_item.cpp:147
const KIFONT::METRICS & GetFontMetrics() const
Definition: sch_item.cpp:331
SCH_LAYER_ID m_layer
Definition: sch_item.h:510
Handle actions specific to the schematic editor.
void HypertextCommand(const wxString &href)
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:57
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
Definition: sch_sheet.cpp:236
void DoHypertextAction(EDA_DRAW_FRAME *aFrame) const override
Definition: sch_text.cpp:304
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_text.h:65
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_text.cpp:320
bool m_excludedFromSim
Definition: sch_text.h:153
void FlipHJustify()
Definition: sch_text.cpp:79
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_text.cpp:100
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
Definition: sch_text.cpp:354
bool operator<(const SCH_ITEM &aItem) const override
Definition: sch_text.cpp:159
VECTOR2I GetPosition() const override
Definition: sch_text.h:126
virtual void Rotate90(bool aClockwise)
Definition: sch_text.cpp:124
KIFONT::FONT * getDrawFont() const override
Definition: sch_text.cpp:203
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_text.cpp:88
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_text.cpp:112
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_text.cpp:146
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_text.cpp:245
virtual wxString GetClass() const override
Return the class name.
Definition: sch_text.h:52
int GetPenWidth() const override
Definition: sch_text.cpp:197
virtual wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
Definition: sch_text.cpp:266
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_text.cpp:346
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &offset) override
Print a schematic item.
Definition: sch_text.cpp:214
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: sch_text.cpp:326
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_text.cpp:314
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: sch_text.cpp:413
virtual VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_text.cpp:72
SCH_TEXT(const VECTOR2I &aPos={ 0, 0 }, const wxString &aText=wxEmptyString, KICAD_T aType=SCH_TEXT_T)
Definition: sch_text.cpp:51
bool GetExcludedFromSim() const override
Definition: sch_text.h:73
virtual void MirrorSpinStyle(bool aLeftRight)
Definition: sch_text.cpp:136
int GetTextOffset(const RENDER_SETTINGS *aSettings=nullptr) const
Definition: sch_text.cpp:182
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:58
#define DEFAULT_TEXT_OFFSET_RATIO
Ratio of the font height to space around global labels.
#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
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:165
@ LAYER_NOTES
Definition: layer_ids.h:363
@ LAYER_BUS
Definition: layer_ids.h:350
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:387
T MIRRORVAL(T aPoint, T aMirrorRef)
Returns the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:31
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
see class PGM_BASE
#define TYPE_HASH(x)
Definition: property.h:64
#define REGISTER_TYPE(x)
Definition: property_mgr.h:356
static struct SCH_TEXT_DESC _SCH_TEXT_DESC
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: string_utils.h:378
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
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