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 BOX2I bbox;
124
125 for( SCH_TABLECELL* cell : m_cells )
126 {
127 bbox.Merge( cell->GetPosition() );
128 bbox.Merge( cell->GetEnd() );
129 }
130
131 return bbox.GetCenter();
132}
133
134
136{
137 VECTOR2I tableSize;
138
139 for( int ii = 0; ii < GetColCount(); ++ii )
140 tableSize.x += GetColWidth( ii );
141
142 for( int ii = 0; ii < GetRowCount(); ++ii )
143 tableSize.y += GetRowHeight( ii );
144
145 return GetPosition() + tableSize;
146}
147
148
150{
151 int y = GetPosition().y;
152
153 for( int row = 0; row < GetRowCount(); ++row )
154 {
155 int x = GetPosition().x;
156 int rowHeight = m_rowHeights[ row ];
157
158 for( int col = 0; col < GetColCount(); ++col )
159 {
160 int colWidth = m_colWidths[ col ];
161
162 SCH_TABLECELL* cell = GetCell( row, col );
163 VECTOR2I pos( x, y );
164
165 RotatePoint( pos, GetPosition(), cell->GetTextAngle() );
166
167 if( cell->GetPosition() != pos )
168 {
169 cell->SetPosition( pos );
170 cell->ClearRenderCache();
171 }
172
173 VECTOR2I end = VECTOR2I( x + colWidth, y + rowHeight );
174
175 if( cell->GetColSpan() > 1 || cell->GetRowSpan() > 1 )
176 {
177 for( int ii = col + 1; ii < col + cell->GetColSpan(); ++ii )
178 end.x += m_colWidths[ii];
179
180 for( int ii = row + 1; ii < row + cell->GetRowSpan(); ++ii )
181 end.y += m_rowHeights[ii];
182 }
183
184 RotatePoint( end, GetPosition(), cell->GetTextAngle() );
185
186 if( cell->GetEnd() != end )
187 {
188 cell->SetEnd( end );
189 cell->ClearRenderCache();
190 }
191
192 x += colWidth;
193 }
194
195 y += rowHeight;
196 }
197}
198
199
200void SCH_TABLE::Move( const VECTOR2I& aMoveVector )
201{
202 for( SCH_TABLECELL* cell : m_cells )
203 cell->Move( aMoveVector );
204}
205
206
208{
209 // We could mirror all the cells, but it doesn't seem useful....
210}
211
212
214{
215 // We could mirror all the cells, but it doesn't seem useful....
216}
217
218
219void SCH_TABLE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
220{
221 for( SCH_TABLECELL* cell : m_cells )
222 cell->Rotate( aCenter, aRotateCCW );
223
224 Normalize();
225}
226
227
228bool SCH_TABLE::operator<( const SCH_ITEM& aItem ) const
229{
230 if( Type() != aItem.Type() )
231 return Type() < aItem.Type();
232
233 const SCH_TABLE& other = static_cast<const SCH_TABLE&>( aItem );
234
235 if( m_cells.size() != other.m_cells.size() )
236 return m_cells.size() < other.m_cells.size();
237
238 if( GetPosition().x != other.GetPosition().x )
239 return GetPosition().x < GetPosition().x;
240
241 if( GetPosition().y != GetPosition().y )
242 return GetPosition().y < GetPosition().y;
243
244 return m_cells[0] < other.m_cells[0];
245}
246
247
248void SCH_TABLE::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction )
249{
250 for( SCH_TABLECELL* cell : m_cells )
251 aFunction( cell );
252}
253
254
255void SCH_TABLE::PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
256 const VECTOR2I& aOffset, bool aDimmed )
257{
258 for( SCH_TABLECELL* cell : m_cells )
259 cell->PrintBackground( aSettings, aUnit, aBodyStyle, aOffset, aDimmed );
260}
261
262
263void SCH_TABLE::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
264 const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
265{
266 for( SCH_TABLECELL* cell : m_cells )
267 cell->Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
268
269 wxDC* DC = aSettings->GetPrintDC();
270 VECTOR2I pos = GetPosition();
271 VECTOR2I end = GetEnd();
272 int lineWidth;
274 LINE_STYLE lineStyle;
275
276 auto setupStroke =
277 [&]( const STROKE_PARAMS& stroke )
278 {
279 lineWidth = stroke.GetWidth();
280 color = stroke.GetColor();
281 lineStyle = stroke.GetLineStyle();
282
283 if( lineWidth == 0 )
284 lineWidth = aSettings->GetDefaultPenWidth();
285
286 if( color == COLOR4D::UNSPECIFIED )
287 color = aSettings->GetLayerColor( LAYER_NOTES );
288
289 if( lineStyle == LINE_STYLE::DEFAULT )
290 lineStyle = LINE_STYLE::SOLID;
291 };
292
293 auto strokeShape =
294 [&]( const SHAPE& shape )
295 {
296 STROKE_PARAMS::Stroke( &shape, lineStyle, lineWidth, aSettings,
297 [&]( const VECTOR2I& a, const VECTOR2I& b )
298 {
299 GRLine( DC, a.x, a.y, b.x, b.y, lineWidth, color );
300 } );
301 };
302
303 auto strokeLine =
304 [&]( const VECTOR2I& ptA, const VECTOR2I& ptB )
305 {
306 if( lineStyle <= LINE_STYLE::FIRST_TYPE )
307 {
308 GRLine( DC, ptA.x, ptA.y, ptB.x, ptB.y, lineWidth, color );
309 }
310 else
311 {
312 SHAPE_SEGMENT seg( ptA, ptB );
313 strokeShape( seg );
314 }
315 };
316
317 auto strokeRect =
318 [&]( const VECTOR2I& ptA, const VECTOR2I& ptB )
319 {
320 if( lineStyle <= LINE_STYLE::FIRST_TYPE )
321 {
322 GRRect( DC, ptA, ptB, lineWidth, color );
323 }
324 else
325 {
326 SHAPE_RECT rect( BOX2I( ptA, ptB - ptA ) );
327 strokeShape( rect );
328 }
329 };
330
331 if( GetSeparatorsStroke().GetWidth() >= 0 )
332 {
333 setupStroke( GetSeparatorsStroke() );
334
335 if( StrokeColumns() )
336 {
337 for( int col = 0; col < GetColCount() - 1; ++col )
338 {
339 for( int row = 0; row < GetRowCount(); ++row )
340 {
341 SCH_TABLECELL* cell = GetCell( row, col );
342
343 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
344 {
345 strokeLine( VECTOR2I( cell->GetEndX(), cell->GetStartY() ),
346 VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
347 }
348 }
349 }
350 }
351
352 if( StrokeRows() )
353 {
354 for( int row = 0; row < GetRowCount() - 1; ++row )
355 {
356 for( int col = 0; col < GetColCount(); ++col )
357 {
358 SCH_TABLECELL* cell = GetCell( row, 0 );
359
360 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
361 {
362 strokeLine( VECTOR2I( cell->GetStartX(), cell->GetEndY() ),
363 VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
364 }
365 }
366 }
367 }
368 }
369
370 if( GetBorderStroke().GetWidth() >= 0 )
371 {
372 setupStroke( GetBorderStroke() );
373
374 if( StrokeHeader() )
375 {
376 SCH_TABLECELL* cell = GetCell( 0, 0 );
377 strokeLine( VECTOR2I( pos.x, cell->GetEndY() ), VECTOR2I( end.x, cell->GetEndY() ) );
378 }
379
380 if( StrokeExternal() )
381 strokeRect( pos, end );
382 }
383}
384
385
387{
388 // Note: a table with no cells is not allowed
389 BOX2I bbox = m_cells[0]->GetBoundingBox();
390
391 bbox.Merge( m_cells[ m_cells.size() - 1 ]->GetBoundingBox() );
392
393 return bbox;
394}
395
396
397INSPECT_RESULT SCH_TABLE::Visit( INSPECTOR aInspector, void* aTestData,
398 const std::vector<KICAD_T>& aScanTypes )
399{
400 for( KICAD_T scanType : aScanTypes )
401 {
402 if( scanType == SCH_LOCATE_ANY_T || scanType == SCH_TABLE_T )
403 {
404 if( INSPECT_RESULT::QUIT == aInspector( this, aTestData ) )
405 return INSPECT_RESULT::QUIT;
406 }
407
408 if( scanType == SCH_LOCATE_ANY_T || scanType == SCH_TABLECELL_T )
409 {
410 for( SCH_TABLECELL* cell : m_cells )
411 {
412 if( INSPECT_RESULT::QUIT == aInspector( cell, (void*) this ) )
413 return INSPECT_RESULT::QUIT;
414 }
415 }
416 }
417
418 return INSPECT_RESULT::CONTINUE;
419}
420
421
422wxString SCH_TABLE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
423{
424 return wxString::Format( _( "%d Column Table" ), m_colCount );
425}
426
427
429{
430 return BITMAPS::spreadsheet; // JEY TODO
431}
432
433
434std::vector<int> SCH_TABLE::ViewGetLayers() const
435{
437}
438
439
440bool SCH_TABLE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
441{
442 BOX2I rect = GetBoundingBox();
443
444 rect.Inflate( aAccuracy );
445
446 return rect.Contains( aPosition );
447}
448
449
450bool SCH_TABLE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
451{
452 BOX2I rect = aRect;
453
454 rect.Inflate( aAccuracy );
455
456 if( aContained )
457 return rect.Contains( GetBoundingBox() );
458
459 return rect.Intersects( GetBoundingBox() );
460}
461
462
463void SCH_TABLE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
464 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
465{
466 for( SCH_TABLECELL* cell : m_cells )
467 cell->Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed );
468
469 if( aBackground )
470 return;
471
472 RENDER_SETTINGS* settings = aPlotter->RenderSettings();
473 VECTOR2I pos = GetPosition();
474 VECTOR2I end = GetEnd();
475 int lineWidth;
477 LINE_STYLE lineStyle;
478
479 auto setupStroke =
480 [&]( const STROKE_PARAMS& stroke )
481 {
482 lineWidth = stroke.GetWidth();
483 color = stroke.GetColor();
484 lineStyle = stroke.GetLineStyle();
485
486 if( lineWidth == 0 )
487 {
488 if( SCHEMATIC* schematic = Schematic() )
489 lineWidth = schematic->Settings().m_DefaultLineWidth;
490 else
492 }
493
494 if( lineWidth < settings->GetMinPenWidth() )
495 lineWidth = settings->GetMinPenWidth();
496
497 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
498 color = settings->GetLayerColor( m_layer );
499
500 if( lineStyle == LINE_STYLE::DEFAULT )
501 lineStyle = LINE_STYLE::SOLID;
502
503 aPlotter->SetColor( color );
504 aPlotter->SetDash( lineWidth, lineStyle );
505 };
506
507 if( GetSeparatorsStroke().GetWidth() >= 0 )
508 {
509 setupStroke( GetSeparatorsStroke() );
510
511 if( StrokeColumns() )
512 {
513 for( int col = 0; col < GetColCount() - 1; ++col )
514 {
515 for( int row = 0; row < GetRowCount(); ++row )
516 {
517 SCH_TABLECELL* cell = GetCell( row, col );
518
519 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
520 {
521 aPlotter->MoveTo( VECTOR2I( cell->GetEndX(), cell->GetStartY() ) );
522 aPlotter->FinishTo( VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
523 }
524 }
525 }
526 }
527
528 if( StrokeRows() )
529 {
530 for( int row = 0; row < GetRowCount() - 1; ++row )
531 {
532 for( int col = 0; col < GetColCount(); ++col )
533 {
534 SCH_TABLECELL* cell = GetCell( row, 0 );
535
536 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
537 {
538 aPlotter->MoveTo( VECTOR2I( cell->GetStartX(), cell->GetEndY() ) );
539 aPlotter->FinishTo( VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
540 }
541 }
542 }
543 }
544 }
545
546 if( GetBorderStroke().GetWidth() >= 0 )
547 {
548 setupStroke( GetBorderStroke() );
549
550 if( StrokeHeader() )
551 {
552 SCH_TABLECELL* cell = GetCell( 0, 0 );
553 aPlotter->MoveTo( VECTOR2I( pos.x, cell->GetEndY() ) );
554 aPlotter->FinishTo( VECTOR2I( end.x, cell->GetEndY() ) );
555 }
556
557 if( StrokeExternal() )
558 aPlotter->Rect( pos, end, FILL_T::NO_FILL, lineWidth );
559 }
560}
561
562
563void SCH_TABLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
564{
565 // Don't use GetShownText() here; we want to show the user the variable references
566 aList.emplace_back( _( "Table" ), wxString::Format( _( "%d Columns" ), m_colCount ) );
567}
568
569
570bool SCH_TABLE::operator==( const SCH_ITEM& aOther ) const
571{
572 if( Type() != aOther.Type() )
573 return false;
574
575 const SCH_TABLE& other = static_cast<const SCH_TABLE&>( aOther );
576
577 if( m_cells.size() != other.m_cells.size() )
578 return false;
579
580 if( m_colWidths != other.m_colWidths )
581 return false;
582
583 if( m_rowHeights != other.m_rowHeights )
584 return false;
585
586 for( int ii = 0; ii < (int) m_cells.size(); ++ii )
587 {
588 if( !( *m_cells[ii] == *other.m_cells[ii] ) )
589 return false;
590 }
591
592 return true;
593}
594
595
596double SCH_TABLE::Similarity( const SCH_ITEM& aOther ) const
597{
598 if( aOther.Type() != Type() )
599 return 0.0;
600
601 const SCH_TABLE& other = static_cast<const SCH_TABLE&>( aOther );
602
603 if( m_cells.size() != other.m_cells.size() )
604 return 0.1;
605
606 double similarity = 1.0;
607
608 for( int ii = 0; ii < (int) m_cells.size(); ++ii )
609 similarity *= m_cells[ii]->Similarity( *other.m_cells[ii] );
610
611 return similarity;
612}
613
614
615static struct SCH_TABLE_DESC
616{
618 {
621
624
625 propMgr.AddProperty( new PROPERTY<SCH_TABLE, int>( _HKI( "Start X" ),
626 &SCH_TABLE::SetPositionX, &SCH_TABLE::GetPositionX, PROPERTY_DISPLAY::PT_COORD,
628 propMgr.AddProperty( new PROPERTY<SCH_TABLE, int>( _HKI( "Start Y" ),
629 &SCH_TABLE::SetPositionY, &SCH_TABLE::GetPositionY, PROPERTY_DISPLAY::PT_COORD,
631
632 const wxString tableProps = _( "Table Properties" );
633
634 propMgr.AddProperty( new PROPERTY<SCH_TABLE, bool>( _HKI( "External Border" ),
636 tableProps );
637
638 propMgr.AddProperty( new PROPERTY<SCH_TABLE, bool>( _HKI( "Header Border" ),
640 tableProps );
641
642 propMgr.AddProperty( new PROPERTY<SCH_TABLE, int>( _HKI( "Border Width" ),
644 PROPERTY_DISPLAY::PT_SIZE ),
645 tableProps );
646
647 propMgr.AddProperty( new PROPERTY_ENUM<SCH_TABLE, LINE_STYLE>( _HKI( "Border Style" ),
649 tableProps );
650
651 propMgr.AddProperty( new PROPERTY<SCH_TABLE, COLOR4D>( _HKI( "Border Color" ),
653 tableProps );
654
655 propMgr.AddProperty( new PROPERTY<SCH_TABLE, bool>( _HKI( "Row Separators" ),
657 tableProps );
658
659 propMgr.AddProperty( new PROPERTY<SCH_TABLE, bool>( _HKI( "Cell Separators" ),
661 tableProps );
662
663 propMgr.AddProperty( new PROPERTY<SCH_TABLE, int>( _HKI( "Separators Width" ),
665 PROPERTY_DISPLAY::PT_SIZE ),
666 tableProps );
667
668 propMgr.AddProperty( new PROPERTY_ENUM<SCH_TABLE, LINE_STYLE>( _HKI( "Separators Style" ),
670 tableProps );
671
672 propMgr.AddProperty( new PROPERTY<SCH_TABLE, COLOR4D>( _HKI( "Separators Color" ),
674 tableProps );
675 }
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:922
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:558
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:658
constexpr const Vec GetCenter() const
Definition: box2.h:230
constexpr bool Contains(const Vec &aPoint) const
Definition: box2.h:168
constexpr bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:311
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:104
int GetStartY() const
Definition: eda_shape.h:138
int GetEndX() const
Definition: eda_shape.h:176
int GetEndY() const
Definition: eda_shape.h:175
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:174
void SetEnd(const VECTOR2I &aEnd)
Definition: eda_shape.h:178
int GetStartX() const
Definition: eda_shape.h:139
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:134
virtual void ClearRenderCache()
Definition: eda_text.cpp:631
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:105
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:244
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle)=0
void FinishTo(const VECTOR2I &pos)
Definition: plotter.h:254
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:136
bool GetColorMode() const
Definition: plotter.h:133
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:77
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:166
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:150
void SetLayer(SCH_LAYER_ID aLayer)
Definition: sch_item.h:282
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition: sch_item.cpp:351
SCH_LAYER_ID m_layer
Definition: sch_item.h:723
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
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_table.cpp:434
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:596
bool operator<(const SCH_ITEM &aItem) const override
Definition: sch_table.cpp:228
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:263
std::vector< SCH_TABLECELL * > m_cells
Definition: sch_table.h:240
const STROKE_PARAMS & GetSeparatorsStroke() const
Definition: sch_table.h:72
std::map< int, int > m_rowHeights
Definition: sch_table.h:239
bool m_strokeColumns
Definition: sch_table.h:234
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:440
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:386
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_table.cpp:207
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:233
int GetPositionY() const
Definition: sch_table.h:102
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: sch_table.cpp:422
void SetPositionX(int x)
Definition: sch_table.h:99
bool m_strokeHeader
Definition: sch_table.h:231
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:124
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:213
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:397
int GetColWidth(int aCol) const
Definition: sch_table.h:114
void AddCell(SCH_TABLECELL *aCell)
Definition: sch_table.h:147
void SetSeparatorsWidth(int aWidth)
Definition: sch_table.h:74
const STROKE_PARAMS & GetBorderStroke() const
Definition: sch_table.h:60
VECTOR2I GetCenter() const
Definition: sch_table.cpp:121
void PrintBackground(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Print just the background fills.
Definition: sch_table.cpp:255
int m_colCount
Definition: sch_table.h:237
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:135
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:563
void SetPositionY(int y)
Definition: sch_table.h:100
STROKE_PARAMS m_separatorsStroke
Definition: sch_table.h:235
int GetColCount() const
Definition: sch_table.h:105
bool m_strokeExternal
Definition: sch_table.h:230
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:463
std::map< int, int > m_colWidths
Definition: sch_table.h:238
void SetStrokeColumns(bool aDoStroke)
Definition: sch_table.h:83
SCH_TABLECELL * GetCell(int aRow, int aCol) const
Definition: sch_table.h:132
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:101
bool StrokeRows() const
Definition: sch_table.h:87
STROKE_PARAMS m_borderStroke
Definition: sch_table.h:232
int GetRowCount() const
Definition: sch_table.h:107
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:428
bool StrokeHeader() const
Definition: sch_table.h:57
bool operator==(const SCH_ITEM &aOther) const override
Definition: sch_table.cpp:570
int GetBorderWidth() const
Definition: sch_table.h:63
void Normalize()
Definition: sch_table.cpp:149
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_table.cpp:200
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_table.cpp:219
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
Definition: sch_table.cpp:248
An abstract shape on 2D plane.
Definition: shape.h:126
Simple container to manage line stroke parameters.
Definition: stroke_params.h:79
int GetWidth() const
Definition: stroke_params.h:89
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:82
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:397
see class PGM_BASE
#define TYPE_HASH(x)
Definition: property.h:71
#define REGISTER_TYPE(x)
Definition: property_mgr.h:371
static struct SCH_TABLE_DESC _SCH_TABLE_DESC
LINE_STYLE
Dashed line types.
Definition: stroke_params.h:46
constexpr int MilsToIU(int mils) const
Definition: base_units.h:93
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
Definition: trigo.cpp:229
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< int32_t > VECTOR2I
Definition: vector2d.h:691