54 return wxString::Format(
_(
"Table Cell %s" ),
GetAddr() );
62 for(
int row = 0; row <
table->GetRowCount(); ++row )
64 for(
int col = 0; col <
table->GetColCount(); ++col )
66 if(
table->GetCell( row, col ) ==
this )
79 for(
int row = 0; row <
table->GetRowCount(); ++row )
81 for(
int col = 0; col <
table->GetColCount(); ++col )
83 if(
table->GetCell( row, col ) ==
this )
94 return wxString::Format( wxT(
"%c%d" ),
'A' +
GetColumn() % 26,
GetRow() );
110 if( aAddr.IsEmpty() )
118 while( i < aAddr.Length() && wxIsalpha( aAddr[i] ) )
120 colPart += wxToupper( aAddr[i] );
125 if( colPart.IsEmpty() )
130 for(
size_t j = 0; j < colPart.Length(); j++ )
132 aCol = aCol * 26 + ( colPart[j] -
'A' + 1 );
137 wxString rowPart = aAddr.Mid( i );
138 if( rowPart.IsEmpty() )
143 if( !rowPart.ToLong( &rowNum ) || rowNum < 0 )
153 bool aAllowExtraText,
int aDepth )
const
161 sheet = aPath->
Last();
168 std::function<bool( wxString* )> tableCellResolver = [&]( wxString* token ) ->
bool
170 if( token->IsSameAs( wxT(
"ROW" ) ) )
172 *token = wxString::Format( wxT(
"%d" ),
GetRow() );
175 else if( token->IsSameAs( wxT(
"COL" ) ) )
177 *token = wxString::Format( wxT(
"%d" ),
GetColumn() );
180 else if( token->IsSameAs( wxT(
"ADDR" ) ) )
185 else if( token->StartsWith( wxT(
"CELL(" ) ) && token->EndsWith( wxT(
")" ) ) )
188 wxString args = token->Mid( 5, token->Length() - 6 );
189 args.Trim(
true ).Trim(
false );
194 *token = wxT(
"<Unresolved: CELL() requires table context>" );
202 if( args.StartsWith( wxT(
"\"" ) ) && args.EndsWith( wxT(
"\"" ) ) )
204 wxString addr = args.Mid( 1, args.Length() - 2 );
207 *token = wxString::Format( wxT(
"<Unresolved: Invalid cell address: %s>" ), addr );
212 else if( args.Find(
',' ) != wxNOT_FOUND )
214 wxString rowStr = args.BeforeFirst(
',' ).Trim(
true ).Trim(
false );
215 wxString colStr = args.AfterFirst(
',' ).Trim(
true ).Trim(
false );
218 if( !rowStr.ToLong( &rowNum ) || !colStr.ToLong( &colNum ) )
220 *token = wxString::Format( wxT(
"<Unresolved: Invalid cell coordinates: %s>" ), args );
230 *token = wxString::Format( wxT(
"<Unresolved: Invalid CELL() syntax: %s>" ), args );
235 if( targetRow < 0 || targetRow >=
table->GetRowCount() || targetCol < 0
236 || targetCol >=
table->GetColCount() )
239 if( targetRow >= 0 && targetCol >= 0 )
241 char colLetter =
'A' + ( targetCol % 26 );
242 cellAddr = wxString::Format( wxT(
"%c%d" ), colLetter, targetRow );
248 *token = wxString::Format( wxT(
"<Unresolved: Cell %s not found>" ), cellAddr );
258 if( aDepth >= maxDepth )
260 *token = wxT(
"<Circular reference>" );
264 *token = targetCell->
GetShownText( aSettings, aPath, aAllowExtraText, aDepth + 1 );
269 *token = wxT(
"<Unresolved: Cell not found>" );
304 text.Replace( wxT(
"<<<ESC_DOLLAR:" ), wxT(
"${" ) );
305 text.Replace( wxT(
"<<<ESC_AT:" ), wxT(
"@{" ) );
343 int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
345 const int cell_body_style = -1;
347 SCH_TEXTBOX::Plot( aPlotter, aBackground, aPlotOpts, aUnit, cell_body_style, aOffset, aDimmed );
353 aList.emplace_back(
_(
"Table Cell" ),
GetAddr() );
361 aList.emplace_back(
_(
"Font" ),
GetFont() ?
GetFont()->GetName() :
_(
"Default" ) );
363 wxString textStyle[] = {
_(
"Normal" ),
_(
"Italic" ),
_(
"Bold" ),
_(
"Bold Italic" ) };
365 aList.emplace_back(
_(
"Style" ), textStyle[style] );
378 double similarity = 1.0;
399 return *
this == other;
449 const wxString tableProps =
_(
"Table" );
461 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