56 return wxString::Format(
_(
"Table Cell %s" ),
GetAddr() );
64 for(
int row = 0; row <
table->GetRowCount(); ++row )
66 for(
int col = 0; col <
table->GetColCount(); ++col )
68 if(
table->GetCell( row, col ) ==
this )
81 for(
int row = 0; row <
table->GetRowCount(); ++row )
83 for(
int col = 0; col <
table->GetColCount(); ++col )
85 if(
table->GetCell( row, col ) ==
this )
96 return wxString::Format( wxT(
"%c%d" ),
'A' +
GetColumn() % 26,
GetRow() );
112 if( aAddr.IsEmpty() )
120 while( i < aAddr.Length() && wxIsalpha( aAddr[i] ) )
122 colPart += wxToupper( aAddr[i] );
127 if( colPart.IsEmpty() )
132 for(
size_t j = 0; j < colPart.Length(); j++ )
134 aCol = aCol * 26 + ( colPart[j] -
'A' + 1 );
139 wxString rowPart = aAddr.Mid( i );
140 if( rowPart.IsEmpty() )
145 if( !rowPart.ToLong( &rowNum ) || rowNum < 0 )
155 bool aAllowExtraText,
int aDepth )
const
163 sheet = aPath->
Last();
170 std::function<bool( wxString* )> tableCellResolver = [&]( wxString* token ) ->
bool
172 if( token->IsSameAs( wxT(
"ROW" ) ) )
174 *token = wxString::Format( wxT(
"%d" ),
GetRow() );
177 else if( token->IsSameAs( wxT(
"COL" ) ) )
179 *token = wxString::Format( wxT(
"%d" ),
GetColumn() );
182 else if( token->IsSameAs( wxT(
"ADDR" ) ) )
187 else if( token->StartsWith( wxT(
"CELL(" ) ) && token->EndsWith( wxT(
")" ) ) )
190 wxString args = token->Mid( 5, token->Length() - 6 );
191 args.Trim(
true ).Trim(
false );
196 *token = wxT(
"<Unresolved: CELL() requires table context>" );
204 if( args.StartsWith( wxT(
"\"" ) ) && args.EndsWith( wxT(
"\"" ) ) )
206 wxString addr = args.Mid( 1, args.Length() - 2 );
209 *token = wxString::Format( wxT(
"<Unresolved: Invalid cell address: %s>" ), addr );
214 else if( args.Find(
',' ) != wxNOT_FOUND )
216 wxString rowStr = args.BeforeFirst(
',' ).Trim(
true ).Trim(
false );
217 wxString colStr = args.AfterFirst(
',' ).Trim(
true ).Trim(
false );
220 if( !rowStr.ToLong( &rowNum ) || !colStr.ToLong( &colNum ) )
222 *token = wxString::Format( wxT(
"<Unresolved: Invalid cell coordinates: %s>" ), args );
232 *token = wxString::Format( wxT(
"<Unresolved: Invalid CELL() syntax: %s>" ), args );
237 if( targetRow < 0 || targetRow >=
table->GetRowCount() || targetCol < 0
238 || targetCol >=
table->GetColCount() )
241 if( targetRow >= 0 && targetCol >= 0 )
243 char colLetter =
'A' + ( targetCol % 26 );
244 cellAddr = wxString::Format( wxT(
"%c%d" ), colLetter, targetRow );
250 *token = wxString::Format( wxT(
"<Unresolved: Cell %s not found>" ), cellAddr );
260 if( aDepth >= maxDepth )
262 *token = wxT(
"<Circular reference>" );
266 *token = targetCell->
GetShownText( aSettings, aPath, aAllowExtraText, aDepth + 1 );
271 *token = wxT(
"<Unresolved: Cell not found>" );
306 text.Replace( wxT(
"<<<ESC_DOLLAR:" ), wxT(
"${" ) );
307 text.Replace( wxT(
"<<<ESC_AT:" ), wxT(
"@{" ) );
345 int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
347 const int cell_body_style = -1;
350 SCH_TEXTBOX::Plot( aPlotter, aBackground, aPlotOpts, aUnit, cell_body_style, aOffset, aDimmed );
356 aList.emplace_back(
_(
"Table Cell" ),
GetAddr() );
364 aList.emplace_back(
_(
"Font" ),
GetFont() ?
GetFont()->GetName() :
_(
"Default" ) );
366 wxString textStyle[] = {
_(
"Normal" ),
_(
"Italic" ),
_(
"Bold" ),
_(
"Bold Italic" ) };
368 aList.emplace_back(
_(
"Style" ), textStyle[style] );
381 double similarity = 1.0;
402 return *
this == other;
452 const wxString tableProps =
_(
"Table" );
464 const wxString cellProps =
_(
"Cell Properties" );
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.
EDA_ITEM * GetParent() const
virtual void SetFilled(bool aFlag)
void SetFillColor(const COLOR4D &aColor)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
COLOR4D GetFillColor() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
const EDA_ANGLE & GetTextAngle() const
virtual const wxString & GetText() const
Return the string associated with the text object.
KIFONT::FONT * GetFont() const
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
virtual wxString GetShownText(bool aAllowExtraText, int aDepth=0) const
Return the string actually shown after processing of the base text.
VECTOR2I GetTextSize() const
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.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Base plotter engine class.
PROPERTY_BASE & SetIsHiddenFromRulesEditor(bool aHide=true)
Provide class metadata.Helper macro to map type hashes to names.
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)
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.
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.
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
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.
bool operator==(const SCH_TABLECELL &aOther) const
wxString GetShownText(const RENDER_SETTINGS *aSettings, const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const override
void SetColumnWidth(int aWidth)
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
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
bool operator==(const SCH_ITEM &aOther) const override
int GetMarginLeft() const
int GetMarginRight() const
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 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().
wxString ResolveTextVars(const wxString &aSource, const std::function< bool(wxString *)> *aResolver, int &aDepth)
Multi-pass text variable expansion and math expression evaluation.
int m_ResolveTextRecursionDepth
The number of recursions to resolve text variables.
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.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ PT_SIZE
Size expressed in distance units (mm/inch)
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.
VECTOR2< int32_t > VECTOR2I