KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_textbox.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <base_units.h>
25#include <pgm_base.h>
26#include <sch_edit_frame.h>
27#include <plotters/plotter.h>
28#include <widgets/msgpanel.h>
29#include <bitmaps.h>
30#include <string_utils.h>
31#include <schematic.h>
33#include <sch_painter.h>
34#include <wx/log.h>
38#include <core/kicad_algo.h>
39#include <trigo.h>
40#include <sch_textbox.h>
42
44
45
46SCH_TEXTBOX::SCH_TEXTBOX( int aLineWidth, FILL_T aFillType, const wxString& text ) :
47 SCH_SHAPE( SHAPE_T::RECTANGLE, aLineWidth, aFillType, SCH_TEXTBOX_T ),
49{
51
54 SetMultilineAllowed( true );
55
56 m_excludedFromSim = false;
57}
58
59
61 SCH_SHAPE( aText ),
62 EDA_TEXT( aText )
63{
65}
66
67
69{
70 return KiROUND( GetStroke().GetWidth() / 2.0 ) + KiROUND( GetTextSize().y * 0.75 );
71}
72
73
75{
76 // Text is NOT really mirrored; it just has its justification flipped
78 {
79 switch( GetHorizJustify() )
80 {
82 case GR_TEXT_H_ALIGN_CENTER: break;
84 }
85 }
86}
87
88
90{
91 // Text is NOT really mirrored; it just has its justification flipped
93 {
94 switch( GetHorizJustify() )
95 {
97 case GR_TEXT_H_ALIGN_CENTER: break;
99 }
100 }
101}
102
103
104void SCH_TEXTBOX::Rotate( const VECTOR2I& aCenter )
105{
106 SCH_SHAPE::Rotate( aCenter );
108}
109
110
111void SCH_TEXTBOX::Rotate90( bool aClockwise )
112{
114}
115
116
118{
119 int margin = GetTextMargin();
120 BOX2I bbox( m_start, m_end - m_start );
121
122 bbox.Normalize();
123
124 VECTOR2I pos( bbox.GetLeft() + margin, bbox.GetBottom() - margin );
125
127 {
128 switch( GetHorizJustify() )
129 {
131 pos.y = bbox.GetBottom() - margin;
132 break;
134 pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2;
135 break;
137 pos.y = bbox.GetTop() + margin;
138 break;
139 }
140
141 switch( GetVertJustify() )
142 {
144 pos.x = bbox.GetLeft() + margin;
145 break;
147 pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2;
148 break;
150 pos.x = bbox.GetRight() - margin;
151 break;
152 }
153 }
154 else
155 {
156 switch( GetHorizJustify() )
157 {
159 pos.x = bbox.GetLeft() + margin;
160 break;
162 pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2;
163 break;
165 pos.x = bbox.GetRight() - margin;
166 break;
167 }
168
169 switch( GetVertJustify() )
170 {
172 pos.y = bbox.GetTop() + margin;
173 break;
175 pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2;
176 break;
178 pos.y = bbox.GetBottom() - margin;
179 break;
180 }
181 }
182
183 return pos;
184}
185
186
188{
189 SCH_SHAPE::SwapData( aItem );
190
191 SCH_TEXTBOX* item = static_cast<SCH_TEXTBOX*>( aItem );
192
193 std::swap( m_layer, item->m_layer );
194
195 SwapText( *item );
196 SwapAttributes( *item );
197}
198
199
200bool SCH_TEXTBOX::operator<( const SCH_ITEM& aItem ) const
201{
202 if( Type() != aItem.Type() )
203 return Type() < aItem.Type();
204
205 auto other = static_cast<const SCH_TEXTBOX*>( &aItem );
206
207 if( GetLayer() != other->GetLayer() )
208 return GetLayer() < other->GetLayer();
209
210 if( GetPosition().x != other->GetPosition().x )
211 return GetPosition().x < other->GetPosition().x;
212
213 if( GetPosition().y != other->GetPosition().y )
214 return GetPosition().y < other->GetPosition().y;
215
216 if( GetExcludedFromSim() != other->GetExcludedFromSim() )
217 return GetExcludedFromSim() - other->GetExcludedFromSim();
218
219 return GetText() < other->GetText();
220}
221
222
224{
226
227 if( !font )
229
230 return font;
231}
232
233
234void SCH_TEXTBOX::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
235{
236 wxDC* DC = aSettings->GetPrintDC();
237 int penWidth = GetPenWidth();
238 bool blackAndWhiteMode = GetGRForceBlackPenState();
239 VECTOR2I pt1 = GetStart();
240 VECTOR2I pt2 = GetEnd();
242 PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
243
244 if( GetFillMode() == FILL_T::FILLED_WITH_COLOR && !blackAndWhiteMode )
245 GRFilledRect( DC, pt1, pt2, 0, GetFillColor(), GetFillColor() );
246
247 if( penWidth > 0 )
248 {
249 penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
250
251 if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
252 color = aSettings->GetLayerColor( m_layer );
253
254 if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
255 lineStyle = PLOT_DASH_TYPE::SOLID;
256
257 if( lineStyle == PLOT_DASH_TYPE::SOLID )
258 {
259 GRRect( DC, pt1, pt2, penWidth, color );
260 }
261 else
262 {
263 std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
264
265 for( SHAPE* shape : shapes )
266 {
267 STROKE_PARAMS::Stroke( shape, lineStyle, penWidth, aSettings,
268 [&]( const VECTOR2I& a, const VECTOR2I& b )
269 {
270 GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
271 } );
272 }
273
274 for( SHAPE* shape : shapes )
275 delete shape;
276 }
277 }
278
280
281 if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
282 color = aSettings->GetLayerColor( m_layer );
283
284 EDA_TEXT::Print( aSettings, aOffset, color );
285}
286
287
288wxString SCH_TEXTBOX::GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
289 int aDepth ) const
290{
291 SCH_SHEET* sheet = nullptr;
292
293 if( aPath )
294 sheet = aPath->Last();
295 else if( Schematic() )
296 sheet = Schematic()->CurrentSheet().Last();
297
298 std::function<bool( wxString* )> textResolver =
299 [&]( wxString* token ) -> bool
300 {
301 if( sheet )
302 {
303 if( sheet->ResolveTextVar( token, aDepth + 1 ) )
304 return true;
305 }
306
307 return false;
308 };
309
310 wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
311
312 if( HasTextVars() )
313 {
314 if( aDepth < 10 )
315 text = ExpandTextVars( text, &textResolver );
316 }
317
318 KIFONT::FONT* font = GetFont();
319
320 if( !font )
322
323 VECTOR2D size = GetEnd() - GetStart();
324 int colWidth = GetTextAngle() == ANGLE_HORIZONTAL ? size.x : size.y;
325
326 colWidth = abs( colWidth ) - GetTextMargin() * 2;
327 font->LinebreakText( text, colWidth, GetTextSize(), GetTextThickness(), IsBold(), IsItalic() );
328
329 return text;
330}
331
332
333bool SCH_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
334{
335 BOX2I rect = GetBoundingBox();
336
337 rect.Inflate( aAccuracy );
338
339 return rect.Contains( aPosition );
340}
341
342
343bool SCH_TEXTBOX::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
344{
345 BOX2I rect = aRect;
346
347 rect.Inflate( aAccuracy );
348
349 if( aContained )
350 return rect.Contains( GetBoundingBox() );
351
352 return rect.Intersects( GetBoundingBox() );
353}
354
355
357{
358 wxCHECK_MSG( IsHypertext(), /* void */,
359 "Calling a hypertext menu on a SCH_TEXTBOX with no hyperlink?" );
360
362 navTool->HypertextCommand( m_hyperlink );
363}
364
365
366wxString SCH_TEXTBOX::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
367{
368 return wxString::Format( _( "Graphic Text Box" ) );
369}
370
371
373{
374 return BITMAPS::add_textbox;
375}
376
377
378void SCH_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground ) const
379{
380 if( aBackground )
381 {
382 SCH_SHAPE::Plot( aPlotter, aBackground );
383 return;
384 }
385
386 RENDER_SETTINGS* settings = aPlotter->RenderSettings();
387 int penWidth = GetPenWidth();
389 PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
390
391 if( penWidth > 0 )
392 {
393 penWidth = std::max( penWidth, settings->GetMinPenWidth() );
394
395 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
396 color = settings->GetLayerColor( m_layer );
397
398 if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
399 lineStyle = PLOT_DASH_TYPE::SOLID;
400
401 aPlotter->SetColor( color );
402 aPlotter->SetDash( penWidth, lineStyle );
403 aPlotter->Rect( m_start, m_end, FILL_T::NO_FILL, penWidth );
404 aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
405 }
406
407 KIFONT::FONT* font = GetFont();
408
409 if( !font )
410 font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
411
413
414 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
415 color = settings->GetLayerColor( m_layer );
416
417 penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
418 penWidth = std::max( penWidth, settings->GetMinPenWidth() );
419 aPlotter->SetCurrentLineWidth( penWidth );
420
421 std::vector<VECTOR2I> positions;
422 wxArrayString strings_list;
423 wxStringSplit( GetShownText( true ), strings_list, '\n' );
424 positions.reserve( strings_list.Count() );
425
426 GetLinePositions( positions, (int) strings_list.Count() );
427
429 attrs.m_StrokeWidth = penWidth;
430 attrs.m_Multiline = false;
431
432 for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
433 {
434 aPlotter->PlotText( positions[ii], color, strings_list.Item( ii ), attrs, font,
435 GetFontMetrics() );
436 }
437
438 if( HasHyperlink() )
439 aPlotter->HyperlinkBox( GetBoundingBox(), GetHyperlink() );
440}
441
442
443void SCH_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
444{
445 // Don't use GetShownText() here; we want to show the user the variable references
446 aList.emplace_back( _( "Text Box" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
447
449 aList.emplace_back( _( "Exclude from" ), _( "Simulation" ) );
450
451 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
452
453 wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
454 int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
455 aList.emplace_back( _( "Style" ), textStyle[style] );
456
457 aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
458
459 aList.emplace_back( _( "Box Width" ),
460 aFrame->MessageTextFromValue( std::abs( GetEnd().x - GetStart().x ) ) );
461
462 aList.emplace_back( _( "Box Height" ),
463 aFrame->MessageTextFromValue( std::abs( GetEnd().y - GetStart().y ) ) );
464
465 m_stroke.GetMsgPanelInfo( aFrame, aList );
466}
467
468
469static struct SCH_TEXTBOX_DESC
470{
472 {
475
480
481 propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Shape" ) );
482 propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Start X" ) );
483 propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Start Y" ) );
484 propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "End X" ) );
485 propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "End Y" ) );
486 propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Width" ) );
487
488 propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Orientation" ) );
489 }
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
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:120
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:270
coord_type GetTop() const
Definition: box2.h:195
bool Contains(const Vec &aPoint) const
Definition: box2.h:142
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:507
coord_type GetRight() const
Definition: box2.h:190
coord_type GetLeft() const
Definition: box2.h:194
coord_type GetBottom() const
Definition: box2.h:191
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
FILL_T GetFillMode() const
Definition: eda_shape.h:102
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
Definition: eda_shape.h:298
VECTOR2I m_start
Definition: eda_shape.h:387
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:149
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:124
COLOR4D GetFillColor() const
Definition: eda_shape.h:106
VECTOR2I m_end
Definition: eda_shape.h:388
virtual int GetWidth() const
Definition: eda_shape.h:110
STROKE_PARAMS m_stroke
Definition: eda_shape.h:377
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:80
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
KIFONT::FONT * GetFont() const
Definition: eda_text.h:199
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
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:257
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
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:163
virtual wxString GetShownText(bool aAllowExtraText, int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:106
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:202
int GetTextThickness() const
Definition: eda_text.h:123
void 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
void LinebreakText(wxString &aText, int aColumnWidth, const VECTOR2I &aGlyphSize, int aThickness, bool aBold, bool aItalic) const
Insert characters into text to ensure that no lines are wider than aColumnWidth.
Definition: font.cpp:582
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxDC * GetPrintDC() const
Store schematic specific render settings.
Definition: sch_painter.h:71
Base plotter engine class.
Definition: plotter.h:104
virtual void SetDash(int aLineWidth, PLOT_DASH_TYPE aLineStyle)=0
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:135
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
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void SetColor(const COLOR4D &color)=0
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.
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:136
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
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)
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_shape.cpp:52
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_shape.h:75
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_shape.cpp:108
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
Definition: sch_shape.cpp:114
int GetPenWidth() const override
Definition: sch_shape.cpp:216
STROKE_PARAMS GetStroke() const override
Definition: sch_shape.h:64
VECTOR2I GetPosition() const override
Definition: sch_shape.h:77
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 MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_textbox.cpp:74
bool m_excludedFromSim
Definition: sch_textbox.h:129
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
virtual wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
bool GetExcludedFromSim() const override
Definition: sch_textbox.h:74
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool operator<(const SCH_ITEM &aItem) const override
int GetTextMargin() const
Definition: sch_textbox.cpp:68
SCH_TEXTBOX(int aLineWidth=0, FILL_T aFillType=FILL_T::NO_FILL, const wxString &aText=wxEmptyString)
Definition: sch_textbox.cpp:46
VECTOR2I GetDrawPos() const override
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_textbox.h:66
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.
virtual void Rotate90(bool aClockwise)
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &offset) override
Print a schematic item.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_textbox.cpp:89
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
KIFONT::FONT * getDrawFont() const override
void DoHypertextAction(EDA_DRAW_FRAME *aFrame) const override
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
An abstract shape on 2D plane.
Definition: shape.h:126
void GetMsgPanelInfo(UNITS_PROVIDER *aUnitsProvider, std::vector< MSG_PANEL_ITEM > &aList, bool aIncludeStyle=true, bool aIncludeWidth=true)
static void Stroke(const SHAPE *aShape, PLOT_DASH_TYPE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, std::function< void(const VECTOR2I &a, const VECTOR2I &b)> aStroker)
KIGFX::COLOR4D GetColor() const
Definition: stroke_params.h:97
PLOT_DASH_TYPE GetPlotStyle() const
Definition: stroke_params.h:94
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 _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
SHAPE_T
Definition: eda_shape.h:42
FILL_T
Definition: eda_shape.h:55
void GRRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor)
Definition: gr_basic.cpp:396
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:171
void GRFilledRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor, const COLOR4D &aBgColor)
Definition: gr_basic.cpp:403
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:165
@ LAYER_NOTES
Definition: layer_ids.h:363
Message panel definition file.
wxString EllipsizeStatusText(wxWindow *aWindow, const wxString &aString)
Ellipsize text (at the end) to be no more than 1/3 of the window width.
Definition: ui_common.cpp:201
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:426
see class PGM_BASE
#define TYPE_HASH(x)
Definition: property.h:64
#define REGISTER_TYPE(x)
Definition: property_mgr.h:356
static struct SCH_TEXTBOX_DESC _SCH_TEXTBOX_DESC
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
PLOT_DASH_TYPE
Dashed line types.
Definition: stroke_params.h:48
@ 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
@ SCH_TEXTBOX_T
Definition: typeinfo.h:148
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