KiCad PCB EDA Suite
Loading...
Searching...
No Matches
fields_grid_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) 2018-2024 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <embedded_files.h>
25#include <kiway.h>
26#include <kiway_player.h>
27#include <dialog_shim.h>
28#include <fields_grid_table.h>
29#include <sch_base_frame.h>
30#include <sch_field.h>
31#include <sch_label.h>
32#include <sch_validators.h>
33#include <validators.h>
34#include <sch_edit_frame.h>
35#include <symbol_library.h>
36#include <schematic.h>
37#include <template_fieldnames.h>
42#include "eda_doc.h"
44#include "font/fontconfig.h"
47#include <wx/settings.h>
48#include <string_utils.h>
50#include <pgm_base.h>
51#include <project_sch.h>
52
53
54enum
55{
58};
59
60
61#define DEFAULT_FONT_NAME _( "Default Font" )
62
63
64static wxString netList( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH& aSheetPath )
65{
66 wxCHECK( aSymbol && aSymbol->GetLibSymbolRef(), wxEmptyString );
67
68 /*
69 * Symbol netlist format:
70 * pinNumber pinName <tab> pinNumber pinName...
71 * fpFilter fpFilter...
72 */
73 wxString netlist;
74
75 // We need the list of pins of the lib symbol, not just the pins of the current
76 // sch symbol, that can be just an unit of a multi-unit symbol, to be able to
77 // select/filter right footprints
78 wxArrayString pins;
79
80 const std::unique_ptr< LIB_SYMBOL >& lib_symbol = aSymbol->GetLibSymbolRef();
81
82 if( lib_symbol )
83 {
84 for( SCH_PIN* pin : lib_symbol->GetPins( 0 /* all units */, 1 /* single bodyStyle */ ) )
85 pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
86 }
87
88 if( !pins.IsEmpty() )
89 netlist << EscapeString( wxJoin( pins, '\t' ), CTX_LINE );
90
91 netlist << wxS( "\r" );
92
93 wxArrayString fpFilters = aSymbol->GetLibSymbolRef()->GetFPFilters();
94
95 if( !fpFilters.IsEmpty() )
96 netlist << EscapeString( wxJoin( fpFilters, ' ' ), CTX_LINE );
97
98 netlist << wxS( "\r" );
99
100 return netlist;
101}
102
103
104static wxString netList( LIB_SYMBOL* aSymbol )
105{
106 /*
107 * Symbol netlist format:
108 * pinNumber pinName <tab> pinNumber pinName...
109 * fpFilter fpFilter...
110 */
111 wxString netlist;
112 wxArrayString pins;
113
114 for( SCH_PIN* pin : aSymbol->GetPins( 0 /* all units */, 1 /* single bodyStyle */ ) )
115 pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
116
117 if( !pins.IsEmpty() )
118 netlist << EscapeString( wxJoin( pins, '\t' ), CTX_LINE );
119
120 netlist << wxS( "\r" );
121
122 wxArrayString fpFilters = aSymbol->GetFPFilters();
123
124 if( !fpFilters.IsEmpty() )
125 netlist << EscapeString( wxJoin( fpFilters, ' ' ), CTX_LINE );
126
127 netlist << wxS( "\r" );
128
129 return netlist;
130}
131
132
134 LIB_SYMBOL* aSymbol ) :
135 m_frame( aFrame ),
136 m_dialog( aDialog ),
137 m_parentType( SCH_SYMBOL_T ),
138 m_mandatoryFieldCount( MANDATORY_FIELDS ),
139 m_part( aSymbol ),
140 m_symbolNetlist( netList( aSymbol ) ),
141 m_fieldNameValidator( FIELD_NAME ),
142 m_referenceValidator( REFERENCE_FIELD ),
143 m_valueValidator( VALUE_FIELD ),
144 m_urlValidator( FIELD_VALUE ),
145 m_nonUrlValidator( FIELD_VALUE ),
146 m_filepathValidator( SHEETFILENAME )
147{
148 initGrid( aGrid );
149}
150
151
153 SCH_SYMBOL* aSymbol ) :
154 m_frame( aFrame ),
155 m_dialog( aDialog ),
156 m_parentType( SCH_SYMBOL_T ),
157 m_mandatoryFieldCount( MANDATORY_FIELDS ),
158 m_part( aSymbol->GetLibSymbolRef().get() ),
159 m_symbolNetlist( netList( aSymbol, aFrame->GetCurrentSheet() ) ),
160 m_fieldNameValidator( FIELD_NAME ),
161 m_referenceValidator( REFERENCE_FIELD ),
162 m_valueValidator( VALUE_FIELD ),
163 m_urlValidator( FIELD_VALUE ),
164 m_nonUrlValidator( FIELD_VALUE ),
165 m_filepathValidator( SHEETFILENAME )
166{
167 initGrid( aGrid );
168}
169
170
172SCH_SHEET* aSheet ) :
173 m_frame( aFrame ),
174 m_dialog( aDialog ),
175 m_parentType( SCH_SHEET_T ),
176 m_mandatoryFieldCount( SHEET_MANDATORY_FIELDS ),
177 m_part( nullptr ),
178 m_fieldNameValidator( FIELD_NAME ),
179 m_referenceValidator( SHEETNAME_V ),
180 m_valueValidator( VALUE_FIELD ),
181 m_urlValidator( FIELD_VALUE ),
182 m_nonUrlValidator( FIELD_VALUE ),
183 m_filepathValidator( SHEETFILENAME_V )
184{
185 initGrid( aGrid );
186}
187
188
190 SCH_LABEL_BASE* aLabel ) :
191 m_frame( aFrame ),
192 m_dialog( aDialog ),
193 m_parentType( SCH_LABEL_LOCATE_ANY_T ),
194 m_mandatoryFieldCount( aLabel->GetMandatoryFieldCount() ),
195 m_part( nullptr ),
196 m_fieldNameValidator( FIELD_NAME ),
197 m_referenceValidator( 0 ),
198 m_valueValidator( 0 ),
199 m_urlValidator( FIELD_VALUE ),
200 m_nonUrlValidator( FIELD_VALUE ),
201 m_filepathValidator( 0 )
202{
203 initGrid( aGrid );
204}
205
206
208{
209 // Build the various grid cell attributes.
210 // NOTE: validators and cellAttrs are member variables to get the destruction order
211 // right. wxGrid is VERY cranky about this.
212
213 m_readOnlyAttr = new wxGridCellAttr;
214 m_readOnlyAttr->SetReadOnly( true );
215
216 m_fieldNameAttr = new wxGridCellAttr;
218 nameEditor->SetValidator( m_fieldNameValidator );
219 m_fieldNameAttr->SetEditor( nameEditor );
220
221 m_referenceAttr = new wxGridCellAttr;
222 GRID_CELL_TEXT_EDITOR* referenceEditor = new GRID_CELL_TEXT_EDITOR();
223 referenceEditor->SetValidator( m_referenceValidator );
224 m_referenceAttr->SetEditor( referenceEditor );
225
226 m_valueAttr = new wxGridCellAttr;
227
229 {
230 GRID_CELL_TEXT_EDITOR* valueEditor = new GRID_CELL_TEXT_EDITOR();
231 valueEditor->SetValidator( m_valueValidator );
232 m_valueAttr->SetEditor( valueEditor );
233 }
234 else
235 {
236 GRID_CELL_STC_EDITOR* valueEditor = new GRID_CELL_STC_EDITOR( true,
237 [this]( wxStyledTextEvent& aEvent, SCINTILLA_TRICKS* aScintillaTricks )
238 {
239 SCH_FIELD& valueField = static_cast<SCH_FIELD&>( this->at( VALUE_FIELD ) );
240 valueField.OnScintillaCharAdded( aScintillaTricks, aEvent );
241 } );
242 m_valueAttr->SetEditor( valueEditor );
243 }
244
245 m_footprintAttr = new wxGridCellAttr;
247 fpIdEditor->SetValidator( m_nonUrlValidator );
248 m_footprintAttr->SetEditor( fpIdEditor );
249
250 EMBEDDED_FILES* files = nullptr;
251
252 if( m_frame->GetFrameType() == FRAME_SCH )
253 files = m_frame->GetScreen()->Schematic();
255 files = m_part;
256
257 m_urlAttr = new wxGridCellAttr;
258 GRID_CELL_URL_EDITOR* urlEditor =
260 urlEditor->SetValidator( m_urlValidator );
261 m_urlAttr->SetEditor( urlEditor );
262
263 m_nonUrlAttr = new wxGridCellAttr;
264 GRID_CELL_TEXT_EDITOR* nonUrlEditor = new GRID_CELL_TEXT_EDITOR();
265 nonUrlEditor->SetValidator( m_nonUrlValidator );
266 m_nonUrlAttr->SetEditor( nonUrlEditor );
267
269 m_filepathAttr = new wxGridCellAttr;
270
271 // Create a wild card using wxFileDialog syntax.
272 wxString wildCard( _( "Schematic Files" ) );
273 std::vector<std::string> exts;
274 exts.push_back( FILEEXT::KiCadSchematicFileExtension );
275 wildCard += AddFileExtListToFilter( exts );
276
277 auto filepathEditor = new GRID_CELL_PATH_EDITOR( m_dialog, aGrid, &m_curdir, wildCard );
278 filepathEditor->SetValidator( m_filepathValidator );
279 m_filepathAttr->SetEditor( filepathEditor );
280
281 m_boolAttr = new wxGridCellAttr;
282 m_boolAttr->SetRenderer( new wxGridCellBoolRenderer() );
283 m_boolAttr->SetEditor( new wxGridCellBoolEditor() );
284 m_boolAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
285
286 wxArrayString vAlignNames;
287 vAlignNames.Add( _( "Top" ) );
288 vAlignNames.Add( _( "Center" ) );
289 vAlignNames.Add( _( "Bottom" ) );
290 m_vAlignAttr = new wxGridCellAttr;
291 m_vAlignAttr->SetEditor( new wxGridCellChoiceEditor( vAlignNames ) );
292 m_vAlignAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
293
294 wxArrayString hAlignNames;
295 hAlignNames.Add( _( "Left" ) );
296 hAlignNames.Add(_( "Center" ) );
297 hAlignNames.Add(_( "Right" ) );
298 m_hAlignAttr = new wxGridCellAttr;
299 m_hAlignAttr->SetEditor( new wxGridCellChoiceEditor( hAlignNames ) );
300 m_hAlignAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
301
302 wxArrayString orientationNames;
303 orientationNames.Add( _( "Horizontal" ) );
304 orientationNames.Add(_( "Vertical" ) );
305 m_orientationAttr = new wxGridCellAttr;
306 m_orientationAttr->SetEditor( new wxGridCellChoiceEditor( orientationNames ) );
307 m_orientationAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
308
309 SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
310 wxArrayString existingNetclasses;
311
312 wxArrayString fonts;
313 std::vector<std::string> fontNames;
314
315 if( editFrame )
316 {
317 // Load the combobox with existing existingNetclassNames
318 PROJECT_FILE& projectFile = editFrame->Prj().GetProjectFile();
319 const std::shared_ptr<NET_SETTINGS>& settings = projectFile.NetSettings();
320
321 existingNetclasses.push_back( settings->GetDefaultNetclass()->GetName() );
322
323 for( const auto& [name, netclass] : settings->GetNetclasses() )
324 existingNetclasses.push_back( name );
325
326 // We don't need to re-cache the embedded fonts when looking at symbols in the schematic editor
327 // because the fonts are all available in the schematic.
328 const std::vector<wxString>* fontFiles = nullptr;
329
332
333 Fontconfig()->ListFonts( fontNames, std::string( Pgm().GetLanguageTag().utf8_str() ),
334 fontFiles, false );
335 }
336 else
337 {
338 const std::vector<wxString>* fontFiles = m_part->GetEmbeddedFiles()->UpdateFontFiles();
339
340 // If there are font files embedded, we want to re-cache our fonts for each symbol that we
341 // are looking at in the symbol editor.
342 Fontconfig()->ListFonts( fontNames, std::string( Pgm().GetLanguageTag().utf8_str() ),
343 fontFiles, !fontFiles->empty() );
344 }
345
346 m_netclassAttr = new wxGridCellAttr;
347 m_netclassAttr->SetEditor( new GRID_CELL_COMBOBOX( existingNetclasses ) );
348
349 for( const std::string& name : fontNames )
350 fonts.Add( wxString( name ) );
351
352 fonts.Sort();
353 fonts.Insert( KICAD_FONT_NAME, 0 );
354 fonts.Insert( DEFAULT_FONT_NAME, 0 );
355
356 m_fontAttr = new wxGridCellAttr;
357 m_fontAttr->SetEditor( new GRID_CELL_COMBOBOX( fonts ) );
358
359 m_colorAttr = new wxGridCellAttr;
360 m_colorAttr->SetRenderer( new GRID_CELL_COLOR_RENDERER( m_dialog ) );
361 m_colorAttr->SetEditor( new GRID_CELL_COLOR_SELECTOR( m_dialog, aGrid ) );
362
363 m_eval = std::make_unique<NUMERIC_EVALUATOR>( m_frame->GetUserUnits() );
364
365 m_frame->Bind( EDA_EVT_UNITS_CHANGED, &FIELDS_GRID_TABLE::onUnitsChanged, this );
366}
367
368
370{
371 m_readOnlyAttr->DecRef();
372 m_fieldNameAttr->DecRef();
373 m_boolAttr->DecRef();
374 m_referenceAttr->DecRef();
375 m_valueAttr->DecRef();
376 m_footprintAttr->DecRef();
377 m_urlAttr->DecRef();
378 m_nonUrlAttr->DecRef();
379 m_filepathAttr->DecRef();
380 m_vAlignAttr->DecRef();
381 m_hAlignAttr->DecRef();
382 m_orientationAttr->DecRef();
383 m_netclassAttr->DecRef();
384 m_fontAttr->DecRef();
385 m_colorAttr->DecRef();
386
387 m_frame->Unbind( EDA_EVT_UNITS_CHANGED, &FIELDS_GRID_TABLE::onUnitsChanged, this );
388}
389
390
391void FIELDS_GRID_TABLE::onUnitsChanged( wxCommandEvent& aEvent )
392{
393 if( GetView() )
394 GetView()->ForceRefresh();
395
396 aEvent.Skip();
397}
398
399
401{
402 switch( aCol )
403 {
404 case FDC_NAME: return _( "Name" );
405 case FDC_VALUE: return _( "Value" );
406 case FDC_SHOWN: return _( "Show" );
407 case FDC_SHOW_NAME: return _( "Show Name" );
408 case FDC_H_ALIGN: return _( "H Align" );
409 case FDC_V_ALIGN: return _( "V Align" );
410 case FDC_ITALIC: return _( "Italic" );
411 case FDC_BOLD: return _( "Bold" );
412 case FDC_TEXT_SIZE: return _( "Text Size" );
413 case FDC_ORIENTATION: return _( "Orientation" );
414 case FDC_POSX: return _( "X Position" );
415 case FDC_POSY: return _( "Y Position" );
416 case FDC_FONT: return _( "Font" );
417 case FDC_COLOR: return _( "Color" );
418 case FDC_ALLOW_AUTOPLACE: return _( "Allow Autoplacement" );
419 default: wxFAIL; return wxEmptyString;
420 }
421}
422
423
424bool FIELDS_GRID_TABLE::CanGetValueAs( int aRow, int aCol, const wxString& aTypeName )
425{
426 switch( aCol )
427 {
428 case FDC_NAME:
429 case FDC_VALUE:
430 case FDC_H_ALIGN:
431 case FDC_V_ALIGN:
432 case FDC_TEXT_SIZE:
433 case FDC_ORIENTATION:
434 case FDC_POSX:
435 case FDC_POSY:
436 case FDC_FONT:
437 case FDC_COLOR:
438 return aTypeName == wxGRID_VALUE_STRING;
439
440 case FDC_SHOWN:
441 case FDC_SHOW_NAME:
442 case FDC_ITALIC:
443 case FDC_BOLD:
445 return aTypeName == wxGRID_VALUE_BOOL;
446
447 default:
448 wxFAIL;
449 return false;
450 }
451}
452
453
454bool FIELDS_GRID_TABLE::CanSetValueAs( int aRow, int aCol, const wxString& aTypeName )
455{
456 return CanGetValueAs( aRow, aCol, aTypeName );
457}
458
459
460wxGridCellAttr* FIELDS_GRID_TABLE::GetAttr( int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind )
461{
462 wxGridCellAttr* tmp;
463
464 switch( aCol )
465 {
466 case FDC_NAME:
467 if( aRow < m_mandatoryFieldCount )
468 {
469 tmp = m_fieldNameAttr->Clone();
470 tmp->SetReadOnly( true );
471 return enhanceAttr( tmp, aRow, aCol, aKind );
472 }
473 else
474 {
475 m_fieldNameAttr->IncRef();
476 return enhanceAttr( m_fieldNameAttr, aRow, aCol, aKind );
477 }
478
479 case FDC_VALUE:
480 if( m_parentType == SCH_SYMBOL_T && aRow == REFERENCE_FIELD )
481 {
482 m_referenceAttr->IncRef();
483 return enhanceAttr( m_referenceAttr, aRow, aCol, aKind );
484 }
485 else if( m_parentType == SCH_SYMBOL_T && aRow == VALUE_FIELD )
486 {
487 m_valueAttr->IncRef();
488 return enhanceAttr( m_valueAttr, aRow, aCol, aKind );
489 }
490 else if( m_parentType == SCH_SYMBOL_T && aRow == FOOTPRINT_FIELD )
491 {
492 // Power symbols have do not appear in the board, so don't allow
493 // a footprint (m_part can be nullptr when loading a old schematic
494 // (for instance Kicad 4) with libraries missing)
495 if( m_part && m_part->IsPower() )
496 {
497 m_readOnlyAttr->IncRef();
498 return enhanceAttr( m_readOnlyAttr, aRow, aCol, aKind );
499 }
500 else
501 {
502 m_footprintAttr->IncRef();
503 return enhanceAttr( m_footprintAttr, aRow, aCol, aKind );
504 }
505 }
506 else if( m_parentType == SCH_SYMBOL_T && aRow == DATASHEET_FIELD )
507 {
508 m_urlAttr->IncRef();
509 return enhanceAttr( m_urlAttr, aRow, aCol, aKind );
510 }
511 else if( m_parentType == SCH_SHEET_T && aRow == SHEETNAME )
512 {
513 m_referenceAttr->IncRef();
514 return enhanceAttr( m_referenceAttr, aRow, aCol, aKind );
515 }
516 else if( m_parentType == SCH_SHEET_T && aRow == SHEETFILENAME )
517 {
518 m_filepathAttr->IncRef();
519 return enhanceAttr( m_filepathAttr, aRow, aCol, aKind );
520 }
522 && this->at( (size_t) aRow ).GetCanonicalName() == wxT( "Netclass" ) )
523 {
524 m_netclassAttr->IncRef();
525 return enhanceAttr( m_netclassAttr, aRow, aCol, aKind );
526 }
527 else
528 {
529 wxString fn = GetValue( aRow, FDC_NAME );
530
532
533 const TEMPLATE_FIELDNAME* templateFn =
534 settings ? settings->m_TemplateFieldNames.GetFieldName( fn ) : nullptr;
535
536 if( templateFn && templateFn->m_URL )
537 {
538 m_urlAttr->IncRef();
539 return enhanceAttr( m_urlAttr, aRow, aCol, aKind );
540 }
541 else
542 {
543 m_nonUrlAttr->IncRef();
544 return enhanceAttr( m_nonUrlAttr, aRow, aCol, aKind );
545 }
546 }
547
548 case FDC_TEXT_SIZE:
549 case FDC_POSX:
550 case FDC_POSY:
551 return enhanceAttr( nullptr, aRow, aCol, aKind );
552
553 case FDC_H_ALIGN:
554 m_hAlignAttr->IncRef();
555 return enhanceAttr( m_hAlignAttr, aRow, aCol, aKind );
556
557 case FDC_V_ALIGN:
558 m_vAlignAttr->IncRef();
559 return enhanceAttr( m_vAlignAttr, aRow, aCol, aKind );
560
561 case FDC_ORIENTATION:
562 m_orientationAttr->IncRef();
563 return enhanceAttr( m_orientationAttr, aRow, aCol, aKind );
564
565 case FDC_SHOWN:
566 case FDC_SHOW_NAME:
567 case FDC_ITALIC:
568 case FDC_BOLD:
570 m_boolAttr->IncRef();
571 return enhanceAttr( m_boolAttr, aRow, aCol, aKind );
572
573 case FDC_FONT:
574 m_fontAttr->IncRef();
575 return enhanceAttr( m_fontAttr, aRow, aCol, aKind );
576
577 case FDC_COLOR:
578 m_colorAttr->IncRef();
579 return enhanceAttr( m_colorAttr, aRow, aCol, aKind );
580
581 default:
582 wxFAIL;
583 return enhanceAttr( nullptr, aRow, aCol, aKind );
584 }
585}
586
587
588wxString FIELDS_GRID_TABLE::GetValue( int aRow, int aCol )
589{
590 wxCHECK( aRow < GetNumberRows(), wxEmptyString );
591
592 wxGrid* grid = GetView();
593 const SCH_FIELD& field = this->at( (size_t) aRow );
594
595 if( grid->GetGridCursorRow() == aRow && grid->GetGridCursorCol() == aCol
596 && grid->IsCellEditControlShown() )
597 {
598 auto it = m_evalOriginal.find( { aRow, aCol } );
599
600 if( it != m_evalOriginal.end() )
601 return it->second;
602 }
603
604 switch( aCol )
605 {
606 case FDC_NAME:
607 // Use default field names for mandatory and system fields because they are translated
608 // according to the current locale
610 {
611 if( aRow < m_mandatoryFieldCount )
613 else
614 return field.GetName( false );
615 }
616 else if( m_parentType == SCH_SHEET_T )
617 {
618 if( aRow < m_mandatoryFieldCount )
619 return SCH_SHEET::GetDefaultFieldName( aRow );
620 else
621 return field.GetName( false );
622 }
624 {
626 }
627 else
628 {
629 wxFAIL_MSG( wxS( "Unhandled field owner type." ) );
630 return field.GetName( false );
631 }
632
633 case FDC_VALUE:
634 return EscapeString( UnescapeString( field.GetText() ), CTX_LINE );
635
636 case FDC_SHOWN:
637 return StringFromBool( field.IsVisible() );
638
639 case FDC_SHOW_NAME:
640 return StringFromBool( field.IsNameShown() );
641
642 case FDC_H_ALIGN:
643 switch ( field.GetEffectiveHorizJustify() )
644 {
645 case GR_TEXT_H_ALIGN_LEFT: return _( "Left" );
646 case GR_TEXT_H_ALIGN_CENTER: return _( "Center" );
647 case GR_TEXT_H_ALIGN_RIGHT: return _( "Right" );
649 }
650
651 break;
652
653 case FDC_V_ALIGN:
654 switch ( field.GetEffectiveVertJustify() )
655 {
656 case GR_TEXT_V_ALIGN_TOP: return _( "Top" );
657 case GR_TEXT_V_ALIGN_CENTER: return _( "Center" );
658 case GR_TEXT_V_ALIGN_BOTTOM: return _( "Bottom" );
660 }
661
662 break;
663
664 case FDC_ITALIC:
665 return StringFromBool( field.IsItalic() );
666
667 case FDC_BOLD:
668 return StringFromBool( field.IsBold() );
669
670 case FDC_TEXT_SIZE:
671 return m_frame->StringFromValue( field.GetTextHeight(), true );
672
673 case FDC_ORIENTATION:
674 if( field.GetTextAngle().IsHorizontal() )
675 return _( "Horizontal" );
676 else
677 return _( "Vertical" );
678
679 case FDC_POSX:
680 return m_frame->StringFromValue( field.GetTextPos().x, true );
681
682 case FDC_POSY:
683 return m_frame->StringFromValue( field.GetTextPos().y, true );
684
685 case FDC_FONT:
686 if( field.GetFont() )
687 return field.GetFont()->GetName();
688 else
689 return DEFAULT_FONT_NAME;
690
691 case FDC_COLOR:
692 return field.GetTextColor().ToCSSString();
693
695 return StringFromBool( field.CanAutoplace() );
696
697 default:
698 // we can't assert here because wxWidgets sometimes calls this without checking
699 // the column type when trying to see if there's an overflow
700 break;
701 }
702
703 return wxT( "bad wxWidgets!" );
704}
705
706
707bool FIELDS_GRID_TABLE::GetValueAsBool( int aRow, int aCol )
708{
709 wxCHECK( aRow < GetNumberRows(), false );
710 const SCH_FIELD& field = this->at( (size_t) aRow );
711
712 switch( aCol )
713 {
714 case FDC_SHOWN: return field.IsVisible();
715 case FDC_SHOW_NAME: return field.IsNameShown();
716 case FDC_ITALIC: return field.IsItalic();
717 case FDC_BOLD: return field.IsBold();
718 case FDC_ALLOW_AUTOPLACE: return field.CanAutoplace();
719 default:
720 wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) );
721 return false;
722 }
723}
724
725
726void FIELDS_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
727{
728 wxCHECK( aRow < GetNumberRows(), /*void*/ );
729 SCH_FIELD& field = this->at( (size_t) aRow );
730 VECTOR2I pos;
731 wxString value = aValue;
732
733 switch( aCol )
734 {
735 case FDC_TEXT_SIZE:
736 case FDC_POSX:
737 case FDC_POSY:
738 m_eval->SetDefaultUnits( m_frame->GetUserUnits() );
739
740 if( m_eval->Process( value ) )
741 {
742 m_evalOriginal[ { aRow, aCol } ] = value;
743 value = m_eval->Result();
744 }
745
746 break;
747
748 default:
749 break;
750 }
751
752 switch( aCol )
753 {
754 case FDC_NAME:
755 field.SetName( value );
756 break;
757
758 case FDC_VALUE:
759 {
760 if( m_parentType == SCH_SHEET_T && aRow == SHEETFILENAME )
761 {
763 }
764 else if( m_parentType == LIB_SYMBOL_T && aRow == VALUE_FIELD )
765 {
766 value = EscapeString( value, CTX_LIBID );
767 }
768
769 field.SetText( UnescapeString( value ) );
770 break;
771 }
772
773 case FDC_SHOWN:
774 field.SetVisible( BoolFromString( value ) );
775 break;
776
777 case FDC_SHOW_NAME:
778 field.SetNameShown( BoolFromString( value ) );
779 break;
780
781 case FDC_H_ALIGN:
782 {
783 GR_TEXT_H_ALIGN_T horizontalJustification = GR_TEXT_H_ALIGN_CENTER;
784
785 if( value == _( "Left" ) )
786 horizontalJustification = GR_TEXT_H_ALIGN_LEFT;
787 else if( value == _( "Center" ) )
788 horizontalJustification = GR_TEXT_H_ALIGN_CENTER;
789 else if( value == _( "Right" ) )
790 horizontalJustification = GR_TEXT_H_ALIGN_RIGHT;
791 else
792 wxFAIL_MSG( wxT( "unknown horizontal alignment: " ) + value );
793
794 // Note that we must set justifications before we can ask if they're flipped. If the old
795 // justification is center then it won't know (whereas if the new justification is center
796 // the we don't care).
797 field.SetHorizJustify( horizontalJustification );
798
799 if( field.IsHorizJustifyFlipped() )
800 field.SetHorizJustify( EDA_TEXT::MapHorizJustify( - horizontalJustification ) );
801
802 break;
803 }
804
805 case FDC_V_ALIGN:
806 {
807 GR_TEXT_V_ALIGN_T verticalJustification = GR_TEXT_V_ALIGN_BOTTOM;
808
809 if( value == _( "Top" ) )
810 verticalJustification = GR_TEXT_V_ALIGN_TOP;
811 else if( value == _( "Center" ) )
812 verticalJustification = GR_TEXT_V_ALIGN_CENTER;
813 else if( value == _( "Bottom" ) )
814 verticalJustification = GR_TEXT_V_ALIGN_BOTTOM;
815 else
816 wxFAIL_MSG( wxT( "unknown vertical alignment: " ) + value);
817
818 // Note that we must set justifications before we can ask if they're flipped. If the old
819 // justification is center then it won't know (whereas if the new justification is center
820 // the we don't care).
821 field.SetVertJustify( verticalJustification );
822
823 if( field.IsVertJustifyFlipped() )
824 field.SetVertJustify( EDA_TEXT::MapVertJustify( -verticalJustification ) );
825
826 break;
827 }
828
829 case FDC_ITALIC:
830 field.SetItalic( BoolFromString( value ) );
831 break;
832
833 case FDC_BOLD:
834 field.SetBold( BoolFromString( value ) );
835 break;
836
837 case FDC_TEXT_SIZE:
839 m_frame->ValueFromString( value ) ) );
840 break;
841
842 case FDC_ORIENTATION:
843 if( value == _( "Horizontal" ) )
845 else if( value == _( "Vertical" ) )
847 else
848 wxFAIL_MSG( wxT( "unknown orientation: " ) + value );
849
850 break;
851
852 case FDC_POSX:
853 case FDC_POSY:
854 pos = field.GetTextPos();
855
856 if( aCol == FDC_POSX )
857 pos.x = m_frame->ValueFromString( value );
858 else
859 pos.y = m_frame->ValueFromString( value );
860
861 field.SetTextPos( pos );
862 break;
863
864 case FDC_FONT:
865 if( value == DEFAULT_FONT_NAME )
866 field.SetFont( nullptr );
867 else if( value == KICAD_FONT_NAME )
868 field.SetFont( KIFONT::FONT::GetFont( wxEmptyString, field.IsBold(),
869 field.IsItalic() ) );
870 else
871 field.SetFont( KIFONT::FONT::GetFont( aValue, field.IsBold(), field.IsItalic() ) );
872
873 break;
874
875 case FDC_COLOR:
876 field.SetTextColor( wxColor( value ) );
877 break;
878
880 field.SetCanAutoplace( BoolFromString( value ) );
881 break;
882
883 default:
884 wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a string value" ), aCol ) );
885 break;
886 }
887
889
890 GetView()->Refresh();
891}
892
893
894void FIELDS_GRID_TABLE::SetValueAsBool( int aRow, int aCol, bool aValue )
895{
896 wxCHECK( aRow < GetNumberRows(), /*void*/ );
897 SCH_FIELD& field = this->at( (size_t) aRow );
898
899 switch( aCol )
900 {
901 case FDC_SHOWN:
902 field.SetVisible( aValue );
903 break;
904
905 case FDC_SHOW_NAME:
906 field.SetNameShown( aValue );
907 break;
908
909 case FDC_ITALIC:
910 field.SetItalic( aValue );
911 break;
912
913 case FDC_BOLD:
914 field.SetBold( aValue );
915 break;
916
918 field.SetCanAutoplace( aValue );
919 break;
920
921 default:
922 wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) );
923 break;
924 }
925
927}
928
929
930void FIELDS_GRID_TRICKS::showPopupMenu( wxMenu& menu, wxGridEvent& aEvent )
931{
932 if( m_grid->GetGridCursorRow() == FOOTPRINT_FIELD && m_grid->GetGridCursorCol() == FDC_VALUE
933 && !m_grid->IsReadOnly( FOOTPRINT_FIELD, FDC_VALUE ) )
934 {
935 menu.Append( MYID_SELECT_FOOTPRINT, _( "Select Footprint..." ),
936 _( "Browse for footprint" ) );
937 menu.AppendSeparator();
938 }
939 else if( m_grid->GetGridCursorRow() == DATASHEET_FIELD
940 && m_grid->GetGridCursorCol() == FDC_VALUE )
941 {
942 menu.Append( MYID_SHOW_DATASHEET, _( "Show Datasheet" ),
943 _( "Show datasheet in browser" ) );
944 menu.AppendSeparator();
945 }
946
947 GRID_TRICKS::showPopupMenu( menu, aEvent );
948}
949
950
951void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
952{
953 if( event.GetId() == MYID_SELECT_FOOTPRINT )
954 {
955 // pick a footprint using the footprint picker.
956 wxString fpid = m_grid->GetCellValue( FOOTPRINT_FIELD, FDC_VALUE );
957
958 if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg ) )
959 {
960 if( frame->ShowModal( &fpid, m_dlg ) )
961 m_grid->SetCellValue( FOOTPRINT_FIELD, FDC_VALUE, fpid );
962
963 frame->Destroy();
964 }
965 }
966 else if (event.GetId() == MYID_SHOW_DATASHEET )
967 {
968 wxString datasheet_uri = m_grid->GetCellValue( DATASHEET_FIELD, FDC_VALUE );
969
970 GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj(),
972 }
973 else
974 {
976 }
977}
978
979
980wxString FIELDS_GRID_TABLE::StringFromBool( bool aValue ) const
981{
982 if( aValue )
983 return wxT( "1" );
984 else
985 return wxT( "0" );
986}
987
988
989bool FIELDS_GRID_TABLE::BoolFromString( wxString aValue ) const
990{
991 if( aValue == wxS( "1" ) )
992 {
993 return true;
994 }
995 else if( aValue == wxS( "0" ) )
996 {
997 return false;
998 }
999 else
1000 {
1001 wxFAIL_MSG( wxString::Format( "string '%s' can't be converted to boolean correctly and "
1002 "will be perceived as FALSE", aValue ) );
1003 return false;
1004 }
1005}
const char * name
Definition: DXF_plotter.cpp:57
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:88
void OnModify()
bool IsHorizontal() const
Definition: eda_angle.h:138
FRAME_T GetFrameType() const
int GetTextHeight() const
Definition: eda_text.h:247
void SetTextColor(const COLOR4D &aColor)
Definition: eda_text.h:249
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:253
COLOR4D GetTextColor() const
Definition: eda_text.h:250
bool IsItalic() const
Definition: eda_text.h:152
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:130
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
Definition: eda_text.cpp:419
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:94
virtual bool IsVisible() const
Definition: eda_text.h:170
void SetTextPos(const VECTOR2I &aPoint)
Definition: eda_text.cpp:464
KIFONT::FONT * GetFont() const
Definition: eda_text.h:230
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:321
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:290
static GR_TEXT_H_ALIGN_T MapHorizJustify(int aHorizJustify)
Definition: eda_text.cpp:64
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
Definition: eda_text.cpp:240
bool IsBold() const
Definition: eda_text.h:167
static GR_TEXT_V_ALIGN_T MapVertJustify(int aVertJustify)
Definition: eda_text.cpp:78
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:204
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
Definition: eda_text.cpp:212
void SetFont(KIFONT::FONT *aFont)
Definition: eda_text.cpp:403
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:313
const std::vector< wxString > * UpdateFontFiles()
Helper function to get a list of fonts for fontconfig to add to the library.
const std::vector< wxString > * GetFontFiles() const
If we just need the cached version of the font files, we can use this function which is const and wil...
wxGridCellAttr * GetAttr(int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind) override
wxString StringFromBool(bool aValue) const
bool GetValueAsBool(int aRow, int aCol) override
FIELD_VALIDATOR m_fieldNameValidator
bool CanSetValueAs(int aRow, int aCol, const wxString &aTypeName) override
void initGrid(WX_GRID *aGrid)
wxGridCellAttr * m_fieldNameAttr
int GetNumberRows() override
wxGridCellAttr * m_readOnlyAttr
FIELD_VALIDATOR m_urlValidator
SCH_BASE_FRAME * m_frame
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override
wxGridCellAttr * m_colorAttr
wxGridCellAttr * m_nonUrlAttr
wxGridCellAttr * m_referenceAttr
FIELD_VALIDATOR m_referenceValidator
FIELD_VALIDATOR m_valueValidator
std::map< std::pair< int, int >, wxString > m_evalOriginal
DIALOG_SHIM * m_dialog
wxGridCellAttr * m_footprintAttr
wxGridCellAttr * m_boolAttr
wxGridCellAttr * m_fontAttr
wxGridCellAttr * m_urlAttr
wxGridCellAttr * m_valueAttr
wxGridCellAttr * m_hAlignAttr
wxGridCellAttr * m_orientationAttr
void SetValue(int aRow, int aCol, const wxString &aValue) override
wxGridCellAttr * m_vAlignAttr
FIELDS_GRID_TABLE(DIALOG_SHIM *aDialog, SCH_BASE_FRAME *aFrame, WX_GRID *aGrid, LIB_SYMBOL *aSymbol)
wxGridCellAttr * m_filepathAttr
wxGridCellAttr * m_netclassAttr
void SetValueAsBool(int aRow, int aCol, bool aValue) override
wxString GetValue(int aRow, int aCol) override
void onUnitsChanged(wxCommandEvent &aEvent)
std::unique_ptr< NUMERIC_EVALUATOR > m_eval
FIELD_VALIDATOR m_nonUrlValidator
FIELD_VALIDATOR m_filepathValidator
wxString GetColLabelValue(int aCol) override
bool BoolFromString(wxString aValue) const
void showPopupMenu(wxMenu &menu, wxGridEvent &aEvent) override
void doPopupSelection(wxCommandEvent &event) override
EMBEDDED_FILES * m_files
Editor for wxGrid cells that adds a file/folder browser to the grid input field.
This class works around a bug in wxGrid where the first keystroke doesn't get sent through the valida...
virtual void SetValidator(const wxValidator &validator) override
virtual void doPopupSelection(wxCommandEvent &event)
virtual void showPopupMenu(wxMenu &menu, wxGridEvent &aEvent)
WX_GRID * m_grid
I don't own the grid, but he owns me.
Definition: grid_tricks.h:125
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
Definition: font.cpp:146
const wxString & GetName() const
Definition: font.h:149
wxString ToCSSString() const
Definition: color4d.cpp:147
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:55
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:65
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:406
Define a library symbol object.
Definition: lib_symbol.h:78
bool IsPower() const override
Definition: lib_symbol.cpp:389
std::vector< SCH_PIN * > GetPins(int aUnit=0, int aBodyStyle=0) const
Return a list of pin object pointers from the draw item list.
Definition: lib_symbol.cpp:810
wxArrayString GetFPFilters() const
Definition: lib_symbol.h:206
EMBEDDED_FILES * GetEmbeddedFiles() override
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:72
SCHEMATIC_SETTINGS * m_SchematicSettings
Definition: project_file.h:140
std::shared_ptr< NET_SETTINGS > & NetSettings()
Definition: project_file.h:103
static SEARCH_STACK * SchSearchS(PROJECT *aProject)
Accessor for Eeschema search stack.
Definition: project_sch.cpp:41
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:135
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:200
These are loaded from Eeschema settings but then overwritten by the project settings.
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition: schematic.cpp:860
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
Schematic editor (Eeschema) main window.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
GR_TEXT_V_ALIGN_T GetEffectiveVertJustify() const
Definition: sch_field.cpp:744
bool IsNameShown() const
Definition: sch_field.h:208
bool IsHorizJustifyFlipped() const
Return whether the field will be rendered with the horizontal justification inverted due to rotation ...
Definition: sch_field.cpp:644
bool IsVertJustifyFlipped() const
Definition: sch_field.cpp:701
void SetCanAutoplace(bool aCanPlace)
Definition: sch_field.h:220
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
Definition: sch_field.cpp:1252
GR_TEXT_H_ALIGN_T GetEffectiveHorizJustify() const
Definition: sch_field.cpp:687
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Definition: sch_field.cpp:1227
void SetName(const wxString &aName)
Definition: sch_field.cpp:1202
bool CanAutoplace() const
Definition: sch_field.h:219
void SetText(const wxString &aText) override
Definition: sch_field.cpp:1212
void OnScintillaCharAdded(SCINTILLA_TRICKS *aScintillaTricks, wxStyledTextEvent &aEvent) const
Definition: sch_field.cpp:807
void SetNameShown(bool aShown=true)
Definition: sch_field.h:209
static const wxString GetDefaultFieldName(const wxString &aName, bool aUseDefaultName)
Definition: sch_label.cpp:203
SCHEMATIC * Schematic() const
Definition: sch_screen.cpp:100
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:57
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslated=true)
Definition: sch_sheet.cpp:57
Schematic symbol object.
Definition: sch_symbol.h:104
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:212
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
const TEMPLATE_FIELDNAME * GetFieldName(const wxString &aName)
Search for aName in the template field name list.
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.
wxGridCellAttr * enhanceAttr(wxGridCellAttr *aInputAttr, int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind)
Definition: wx_grid.cpp:45
wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
Definition: common.cpp:422
#define _(s)
static constexpr EDA_ANGLE ANGLE_VERTICAL
Definition: eda_angle.h:398
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
Definition: eda_angle.h:397
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, PROJECT *aProject, SEARCH_STACK *aPaths, EMBEDDED_FILES *aFiles)
Open a document (file) with the suitable browser.
Definition: eda_doc.cpp:62
This file is part of the common library.
#define DEFAULT_FONT_NAME
static wxString netList(SCH_SYMBOL *aSymbol, SCH_SHEET_PATH &aSheetPath)
@ MYID_SHOW_DATASHEET
@ MYID_SELECT_FOOTPRINT
@ FDC_TEXT_SIZE
@ FDC_BOLD
@ FDC_POSY
@ FDC_ITALIC
@ FDC_SHOW_NAME
@ FDC_NAME
@ FDC_H_ALIGN
@ FDC_COLOR
@ FDC_SHOWN
@ FDC_ALLOW_AUTOPLACE
@ FDC_VALUE
@ FDC_POSX
@ FDC_ORIENTATION
@ FDC_V_ALIGN
@ FDC_FONT
FONTCONFIG * Fontconfig()
Definition: fontconfig.cpp:100
@ FRAME_SCH_SYMBOL_EDITOR
Definition: frame_type.h:35
@ FRAME_SCH_VIEWER
Definition: frame_type.h:36
@ FRAME_SCH
Definition: frame_type.h:34
@ FRAME_FOOTPRINT_CHOOSER
Definition: frame_type.h:44
@ GRIDTRICKS_FIRST_CLIENT_ID
Definition: grid_tricks.h:48
static const std::string KiCadSchematicFileExtension
#define KICAD_FONT_NAME
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE
@ SHEET_MANDATORY_FIELDS
The first 2 are mandatory, and must be instantiated in SCH_SHEET.
Definition: sch_sheet.h:49
@ SHEETNAME
Definition: sch_sheet.h:45
@ SHEETFILENAME
Definition: sch_sheet.h:46
Definitions of control validators for schematic dialogs.
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_LINE
Definition: string_utils.h:59
@ CTX_LIBID
Definition: string_utils.h:54
Hold a name of a symbol's field, field value, and default visibility.
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslateForHI=false)
Return a default symbol field name for field aFieldNdx for all components.
Definition for symbol library class.
#define DO_TRANSLATE
@ DATASHEET_FIELD
name of datasheet
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ MANDATORY_FIELDS
The first 5 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
GR_TEXT_H_ALIGN_T
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
@ GR_TEXT_H_ALIGN_INDETERMINATE
GR_TEXT_V_ALIGN_T
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP
@ LIB_SYMBOL_T
Definition: typeinfo.h:148
@ SCH_SYMBOL_T
Definition: typeinfo.h:172
@ SCH_SHEET_T
Definition: typeinfo.h:174
@ SCH_LABEL_LOCATE_ANY_T
Definition: typeinfo.h:190
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
Definition: ui_common.h:46
Custom text control validator definitions.
#define SHEETFILENAME_V
Definition: validators.h:47
#define FIELD_NAME
Definition: validators.h:43
#define SHEETNAME_V
Definition: validators.h:46
#define FIELD_VALUE
Definition: validators.h:44
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:691
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.
Definition of file extensions used in Kicad.