23#include <api/board/board_types.pb.h>
77 kiapi::board::types::TableCell cell;
80 if( !aContainer.PackFrom( cell ) )
81 wxFAIL_MSG( wxT(
"Failed to pack PCB_TABLECELL" ) );
90 if( !cell.has_text_box() )
107 kiapi::board::types::TableCell cell;
109 if( !aContainer.UnpackTo( &cell ) )
118 return wxString::Format(
_(
"Table cell %s" ),
GetAddr() );
133 for(
int row = 0; row <
table->GetRowCount(); ++row )
135 for(
int col = 0; col <
table->GetColCount(); ++col )
137 if(
table->GetCell( row, col ) ==
this )
150 for(
int row = 0; row <
table->GetRowCount(); ++row )
152 for(
int col = 0; col <
table->GetColCount(); ++col )
154 if(
table->GetCell( row, col ) ==
this )
165 return wxString::Format( wxT(
"%c%d" ),
'A' +
GetColumn() % 26,
GetRow() + 1 );
174 std::function<bool( wxString* )> tableCellResolver =
175 [&]( wxString* token ) ->
bool
177 if( token->IsSameAs( wxT(
"ROW" ) ) )
179 *token = wxString::Format( wxT(
"%d" ),
GetRow() + 1 );
182 else if( token->IsSameAs( wxT(
"COL" ) ) )
184 *token = wxString::Format( wxT(
"%d" ),
GetColumn() + 1 );
187 else if( token->IsSameAs( wxT(
"ADDR" ) ) )
192 else if( token->IsSameAs( wxT(
"LAYER" ) ) )
198 if( parentFootprint && parentFootprint->
ResolveTextVar( token, aDepth + 1 ) )
201 if(
board &&
board->ResolveTextVar( token, aDepth + 1 ) )
226 int colWidth = ( corners[1] - corners[0] ).EuclideanNorm();
257 if(
table->IsGenerated() )
261 if(
GetColumn() <
static_cast<int>( columns.size() ) )
280 generated->SetRowHeightToFit(
GetRow(), aHeight );
299 aList.emplace_back(
_(
"Table Cell" ),
GetAddr() );
305 aList.emplace_back(
_(
"Status" ),
_(
"Locked" ) );
308 aList.emplace_back(
_(
"Mirror" ),
IsMirrored() ?
_(
"Yes" ) :
_(
"No" ) );
313 aList.emplace_back(
_(
"Font" ),
GetFont() ?
GetFont()->GetName() :
_(
"Default" ) );
318 aList.emplace_back(
_(
"Text Thickness" ),
_(
"Auto" ) );
332 double similarity = 1.0;
352 return *
this == other;
417 const auto isGeneratedCell =
423 const auto isPlainCell =
426 return !isGeneratedCell( aItem );
429 const std::vector<wxString> fontGroupProps = {
_HKI(
"Font" ),
_HKI(
"Width" ),
_HKI(
"Height" ) };
432 for(
const wxString&
name : fontGroupProps )
435 const wxString fontProps =
_HKI(
"Font" );
457 const wxString tableProps =
_(
"Table" );
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
bool IsLocked() const override
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual double GetCoverageArea(int aTextMargin) const
Return the board area this item covers, used to rank candidates under the cursor so a click on a smal...
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
FOOTPRINT * GetParentFootprint() const
BOARD_ITEM_CONTAINER * GetParent() const
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Information pertinent to a Pcbnew printed circuit board.
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
void SetRectangleHeight(const int &aHeight)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
void SetRectangleWidth(const int &aWidth)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
void SetFontProp(const wxString &aFontName)
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual int GetTextHeight() const
KIFONT::FONT * GetFont() const
void SetMirrored(bool isMirrored)
wxString GetFontProp() const
virtual EDA_ANGLE GetDrawRotation() const
virtual wxString GetShownText(RESOLUTION_CONTEXT aContext, int aDepth=0) const
Return the string actually shown after processing of the base text.
virtual int GetTextWidth() const
virtual KIFONT::FONT * GetDrawFont(const RENDER_SETTINGS *aSettings) const
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
EDA_TEXT(const EDA_IU_SCALE &aIuScale, const wxString &aText=wxEmptyString)
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Class that other classes need to inherit from, in order to be inspectable.
FONT is an abstract base class for both outline and stroke fonts.
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.
A table whose cell text is derived from the board and rebuilt whenever it goes stale.
int GetColumnWidth() const
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
double GetCoverageArea(int aTextMargin) const override
Return the board area this item covers, used to rank candidates under the cursor so a click on a smal...
void SetRowHeight(int aHeight)
wxString GetShownText(RESOLUTION_CONTEXT aContext, int aDepth=0) const override
Return the string actually shown after processing of the base text.
virtual void swapData(BOARD_ITEM *aImage) override
void SetRowSpan(int aSpan)
double Similarity(const BOARD_ITEM &aBoardItem) const override
Return a measure of how likely the other object is to represent the same object.
bool operator==(const PCB_TABLECELL &aBoardItem) const
void SetFontSize(int aSize)
void SetColumnWidth(int aWidth)
bool HasSquareFontSize() const
wxString GetUnwrappedShownText(RESOLUTION_CONTEXT aContext, int aDepth=0) const
GetShownText() before it is line-broken to the cell's width, i.e.
void SetColSpan(int aSpan)
void CopyFrom(const BOARD_ITEM *aOther) override
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
int GetFontSize() const
The text height, which speaks for the width too only when HasSquareFontSize.
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.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
PCB_TABLECELL(BOARD_ITEM *parent)
static wxPGChoices FontChoices(INSPECTABLE *aItem)
The font names EDA_TEXT's Font property offers, for the Font Name a generated table and its cells off...
double Similarity(const BOARD_ITEM &aBoardItem) const override
Return a measure of how likely the other object is to represent the same object.
int GetMarginBottom() const
EDA_ANGLE GetTextAngle() const override
PCB_TEXTBOX(BOARD_ITEM *aParent, KICAD_T aType=PCB_TEXTBOX_T)
int GetTextThickness() const override
VECTOR2I GetTextSize() const override
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
int GetMarginLeft() const
std::vector< VECTOR2I > GetCornersInSequence(EDA_ANGLE angle) const override
int GetMarginRight() const
bool operator==(const PCB_TEXTBOX &aOther) const
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
PROPERTY_BASE & SetChoicesFunc(std::function< wxPGChoices(INSPECTABLE *)> aFunc)
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
PROPERTY_BASE & SetIndeterminateFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object's value for this property is mixed.
wxPGChoices GetChoices(INSPECTABLE *aObject) const
PROPERTY_BASE & SetIsCopyable(bool aIsCopyable=true)
PROPERTY_BASE & SetIsHiddenFromRulesEditor(bool aHide=true)
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.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
void OverrideAvailability(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc)
Sets an override availability functor for a base class property of a given derived class.
void OverrideWriteability(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc)
Sets an override writeability functor for a base class property of a given derived class.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
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)
wxString ResolveTextVars(const wxString &aSource, const std::function< bool(wxString *)> *aResolver, int &aDepth)
Multi-pass text variable expansion and math expression evaluation.
#define PCB_EDIT_FRAME_NAME
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
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)
bool IsGeneratedTableCell(const EDA_ITEM *aItem)
True for a cell whose text is generated from the board, so only its formatting is the user's.
static struct PCB_TABLECELL_DESC _PCB_TABLECELL_DESC
#define TYPE_HASH(x)
Macro to generate unique identifier for a type.
@ PT_SIZE
Size expressed in distance units (mm/inch)
#define REGISTER_TYPE(x)
Helper macro to map type hashes to names.
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables