52 return wxString::Format(
_(
"Table Cell %s" ),
GetAddr() );
60 for(
int row = 0; row <
table->GetRowCount(); ++row )
62 for(
int col = 0; col <
table->GetColCount(); ++col )
64 if(
table->GetCell( row, col ) ==
this )
77 for(
int row = 0; row <
table->GetRowCount(); ++row )
79 for(
int col = 0; col <
table->GetColCount(); ++col )
81 if(
table->GetCell( row, col ) ==
this )
92 return wxString::Format( wxT(
"%c%d" ),
'A' +
GetColumn() % 26,
GetRow() );
108 if( aAddr.IsEmpty() )
116 while( i < aAddr.Length() && wxIsalpha( aAddr[i] ) )
118 colPart += wxToupper( aAddr[i] );
123 if( colPart.IsEmpty() )
128 for(
size_t j = 0; j < colPart.Length(); j++ )
130 aCol = aCol * 26 + ( colPart[j] -
'A' + 1 );
135 wxString rowPart = aAddr.Mid( i );
136 if( rowPart.IsEmpty() )
141 if( !rowPart.ToLong( &rowNum ) || rowNum < 0 )
151 bool aAllowExtraText,
int aDepth )
const
159 sheet = aPath->
Last();
166 std::function<bool( wxString* )> tableCellResolver = [&]( wxString* token ) ->
bool
168 if( token->IsSameAs( wxT(
"ROW" ) ) )
170 *token = wxString::Format( wxT(
"%d" ),
GetRow() );
173 else if( token->IsSameAs( wxT(
"COL" ) ) )
175 *token = wxString::Format( wxT(
"%d" ),
GetColumn() );
178 else if( token->IsSameAs( wxT(
"ADDR" ) ) )
183 else if( token->StartsWith( wxT(
"CELL(" ) ) && token->EndsWith( wxT(
")" ) ) )
186 wxString args = token->Mid( 5, token->Length() - 6 );
187 args.Trim(
true ).Trim(
false );
192 *token = wxT(
"<Unresolved: CELL() requires table context>" );
200 if( args.StartsWith( wxT(
"\"" ) ) && args.EndsWith( wxT(
"\"" ) ) )
202 wxString addr = args.Mid( 1, args.Length() - 2 );
205 *token = wxString::Format( wxT(
"<Unresolved: Invalid cell address: %s>" ), addr );
210 else if( args.Find(
',' ) != wxNOT_FOUND )
212 wxString rowStr = args.BeforeFirst(
',' ).Trim(
true ).Trim(
false );
213 wxString colStr = args.AfterFirst(
',' ).Trim(
true ).Trim(
false );
216 if( !rowStr.ToLong( &rowNum ) || !colStr.ToLong( &colNum ) )
218 *token = wxString::Format( wxT(
"<Unresolved: Invalid cell coordinates: %s>" ), args );
228 *token = wxString::Format( wxT(
"<Unresolved: Invalid CELL() syntax: %s>" ), args );
233 if( targetRow < 0 || targetRow >=
table->GetRowCount() || targetCol < 0
234 || targetCol >=
table->GetColCount() )
237 if( targetRow >= 0 && targetCol >= 0 )
239 char colLetter =
'A' + ( targetCol % 26 );
240 cellAddr = wxString::Format( wxT(
"%c%d" ), colLetter, targetRow );
246 *token = wxString::Format( wxT(
"<Unresolved: Cell %s not found>" ), cellAddr );
256 if( aDepth >= maxDepth )
258 *token = wxT(
"<Circular reference>" );
262 *token = targetCell->
GetShownText( aSettings, aPath, aAllowExtraText, aDepth + 1 );
267 *token = wxT(
"<Unresolved: Cell not found>" );
302 text.Replace( wxT(
"<<<ESC_DOLLAR:" ), wxT(
"${" ) );
303 text.Replace( wxT(
"<<<ESC_AT:" ), wxT(
"@{" ) );
341 int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
343 const int cell_body_style = -1;
346 SCH_TEXTBOX::Plot( aPlotter, aBackground, aPlotOpts, aUnit, cell_body_style, aOffset, aDimmed );
352 aList.emplace_back(
_(
"Table Cell" ),
GetAddr() );
360 aList.emplace_back(
_(
"Font" ),
GetFont() ?
GetFont()->GetName() :
_(
"Default" ) );
362 wxString textStyle[] = {
_(
"Normal" ),
_(
"Italic" ),
_(
"Bold" ),
_(
"Bold Italic" ) };
364 aList.emplace_back(
_(
"Style" ), textStyle[style] );
377 double similarity = 1.0;
398 return *
this == other;
448 const wxString tableProps =
_(
"Table" );
460 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,...
virtual VECTOR2I GetTextSize() const
virtual const wxString & GetText() const
Return the string associated with the text object.
KIFONT::FONT * GetFont() const
virtual int GetTextWidth() const
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
virtual EDA_ANGLE GetTextAngle() const
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.
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.
std::vector< std::vector< std::string > > table
VECTOR2< int32_t > VECTOR2I