KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_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 <advanced_config.h>
21#include <api/api_enums.h>
22#include <api/api_utils.h>
23#include <api/board/board_types.pb.h>
24#include <common.h>
25#include <pcb_edit_frame.h>
26#include <font/font.h>
27#include <widgets/msgpanel.h>
28#include <string_utils.h>
29#include <board.h>
30#include <pcb_generated_table.h>
31#include <pcb_table.h>
32#include <footprint.h>
33#include <properties/property.h>
35
36
38 PCB_TEXTBOX( aParentTable, PCB_TABLECELL_T ),
39 m_colSpan( 1 ),
40 m_rowSpan( 1 )
41{
42 if( FOOTPRINT* parentFP = aParentTable->GetParentFootprint() )
43 SetMirrored( parentFP->IsFlipped() );
44 else if( BOARD* board = aParentTable->GetBoard() )
45 SetMirrored( board->IsBackLayer( aParentTable->GetLayer() ) );
46 else
47 SetMirrored( IsBackLayer( aParentTable->GetLayer() ) );
48
49 SetRectangleHeight( std::numeric_limits<int>::max() / 2 );
50 SetRectangleWidth( std::numeric_limits<int>::max() / 2 );
51}
52
53
55{
56 wxASSERT( aImage->Type() == PCB_TABLECELL_T );
57
58 std::swap( *( (PCB_TABLECELL*) this ), *( (PCB_TABLECELL*) aImage ) );
59}
60
61
62void PCB_TABLECELL::Serialize( kiapi::board::types::TableCell& cell ) const
63{
64 using namespace kiapi::board;
65
66 cell.set_column_span( m_colSpan );
67 cell.set_row_span( m_rowSpan );
68
69 PCB_TEXTBOX::Serialize( *cell.mutable_text_box() );
70
71 kiapi::common::PackCustomProperties( cell.mutable_custom_properties(), *this );
72}
73
74
75void PCB_TABLECELL::Serialize( google::protobuf::Any& aContainer ) const
76{
77 kiapi::board::types::TableCell cell;
78 Serialize( cell );
79
80 if( !aContainer.PackFrom( cell ) )
81 wxFAIL_MSG( wxT( "Failed to pack PCB_TABLECELL" ) );
82}
83
84
85bool PCB_TABLECELL::Deserialize( const kiapi::board::types::TableCell& cell )
86{
87 using namespace kiapi::board;
88
89
90 if( !cell.has_text_box() )
91 return false;
92
93 if( !PCB_TEXTBOX::Deserialize( cell.text_box() ) )
94 return false;
95
96 SetColSpan( cell.column_span() );
97 SetRowSpan( cell.row_span() );
98
99 kiapi::common::UnpackCustomProperties( cell.custom_properties(), *this );
100
101 return true;
102}
103
104
105bool PCB_TABLECELL::Deserialize( const google::protobuf::Any& aContainer )
106{
107 kiapi::board::types::TableCell cell;
108
109 if( !aContainer.UnpackTo( &cell ) )
110 return false;
111
112 return Deserialize( cell );
113}
114
115
116wxString PCB_TABLECELL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
117{
118 return wxString::Format( _( "Table cell %s" ), GetAddr() );
119}
120
121
123{
124 wxCHECK( aOther && aOther->Type() == PCB_TABLECELL_T, /* void */ );
125 *this = *static_cast<const PCB_TABLECELL*>( aOther );
126}
127
128
130{
131 const PCB_TABLE* table = static_cast<const PCB_TABLE*>( GetParent() );
132
133 for( int row = 0; row < table->GetRowCount(); ++row )
134 {
135 for( int col = 0; col < table->GetColCount(); ++col )
136 {
137 if( table->GetCell( row, col ) == this )
138 return row;
139 }
140 }
141
142 return -1;
143}
144
145
147{
148 const PCB_TABLE* table = static_cast<const PCB_TABLE*>( GetParent() );
149
150 for( int row = 0; row < table->GetRowCount(); ++row )
151 {
152 for( int col = 0; col < table->GetColCount(); ++col )
153 {
154 if( table->GetCell( row, col ) == this )
155 return col;
156 }
157 }
158
159 return -1;
160}
161
162
164{
165 return wxString::Format( wxT( "%c%d" ), 'A' + GetColumn() % 26, GetRow() + 1 );
166}
167
168
169wxString PCB_TABLECELL::GetUnwrappedShownText( RESOLUTION_CONTEXT aContext, int aDepth ) const
170{
171 const FOOTPRINT* parentFootprint = GetParentFootprint();
172 const BOARD* board = GetBoard();
173
174 std::function<bool( wxString* )> tableCellResolver =
175 [&]( wxString* token ) -> bool
176 {
177 if( token->IsSameAs( wxT( "ROW" ) ) )
178 {
179 *token = wxString::Format( wxT( "%d" ), GetRow() + 1 ); // 1-based
180 return true;
181 }
182 else if( token->IsSameAs( wxT( "COL" ) ) )
183 {
184 *token = wxString::Format( wxT( "%d" ), GetColumn() + 1 ); // 1-based
185 return true;
186 }
187 else if( token->IsSameAs( wxT( "ADDR" ) ) )
188 {
189 *token = GetAddr();
190 return true;
191 }
192 else if( token->IsSameAs( wxT( "LAYER" ) ) )
193 {
194 *token = GetLayerName();
195 return true;
196 }
197
198 if( parentFootprint && parentFootprint->ResolveTextVar( token, aDepth + 1 ) )
199 return true;
200
201 if( board && board->ResolveTextVar( token, aDepth + 1 ) )
202 return true;
203
204 return false;
205 };
206
207 wxString text = EDA_TEXT::GetShownText( aContext, aDepth );
208
209 if( HasTextVars() && aContext != RAW_VALUE )
210 {
211 text = ResolveTextVars( text, &tableCellResolver, aDepth );
212 FinalizeTextVarExpansion( text, aContext );
213 }
214
215 return text;
216}
217
218
219wxString PCB_TABLECELL::GetShownText( RESOLUTION_CONTEXT aContext, int aDepth ) const
220{
221 wxString text = GetUnwrappedShownText( aContext, aDepth );
222
223 KIFONT::FONT* font = GetDrawFont( nullptr );
224 EDA_ANGLE drawAngle = GetDrawRotation();
225 std::vector<VECTOR2I> corners = GetCornersInSequence( drawAngle );
226 int colWidth = ( corners[1] - corners[0] ).EuclideanNorm();
227
228 if( GetTextAngle().IsHorizontal() )
229 colWidth -= ( GetMarginLeft() + GetMarginRight() );
230 else
231 colWidth -= ( GetMarginTop() + GetMarginBottom() );
232
234
235 return text;
236}
237
238
239double PCB_TABLECELL::GetCoverageArea( int aTextMargin ) const
240{
241 // A cell covers its whole box, not only the text a text box would measure
242 return BOARD_ITEM::GetCoverageArea( aTextMargin );
243}
244
245
247{
248 return static_cast<PCB_TABLE*>( GetParent() )->GetColWidth( GetColumn() );
249}
250
251
253{
254 PCB_TABLE* table = static_cast<PCB_TABLE*>( GetParent() );
255
256 // A generated table autosizes its columns on every rebuild, keeping only the authored width
257 if( table->IsGenerated() )
258 {
259 std::vector<GENERATED_TABLE_COLUMN>& columns = static_cast<PCB_GENERATED_TABLE*>( table )->Columns();
260
261 if( GetColumn() < static_cast<int>( columns.size() ) )
262 columns[GetColumn()].m_Width = aWidth;
263 }
264
265 table->SetColWidth( GetColumn(), aWidth );
266 table->Normalize();
267}
268
269
271{
272 return static_cast<PCB_TABLE*>( GetParent() )->GetRowHeight( GetRow() );
273}
274
275
277{
278 if( PCB_GENERATED_TABLE* generated = dynamic_cast<PCB_GENERATED_TABLE*>( GetParent() ) )
279 {
280 generated->SetRowHeightToFit( GetRow(), aHeight );
281 return;
282 }
283
284 PCB_TABLE* table = static_cast<PCB_TABLE*>( GetParent() );
285
286 table->SetRowHeight( GetRow(), aHeight );
287 table->Normalize();
288}
289
290
292{
293 return PROPERTY_MANAGER::Instance().GetProperty( TYPE_HASH( EDA_TEXT ), _HKI( "Font" ) )->GetChoices( aItem );
294}
295
296
297void PCB_TABLECELL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
298{
299 aList.emplace_back( _( "Table Cell" ), GetAddr() );
300
301 // Don't use GetShownText() here; we want to show the user the variable references
302 aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
303
304 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
305 aList.emplace_back( _( "Status" ), _( "Locked" ) );
306
307 aList.emplace_back( _( "Layer" ), GetLayerName() );
308 aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
309
310 aList.emplace_back( _( "Cell Width" ), aFrame->MessageTextFromValue( std::abs( GetEnd().x - GetStart().x ) ) );
311 aList.emplace_back( _( "Cell Height" ), aFrame->MessageTextFromValue( std::abs( GetEnd().y - GetStart().y ) ) );
312
313 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
314
315 if( GetTextThickness() )
316 aList.emplace_back( _( "Text Thickness" ), aFrame->MessageTextFromValue( GetEffectiveTextPenWidth() ) );
317 else
318 aList.emplace_back( _( "Text Thickness" ), _( "Auto" ) );
319
320 aList.emplace_back( _( "Text Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
321 aList.emplace_back( _( "Text Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );
322}
323
324
325double PCB_TABLECELL::Similarity( const BOARD_ITEM& aBoardItem ) const
326{
327 if( aBoardItem.Type() != Type() )
328 return 0.0;
329
330 const PCB_TABLECELL& other = static_cast<const PCB_TABLECELL&>( aBoardItem );
331
332 double similarity = 1.0;
333
334 if( m_colSpan != other.m_colSpan )
335 similarity *= 0.9;
336
337 if( m_rowSpan != other.m_rowSpan )
338 similarity *= 0.9;
339
340 similarity *= PCB_TEXTBOX::Similarity( other );
341
342 return similarity;
343}
344
345bool PCB_TABLECELL::operator==( const BOARD_ITEM& aBoardItem ) const
346{
347 if( aBoardItem.Type() != Type() )
348 return false;
349
350 const PCB_TABLECELL& other = static_cast<const PCB_TABLECELL&>( aBoardItem );
351
352 return *this == other;
353}
354
355bool PCB_TABLECELL::operator==( const PCB_TABLECELL& aOther ) const
356{
357 return m_colSpan == aOther.m_colSpan && m_rowSpan == aOther.m_rowSpan && PCB_TEXTBOX::operator==( aOther );
358}
359
360
362{
364 {
367
380
381 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( BOARD_ITEM ), _HKI( "Position X" ) );
382 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( BOARD_ITEM ), _HKI( "Position Y" ) );
383 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( PCB_SHAPE ), _HKI( "Layer" ) );
384 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( PCB_SHAPE ), _HKI( "Soldermask" ) );
385 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( PCB_SHAPE ), _HKI( "Soldermask Margin Override" ) );
386 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Corner Radius" ) );
387
389
390 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( PCB_TEXTBOX ), _HKI( "Border" ) );
391 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( PCB_TEXTBOX ), _HKI( "Border Style" ) );
392 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( PCB_TEXTBOX ), _HKI( "Border Width" ) );
393
394 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Start X" ) );
395 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Start Y" ) );
396 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "End X" ) );
397 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "End Y" ) );
398 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Shape" ) );
399 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Width" ) );
400 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Height" ) );
401 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Width" ) );
402 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Style" ) );
403 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Color" ) );
404
405 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Orientation" ) );
406 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Hyperlink" ) );
407 propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Color" ) );
408
409 // A generated table reports the board, so cell contents are not the user's to edit but
410 // their formatting is. Scoped here, not on EDA_TEXT's descriptor, which eeschema shares
412 []( INSPECTABLE* aItem ) -> bool
413 {
414 return !IsGeneratedTableCell( dynamic_cast<PCB_TABLECELL*>( aItem ) );
415 } );
416
417 const auto isGeneratedCell =
418 []( INSPECTABLE* aItem ) -> bool
419 {
420 return IsGeneratedTableCell( dynamic_cast<PCB_TABLECELL*>( aItem ) );
421 };
422
423 const auto isPlainCell =
424 [=]( INSPECTABLE* aItem ) -> bool
425 {
426 return !isGeneratedCell( aItem );
427 };
428
429 const std::vector<wxString> fontGroupProps = { _HKI( "Font" ), _HKI( "Width" ), _HKI( "Height" ) };
430
431 // A generated cell takes its font and size through the Font group, the same as its table
432 for( const wxString& name : fontGroupProps )
433 propMgr.OverrideAvailability( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_TEXT ), name, isPlainCell );
434
435 const wxString fontProps = _HKI( "Font" );
436
439 fontProps )
440 .SetAvailableFunc( isGeneratedCell )
444
445 propMgr.AddProperty( new PROPERTY<PCB_TABLECELL, int>( _HKI( "Font Size" ),
447 fontProps )
448 .SetAvailableFunc( isGeneratedCell )
451 []( INSPECTABLE* aItem ) -> bool
452 {
453 PCB_TABLECELL* cell = dynamic_cast<PCB_TABLECELL*>( aItem );
454 return cell && !cell->HasSquareFontSize();
455 } );
456
457 const wxString tableProps = _( "Table" );
458
459 propMgr.AddProperty( new PROPERTY<PCB_TABLECELL, int>( _HKI( "Column Width" ),
461 tableProps );
462
463 propMgr.AddProperty( new PROPERTY<PCB_TABLECELL, int>( _HKI( "Row Height" ),
465 tableProps );
466 }
const char * name
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...
Definition board_item.h:99
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
Definition board_item.h:281
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:411
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
void SetRectangleHeight(const int &aHeight)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition eda_shape.h:334
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition eda_shape.h:284
void SetRectangleWidth(const int &aWidth)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:94
void SetFontProp(const wxString &aFontName)
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
virtual int GetTextHeight() const
Definition eda_text.h:307
KIFONT::FONT * GetFont() const
Definition eda_text.h:286
void SetMirrored(bool isMirrored)
Definition eda_text.cpp:355
wxString GetFontProp() const
virtual EDA_ANGLE GetDrawRotation() const
Definition eda_text.h:425
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
virtual KIFONT::FONT * GetDrawFont(const RENDER_SETTINGS *aSettings) const
Definition eda_text.cpp:648
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition eda_text.h:139
EDA_TEXT(const EDA_IU_SCALE &aIuScale, const wxString &aText=wxEmptyString)
Definition eda_text.cpp:98
bool IsMirrored() const
Definition eda_text.h:229
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition eda_text.cpp:428
bool IsBold() const
Definition eda_text.h:215
bool ResolveTextVar(wxString *aToken, int aDepth=0) const
Resolve any references to system tokens supported by the component.
Class that other classes need to inherit from, in order to be inspectable.
Definition inspectable.h:39
FONT is an abstract base class for both outline and stroke fonts.
Definition font.h:94
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:612
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.
wxString GetAddr() const
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
int GetRow() const
int GetColumn() const
int GetRowHeight() const
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
int GetMarginTop() 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)
Definition property.h:289
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
Definition property.h:275
PROPERTY_BASE & SetIndeterminateFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object's value for this property is mixed.
Definition property.h:322
wxPGChoices GetChoices(INSPECTABLE *aObject) const
Definition property.h:281
PROPERTY_BASE & SetIsCopyable(bool aIsCopyable=true)
Definition property.h:388
PROPERTY_BASE & SetIsHiddenFromRulesEditor(bool aHide=true)
Definition property.h:361
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.
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)
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:91
@ RAW_VALUE
Definition common.h:98
#define _(s)
#define PCB_EDIT_FRAME_NAME
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition layer_ids.h:870
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:461
#define _HKI(x)
Definition page_info.cpp:40
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.
Definition pcb_table.h:355
static struct PCB_TABLECELL_DESC _PCB_TABLECELL_DESC
#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.
const std::string table
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
Definition typeinfo.h:87