KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_symbol_properties.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, 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
26#include <memory>
27
28#include <bitmaps.h>
29#include <wx/tooltip.h>
30#include <wx/uiaction.h>
31#include <grid_tricks.h>
32#include <confirm.h>
33#include <kiface_base.h>
34#include <pin_numbers.h>
35#include <string_utils.h>
36#include <kiplatform/ui.h>
41#include <sch_collectors.h>
42#include <fields_grid_table.h>
43#include <sch_edit_frame.h>
44#include <sch_reference_list.h>
45#include <schematic.h>
46#include <sch_commit.h>
47#include <tool/tool_manager.h>
48#include <tool/actions.h>
49
50#include <dialog_sim_model.h>
52
53
54wxDEFINE_EVENT( SYMBOL_DELAY_FOCUS, wxCommandEvent );
55wxDEFINE_EVENT( SYMBOL_DELAY_SELECTION, wxCommandEvent );
56
57
68
69
70class SCH_PIN_TABLE_DATA_MODEL : public WX_GRID_TABLE_BASE, public std::vector<SCH_PIN>
71{
72public:
74 m_readOnlyAttr( nullptr ),
75 m_typeAttr( nullptr ),
76 m_shapeAttr( nullptr )
77 {
78 }
79
81 {
82 for( wxGridCellAttr* attr : m_nameAttrs )
83 attr->DecRef();
84
85 m_readOnlyAttr->DecRef();
86 m_typeAttr->DecRef();
87 m_shapeAttr->DecRef();
88 }
89
91 {
92 for( wxGridCellAttr* attr : m_nameAttrs )
93 attr->DecRef();
94
95 m_nameAttrs.clear();
96
97 if( m_readOnlyAttr )
98 m_readOnlyAttr->DecRef();
99
100 m_readOnlyAttr = new wxGridCellAttr;
101 m_readOnlyAttr->SetReadOnly( true );
102
103 for( const SCH_PIN& pin : *this )
104 {
105 SCH_PIN* lib_pin = pin.GetLibPin();
106 wxGridCellAttr* attr = nullptr;
107
108 if( !lib_pin || lib_pin->GetAlternates().empty() )
109 {
110 attr = new wxGridCellAttr;
111 attr->SetReadOnly( true );
112 attr->SetBackgroundColour( KIPLATFORM::UI::GetDialogBGColour() );
113 }
114 else
115 {
116 wxArrayString choices;
117 choices.push_back( lib_pin->GetName() );
118
119 for( const std::pair<const wxString, SCH_PIN::ALT>& alt : lib_pin->GetAlternates() )
120 choices.push_back( alt.first );
121
122 attr = new wxGridCellAttr();
123 attr->SetEditor( new GRID_CELL_COMBOBOX( choices ) );
124 }
125
126 m_nameAttrs.push_back( attr );
127 }
128
129 if( m_typeAttr )
130 m_typeAttr->DecRef();
131
132 m_typeAttr = new wxGridCellAttr;
134 m_typeAttr->SetReadOnly( true );
135
136 if( m_shapeAttr )
137 m_shapeAttr->DecRef();
138
139 m_shapeAttr = new wxGridCellAttr;
141 m_shapeAttr->SetReadOnly( true );
142 }
143
144 int GetNumberRows() override { return (int) size(); }
145 int GetNumberCols() override { return COL_COUNT; }
146
147 wxString GetColLabelValue( int aCol ) override
148 {
149 switch( aCol )
150 {
151 case COL_NUMBER: return _( "Number" );
152 case COL_BASE_NAME: return _( "Base Name" );
153 case COL_ALT_NAME: return _( "Alternate Assignment" );
154 case COL_TYPE: return _( "Electrical Type" );
155 case COL_SHAPE: return _( "Graphic Style" );
156 default: wxFAIL; return wxEmptyString;
157 }
158 }
159
160 bool IsEmptyCell( int row, int col ) override
161 {
162 return false; // don't allow adjacent cell overflow, even if we are actually empty
163 }
164
165 bool CanSetValueAs( int aRow, int aCol, const wxString& aTypeName ) override
166 {
167 // Don't accept random values; must use the popup to change to a known alternate
168 return false;
169 }
170
171 wxString GetValue( int aRow, int aCol ) override
172 {
173 return GetValue( at( aRow ), aCol );
174 }
175
176 static wxString GetValue( const SCH_PIN& aPin, int aCol )
177 {
178 if( aCol == COL_ALT_NAME )
179 {
180 if( !aPin.GetLibPin() || aPin.GetLibPin()->GetAlternates().empty() )
181 return wxEmptyString;
182 else if( aPin.GetAlt().IsEmpty() )
183 return aPin.GetName();
184 else
185 return aPin.GetAlt();
186 }
187
188 switch( aCol )
189 {
190 case COL_NUMBER: return aPin.GetNumber();
191 case COL_BASE_NAME: return aPin.GetBaseName();
192 case COL_TYPE: return PinTypeNames()[static_cast<int>( aPin.GetType() )];
193 case COL_SHAPE: return PinShapeNames()[static_cast<int>( aPin.GetShape() )];
194 default: wxFAIL; return wxEmptyString;
195 }
196 }
197
198 wxGridCellAttr* GetAttr( int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind ) override
199 {
200 switch( aCol )
201 {
202 case COL_NUMBER:
203 case COL_BASE_NAME:
204 m_readOnlyAttr->IncRef();
205 return enhanceAttr( m_readOnlyAttr, aRow, aCol, aKind );
206
207 case COL_ALT_NAME:
208 m_nameAttrs[ aRow ]->IncRef();
209 return enhanceAttr( m_nameAttrs[ aRow ], aRow, aCol, aKind );
210
211 case COL_TYPE:
212 m_typeAttr->IncRef();
213 return enhanceAttr( m_typeAttr, aRow, aCol, aKind );
214
215 case COL_SHAPE:
216 m_shapeAttr->IncRef();
217 return enhanceAttr( m_shapeAttr, aRow, aCol, aKind );
218
219 default:
220 wxFAIL;
221 return nullptr;
222 }
223 }
224
225 void SetValue( int aRow, int aCol, const wxString &aValue ) override
226 {
227 SCH_PIN& pin = at( aRow );
228
229 switch( aCol )
230 {
231 case COL_ALT_NAME:
232 if( pin.GetLibPin() && aValue == pin.GetLibPin()->GetName() )
233 pin.SetAlt( wxEmptyString );
234 else
235 pin.SetAlt( aValue );
236 break;
237
238 case COL_NUMBER:
239 case COL_BASE_NAME:
240 case COL_TYPE:
241 case COL_SHAPE:
242 // Read-only.
243 break;
244
245 default:
246 wxFAIL;
247 break;
248 }
249 }
250
251 static bool compare( const SCH_PIN& lhs, const SCH_PIN& rhs, int sortCol, bool ascending )
252 {
253 wxString lhStr = GetValue( lhs, sortCol );
254 wxString rhStr = GetValue( rhs, sortCol );
255
256 if( lhStr == rhStr )
257 {
258 // Secondary sort key is always COL_NUMBER
259 sortCol = COL_NUMBER;
260 lhStr = GetValue( lhs, sortCol );
261 rhStr = GetValue( rhs, sortCol );
262 }
263
264 bool res;
265
266 // N.B. To meet the iterator sort conditions, we cannot simply invert the truth
267 // to get the opposite sort. i.e. ~(a<b) != (a>b)
268 auto cmp = [ ascending ]( const auto a, const auto b )
269 {
270 if( ascending )
271 return a < b;
272 else
273 return b < a;
274 };
275
276 switch( sortCol )
277 {
278 case COL_NUMBER:
279 case COL_BASE_NAME:
280 case COL_ALT_NAME:
281 res = cmp( PIN_NUMBERS::Compare( lhStr, rhStr ), 0 );
282 break;
283 case COL_TYPE:
284 case COL_SHAPE:
285 res = cmp( lhStr.CmpNoCase( rhStr ), 0 );
286 break;
287 default:
288 res = cmp( StrNumCmp( lhStr, rhStr ), 0 );
289 break;
290 }
291
292 return res;
293 }
294
295 void SortRows( int aSortCol, bool ascending )
296 {
297 std::sort( begin(), end(),
298 [ aSortCol, ascending ]( const SCH_PIN& lhs, const SCH_PIN& rhs ) -> bool
299 {
300 return compare( lhs, rhs, aSortCol, ascending );
301 } );
302 }
303
304protected:
305 std::vector<wxGridCellAttr*> m_nameAttrs;
306 wxGridCellAttr* m_readOnlyAttr;
307 wxGridCellAttr* m_typeAttr;
308 wxGridCellAttr* m_shapeAttr;
309};
310
311
314 m_symbol( nullptr ),
315 m_part( nullptr ),
317 m_editorShown( false ),
318 m_fields( nullptr ),
319 m_dataModel( nullptr ),
320 m_embeddedFiles( nullptr )
321{
322 m_symbol = aSymbol;
323 m_part = m_symbol->GetLibSymbolRef().get();
324
325 // GetLibSymbolRef() now points to the cached part in the schematic, which should always be
326 // there for usual cases, but can be null when opening old schematics not storing the part
327 // so we need to handle m_part == nullptr
328 // wxASSERT( m_part );
329
330 m_fields = new FIELDS_GRID_TABLE( this, aParent, m_fieldsGrid, m_symbol );
331
332 m_fieldsGrid->SetTable( m_fields );
333 m_fieldsGrid->PushEventHandler( new FIELDS_GRID_TRICKS( m_fieldsGrid, this,
334 { &aParent->Schematic(), m_part },
335 [&]( wxCommandEvent& aEvent )
336 {
337 OnAddField( aEvent );
338 } ) );
339 m_fieldsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
340 m_fieldsGrid->ShowHideColumns( "0 1 2 3 4 5 6 7" );
341 m_fieldsGrid->SetMinSize( wxSize( -1, 160 ) );
342 m_shownColumns = m_fieldsGrid->GetShownColumns();
343
344 if( m_symbol->GetEmbeddedFiles() )
345 {
346 m_embeddedFiles = new PANEL_EMBEDDED_FILES( m_notebook1, m_symbol->GetEmbeddedFiles() );
347 m_notebook1->AddPage( m_embeddedFiles, _( "Embedded Files" ) );
348 }
349
350 if( m_part && m_part->IsMultiBodyStyle() )
351 {
352 // Multiple body styles are a superclass of alternate pin assignments, so don't allow
353 // free-form alternate assignments as well. (We won't know how to map the alternates
354 // back and forth when the body style is changed.)
355 m_pinTablePage->Disable();
356 m_pinTablePage->SetToolTip( _( "Alternate pin assignments are not available for symbols with multiple "
357 "body styles." ) );
358 }
359 else
360 {
362
363 // Make a copy of the pins for editing
364 for( const std::unique_ptr<SCH_PIN>& pin : m_symbol->GetRawPins() )
365 m_dataModel->push_back( *pin );
366
367 m_dataModel->SortRows( COL_NUMBER, true );
368 m_dataModel->BuildAttrs();
369
370 m_pinGrid->SetTable( m_dataModel );
371 }
372
373 if( m_part && m_part->IsPower() )
374 m_spiceFieldsButton->Hide();
375
376 m_pinGrid->PushEventHandler( new GRID_TRICKS( m_pinGrid ) );
377 m_pinGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
378
379 wxFont infoFont = KIUI::GetSmallInfoFont( this );
380 m_libraryIDLabel->SetFont( infoFont );
381 m_tcLibraryID->SetFont( infoFont );
382 m_tcLibraryID->SetBackgroundColour( KIPLATFORM::UI::GetDialogBGColour() );
383
384 wxToolTip::Enable( true );
386
387 // Configure button logos
392
393 // wxFormBuilder doesn't include this event...
394 m_fieldsGrid->Bind( wxEVT_GRID_CELL_CHANGING, &DIALOG_SYMBOL_PROPERTIES::OnGridCellChanging, this );
395 m_pinGrid->Bind( wxEVT_GRID_COL_SORT, &DIALOG_SYMBOL_PROPERTIES::OnPinTableColSort, this );
396 Bind( SYMBOL_DELAY_FOCUS, &DIALOG_SYMBOL_PROPERTIES::HandleDelayedFocus, this );
397 Bind( SYMBOL_DELAY_SELECTION, &DIALOG_SYMBOL_PROPERTIES::HandleDelayedSelection, this );
398
399 wxCommandEvent* evt = new wxCommandEvent( SYMBOL_DELAY_SELECTION );
400 evt->SetClientData( new VECTOR2I( 0, FDC_VALUE ) );
401 QueueEvent( evt );
402
403 evt = new wxCommandEvent( SYMBOL_DELAY_FOCUS );
404 evt->SetClientData( new VECTOR2I( 0, FDC_VALUE ) );
405 QueueEvent( evt );
406
407 // Remind user that they are editing the current variant.
408 if( !aParent->Schematic().GetCurrentVariant().IsEmpty() )
409 SetTitle( GetTitle() + wxS( " - " ) + aParent->Schematic().GetCurrentVariant() + _( " Design Variant" ) );
410
411 Layout();
412 m_fieldsGrid->Layout();
413
414 if( GetSizer() )
415 GetSizer()->Fit( this );
416
418}
419
420
422{
423 // Prevents crash bug in wxGrid's d'tor
424 m_fieldsGrid->DestroyTable( m_fields );
425
426 if( m_dataModel )
427 m_pinGrid->DestroyTable( m_dataModel );
428
429 m_fieldsGrid->Unbind( wxEVT_GRID_CELL_CHANGING, &DIALOG_SYMBOL_PROPERTIES::OnGridCellChanging, this );
430 m_pinGrid->Unbind( wxEVT_GRID_COL_SORT, &DIALOG_SYMBOL_PROPERTIES::OnPinTableColSort, this );
431 Unbind( SYMBOL_DELAY_FOCUS, &DIALOG_SYMBOL_PROPERTIES::HandleDelayedFocus, this );
432 Unbind( SYMBOL_DELAY_SELECTION, &DIALOG_SYMBOL_PROPERTIES::HandleDelayedSelection, this );
433
434 // Delete the GRID_TRICKS.
435 m_fieldsGrid->PopEventHandler( true );
436 m_pinGrid->PopEventHandler( true );
437}
438
439
441{
442 return dynamic_cast<SCH_EDIT_FRAME*>( wxDialog::GetParent() );
443}
444
445
447{
448 if( !wxDialog::TransferDataToWindow() )
449 return false;
450
451 const SCHEMATIC& schematic = GetParent()->Schematic();
452 SCH_SHEET_PATH& sheetPath = schematic.CurrentSheet();
453 wxString variantName = schematic.GetCurrentVariant();
454 std::optional<SCH_SYMBOL_VARIANT> variant = m_symbol->GetVariant( sheetPath, variantName );
455 std::set<wxString> defined;
456
457 // Push a copy of each field into m_updateFields
458 for( SCH_FIELD& srcField : m_symbol->GetFields() )
459 {
460 SCH_FIELD field( srcField );
461
462 // change offset to be symbol-relative
463 field.Offset( -m_symbol->GetPosition() );
464 field.SetText( schematic.ConvertKIIDsToRefs( m_symbol->GetFieldText( field.GetName(), &sheetPath,
465 variantName ) ) );
466
467 defined.insert( field.GetName() );
468 m_fields->push_back( field );
469 }
470
471 // Add in any template fieldnames not yet defined:
472 for( const TEMPLATE_FIELDNAME& templateFieldname :
474 {
475 if( defined.count( templateFieldname.m_Name ) <= 0 )
476 {
477 SCH_FIELD field( m_symbol, FIELD_T::USER, templateFieldname.m_Name );
478 field.SetVisible( templateFieldname.m_Visible );
479 m_fields->push_back( field );
480 }
481 }
482
483 // notify the grid
484 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->GetNumberRows() );
485 m_fieldsGrid->ProcessTableMessage( msg );
486
487 // If a multi-unit symbol, set up the unit selector and interchangeable checkbox.
488 if( m_symbol->IsMultiUnit() )
489 {
490 // Ensure symbol unit is the currently selected unit (mandatory in complex hierarchies)
491 // from the current sheet path, because it can be modified by previous calculations
492 m_symbol->SetUnit( m_symbol->GetUnitSelection( &sheetPath ) );
493
494 for( int ii = 1; ii <= m_symbol->GetUnitCount(); ii++ )
495 m_unitChoice->Append( m_symbol->GetUnitDisplayName( ii, false ) );
496
497 if( m_symbol->GetUnit() <= ( int )m_unitChoice->GetCount() )
498 m_unitChoice->SetSelection( m_symbol->GetUnit() - 1 );
499 }
500 else
501 {
502 m_unitLabel->Enable( false );
503 m_unitChoice->Enable( false );
504 }
505
506 if( m_part && m_part->IsMultiBodyStyle() )
507 {
508 if( m_part->HasDeMorganBodyStyles() )
509 {
510 m_bodyStyleChoice->Append( _( "Standard" ) );
511 m_bodyStyleChoice->Append( _( "Alternate" ) );
512 }
513 else
514 {
515 wxASSERT( (int)m_part->GetBodyStyleNames().size() == m_part->GetBodyStyleCount() );
516
517 for( int ii = 0; ii < m_part->GetBodyStyleCount(); ii++ )
518 {
519 try
520 {
521 m_bodyStyleChoice->Append( m_part->GetBodyStyleNames().at( ii ) );
522 }
523 catch( ... )
524 {
525 m_bodyStyleChoice->Append( wxT( "???" ) );
526 }
527 }
528 }
529
530 if( m_symbol->GetBodyStyle() <= (int) m_bodyStyleChoice->GetCount() )
531 m_bodyStyleChoice->SetSelection( m_symbol->GetBodyStyle() - 1 );
532 }
533 else
534 {
535 m_bodyStyle->Enable( false );
536 m_bodyStyleChoice->Enable( false );
537 }
538
539 // Set the symbol orientation and mirroring.
540 int orientation = m_symbol->GetOrientation() & ~( SYM_MIRROR_X | SYM_MIRROR_Y );
541
542 switch( orientation )
543 {
544 default:
545 case SYM_ORIENT_0: m_orientationCtrl->SetSelection( 0 ); break;
546 case SYM_ORIENT_90: m_orientationCtrl->SetSelection( 1 ); break;
547 case SYM_ORIENT_270: m_orientationCtrl->SetSelection( 2 ); break;
548 case SYM_ORIENT_180: m_orientationCtrl->SetSelection( 3 ); break;
549 }
550
551 int mirror = m_symbol->GetOrientation() & ( SYM_MIRROR_X | SYM_MIRROR_Y );
552
553 switch( mirror )
554 {
555 default: m_mirrorCtrl->SetSelection( 0 ) ; break;
556 case SYM_MIRROR_X: m_mirrorCtrl->SetSelection( 1 ); break;
557 case SYM_MIRROR_Y: m_mirrorCtrl->SetSelection( 2 ); break;
558 }
559
560 m_cbExcludeFromSim->SetValue( m_symbol->GetExcludedFromSim( &sheetPath, variantName ) );
561 m_cbExcludeFromBom->SetValue( m_symbol->GetExcludedFromBOM( &sheetPath, variantName ) );
562 m_cbExcludeFromBoard->SetValue( m_symbol->GetExcludedFromBoard( &sheetPath, variantName ) );
563 m_cbExcludeFromPosFiles->SetValue( m_symbol->GetExcludedFromPosFiles( &sheetPath, variantName ) );
564 m_cbDNP->SetValue( m_symbol->GetDNP( &sheetPath, variantName ) );
565
566 if( m_part )
567 {
568 m_ShowPinNumButt->SetValue( m_part->GetShowPinNumbers() );
569 m_ShowPinNameButt->SetValue( m_part->GetShowPinNames() );
570 }
571
572 // Set the symbol's library name.
573 m_tcLibraryID->SetValue( UnescapeString( m_symbol->GetLibId().Format() ) );
574
575 if( m_embeddedFiles && !m_embeddedFiles->TransferDataToWindow() )
576 return false;
577
578 m_fieldsGrid->Layout();
579 Layout();
580
581 return true;
582}
583
584
586{
587 if( !m_fieldsGrid->CommitPendingChanges() )
588 return;
589
590 m_fieldsGrid->ClearSelection();
591
592 std::vector<SCH_FIELD> fields;
593
594 for( const SCH_FIELD& field : *m_fields )
595 fields.emplace_back( field );
596
597 DIALOG_SIM_MODEL dialog( this, m_parentFrame, *m_symbol, fields );
598
599 if( dialog.ShowModal() != wxID_OK )
600 return;
601
602 // Add in any new fields
603 for( const SCH_FIELD& editedField : fields )
604 {
605 bool found = false;
606
607 for( SCH_FIELD& existingField : *m_fields )
608 {
609 if( existingField.GetName() == editedField.GetName() )
610 {
611 found = true;
612 existingField.SetText( editedField.GetText() );
613 break;
614 }
615 }
616
617 if( !found )
618 {
619 m_fields->emplace_back( editedField );
620 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
621 m_fieldsGrid->ProcessTableMessage( msg );
622 }
623 }
624
625 // Remove any deleted fields
626 for( int ii = (int) m_fields->size() - 1; ii >= 0; --ii )
627 {
628 SCH_FIELD& existingField = m_fields->at( ii );
629 bool found = false;
630
631 for( SCH_FIELD& editedField : fields )
632 {
633 if( editedField.GetName() == existingField.GetName() )
634 {
635 found = true;
636 break;
637 }
638 }
639
640 if( !found )
641 {
642 m_fieldsGrid->ClearSelection();
643 m_fields->erase( m_fields->begin() + ii );
644
645 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, ii, 1 );
646 m_fieldsGrid->ProcessTableMessage( msg );
647 }
648 }
649
650 OnModify();
651 m_fieldsGrid->ForceRefresh();
652}
653
654
656{
657 // Running the Footprint Browser gums up the works and causes the automatic cancel
658 // stuff to no longer work. So we do it here ourselves.
659 EndQuasiModal( wxID_CANCEL );
660}
661
662
664{
665 LIB_ID id;
666
667 if( !m_fieldsGrid->CommitPendingChanges() || !m_fieldsGrid->Validate() )
668 return false;
669
670 // Check for missing field names.
671 for( size_t i = 0; i < m_fields->size(); ++i )
672 {
673 SCH_FIELD& field = m_fields->at( i );
674
675 if( field.IsMandatory() )
676 continue;
677
678 wxString fieldName = field.GetName( false );
679
680 if( fieldName.IsEmpty() )
681 {
682 DisplayErrorMessage( this, _( "Fields must have a name." ) );
683
684 wxCommandEvent *evt = new wxCommandEvent( SYMBOL_DELAY_FOCUS );
685 evt->SetClientData( new VECTOR2I( i, FDC_VALUE ) );
686 QueueEvent( evt );
687
688 return false;
689 }
690 }
691
692 return true;
693}
694
695
697{
698 if( !wxDialog::TransferDataFromWindow() ) // Calls our Validate() method.
699 return false;
700
701 if( m_embeddedFiles && !m_embeddedFiles->TransferDataFromWindow() )
702 return false;
703
704 if( !m_fieldsGrid->CommitPendingChanges() )
705 return false;
706
707 if( !m_pinGrid->CommitPendingChanges() )
708 return false;
709
710 SCH_COMMIT commit( GetParent() );
711 SCH_SCREEN* currentScreen = GetParent()->GetScreen();
712 SCH_SHEET_PATH currentSheet = GetParent()->Schematic().CurrentSheet();
713 wxString currentVariant = GetParent()->Schematic().GetCurrentVariant();
714 bool replaceOnCurrentScreen;
715
716 wxCHECK( currentScreen, false );
717
718 // This needs to be done before the LIB_ID is changed to prevent stale library symbols in
719 // the schematic file.
720 replaceOnCurrentScreen = currentScreen->Remove( m_symbol );
721
722 // save old cmp in undo list if not already in edit, or moving ...
723 if( m_symbol->GetEditFlags() == 0 )
724 commit.Modify( m_symbol, currentScreen );
725
726 // Save current flags which could be modified by next change settings
727 EDA_ITEM_FLAGS flags = m_symbol->GetFlags();
728
729 //Set the part selection in multiple part per package
730 int unit_selection = m_unitChoice->IsEnabled() ? m_unitChoice->GetSelection() + 1 : 1;
731 m_symbol->SetUnitSelection( &GetParent()->GetCurrentSheet(), unit_selection );
732 m_symbol->SetUnit( unit_selection );
733
734 int bodyStyle_selection = m_bodyStyleChoice->IsEnabled() ? m_bodyStyleChoice->GetSelection() + 1 : 1;
735 m_symbol->SetBodyStyle( bodyStyle_selection );
736
737 switch( m_orientationCtrl->GetSelection() )
738 {
739 case 0: m_symbol->SetOrientation( SYM_ORIENT_0 ); break;
740 case 1: m_symbol->SetOrientation( SYM_ORIENT_90 ); break;
741 case 2: m_symbol->SetOrientation( SYM_ORIENT_270 ); break;
742 case 3: m_symbol->SetOrientation( SYM_ORIENT_180 ); break;
743 }
744
745 switch( m_mirrorCtrl->GetSelection() )
746 {
747 case 0: break;
748 case 1: m_symbol->SetOrientation( SYM_MIRROR_X ); break;
749 case 2: m_symbol->SetOrientation( SYM_MIRROR_Y ); break;
750 }
751
752 m_symbol->SetShowPinNames( m_ShowPinNameButt->GetValue() );
753 m_symbol->SetShowPinNumbers( m_ShowPinNumButt->GetValue() );
754
755 // Restore m_Flag modified by SetUnit() and other change settings from the dialog
756 m_symbol->ClearFlags();
757 m_symbol->SetFlags( flags );
758
759 // change all field positions from relative to absolute
760 for( SCH_FIELD& field : *m_fields )
761 field.Offset( m_symbol->GetPosition() );
762
763 int ordinal = 42; // Arbitrarily larger than any mandatory FIELD_T ids.
764
765 for( SCH_FIELD& field : *m_fields )
766 {
767 const wxString& fieldName = field.GetCanonicalName();
768
769 if( fieldName.IsEmpty() && field.GetText().IsEmpty() )
770 continue;
771 else if( fieldName.IsEmpty() )
772 field.SetName( _( "untitled" ) );
773
774 const SCH_FIELD* existingField = m_symbol->GetField( fieldName );
775 SCH_FIELD* tmp;
776
777 if( !existingField )
778 {
779 tmp = m_symbol->AddField( field );
780 tmp->SetParent( m_symbol );
781 }
782 else
783 {
784 wxString defaultText = m_symbol->Schematic()->ConvertRefsToKIIDs( existingField->GetText() );
785 tmp = const_cast<SCH_FIELD*>( existingField );
786
787 *tmp = field;
788
789 if( !currentVariant.IsEmpty() )
790 {
791 // Restore the default field text for existing fields.
792 tmp->SetText( defaultText, &currentSheet );
793
794 wxString variantText = m_symbol->Schematic()->ConvertRefsToKIIDs( field.GetText() );
795 tmp->SetText( variantText, &currentSheet, currentVariant );
796 }
797 }
798
799 if( !field.IsMandatory() )
800 field.SetOrdinal( ordinal++ );
801 }
802
803 for( int ii = (int) m_symbol->GetFields().size() - 1; ii >= 0; ii-- )
804 {
805 SCH_FIELD& symbolField = m_symbol->GetFields()[ii];
806
807 if( symbolField.IsMandatory() )
808 continue;
809
810 bool found = false;
811
812 for( const SCH_FIELD& editedField : *m_fields )
813 {
814 if( editedField.GetName() == symbolField.GetName() )
815 {
816 found = true;
817 break;
818 }
819 }
820
821 if( !found )
822 m_symbol->GetFields().erase( m_symbol->GetFields().begin() + ii );
823 }
824
825 if( currentVariant.IsEmpty() )
826 {
827 // Reference has a specific initialization, depending on the current active sheet
828 // because for a given symbol, in a complex hierarchy, there are more than one
829 // reference.
830 m_symbol->SetRef( &GetParent()->GetCurrentSheet(), m_fields->GetField( FIELD_T::REFERENCE )->GetText() );
831 }
832
833 m_symbol->SetExcludedFromSim( m_cbExcludeFromSim->IsChecked(), &currentSheet, currentVariant );
834 m_symbol->SetExcludedFromBOM( m_cbExcludeFromBom->IsChecked(), &currentSheet, currentVariant );
835 m_symbol->SetExcludedFromBoard( m_cbExcludeFromBoard->IsChecked(), &currentSheet, currentVariant );
836 m_symbol->SetExcludedFromPosFiles( m_cbExcludeFromPosFiles->IsChecked(), &currentSheet, currentVariant );
837 m_symbol->SetDNP( m_cbDNP->IsChecked(), &currentSheet, currentVariant );
838
839 // Update any assignments
840 if( m_dataModel )
841 {
842 for( const SCH_PIN& model_pin : *m_dataModel )
843 {
844 // map from the edited copy back to the "real" pin(s) in the symbol.
845 for( SCH_PIN* src_pin : m_symbol->GetPinsByNumber( model_pin.GetNumber() ) )
846 src_pin->SetAlt( model_pin.GetAlt() );
847 }
848 }
849
850 // Keep fields other than the reference, include/exclude flags, and alternate pin assignements
851 // in sync in multi-unit parts.
852 m_symbol->SyncOtherUnits( currentSheet, commit, nullptr, currentVariant );
853
854 if( replaceOnCurrentScreen )
855 currentScreen->Append( m_symbol );
856
857 if( !commit.Empty() )
858 commit.Push( _( "Edit Symbol Properties" ) );
859
860 return true;
861}
862
863
865{
866 wxGridCellEditor* editor = m_fieldsGrid->GetCellEditor( event.GetRow(), event.GetCol() );
867 wxControl* control = editor->GetControl();
868
869 if( control && control->GetValidator() && !control->GetValidator()->Validate( control ) )
870 {
871 event.Veto();
872 wxCommandEvent *evt = new wxCommandEvent( SYMBOL_DELAY_FOCUS );
873 evt->SetClientData( new VECTOR2I( event.GetRow(), event.GetCol() ) );
874 QueueEvent( evt );
875 }
876 else if( event.GetCol() == FDC_NAME )
877 {
878 wxString newName = event.GetString();
879
880 for( int i = 0; i < m_fieldsGrid->GetNumberRows(); ++i )
881 {
882 if( i == event.GetRow() )
883 continue;
884
885 if( newName.CmpNoCase( m_fieldsGrid->GetCellValue( i, FDC_NAME ) ) == 0 )
886 {
887 DisplayError( this, wxString::Format( _( "Field name '%s' already in use." ),
888 newName ) );
889 event.Veto();
890 wxCommandEvent *evt = new wxCommandEvent( SYMBOL_DELAY_FOCUS );
891 evt->SetClientData( new VECTOR2I( event.GetRow(), event.GetCol() ) );
892 QueueEvent( evt );
893 }
894 }
895 }
896
897 editor->DecRef();
898}
899
900
902{
903 if( m_fields->at( aEvent.GetRow() ).GetId() == FIELD_T::REFERENCE
904 && aEvent.GetCol() == FDC_VALUE )
905 {
906 wxCommandEvent* evt = new wxCommandEvent( SYMBOL_DELAY_SELECTION );
907 evt->SetClientData( new VECTOR2I( aEvent.GetRow(), aEvent.GetCol() ) );
908 QueueEvent( evt );
909 }
910
911 m_editorShown = true;
912}
913
914
916{
917 m_editorShown = false;
918}
919
920
921void DIALOG_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event )
922{
923 m_fieldsGrid->OnAddRow(
924 [&]() -> std::pair<int, int>
925 {
927
928 newField.SetTextAngle( m_fields->GetField( FIELD_T::REFERENCE )->GetTextAngle() );
929 newField.SetVisible( false );
930
931 m_fields->push_back( newField );
932
933 // notify the grid
934 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
935 m_fieldsGrid->ProcessTableMessage( msg );
936 OnModify();
937
938 return { m_fields->size() - 1, FDC_NAME };
939 } );
940}
941
942
943void DIALOG_SYMBOL_PROPERTIES::OnDeleteField( wxCommandEvent& event )
944{
945 m_fieldsGrid->OnDeleteRows(
946 [&]( int row )
947 {
948 if( row < m_fields->GetMandatoryRowCount() )
949 {
950 DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
951 m_fields->GetMandatoryRowCount() ) );
952 return false;
953 }
954
955 return true;
956 },
957 [&]( int row )
958 {
959 m_fields->erase( m_fields->begin() + row );
960
961 // notify the grid
962 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
963 m_fieldsGrid->ProcessTableMessage( msg );
964 } );
965
966 OnModify();
967}
968
969
970void DIALOG_SYMBOL_PROPERTIES::OnMoveUp( wxCommandEvent& event )
971{
972 m_fieldsGrid->OnMoveRowUp(
973 [&]( int row )
974 {
975 return row > m_fields->GetMandatoryRowCount();
976 },
977 [&]( int row )
978 {
979 std::swap( *( m_fields->begin() + row ), *( m_fields->begin() + row - 1 ) );
980 m_fieldsGrid->ForceRefresh();
981 OnModify();
982 } );
983}
984
985
986void DIALOG_SYMBOL_PROPERTIES::OnMoveDown( wxCommandEvent& event )
987{
988 m_fieldsGrid->OnMoveRowDown(
989 [&]( int row )
990 {
991 return row >= m_fields->GetMandatoryRowCount();
992 },
993 [&]( int row )
994 {
995 std::swap( *( m_fields->begin() + row ), *( m_fields->begin() + row + 1 ) );
996 m_fieldsGrid->ForceRefresh();
997 OnModify();
998 } );
999}
1000
1001
1007
1008
1014
1015
1021
1022
1028
1029
1031{
1032 int row = aEvent.GetRow();
1033
1034 if( m_pinGrid->GetCellValue( row, COL_ALT_NAME ) == m_dataModel->GetValue( row, COL_BASE_NAME ) )
1035 m_dataModel->SetValue( row, COL_ALT_NAME, wxEmptyString );
1036
1037 // These are just to get the cells refreshed
1038 m_dataModel->SetValue( row, COL_TYPE, m_dataModel->GetValue( row, COL_TYPE ) );
1039 m_dataModel->SetValue( row, COL_SHAPE, m_dataModel->GetValue( row, COL_SHAPE ) );
1040
1041 OnModify();
1042}
1043
1044
1046{
1047 int sortCol = aEvent.GetCol();
1048 bool ascending;
1049
1050 // This is bonkers, but wxWidgets doesn't tell us ascending/descending in the
1051 // event, and if we ask it will give us pre-event info.
1052 if( m_pinGrid->IsSortingBy( sortCol ) )
1053 // same column; invert ascending
1054 ascending = !m_pinGrid->IsSortOrderAscending();
1055 else
1056 // different column; start with ascending
1057 ascending = true;
1058
1059 m_dataModel->SortRows( sortCol, ascending );
1060 m_dataModel->BuildAttrs();
1061}
1062
1063
1065{
1066 wxGridUpdateLocker deferRepaintsTillLeavingScope( m_pinGrid );
1067
1068 // Account for scroll bars
1069 int pinTblWidth = KIPLATFORM::UI::GetUnobscuredSize( m_pinGrid ).x;
1070
1071 // Stretch the Base Name and Alternate Assignment columns to fit.
1072 for( int i = 0; i < COL_COUNT; ++i )
1073 {
1074 if( i != COL_BASE_NAME && i != COL_ALT_NAME )
1075 pinTblWidth -= m_pinGrid->GetColSize( i );
1076 }
1077
1078 if( pinTblWidth > 2 )
1079 {
1080 m_pinGrid->SetColSize( COL_BASE_NAME, pinTblWidth / 2 );
1081 m_pinGrid->SetColSize( COL_ALT_NAME, pinTblWidth / 2 );
1082 }
1083}
1084
1085
1086void DIALOG_SYMBOL_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
1087{
1088 std::bitset<64> shownColumns = m_fieldsGrid->GetShownColumns();
1089
1090 if( shownColumns != m_shownColumns )
1091 {
1092 m_shownColumns = shownColumns;
1093
1094 if( !m_fieldsGrid->IsCellEditControlShown() )
1095 m_fieldsGrid->SetGridWidthsDirty();
1096 }
1097}
1098
1099
1101{
1102 VECTOR2I *loc = static_cast<VECTOR2I*>( event.GetClientData() );
1103
1104 wxCHECK_RET( loc, wxT( "Missing focus cell location" ) );
1105
1106 // Run the AutoColumnSizer before setting focus (as it will clear any shown cell edit control
1107 // if it has to resize that column).
1108 m_fieldsGrid->RecomputeGridWidths();
1109
1110 // Handle a delayed focus
1111
1112 m_fieldsGrid->SetFocus();
1113 m_fieldsGrid->MakeCellVisible( loc->x, loc->y );
1114 m_fieldsGrid->SetGridCursor( loc->x, loc->y );
1115
1116 delete loc;
1117
1118 CallAfter(
1119 [this]()
1120 {
1121 m_fieldsGrid->EnableCellEditControl( true );
1122 } );
1123}
1124
1125
1127{
1128 VECTOR2I *loc = static_cast<VECTOR2I*>( event.GetClientData() );
1129
1130 wxCHECK_RET( loc, wxT( "Missing focus cell location" ) );
1131
1132 // Handle a delayed selection
1133 wxGridCellEditor* cellEditor = m_fieldsGrid->GetCellEditor( loc->x, loc->y );
1134
1135 if( wxTextEntry* txt = dynamic_cast<wxTextEntry*>( cellEditor->GetControl() ) )
1137
1138 cellEditor->DecRef(); // we're done; must release
1139 delete loc;
1140}
1141
1142
1144{
1145 wxSize new_size = event.GetSize();
1146
1147 if( ( !m_editorShown || m_lastRequestedPinsSize != new_size ) && m_pinsSize != new_size )
1148 {
1149 m_pinsSize = new_size;
1150
1152 }
1153
1154 // We store this value to check whether the dialog is changing size. This might indicate
1155 // that the user is scaling the dialog with a grid-cell-editor shown. Some editors do not
1156 // close (at least on GTK) when the user drags a dialog corner
1157 m_lastRequestedPinsSize = new_size;
1158
1159 // Always propagate for a grid repaint (needed if the height changes, as well as width)
1160 event.Skip();
1161}
1162
1163
1164void DIALOG_SYMBOL_PROPERTIES::OnCheckBox( wxCommandEvent& event )
1165{
1166 OnModify();
1167}
1168
1169
1170void DIALOG_SYMBOL_PROPERTIES::OnUnitChoice( wxCommandEvent& event )
1171{
1172 if( m_dataModel )
1173 {
1174 EDA_ITEM_FLAGS flags = m_symbol->GetFlags();
1175
1176 int unit_selection = m_unitChoice->GetSelection() + 1;
1177
1178 // We need to select a new unit to build the new unit pin list
1179 // but we should not change the symbol, so the initial unit will be selected
1180 // after rebuilding the pin list
1181 int old_unit = m_symbol->GetUnit();
1182 m_symbol->SetUnit( unit_selection );
1183
1184 // Rebuild a copy of the pins of the new unit for editing
1185 m_dataModel->clear();
1186
1187 for( const std::unique_ptr<SCH_PIN>& pin : m_symbol->GetRawPins() )
1188 m_dataModel->push_back( *pin );
1189
1190 m_dataModel->SortRows( COL_NUMBER, true );
1191 m_dataModel->BuildAttrs();
1192
1193 m_symbol->SetUnit( old_unit );
1194
1195 // Restore m_Flag modified by SetUnit()
1196 m_symbol->ClearFlags();
1197 m_symbol->SetFlags( flags );
1198 }
1199
1200 OnModify();
1201}
1202
1203
1205{
1206 event.Enable( m_symbol && m_symbol->GetLibSymbolRef() );
1207}
1208
1209
1211{
1212 event.Enable( m_symbol && m_symbol->GetLibSymbolRef() );
1213}
1214
1215
1216void DIALOG_SYMBOL_PROPERTIES::OnPageChanging( wxBookCtrlEvent& aEvent )
1217{
1218 if( !m_fieldsGrid->CommitPendingChanges() )
1219 aEvent.Veto();
1220
1221 if( !m_pinGrid->CommitPendingChanges() )
1222 aEvent.Veto();
1223}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:110
bool Empty() const
Definition commit.h:137
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Definition commit.h:106
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void EndQuasiModal(int retCode)
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
EDA_BASE_FRAME * m_parentFrame
int ShowModal() override
DIALOG_SYMBOL_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Symbol Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU)
void OnSizePinsGrid(wxSizeEvent &event) override
void OnPinTableCellEdited(wxGridEvent &event) override
void OnGridEditorShown(wxGridEvent &event) override
void OnUpdateUI(wxUpdateUIEvent &event) override
void OnEditSymbol(wxCommandEvent &) override
void OnCancelButtonClick(wxCommandEvent &event) override
virtual void onUpdateEditLibrarySymbol(wxUpdateUIEvent &event) override
SCH_PIN_TABLE_DATA_MODEL * m_dataModel
void OnMoveDown(wxCommandEvent &event) override
void OnPinTableColSort(wxGridEvent &aEvent)
void OnMoveUp(wxCommandEvent &event) override
void OnDeleteField(wxCommandEvent &event) override
void OnAddField(wxCommandEvent &event) override
void OnGridEditorHidden(wxGridEvent &event) override
PANEL_EMBEDDED_FILES * m_embeddedFiles
void OnUnitChoice(wxCommandEvent &event) override
void OnEditSpiceModel(wxCommandEvent &event) override
void OnPageChanging(wxNotebookEvent &event) override
DIALOG_SYMBOL_PROPERTIES(SCH_EDIT_FRAME *aParent, SCH_SYMBOL *aSymbol)
void HandleDelayedFocus(wxCommandEvent &event)
void HandleDelayedSelection(wxCommandEvent &event)
void OnCheckBox(wxCommandEvent &event) override
void OnGridCellChanging(wxGridEvent &event)
void OnEditLibrarySymbol(wxCommandEvent &) override
void OnUpdateSymbol(wxCommandEvent &) override
void OnExchangeSymbol(wxCommandEvent &) override
virtual void onUpdateEditSymbol(wxUpdateUIEvent &event) override
virtual void SetParent(EDA_ITEM *aParent)
Definition eda_item.cpp:93
void Offset(const VECTOR2I &aOffset)
Definition eda_text.cpp:578
virtual void SetVisible(bool aVisible)
Definition eda_text.cpp:370
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition eda_text.cpp:283
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition grid_tricks.h:61
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:49
static int Compare(const wxString &lhs, const wxString &rhs)
Holds all the data relating to one schematic.
Definition schematic.h:89
SCHEMATIC_SETTINGS & Settings() const
wxString ConvertKIIDsToRefs(const wxString &aSource) const
wxString GetCurrentVariant() const
Return the current variant being edited.
SCH_SHEET_PATH & CurrentSheet() const
Definition schematic.h:188
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
Schematic editor (Eeschema) main window.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCHEMATIC & Schematic() const
void SetOrdinal(int aOrdinal)
Definition sch_field.h:133
bool IsMandatory() const
virtual const wxString & GetText() const override
Return the string associated with the text object.
Definition sch_field.h:123
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
void SetText(const wxString &aText) override
bool IsEmptyCell(int row, int col) override
wxString GetValue(int aRow, int aCol) override
std::vector< wxGridCellAttr * > m_nameAttrs
static bool compare(const SCH_PIN &lhs, const SCH_PIN &rhs, int sortCol, bool ascending)
void SortRows(int aSortCol, bool ascending)
bool CanSetValueAs(int aRow, int aCol, const wxString &aTypeName) override
static wxString GetValue(const SCH_PIN &aPin, int aCol)
wxString GetColLabelValue(int aCol) override
void SetValue(int aRow, int aCol, const wxString &aValue) override
wxGridCellAttr * GetAttr(int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind) override
const std::map< wxString, ALT > & GetAlternates() const
Definition sch_pin.h:160
ALT GetAlt(const wxString &aAlt)
Definition sch_pin.h:174
SCH_PIN * GetLibPin() const
Definition sch_pin.h:89
const wxString & GetName() const
Definition sch_pin.cpp:403
const wxString & GetBaseName() const
Get the name without any alternates.
Definition sch_pin.cpp:412
const wxString & GetNumber() const
Definition sch_pin.h:124
GRAPHIC_PINSHAPE GetShape() const
Definition sch_pin.cpp:276
ELECTRICAL_PINTYPE GetType() const
Definition sch_pin.cpp:311
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
bool Remove(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Remove aItem from the schematic associated with this screen.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Schematic symbol object.
Definition sch_symbol.h:76
const std::vector< TEMPLATE_FIELDNAME > & GetTemplateFieldNames()
Return a template field name list for read only access.
wxGridCellAttr * enhanceAttr(wxGridCellAttr *aInputAttr, int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind)
Definition wx_grid.cpp:47
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:202
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:177
This file is part of the common library.
wxDEFINE_EVENT(SYMBOL_DELAY_FOCUS, wxCommandEvent)
@ SYMBOL_PROPS_EDIT_SCHEMATIC_SYMBOL
@ SYMBOL_PROPS_WANT_EXCHANGE_SYMBOL
@ SYMBOL_PROPS_WANT_UPDATE_SYMBOL
@ SYMBOL_PROPS_EDIT_LIBRARY_SYMBOL
#define _(s)
std::uint32_t EDA_ITEM_FLAGS
@ FDC_NAME
@ FDC_VALUE
wxColour GetDialogBGColour()
Definition wxgtk/ui.cpp:62
wxSize GetUnobscuredSize(const wxWindow *aWindow)
Tries to determine the size of the viewport of a scrollable widget (wxDataViewCtrl,...
Definition wxgtk/ui.cpp:281
KICOMMON_API wxFont GetSmallInfoFont(wxWindow *aWindow)
KICOMMON_API void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
const std::vector< BITMAPS > & PinTypeIcons()
Definition pin_type.cpp:162
const wxArrayString & PinTypeNames()
Definition pin_type.cpp:153
const wxArrayString & PinShapeNames()
Definition pin_type.cpp:171
const std::vector< BITMAPS > & PinShapeIcons()
Definition pin_type.cpp:180
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
wxString UnescapeString(const wxString &aSource)
Hold a name of a symbol's field, field value, and default visibility.
@ SYM_ORIENT_270
Definition symbol.h:42
@ SYM_MIRROR_Y
Definition symbol.h:44
@ SYM_ORIENT_180
Definition symbol.h:41
@ SYM_MIRROR_X
Definition symbol.h:43
@ SYM_ORIENT_90
Definition symbol.h:40
@ SYM_ORIENT_0
Definition symbol.h:39
wxString GetUserFieldName(int aFieldNdx, bool aTranslateForHI)
#define DO_TRANSLATE
@ USER
The field ID hasn't been set yet; field is invalid.
@ REFERENCE
Field Reference of part, i.e. "IC21".
KIBIS_PIN * pin
VECTOR3I res
VECTOR2I end
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:687