KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_tablecell.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 The 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#include <font/font.h>
21#include <advanced_config.h>
22#include <common.h>
23#include <sch_edit_frame.h>
24#include <widgets/msgpanel.h>
25#include <string_utils.h>
26#include <sch_table.h>
27#include <sch_tablecell.h>
28#include <properties/property.h>
30
31#include <api/api_utils.h>
32#include <api/schematic/schematic_types.pb.h>
33
34
35SCH_TABLECELL::SCH_TABLECELL( int aLineWidth, FILL_T aFillType ) :
36 SCH_TEXTBOX( LAYER_NOTES, aLineWidth, aFillType, wxEmptyString, SCH_TABLECELL_T ),
37 m_colSpan( 1 ),
38 m_rowSpan( 1 )
39{
40}
41
42void SCH_TABLECELL::Serialize( kiapi::schematic::types::SchematicTableCell& aCell ) const
43{
44 aCell.set_column_span( m_colSpan );
45 aCell.set_row_span( m_rowSpan );
46
47 SCH_TEXTBOX::Serialize( *aCell.mutable_text_box(), schIUScale );
48 kiapi::common::PackCustomProperties( aCell.mutable_custom_properties(), *this );
49}
50
51
52void SCH_TABLECELL::Serialize( google::protobuf::Any& aContainer ) const
53{
54 kiapi::schematic::types::SchematicTableCell cell;
55 Serialize( cell );
56 aContainer.PackFrom( cell );
57}
58
59
60bool SCH_TABLECELL::Deserialize( const kiapi::schematic::types::SchematicTableCell& aCell )
61{
62 if( !aCell.has_text_box() )
63 return false;
64
65 if( !SCH_TEXTBOX::Deserialize( aCell.text_box(), schIUScale ) )
66 return false;
67
68 SetColSpan( aCell.column_span() );
69 SetRowSpan( aCell.row_span() );
70
71 kiapi::common::UnpackCustomProperties( aCell.custom_properties(), *this );
72
73 return true;
74}
75
76
77bool SCH_TABLECELL::Deserialize( const google::protobuf::Any& aContainer )
78{
79 kiapi::schematic::types::SchematicTableCell cell;
80
81 if( !aContainer.UnpackTo( &cell ) )
82 return false;
83
84 return Deserialize( cell );
85}
86
87
88
89
91{
92 SCH_TEXTBOX::swapData( aItem );
93
94 SCH_TABLECELL* cell = static_cast<SCH_TABLECELL*>( aItem );
95
96 std::swap( m_colSpan, cell->m_colSpan );
97 std::swap( m_rowSpan, cell->m_rowSpan );
98}
99
100
101wxString SCH_TABLECELL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
102{
103 return wxString::Format( _( "Table Cell %s" ), GetAddr() );
104}
105
106
108{
109 const SCH_TABLE* table = static_cast<const SCH_TABLE*>( GetParent() );
110
111 for( int row = 0; row < table->GetRowCount(); ++row )
112 {
113 for( int col = 0; col < table->GetColCount(); ++col )
114 {
115 if( table->GetCell( row, col ) == this )
116 return row;
117 }
118 }
119
120 return -1;
121}
122
123
125{
126 const SCH_TABLE* table = static_cast<const SCH_TABLE*>( GetParent() );
127
128 for( int row = 0; row < table->GetRowCount(); ++row )
129 {
130 for( int col = 0; col < table->GetColCount(); ++col )
131 {
132 if( table->GetCell( row, col ) == this )
133 return col;
134 }
135 }
136
137 return -1;
138}
139
140
142{
143 return wxString::Format( wxT( "%c%d" ), 'A' + GetColumn() % 26, GetRow() );
144}
145
146
157static bool parseCellAddress( const wxString& aAddr, int& aRow, int& aCol )
158{
159 if( aAddr.IsEmpty() )
160 return false;
161
162 // Extract column part (letters) and row part (numbers)
163 size_t i = 0;
164 wxString colPart;
165
166 // Read column letters (A-Z, AA-ZZ, etc.)
167 while( i < aAddr.Length() && wxIsalpha( aAddr[i] ) )
168 {
169 colPart += wxToupper( aAddr[i] );
170 i++;
171 }
172
173 // Must have at least one letter
174 if( colPart.IsEmpty() )
175 return false;
176
177 // Convert column letters to 0-based index (A=0, B=1, ..., Z=25, AA=26, AB=27, etc.)
178 aCol = 0;
179 for( size_t j = 0; j < colPart.Length(); j++ )
180 {
181 aCol = aCol * 26 + ( colPart[j] - 'A' + 1 );
182 }
183 aCol -= 1; // Convert to 0-based
184
185 // Read row number (0-based)
186 wxString rowPart = aAddr.Mid( i );
187 if( rowPart.IsEmpty() )
188 return false;
189
190 // Convert row string to number (already 0-based in address string)
191 long rowNum;
192 if( !rowPart.ToLong( &rowNum ) || rowNum < 0 )
193 return false;
194
195 aRow = rowNum; // Already 0-based
196
197 return true;
198}
199
200
201wxString SCH_TABLECELL::GetShownText( const RENDER_SETTINGS* aSettings, const SCH_SHEET_PATH* aPath,
202 RESOLUTION_CONTEXT aContext, int aDepth ) const
203{
204 // Local depth counter for ResolveTextVars iteration tracking (separate from cross-cell aDepth)
205 int depth = 0;
206
207 SCH_SHEET* sheet = nullptr;
208
209 if( aPath )
210 sheet = aPath->Last();
211
212 // Text variable resolver supporting:
213 // - ${ROW}, ${COL}, ${ADDR} - cell position variables
214 // - @{expression} - math expression evaluation
215 // - ${CELL("A1")} or ${CELL(row,col)} - reference to another cell's evaluated text
216 // - \${...} and \@{...} - escape sequences for literal display
217 std::function<bool( wxString* )> tableCellResolver =
218 [&]( wxString* token ) -> bool
219 {
220 if( token->IsSameAs( wxT( "ROW" ) ) )
221 {
222 *token = wxString::Format( wxT( "%d" ), GetRow() ); // 0-based
223 return true;
224 }
225 else if( token->IsSameAs( wxT( "COL" ) ) )
226 {
227 *token = wxString::Format( wxT( "%d" ), GetColumn() ); // 0-based
228 return true;
229 }
230 else if( token->IsSameAs( wxT( "ADDR" ) ) )
231 {
232 *token = GetAddr();
233 return true;
234 }
235 else if( token->StartsWith( wxT( "CELL(" ) ) && token->EndsWith( wxT( ")" ) ) )
236 {
237 // Handle CELL("A0") or CELL(0, 1) syntax
238 wxString args = token->Mid( 5, token->Length() - 6 ); // Extract arguments
239 args.Trim( true ).Trim( false ); // Remove whitespace
240
241 SCH_TABLE* table = static_cast<SCH_TABLE*>( GetParent() );
242 if( !table )
243 {
244 *token = wxT( "<Unresolved: CELL() requires table context>" );
245 return true;
246 }
247
248 int targetRow = -1;
249 int targetCol = -1;
250
251 // Check if it's cell("A1") format (string argument with quotes)
252 if( args.StartsWith( wxT( "\"" ) ) && args.EndsWith( wxT( "\"" ) ) )
253 {
254 wxString addr = args.Mid( 1, args.Length() - 2 ); // Remove quotes
255 if( !parseCellAddress( addr, targetRow, targetCol ) )
256 {
257 *token = wxString::Format( wxT( "<Unresolved: Invalid cell address: %s>" ), addr );
258 return true;
259 }
260 }
261 // Check if it's cell(row, col) format (two numeric arguments)
262 else if( args.Find( ',' ) != wxNOT_FOUND )
263 {
264 wxString rowStr = args.BeforeFirst( ',' ).Trim( true ).Trim( false );
265 wxString colStr = args.AfterFirst( ',' ).Trim( true ).Trim( false );
266
267 long rowNum, colNum;
268 if( !rowStr.ToLong( &rowNum ) || !colStr.ToLong( &colNum ) )
269 {
270 *token = wxString::Format( wxT( "<Unresolved: Invalid cell coordinates: %s>" ), args );
271 return true;
272 }
273
274 // Arguments are already 0-based
275 targetRow = rowNum;
276 targetCol = colNum;
277 }
278 else
279 {
280 *token = wxString::Format( wxT( "<Unresolved: Invalid CELL() syntax: %s>" ), args );
281 return true;
282 }
283
284 // Check bounds
285 if( targetRow < 0 || targetRow >= table->GetRowCount() || targetCol < 0
286 || targetCol >= table->GetColCount() )
287 {
288 wxString cellAddr;
289 if( targetRow >= 0 && targetCol >= 0 )
290 {
291 char colLetter = 'A' + ( targetCol % 26 );
292 cellAddr = wxString::Format( wxT( "%c%d" ), colLetter, targetRow );
293 }
294 else
295 {
296 cellAddr = args;
297 }
298 *token = wxString::Format( wxT( "<Unresolved: Cell %s not found>" ), cellAddr );
299 return true;
300 }
301
302 // Get the target cell and return its evaluated text
303 SCH_TABLECELL* targetCell = table->GetCell( targetRow, targetCol );
304 if( targetCell )
305 {
306 // Check for excessive recursion depth (circular references)
308 if( aDepth >= maxDepth )
309 {
310 *token = wxT( "<Circular reference>" );
311 return true;
312 }
313
314 *token = targetCell->GetShownText( aSettings, aPath, aContext, aDepth + 1 );
315 return true;
316 }
317 else
318 {
319 *token = wxT( "<Unresolved: Cell not found>" );
320 return true;
321 }
322 }
323
324 // Fall back to sheet variables
325 if( sheet )
326 {
327 if( sheet->ResolveTextVar( aPath, token, depth + 1 ) )
328 return true;
329 }
330
331 return false;
332 };
333
334 wxString text = EDA_TEXT::GetShownText( aContext, depth );
335
336 if( HasTextVars() && aContext != RAW_VALUE )
337 {
338 text = ResolveTextVars( text, &tableCellResolver, depth );
339
340 // Only do this at the top level (aDepth == 0) to avoid premature unescaping in nested CELL() calls
341 if( aDepth == 0 )
342 FinalizeTextVarExpansion( text, aContext );
343 }
344
345 // Only linebreak when at top level
346 if( aDepth == 0 )
347 {
348 VECTOR2I size = GetEnd() - GetStart();
349 int colWidth;
350
351 if( GetTextAngle().IsVertical() )
352 colWidth = abs( size.y ) - ( GetMarginTop() + GetMarginBottom() );
353 else
354 colWidth = abs( size.x ) - ( GetMarginLeft() + GetMarginRight() );
355
357 IsBold(), IsItalic() );
358 }
359
360 return text;
361}
362
363
365{
366 return static_cast<SCH_TABLE*>( GetParent() )->GetColWidth( GetColumn() );
367}
368
369
371{
372 SCH_TABLE* table = static_cast<SCH_TABLE*>( GetParent() );
373
374 table->SetColWidth( GetColumn(), aWidth );
375 table->Normalize();
376}
377
378
380{
381 return static_cast<SCH_TABLE*>( GetParent() )->GetRowHeight( GetRow() );
382}
383
384
386{
387 SCH_TABLE* table = static_cast<SCH_TABLE*>( GetParent() );
388
389 table->SetRowHeight( GetRow(), aHeight );
390 table->Normalize();
391}
392
393
394void SCH_TABLECELL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts, int aUnit,
395 int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
396{
397 const int cell_body_style = -1; // flag to disable box ouline plotting
398
399 if( m_colSpan >= 1 && m_rowSpan >= 1 )
400 SCH_TEXTBOX::Plot( aPlotter, aBackground, aPlotOpts, aUnit, cell_body_style, aOffset, aDimmed );
401}
402
403
404void SCH_TABLECELL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
405{
406 aList.emplace_back( _( "Table Cell" ), GetAddr() );
407
408 // Don't use GetShownText() here; we want to show the user the variable references
409 aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
410
411 aList.emplace_back( _( "Cell Width" ), aFrame->MessageTextFromValue( std::abs( GetEnd().x - GetStart().x ) ) );
412 aList.emplace_back( _( "Cell Height" ), aFrame->MessageTextFromValue( std::abs( GetEnd().y - GetStart().y ) ) );
413
414 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
415
416 wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
417 int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
418 aList.emplace_back( _( "Style" ), textStyle[style] );
419
420 aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
421}
422
423
424double SCH_TABLECELL::Similarity( const SCH_ITEM& aOtherItem ) const
425{
426 if( aOtherItem.Type() != Type() )
427 return 0.0;
428
429 const SCH_TABLECELL& other = static_cast<const SCH_TABLECELL&>( aOtherItem );
430
431 double similarity = 1.0;
432
433 if( m_colSpan != other.m_colSpan )
434 similarity *= 0.9;
435
436 if( m_rowSpan != other.m_rowSpan )
437 similarity *= 0.9;
438
439 similarity *= SCH_TEXTBOX::Similarity( other );
440
441 return similarity;
442}
443
444
445bool SCH_TABLECELL::operator==( const SCH_ITEM& aOtherItem ) const
446{
447 if( aOtherItem.Type() != Type() )
448 return false;
449
450 const SCH_TABLECELL& other = static_cast<const SCH_TABLECELL&>( aOtherItem );
451
452 return *this == other;
453}
454
455
456bool SCH_TABLECELL::operator==( const SCH_TABLECELL& aOtherItem ) const
457{
458 return m_colSpan == aOtherItem.m_colSpan && m_rowSpan == aOtherItem.m_rowSpan
459 && SCH_TEXTBOX::operator==( aOtherItem );
460}
461
462
464{
466 {
469
478
479 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Start X" ) );
480 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Start Y" ) );
481 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "End X" ) );
482 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "End Y" ) );
483
484 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Shape" ) );
485 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Width" ) );
486 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Height" ) );
487 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Fill" ) );
488 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Fill Color" ) );
489 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Width" ) );
490 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Style" ) );
491 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Color" ) );
492 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Corner Radius" ) );
493
494 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Width" ) );
495 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Height" ) );
496 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Thickness" ) );
497 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Orientation" ) );
498 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Mirrored" ) );
499 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Visible" ) );
500 propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Hyperlink" ) );
501
502 const wxString tableProps = _( "Table" );
503
504 propMgr.AddProperty( new PROPERTY<SCH_TABLECELL, int>( _HKI( "Column Width" ),
506 tableProps );
507
508 propMgr.AddProperty( new PROPERTY<SCH_TABLECELL, int>( _HKI( "Row Height" ),
510 tableProps );
511
512 const wxString cellProps = _( "Cell Properties" );
513
514 propMgr.AddProperty( new PROPERTY<SCH_TABLECELL, bool, EDA_SHAPE>( _HKI( "Background Fill" ),
516 cellProps );
517
518 propMgr.AddProperty( new PROPERTY<SCH_TABLECELL, COLOR4D, EDA_SHAPE>( _HKI( "Background Fill Color" ),
520 cellProps )
522 }
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:130
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
EDA_ITEM * GetParent() const
Definition eda_item.h:112
virtual void SetFilled(bool aFlag)
Definition eda_shape.h:142
void SetFillColor(const COLOR4D &aColor)
Definition eda_shape.h:160
bool IsSolidFill() const
Definition eda_shape.h:123
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition eda_shape.h:325
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition eda_shape.h:275
COLOR4D GetFillColor() const
Definition eda_shape.h:159
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:94
virtual VECTOR2I GetTextSize() const
Definition eda_text.h:301
bool IsItalic() const
Definition eda_text.h:200
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:118
KIFONT::FONT * GetFont() const
Definition eda_text.h:286
virtual wxString GetShownText(RESOLUTION_CONTEXT aContext, int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition eda_text.h:128
virtual int GetTextWidth() const
Definition eda_text.h:304
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition eda_text.h:139
virtual EDA_ANGLE GetTextAngle() const
Definition eda_text.h:178
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition eda_text.cpp:427
bool IsBold() const
Definition eda_text.h:215
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:609
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Base plotter engine class.
Definition plotter.h:136
PROPERTY_BASE & SetIsHiddenFromRulesEditor(bool aHide=true)
Definition property.h:332
Provide class metadata.
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()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:65
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:48
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
int GetRowHeight() const
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
wxString GetShownText(const RENDER_SETTINGS *aSettings, const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, int aDepth=0) const override
SCH_TABLECELL(int aLineWidth=0, FILL_T aFillType=FILL_T::NO_FILL)
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
wxString GetAddr() const
bool operator==(const SCH_TABLECELL &aOther) const
void SetRowSpan(int aSpan)
void SetColumnWidth(int aWidth)
int GetColumn() const
void SetColSpan(int aSpan)
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
void SetRowHeight(int aHeight)
int GetColumnWidth() const
int GetRow() const
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
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.
int GetMarginBottom() const
Definition sch_textbox.h:82
bool operator==(const SCH_ITEM &aOther) const override
int GetMarginLeft() const
Definition sch_textbox.h:79
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
int GetMarginRight() const
Definition sch_textbox.h:81
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
int GetMarginTop() const
Definition sch_textbox.h:80
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
KIFONT::FONT * GetDrawFont(const RENDER_SETTINGS *aSettings) const override
SCH_TEXTBOX(SCH_LAYER_ID aLayer=LAYER_NOTES, int aLineWidth=0, FILL_T aFillType=FILL_T::NO_FILL, const wxString &aText=wxEmptyString, KICAD_T aType=SCH_TEXTBOX_T)
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
void FinalizeTextVarExpansion(wxString &aText, RESOLUTION_CONTEXT aContext)
Definition common.cpp:88
wxString ResolveTextVars(const wxString &aSource, const std::function< bool(wxString *)> *aResolver, int &aDepth)
Multi-pass text variable expansion and math expression evaluation.
Definition common.cpp:333
RESOLUTION_CONTEXT
Definition common.h:89
@ RAW_VALUE
Definition common.h:96
#define _(s)
FILL_T
Definition eda_fill.h:29
int m_ResolveTextRecursionDepth
The number of recursions to resolve text variables.
@ LAYER_NOTES
Definition layer_ids.h:489
Message panel definition file.
KICOMMON_API wxString EllipsizeStatusText(wxWindow *aWindow, const wxString &aString)
Ellipsize text (at the end) to be no more than 1/3 of the window width.
KICOMMON_API void PackCustomProperties(google::protobuf::RepeatedPtrField< types::CustomProperty > *aOutput, const EDA_ITEM &aItem)
KICOMMON_API void UnpackCustomProperties(const google::protobuf::RepeatedPtrField< types::CustomProperty > &aInput, EDA_ITEM &aItem)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition eda_angle.h:437
#define _HKI(x)
Definition page_info.cpp:40
#define TYPE_HASH(x)
Macro to generate unique identifier for a type.
Definition property.h:74
@ PT_SIZE
Size expressed in distance units (mm/inch)
Definition property.h:63
#define REGISTER_TYPE(x)
Helper macro to map type hashes to names.
static struct SCH_TABLECELL_DESC _SCH_TABLECELL_DESC
static bool parseCellAddress(const wxString &aAddr, int &aRow, int &aCol)
Parse a cell address string like "A0" or "B12" into 0-based row and column indices.
@ SCH_TABLECELL_T
Definition typeinfo.h:162
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708