KiCad PCB EDA Suite
lib_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 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>
37#include <core/kicad_algo.h>
38#include <trigo.h>
39#include <lib_textbox.h>
40
41
43
44
45LIB_TEXTBOX::LIB_TEXTBOX( LIB_SYMBOL* aParent, int aLineWidth, FILL_T aFillType,
46 const wxString& text ) :
47 LIB_SHAPE( aParent, SHAPE_T::RECT, aLineWidth, aFillType, LIB_TEXTBOX_T ),
49{
53 SetMultilineAllowed( true );
54}
55
56
58 LIB_SHAPE( aText ),
59 EDA_TEXT( aText )
60{ }
61
62
64{
65 return KiROUND( GetTextSize().y * 0.8 );
66}
67
68
70{
71 // Text is NOT really mirrored; it just has its justification flipped
73 {
74 switch( GetHorizJustify() )
75 {
77 case GR_TEXT_H_ALIGN_CENTER: break;
79 }
80 }
81}
82
83
85{
86 // Text is NOT really mirrored; it just has its justification flipped
88 {
89 switch( GetHorizJustify() )
90 {
92 case GR_TEXT_H_ALIGN_CENTER: break;
94 }
95 }
96}
97
98
99void LIB_TEXTBOX::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
100{
101 LIB_SHAPE::Rotate( aCenter, aRotateCCW );
103}
104
105
107{
108 int margin = GetTextMargin();
109 BOX2I bbox( VECTOR2I( std::min( m_start.x, m_end.x ), std::min( -m_start.y, -m_end.y ) ),
110 VECTOR2I( abs( m_end.x - m_start.x ), abs( m_end.y - m_start.y ) ) );
111
112 VECTOR2I pos( bbox.GetLeft() + margin, bbox.GetBottom() - margin );
113
115 {
116 switch( GetHorizJustify() )
117 {
119 pos.y = bbox.GetBottom() - margin;
120 break;
122 pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2;
123 break;
125 pos.y = bbox.GetTop() + margin;
126 break;
127 }
128
129 switch( GetVertJustify() )
130 {
132 pos.x = bbox.GetLeft() + margin;
133 break;
135 pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2;
136 break;
138 pos.x = bbox.GetRight() - margin;
139 break;
140 }
141 }
142 else
143 {
144 switch( GetHorizJustify() )
145 {
147 pos.x = bbox.GetLeft() + margin;
148 break;
150 pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2;
151 break;
153 pos.x = bbox.GetRight() - margin;
154 break;
155 }
156
157 switch( GetVertJustify() )
158 {
160 pos.y = bbox.GetTop() + margin;
161 break;
163 pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2;
164 break;
166 pos.y = bbox.GetBottom() - margin;
167 break;
168 }
169 }
170
171 return pos;
172}
173
174
175int LIB_TEXTBOX::compare( const LIB_ITEM& aOther, int aCompareFlags ) const
176{
177 wxASSERT( aOther.Type() == LIB_TEXTBOX_T );
178
179 int retv = LIB_ITEM::compare( aOther, aCompareFlags );
180
181 if( retv )
182 return retv;
183
184 const LIB_TEXTBOX* tmp = static_cast<const LIB_TEXTBOX*>( &aOther );
185
186 int result = GetText().CmpNoCase( tmp->GetText() );
187
188 if( result != 0 )
189 return result;
190
191 if( GetTextWidth() != tmp->GetTextWidth() )
192 return GetTextWidth() - tmp->GetTextWidth();
193
194 if( GetTextHeight() != tmp->GetTextHeight() )
195 return GetTextHeight() - tmp->GetTextHeight();
196
197 if( IsBold() != tmp->IsBold() )
198 return IsBold() - tmp->IsBold();
199
200 if( IsItalic() != tmp->IsItalic() )
201 return IsItalic() - tmp->IsItalic();
202
203 if( GetHorizJustify() != tmp->GetHorizJustify() )
204 return GetHorizJustify() - tmp->GetHorizJustify();
205
206 if( GetTextAngle().AsTenthsOfADegree() != tmp->GetTextAngle().AsTenthsOfADegree() )
208
209 return EDA_SHAPE::Compare( &static_cast<const LIB_SHAPE&>( aOther ) );
210}
211
212
214{
216
217 if( !font )
219
220 return font;
221}
222
223
224void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
225 const TRANSFORM& aTransform, bool aDimmed )
226{
227 if( IsPrivate() )
228 return;
229
230 bool forceNoFill = static_cast<bool>( aData );
231 bool blackAndWhiteMode = GetGRForceBlackPenState();
232 int penWidth = GetEffectivePenWidth( aSettings );
234 PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
235
236 wxDC* DC = aSettings->GetPrintDC();
237 VECTOR2I pt1 = aTransform.TransformCoordinate( m_start ) + aOffset;
238 VECTOR2I pt2 = aTransform.TransformCoordinate( m_end ) + aOffset;
239
240 if( !forceNoFill && GetFillMode() == FILL_T::FILLED_WITH_COLOR && !blackAndWhiteMode )
241 GRFilledRect( DC, pt1, pt2, penWidth, GetFillColor(), GetFillColor() );
242
243 if( penWidth > 0 )
244 {
245 penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
246
247 if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
248 color = aSettings->GetLayerColor( LAYER_DEVICE );
249
250 COLOR4D bg = aSettings->GetBackgroundColor();
251
252 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
253 bg = COLOR4D::WHITE;
254
255 if( aDimmed )
256 color = color.Mix( bg, 0.5f );
257
258 if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
259 lineStyle = PLOT_DASH_TYPE::SOLID;
260
261 if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
262 {
263 GRRect( DC, pt1, pt2, penWidth, color );
264 }
265 else
266 {
267 std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
268
269 for( SHAPE* shape : shapes )
270 {
271 STROKE_PARAMS::Stroke( shape, lineStyle, penWidth, aSettings,
272 [&]( const VECTOR2I& a, const VECTOR2I& b )
273 {
274 VECTOR2I pts = aTransform.TransformCoordinate( a ) + aOffset;
275 VECTOR2I pte = aTransform.TransformCoordinate( b ) + aOffset;
276 GRLine( DC, pts.x, pts.y, pte.x, pte.y, penWidth, color );
277 } );
278 }
279
280 for( SHAPE* shape : shapes )
281 delete shape;
282 }
283 }
284
285 LIB_TEXTBOX text( *this );
286
288
289 if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
290 color = aSettings->GetLayerColor( LAYER_DEVICE );
291
292 COLOR4D bg = aSettings->GetBackgroundColor();
293
294 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
295 bg = COLOR4D::WHITE;
296
297 if( aDimmed )
298 color = color.Mix( bg, 0.5f );
299
300 penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetMinPenWidth() );
301
302 if( aTransform.y1 )
303 {
304 text.SetTextAngle( text.GetTextAngle() == ANGLE_HORIZONTAL ? ANGLE_VERTICAL
306 }
307
308 KIFONT::FONT* font = GetFont();
309
310 if( !font )
311 font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
312
313 // NB: GetDrawPos() will want Symbol Editor (upside-down) coordinates
314 text.SetStart( VECTOR2I( pt1.x, -pt1.y ) );
315 text.SetEnd( VECTOR2I( pt2.x, -pt2.y ) );
316
317 GRPrintText( DC, text.GetDrawPos(), color, text.GetShownText(), text.GetTextAngle(),
318 text.GetTextSize(), text.GetHorizJustify(), text.GetVertJustify(), penWidth,
319 text.IsItalic(), text.IsBold(), font );
320}
321
322
323wxString LIB_TEXTBOX::GetShownText( int aDepth, bool aAllowExtraText ) const
324{
325 wxString text = EDA_TEXT::GetShownText();
326
327 KIFONT::FONT* font = GetFont();
328 VECTOR2D size = GetEnd() - GetStart();
329 int colWidth = GetTextAngle() == ANGLE_HORIZONTAL ? size.x : size.y;
330
331 if( !font )
333
334 colWidth = abs( colWidth ) - GetTextMargin() * 2;
335 font->LinebreakText( text, colWidth, GetTextSize(), GetTextThickness(), IsBold(), IsItalic() );
336
337 return text;
338}
339
340
341bool LIB_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
342{
345
346 BOX2I rect = GetBoundingBox();
347
348 rect.Inflate( aAccuracy );
349
350 return rect.Contains( aPosition );
351}
352
353
354bool LIB_TEXTBOX::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
355{
356 BOX2I rect = aRect;
357
358 rect.Inflate( aAccuracy );
359
360 if( aContained )
361 return rect.Contains( GetBoundingBox() );
362
363 return rect.Intersects( GetBoundingBox() );
364}
365
366
367wxString LIB_TEXTBOX::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
368{
369 return wxString::Format( _( "Graphic Text Box" ) );
370}
371
372
374{
376}
377
378
379void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
380 const TRANSFORM& aTransform, bool aDimmed ) const
381{
382 wxASSERT( aPlotter != nullptr );
383
384 if( IsPrivate() )
385 return;
386
387 if( aBackground )
388 {
389 LIB_SHAPE::Plot( aPlotter, aBackground, aOffset, aTransform, aDimmed );
390 return;
391 }
392
393 RENDER_SETTINGS* renderSettings = aPlotter->RenderSettings();
394 VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
395 VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
396 COLOR4D bg = renderSettings->GetBackgroundColor();
397
398 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
399 bg = COLOR4D::WHITE;
400
401 int penWidth = GetEffectivePenWidth( renderSettings );
403 PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
404
405 if( penWidth > 0 )
406 {
407 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
408 color = renderSettings->GetLayerColor( LAYER_DEVICE );
409
410 if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
411 lineStyle = PLOT_DASH_TYPE::DASH;
412
413 if( aDimmed )
414 color = color.Mix( bg, 0.5f );
415
416 aPlotter->SetColor( color );
417 aPlotter->SetDash( penWidth, lineStyle );
418 aPlotter->Rect( start, end, FILL_T::NO_FILL, penWidth );
419 aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
420 }
421
422 KIFONT::FONT* font = GetFont();
423
424 if( !font )
425 font = KIFONT::FONT::GetFont( renderSettings->GetDefaultFont(), IsBold(), IsItalic() );
426
427 LIB_TEXTBOX text( *this );
428
430
431 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
432 color = renderSettings->GetLayerColor( LAYER_DEVICE );
433
434 if( aDimmed )
435 color = color.Mix( bg, 0.5f );
436
437 penWidth = std::max( GetEffectiveTextPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
438
439 if( aTransform.y1 )
440 {
441 text.SetTextAngle( text.GetTextAngle() == ANGLE_HORIZONTAL ? ANGLE_VERTICAL
443 }
444
445 // NB: GetDrawPos() will want Symbol Editor (upside-down) coordinates
446 text.SetStart( VECTOR2I( start.x, -start.y ) );
447 text.SetEnd( VECTOR2I( end.x, -end.y ) );
448
449 std::vector<VECTOR2I> positions;
450 wxArrayString strings_list;
451 wxStringSplit( GetShownText(), strings_list, '\n' );
452 positions.reserve( strings_list.Count() );
453
454 text.GetLinePositions( positions, (int) strings_list.Count() );
455
456 for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
457 {
458 aPlotter->Text( positions[ii], color, strings_list.Item( ii ), text.GetTextAngle(),
459 text.GetTextSize(), text.GetHorizJustify(), text.GetVertJustify(),
460 penWidth, text.IsItalic(), text.IsBold(), false, font );
461 }
462}
463
464
465void LIB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
466{
467 // Don't use GetShownText() here; we want to show the user the variable references
468 aList.emplace_back( _( "Text Box" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
469
470 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
471
472 wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
473 int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
474 aList.emplace_back( _( "Style" ), textStyle[style] );
475
476 aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
477
478 aList.emplace_back( _( "Box Width" ),
479 aFrame->MessageTextFromValue( std::abs( GetEnd().x - GetStart().x ) ) );
480
481 aList.emplace_back( _( "Box Height" ),
482 aFrame->MessageTextFromValue( std::abs( GetEnd().y - GetStart().y ) ) );
483
484 m_stroke.GetMsgPanelInfo( aFrame, aList );
485}
486
487
488void LIB_TEXTBOX::ViewGetLayers( int aLayers[], int& aCount ) const
489{
490 aCount = 3;
491 aLayers[0] = IsPrivate() ? LAYER_PRIVATE_NOTES : LAYER_DEVICE;
493 aLayers[2] = LAYER_SELECTION_SHADOWS;
494}
int color
Definition: DXF_plotter.cpp:57
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:269
coord_type GetTop() const
Definition: box2.h:194
bool Contains(const Vec &aPoint) const
Definition: box2.h:141
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506
coord_type GetRight() const
Definition: box2.h:189
coord_type GetLeft() const
Definition: box2.h:193
coord_type GetBottom() const
Definition: box2.h:190
int AsTenthsOfADegree() const
Definition: eda_angle.h:151
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:101
VECTOR2I m_start
Definition: eda_shape.h:369
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:145
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:120
COLOR4D GetFillColor() const
Definition: eda_shape.h:105
VECTOR2I m_end
Definition: eda_shape.h:370
STROKE_PARAMS m_stroke
Definition: eda_shape.h:365
int Compare(const EDA_SHAPE *aOther) const
Definition: eda_shape.cpp:1496
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
int GetTextHeight() const
Definition: eda_text.h:195
COLOR4D GetTextColor() const
Definition: eda_text.h:198
bool IsItalic() const
Definition: eda_text.h:123
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:120
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
KIFONT::FONT * GetFont() const
Definition: eda_text.h:181
int GetTextWidth() const
Definition: eda_text.h:192
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:248
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:142
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition: eda_text.cpp:297
bool IsBold() const
Definition: eda_text.h:126
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:145
void SetTextSize(const VECTOR2I &aNewSize)
Definition: eda_text.cpp:347
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:193
int GetTextThickness() const
Definition: eda_text.h:112
virtual wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:98
void SetMultilineAllowed(bool aAllow)
Definition: eda_text.cpp:232
VECTOR2I GetTextSize() const
Definition: eda_text.h:189
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:240
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:105
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false)
Definition: font.cpp:65
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:423
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.
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
Store schematic specific render settings.
Definition: sch_painter.h:71
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
bool IsPrivate() const
Definition: lib_item.h:279
const wxString & GetDefaultFont() const
Definition: lib_item.cpp:128
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:74
virtual int GetEffectivePenWidth(const RENDER_SETTINGS *aSettings) const
Definition: lib_item.h:155
STROKE_PARAMS GetStroke() const
Definition: lib_shape.h:52
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_shape.cpp:134
const BOX2I GetBoundingBox() const override
Definition: lib_shape.cpp:434
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
Definition: lib_shape.cpp:126
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const override
Make a set of SHAPE objects representing the LIB_SHAPE.
Definition: lib_shape.h:96
Define a library symbol object.
Definition: lib_symbol.h:98
void print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed) override
Print the item to aDC.
VECTOR2I GetDrawPos() const override
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.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
int GetTextMargin() const
Definition: lib_textbox.cpp:63
void MirrorHorizontally(const VECTOR2I &center)
Definition: lib_textbox.cpp:69
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
KIFONT::FONT * getDrawFont() const override
LIB_TEXTBOX(LIB_SYMBOL *aParent, int aLineWidth=0, FILL_T aFillType=FILL_T::NO_FILL, const wxString &aText=wxEmptyString)
Definition: lib_textbox.cpp:45
void Plot(PLOTTER *aPlotter, bool aBackground, const VECTOR2I &offset, const TRANSFORM &aTransform, bool aDimmed) const override
Plot the draw item using the plot object.
int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const override
Provide the draw object specific comparison called by the == and < operators.
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the object about aCenter point.
Definition: lib_textbox.cpp:99
void MirrorVertically(const VECTOR2I &center)
Definition: lib_textbox.cpp:84
Base plotter engine class.
Definition: plotter.h:110
virtual void SetDash(int aLineWidth, PLOT_DASH_TYPE aLineStyle)=0
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
virtual void Text(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 aPenWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, void *aData=nullptr)
Draw text with the plotter.
Definition: plotter.cpp:714
bool GetColorMode() const
Definition: plotter.h:138
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
An abstract shape on 2D plane.
Definition: shape.h:123
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
PLOT_DASH_TYPE GetPlotStyle() const
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:47
int y1
Definition: transform.h:50
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
@ WHITE
Definition: color4d.h:48
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
#define _(s)
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
Definition: eda_angle.h:408
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:409
SHAPE_T
Definition: eda_shape.h:41
FILL_T
Definition: eda_shape.h:54
@ FILLED_WITH_COLOR
void GRRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor)
Definition: gr_basic.cpp:387
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:162
void GRFilledRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor, const COLOR4D &aBgColor)
Definition: gr_basic.cpp:394
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:156
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)
Print a graphic text through wxDC.
Definition: gr_text.cpp:129
@ LAYER_DEVICE
Definition: layer_ids.h:357
@ LAYER_PRIVATE_NOTES
Definition: layer_ids.h:359
@ LAYER_DEVICE_BACKGROUND
Definition: layer_ids.h:372
@ LAYER_NOTES_BACKGROUND
Definition: layer_ids.h:360
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:381
#define MINIMUM_SELECTION_DISTANCE
Definition: lib_item.h:46
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:185
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:401
see class PGM_BASE
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
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
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
@ 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
@ LIB_TEXTBOX_T
Definition: typeinfo.h:201
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:618