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_fieldsGrid->OverrideMinSize( 1.0, 1.0 );
343 m_shownColumns = m_fieldsGrid->GetShownColumns();
344
345 if( m_symbol->GetEmbeddedFiles() )
346 {
347 m_embeddedFiles = new PANEL_EMBEDDED_FILES( m_notebook1, m_symbol->GetEmbeddedFiles() );
348 m_notebook1->AddPage( m_embeddedFiles, _( "Embedded Files" ) );
349 }
350
351 if( m_part && m_part->IsMultiBodyStyle() )
352 {
353 // Multiple body styles are a superclass of alternate pin assignments, so don't allow
354 // free-form alternate assignments as well. (We won't know how to map the alternates
355 // back and forth when the body style is changed.)
356 m_pinTablePage->Disable();
357 m_pinTablePage->SetToolTip( _( "Alternate pin assignments are not available for symbols with multiple "
358 "body styles." ) );
359 }
360 else
361 {
363
364 // Make a copy of the pins for editing
365 for( const std::unique_ptr<SCH_PIN>& pin : m_symbol->GetRawPins() )
366 m_dataModel->push_back( *pin );
367
368 m_dataModel->SortRows( COL_NUMBER, true );
369 m_dataModel->BuildAttrs();
370
371 m_pinGrid->SetTable( m_dataModel );
372 }
373
374 if( m_part && m_part->IsPower() )
375 m_spiceFieldsButton->Hide();
376
377 m_pinGrid->PushEventHandler( new GRID_TRICKS( m_pinGrid ) );
378 m_pinGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
379
380 wxFont infoFont = KIUI::GetSmallInfoFont( this );
381 m_libraryIDLabel->SetFont( infoFont );
382 m_tcLibraryID->SetFont( infoFont );
383 m_tcLibraryID->SetBackgroundColour( KIPLATFORM::UI::GetDialogBGColour() );
384
385 wxToolTip::Enable( true );
387
388 // Configure button logos
393
394 // wxFormBuilder doesn't include this event...
395 m_fieldsGrid->Bind( wxEVT_GRID_CELL_CHANGING, &DIALOG_SYMBOL_PROPERTIES::OnGridCellChanging, this );
396 m_pinGrid->Bind( wxEVT_GRID_COL_SORT, &DIALOG_SYMBOL_PROPERTIES::OnPinTableColSort, this );
397 Bind( SYMBOL_DELAY_FOCUS, &DIALOG_SYMBOL_PROPERTIES::HandleDelayedFocus, this );
398 Bind( SYMBOL_DELAY_SELECTION, &DIALOG_SYMBOL_PROPERTIES::HandleDelayedSelection, this );
399
400 wxCommandEvent* evt = new wxCommandEvent( SYMBOL_DELAY_SELECTION );
401 evt->SetClientData( new VECTOR2I( 0, FDC_VALUE ) );
402 QueueEvent( evt );
403
404 evt = new wxCommandEvent( SYMBOL_DELAY_FOCUS );
405 evt->SetClientData( new VECTOR2I( 0, FDC_VALUE ) );
406 QueueEvent( evt );
407
408 // Remind user that they are editing the current variant.
409 if( !aParent->Schematic().GetCurrentVariant().IsEmpty() )
410 SetTitle( GetTitle() + wxS( " - " ) + aParent->Schematic().GetCurrentVariant() + _( " Design Variant" ) );
411
412 Layout();
413 m_fieldsGrid->Layout();
414
415 if( GetSizer() )
416 GetSizer()->Fit( this );
417
419}
420
421
423{
424 // Prevents crash bug in wxGrid's d'tor
425 m_fieldsGrid->DestroyTable( m_fields );
426
427 if( m_dataModel )
428 m_pinGrid->DestroyTable( m_dataModel );
429
430 m_fieldsGrid->Unbind( wxEVT_GRID_CELL_CHANGING, &DIALOG_SYMBOL_PROPERTIES::OnGridCellChanging, this );
431 m_pinGrid->Unbind( wxEVT_GRID_COL_SORT, &DIALOG_SYMBOL_PROPERTIES::OnPinTableColSort, this );
432 Unbind( SYMBOL_DELAY_FOCUS, &DIALOG_SYMBOL_PROPERTIES::HandleDelayedFocus, this );
433 Unbind( SYMBOL_DELAY_SELECTION, &DIALOG_SYMBOL_PROPERTIES::HandleDelayedSelection, this );
434
435 // Delete the GRID_TRICKS.
436 m_fieldsGrid->PopEventHandler( true );
437 m_pinGrid->PopEventHandler( true );
438}
439
440
442{
443 return dynamic_cast<SCH_EDIT_FRAME*>( wxDialog::GetParent() );
444}
445
446
448{
449 if( !wxDialog::TransferDataToWindow() )
450 return false;
451
452 const SCHEMATIC& schematic = GetParent()->Schematic();
453 SCH_SHEET_PATH& sheetPath = schematic.CurrentSheet();
454 wxString variantName = schematic.GetCurrentVariant();
455 std::optional<SCH_SYMBOL_VARIANT> variant = m_symbol->GetVariant( sheetPath, variantName );
456 std::set<wxString> defined;
457
458 // Push a copy of each field into m_updateFields
459 for( SCH_FIELD& srcField : m_symbol->GetFields() )
460 {
461 SCH_FIELD field( srcField );
462
463 // change offset to be symbol-relative
464 field.Offset( -m_symbol->GetPosition() );
465 field.SetText( schematic.ConvertKIIDsToRefs( m_symbol->GetFieldText( field.GetName(), &sheetPath,
466 variantName ) ) );
467
468 defined.insert( field.GetName() );
469 m_fields->push_back( field );
470 }
471
472 // Add in any template fieldnames not yet defined:
473 for( const TEMPLATE_FIELDNAME& templateFieldname :
474 schematic.Settings().m_TemplateFieldNames.GetTemplateFieldNames() )
475 {
476 if( defined.count( templateFieldname.m_Name ) <= 0 )
477 {
478 SCH_FIELD field( m_symbol, FIELD_T::USER, templateFieldname.m_Name );
479 field.SetVisible( templateFieldname.m_Visible );
480 m_fields->push_back( field );
481 }
482 }
483
484 // notify the grid
485 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->GetNumberRows() );
486 m_fieldsGrid->ProcessTableMessage( msg );
487
488 // If a multi-unit symbol, set up the unit selector and interchangeable checkbox.
489 if( m_symbol->IsMultiUnit() )
490 {
491 // Ensure symbol unit is the currently selected unit (mandatory in complex hierarchies)
492 // from the current sheet path, because it can be modified by previous calculations
493 m_symbol->SetUnit( m_symbol->GetUnitSelection( &sheetPath ) );
494
495 for( int ii = 1; ii <= m_symbol->GetUnitCount(); ii++ )
496 m_unitChoice->Append( m_symbol->GetUnitDisplayName( ii, false ) );
497
498 if( m_symbol->GetUnit() <= ( int )m_unitChoice->GetCount() )
499 m_unitChoice->SetSelection( m_symbol->GetUnit() - 1 );
500 }
501 else
502 {
503 m_unitLabel->Enable( false );
504 m_unitChoice->Enable( false );
505 }
506
507 if( m_part && m_part->IsMultiBodyStyle() )
508 {
509 if( m_part->HasDeMorganBodyStyles() )
510 {
511 m_bodyStyleChoice->Append( _( "Standard" ) );
512 m_bodyStyleChoice->Append( _( "Alternate" ) );
513 }
514 else
515 {
516 wxASSERT( (int)m_part->GetBodyStyleNames().size() == m_part->GetBodyStyleCount() );
517
518 for( int ii = 0; ii < m_part->GetBodyStyleCount(); ii++ )
519 {
520 try
521 {
522 m_bodyStyleChoice->Append( m_part->GetBodyStyleNames().at( ii ) );
523 }
524 catch( ... )
525 {
526 m_bodyStyleChoice->Append( wxT( "???" ) );
527 }
528 }
529 }
530
531 if( m_symbol->GetBodyStyle() <= (int) m_bodyStyleChoice->GetCount() )
532 m_bodyStyleChoice->SetSelection( m_symbol->GetBodyStyle() - 1 );
533 }
534 else
535 {
536 m_bodyStyle->Enable( false );
537 m_bodyStyleChoice->Enable( false );
538 }
539
540 // Set the symbol orientation and mirroring.
541 int orientation = m_symbol->GetOrientation() & ~( SYM_MIRROR_X | SYM_MIRROR_Y );
542
543 switch( orientation )
544 {
545 default:
546 case SYM_ORIENT_0: m_orientationCtrl->SetSelection( 0 ); break;
547 case SYM_ORIENT_90: m_orientationCtrl->SetSelection( 1 ); break;
548 case SYM_ORIENT_270: m_orientationCtrl->SetSelection( 2 ); break;
549 case SYM_ORIENT_180: m_orientationCtrl->SetSelection( 3 ); break;
550 }
551
552 int mirror = m_symbol->GetOrientation() & ( SYM_MIRROR_X | SYM_MIRROR_Y );
553
554 switch( mirror )
555 {
556 default: m_mirrorCtrl->SetSelection( 0 ) ; break;
557 case SYM_MIRROR_X: m_mirrorCtrl->SetSelection( 1 ); break;
558 case SYM_MIRROR_Y: m_mirrorCtrl->SetSelection( 2 ); break;
559 }
560
561 m_cbExcludeFromSim->SetValue( m_symbol->GetExcludedFromSim( &sheetPath, variantName ) );
562 m_cbExcludeFromBom->SetValue( m_symbol->GetExcludedFromBOM( &sheetPath, variantName ) );
563 m_cbExcludeFromBoard->SetValue( m_symbol->GetExcludedFromBoard( &sheetPath, variantName ) );
564 m_cbExcludeFromPosFiles->SetValue( m_symbol->GetExcludedFromPosFiles( &sheetPath, variantName ) );
565 m_cbDNP->SetValue( m_symbol->GetDNP( &sheetPath, variantName ) );
566
567 if( m_part )
568 {
569 m_ShowPinNumButt->SetValue( m_part->GetShowPinNumbers() );
570 m_ShowPinNameButt->SetValue( m_part->GetShowPinNames() );
571 }
572
573 // Set the symbol's library name.
574 m_tcLibraryID->SetValue( UnescapeString( m_symbol->GetLibId().Format() ) );
575
576 if( m_embeddedFiles && !m_embeddedFiles->TransferDataToWindow() )
577 return false;
578
579 m_fieldsGrid->Layout();
580 Layout();
581
582 return true;
583}
584
585
587{
588 if( !m_fieldsGrid->CommitPendingChanges() )
589 return;
590
591 m_fieldsGrid->ClearSelection();
592
593 std::vector<SCH_FIELD> fields;
594
595 for( const SCH_FIELD& field : *m_fields )
596 fields.emplace_back( field );
597
598 DIALOG_SIM_MODEL dialog( this, m_parentFrame, *m_symbol, fields );
599
600 if( dialog.ShowModal() != wxID_OK )
601 return;
602
603 // Add in any new fields
604 for( const SCH_FIELD& editedField : fields )
605 {
606 bool found = false;
607
608 for( SCH_FIELD& existingField : *m_fields )
609 {
610 if( existingField.GetName() == editedField.GetName() )
611 {
612 found = true;
613 existingField.SetText( editedField.GetText() );
614 break;
615 }
616 }
617
618 if( !found )
619 {
620 m_fields->emplace_back( editedField );
621 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
622 m_fieldsGrid->ProcessTableMessage( msg );
623 }
624 }
625
626 // Remove any deleted fields
627 for( int ii = (int) m_fields->size() - 1; ii >= 0; --ii )
628 {
629 SCH_FIELD& existingField = m_fields->at( ii );
630 bool found = false;
631
632 for( SCH_FIELD& editedField : fields )
633 {
634 if( editedField.GetName() == existingField.GetName() )
635 {
636 found = true;
637 break;
638 }
639 }
640
641 if( !found )
642 {
643 m_fieldsGrid->ClearSelection();
644 m_fields->erase( m_fields->begin() + ii );
645
646 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, ii, 1 );
647 m_fieldsGrid->ProcessTableMessage( msg );
648 }
649 }
650
651 OnModify();
652 m_fieldsGrid->ForceRefresh();
653}
654
655
657{
658 // Running the Footprint Browser gums up the works and causes the automatic cancel
659 // stuff to no longer work. So we do it here ourselves.
660 EndQuasiModal( wxID_CANCEL );
661}
662
663
665{
666 LIB_ID id;
667
668 if( !m_fieldsGrid->CommitPendingChanges() || !m_fieldsGrid->Validate() )
669 return false;
670
671 // Check for missing field names.
672 for( size_t i = 0; i < m_fields->size(); ++i )
673 {
674 SCH_FIELD& field = m_fields->at( i );
675
676 if( field.IsMandatory() )
677 continue;
678
679 wxString fieldName = field.GetName( false );
680
681 if( fieldName.IsEmpty() )
682 {
683 DisplayErrorMessage( this, _( "Fields must have a name." ) );
684
685 wxCommandEvent *evt = new wxCommandEvent( SYMBOL_DELAY_FOCUS );
686 evt->SetClientData( new VECTOR2I( i, FDC_VALUE ) );
687 QueueEvent( evt );
688
689 return false;
690 }
691 }
692
693 return true;
694}
695
696
698{
699 if( !wxDialog::TransferDataFromWindow() ) // Calls our Validate() method.
700 return false;
701
702 if( m_embeddedFiles && !m_embeddedFiles->TransferDataFromWindow() )
703 return false;
704
705 if( !m_fieldsGrid->CommitPendingChanges() )
706 return false;
707
708 if( !m_pinGrid->CommitPendingChanges() )
709 return false;
710
711 SCH_COMMIT commit( GetParent() );
712 SCH_SCREEN* currentScreen = GetParent()->GetScreen();
713 SCH_SHEET_PATH currentSheet = GetParent()->Schematic().CurrentSheet();
714 wxString currentVariant = GetParent()->Schematic().GetCurrentVariant();
715 bool replaceOnCurrentScreen;
716
717 wxCHECK( currentScreen, false );
718
719 // This needs to be done before the LIB_ID is changed to prevent stale library symbols in
720 // the schematic file.
721 replaceOnCurrentScreen = currentScreen->Remove( m_symbol );
722
723 // save old cmp in undo list if not already in edit, or moving ...
724 if( m_symbol->GetEditFlags() == 0 )
725 commit.Modify( m_symbol, currentScreen );
726
727 // Save current flags which could be modified by next change settings
728 EDA_ITEM_FLAGS flags = m_symbol->GetFlags();
729
730 //Set the part selection in multiple part per package
731 int unit_selection = m_unitChoice->IsEnabled() ? m_unitChoice->GetSelection() + 1 : 1;
732 m_symbol->SetUnitSelection( &GetParent()->GetCurrentSheet(), unit_selection );
733 m_symbol->SetUnit( unit_selection );
734
735 int bodyStyle_selection = m_bodyStyleChoice->IsEnabled() ? m_bodyStyleChoice->GetSelection() + 1 : 1;
736 m_symbol->SetBodyStyle( bodyStyle_selection );
737
738 switch( m_orientationCtrl->GetSelection() )
739 {
740 case 0: m_symbol->SetOrientation( SYM_ORIENT_0 ); break;
741 case 1: m_symbol->SetOrientation( SYM_ORIENT_90 ); break;
742 case 2: m_symbol->SetOrientation( SYM_ORIENT_270 ); break;
743 case 3: m_symbol->SetOrientation( SYM_ORIENT_180 ); break;
744 }
745
746 switch( m_mirrorCtrl->GetSelection() )
747 {
748 case 0: break;
749 case 1: m_symbol->SetOrientation( SYM_MIRROR_X ); break;
750 case 2: m_symbol->SetOrientation( SYM_MIRROR_Y ); break;
751 }
752
753 m_symbol->SetShowPinNames( m_ShowPinNameButt->GetValue() );
754 m_symbol->SetShowPinNumbers( m_ShowPinNumButt->GetValue() );
755
756 // Restore m_Flag modified by SetUnit() and other change settings from the dialog
757 m_symbol->ClearFlags();
758 m_symbol->SetFlags( flags );
759
760 // change all field positions from relative to absolute
761 for( SCH_FIELD& field : *m_fields )
762 field.Offset( m_symbol->GetPosition() );
763
764 int ordinal = 42; // Arbitrarily larger than any mandatory FIELD_T ids.
765
766 for( SCH_FIELD& field : *m_fields )
767 {
768 const wxString& fieldName = field.GetCanonicalName();
769
770 if( fieldName.IsEmpty() && field.GetText().IsEmpty() )
771 continue;
772 else if( fieldName.IsEmpty() )
773 field.SetName( _( "untitled" ) );
774
775 const SCH_FIELD* existingField = m_symbol->GetField( fieldName );
776 SCH_FIELD* tmp;
777
778 if( !existingField )
779 {
780 tmp = m_symbol->AddField( field );
781 tmp->SetParent( m_symbol );
782 }
783 else
784 {
785 wxString defaultText = m_symbol->Schematic()->ConvertRefsToKIIDs( existingField->GetText() );
786 tmp = const_cast<SCH_FIELD*>( existingField );
787
788 *tmp = field;
789
790 if( !currentVariant.IsEmpty() )
791 {
792 // Restore the default field text for existing fields.
793 tmp->SetText( defaultText, &currentSheet );
794
795 wxString variantText = m_symbol->Schematic()->ConvertRefsToKIIDs( field.GetText() );
796 tmp->SetText( variantText, &currentSheet, currentVariant );
797 }
798 }
799
800 if( !field.IsMandatory() )
801 field.SetOrdinal( ordinal++ );
802 }
803
804 for( int ii = (int) m_symbol->GetFields().size() - 1; ii >= 0; ii-- )
805 {
806 SCH_FIELD& symbolField = m_symbol->GetFields()[ii];
807
808 if( symbolField.IsMandatory() )
809 continue;
810
811 bool found = false;
812
813 for( const SCH_FIELD& editedField : *m_fields )
814 {
815 if( editedField.GetName() == symbolField.GetName() )
816 {
817 found = true;
818 break;
819 }
820 }
821
822 if( !found )
823 m_symbol->GetFields().erase( m_symbol->GetFields().begin() + ii );
824 }
825
826 if( currentVariant.IsEmpty() )
827 {
828 // Reference has a specific initialization, depending on the current active sheet
829 // because for a given symbol, in a complex hierarchy, there are more than one
830 // reference.
831 m_symbol->SetRef( &GetParent()->GetCurrentSheet(), m_fields->GetField( FIELD_T::REFERENCE )->GetText() );
832 }
833
834 m_symbol->SetExcludedFromSim( m_cbExcludeFromSim->IsChecked(), &currentSheet, currentVariant );
835 m_symbol->SetExcludedFromBOM( m_cbExcludeFromBom->IsChecked(), &currentSheet, currentVariant );
836 m_symbol->SetExcludedFromBoard( m_cbExcludeFromBoard->IsChecked(), &currentSheet, currentVariant );
837 m_symbol->SetExcludedFromPosFiles( m_cbExcludeFromPosFiles->IsChecked(), &currentSheet, currentVariant );
838 m_symbol->SetDNP( m_cbDNP->IsChecked(), &currentSheet, currentVariant );
839
840 // Update any assignments
841 if( m_dataModel )
842 {
843 for( const SCH_PIN& model_pin : *m_dataModel )
844 {
845 // map from the edited copy back to the "real" pin(s) in the symbol.
846 for( SCH_PIN* src_pin : m_symbol->GetPinsByNumber( model_pin.GetNumber() ) )
847 src_pin->SetAlt( model_pin.GetAlt() );
848 }
849 }
850
851 // Keep fields other than the reference, include/exclude flags, and alternate pin assignements
852 // in sync in multi-unit parts.
853 m_symbol->SyncOtherUnits( currentSheet, commit, nullptr, currentVariant );
854
855 if( replaceOnCurrentScreen )
856 currentScreen->Append( m_symbol );
857
858 if( !commit.Empty() )
859 commit.Push( _( "Edit Symbol Properties" ) );
860
861 return true;
862}
863
864
866{
867 wxGridCellEditor* editor = m_fieldsGrid->GetCellEditor( event.GetRow(), event.GetCol() );
868 wxControl* control = editor->GetControl();
869
870 if( control && control->GetValidator() && !control->GetValidator()->Validate( control ) )
871 {
872 event.Veto();
873 wxCommandEvent *evt = new wxCommandEvent( SYMBOL_DELAY_FOCUS );
874 evt->SetClientData( new VECTOR2I( event.GetRow(), event.GetCol() ) );
875 QueueEvent( evt );
876 }
877 else if( event.GetCol() == FDC_NAME )
878 {
879 wxString newName = event.GetString();
880
881 for( int i = 0; i < m_fieldsGrid->GetNumberRows(); ++i )
882 {
883 if( i == event.GetRow() )
884 continue;
885
886 if( newName.CmpNoCase( m_fieldsGrid->GetCellValue( i, FDC_NAME ) ) == 0 )
887 {
888 DisplayError( this, wxString::Format( _( "Field name '%s' already in use." ),
889 newName ) );
890 event.Veto();
891 wxCommandEvent *evt = new wxCommandEvent( SYMBOL_DELAY_FOCUS );
892 evt->SetClientData( new VECTOR2I( event.GetRow(), event.GetCol() ) );
893 QueueEvent( evt );
894 }
895 }
896 }
897
898 editor->DecRef();
899}
900
901
903{
904 if( m_fields->at( aEvent.GetRow() ).GetId() == FIELD_T::REFERENCE
905 && aEvent.GetCol() == FDC_VALUE )
906 {
907 wxCommandEvent* evt = new wxCommandEvent( SYMBOL_DELAY_SELECTION );
908 evt->SetClientData( new VECTOR2I( aEvent.GetRow(), aEvent.GetCol() ) );
909 QueueEvent( evt );
910 }
911
912 m_editorShown = true;
913}
914
915
917{
918 m_editorShown = false;
919}
920
921
922void DIALOG_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event )
923{
924 m_fieldsGrid->OnAddRow(
925 [&]() -> std::pair<int, int>
926 {
928
929 newField.SetTextAngle( m_fields->GetField( FIELD_T::REFERENCE )->GetTextAngle() );
930 newField.SetVisible( false );
931
932 m_fields->push_back( newField );
933
934 // notify the grid
935 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
936 m_fieldsGrid->ProcessTableMessage( msg );
937 OnModify();
938
939 return { m_fields->size() - 1, FDC_NAME };
940 } );
941}
942
943
944void DIALOG_SYMBOL_PROPERTIES::OnDeleteField( wxCommandEvent& event )
945{
946 m_fieldsGrid->OnDeleteRows(
947 [&]( int row )
948 {
949 if( row < m_fields->GetMandatoryRowCount() )
950 {
951 DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
952 m_fields->GetMandatoryRowCount() ) );
953 return false;
954 }
955
956 return true;
957 },
958 [&]( int row )
959 {
960 m_fields->erase( m_fields->begin() + row );
961
962 // notify the grid
963 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
964 m_fieldsGrid->ProcessTableMessage( msg );
965 } );
966
967 OnModify();
968}
969
970
971void DIALOG_SYMBOL_PROPERTIES::OnMoveUp( wxCommandEvent& event )
972{
973 m_fieldsGrid->OnMoveRowUp(
974 [&]( int row )
975 {
976 return row > m_fields->GetMandatoryRowCount();
977 },
978 [&]( int row )
979 {
980 std::swap( *( m_fields->begin() + row ), *( m_fields->begin() + row - 1 ) );
981 m_fieldsGrid->ForceRefresh();
982 OnModify();
983 } );
984}
985
986
987void DIALOG_SYMBOL_PROPERTIES::OnMoveDown( wxCommandEvent& event )
988{
989 m_fieldsGrid->OnMoveRowDown(
990 [&]( int row )
991 {
992 return row >= m_fields->GetMandatoryRowCount();
993 },
994 [&]( int row )
995 {
996 std::swap( *( m_fields->begin() + row ), *( m_fields->begin() + row + 1 ) );
997 m_fieldsGrid->ForceRefresh();
998 OnModify();
999 } );
1000}
1001
1002
1008
1009
1015
1016
1022
1023
1029
1030
1032{
1033 int row = aEvent.GetRow();
1034
1035 if( m_pinGrid->GetCellValue( row, COL_ALT_NAME ) == m_dataModel->GetValue( row, COL_BASE_NAME ) )
1036 m_dataModel->SetValue( row, COL_ALT_NAME, wxEmptyString );
1037
1038 // These are just to get the cells refreshed
1039 m_dataModel->SetValue( row, COL_TYPE, m_dataModel->GetValue( row, COL_TYPE ) );
1040 m_dataModel->SetValue( row, COL_SHAPE, m_dataModel->GetValue( row, COL_SHAPE ) );
1041
1042 OnModify();
1043}
1044
1045
1047{
1048 int sortCol = aEvent.GetCol();
1049 bool ascending;
1050
1051 // This is bonkers, but wxWidgets doesn't tell us ascending/descending in the
1052 // event, and if we ask it will give us pre-event info.
1053 if( m_pinGrid->IsSortingBy( sortCol ) )
1054 // same column; invert ascending
1055 ascending = !m_pinGrid->IsSortOrderAscending();
1056 else
1057 // different column; start with ascending
1058 ascending = true;
1059
1060 m_dataModel->SortRows( sortCol, ascending );
1061 m_dataModel->BuildAttrs();
1062}
1063
1064
1066{
1067 wxGridUpdateLocker deferRepaintsTillLeavingScope( m_pinGrid );
1068
1069 // Account for scroll bars
1070 int pinTblWidth = KIPLATFORM::UI::GetUnobscuredSize( m_pinGrid ).x;
1071
1072 // Stretch the Base Name and Alternate Assignment columns to fit.
1073 for( int i = 0; i < COL_COUNT; ++i )
1074 {
1075 if( i != COL_BASE_NAME && i != COL_ALT_NAME )
1076 pinTblWidth -= m_pinGrid->GetColSize( i );
1077 }
1078
1079 if( pinTblWidth > 2 )
1080 {
1081 m_pinGrid->SetColSize( COL_BASE_NAME, pinTblWidth / 2 );
1082 m_pinGrid->SetColSize( COL_ALT_NAME, pinTblWidth / 2 );
1083 }
1084}
1085
1086
1087void DIALOG_SYMBOL_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
1088{
1089 std::bitset<64> shownColumns = m_fieldsGrid->GetShownColumns();
1090
1091 if( shownColumns != m_shownColumns )
1092 {
1093 m_shownColumns = shownColumns;
1094
1095 if( !m_fieldsGrid->IsCellEditControlShown() )
1096 m_fieldsGrid->SetGridWidthsDirty();
1097 }
1098}
1099
1100
1102{
1103 VECTOR2I *loc = static_cast<VECTOR2I*>( event.GetClientData() );
1104
1105 wxCHECK_RET( loc, wxT( "Missing focus cell location" ) );
1106
1107 // Run the AutoColumnSizer before setting focus (as it will clear any shown cell edit control
1108 // if it has to resize that column).
1109 m_fieldsGrid->RecomputeGridWidths();
1110
1111 // Handle a delayed focus
1112
1113 m_fieldsGrid->SetFocus();
1114 m_fieldsGrid->MakeCellVisible( loc->x, loc->y );
1115 m_fieldsGrid->SetGridCursor( loc->x, loc->y );
1116
1117 delete loc;
1118
1119 CallAfter(
1120 [this]()
1121 {
1122 m_fieldsGrid->EnableCellEditControl( true );
1123 } );
1124}
1125
1126
1128{
1129 VECTOR2I *loc = static_cast<VECTOR2I*>( event.GetClientData() );
1130
1131 wxCHECK_RET( loc, wxT( "Missing focus cell location" ) );
1132
1133 // Handle a delayed selection
1134 wxGridCellEditor* cellEditor = m_fieldsGrid->GetCellEditor( loc->x, loc->y );
1135
1136 if( wxTextEntry* txt = dynamic_cast<wxTextEntry*>( cellEditor->GetControl() ) )
1138
1139 cellEditor->DecRef(); // we're done; must release
1140 delete loc;
1141}
1142
1143
1145{
1146 wxSize new_size = event.GetSize();
1147
1148 if( ( !m_editorShown || m_lastRequestedPinsSize != new_size ) && m_pinsSize != new_size )
1149 {
1150 m_pinsSize = new_size;
1151
1153 }
1154
1155 // We store this value to check whether the dialog is changing size. This might indicate
1156 // that the user is scaling the dialog with a grid-cell-editor shown. Some editors do not
1157 // close (at least on GTK) when the user drags a dialog corner
1158 m_lastRequestedPinsSize = new_size;
1159
1160 // Always propagate for a grid repaint (needed if the height changes, as well as width)
1161 event.Skip();
1162}
1163
1164
1165void DIALOG_SYMBOL_PROPERTIES::OnCheckBox( wxCommandEvent& event )
1166{
1167 OnModify();
1168}
1169
1170
1171void DIALOG_SYMBOL_PROPERTIES::OnUnitChoice( wxCommandEvent& event )
1172{
1173 if( m_dataModel )
1174 {
1175 EDA_ITEM_FLAGS flags = m_symbol->GetFlags();
1176
1177 int unit_selection = m_unitChoice->GetSelection() + 1;
1178
1179 // We need to select a new unit to build the new unit pin list
1180 // but we should not change the symbol, so the initial unit will be selected
1181 // after rebuilding the pin list
1182 int old_unit = m_symbol->GetUnit();
1183 m_symbol->SetUnit( unit_selection );
1184
1185 // Rebuild a copy of the pins of the new unit for editing
1186 m_dataModel->clear();
1187
1188 for( const std::unique_ptr<SCH_PIN>& pin : m_symbol->GetRawPins() )
1189 m_dataModel->push_back( *pin );
1190
1191 m_dataModel->SortRows( COL_NUMBER, true );
1192 m_dataModel->BuildAttrs();
1193
1194 m_symbol->SetUnit( old_unit );
1195
1196 // Restore m_Flag modified by SetUnit()
1197 m_symbol->ClearFlags();
1198 m_symbol->SetFlags( flags );
1199 }
1200
1201 OnModify();
1202}
1203
1204
1206{
1207 event.Enable( m_symbol && m_symbol->GetLibSymbolRef() );
1208}
1209
1210
1212{
1213 event.Enable( m_symbol && m_symbol->GetLibSymbolRef() );
1214}
1215
1216
1217void DIALOG_SYMBOL_PROPERTIES::OnPageChanging( wxBookCtrlEvent& aEvent )
1218{
1219 if( !m_fieldsGrid->CommitPendingChanges() )
1220 aEvent.Veto();
1221
1222 if( !m_pinGrid->CommitPendingChanges() )
1223 aEvent.Veto();
1224}
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:594
virtual void SetVisible(bool aVisible)
Definition eda_text.cpp:385
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition eda_text.cpp:298
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
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:136
bool IsMandatory() const
virtual const wxString & GetText() const override
Return the string associated with the text object.
Definition sch_field.h:126
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:163
ALT GetAlt(const wxString &aAlt)
Definition sch_pin.h:177
SCH_PIN * GetLibPin() const
Definition sch_pin.h:92
const wxString & GetName() const
Definition sch_pin.cpp:485
const wxString & GetBaseName() const
Get the name without any alternates.
Definition sch_pin.cpp:494
const wxString & GetNumber() const
Definition sch_pin.h:127
GRAPHIC_PINSHAPE GetShape() const
Definition sch_pin.cpp:358
ELECTRICAL_PINTYPE GetType() const
Definition sch_pin.cpp:393
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
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:221
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:196
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