KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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 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
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, EMBEDDED_FILES* aFiles ) :
135 m_frame( aFrame ),
136 m_dialog( aDialog ),
137 m_parentType( SCH_SYMBOL_T ),
138 m_part( aSymbol ),
139 m_files( aFiles ),
140 m_symbolNetlist( netList( aSymbol ) ),
141 m_fieldNameValidator( FIELD_T::USER ),
142 m_referenceValidator( FIELD_T::REFERENCE ),
143 m_valueValidator( FIELD_T::VALUE ),
144 m_urlValidator( FIELD_T::USER ),
145 m_nonUrlValidator( FIELD_T::USER ),
146 m_filepathValidator( FIELD_T::SHEET_FILENAME )
147{
148 initGrid( aGrid );
149}
150
151
153 SCH_SYMBOL* aSymbol, EMBEDDED_FILES* aFiles ) :
154 m_frame( aFrame ),
155 m_dialog( aDialog ),
156 m_parentType( SCH_SYMBOL_T ),
157 m_part( aSymbol->GetLibSymbolRef().get() ),
158 m_files( aFiles ),
159 m_symbolNetlist( netList( aSymbol, aFrame->GetCurrentSheet() ) ),
160 m_fieldNameValidator( FIELD_T::USER ),
161 m_referenceValidator( FIELD_T::REFERENCE ),
162 m_valueValidator( FIELD_T::VALUE ),
163 m_urlValidator( FIELD_T::USER ),
164 m_nonUrlValidator( FIELD_T::USER ),
165 m_filepathValidator( FIELD_T::SHEET_FILENAME )
166{
167 initGrid( aGrid );
168}
169
170
172 SCH_SHEET* aSheet ) :
173 m_frame( aFrame ),
174 m_dialog( aDialog ),
175 m_parentType( SCH_SHEET_T ),
176 m_part( nullptr ),
177 m_files( nullptr ),
178 m_fieldNameValidator( FIELD_T::USER ),
179 m_referenceValidator( FIELD_T::SHEET_NAME ),
180 m_valueValidator( FIELD_T::VALUE ),
181 m_urlValidator( FIELD_T::USER ),
182 m_nonUrlValidator( FIELD_T::USER ),
183 m_filepathValidator( FIELD_T::SHEET_FILENAME )
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_part( nullptr ),
195 m_fieldNameValidator( FIELD_T::USER ),
196 m_referenceValidator( FIELD_T::USER ),
197 m_valueValidator( FIELD_T::USER ),
198 m_urlValidator( FIELD_T::USER ),
199 m_nonUrlValidator( FIELD_T::USER ),
200 m_filepathValidator( FIELD_T::USER )
201{
202 initGrid( aGrid );
203}
204
205
207{
208 int mandatoryRows = 0;
209
210 for( const SCH_FIELD& field : *this )
211 {
212 if( field.IsMandatory() )
213 mandatoryRows++;
214 }
215
216 return mandatoryRows;
217}
218
219
221{
222 // Build the various grid cell attributes.
223 // NOTE: validators and cellAttrs are member variables to get the destruction order
224 // right. wxGrid is VERY cranky about this.
225
226 m_readOnlyAttr = new wxGridCellAttr;
227 m_readOnlyAttr->SetReadOnly( true );
228
229 m_fieldNameAttr = new wxGridCellAttr;
231 nameEditor->SetValidator( m_fieldNameValidator );
232 m_fieldNameAttr->SetEditor( nameEditor );
233
234 m_referenceAttr = new wxGridCellAttr;
235 GRID_CELL_TEXT_EDITOR* referenceEditor = new GRID_CELL_TEXT_EDITOR();
236 referenceEditor->SetValidator( m_referenceValidator );
237 m_referenceAttr->SetEditor( referenceEditor );
238
239 m_valueAttr = new wxGridCellAttr;
240
242 {
243 GRID_CELL_TEXT_EDITOR* valueEditor = new GRID_CELL_TEXT_EDITOR();
244 valueEditor->SetValidator( m_valueValidator );
245 m_valueAttr->SetEditor( valueEditor );
246 }
247 else
248 {
249 GRID_CELL_STC_EDITOR* valueEditor = new GRID_CELL_STC_EDITOR( true,
250 [this]( wxStyledTextEvent& aEvent, SCINTILLA_TRICKS* aScintillaTricks )
251 {
252 SCH_FIELD* valueField = this->GetField( FIELD_T::VALUE );
253 valueField->OnScintillaCharAdded( aScintillaTricks, aEvent );
254 } );
255
256 m_valueAttr->SetEditor( valueEditor );
257 }
258
259 m_footprintAttr = new wxGridCellAttr;
261 fpIdEditor->SetValidator( m_nonUrlValidator );
262 m_footprintAttr->SetEditor( fpIdEditor );
263
264 m_urlAttr = new wxGridCellAttr;
265 SEARCH_STACK* prjSearchStack = PROJECT_SCH::SchSearchS( &m_frame->Prj() );
266 GRID_CELL_URL_EDITOR* urlEditor = new GRID_CELL_URL_EDITOR( m_dialog, prjSearchStack, m_files );
267 urlEditor->SetValidator( m_urlValidator );
268 m_urlAttr->SetEditor( urlEditor );
269
270 m_nonUrlAttr = new wxGridCellAttr;
271 GRID_CELL_TEXT_EDITOR* nonUrlEditor = new GRID_CELL_TEXT_EDITOR();
272 nonUrlEditor->SetValidator( m_nonUrlValidator );
273 m_nonUrlAttr->SetEditor( nonUrlEditor );
274
276 m_filepathAttr = new wxGridCellAttr;
277
278 // Create a wild card using wxFileDialog syntax.
279 wxString wildCard( _( "Schematic Files" ) );
280 std::vector<std::string> exts;
281 exts.push_back( FILEEXT::KiCadSchematicFileExtension );
282 wildCard += AddFileExtListToFilter( exts );
283
284 auto filepathEditor = new GRID_CELL_PATH_EDITOR( m_dialog, aGrid, &m_curdir, wildCard );
285 filepathEditor->SetValidator( m_filepathValidator );
286 m_filepathAttr->SetEditor( filepathEditor );
287
288 m_boolAttr = new wxGridCellAttr;
289 m_boolAttr->SetRenderer( new wxGridCellBoolRenderer() );
290 m_boolAttr->SetEditor( new wxGridCellBoolEditor() );
291 m_boolAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
292
293 wxArrayString vAlignNames;
294 vAlignNames.Add( _( "Top" ) );
295 vAlignNames.Add( _( "Center" ) );
296 vAlignNames.Add( _( "Bottom" ) );
297 m_vAlignAttr = new wxGridCellAttr;
298 m_vAlignAttr->SetEditor( new wxGridCellChoiceEditor( vAlignNames ) );
299 m_vAlignAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
300
301 wxArrayString hAlignNames;
302 hAlignNames.Add( _( "Left" ) );
303 hAlignNames.Add(_( "Center" ) );
304 hAlignNames.Add(_( "Right" ) );
305 m_hAlignAttr = new wxGridCellAttr;
306 m_hAlignAttr->SetEditor( new wxGridCellChoiceEditor( hAlignNames ) );
307 m_hAlignAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
308
309 wxArrayString orientationNames;
310 orientationNames.Add( _( "Horizontal" ) );
311 orientationNames.Add(_( "Vertical" ) );
312 m_orientationAttr = new wxGridCellAttr;
313 m_orientationAttr->SetEditor( new wxGridCellChoiceEditor( orientationNames ) );
314 m_orientationAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
315
316 SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
317 wxArrayString existingNetclasses;
318
319 wxArrayString fonts;
320 std::vector<std::string> fontNames;
321
322 if( editFrame )
323 {
324 // Load the combobox with existing existingNetclassNames
325 PROJECT_FILE& projectFile = editFrame->Prj().GetProjectFile();
326 const std::shared_ptr<NET_SETTINGS>& settings = projectFile.NetSettings();
327
328 existingNetclasses.push_back( settings->GetDefaultNetclass()->GetName() );
329
330 for( const auto& [name, netclass] : settings->GetNetclasses() )
331 existingNetclasses.push_back( name );
332
333 // We don't need to re-cache the embedded fonts when looking at symbols in the schematic
334 // editor because the fonts are all available in the schematic.
335 const std::vector<wxString>* fontFiles = nullptr;
336
339
340 Fontconfig()->ListFonts( fontNames, std::string( Pgm().GetLanguageTag().utf8_str() ),
341 fontFiles, false );
342 }
343 else
344 {
345 const std::vector<wxString>* fontFiles = m_part->GetEmbeddedFiles()->UpdateFontFiles();
346
347 // If there are font files embedded, we want to re-cache our fonts for each symbol that
348 // we are looking at in the symbol editor.
349 Fontconfig()->ListFonts( fontNames, std::string( Pgm().GetLanguageTag().utf8_str() ),
350 fontFiles, !fontFiles->empty() );
351 }
352
353 m_netclassAttr = new wxGridCellAttr;
354 m_netclassAttr->SetEditor( new GRID_CELL_COMBOBOX( existingNetclasses ) );
355
356 for( const std::string& name : fontNames )
357 fonts.Add( wxString( name ) );
358
359 fonts.Sort();
360 fonts.Insert( KICAD_FONT_NAME, 0 );
361 fonts.Insert( DEFAULT_FONT_NAME, 0 );
362
363 m_fontAttr = new wxGridCellAttr;
364 m_fontAttr->SetEditor( new GRID_CELL_COMBOBOX( fonts ) );
365
366 m_colorAttr = new wxGridCellAttr;
367 m_colorAttr->SetRenderer( new GRID_CELL_COLOR_RENDERER( m_dialog ) );
368 m_colorAttr->SetEditor( new GRID_CELL_COLOR_SELECTOR( m_dialog, aGrid ) );
369
370 m_eval = std::make_unique<NUMERIC_EVALUATOR>( m_frame->GetUserUnits() );
371
372 m_frame->Bind( EDA_EVT_UNITS_CHANGED, &FIELDS_GRID_TABLE::onUnitsChanged, this );
373}
374
375
377{
378 m_readOnlyAttr->DecRef();
379 m_fieldNameAttr->DecRef();
380 m_boolAttr->DecRef();
381 m_referenceAttr->DecRef();
382 m_valueAttr->DecRef();
383 m_footprintAttr->DecRef();
384 m_urlAttr->DecRef();
385 m_nonUrlAttr->DecRef();
386 m_filepathAttr->DecRef();
387 m_vAlignAttr->DecRef();
388 m_hAlignAttr->DecRef();
389 m_orientationAttr->DecRef();
390 m_netclassAttr->DecRef();
391 m_fontAttr->DecRef();
392 m_colorAttr->DecRef();
393
394 m_frame->Unbind( EDA_EVT_UNITS_CHANGED, &FIELDS_GRID_TABLE::onUnitsChanged, this );
395}
396
397
398void FIELDS_GRID_TABLE::onUnitsChanged( wxCommandEvent& aEvent )
399{
400 if( GetView() )
401 GetView()->ForceRefresh();
402
403 aEvent.Skip();
404}
405
406
408{
411 {
412 return FDC_SCH_EDIT_COUNT;
413 }
414 else
415 {
417 }
418}
419
420
422{
425 {
426 int visibleRows = 0;
427
428 for( const SCH_FIELD& field : *this )
429 {
430 if( !field.IsPrivate() )
431 visibleRows++;
432 }
433
434 return visibleRows;
435 }
436
437 return (int) this->size();
438}
439
440
442{
445 {
446 int visibleRow = 0;
447
448 for( SCH_FIELD& field : *this )
449 {
450 if( field.IsPrivate() )
451 continue;
452
453 if( visibleRow == aRow )
454 return field;
455
456 ++visibleRow;
457 }
458
459 wxFAIL_MSG( wxT( "Row index off end of visible row count" ) );
460 }
461
462 return this->at( aRow );
463}
464
465
467{
468 switch( aCol )
469 {
470 case FDC_NAME: return _( "Name" );
471 case FDC_VALUE: return _( "Value" );
472 case FDC_SHOWN: return _( "Show" );
473 case FDC_SHOW_NAME: return _( "Show Name" );
474 case FDC_H_ALIGN: return _( "H Align" );
475 case FDC_V_ALIGN: return _( "V Align" );
476 case FDC_ITALIC: return _( "Italic" );
477 case FDC_BOLD: return _( "Bold" );
478 case FDC_TEXT_SIZE: return _( "Text Size" );
479 case FDC_ORIENTATION: return _( "Orientation" );
480 case FDC_POSX: return _( "X Position" );
481 case FDC_POSY: return _( "Y Position" );
482 case FDC_FONT: return _( "Font" );
483 case FDC_COLOR: return _( "Color" );
484 case FDC_ALLOW_AUTOPLACE: return _( "Allow Autoplacement" );
485 case FDC_PRIVATE: return _( "Private" );
486 default: wxFAIL; return wxEmptyString;
487 }
488}
489
490
491bool FIELDS_GRID_TABLE::CanGetValueAs( int aRow, int aCol, const wxString& aTypeName )
492{
493 switch( aCol )
494 {
495 case FDC_NAME:
496 case FDC_VALUE:
497 case FDC_H_ALIGN:
498 case FDC_V_ALIGN:
499 case FDC_TEXT_SIZE:
500 case FDC_ORIENTATION:
501 case FDC_POSX:
502 case FDC_POSY:
503 case FDC_FONT:
504 case FDC_COLOR:
505 return aTypeName == wxGRID_VALUE_STRING;
506
507 case FDC_SHOWN:
508 case FDC_SHOW_NAME:
509 case FDC_ITALIC:
510 case FDC_BOLD:
512 case FDC_PRIVATE:
513 return aTypeName == wxGRID_VALUE_BOOL;
514
515 default:
516 wxFAIL;
517 return false;
518 }
519}
520
521
522bool FIELDS_GRID_TABLE::CanSetValueAs( int aRow, int aCol, const wxString& aTypeName )
523{
524 return CanGetValueAs( aRow, aCol, aTypeName );
525}
526
527
528wxGridCellAttr* FIELDS_GRID_TABLE::GetAttr( int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind )
529{
530 wxCHECK( aRow < GetNumberRows(), nullptr );
531
532 const SCH_FIELD& field = getField( aRow );
533 wxGridCellAttr* tmp;
534
535 switch( aCol )
536 {
537 case FDC_NAME:
538 if( field.IsMandatory() )
539 {
540 tmp = m_fieldNameAttr->Clone();
541 tmp->SetReadOnly( true );
542 return enhanceAttr( tmp, aRow, aCol, aKind );
543 }
544 else
545 {
546 m_fieldNameAttr->IncRef();
547 return enhanceAttr( m_fieldNameAttr, aRow, aCol, aKind );
548 }
549
550 case FDC_VALUE:
551 if( field.GetId() == FIELD_T::REFERENCE )
552 {
553 m_referenceAttr->IncRef();
554 return enhanceAttr( m_referenceAttr, aRow, aCol, aKind );
555 }
556 else if( field.GetId() == FIELD_T::VALUE )
557 {
558 m_valueAttr->IncRef();
559 return enhanceAttr( m_valueAttr, aRow, aCol, aKind );
560 }
561 else if( field.GetId() == FIELD_T::FOOTPRINT )
562 {
563 // Power symbols have do not appear in the board, so don't allow
564 // a footprint (m_part can be nullptr when loading a old schematic
565 // (for instance Kicad 4) with libraries missing)
566 if( m_part && m_part->IsPower() )
567 {
568 m_readOnlyAttr->IncRef();
569 return enhanceAttr( m_readOnlyAttr, aRow, aCol, aKind );
570 }
571 else
572 {
573 m_footprintAttr->IncRef();
574 return enhanceAttr( m_footprintAttr, aRow, aCol, aKind );
575 }
576 }
577 else if( field.GetId() == FIELD_T::DATASHEET )
578 {
579 m_urlAttr->IncRef();
580 return enhanceAttr( m_urlAttr, aRow, aCol, aKind );
581 }
582 else if( field.GetId() == FIELD_T::SHEET_NAME )
583 {
584 m_referenceAttr->IncRef();
585 return enhanceAttr( m_referenceAttr, aRow, aCol, aKind );
586 }
587 else if( field.GetId() == FIELD_T::SHEET_FILENAME )
588 {
589 m_filepathAttr->IncRef();
590 return enhanceAttr( m_filepathAttr, aRow, aCol, aKind );
591 }
593 && field.GetCanonicalName() == wxT( "Netclass" ) )
594 {
595 m_netclassAttr->IncRef();
596 return enhanceAttr( m_netclassAttr, aRow, aCol, aKind );
597 }
598 else
599 {
600 wxString fn = GetValue( aRow, FDC_NAME );
601
603
604 const TEMPLATE_FIELDNAME* templateFn =
605 settings ? settings->m_TemplateFieldNames.GetFieldName( fn ) : nullptr;
606
607 if( ( templateFn && templateFn->m_URL ) || field.IsHypertext() )
608 {
609 m_urlAttr->IncRef();
610 return enhanceAttr( m_urlAttr, aRow, aCol, aKind );
611 }
612 else
613 {
614 m_nonUrlAttr->IncRef();
615 return enhanceAttr( m_nonUrlAttr, aRow, aCol, aKind );
616 }
617 }
618
619 case FDC_TEXT_SIZE:
620 case FDC_POSX:
621 case FDC_POSY:
622 return enhanceAttr( nullptr, aRow, aCol, aKind );
623
624 case FDC_H_ALIGN:
625 m_hAlignAttr->IncRef();
626 return enhanceAttr( m_hAlignAttr, aRow, aCol, aKind );
627
628 case FDC_V_ALIGN:
629 m_vAlignAttr->IncRef();
630 return enhanceAttr( m_vAlignAttr, aRow, aCol, aKind );
631
632 case FDC_ORIENTATION:
633 m_orientationAttr->IncRef();
634 return enhanceAttr( m_orientationAttr, aRow, aCol, aKind );
635
636 case FDC_SHOWN:
637 case FDC_SHOW_NAME:
638 case FDC_ITALIC:
639 case FDC_BOLD:
641 case FDC_PRIVATE:
642 m_boolAttr->IncRef();
643 return enhanceAttr( m_boolAttr, aRow, aCol, aKind );
644
645 case FDC_FONT:
646 m_fontAttr->IncRef();
647 return enhanceAttr( m_fontAttr, aRow, aCol, aKind );
648
649 case FDC_COLOR:
650 m_colorAttr->IncRef();
651 return enhanceAttr( m_colorAttr, aRow, aCol, aKind );
652
653 default:
654 wxFAIL;
655 return enhanceAttr( nullptr, aRow, aCol, aKind );
656 }
657}
658
659
660wxString FIELDS_GRID_TABLE::GetValue( int aRow, int aCol )
661{
662 wxCHECK( aRow < GetNumberRows(), wxEmptyString );
663
664 wxGrid* grid = GetView();
665 const SCH_FIELD& field = getField( aRow );
666
667 if( grid->GetGridCursorRow() == aRow && grid->GetGridCursorCol() == aCol
668 && grid->IsCellEditControlShown() )
669 {
670 auto it = m_evalOriginal.find( { aRow, aCol } );
671
672 if( it != m_evalOriginal.end() )
673 return it->second;
674 }
675
676 switch( aCol )
677 {
678 case FDC_NAME:
679 // Use default field names for mandatory and system fields because they are translated
680 // according to the current locale
682 {
684 }
685 else
686 {
687 if( field.IsMandatory() )
688 return GetDefaultFieldName( field.GetId(), DO_TRANSLATE );
689 else
690 return field.GetName( false );
691 }
692
693 case FDC_VALUE:
694 return EscapeString( UnescapeString( field.GetText() ), CTX_LINE );
695
696 case FDC_SHOWN:
697 return StringFromBool( field.IsVisible() );
698
699 case FDC_SHOW_NAME:
700 return StringFromBool( field.IsNameShown() );
701
702 case FDC_H_ALIGN:
703 switch ( field.GetEffectiveHorizJustify() )
704 {
705 case GR_TEXT_H_ALIGN_LEFT: return _( "Left" );
706 case GR_TEXT_H_ALIGN_CENTER: return _( "Center" );
707 case GR_TEXT_H_ALIGN_RIGHT: return _( "Right" );
709 }
710
711 break;
712
713 case FDC_V_ALIGN:
714 switch ( field.GetEffectiveVertJustify() )
715 {
716 case GR_TEXT_V_ALIGN_TOP: return _( "Top" );
717 case GR_TEXT_V_ALIGN_CENTER: return _( "Center" );
718 case GR_TEXT_V_ALIGN_BOTTOM: return _( "Bottom" );
720 }
721
722 break;
723
724 case FDC_ITALIC:
725 return StringFromBool( field.IsItalic() );
726
727 case FDC_BOLD:
728 return StringFromBool( field.IsBold() );
729
730 case FDC_TEXT_SIZE:
731 return m_frame->StringFromValue( field.GetTextHeight(), true );
732
733 case FDC_ORIENTATION:
734 if( field.GetTextAngle().IsHorizontal() )
735 return _( "Horizontal" );
736 else
737 return _( "Vertical" );
738
739 case FDC_POSX:
740 return m_frame->StringFromValue( field.GetTextPos().x, true );
741
742 case FDC_POSY:
743 return m_frame->StringFromValue( field.GetTextPos().y, true );
744
745 case FDC_FONT:
746 if( field.GetFont() )
747 return field.GetFont()->GetName();
748 else
749 return DEFAULT_FONT_NAME;
750
751 case FDC_COLOR:
752 return field.GetTextColor().ToCSSString();
753
755 return StringFromBool( field.CanAutoplace() );
756
757 case FDC_PRIVATE:
758 return StringFromBool( field.IsPrivate() );
759
760 default:
761 // we can't assert here because wxWidgets sometimes calls this without checking
762 // the column type when trying to see if there's an overflow
763 break;
764 }
765
766 return wxT( "bad wxWidgets!" );
767}
768
769
770bool FIELDS_GRID_TABLE::GetValueAsBool( int aRow, int aCol )
771{
772 wxCHECK( aRow < GetNumberRows(), false );
773 const SCH_FIELD& field = getField( aRow );
774
775 switch( aCol )
776 {
777 case FDC_SHOWN: return field.IsVisible();
778 case FDC_SHOW_NAME: return field.IsNameShown();
779 case FDC_ITALIC: return field.IsItalic();
780 case FDC_BOLD: return field.IsBold();
781 case FDC_ALLOW_AUTOPLACE: return field.CanAutoplace();
782 case FDC_PRIVATE: return field.IsPrivate();
783 default:
784 wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) );
785 return false;
786 }
787}
788
789
790void FIELDS_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
791{
792 wxCHECK( aRow < GetNumberRows(), /*void*/ );
793 SCH_FIELD& field = getField( aRow );
794 VECTOR2I pos;
795 wxString value = aValue;
796
797 switch( aCol )
798 {
799 case FDC_TEXT_SIZE:
800 case FDC_POSX:
801 case FDC_POSY:
802 m_eval->SetDefaultUnits( m_frame->GetUserUnits() );
803
804 if( m_eval->Process( value ) )
805 {
806 m_evalOriginal[ { aRow, aCol } ] = value;
807 value = m_eval->Result();
808 }
809
810 break;
811
812 default:
813 break;
814 }
815
816 switch( aCol )
817 {
818 case FDC_NAME:
819 field.SetName( value );
820 break;
821
822 case FDC_VALUE:
823 {
824 if( m_parentType == SCH_SHEET_T && field.GetId() == FIELD_T::SHEET_FILENAME )
825 {
827 }
828 else if( m_parentType == LIB_SYMBOL_T && field.GetId() == FIELD_T::VALUE )
829 {
830 value = EscapeString( value, CTX_LIBID );
831 }
832
833 field.SetText( UnescapeString( value ) );
834 break;
835 }
836
837 case FDC_SHOWN:
838 field.SetVisible( BoolFromString( value ) );
839 break;
840
841 case FDC_SHOW_NAME:
842 field.SetNameShown( BoolFromString( value ) );
843 break;
844
845 case FDC_H_ALIGN:
846 {
847 GR_TEXT_H_ALIGN_T horizontalJustification = GR_TEXT_H_ALIGN_CENTER;
848
849 if( value == _( "Left" ) )
850 horizontalJustification = GR_TEXT_H_ALIGN_LEFT;
851 else if( value == _( "Center" ) )
852 horizontalJustification = GR_TEXT_H_ALIGN_CENTER;
853 else if( value == _( "Right" ) )
854 horizontalJustification = GR_TEXT_H_ALIGN_RIGHT;
855 else
856 wxFAIL_MSG( wxT( "unknown horizontal alignment: " ) + value );
857
858 // Note that we must set justifications before we can ask if they're flipped. If the old
859 // justification is center then it won't know (whereas if the new justification is center
860 // the we don't care).
861 field.SetHorizJustify( horizontalJustification );
862
863 if( field.IsHorizJustifyFlipped() )
864 field.SetHorizJustify( EDA_TEXT::MapHorizJustify( - horizontalJustification ) );
865
866 break;
867 }
868
869 case FDC_V_ALIGN:
870 {
871 GR_TEXT_V_ALIGN_T verticalJustification = GR_TEXT_V_ALIGN_BOTTOM;
872
873 if( value == _( "Top" ) )
874 verticalJustification = GR_TEXT_V_ALIGN_TOP;
875 else if( value == _( "Center" ) )
876 verticalJustification = GR_TEXT_V_ALIGN_CENTER;
877 else if( value == _( "Bottom" ) )
878 verticalJustification = GR_TEXT_V_ALIGN_BOTTOM;
879 else
880 wxFAIL_MSG( wxT( "unknown vertical alignment: " ) + value);
881
882 // Note that we must set justifications before we can ask if they're flipped. If the old
883 // justification is center then it won't know (whereas if the new justification is center
884 // the we don't care).
885 field.SetVertJustify( verticalJustification );
886
887 if( field.IsVertJustifyFlipped() )
888 field.SetVertJustify( EDA_TEXT::MapVertJustify( -verticalJustification ) );
889
890 break;
891 }
892
893 case FDC_ITALIC:
894 field.SetItalic( BoolFromString( value ) );
895 break;
896
897 case FDC_BOLD:
898 field.SetBold( BoolFromString( value ) );
899 break;
900
901 case FDC_TEXT_SIZE:
903 m_frame->ValueFromString( value ) ) );
904 break;
905
906 case FDC_ORIENTATION:
907 if( value == _( "Horizontal" ) )
909 else if( value == _( "Vertical" ) )
911 else
912 wxFAIL_MSG( wxT( "unknown orientation: " ) + value );
913
914 break;
915
916 case FDC_POSX:
917 case FDC_POSY:
918 pos = field.GetTextPos();
919
920 if( aCol == FDC_POSX )
921 pos.x = m_frame->ValueFromString( value );
922 else
923 pos.y = m_frame->ValueFromString( value );
924
925 field.SetTextPos( pos );
926 break;
927
928 case FDC_FONT:
929 if( value == DEFAULT_FONT_NAME )
930 field.SetFont( nullptr );
931 else if( value == KICAD_FONT_NAME )
932 field.SetFont( KIFONT::FONT::GetFont( wxEmptyString, field.IsBold(),
933 field.IsItalic() ) );
934 else
935 field.SetFont( KIFONT::FONT::GetFont( aValue, field.IsBold(), field.IsItalic() ) );
936
937 break;
938
939 case FDC_COLOR:
940 field.SetTextColor( wxColor( value ) );
941 break;
942
944 field.SetCanAutoplace( BoolFromString( value ) );
945 break;
946
947 case FDC_PRIVATE:
948 field.SetPrivate( BoolFromString( value ) );
949 break;
950
951 default:
952 wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a string value" ), aCol ) );
953 break;
954 }
955
957
958 GetView()->Refresh();
959}
960
961
962void FIELDS_GRID_TABLE::SetValueAsBool( int aRow, int aCol, bool aValue )
963{
964 wxCHECK( aRow < GetNumberRows(), /*void*/ );
965 SCH_FIELD& field = getField( aRow );
966
967 switch( aCol )
968 {
969 case FDC_SHOWN:
970 field.SetVisible( aValue );
971 break;
972
973 case FDC_SHOW_NAME:
974 field.SetNameShown( aValue );
975 break;
976
977 case FDC_ITALIC:
978 field.SetItalic( aValue );
979 break;
980
981 case FDC_BOLD:
982 field.SetBold( aValue );
983 break;
984
986 field.SetCanAutoplace( aValue );
987 break;
988
989 case FDC_PRIVATE:
990 field.SetPrivate( aValue );
991 break;
992
993 default:
994 wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) );
995 break;
996 }
997
999}
1000
1001
1002wxString FIELDS_GRID_TABLE::StringFromBool( bool aValue ) const
1003{
1004 if( aValue )
1005 return wxT( "1" );
1006 else
1007 return wxT( "0" );
1008}
1009
1010
1011bool FIELDS_GRID_TABLE::BoolFromString( const wxString& aValue ) const
1012{
1013 if( aValue == wxS( "1" ) )
1014 {
1015 return true;
1016 }
1017 else if( aValue == wxS( "0" ) )
1018 {
1019 return false;
1020 }
1021 else
1022 {
1023 wxFAIL_MSG( wxString::Format( "string '%s' can't be converted to boolean correctly and "
1024 "will be perceived as FALSE", aValue ) );
1025 return false;
1026 }
1027}
1028
1029
1031{
1032 for( SCH_FIELD& field : *this )
1033 {
1034 if( field.GetId() == aFieldId )
1035 return &field;
1036 }
1037
1038 return nullptr;
1039}
1040
1041
1043{
1044 for( int ii = 0; ii < (int) this->size(); ++ii )
1045 {
1046 if( this->at( ii ).GetId() == aFieldId )
1047 return ii;
1048 }
1049
1050 return -1;
1051}
1052
1053
1055{
1056 for( SCH_FIELD& field : *this )
1057 field.SetParent( nullptr );
1058}
1059
1060
1062{
1063 return static_cast<FIELDS_GRID_TABLE*>( m_grid->GetTable() )->GetFieldRow( aFieldId );
1064}
1065
1066
1067void FIELDS_GRID_TRICKS::showPopupMenu( wxMenu& menu, wxGridEvent& aEvent )
1068{
1069 if( m_grid->GetGridCursorRow() == getFieldRow( FIELD_T::FOOTPRINT )
1070 && m_grid->GetGridCursorCol() == FDC_VALUE
1071 && !m_grid->IsReadOnly( getFieldRow( FIELD_T::FOOTPRINT ), FDC_VALUE ) )
1072 {
1073 menu.Append( MYID_SELECT_FOOTPRINT, _( "Select Footprint..." ),
1074 _( "Browse for footprint" ) );
1075 menu.AppendSeparator();
1076 }
1077 else if( m_grid->GetGridCursorRow() == getFieldRow( FIELD_T::DATASHEET )
1078 && m_grid->GetGridCursorCol() == FDC_VALUE
1079 && !m_grid->IsReadOnly( getFieldRow( FIELD_T::DATASHEET ), FDC_VALUE ) )
1080 {
1081 menu.Append( MYID_SHOW_DATASHEET, _( "Show Datasheet" ),
1082 _( "Show datasheet in browser" ) );
1083 menu.AppendSeparator();
1084 }
1085
1086 GRID_TRICKS::showPopupMenu( menu, aEvent );
1087}
1088
1089
1090void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
1091{
1092 if( event.GetId() == MYID_SELECT_FOOTPRINT )
1093 {
1094 // pick a footprint using the footprint picker.
1095 wxString fpid = m_grid->GetCellValue( getFieldRow( FIELD_T::FOOTPRINT ), FDC_VALUE );
1096
1097 if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg ) )
1098 {
1099 if( frame->ShowModal( &fpid, m_dlg ) )
1100 m_grid->SetCellValue( getFieldRow( FIELD_T::FOOTPRINT ), FDC_VALUE, fpid );
1101
1102 frame->Destroy();
1103 }
1104 }
1105 else if (event.GetId() == MYID_SHOW_DATASHEET )
1106 {
1107 wxString datasheet_uri = m_grid->GetCellValue( getFieldRow( FIELD_T::DATASHEET ), FDC_VALUE );
1108
1109 GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj(),
1111 }
1112 else
1113 {
1115 }
1116}
1117
1118
const char * name
Definition: DXF_plotter.cpp:59
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:52
void OnModify()
bool IsHorizontal() const
Definition: eda_angle.h:138
FRAME_T GetFrameType() const
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:110
int GetTextHeight() const
Definition: eda_text.h:254
void SetTextColor(const COLOR4D &aColor)
Definition: eda_text.h:256
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:260
COLOR4D GetTextColor() const
Definition: eda_text.h:257
bool IsItalic() const
Definition: eda_text.h:156
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:134
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
Definition: eda_text.cpp:526
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:98
virtual bool IsVisible() const
Definition: eda_text.h:174
void SetTextPos(const VECTOR2I &aPoint)
Definition: eda_text.cpp:571
KIFONT::FONT * GetFont() const
Definition: eda_text.h:234
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:410
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:379
static GR_TEXT_H_ALIGN_T MapHorizJustify(int aHorizJustify)
Definition: eda_text.cpp:67
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
Definition: eda_text.cpp:328
bool IsBold() const
Definition: eda_text.h:171
static GR_TEXT_V_ALIGN_T MapVertJustify(int aVertJustify)
Definition: eda_text.cpp:81
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:292
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
Definition: eda_text.cpp:300
void SetFont(KIFONT::FONT *aFont)
Definition: eda_text.cpp:492
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:402
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
SCH_FIELD * GetField(FIELD_T aFieldId)
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
int GetMandatoryRowCount() const
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
int getVisibleRowCount() const
DIALOG_SHIM * m_dialog
wxGridCellAttr * m_footprintAttr
wxGridCellAttr * m_boolAttr
int GetFieldRow(FIELD_T aFieldId)
bool BoolFromString(const wxString &aValue) const
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
EMBEDDED_FILES * m_files
wxGridCellAttr * m_filepathAttr
SCH_FIELD & getField(int aRow)
wxGridCellAttr * m_netclassAttr
void SetValueAsBool(int aRow, int aCol, bool aValue) override
FIELDS_GRID_TABLE(DIALOG_SHIM *aDialog, SCH_BASE_FRAME *aFrame, WX_GRID *aGrid, LIB_SYMBOL *aSymbol, EMBEDDED_FILES *aFiles=nullptr)
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
void showPopupMenu(wxMenu &menu, wxGridEvent &aEvent) override
int getFieldRow(FIELD_T aFieldId)
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:147
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:85
std::vector< SCH_PIN * > GetPins(int aUnit, int aBodyStyle) const
Return a list of pin object pointers from the draw item list.
Definition: lib_symbol.cpp:797
bool IsPower() const override
Definition: lib_symbol.cpp:467
wxArrayString GetFPFilters() const
Definition: lib_symbol.h:218
EMBEDDED_FILES * GetEmbeddedFiles() override
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:73
SCHEMATIC_SETTINGS * m_SchematicSettings
Definition: project_file.h:151
std::shared_ptr< NET_SETTINGS > & NetSettings()
Definition: project_file.h:104
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:146
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:203
These are loaded from Eeschema settings but then overwritten by the project settings.
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition: schematic.cpp:871
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.
GR_TEXT_V_ALIGN_T GetEffectiveVertJustify() const
Definition: sch_field.cpp:627
bool IsMandatory() const
Definition: sch_field.cpp:1328
bool IsNameShown() const
Definition: sch_field.h:208
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_field.h:96
bool IsHorizJustifyFlipped() const
Return whether the field will be rendered with the horizontal justification inverted due to rotation ...
Definition: sch_field.cpp:527
bool IsVertJustifyFlipped() const
Definition: sch_field.cpp:584
FIELD_T GetId() const
Definition: sch_field.h:124
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:1090
GR_TEXT_H_ALIGN_T GetEffectiveHorizJustify() const
Definition: sch_field.cpp:570
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Definition: sch_field.cpp:1076
void SetName(const wxString &aName)
Definition: sch_field.cpp:1051
bool CanAutoplace() const
Definition: sch_field.h:219
void SetText(const wxString &aText) override
Definition: sch_field.cpp:1061
void OnScintillaCharAdded(SCINTILLA_TRICKS *aScintillaTricks, wxStyledTextEvent &aEvent) const
Definition: sch_field.cpp:697
void SetNameShown(bool aShown=true)
Definition: sch_field.h:209
void SetPrivate(bool aPrivate)
Definition: sch_item.h:245
bool IsPrivate() const
Definition: sch_item.h:246
static const wxString GetDefaultFieldName(const wxString &aName, bool aUseDefaultName)
Definition: sch_label.cpp:202
SCHEMATIC * Schematic() const
Definition: sch_screen.cpp:102
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:47
Schematic symbol object.
Definition: sch_symbol.h:75
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:183
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
Look for files in a number of paths.
Definition: search_stack.h:43
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:425
#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_SCH_EDIT_COUNT
@ FDC_POSY
@ FDC_ITALIC
@ FDC_SHOW_NAME
@ FDC_NAME
@ FDC_H_ALIGN
@ FDC_COLOR
@ FDC_SHOWN
@ FDC_ALLOW_AUTOPLACE
@ FDC_VALUE
@ FDC_SYMBOL_EDITOR_COUNT
@ FDC_POSX
@ FDC_ORIENTATION
@ FDC_V_ALIGN
@ FDC_FONT
@ FDC_PRIVATE
FONTCONFIG * Fontconfig()
Definition: fontconfig.cpp:104
@ 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
@ USER
The main config directory (e.g. ~/.config/kicad/)
#define KICAD_FONT_NAME
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:1071
see class PGM_BASE
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.
Definition for symbol library class.
wxString GetDefaultFieldName(FIELD_T aFieldId, bool aTranslateForHI)
Return a default symbol field name for a mandatory field type.
#define DO_TRANSLATE
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ SHEET_FILENAME
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
@ 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
This is API surface mapped to common.types.VertialAlignment.
@ 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.
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:695
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.