KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_table.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 (C) 2023 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, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <pgm_base.h>
25#include <sch_edit_frame.h>
26#include <plotters/plotter.h>
28#include <geometry/shape_rect.h>
29#include <bitmaps.h>
30#include <string_utils.h>
31#include <schematic.h>
33#include <sch_painter.h>
34#include <wx/log.h>
35#include <sch_table.h>
36
37
38SCH_TABLE::SCH_TABLE( int aLineWidth ) :
39 SCH_ITEM( nullptr, SCH_TABLE_T ),
40 m_strokeExternal( true ),
41 m_strokeHeader( true ),
42 m_borderStroke( aLineWidth, LINE_STYLE::DEFAULT, COLOR4D::UNSPECIFIED ),
43 m_strokeRows( true ),
44 m_strokeColumns( true ),
45 m_separatorsStroke( aLineWidth, LINE_STYLE::DEFAULT, COLOR4D::UNSPECIFIED ),
46 m_colCount( 0 )
47{
49}
50
51
53 SCH_ITEM( aTable )
54{
61
62 m_colCount = aTable.m_colCount;
63 m_colWidths = aTable.m_colWidths;
65
66 for( SCH_TABLECELL* src : aTable.m_cells )
67 AddCell( new SCH_TABLECELL( *src ) );
68}
69
70
72{
73 // We own our cells; delete them
74 for( SCH_TABLECELL* cell : m_cells )
75 delete cell;
76}
77
78
80{
81 SCH_ITEM::SwapFlags( aItem );
82
83 wxCHECK_RET( aItem != nullptr && aItem->Type() == SCH_TABLE_T,
84 wxT( "Cannot swap data with invalid table." ) );
85
86 SCH_TABLE* table = static_cast<SCH_TABLE*>( aItem );
87
88 std::swap( m_strokeExternal, table->m_strokeExternal );
89 std::swap( m_strokeHeader, table->m_strokeHeader );
90 std::swap( m_borderStroke, table->m_borderStroke );
91 std::swap( m_strokeRows, table->m_strokeRows );
92 std::swap( m_strokeColumns, table->m_strokeColumns );
93 std::swap( m_separatorsStroke, table->m_separatorsStroke );
94
95 std::swap( m_colCount, table->m_colCount );
96 std::swap( m_colWidths, table->m_colWidths );
97 std::swap( m_rowHeights, table->m_rowHeights );
98
99 std::swap( m_cells, table->m_cells );
100
101 for( SCH_TABLECELL* cell : m_cells )
102 cell->SetParent( this );
103
104 for( SCH_TABLECELL* cell : table->m_cells )
105 cell->SetParent( table );
106}
107
108
110{
111 Move( aPos - GetPosition() );
112}
113
114
116{
117 return m_cells[0]->GetPosition();
118}
119
120
122{
123 VECTOR2I tableSize;
124
125 for( int ii = 0; ii < GetColCount(); ++ii )
126 tableSize.x += GetColWidth( ii );
127
128 for( int ii = 0; ii < GetRowCount(); ++ii )
129 tableSize.y += GetRowHeight( ii );
130
131 return GetPosition() + tableSize;
132}
133
134
136{
137 // JEY TODO: pukes on rotated tables...
138
139 int y = GetPosition().y;
140
141 for( int row = 0; row < GetRowCount(); ++row )
142 {
143 int x = GetPosition().x;
144 int rowHeight = m_rowHeights[ row ];
145
146 for( int col = 0; col < GetColCount(); ++col )
147 {
148 int colWidth = m_colWidths[ col ];
149
150 SCH_TABLECELL* cell = GetCell( row, col );
151 VECTOR2I pos( x, y );
152
153 if( cell->GetPosition() != pos )
154 {
155 cell->SetPosition( pos );
156 cell->ClearRenderCache();
157 }
158
159 VECTOR2I end = cell->GetStart() + VECTOR2I( colWidth, rowHeight );
160
161 if( cell->GetColSpan() > 1 || cell->GetRowSpan() > 1 )
162 {
163 for( int ii = col + 1; ii < col + cell->GetColSpan(); ++ii )
164 end.x += m_colWidths[ii];
165
166 for( int ii = row + 1; ii < row + cell->GetRowSpan(); ++ii )
167 end.y += m_rowHeights[ii];
168 }
169
170 if( cell->GetEnd() != end )
171 {
172 cell->SetEnd( end );
173 cell->ClearRenderCache();
174 }
175
176 x += colWidth;
177 }
178
179 y += rowHeight;
180 }
181}
182
183
184void SCH_TABLE::Move( const VECTOR2I& aMoveVector )
185{
186 for( SCH_TABLECELL* cell : m_cells )
187 cell->Move( aMoveVector );
188}
189
190
192{
193 // We could mirror all the cells, but it doesn't seem useful....
194}
195
196
198{
199 // We could mirror all the cells, but it doesn't seem useful....
200}
201
202
203void SCH_TABLE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
204{
205 for( SCH_TABLECELL* cell : m_cells )
206 cell->Rotate( aCenter, aRotateCCW );
207
208 Normalize();
209}
210
211
212bool SCH_TABLE::operator<( const SCH_ITEM& aItem ) const
213{
214 if( Type() != aItem.Type() )
215 return Type() < aItem.Type();
216
217 const SCH_TABLE& other = static_cast<const SCH_TABLE&>( aItem );
218
219 if( m_cells.size() != other.m_cells.size() )
220 return m_cells.size() < other.m_cells.size();
221
222 if( GetPosition().x != other.GetPosition().x )
223 return GetPosition().x < GetPosition().x;
224
225 if( GetPosition().y != GetPosition().y )
226 return GetPosition().y < GetPosition().y;
227
228 return m_cells[0] < other.m_cells[0];
229}
230
231
232void SCH_TABLE::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction )
233{
234 for( SCH_TABLECELL* cell : m_cells )
235 aFunction( cell );
236}
237
238
239void SCH_TABLE::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
240 const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
241{
242 for( SCH_TABLECELL* cell : m_cells )
243 cell->Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
244
245 wxDC* DC = aSettings->GetPrintDC();
246 VECTOR2I pos = GetPosition();
247 VECTOR2I end = GetEnd();
248 int lineWidth;
250 LINE_STYLE lineStyle;
251
252 auto setupStroke =
253 [&]( const STROKE_PARAMS& stroke )
254 {
255 lineWidth = stroke.GetWidth();
256 color = stroke.GetColor();
257 lineStyle = stroke.GetLineStyle();
258
259 if( lineWidth == 0 )
260 lineWidth = aSettings->GetDefaultPenWidth();
261
262 if( color == COLOR4D::UNSPECIFIED )
263 color = aSettings->GetLayerColor( LAYER_NOTES );
264
265 if( lineStyle == LINE_STYLE::DEFAULT )
266 lineStyle = LINE_STYLE::SOLID;
267 };
268
269 auto strokeShape =
270 [&]( const SHAPE& shape )
271 {
272 STROKE_PARAMS::Stroke( &shape, lineStyle, lineWidth, aSettings,
273 [&]( const VECTOR2I& a, const VECTOR2I& b )
274 {
275 GRLine( DC, a.x, a.y, b.x, b.y, lineWidth, color );
276 } );
277 };
278
279 auto strokeLine =
280 [&]( const VECTOR2I& ptA, const VECTOR2I& ptB )
281 {
282 if( lineStyle <= LINE_STYLE::FIRST_TYPE )
283 {
284 GRLine( DC, ptA.x, ptA.y, ptB.x, ptB.y, lineWidth, color );
285 }
286 else
287 {
288 SHAPE_SEGMENT seg( ptA, ptB );
289 strokeShape( seg );
290 }
291 };
292
293 auto strokeRect =
294 [&]( const VECTOR2I& ptA, const VECTOR2I& ptB )
295 {
296 if( lineStyle <= LINE_STYLE::FIRST_TYPE )
297 {
298 GRRect( DC, ptA, ptB, lineWidth, color );
299 }
300 else
301 {
302 SHAPE_RECT rect( BOX2I( ptA, ptB - ptA ) );
303 strokeShape( rect );
304 }
305 };
306
307 if( GetSeparatorsStroke().GetWidth() >= 0 )
308 {
309 setupStroke( GetSeparatorsStroke() );
310
311 if( StrokeColumns() )
312 {
313 for( int col = 0; col < GetColCount() - 1; ++col )
314 {
315 for( int row = 0; row < GetRowCount(); ++row )
316 {
317 SCH_TABLECELL* cell = GetCell( row, col );
318
319 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
320 {
321 strokeLine( VECTOR2I( cell->GetEndX(), cell->GetStartY() ),
322 VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
323 }
324 }
325 }
326 }
327
328 if( StrokeRows() )
329 {
330 for( int row = 0; row < GetRowCount() - 1; ++row )
331 {
332 for( int col = 0; col < GetColCount(); ++col )
333 {
334 SCH_TABLECELL* cell = GetCell( row, 0 );
335
336 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
337 {
338 strokeLine( VECTOR2I( cell->GetStartX(), cell->GetEndY() ),
339 VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
340 }
341 }
342 }
343 }
344 }
345
346 if( GetBorderStroke().GetWidth() >= 0 )
347 {
348 setupStroke( GetBorderStroke() );
349
350 if( StrokeHeader() )
351 {
352 SCH_TABLECELL* cell = GetCell( 0, 0 );
353 strokeLine( VECTOR2I( pos.x, cell->GetEndY() ), VECTOR2I( end.x, cell->GetEndY() ) );
354 }
355
356 if( StrokeExternal() )
357 strokeRect( pos, end );
358 }
359}
360
361
363{
364 // Note: a table with no cells is not allowed
365 BOX2I bbox = m_cells[0]->GetBoundingBox();
366
367 bbox.Merge( m_cells[ m_cells.size() - 1 ]->GetBoundingBox() );
368
369 return bbox;
370}
371
372
373INSPECT_RESULT SCH_TABLE::Visit( INSPECTOR aInspector, void* aTestData,
374 const std::vector<KICAD_T>& aScanTypes )
375{
376 for( KICAD_T scanType : aScanTypes )
377 {
378 if( scanType == SCH_LOCATE_ANY_T || scanType == SCH_TABLE_T )
379 {
380 if( INSPECT_RESULT::QUIT == aInspector( this, aTestData ) )
381 return INSPECT_RESULT::QUIT;
382 }
383
384 if( scanType == SCH_LOCATE_ANY_T || scanType == SCH_TABLECELL_T )
385 {
386 for( SCH_TABLECELL* cell : m_cells )
387 {
388 if( INSPECT_RESULT::QUIT == aInspector( cell, (void*) this ) )
389 return INSPECT_RESULT::QUIT;
390 }
391 }
392 }
393
394 return INSPECT_RESULT::CONTINUE;
395}
396
397
398wxString SCH_TABLE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
399{
400 return wxString::Format( _( "%d Column Table" ), m_colCount );
401}
402
403
405{
406 return BITMAPS::spreadsheet; // JEY TODO
407}
408
409
410void SCH_TABLE::ViewGetLayers( int aLayers[], int& aCount ) const
411{
412 aCount = 3;
413 aLayers[0] = LAYER_NOTES;
414 aLayers[1] = LAYER_NOTES_BACKGROUND;
415 aLayers[2] = LAYER_SELECTION_SHADOWS;
416}
417
418
419bool SCH_TABLE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
420{
421 BOX2I rect = GetBoundingBox();
422
423 rect.Inflate( aAccuracy );
424
425 return rect.Contains( aPosition );
426}
427
428
429bool SCH_TABLE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
430{
431 BOX2I rect = aRect;
432
433 rect.Inflate( aAccuracy );
434
435 if( aContained )
436 return rect.Contains( GetBoundingBox() );
437
438 return rect.Intersects( GetBoundingBox() );
439}
440
441
442void SCH_TABLE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
443 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
444{
445 for( SCH_TABLECELL* cell : m_cells )
446 cell->Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed );
447
448 if( aBackground )
449 return;
450
451 RENDER_SETTINGS* settings = aPlotter->RenderSettings();
452 VECTOR2I pos = GetPosition();
453 VECTOR2I end = GetEnd();
454 int lineWidth;
456 LINE_STYLE lineStyle;
457
458 auto setupStroke =
459 [&]( const STROKE_PARAMS& stroke )
460 {
461 lineWidth = stroke.GetWidth();
462 color = stroke.GetColor();
463 lineStyle = stroke.GetLineStyle();
464
465 if( lineWidth == 0 )
466 {
467 if( SCHEMATIC* schematic = Schematic() )
468 lineWidth = schematic->Settings().m_DefaultLineWidth;
469 else
471 }
472
473 if( lineWidth < settings->GetMinPenWidth() )
474 lineWidth = settings->GetMinPenWidth();
475
476 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
477 color = settings->GetLayerColor( m_layer );
478
479 if( lineStyle == LINE_STYLE::DEFAULT )
480 lineStyle = LINE_STYLE::SOLID;
481
482 aPlotter->SetColor( color );
483 aPlotter->SetDash( lineWidth, lineStyle );
484 };
485
486 if( GetSeparatorsStroke().GetWidth() >= 0 )
487 {
488 setupStroke( GetSeparatorsStroke() );
489
490 if( StrokeColumns() )
491 {
492 for( int col = 0; col < GetColCount() - 1; ++col )
493 {
494 for( int row = 0; row < GetRowCount(); ++row )
495 {
496 SCH_TABLECELL* cell = GetCell( row, col );
497
498 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
499 {
500 aPlotter->MoveTo( VECTOR2I( cell->GetEndX(), cell->GetStartY() ) );
501 aPlotter->FinishTo( VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
502 }
503 }
504 }
505 }
506
507 if( StrokeRows() )
508 {
509 for( int row = 0; row < GetRowCount() - 1; ++row )
510 {
511 for( int col = 0; col < GetColCount(); ++col )
512 {
513 SCH_TABLECELL* cell = GetCell( row, 0 );
514
515 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
516 {
517 aPlotter->MoveTo( VECTOR2I( cell->GetStartX(), cell->GetEndY() ) );
518 aPlotter->FinishTo( VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
519 }
520 }
521 }
522 }
523 }
524
525 if( GetBorderStroke().GetWidth() >= 0 )
526 {
527 setupStroke( GetBorderStroke() );
528
529 if( StrokeHeader() )
530 {
531 SCH_TABLECELL* cell = GetCell( 0, 0 );
532 aPlotter->MoveTo( VECTOR2I( pos.x, cell->GetEndY() ) );
533 aPlotter->FinishTo( VECTOR2I( end.x, cell->GetEndY() ) );
534 }
535
536 if( StrokeExternal() )
537 aPlotter->Rect( pos, end, FILL_T::NO_FILL, lineWidth );
538 }
539}
540
541
542void SCH_TABLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
543{
544 // Don't use GetShownText() here; we want to show the user the variable references
545 aList.emplace_back( _( "Table" ), wxString::Format( _( "%d Columns" ), m_colCount ) );
546}
547
548
549bool SCH_TABLE::operator==( const SCH_ITEM& aOther ) const
550{
551 if( Type() != aOther.Type() )
552 return false;
553
554 const SCH_TABLE& other = static_cast<const SCH_TABLE&>( aOther );
555
556 if( m_cells.size() != other.m_cells.size() )
557 return false;
558
559 if( m_colWidths != other.m_colWidths )
560 return false;
561
562 if( m_rowHeights != other.m_rowHeights )
563 return false;
564
565 for( int ii = 0; ii < (int) m_cells.size(); ++ii )
566 {
567 if( !( *m_cells[ii] == *other.m_cells[ii] ) )
568 return false;
569 }
570
571 return true;
572}
573
574
575double SCH_TABLE::Similarity( const SCH_ITEM& aOther ) const
576{
577 if( aOther.Type() != Type() )
578 return 0.0;
579
580 const SCH_TABLE& other = static_cast<const SCH_TABLE&>( aOther );
581
582 if( m_cells.size() != other.m_cells.size() )
583 return 0.1;
584
585 double similarity = 1.0;
586
587 for( int ii = 0; ii < (int) m_cells.size(); ++ii )
588 similarity *= m_cells[ii]->Similarity( *other.m_cells[ii] );
589
590 return similarity;
591}
592
593
594static struct SCH_TABLE_DESC
595{
597 {
600
603
604 propMgr.AddProperty( new PROPERTY<SCH_TABLE, int>( _HKI( "Start X" ),
605 &SCH_TABLE::SetPositionX, &SCH_TABLE::GetPositionX, PROPERTY_DISPLAY::PT_COORD,
607 propMgr.AddProperty( new PROPERTY<SCH_TABLE, int>( _HKI( "Start Y" ),
608 &SCH_TABLE::SetPositionY, &SCH_TABLE::GetPositionY, PROPERTY_DISPLAY::PT_COORD,
610
611 const wxString tableProps = _( "Table Properties" );
612
613 propMgr.AddProperty( new PROPERTY<SCH_TABLE, bool>( _HKI( "External Border" ),
615 tableProps );
616
617 propMgr.AddProperty( new PROPERTY<SCH_TABLE, bool>( _HKI( "Header Border" ),
619 tableProps );
620
621 propMgr.AddProperty( new PROPERTY<SCH_TABLE, int>( _HKI( "Border Width" ),
623 PROPERTY_DISPLAY::PT_SIZE ),
624 tableProps );
625
626 propMgr.AddProperty( new PROPERTY_ENUM<SCH_TABLE, LINE_STYLE>( _HKI( "Border Style" ),
628 tableProps );
629
630 propMgr.AddProperty( new PROPERTY<SCH_TABLE, COLOR4D>( _HKI( "Border Color" ),
632 tableProps );
633
634 propMgr.AddProperty( new PROPERTY<SCH_TABLE, bool>( _HKI( "Row Separators" ),
636 tableProps );
637
638 propMgr.AddProperty( new PROPERTY<SCH_TABLE, bool>( _HKI( "Cell Separators" ),
640 tableProps );
641
642 propMgr.AddProperty( new PROPERTY<SCH_TABLE, int>( _HKI( "Separators Width" ),
644 PROPERTY_DISPLAY::PT_SIZE ),
645 tableProps );
646
647 propMgr.AddProperty( new PROPERTY_ENUM<SCH_TABLE, LINE_STYLE>( _HKI( "Separators Style" ),
649 tableProps );
650
651 propMgr.AddProperty( new PROPERTY<SCH_TABLE, COLOR4D>( _HKI( "Separators Color" ),
653 tableProps );
654 }
int color
Definition: DXF_plotter.cpp:58
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:110
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
BOX2< VECTOR2I > BOX2I
Definition: box2.h:877
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:294
bool Contains(const Vec &aPoint) const
Definition: box2.h:158
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:541
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:623
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:103
int GetStartY() const
Definition: eda_shape.h:126
int GetEndX() const
Definition: eda_shape.h:152
int GetEndY() const
Definition: eda_shape.h:151
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:150
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:125
void SetEnd(const VECTOR2I &aEnd)
Definition: eda_shape.h:154
int GetStartX() const
Definition: eda_shape.h:127
virtual void ClearRenderCache()
Definition: eda_text.cpp:497
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxDC * GetPrintDC() const
Base plotter engine class.
Definition: plotter.h:104
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:243
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle)=0
void FinishTo(const VECTOR2I &pos)
Definition: plotter.h:253
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:135
bool GetColorMode() const
Definition: plotter.h:132
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void SetColor(const COLOR4D &color)=0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:85
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:87
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Holds all the data relating to one schematic.
Definition: schematic.h:75
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:174
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:139
void SetLayer(SCH_LAYER_ID aLayer)
Definition: sch_item.h:290
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition: sch_item.cpp:343
SCH_LAYER_ID m_layer
Definition: sch_item.h:731
void SetPosition(const VECTOR2I &aPos) override
Definition: sch_shape.h:71
VECTOR2I GetPosition() const override
Definition: sch_shape.h:70
int GetColSpan() const
Definition: sch_tablecell.h:61
int GetRowSpan() const
Definition: sch_tablecell.h:64
void SetBorderWidth(int aWidth)
Definition: sch_table.h:62
void SetSeparatorsStyle(const LINE_STYLE aStyle)
Definition: sch_table.h:77
LINE_STYLE GetSeparatorsStyle() const
Definition: sch_table.h:78
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: sch_table.cpp:575
bool operator<(const SCH_ITEM &aItem) const override
Definition: sch_table.cpp:212
void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &offset, bool aForceNoFill, bool aDimmed) override
Print an item.
Definition: sch_table.cpp:239
std::vector< SCH_TABLECELL * > m_cells
Definition: sch_table.h:236
const STROKE_PARAMS & GetSeparatorsStroke() const
Definition: sch_table.h:72
std::map< int, int > m_rowHeights
Definition: sch_table.h:235
bool m_strokeColumns
Definition: sch_table.h:230
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: sch_table.cpp:419
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_table.cpp:79
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_table.cpp:362
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_table.cpp:398
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_table.cpp:191
bool StrokeExternal() const
Definition: sch_table.h:54
void SetBorderColor(const COLOR4D &aColor)
Definition: sch_table.h:68
bool m_strokeRows
Definition: sch_table.h:229
int GetPositionY() const
Definition: sch_table.h:101
void SetPositionX(int x)
Definition: sch_table.h:98
bool m_strokeHeader
Definition: sch_table.h:227
LINE_STYLE GetBorderStyle() const
Definition: sch_table.h:66
void SetSeparatorsColor(const COLOR4D &aColor)
Definition: sch_table.h:80
int GetRowHeight(int aRow) const
Definition: sch_table.h:123
COLOR4D GetSeparatorsColor() const
Definition: sch_table.h:81
void SetStrokeHeader(bool aDoStroke)
Definition: sch_table.h:56
SCH_TABLE(int aLineWidth=0)
Definition: sch_table.cpp:38
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_table.cpp:197
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_table.cpp:410
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: sch_table.cpp:373
int GetColWidth(int aCol) const
Definition: sch_table.h:113
void AddCell(SCH_TABLECELL *aCell)
Definition: sch_table.h:146
void SetSeparatorsWidth(int aWidth)
Definition: sch_table.h:74
const STROKE_PARAMS & GetBorderStroke() const
Definition: sch_table.h:60
int m_colCount
Definition: sch_table.h:233
VECTOR2I GetPosition() const override
Definition: sch_table.cpp:115
void SetStrokeExternal(bool aDoStroke)
Definition: sch_table.h:53
VECTOR2I GetEnd() const
Definition: sch_table.cpp:121
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.
Definition: sch_table.cpp:542
void SetPositionY(int y)
Definition: sch_table.h:99
STROKE_PARAMS m_separatorsStroke
Definition: sch_table.h:231
int GetColCount() const
Definition: sch_table.h:104
bool m_strokeExternal
Definition: sch_table.h:226
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.
Definition: sch_table.cpp:442
std::map< int, int > m_colWidths
Definition: sch_table.h:234
void SetStrokeColumns(bool aDoStroke)
Definition: sch_table.h:83
SCH_TABLECELL * GetCell(int aRow, int aCol) const
Definition: sch_table.h:131
int GetSeparatorsWidth() const
Definition: sch_table.h:75
bool StrokeColumns() const
Definition: sch_table.h:84
void SetPosition(const VECTOR2I &aPos) override
Definition: sch_table.cpp:109
int GetPositionX() const
Definition: sch_table.h:100
bool StrokeRows() const
Definition: sch_table.h:87
STROKE_PARAMS m_borderStroke
Definition: sch_table.h:228
int GetRowCount() const
Definition: sch_table.h:106
void SetStrokeRows(bool aDoStroke)
Definition: sch_table.h:86
void SetBorderStyle(const LINE_STYLE aStyle)
Definition: sch_table.h:65
COLOR4D GetBorderColor() const
Definition: sch_table.h:69
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_table.cpp:404
bool StrokeHeader() const
Definition: sch_table.h:57
bool operator==(const SCH_ITEM &aOther) const override
Definition: sch_table.cpp:549
int GetBorderWidth() const
Definition: sch_table.h:63
void Normalize()
Definition: sch_table.cpp:135
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_table.cpp:184
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_table.cpp:203
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
Definition: sch_table.cpp:232
An abstract shape on 2D plane.
Definition: shape.h:126
Simple container to manage line stroke parameters.
Definition: stroke_params.h:81
int GetWidth() const
Definition: stroke_params.h:91
static void Stroke(const SHAPE *aShape, LINE_STYLE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, const std::function< void(const VECTOR2I &a, const VECTOR2I &b)> &aStroker)
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
#define _HKI(x)
#define _(s)
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:81
void GRRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor)
Definition: gr_basic.cpp:396
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:171
@ LAYER_NOTES
Definition: layer_ids.h:371
@ LAYER_NOTES_BACKGROUND
Definition: layer_ids.h:373
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:395
see class PGM_BASE
#define TYPE_HASH(x)
Definition: property.h:71
#define REGISTER_TYPE(x)
Definition: property_mgr.h:366
static struct SCH_TABLE_DESC _SCH_TABLE_DESC
LINE_STYLE
Dashed line types.
Definition: stroke_params.h:48
constexpr int MilsToIU(int mils) const
Definition: base_units.h:93
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_TABLE_T
Definition: typeinfo.h:165
@ SCH_TABLECELL_T
Definition: typeinfo.h:166
@ SCH_LOCATE_ANY_T
Definition: typeinfo.h:198
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588