KiCad PCB EDA Suite
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 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::RECT, aLineWidth, aFillType, SCH_TEXTBOX_T ),
49{
51
54 SetMultilineAllowed( true );
55}
56
57
59 SCH_SHAPE( aText ),
60 EDA_TEXT( aText )
61{ }
62
63
65{
66 return KiROUND( GetTextSize().y * 0.8 );
67}
68
69
71{
72 // Text is NOT really mirrored; it just has its justification flipped
74 {
75 switch( GetHorizJustify() )
76 {
78 case GR_TEXT_H_ALIGN_CENTER: break;
80 }
81 }
82}
83
84
86{
87 // Text is NOT really mirrored; it just has its justification flipped
89 {
90 switch( GetHorizJustify() )
91 {
93 case GR_TEXT_H_ALIGN_CENTER: break;
95 }
96 }
97}
98
99
100void SCH_TEXTBOX::Rotate( const VECTOR2I& aCenter )
101{
102 SCH_SHAPE::Rotate( aCenter );
104}
105
106
107void SCH_TEXTBOX::Rotate90( bool aClockwise )
108{
110}
111
112
114{
115 int margin = GetTextMargin();
116 BOX2I bbox( m_start, m_end - m_start );
117
118 bbox.Normalize();
119
120 VECTOR2I pos( bbox.GetLeft() + margin, bbox.GetBottom() - margin );
121
123 {
124 switch( GetHorizJustify() )
125 {
127 pos.y = bbox.GetBottom() - margin;
128 break;
130 pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2;
131 break;
133 pos.y = bbox.GetTop() + margin;
134 break;
135 }
136
137 switch( GetVertJustify() )
138 {
140 pos.x = bbox.GetLeft() + margin;
141 break;
143 pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2;
144 break;
146 pos.x = bbox.GetRight() - margin;
147 break;
148 }
149 }
150 else
151 {
152 switch( GetHorizJustify() )
153 {
155 pos.x = bbox.GetLeft() + margin;
156 break;
158 pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2;
159 break;
161 pos.x = bbox.GetRight() - margin;
162 break;
163 }
164
165 switch( GetVertJustify() )
166 {
168 pos.y = bbox.GetTop() + margin;
169 break;
171 pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2;
172 break;
174 pos.y = bbox.GetBottom() - margin;
175 break;
176 }
177 }
178
179 return pos;
180}
181
182
184{
185 SCH_TEXTBOX* item = static_cast<SCH_TEXTBOX*>( aItem );
186
187 std::swap( m_layer, item->m_layer );
188
189 SwapText( *item );
190 SwapAttributes( *item );
191
192 SCH_SHAPE::SwapData( aItem );
193}
194
195
196bool SCH_TEXTBOX::operator<( const SCH_ITEM& aItem ) const
197{
198 if( Type() != aItem.Type() )
199 return Type() < aItem.Type();
200
201 auto other = static_cast<const SCH_TEXTBOX*>( &aItem );
202
203 if( GetLayer() != other->GetLayer() )
204 return GetLayer() < other->GetLayer();
205
206 if( GetPosition().x != other->GetPosition().x )
207 return GetPosition().x < other->GetPosition().x;
208
209 if( GetPosition().y != other->GetPosition().y )
210 return GetPosition().y < other->GetPosition().y;
211
212 return GetText() < other->GetText();
213}
214
215
217{
219
220 if( !font )
222
223 return font;
224}
225
226
227void SCH_TEXTBOX::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
228{
229 wxDC* DC = aSettings->GetPrintDC();
230 int penWidth = GetPenWidth();
231 bool blackAndWhiteMode = GetGRForceBlackPenState();
232 VECTOR2I pt1 = GetStart();
233 VECTOR2I pt2 = GetEnd();
235 PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
236
237 if( GetFillMode() == FILL_T::FILLED_WITH_COLOR && !blackAndWhiteMode )
238 GRFilledRect( DC, pt1, pt2, 0, GetFillColor(), GetFillColor() );
239
240 if( penWidth > 0 )
241 {
242 penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
243
244 if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
245 color = aSettings->GetLayerColor( m_layer );
246
247 if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
248 lineStyle = PLOT_DASH_TYPE::SOLID;
249
250 if( lineStyle == PLOT_DASH_TYPE::SOLID )
251 {
252 GRRect( DC, pt1, pt2, penWidth, color );
253 }
254 else
255 {
256 std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
257
258 for( SHAPE* shape : shapes )
259 {
260 STROKE_PARAMS::Stroke( shape, lineStyle, penWidth, aSettings,
261 [&]( const VECTOR2I& a, const VECTOR2I& b )
262 {
263 GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
264 } );
265 }
266
267 for( SHAPE* shape : shapes )
268 delete shape;
269 }
270 }
271
273
274 if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
275 color = aSettings->GetLayerColor( m_layer );
276
277 EDA_TEXT::Print( aSettings, aOffset, color );
278}
279
280
281wxString SCH_TEXTBOX::GetShownText( int aDepth, bool aAllowExtraText ) const
282{
283 std::function<bool( wxString* )> textResolver =
284 [&]( wxString* token ) -> bool
285 {
286 if( token->Contains( ':' ) )
287 {
288 if( Schematic()->ResolveCrossReference( token, aDepth ) )
289 return true;
290 }
291 else
292 {
293 SCHEMATIC* schematic = Schematic();
294 SCH_SHEET* sheet = schematic ? schematic->CurrentSheet().Last() : nullptr;
295
296 if( sheet && sheet->ResolveTextVar( token, aDepth + 1 ) )
297 return true;
298 }
299
300 return false;
301 };
302
303 std::function<bool( wxString* )> schematicTextResolver =
304 [&]( wxString* token ) -> bool
305 {
306 return Schematic()->ResolveTextVar( token, aDepth + 1 );
307 };
308
309 wxString text = EDA_TEXT::GetShownText();
310
311 if( HasTextVars() )
312 {
313 PROJECT* project = nullptr;
314
315 if( Schematic() )
316 project = &Schematic()->Prj();
317
318 if( aDepth < 10 )
319 text = ExpandTextVars( text, &textResolver, &schematicTextResolver, project );
320 }
321
322 KIFONT::FONT* font = GetFont();
323
324 if( !font )
326
327 VECTOR2D size = GetEnd() - GetStart();
328 int colWidth = GetTextAngle() == ANGLE_HORIZONTAL ? size.x : size.y;
329
330 colWidth = abs( colWidth ) - GetTextMargin() * 2;
331 font->LinebreakText( text, colWidth, GetTextSize(), GetTextThickness(), IsBold(), IsItalic() );
332
333 return text;
334}
335
336
337bool SCH_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
338{
339 BOX2I rect = GetBoundingBox();
340
341 rect.Inflate( aAccuracy );
342
343 return rect.Contains( aPosition );
344}
345
346
347bool SCH_TEXTBOX::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
348{
349 BOX2I rect = aRect;
350
351 rect.Inflate( aAccuracy );
352
353 if( aContained )
354 return rect.Contains( GetBoundingBox() );
355
356 return rect.Intersects( GetBoundingBox() );
357}
358
359
361{
362 wxCHECK_MSG( IsHypertext(), /* void */,
363 "Calling a hypertext menu on a SCH_TEXTBOX with no hyperlink?" );
364
366 navTool->HypertextCommand( m_hyperlink );
367}
368
369
370wxString SCH_TEXTBOX::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
371{
372 return wxString::Format( _( "Graphic Text Box" ) );
373}
374
375
377{
379}
380
381
382void SCH_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground ) const
383{
384 if( aBackground )
385 {
386 SCH_SHAPE::Plot( aPlotter, aBackground );
387 return;
388 }
389
390 RENDER_SETTINGS* settings = aPlotter->RenderSettings();
391 int penWidth = GetPenWidth();
393 PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
394
395 if( penWidth > 0 )
396 {
397 penWidth = std::max( penWidth, settings->GetMinPenWidth() );
398
399 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
400 color = settings->GetLayerColor( m_layer );
401
402 if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
403 lineStyle = PLOT_DASH_TYPE::SOLID;
404
405 aPlotter->SetColor( color );
406 aPlotter->SetDash( penWidth, lineStyle );
407 aPlotter->Rect( m_start, m_end, FILL_T::NO_FILL, penWidth );
408 aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
409 }
410
411 KIFONT::FONT* font = GetFont();
412
413 if( !font )
414 font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
415
417
418 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
419 color = settings->GetLayerColor( m_layer );
420
421 penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
422 penWidth = std::max( penWidth, settings->GetMinPenWidth() );
423 aPlotter->SetCurrentLineWidth( penWidth );
424
425 std::vector<VECTOR2I> positions;
426 wxArrayString strings_list;
427 wxStringSplit( GetShownText(), strings_list, '\n' );
428 positions.reserve( strings_list.Count() );
429
430 GetLinePositions( positions, (int) strings_list.Count() );
431
432 for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
433 {
434 aPlotter->Text( positions[ii], color, strings_list.Item( ii ), GetTextAngle(),
436 IsBold(), false, font );
437 }
438
439 if( HasHyperlink() )
440 aPlotter->HyperlinkBox( GetBoundingBox(), GetHyperlink() );
441}
442
443
444void SCH_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
445{
446 // Don't use GetShownText() here; we want to show the user the variable references
447 aList.emplace_back( _( "Text Box" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
448
449 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
450
451 wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
452 int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
453 aList.emplace_back( _( "Style" ), textStyle[style] );
454
455 aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
456
457 aList.emplace_back( _( "Box Width" ),
458 aFrame->MessageTextFromValue( std::abs( GetEnd().x - GetStart().x ) ) );
459
460 aList.emplace_back( _( "Box Height" ),
461 aFrame->MessageTextFromValue( std::abs( GetEnd().y - GetStart().y ) ) );
462
463 m_stroke.GetMsgPanelInfo( aFrame, aList );
464}
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
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:119
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
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
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
Definition: eda_shape.h:289
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
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
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
wxString m_hyperlink
A hyperlink URL.
Definition: eda_text.h:379
int GetTextWidth() const
Definition: eda_text.h:192
virtual bool HasHyperlink() const
Definition: eda_text.h:326
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:248
wxString GetHyperlink() const
Definition: eda_text.h:327
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:142
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition: eda_text.h:103
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:671
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition: eda_text.cpp:297
void SwapAttributes(EDA_TEXT &aTradingPartner)
Swap the text attributes of the two involved instances.
Definition: eda_text.cpp:284
bool IsBold() const
Definition: eda_text.h:126
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:145
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 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:648
void SwapText(EDA_TEXT &aTradingPartner)
Definition: eda_text.cpp:273
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.
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: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
virtual void HyperlinkBox(const BOX2I &aBox, const wxString &aDestinationURL)
Create a clickable hyperlink with a rectangular click area.
Definition: plotter.h:435
bool GetColorMode() const
Definition: plotter.h:138
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
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
Container for project specific data.
Definition: project.h:63
Holds all the data relating to one schematic.
Definition: schematic.h:61
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:120
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: schematic.cpp:123
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:76
bool ResolveCrossReference(wxString *token, int aDepth) const
Resolves text vars that refer to other items.
Definition: schematic.cpp:259
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
const wxString & GetDefaultFont() const
Definition: sch_item.cpp:286
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:112
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:246
SCH_LAYER_ID m_layer
Definition: sch_item.h:491
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:106
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
Definition: sch_shape.cpp:112
int GetPenWidth() const override
Definition: sch_shape.cpp:226
STROKE_PARAMS GetStroke() const override
Definition: sch_shape.h:64
VECTOR2I GetPosition() const override
Definition: sch_shape.h:77
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:55
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
Definition: sch_sheet.cpp:233
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_textbox.cpp:70
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.
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
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:64
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:60
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.
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
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:85
wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
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: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
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
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:57
#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
@ LAYER_NOTES
Definition: layer_ids.h:358
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
@ 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:149
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