KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_lib_edit_pin_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) 1992-2022 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
25#include "grid_tricks.h"
26#include <sch_pin.h>
27#include <pin_numbers.h>
28#include "pgm_base.h"
29#include <base_units.h>
30#include <bitmaps.h>
31#include <confirm.h>
32#include <symbol_edit_frame.h>
34#include <kiplatform/ui.h>
37#include <widgets/wx_grid.h>
41#include <wx/tokenzr.h>
42#include <string_utils.h>
43
44#define UNITS_ALL _( "ALL" )
45#define DEMORGAN_ALL _( "ALL" )
46#define DEMORGAN_STD _( "Standard" )
47#define DEMORGAN_ALT _( "Alternate" )
48
49
50void getSelectedArea( WX_GRID* aGrid, int* aRowStart, int* aRowCount )
51{
52 wxGridCellCoordsArray topLeft = aGrid->GetSelectionBlockTopLeft();
53 wxGridCellCoordsArray botRight = aGrid->GetSelectionBlockBottomRight();
54
55 wxArrayInt cols = aGrid->GetSelectedCols();
56 wxArrayInt rows = aGrid->GetSelectedRows();
57
58 if( topLeft.Count() && botRight.Count() )
59 {
60 *aRowStart = topLeft[0].GetRow();
61 *aRowCount = botRight[0].GetRow() - *aRowStart + 1;
62 }
63 else if( cols.Count() )
64 {
65 *aRowStart = 0;
66 *aRowCount = aGrid->GetNumberRows();
67 }
68 else if( rows.Count() )
69 {
70 *aRowStart = rows[0];
71 *aRowCount = rows.Count();
72 }
73 else
74 {
75 *aRowStart = aGrid->GetGridCursorRow();
76 *aRowCount = *aRowStart >= 0 ? 1 : 0;
77 }
78}
79
80
81class PIN_TABLE_DATA_MODEL : public wxGridTableBase
82{
83public:
85 LIB_SYMBOL* aSymbol ) :
86 m_frame( aFrame ),
87 m_unitFilter( -1 ),
88 m_edited( false ),
89 m_pinTable( aPinTable ),
90 m_symbol( aSymbol )
91 {
92 m_eval = std::make_unique<NUMERIC_EVALUATOR>( m_frame->GetUserUnits() );
93
94 m_frame->Bind( EDA_EVT_UNITS_CHANGED, &PIN_TABLE_DATA_MODEL::onUnitsChanged, this );
95 }
96
98 {
99 m_frame->Unbind( EDA_EVT_UNITS_CHANGED, &PIN_TABLE_DATA_MODEL::onUnitsChanged, this );
100 }
101
102 void onUnitsChanged( wxCommandEvent& aEvent )
103 {
104 if( GetView() )
105 GetView()->ForceRefresh();
106
107 aEvent.Skip();
108 }
109
110 void SetUnitFilter( int aFilter ) { m_unitFilter = aFilter; }
111
112 int GetNumberRows() override { return (int) m_rows.size(); }
113 int GetNumberCols() override { return COL_COUNT; }
114
115 wxString GetColLabelValue( int aCol ) override
116 {
117 switch( aCol )
118 {
119 case COL_PIN_COUNT: return _( "Count" );
120 case COL_NUMBER: return _( "Number" );
121 case COL_NAME: return _( "Name" );
122 case COL_TYPE: return _( "Electrical Type" );
123 case COL_SHAPE: return _( "Graphic Style" );
124 case COL_ORIENTATION: return _( "Orientation" );
125 case COL_NUMBER_SIZE: return _( "Number Text Size" );
126 case COL_NAME_SIZE: return _( "Name Text Size" );
127 case COL_LENGTH: return _( "Length" );
128 case COL_POSX: return _( "X Position" );
129 case COL_POSY: return _( "Y Position" );
130 case COL_VISIBLE: return _( "Visible" );
131 case COL_UNIT: return _( "Unit" );
132 case COL_DEMORGAN: return _( "De Morgan" );
133 default: wxFAIL; return wxEmptyString;
134 }
135 }
136
137 bool IsEmptyCell( int row, int col ) override
138 {
139 return false; // don't allow adjacent cell overflow, even if we are actually empty
140 }
141
142 wxString GetValue( int aRow, int aCol ) override
143 {
144 wxGrid* grid = GetView();
145
146 if( grid->GetGridCursorRow() == aRow && grid->GetGridCursorCol() == aCol
147 && grid->IsCellEditControlShown() )
148 {
149 auto it = m_evalOriginal.find( { m_rows[ aRow ], aCol } );
150
151 if( it != m_evalOriginal.end() )
152 return it->second;
153 }
154
155 return GetValue( m_rows[ aRow ], aCol, m_frame );
156 }
157
158 static wxString GetValue( const std::vector<SCH_PIN*>& pins, int aCol,
159 EDA_DRAW_FRAME* aParentFrame )
160 {
161 wxString fieldValue;
162
163 if( pins.empty() )
164 return fieldValue;
165
166 for( SCH_PIN* pin : pins )
167 {
168 wxString val;
169
170 switch( aCol )
171 {
172 case COL_PIN_COUNT:
173 val << pins.size();
174 break;
175
176 case COL_NUMBER:
177 val = pin->GetNumber();
178 break;
179
180 case COL_NAME:
181 val = pin->GetName();
182 break;
183
184 case COL_TYPE:
185 val = PinTypeNames()[static_cast<int>( pin->GetType() )];
186 break;
187
188 case COL_SHAPE:
189 val = PinShapeNames()[static_cast<int>( pin->GetShape() )];
190 break;
191
192 case COL_ORIENTATION:
193 if( PinOrientationIndex( pin->GetOrientation() ) >= 0 )
194 val = PinOrientationNames()[ PinOrientationIndex( pin->GetOrientation() ) ];
195
196 break;
197
198 case COL_NUMBER_SIZE:
199 val = aParentFrame->StringFromValue( pin->GetNumberTextSize(), true );
200 break;
201
202 case COL_NAME_SIZE:
203 val = aParentFrame->StringFromValue( pin->GetNameTextSize(), true );
204 break;
205
206 case COL_LENGTH:
207 val = aParentFrame->StringFromValue( pin->GetLength(), true );
208 break;
209
210 case COL_POSX:
211 val = aParentFrame->StringFromValue( pin->GetPosition().x, true );
212 break;
213
214 case COL_POSY:
215 val = aParentFrame->StringFromValue( -pin->GetPosition().y, true );
216 break;
217
218 case COL_VISIBLE:
219 val = StringFromBool( pin->IsVisible() );
220 break;
221
222 case COL_UNIT:
223 if( pin->GetUnit() )
224 val = LIB_SYMBOL::LetterSubReference( pin->GetUnit(), 'A' );
225 else
226 val = UNITS_ALL;
227 break;
228
229 case COL_DEMORGAN:
230 switch( pin->GetBodyStyle() )
231 {
232 case BODY_STYLE::BASE:
233 val = DEMORGAN_STD;
234 break;
235 case BODY_STYLE::DEMORGAN:
236 val = DEMORGAN_ALT;
237 break;
238 default:
239 val = DEMORGAN_ALL;
240 break;
241 }
242 break;
243
244 default:
245 wxFAIL;
246 break;
247 }
248
249 if( aCol == COL_NUMBER )
250 {
251 if( fieldValue.length() )
252 fieldValue += wxT( ", " );
253 fieldValue += val;
254 }
255 else
256 {
257 if( !fieldValue.Length() )
258 fieldValue = val;
259 else if( val != fieldValue )
260 fieldValue = INDETERMINATE_STATE;
261 }
262 }
263
264 return fieldValue;
265 }
266
267 void SetValue( int aRow, int aCol, const wxString &aValue ) override
268 {
269 if( aValue == INDETERMINATE_STATE )
270 return;
271
272 wxString value = aValue;
273
274 switch( aCol )
275 {
276 case COL_NUMBER_SIZE:
277 case COL_NAME_SIZE:
278 case COL_LENGTH:
279 case COL_POSX:
280 case COL_POSY:
281 m_eval->SetDefaultUnits( m_frame->GetUserUnits() );
282
283 if( m_eval->Process( value ) )
284 {
285 m_evalOriginal[ { m_rows[ aRow ], aCol } ] = value;
286 value = m_eval->Result();
287 }
288
289 break;
290
291 default:
292 break;
293 }
294
295 std::vector<SCH_PIN*> pins = m_rows[ aRow ];
296
297 // If the NUMBER column is edited and the pins are grouped, renumber, and add or
298 // remove pins based on the comma separated list of pins.
299 if( aCol == COL_NUMBER && m_pinTable->IsDisplayGrouped() )
300 {
301 wxStringTokenizer tokenizer( value, "," );
302 size_t i = 0;
303
304 while( tokenizer.HasMoreTokens() )
305 {
306 wxString pinName = tokenizer.GetNextToken();
307
308 // Trim whitespace from both ends of the string
309 pinName.Trim( true ).Trim( false );
310
311 if( i < pins.size() )
312 {
313 // Renumber the existing pins
314 pins.at( i )->SetNumber( pinName );
315 }
316 else
317 {
318 // Create new pins
319 SCH_PIN* newPin = new SCH_PIN( this->m_symbol );
320 SCH_PIN* last = pins.back();
321
322 newPin->SetNumber( pinName );
323 newPin->SetName( last->GetName() );
324 newPin->SetOrientation( last->GetOrientation() );
325 newPin->SetType( last->GetType() );
326 newPin->SetShape( last->GetShape() );
327 newPin->SetUnit( last->GetUnit() );
328
329 VECTOR2I pos = last->GetPosition();
330
332
333 if( last->GetOrientation() == PIN_ORIENTATION::PIN_LEFT
334 || last->GetOrientation() == PIN_ORIENTATION::PIN_RIGHT )
335 {
336 pos.y -= schIUScale.MilsToIU( cfg->m_Repeat.pin_step );
337 }
338 else
339 {
340 pos.x += schIUScale.MilsToIU( cfg->m_Repeat.pin_step );
341 }
342
343 newPin->SetPosition( pos );
344
345 pins.push_back( newPin );
346 m_pinTable->AddPin( newPin );
347 }
348
349 i++;
350 }
351
352 while( pins.size() > i )
353 {
354 m_pinTable->RemovePin( pins.back() );
355 pins.pop_back();
356 }
357
358 m_rows[aRow] = pins;
359 m_edited = true;
360
361 return;
362 }
363
364 for( SCH_PIN* pin : pins )
365 {
366 switch( aCol )
367 {
368 case COL_NUMBER:
370 pin->SetNumber( value );
371
372 break;
373
374 case COL_NAME:
375 pin->SetName( value );
376 break;
377
378 case COL_TYPE:
379 if( PinTypeNames().Index( value ) != wxNOT_FOUND )
380 pin->SetType( (ELECTRICAL_PINTYPE) PinTypeNames().Index( value ) );
381
382 break;
383
384 case COL_SHAPE:
385 if( PinShapeNames().Index( value ) != wxNOT_FOUND )
386 pin->SetShape( (GRAPHIC_PINSHAPE) PinShapeNames().Index( value ) );
387
388 break;
389
390 case COL_ORIENTATION:
391 if( PinOrientationNames().Index( value ) != wxNOT_FOUND )
392 pin->SetOrientation( PinOrientationCode( PinOrientationNames().Index( value ) ) );
393 break;
394
395 case COL_NUMBER_SIZE:
396 pin->SetNumberTextSize( m_frame->ValueFromString( value ) );
397 break;
398
399 case COL_NAME_SIZE:
400 pin->SetNameTextSize( m_frame->ValueFromString( value ) );
401 break;
402
403 case COL_LENGTH:
404 pin->ChangeLength( m_frame->ValueFromString( value ) );
405 break;
406
407 case COL_POSX:
408 pin->SetPosition( VECTOR2I( m_frame->ValueFromString( value ),
409 pin->GetPosition().y ) );
410 break;
411
412 case COL_POSY:
413 pin->SetPosition( VECTOR2I( pin->GetPosition().x,
414 -m_frame->ValueFromString( value ) ) );
415 break;
416
417 case COL_VISIBLE:
418 pin->SetVisible(BoolFromString( value ));
419 break;
420
421 case COL_UNIT:
422 if( value == UNITS_ALL )
423 {
424 pin->SetUnit( 0 );
425 }
426 else
427 {
428 for( int i = 1; i <= m_symbol->GetUnitCount(); i++ )
429 {
430 if( value == LIB_SYMBOL::LetterSubReference( i, 'A' ) )
431 {
432 pin->SetUnit( i );
433 break;
434 }
435 }
436 }
437 break;
438
439 case COL_DEMORGAN:
440 if( value == DEMORGAN_STD )
441 pin->SetBodyStyle( 1 );
442 else if( value == DEMORGAN_ALT )
443 pin->SetBodyStyle( 2 );
444 else
445 pin->SetBodyStyle( 0 );
446 break;
447
448 default:
449 wxFAIL;
450 break;
451 }
452 }
453
454 m_edited = true;
455 }
456
457 static int findRow( const std::vector<std::vector<SCH_PIN*>>& aRowSet, const wxString& aName )
458 {
459 for( size_t i = 0; i < aRowSet.size(); ++i )
460 {
461 if( aRowSet[ i ][ 0 ] && aRowSet[ i ][ 0 ]->GetName() == aName )
462 return i;
463 }
464
465 return -1;
466 }
467
468 static bool compare( const std::vector<SCH_PIN*>& lhs, const std::vector<SCH_PIN*>& rhs,
469 int sortCol, bool ascending, EDA_DRAW_FRAME* parentFrame )
470 {
471 wxString lhStr = GetValue( lhs, sortCol, parentFrame );
472 wxString rhStr = GetValue( rhs, sortCol, parentFrame );
473
474 if( lhStr == rhStr )
475 {
476 // Secondary sort key is always COL_NUMBER
477 sortCol = COL_NUMBER;
478 lhStr = GetValue( lhs, sortCol, parentFrame );
479 rhStr = GetValue( rhs, sortCol, parentFrame );
480 }
481
482 bool res;
483
484 // N.B. To meet the iterator sort conditions, we cannot simply invert the truth
485 // to get the opposite sort. i.e. ~(a<b) != (a>b)
486 auto cmp = [ ascending ]( const auto a, const auto b )
487 {
488 if( ascending )
489 return a < b;
490 else
491 return b < a;
492 };
493
494 switch( sortCol )
495 {
496 case COL_NUMBER:
497 case COL_NAME:
498 res = cmp( PIN_NUMBERS::Compare( lhStr, rhStr ), 0 );
499 break;
500 case COL_NUMBER_SIZE:
501 case COL_NAME_SIZE:
502 res = cmp( parentFrame->ValueFromString( lhStr ),
503 parentFrame->ValueFromString( rhStr ) );
504 break;
505 case COL_LENGTH:
506 case COL_POSX:
507 case COL_POSY:
508 res = cmp( parentFrame->ValueFromString( lhStr ),
509 parentFrame->ValueFromString( rhStr ) );
510 break;
511 case COL_VISIBLE:
512 case COL_DEMORGAN:
513 default:
514 res = cmp( StrNumCmp( lhStr, rhStr ), 0 );
515 break;
516 }
517
518 return res;
519 }
520
521 void RebuildRows( const std::vector<SCH_PIN*>& aPins, bool groupByName, bool groupBySelection )
522 {
523 WX_GRID* grid = dynamic_cast<WX_GRID*>( GetView() );
524 std::vector<SCH_PIN*> clear_flags;
525
526 clear_flags.reserve( aPins.size() );
527
528 if( grid )
529 {
530 if( groupBySelection )
531 {
532 for( SCH_PIN* pin : aPins )
533 pin->ClearTempFlags();
534
535 int firstSelectedRow;
536 int selectedRowCount;
537
538 getSelectedArea( grid, &firstSelectedRow, &selectedRowCount );
539
540 for( int ii = 0; ii < selectedRowCount; ++ii )
541 {
542 for( SCH_PIN* pin : m_rows[ firstSelectedRow + ii ] )
543 {
544 pin->SetFlags( CANDIDATE );
545 clear_flags.push_back( pin );
546 }
547 }
548 }
549
550 // Commit any pending in-place edits before the row gets moved out from under
551 // the editor.
552 grid->CommitPendingChanges( true );
553
554 wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, m_rows.size() );
555 GetView()->ProcessTableMessage( msg );
556 }
557
558 m_rows.clear();
559
560 if( groupBySelection )
561 m_rows.emplace_back( std::vector<SCH_PIN*>() );
562
563 for( SCH_PIN* pin : aPins )
564 {
565 if( m_unitFilter == -1 || pin->GetUnit() == 0 || pin->GetUnit() == m_unitFilter )
566 {
567 int rowIndex = -1;
568
569 if( groupByName )
570 rowIndex = findRow( m_rows, pin->GetName() );
571 else if( groupBySelection && ( pin->GetFlags() & CANDIDATE ) )
572 rowIndex = 0;
573
574 if( rowIndex < 0 )
575 {
576 m_rows.emplace_back( std::vector<SCH_PIN*>() );
577 rowIndex = m_rows.size() - 1;
578 }
579
580 m_rows[ rowIndex ].push_back( pin );
581 }
582 }
583
584 int sortCol = 0;
585 bool ascending = true;
586
587 if( GetView() && GetView()->GetSortingColumn() != wxNOT_FOUND )
588 {
589 sortCol = GetView()->GetSortingColumn();
590 ascending = GetView()->IsSortOrderAscending();
591 }
592
593 for( std::vector<SCH_PIN*>& row : m_rows )
594 SortPins( row );
595
596 if( !groupBySelection )
597 SortRows( sortCol, ascending );
598
599 if ( GetView() )
600 {
601 wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, (int) m_rows.size() );
602 GetView()->ProcessTableMessage( msg );
603
604 if( groupBySelection )
605 GetView()->SelectRow( 0 );
606 }
607
608 for( SCH_PIN* pin : clear_flags )
609 pin->ClearFlags( CANDIDATE );
610 }
611
612 void SortRows( int aSortCol, bool ascending )
613 {
614 std::sort( m_rows.begin(), m_rows.end(),
615 [ aSortCol, ascending, this ]( const std::vector<SCH_PIN*>& lhs,
616 const std::vector<SCH_PIN*>& rhs ) -> bool
617 {
618 return compare( lhs, rhs, aSortCol, ascending, m_frame );
619 } );
620 }
621
622 void SortPins( std::vector<SCH_PIN*>& aRow )
623 {
624 std::sort( aRow.begin(), aRow.end(),
625 []( SCH_PIN* lhs, SCH_PIN* rhs ) -> bool
626 {
627 return PIN_NUMBERS::Compare( lhs->GetNumber(), rhs->GetNumber() ) < 0;
628 } );
629 }
630
631 void AppendRow( SCH_PIN* aPin )
632 {
633 std::vector<SCH_PIN*> row;
634 row.push_back( aPin );
635 m_rows.push_back( row );
636
637 if ( GetView() )
638 {
639 wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
640 GetView()->ProcessTableMessage( msg );
641 }
642 }
643
644 std::vector<SCH_PIN*> RemoveRow( int aRow )
645 {
646 std::vector<SCH_PIN*> removedRow = m_rows[ aRow ];
647
648 m_rows.erase( m_rows.begin() + aRow );
649
650 if ( GetView() )
651 {
652 wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aRow, 1 );
653 GetView()->ProcessTableMessage( msg );
654 }
655
656 return removedRow;
657 }
658
659 std::vector<SCH_PIN*> GetRowPins( int aRow )
660 {
661 return m_rows[ aRow ];
662 }
663
664 bool IsEdited()
665 {
666 return m_edited;
667 }
668
669private:
670 static wxString StringFromBool( bool aValue )
671 {
672 if( aValue )
673 return wxT( "1" );
674 else
675 return wxT( "0" );
676 }
677
678 static bool BoolFromString( wxString aValue )
679 {
680 if( aValue == wxS( "1" ) )
681 {
682 return true;
683 }
684 else if( aValue == wxS( "0" ) )
685 {
686 return false;
687 }
688 else
689 {
690 wxFAIL_MSG( wxString::Format( "string '%s' can't be converted to boolean correctly, "
691 "it will have been perceived as FALSE",
692 aValue ) );
693 return false;
694 }
695 }
696
697private:
699
700 // Because the rows of the grid can either be a single pin or a group of pins, the
701 // data model is a 2D vector. If we're in the single pin case, each row's SCH_PINs
702 // contains only a single pin.
703 std::vector<std::vector<SCH_PIN*>> m_rows;
704 int m_unitFilter; // 0 to show pins for all units
705
707
709 LIB_SYMBOL* m_symbol; // Parent symbol that the pins belong to.
710
711 std::unique_ptr<NUMERIC_EVALUATOR> m_eval;
712 std::map< std::pair<std::vector<SCH_PIN*>, int>, wxString > m_evalOriginal;
713};
714
715
717 LIB_SYMBOL* aSymbol ) :
719 m_editFrame( parent ),
720 m_symbol( aSymbol )
721{
723
724 // Save original columns widths so we can do proportional sizing.
725 for( int i = 0; i < COL_COUNT; ++i )
726 m_originalColWidths[ i ] = m_grid->GetColSize( i );
727
728 // Give a bit more room for combobox editors
729 m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
730
732 m_grid->PushEventHandler( new GRID_TRICKS( m_grid, [this]( wxCommandEvent& aEvent )
733 {
734 OnAddRow( aEvent );
735 } ) );
736
737 // Show/hide columns according to the user's preference
738 if( SYMBOL_EDITOR_SETTINGS* cfg = parent->GetSettings() )
739 {
740 m_grid->ShowHideColumns( cfg->m_PinTableVisibleColumns );
742 }
743
744 // Set special attributes
745 wxGridCellAttr* attr;
746
747 attr = new wxGridCellAttr;
748 attr->SetReadOnly( true );
749 m_grid->SetColAttr( COL_PIN_COUNT, attr );
750
751 attr = new wxGridCellAttr;
752 wxArrayString typeNames = PinTypeNames();
753 typeNames.push_back( INDETERMINATE_STATE );
754 attr->SetRenderer( new GRID_CELL_ICON_TEXT_RENDERER( PinTypeIcons(), typeNames ) );
755 attr->SetEditor( new GRID_CELL_ICON_TEXT_POPUP( PinTypeIcons(), typeNames ) );
756 m_grid->SetColAttr( COL_TYPE, attr );
757
758 attr = new wxGridCellAttr;
759 wxArrayString shapeNames = PinShapeNames();
760 shapeNames.push_back( INDETERMINATE_STATE );
761 attr->SetRenderer( new GRID_CELL_ICON_TEXT_RENDERER( PinShapeIcons(), shapeNames ) );
762 attr->SetEditor( new GRID_CELL_ICON_TEXT_POPUP( PinShapeIcons(), shapeNames ) );
763 m_grid->SetColAttr( COL_SHAPE, attr );
764
765 attr = new wxGridCellAttr;
766 wxArrayString orientationNames = PinOrientationNames();
767 orientationNames.push_back( INDETERMINATE_STATE );
768 attr->SetRenderer( new GRID_CELL_ICON_TEXT_RENDERER( PinOrientationIcons(),
769 orientationNames ) );
770 attr->SetEditor( new GRID_CELL_ICON_TEXT_POPUP( PinOrientationIcons(), orientationNames ) );
771 m_grid->SetColAttr( COL_ORIENTATION, attr );
772
773 attr = new wxGridCellAttr;
774 wxArrayString unitNames;
775 unitNames.push_back( UNITS_ALL );
776
777 for( int i = 1; i <= aSymbol->GetUnitCount(); i++ )
778 unitNames.push_back( LIB_SYMBOL::LetterSubReference( i, 'A' ) );
779
780 attr->SetEditor( new GRID_CELL_COMBOBOX( unitNames ) );
781 m_grid->SetColAttr( COL_UNIT, attr );
782
783 attr = new wxGridCellAttr;
784 wxArrayString demorganNames;
785 demorganNames.push_back( DEMORGAN_ALL );
786 demorganNames.push_back( DEMORGAN_STD );
787 demorganNames.push_back( DEMORGAN_ALT );
788 attr->SetEditor( new GRID_CELL_COMBOBOX( demorganNames ) );
789 m_grid->SetColAttr( COL_DEMORGAN, attr );
790
791 attr = new wxGridCellAttr;
792 attr->SetRenderer( new wxGridCellBoolRenderer() );
793 attr->SetEditor( new wxGridCellBoolEditor() );
794 attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
795 m_grid->SetColAttr( COL_VISIBLE, attr );
796
797 /* Right-aligned position values look much better, but only MSW and GTK2+
798 * currently support right-aligned textEditCtrls, so the text jumps on all
799 * the other platforms when you edit it.
800 attr = new wxGridCellAttr;
801 attr->SetAlignment( wxALIGN_RIGHT, wxALIGN_TOP );
802 m_grid->SetColAttr( COL_POSX, attr );
803
804 attr = new wxGridCellAttr;
805 attr->SetAlignment( wxALIGN_RIGHT, wxALIGN_TOP );
806 m_grid->SetColAttr( COL_POSY, attr );
807 */
808
809 m_addButton->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
810 m_deleteButton->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
811 m_refreshButton->SetBitmap( KiBitmapBundle( BITMAPS::small_refresh ) );
812
815
816 GetSizer()->SetSizeHints(this);
817 Centre();
818
819 if( aSymbol->IsMulti() )
820 {
821 m_unitFilter->Append( UNITS_ALL );
822
823 for( int ii = 0; ii < aSymbol->GetUnitCount(); ++ii )
824 m_unitFilter->Append( aSymbol->GetUnitReference( ii + 1 ) );
825
826 m_unitFilter->SetSelection( -1 );
827 }
828 else
829 {
830 m_cbFilterByUnit->Show( false );
831 m_unitFilter->Show( false );
832 }
833
835
836 if( !parent->IsSymbolEditable() || parent->IsSymbolAlias() )
837 {
838 m_ButtonsCancel->SetDefault();
839 m_ButtonsOK->SetLabel( _( "Read Only" ) );
840 m_ButtonsOK->Enable( false );
841 }
842
843 m_initialized = true;
844 m_modified = false;
845
846 // Connect Events
847 m_grid->Connect( wxEVT_GRID_COL_SORT,
848 wxGridEventHandler( DIALOG_LIB_EDIT_PIN_TABLE::OnColSort ), nullptr, this );
849}
850
851
853{
855 cfg->m_PinTableVisibleColumns = m_grid->GetShownColumnsAsString();
856
857 // Disconnect Events
858 m_grid->Disconnect( wxEVT_GRID_COL_SORT,
859 wxGridEventHandler( DIALOG_LIB_EDIT_PIN_TABLE::OnColSort ), nullptr, this );
860
861 // Prevents crash bug in wxGrid's d'tor
863
864 // Delete the GRID_TRICKS.
865 m_grid->PopEventHandler( true );
866
867 // This is our copy of the pins. If they were transferred to the part on an OK, then
868 // m_pins will already be empty.
869 for( SCH_PIN* pin : m_pins )
870 delete pin;
871
872 WINDOW_THAWER thawer( m_editFrame );
873
874 m_editFrame->FocusOnItem( nullptr );
876}
877
878
880{
881 // Make a copy of the pins for editing
882 std::vector<SCH_PIN*> pins = m_symbol->GetAllLibPins();
883
884 for( SCH_PIN* pin : pins )
885 m_pins.push_back( new SCH_PIN( *pin ) );
886
887 m_dataModel->RebuildRows( m_pins, m_cbGroup->GetValue(), false );
888
889 if( m_symbol->IsMulti() )
890 m_grid->ShowCol( COL_UNIT );
891 else
892 m_grid->HideCol( COL_UNIT );
893
895 m_grid->ShowCol( COL_DEMORGAN );
896 else
897 m_grid->HideCol( COL_DEMORGAN );
898
900
901 return true;
902}
903
904
906{
908 return false;
909
910 // Delete the part's pins
911 std::vector<SCH_PIN*> pins = m_symbol->GetAllLibPins();
912
913 for( SCH_PIN* pin : pins )
915
916 // Transfer our pins to the part
917 for( SCH_PIN* pin : m_pins )
919
920 m_pins.clear();
921
922 return true;
923}
924
925
926void DIALOG_LIB_EDIT_PIN_TABLE::OnColSort( wxGridEvent& aEvent )
927{
928 int sortCol = aEvent.GetCol();
929 bool ascending;
930
931 // This is bonkers, but wxWidgets doesn't tell us ascending/descending in the
932 // event, and if we ask it will give us pre-event info.
933 if( m_grid->IsSortingBy( sortCol ) )
934 // same column; invert ascending
935 ascending = !m_grid->IsSortOrderAscending();
936 else
937 // different column; start with ascending
938 ascending = true;
939
940 m_dataModel->SortRows( sortCol, ascending );
941}
942
943
944void DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow( wxCommandEvent& event )
945{
947 return;
948
949 SCH_PIN* newPin = new SCH_PIN( this->m_symbol );
950
951 // Copy the settings of the last pin onto the new pin.
952 if( m_pins.size() > 0 )
953 {
954 SCH_PIN* last = m_pins.back();
955
956 newPin->SetOrientation( last->GetOrientation() );
957 newPin->SetType( last->GetType() );
958 newPin->SetShape( last->GetShape() );
959 newPin->SetUnit( last->GetUnit() );
960
961 VECTOR2I pos = last->GetPosition();
962
964
965 if( last->GetOrientation() == PIN_ORIENTATION::PIN_LEFT
966 || last->GetOrientation() == PIN_ORIENTATION::PIN_RIGHT )
967 {
968 pos.y -= schIUScale.MilsToIU( cfg->m_Repeat.pin_step );
969 }
970 else
971 {
972 pos.x += schIUScale.MilsToIU( cfg->m_Repeat.pin_step );
973 }
974
975 newPin->SetPosition( pos );
976 }
977
978 m_pins.push_back( newPin );
979
980 m_dataModel->AppendRow( m_pins[ m_pins.size() - 1 ] );
981
982 m_grid->MakeCellVisible( m_grid->GetNumberRows() - 1, 1 );
983 m_grid->SetGridCursor( m_grid->GetNumberRows() - 1, 1 );
984
985 m_grid->EnableCellEditControl( true );
986 m_grid->ShowCellEditControl();
987
989}
990
991
993{
994 m_pins.push_back( pin );
996}
997
998
999void DIALOG_LIB_EDIT_PIN_TABLE::OnDeleteRow( wxCommandEvent& event )
1000{
1001 // TODO: handle delete of multiple rows....
1003 return;
1004
1005 if( m_pins.size() == 0 ) // empty table
1006 return;
1007
1008 int curRow = m_grid->GetGridCursorRow();
1009
1010 if( curRow < 0 )
1011 return;
1012
1013 // move the selection first because wx internally will try to reselect the row we deleted in out of order events
1014 int nextSelRow = std::max( curRow-1, 0 );
1015 m_grid->GoToCell( nextSelRow, m_grid->GetGridCursorCol() );
1016 m_grid->SetGridCursor( nextSelRow, m_grid->GetGridCursorCol() );
1017 m_grid->SelectRow( nextSelRow );
1018
1019 std::vector<SCH_PIN*> removedRow = m_dataModel->RemoveRow( curRow );
1020
1021 for( SCH_PIN* pin : removedRow )
1022 m_pins.erase( std::find( m_pins.begin(), m_pins.end(), pin ) );
1023
1024 updateSummary();
1025}
1026
1027
1029{
1030 m_pins.erase( std::find( m_pins.begin(), m_pins.end(), pin ) );
1031 updateSummary();
1032}
1033
1034
1036{
1037 updateSummary();
1038}
1039
1040
1042{
1043 SCH_PIN* pin = nullptr;
1044
1045 if( event.GetRow() >= 0 && event.GetRow() < m_dataModel->GetNumberRows() )
1046 {
1047 const std::vector<SCH_PIN*>& pins = m_dataModel->GetRowPins( event.GetRow() );
1048
1049 if( pins.size() == 1 && m_editFrame->GetCurSymbol() )
1050 {
1051 for( SCH_PIN* candidate : m_editFrame->GetCurSymbol()->GetAllLibPins() )
1052 {
1053 if( candidate->GetNumber() == pins.at( 0 )->GetNumber() )
1054 {
1055 pin = candidate;
1056 break;
1057 }
1058 }
1059 }
1060 }
1061
1062 WINDOW_THAWER thawer( m_editFrame );
1063
1066}
1067
1068
1070{
1071 return m_cbGroup->GetValue();
1072}
1073
1074
1076{
1077 m_cbGroup->SetValue( false );
1078
1079 m_dataModel->RebuildRows( m_pins, false, true );
1080
1081 m_grid->ShowCol( COL_PIN_COUNT );
1082 m_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
1083
1085}
1086
1087
1089{
1091 return;
1092
1093 m_dataModel->RebuildRows( m_pins, m_cbGroup->GetValue(), false );
1094
1095 if( m_cbGroup->GetValue() )
1096 {
1097 m_grid->ShowCol( COL_PIN_COUNT );
1098 m_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
1099 }
1100
1102}
1103
1104
1106{
1107 if( event.IsChecked() )
1108 {
1109 m_dataModel->SetUnitFilter( m_unitFilter->GetSelection() );
1110 }
1111 else
1112 {
1114 m_unitFilter->SetSelection( -1 );
1115 }
1116
1117 OnRebuildRows( event );
1118}
1119
1120
1122{
1123 m_cbFilterByUnit->SetValue( true );
1124 m_dataModel->SetUnitFilter( m_unitFilter->GetSelection() );
1125
1126 OnRebuildRows( event );
1127}
1128
1129
1131{
1132 // Account for scroll bars
1134
1135 wxGridUpdateLocker deferRepaintsTillLeavingScope;
1136
1137 // The Number and Name columns must be at least wide enough to hold their contents, but
1138 // no less wide than their original widths.
1139
1140 m_grid->AutoSizeColumn( COL_NUMBER );
1141
1142 if( m_grid->GetColSize( COL_NUMBER ) < m_originalColWidths[ COL_NUMBER ] )
1144
1145 m_grid->AutoSizeColumn( COL_NAME );
1146
1147 if( m_grid->GetColSize( COL_NAME ) < m_originalColWidths[ COL_NAME ] )
1148 m_grid->SetColSize( COL_NAME, m_originalColWidths[ COL_NAME ] );
1149
1150 // If the grid is still wider than the columns, then stretch the Number and Name columns
1151 // to fit.
1152
1153 for( int i = 0; i < COL_COUNT; ++i )
1154 width -= m_grid->GetColSize( i );
1155
1156 if( width > 0 )
1157 {
1158 m_grid->SetColSize( COL_NUMBER, m_grid->GetColSize( COL_NUMBER ) + width / 2 );
1159 m_grid->SetColSize( COL_NAME, m_grid->GetColSize( COL_NAME ) + width / 2 );
1160 }
1161}
1162
1163
1164void DIALOG_LIB_EDIT_PIN_TABLE::OnSize( wxSizeEvent& event )
1165{
1166 wxSize new_size = event.GetSize();
1167
1168 if( m_initialized && m_size != new_size )
1169 {
1170 m_size = new_size;
1171
1173 }
1174
1175 // Always propagate for a grid repaint (needed if the height changes, as well as width)
1176 event.Skip();
1177}
1178
1179
1180void DIALOG_LIB_EDIT_PIN_TABLE::OnUpdateUI( wxUpdateUIEvent& event )
1181{
1182 std::bitset<64> columnsShown = m_grid->GetShownColumns();
1183
1184 if( columnsShown != m_columnsShown )
1185 {
1186 m_columnsShown = columnsShown;
1187
1188 if( !m_grid->IsCellEditControlShown() )
1190 }
1191
1192 int firstSelectedRow;
1193 int selectedRowCount;
1194
1195 getSelectedArea( m_grid, &firstSelectedRow, &selectedRowCount );
1196
1197 if( ( selectedRowCount > 1 ) != m_groupSelected->IsEnabled() )
1198 m_groupSelected->Enable( selectedRowCount > 1 );
1199}
1200
1201
1202void DIALOG_LIB_EDIT_PIN_TABLE::OnCancel( wxCommandEvent& event )
1203{
1204 Close();
1205}
1206
1207
1208void DIALOG_LIB_EDIT_PIN_TABLE::OnClose( wxCloseEvent& event )
1209{
1210 // This is a cancel, so commit quietly as we're going to throw the results away anyway.
1212
1213 int retval = wxID_CANCEL;
1214
1215 if( m_dataModel->IsEdited() )
1216 {
1217 if( HandleUnsavedChanges( this, _( "Save changes?" ),
1218 [&]() -> bool
1219 {
1221 {
1222 retval = wxID_OK;
1223 return true;
1224 }
1225
1226 return false;
1227 } ) )
1228 {
1229 if( IsQuasiModal() )
1230 EndQuasiModal( retval );
1231 else
1232 EndDialog( retval );
1233
1234 return;
1235 }
1236 else
1237 {
1238 event.Veto();
1239 return;
1240 }
1241 }
1242
1243 // No change in dialog: we can close it
1244 if( IsQuasiModal() )
1245 EndQuasiModal( retval );
1246 else
1247 EndDialog( retval );
1248
1249 return;
1250}
1251
1252
1254{
1255 PIN_NUMBERS pinNumbers;
1256
1257 for( SCH_PIN* pin : m_pins )
1258 {
1259 if( pin->GetNumber().Length() )
1260 pinNumbers.insert( pin->GetNumber() );
1261 }
1262
1263 m_pin_numbers_summary->SetLabel( pinNumbers.GetSummary() );
1264 m_pin_count->SetLabel( wxString::Format( wxT( "%u" ), (unsigned) m_pins.size() ) );
1265 m_duplicate_pins->SetLabel( pinNumbers.GetDuplicates() );
1266
1267 Layout();
1268}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:110
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
void SetIsSeparator()
Render button as a toolbar separator.
Class DIALOG_LIB_EDIT_PIN_TABLE_BASE.
bool m_modified
true when there are unsaved changes
void OnRebuildRows(wxCommandEvent &event) override
void OnCancel(wxCommandEvent &event) override
void OnUpdateUI(wxUpdateUIEvent &event) override
void OnColSort(wxGridEvent &aEvent)
void OnGroupSelected(wxCommandEvent &event) override
void OnClose(wxCloseEvent &event) override
void OnSize(wxSizeEvent &event) override
PIN_TABLE_DATA_MODEL * m_dataModel
void OnCellSelected(wxGridEvent &event) override
void OnAddRow(wxCommandEvent &event) override
void OnDeleteRow(wxCommandEvent &event) override
void OnCellEdited(wxGridEvent &event) override
DIALOG_LIB_EDIT_PIN_TABLE(SYMBOL_EDIT_FRAME *parent, LIB_SYMBOL *aSymbol)
std::vector< SCH_PIN * > m_pins
void OnFilterCheckBox(wxCommandEvent &event) override
void OnFilterChoice(wxCommandEvent &event) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
bool IsQuasiModal() const
Definition: dialog_shim.h:107
void EndQuasiModal(int retCode)
The base class for create windows for drawing purpose.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition: grid_tricks.h:61
Define a library symbol object.
Definition: lib_symbol.h:77
bool IsMulti() const override
Definition: lib_symbol.h:541
static wxString LetterSubReference(int aUnit, int aFirstId)
Definition: lib_symbol.cpp:721
std::vector< SCH_PIN * > GetAllLibPins() const
Return a list of pin pointers for all units / converts.
void RemoveDrawItem(SCH_ITEM *aItem)
Remove draw aItem from list.
Definition: lib_symbol.cpp:944
wxString GetUnitReference(int aUnit) override
Return an identifier for aUnit for symbols with units.
Definition: lib_symbol.cpp:523
int GetUnitCount() const override
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
Definition: lib_symbol.cpp:969
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
wxString GetDuplicates() const
Gets a formatted string of all the pins that have duplicate numbers.
static int Compare(const wxString &lhs, const wxString &rhs)
void insert(value_type const &v)
Definition: pin_numbers.h:63
wxString GetSummary() const
Definition: pin_numbers.cpp:70
static bool compare(const std::vector< SCH_PIN * > &lhs, const std::vector< SCH_PIN * > &rhs, int sortCol, bool ascending, EDA_DRAW_FRAME *parentFrame)
PIN_TABLE_DATA_MODEL(SYMBOL_EDIT_FRAME *aFrame, DIALOG_LIB_EDIT_PIN_TABLE *aPinTable, LIB_SYMBOL *aSymbol)
void RebuildRows(const std::vector< SCH_PIN * > &aPins, bool groupByName, bool groupBySelection)
static int findRow(const std::vector< std::vector< SCH_PIN * > > &aRowSet, const wxString &aName)
std::map< std::pair< std::vector< SCH_PIN * >, int >, wxString > m_evalOriginal
static wxString StringFromBool(bool aValue)
std::vector< std::vector< SCH_PIN * > > m_rows
bool IsEmptyCell(int row, int col) override
DIALOG_LIB_EDIT_PIN_TABLE * m_pinTable
std::vector< SCH_PIN * > GetRowPins(int aRow)
static wxString GetValue(const std::vector< SCH_PIN * > &pins, int aCol, EDA_DRAW_FRAME *aParentFrame)
std::unique_ptr< NUMERIC_EVALUATOR > m_eval
void SetValue(int aRow, int aCol, const wxString &aValue) override
wxString GetValue(int aRow, int aCol) override
void SortRows(int aSortCol, bool ascending)
void onUnitsChanged(wxCommandEvent &aEvent)
static bool BoolFromString(wxString aValue)
wxString GetColLabelValue(int aCol) override
std::vector< SCH_PIN * > RemoveRow(int aRow)
void SortPins(std::vector< SCH_PIN * > &aRow)
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
int GetUnit() const
Definition: sch_item.h:235
virtual void SetUnit(int aUnit)
Definition: sch_item.h:234
void SetNumber(const wxString &aNumber)
Definition: sch_pin.cpp:463
void SetOrientation(PIN_ORIENTATION aOrientation)
Definition: sch_pin.h:83
void SetName(const wxString &aName)
Definition: sch_pin.cpp:360
void SetPosition(const VECTOR2I &aPos) override
Definition: sch_pin.h:190
const wxString & GetName() const
Definition: sch_pin.cpp:349
PIN_ORIENTATION GetOrientation() const
Definition: sch_pin.cpp:241
void SetShape(GRAPHIC_PINSHAPE aShape)
Definition: sch_pin.h:86
VECTOR2I GetPosition() const override
Definition: sch_pin.cpp:233
void SetType(ELECTRICAL_PINTYPE aType)
Definition: sch_pin.h:99
GRAPHIC_PINSHAPE GetShape() const
Definition: sch_pin.cpp:254
ELECTRICAL_PINTYPE GetType() const
Definition: sch_pin.cpp:287
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
void SetBitmap(const wxBitmapBundle &aBmp)
The symbol library editor main window.
void FocusOnItem(SCH_ITEM *aItem)
bool IsSymbolAlias() const
Return true if aLibId is an alias for the editor screen symbol.
bool GetShowDeMorgan() const
SYMBOL_EDITOR_SETTINGS * GetSettings() const
bool IsSymbolEditable() const
Test if a symbol is loaded and can be edited.
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
EDA_UNITS GetUserUnits() const
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aValue in internal units into a united string.
int ValueFromString(const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aTextValue in aUnits to internal units used by the frame.
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:408
void SetTable(wxGridTableBase *table, bool aTakeOwnership=false)
Hide wxGrid's SetTable() method with one which doesn't mess up the grid column widths when setting th...
Definition: wx_grid.cpp:231
void DestroyTable(wxGridTableBase *aTable)
Work-around for a bug in wxGrid which crashes when deleting the table if the cell edit control was no...
Definition: wx_grid.cpp:364
wxString GetShownColumnsAsString()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:378
std::bitset< 64 > GetShownColumns()
Definition: wx_grid.cpp:397
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:558
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
Definition: confirm.cpp:240
This file is part of the common library.
#define UNITS_ALL
void getSelectedArea(WX_GRID *aGrid, int *aRowStart, int *aRowCount)
#define DEMORGAN_ALL
#define DEMORGAN_ALT
#define DEMORGAN_STD
#define _(s)
#define CANDIDATE
flag indicating that the structure is connected
static std::map< int, wxString > shapeNames
wxSize GetUnobscuredSize(const wxWindow *aWindow)
Tries to determine the size of the viewport of a scrollable widget (wxDataViewCtrl,...
Definition: gtk/ui.cpp:195
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
see class PGM_BASE
const std::vector< BITMAPS > & PinTypeIcons()
Definition: pin_type.cpp:162
const wxArrayString & PinTypeNames()
Definition: pin_type.cpp:153
int PinOrientationIndex(PIN_ORIENTATION code)
Definition: pin_type.cpp:70
const wxArrayString & PinShapeNames()
Definition: pin_type.cpp:171
const std::vector< BITMAPS > & PinShapeIcons()
Definition: pin_type.cpp:180
const wxArrayString & PinOrientationNames()
Definition: pin_type.cpp:189
PIN_ORIENTATION PinOrientationCode(size_t index)
Definition: pin_type.cpp:63
const std::vector< BITMAPS > & PinOrientationIcons()
Definition: pin_type.cpp:198
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
Definition: pin_type.h:36
GRAPHIC_PINSHAPE
Definition: pin_type.h:57
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
constexpr int MilsToIU(int mils) const
Definition: base_units.h:93
VECTOR3I res
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
Definition: ui_common.h:45
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588