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 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 /*
67 * Symbol netlist format:
68 * pinNumber pinName <tab> pinNumber pinName...
69 * fpFilter fpFilter...
70 */
71 wxString netlist;
72
73 // We need the list of pins of the lib symbol, not just the pins of the current
74 // sch symbol, that can be just an unit of a multi-unit symbol, to be able to
75 // select/filter right footprints
76 wxArrayString pins;
77
78 const std::unique_ptr< LIB_SYMBOL >& lib_symbol = aSymbol->GetLibSymbolRef();
79
80 if( lib_symbol )
81 {
82 for( SCH_PIN* pin : lib_symbol->GetGraphicalPins( 0 /* all units */, 1 /* single bodyStyle */ ) )
83 {
84 bool valid = false;
85 std::vector<wxString> expanded = pin->GetStackedPinNumbers( &valid );
86
87 if( valid && !expanded.empty() )
88 {
89 for( const wxString& num : expanded )
90 pins.push_back( num + ' ' + pin->GetShownName() );
91 }
92 else
93 {
94 pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
95 }
96 }
97 }
98
99 if( !pins.IsEmpty() )
100 {
101 wxString dbg = wxJoin( pins, '\t' );
102 wxLogTrace( "FOOTPRINT_CHOOSER", wxS( "Chooser payload pins: %s" ), dbg );
103 netlist << EscapeString( dbg, CTX_LINE );
104 }
105
106 netlist << wxS( "\r" );
107
108 if( lib_symbol )
109 {
110 wxArrayString fpFilters = lib_symbol->GetFPFilters();
111
112 if( !fpFilters.IsEmpty() )
113 netlist << EscapeString( wxJoin( fpFilters, ' ' ), CTX_LINE );
114 }
115
116 netlist << wxS( "\r" );
117
118 return netlist;
119}
120
121
122static wxString netList( LIB_SYMBOL* aSymbol )
123{
124 /*
125 * Symbol netlist format:
126 * pinNumber pinName <tab> pinNumber pinName...
127 * fpFilter fpFilter...
128 */
129 wxString netlist;
130 wxArrayString pins;
131
132 for( SCH_PIN* pin : aSymbol->GetGraphicalPins( 0 /* all units */, 1 /* single bodyStyle */ ) )
133 {
134 bool valid = false;
135 std::vector<wxString> expanded = pin->GetStackedPinNumbers( &valid );
136
137 if( valid && !expanded.empty() )
138 {
139 for( const wxString& num : expanded )
140 pins.push_back( num + ' ' + pin->GetShownName() );
141 }
142 else
143 {
144 pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
145 }
146 }
147
148 if( !pins.IsEmpty() )
149 {
150 wxString dbg = wxJoin( pins, '\t' );
151 wxLogTrace( "FOOTPRINT_CHOOSER", wxS( "Chooser payload pins: %s" ), dbg );
152 netlist << EscapeString( dbg, CTX_LINE );
153 }
154
155 netlist << wxS( "\r" );
156
157 wxArrayString fpFilters = aSymbol->GetFPFilters();
158
159 if( !fpFilters.IsEmpty() )
160 netlist << EscapeString( wxJoin( fpFilters, ' ' ), CTX_LINE );
161
162 netlist << wxS( "\r" );
163
164 return netlist;
165}
166
167
169 LIB_SYMBOL* aSymbol, std::vector<EMBEDDED_FILES*> aFilesStack ) :
170 m_frame( aFrame ),
171 m_dialog( aDialog ),
173 m_part( aSymbol ),
174 m_filesStack( aFilesStack ),
175 m_symbolNetlist( netList( aSymbol ) ),
182{
183 initGrid( aGrid );
184}
185
186
188 SCH_SYMBOL* aSymbol ) :
189 m_frame( aFrame ),
190 m_dialog( aDialog ),
192 m_part( aSymbol->GetLibSymbolRef().get() ),
193 m_symbolNetlist( netList( aSymbol, aFrame->GetCurrentSheet() ) ),
200{
201 m_filesStack.push_back( aSymbol->Schematic() );
202
203 if( m_part )
204 m_filesStack.push_back( m_part );
205
206 initGrid( aGrid );
207}
208
209
211 SCH_SHEET* aSheet ) :
212 m_frame( aFrame ),
213 m_dialog( aDialog ),
215 m_part( nullptr ),
222{
223 m_filesStack.push_back( aSheet->Schematic() );
224
225 initGrid( aGrid );
226}
227
228
230 SCH_LABEL_BASE* aLabel ) :
231 m_frame( aFrame ),
232 m_dialog( aDialog ),
234 m_part( nullptr ),
241{
242 m_filesStack.push_back( aLabel->Schematic() );
243
244 initGrid( aGrid );
245}
246
247
249{
250 int mandatoryRows = 0;
251
252 for( const SCH_FIELD& field : *this )
253 {
254 if( field.IsMandatory() )
255 mandatoryRows++;
256 }
257
258 return mandatoryRows;
259}
260
261
263{
264 std::vector<SCH_FIELD>::push_back( aField );
265
266 m_isInherited.resize( size() );
267 m_parentFields.resize( size() );
268}
269
270
272{
273 // Build the various grid cell attributes.
274 // NOTE: validators and cellAttrs are member variables to get the destruction order
275 // right. wxGrid is VERY cranky about this.
276
277 m_readOnlyAttr = new wxGridCellAttr;
278 m_readOnlyAttr->SetReadOnly( true );
279
280 m_fieldNameAttr = new wxGridCellAttr;
282 nameEditor->SetValidator( m_fieldNameValidator );
283 m_fieldNameAttr->SetEditor( nameEditor );
284
285 m_referenceAttr = new wxGridCellAttr;
286 GRID_CELL_TEXT_EDITOR* referenceEditor = new GRID_CELL_TEXT_EDITOR();
287 referenceEditor->SetValidator( m_referenceValidator );
288 m_referenceAttr->SetEditor( referenceEditor );
289
290 m_valueAttr = new wxGridCellAttr;
291
293 {
294 GRID_CELL_TEXT_EDITOR* valueEditor = new GRID_CELL_TEXT_EDITOR();
295 valueEditor->SetValidator( m_valueValidator );
296 m_valueAttr->SetEditor( valueEditor );
297 }
298 else
299 {
300 GRID_CELL_STC_EDITOR* valueEditor = new GRID_CELL_STC_EDITOR( true, true,
301 [this]( wxStyledTextEvent& aEvent, SCINTILLA_TRICKS* aScintillaTricks )
302 {
303 SCH_FIELD* valueField = this->GetField( FIELD_T::VALUE );
304 valueField->OnScintillaCharAdded( aScintillaTricks, aEvent );
305 } );
306
307 m_valueAttr->SetEditor( valueEditor );
308 }
309
310 m_footprintAttr = new wxGridCellAttr;
312 fpIdEditor->SetValidator( m_nonUrlValidator );
313 m_footprintAttr->SetEditor( fpIdEditor );
314
315 m_urlAttr = new wxGridCellAttr;
316 SEARCH_STACK* prjSearchStack = PROJECT_SCH::SchSearchS( &m_frame->Prj() );
317 GRID_CELL_URL_EDITOR* urlEditor = new GRID_CELL_URL_EDITOR( m_dialog, prjSearchStack, m_filesStack );
318 urlEditor->SetValidator( m_urlValidator );
319 m_urlAttr->SetEditor( urlEditor );
320
321 m_nonUrlAttr = new wxGridCellAttr;
322 GRID_CELL_TEXT_EDITOR* nonUrlEditor = new GRID_CELL_TEXT_EDITOR();
323 nonUrlEditor->SetValidator( m_nonUrlValidator );
324 m_nonUrlAttr->SetEditor( nonUrlEditor );
325
326 m_curdir = m_frame->Prj().GetProjectPath();
327 m_filepathAttr = new wxGridCellAttr;
328
329 // Create a wild card using wxFileDialog syntax.
330 wxString wildCard( _( "Schematic Files" ) );
331 std::vector<std::string> exts;
332 exts.push_back( FILEEXT::KiCadSchematicFileExtension );
333 wildCard += AddFileExtListToFilter( exts );
334
335 auto filepathEditor = new GRID_CELL_PATH_EDITOR( m_dialog, aGrid, &m_curdir, wildCard );
336 filepathEditor->SetValidator( m_filepathValidator );
337 m_filepathAttr->SetEditor( filepathEditor );
338
339 m_boolAttr = new wxGridCellAttr;
340 m_boolAttr->SetRenderer( new wxGridCellBoolRenderer() );
341 m_boolAttr->SetEditor( new wxGridCellBoolEditor() );
342 m_boolAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
343
344 wxArrayString vAlignNames;
345 vAlignNames.Add( _( "Top" ) );
346 vAlignNames.Add( _( "Center" ) );
347 vAlignNames.Add( _( "Bottom" ) );
348 m_vAlignAttr = new wxGridCellAttr;
349 m_vAlignAttr->SetEditor( new wxGridCellChoiceEditor( vAlignNames ) );
350 m_vAlignAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
351
352 wxArrayString hAlignNames;
353 hAlignNames.Add( _( "Left" ) );
354 hAlignNames.Add(_( "Center" ) );
355 hAlignNames.Add(_( "Right" ) );
356 m_hAlignAttr = new wxGridCellAttr;
357 m_hAlignAttr->SetEditor( new wxGridCellChoiceEditor( hAlignNames ) );
358 m_hAlignAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
359
360 wxArrayString orientationNames;
361 orientationNames.Add( _( "Horizontal" ) );
362 orientationNames.Add(_( "Vertical" ) );
363 m_orientationAttr = new wxGridCellAttr;
364 m_orientationAttr->SetEditor( new wxGridCellChoiceEditor( orientationNames ) );
365 m_orientationAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
366
367 SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
368 wxArrayString existingNetclasses;
369
370 wxArrayString fonts;
371 std::vector<std::string> fontNames;
372
373 if( editFrame )
374 {
375 // Load the combobox with existing existingNetclassNames
376 PROJECT_FILE& projectFile = editFrame->Prj().GetProjectFile();
377 const std::shared_ptr<NET_SETTINGS>& settings = projectFile.NetSettings();
378
379 existingNetclasses.push_back( settings->GetDefaultNetclass()->GetName() );
380
381 for( const auto& [name, netclass] : settings->GetNetclasses() )
382 existingNetclasses.push_back( name );
383
384 // We don't need to re-cache the embedded fonts when looking at symbols in the schematic
385 // editor because the fonts are all available in the schematic.
386 const std::vector<wxString>* fontFiles = nullptr;
387
388 if( m_frame->GetScreen() && m_frame->GetScreen()->Schematic() )
389 fontFiles = m_frame->GetScreen()->Schematic()->GetEmbeddedFiles()->GetFontFiles();
390
391 Fontconfig()->ListFonts( fontNames, std::string( Pgm().GetLanguageTag().utf8_str() ),
392 fontFiles, false );
393 }
394 else
395 {
396 const std::vector<wxString>* fontFiles = m_part->GetEmbeddedFiles()->UpdateFontFiles();
397
398 // If there are font files embedded, we want to re-cache our fonts for each symbol that
399 // we are looking at in the symbol editor.
400 Fontconfig()->ListFonts( fontNames, std::string( Pgm().GetLanguageTag().utf8_str() ),
401 fontFiles, !fontFiles->empty() );
402 }
403
404 m_netclassAttr = new wxGridCellAttr;
405 m_netclassAttr->SetEditor( new GRID_CELL_COMBOBOX( existingNetclasses ) );
406
407 for( const std::string& name : fontNames )
408 fonts.Add( wxString( name ) );
409
410 fonts.Sort();
411 fonts.Insert( KICAD_FONT_NAME, 0 );
412 fonts.Insert( DEFAULT_FONT_NAME, 0 );
413
414 m_fontAttr = new wxGridCellAttr;
415 m_fontAttr->SetEditor( new GRID_CELL_COMBOBOX( fonts ) );
416
417 m_colorAttr = new wxGridCellAttr;
418 m_colorAttr->SetRenderer( new GRID_CELL_COLOR_RENDERER( m_dialog ) );
419 m_colorAttr->SetEditor( new GRID_CELL_COLOR_SELECTOR( m_dialog, aGrid ) );
420
421 m_eval = std::make_unique<NUMERIC_EVALUATOR>( m_frame->GetUserUnits() );
422
424
425 m_frame->Bind( EDA_EVT_UNITS_CHANGED, &FIELDS_GRID_TABLE::onUnitsChanged, this );
426}
427
428
430{
431 m_readOnlyAttr->DecRef();
432 m_fieldNameAttr->DecRef();
433 m_boolAttr->DecRef();
434 m_referenceAttr->DecRef();
435 m_valueAttr->DecRef();
436 m_footprintAttr->DecRef();
437 m_urlAttr->DecRef();
438 m_nonUrlAttr->DecRef();
439 m_filepathAttr->DecRef();
440 m_vAlignAttr->DecRef();
441 m_hAlignAttr->DecRef();
442 m_orientationAttr->DecRef();
443 m_netclassAttr->DecRef();
444 m_fontAttr->DecRef();
445 m_colorAttr->DecRef();
446
447 for( SCH_FIELD& field : m_parentFields )
448 field.SetParent( nullptr );
449
450 m_frame->Unbind( EDA_EVT_UNITS_CHANGED, &FIELDS_GRID_TABLE::onUnitsChanged, this );
451}
452
453
454void FIELDS_GRID_TABLE::onUnitsChanged( wxCommandEvent& aEvent )
455{
456 if( GetView() )
457 GetView()->ForceRefresh();
458
459 aEvent.Skip();
460}
461
462
464{
465 if( m_frame->GetFrameType() == FRAME_SCH
466 || m_frame->GetFrameType() == FRAME_SCH_VIEWER )
467 {
468 return FDC_SCH_EDIT_COUNT;
469 }
470 else
471 {
473 }
474}
475
476
478{
479 if( m_frame->GetFrameType() == FRAME_SCH
480 || m_frame->GetFrameType() == FRAME_SCH_VIEWER )
481 {
482 int visibleRows = 0;
483
484 for( const SCH_FIELD& field : *this )
485 {
486 if( !field.IsPrivate() )
487 visibleRows++;
488 }
489
490 return visibleRows;
491 }
492
493 return (int) this->size();
494}
495
496
498{
499 if( m_frame->GetFrameType() == FRAME_SCH
500 || m_frame->GetFrameType() == FRAME_SCH_VIEWER )
501 {
502 int visibleRow = 0;
503
504 for( SCH_FIELD& field : *this )
505 {
506 if( field.IsPrivate() )
507 continue;
508
509 if( visibleRow == aRow )
510 return field;
511
512 ++visibleRow;
513 }
514
515 wxFAIL_MSG( wxT( "Row index off end of visible row count" ) );
516 }
517
518 return this->at( aRow );
519}
520
521
523{
524 switch( aCol )
525 {
526 case FDC_NAME: return _( "Name" );
527 case FDC_VALUE: return _( "Value" );
528 case FDC_SHOWN: return _( "Show" );
529 case FDC_SHOW_NAME: return _( "Show Name" );
530 case FDC_H_ALIGN: return _( "H Align" );
531 case FDC_V_ALIGN: return _( "V Align" );
532 case FDC_ITALIC: return _( "Italic" );
533 case FDC_BOLD: return _( "Bold" );
534 case FDC_TEXT_SIZE: return _( "Text Size" );
535 case FDC_ORIENTATION: return _( "Orientation" );
536 case FDC_POSX: return _( "X Position" );
537 case FDC_POSY: return _( "Y Position" );
538 case FDC_FONT: return _( "Font" );
539 case FDC_COLOR: return _( "Color" );
540 case FDC_ALLOW_AUTOPLACE: return _( "Allow Autoplacement" );
541 case FDC_PRIVATE: return _( "Private" );
542 default: wxFAIL; return wxEmptyString;
543 }
544}
545
546
547bool FIELDS_GRID_TABLE::CanGetValueAs( int aRow, int aCol, const wxString& aTypeName )
548{
549 switch( aCol )
550 {
551 case FDC_NAME:
552 case FDC_VALUE:
553 case FDC_H_ALIGN:
554 case FDC_V_ALIGN:
555 case FDC_TEXT_SIZE:
556 case FDC_ORIENTATION:
557 case FDC_POSX:
558 case FDC_POSY:
559 case FDC_FONT:
560 case FDC_COLOR:
561 return aTypeName == wxGRID_VALUE_STRING;
562
563 case FDC_SHOWN:
564 case FDC_SHOW_NAME:
565 case FDC_ITALIC:
566 case FDC_BOLD:
568 case FDC_PRIVATE:
569 return aTypeName == wxGRID_VALUE_BOOL;
570
571 default:
572 wxFAIL;
573 return false;
574 }
575}
576
577
578bool FIELDS_GRID_TABLE::CanSetValueAs( int aRow, int aCol, const wxString& aTypeName )
579{
580 return CanGetValueAs( aRow, aCol, aTypeName );
581}
582
583
584wxGridCellAttr* FIELDS_GRID_TABLE::GetAttr( int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind )
585{
586 wxCHECK( aRow < GetNumberRows(), nullptr );
587
588 const SCH_FIELD& field = getField( aRow );
589 wxGridCellAttr* attr = nullptr;
590
591 switch( aCol )
592 {
593 case FDC_NAME:
594 if( field.IsMandatory() )
595 {
596 attr = m_fieldNameAttr->Clone();
597 attr->SetReadOnly( true );
598 }
599 else
600 {
601 m_fieldNameAttr->IncRef();
602 attr = m_fieldNameAttr;
603 }
604
605 break;
606
607 case FDC_VALUE:
608 if( field.GetId() == FIELD_T::REFERENCE )
609 {
610 m_referenceAttr->IncRef();
611 attr = m_referenceAttr;
612 }
613 else if( field.GetId() == FIELD_T::VALUE )
614 {
615 m_valueAttr->IncRef();
616 attr = m_valueAttr;
617 }
618 else if( field.GetId() == FIELD_T::FOOTPRINT )
619 {
620 // Power symbols have do not appear in the board, so don't allow
621 // a footprint (m_part can be nullptr when loading a old schematic
622 // (for instance Kicad 4) with libraries missing)
623 if( m_part && m_part->IsPower() )
624 {
625 m_readOnlyAttr->IncRef();
626 attr = m_readOnlyAttr;
627 }
628 else
629 {
630 m_footprintAttr->IncRef();
631 attr = m_footprintAttr;
632 }
633 }
634 else if( field.GetId() == FIELD_T::DATASHEET )
635 {
636 m_urlAttr->IncRef();
637 attr = m_urlAttr;
638 }
639 else if( field.GetId() == FIELD_T::SHEET_NAME )
640 {
641 m_referenceAttr->IncRef();
642 attr = m_referenceAttr;
643 }
644 else if( field.GetId() == FIELD_T::SHEET_FILENAME )
645 {
646 m_filepathAttr->IncRef();
647 attr = m_filepathAttr;
648 }
650 && field.GetCanonicalName() == wxT( "Netclass" ) )
651 {
652 m_netclassAttr->IncRef();
653 attr = m_netclassAttr;
654 }
655 else
656 {
657 wxString fn = GetValue( aRow, FDC_NAME );
658
659 SCHEMATIC_SETTINGS* settings = m_frame->Prj().GetProjectFile().m_SchematicSettings;
660
661 const TEMPLATE_FIELDNAME* templateFn =
662 settings ? settings->m_TemplateFieldNames.GetFieldName( fn ) : nullptr;
663
664 if( ( templateFn && templateFn->m_URL ) || field.IsHypertext() )
665 {
666 m_urlAttr->IncRef();
667 attr = m_urlAttr;
668 }
669 else
670 {
671 m_nonUrlAttr->IncRef();
672 attr = m_nonUrlAttr;
673 }
674 }
675
676 break;
677
678 case FDC_TEXT_SIZE:
679 case FDC_POSX:
680 case FDC_POSY:
681 break;
682
683 case FDC_H_ALIGN:
684 m_hAlignAttr->IncRef();
685 attr = m_hAlignAttr;
686 break;
687
688 case FDC_V_ALIGN:
689 m_vAlignAttr->IncRef();
690 attr = m_vAlignAttr;
691 break;
692
693 case FDC_ORIENTATION:
694 m_orientationAttr->IncRef();
695 attr = m_orientationAttr;
696 break;
697
698 case FDC_SHOWN:
699 case FDC_SHOW_NAME:
700 case FDC_ITALIC:
701 case FDC_BOLD:
703 case FDC_PRIVATE:
704 m_boolAttr->IncRef();
705 attr = m_boolAttr;
706 break;
707
708 case FDC_FONT:
709 m_fontAttr->IncRef();
710 attr = m_fontAttr;
711 break;
712
713 case FDC_COLOR:
714 m_colorAttr->IncRef();
715 attr = m_colorAttr;
716 break;
717
718 default:
719 attr = nullptr;
720 break;
721 }
722
723 if( !attr )
724 return nullptr;
725
726 attr = enhanceAttr( attr, aRow, aCol, aKind );
727
728 if( IsInherited( aRow ) )
729 {
730 wxGridCellAttr* text_attr = attr ? attr->Clone() : new wxGridCellAttr;
731 wxFont font;
732
733 if( !text_attr->HasFont() )
734 font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
735 else
736 font = text_attr->GetFont();
737
738 font.MakeItalic();
739 text_attr->SetFont( font );
740 text_attr->SetTextColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
741
742 if( attr )
743 attr->DecRef();
744
745 attr = text_attr;
746 }
747
748 return attr;
749}
750
751
752wxString FIELDS_GRID_TABLE::GetValue( int aRow, int aCol )
753{
754 wxCHECK( aRow < GetNumberRows(), wxEmptyString );
755
756 wxGrid* grid = GetView();
757 const SCH_FIELD& field = getField( aRow );
758
759 if( grid->GetGridCursorRow() == aRow && grid->GetGridCursorCol() == aCol
760 && grid->IsCellEditControlShown() )
761 {
762 auto it = m_evalOriginal.find( { aRow, aCol } );
763
764 if( it != m_evalOriginal.end() )
765 return it->second;
766 }
767
768 switch( aCol )
769 {
770 case FDC_NAME:
771 // Use default field names for mandatory and system fields because they are translated
772 // according to the current locale
774 {
776 }
777 else
778 {
779 if( field.IsMandatory() )
780 return GetDefaultFieldName( field.GetId(), DO_TRANSLATE );
781 else
782 return field.GetName( false );
783 }
784
785 case FDC_VALUE:
786 return EscapeString( UnescapeString( field.GetText() ), CTX_LINE );
787
788 case FDC_SHOWN:
789 return StringFromBool( field.IsVisible() );
790
791 case FDC_SHOW_NAME:
792 return StringFromBool( field.IsNameShown() );
793
794 case FDC_H_ALIGN:
795 switch ( field.GetEffectiveHorizJustify() )
796 {
797 case GR_TEXT_H_ALIGN_LEFT: return _( "Left" );
798 case GR_TEXT_H_ALIGN_CENTER: return _( "Center" );
799 case GR_TEXT_H_ALIGN_RIGHT: return _( "Right" );
801 }
802
803 break;
804
805 case FDC_V_ALIGN:
806 switch ( field.GetEffectiveVertJustify() )
807 {
808 case GR_TEXT_V_ALIGN_TOP: return _( "Top" );
809 case GR_TEXT_V_ALIGN_CENTER: return _( "Center" );
810 case GR_TEXT_V_ALIGN_BOTTOM: return _( "Bottom" );
812 }
813
814 break;
815
816 case FDC_ITALIC:
817 return StringFromBool( field.IsItalic() );
818
819 case FDC_BOLD:
820 return StringFromBool( field.IsBold() );
821
822 case FDC_TEXT_SIZE:
823 return m_frame->StringFromValue( field.GetTextHeight(), true );
824
825 case FDC_ORIENTATION:
826 if( field.GetTextAngle().IsHorizontal() )
827 return _( "Horizontal" );
828 else
829 return _( "Vertical" );
830
831 case FDC_POSX:
832 return m_frame->StringFromValue( field.GetTextPos().x, true );
833
834 case FDC_POSY:
835 return m_frame->StringFromValue( field.GetTextPos().y, true );
836
837 case FDC_FONT:
838 if( field.GetFont() )
839 return field.GetFont()->GetName();
840 else
841 return DEFAULT_FONT_NAME;
842
843 case FDC_COLOR:
844 return field.GetTextColor().ToCSSString();
845
847 return StringFromBool( field.CanAutoplace() );
848
849 case FDC_PRIVATE:
850 return StringFromBool( field.IsPrivate() );
851
852 default:
853 // we can't assert here because wxWidgets sometimes calls this without checking
854 // the column type when trying to see if there's an overflow
855 break;
856 }
857
858 return wxT( "bad wxWidgets!" );
859}
860
861
862bool FIELDS_GRID_TABLE::GetValueAsBool( int aRow, int aCol )
863{
864 wxCHECK( aRow < GetNumberRows(), false );
865 const SCH_FIELD& field = getField( aRow );
866
867 switch( aCol )
868 {
869 case FDC_SHOWN: return field.IsVisible();
870 case FDC_SHOW_NAME: return field.IsNameShown();
871 case FDC_ITALIC: return field.IsItalic();
872 case FDC_BOLD: return field.IsBold();
873 case FDC_ALLOW_AUTOPLACE: return field.CanAutoplace();
874 case FDC_PRIVATE: return field.IsPrivate();
875 default:
876 wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) );
877 return false;
878 }
879}
880
881
882void FIELDS_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
883{
884 wxCHECK( aRow < GetNumberRows(), /*void*/ );
885 SCH_FIELD& field = getField( aRow );
886 VECTOR2I pos;
887 wxString value = aValue;
888
889 switch( aCol )
890 {
891 case FDC_TEXT_SIZE:
892 case FDC_POSX:
893 case FDC_POSY:
894 m_eval->SetDefaultUnits( m_frame->GetUserUnits() );
895
896 if( m_eval->Process( value ) )
897 {
898 m_evalOriginal[ { aRow, aCol } ] = value;
899 value = m_eval->Result();
900 }
901
902 break;
903
904 default:
905 break;
906 }
907
908 switch( aCol )
909 {
910 case FDC_NAME:
911 field.SetName( value );
912 break;
913
914 case FDC_VALUE:
915 {
917 {
919 }
920 else if( m_parentType == LIB_SYMBOL_T && field.GetId() == FIELD_T::VALUE )
921 {
922 value = EscapeString( value, CTX_LIBID );
923 }
924
925 field.SetText( UnescapeString( value ) );
926 break;
927 }
928
929 case FDC_SHOWN:
930 field.SetVisible( BoolFromString( value ) );
931 break;
932
933 case FDC_SHOW_NAME:
934 field.SetNameShown( BoolFromString( value ) );
935 break;
936
937 case FDC_H_ALIGN:
938 {
939 GR_TEXT_H_ALIGN_T horizontalJustification = GR_TEXT_H_ALIGN_CENTER;
940
941 if( value == _( "Left" ) )
942 horizontalJustification = GR_TEXT_H_ALIGN_LEFT;
943 else if( value == _( "Center" ) )
944 horizontalJustification = GR_TEXT_H_ALIGN_CENTER;
945 else if( value == _( "Right" ) )
946 horizontalJustification = GR_TEXT_H_ALIGN_RIGHT;
947
948 // Note that we must set justifications before we can ask if they're flipped. If the old
949 // justification is center then it won't know (whereas if the new justification is center
950 // the we don't care).
951 field.SetHorizJustify( horizontalJustification );
952
953 if( field.IsHorizJustifyFlipped() )
954 field.SetHorizJustify( EDA_TEXT::MapHorizJustify( - horizontalJustification ) );
955
956 break;
957 }
958
959 case FDC_V_ALIGN:
960 {
961 GR_TEXT_V_ALIGN_T verticalJustification = GR_TEXT_V_ALIGN_BOTTOM;
962
963 if( value == _( "Top" ) )
964 verticalJustification = GR_TEXT_V_ALIGN_TOP;
965 else if( value == _( "Center" ) )
966 verticalJustification = GR_TEXT_V_ALIGN_CENTER;
967 else if( value == _( "Bottom" ) )
968 verticalJustification = GR_TEXT_V_ALIGN_BOTTOM;
969
970 // Note that we must set justifications before we can ask if they're flipped. If the old
971 // justification is center then it won't know (whereas if the new justification is center
972 // the we don't care).
973 field.SetVertJustify( verticalJustification );
974
975 if( field.IsVertJustifyFlipped() )
976 field.SetVertJustify( EDA_TEXT::MapVertJustify( -verticalJustification ) );
977
978 break;
979 }
980
981 case FDC_ITALIC:
982 field.SetItalic( BoolFromString( value ) );
983 break;
984
985 case FDC_BOLD:
986 field.SetBold( BoolFromString( value ) );
987 break;
988
989 case FDC_TEXT_SIZE:
990 field.SetTextSize( VECTOR2I( m_frame->ValueFromString( value ),
991 m_frame->ValueFromString( value ) ) );
992 break;
993
994 case FDC_ORIENTATION:
995 if( value == _( "Horizontal" ) )
997 else if( value == _( "Vertical" ) )
999 else
1000 wxFAIL_MSG( wxT( "unknown orientation: " ) + value );
1001
1002 break;
1003
1004 case FDC_POSX:
1005 case FDC_POSY:
1006 pos = field.GetTextPos();
1007
1008 if( aCol == FDC_POSX )
1009 pos.x = m_frame->ValueFromString( value );
1010 else
1011 pos.y = m_frame->ValueFromString( value );
1012
1013 field.SetTextPos( pos );
1014 break;
1015
1016 case FDC_FONT:
1017 if( value == DEFAULT_FONT_NAME )
1018 field.SetFont( nullptr );
1019 else if( value == KICAD_FONT_NAME )
1020 field.SetFont( KIFONT::FONT::GetFont( wxEmptyString, field.IsBold(), field.IsItalic() ) );
1021 else
1022 field.SetFont( KIFONT::FONT::GetFont( aValue, field.IsBold(), field.IsItalic() ) );
1023
1024 break;
1025
1026 case FDC_COLOR:
1027 field.SetTextColor( wxColor( value ) );
1028 break;
1029
1031 field.SetCanAutoplace( BoolFromString( value ) );
1032 break;
1033
1034 case FDC_PRIVATE:
1035 field.SetPrivate( BoolFromString( value ) );
1036 break;
1037
1038 default:
1039 wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a string value" ), aCol ) );
1040 break;
1041 }
1042
1043 m_dialog->OnModify();
1044
1045 GetView()->Refresh();
1046}
1047
1048
1049void FIELDS_GRID_TABLE::SetValueAsBool( int aRow, int aCol, bool aValue )
1050{
1051 wxCHECK( aRow < GetNumberRows(), /*void*/ );
1052 SCH_FIELD& field = getField( aRow );
1053
1054 switch( aCol )
1055 {
1056 case FDC_SHOWN:
1057 field.SetVisible( aValue );
1058 break;
1059
1060 case FDC_SHOW_NAME:
1061 field.SetNameShown( aValue );
1062 break;
1063
1064 case FDC_ITALIC:
1065 field.SetItalic( aValue );
1066 break;
1067
1068 case FDC_BOLD:
1069 field.SetBold( aValue );
1070 break;
1071
1073 field.SetCanAutoplace( aValue );
1074 break;
1075
1076 case FDC_PRIVATE:
1077 field.SetPrivate( aValue );
1078 break;
1079
1080 default:
1081 wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) );
1082 break;
1083 }
1084
1085 m_dialog->OnModify();
1086}
1087
1088
1089wxString FIELDS_GRID_TABLE::StringFromBool( bool aValue ) const
1090{
1091 if( aValue )
1092 return wxT( "1" );
1093 else
1094 return wxT( "0" );
1095}
1096
1097
1098bool FIELDS_GRID_TABLE::BoolFromString( const wxString& aValue ) const
1099{
1100 if( aValue == wxS( "1" ) )
1101 {
1102 return true;
1103 }
1104 else if( aValue == wxS( "0" ) )
1105 {
1106 return false;
1107 }
1108 else
1109 {
1110 wxFAIL_MSG( wxString::Format( "string '%s' can't be converted to boolean correctly and "
1111 "will be perceived as FALSE", aValue ) );
1112 return false;
1113 }
1114}
1115
1116
1118{
1119 for( SCH_FIELD& field : *this )
1120 {
1121 if( field.GetId() == aFieldId )
1122 return &field;
1123 }
1124
1125 return nullptr;
1126}
1127
1128
1130{
1131 for( int ii = 0; ii < (int) this->size(); ++ii )
1132 {
1133 if( this->at( ii ).GetId() == aFieldId )
1134 return ii;
1135 }
1136
1137 return -1;
1138}
1139
1141{
1142 push_back( aParent );
1143 back().SetParent( m_part );
1144 m_isInherited.back() = true;
1145 m_parentFields.back() = aParent;
1146}
1147
1149{
1150 if( m_isInherited.size() > aRow )
1151 {
1152 // You can't erase inherited fields, but you can reset them to the parent value.
1153 if( m_isInherited[aRow] )
1154 {
1155 at( aRow ) = m_parentFields[aRow];
1156 return false;
1157 }
1158
1159 m_isInherited.erase( m_isInherited.begin() + aRow );
1160 }
1161
1162 if( m_parentFields.size() > aRow )
1163 m_parentFields.erase( m_parentFields.begin() + aRow );
1164
1165 std::vector<SCH_FIELD>::erase( begin() + aRow );
1166 return true;
1167}
1168
1169void FIELDS_GRID_TABLE::SwapRows( size_t a, size_t b )
1170{
1171 wxCHECK( a < this->size() && b < this->size(), /*void*/ );
1172
1173 std::swap( at( a ), at( b ) );
1174
1175 bool tmpInherited = m_isInherited[a];
1177 m_isInherited[b] = tmpInherited;
1178
1179 std::swap( m_parentFields[a], m_parentFields[b] );
1180}
1181
1182
1184{
1185 for( SCH_FIELD& field : *this )
1186 field.SetParent( nullptr );
1187
1188 for( SCH_FIELD& field : m_parentFields )
1189 field.SetParent( nullptr );
1190}
1191
1192
1194{
1195 return static_cast<FIELDS_GRID_TABLE*>( m_grid->GetTable() )->GetFieldRow( aFieldId );
1196}
1197
1198
1199void FIELDS_GRID_TRICKS::showPopupMenu( wxMenu& menu, wxGridEvent& aEvent )
1200{
1201 if( m_grid->GetGridCursorRow() == getFieldRow( FIELD_T::FOOTPRINT )
1202 && m_grid->GetGridCursorCol() == FDC_VALUE
1203 && !m_grid->IsReadOnly( getFieldRow( FIELD_T::FOOTPRINT ), FDC_VALUE ) )
1204 {
1205 menu.Append( MYID_SELECT_FOOTPRINT, _( "Select Footprint..." ),
1206 _( "Browse for footprint" ) );
1207 menu.AppendSeparator();
1208 }
1209 else if( m_grid->GetGridCursorRow() == getFieldRow( FIELD_T::DATASHEET )
1210 && m_grid->GetGridCursorCol() == FDC_VALUE
1211 && !m_grid->IsReadOnly( getFieldRow( FIELD_T::DATASHEET ), FDC_VALUE ) )
1212 {
1213 menu.Append( MYID_SHOW_DATASHEET, _( "Show Datasheet" ),
1214 _( "Show datasheet in browser" ) );
1215 menu.AppendSeparator();
1216 }
1217
1218 GRID_TRICKS::showPopupMenu( menu, aEvent );
1219}
1220
1221
1222void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
1223{
1224 if( event.GetId() == MYID_SELECT_FOOTPRINT )
1225 {
1226 // pick a footprint using the footprint picker.
1227 wxString fpid = m_grid->GetCellValue( getFieldRow( FIELD_T::FOOTPRINT ), FDC_VALUE );
1228
1229 if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg ) )
1230 {
1231 if( frame->ShowModal( &fpid, m_dlg ) )
1232 m_grid->SetCellValue( getFieldRow( FIELD_T::FOOTPRINT ), FDC_VALUE, fpid );
1233
1234 frame->Destroy();
1235 }
1236 }
1237 else if (event.GetId() == MYID_SHOW_DATASHEET )
1238 {
1239 wxString datasheet_uri = m_grid->GetCellValue( getFieldRow( FIELD_T::DATASHEET ), FDC_VALUE );
1240
1241 GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj(), PROJECT_SCH::SchSearchS( &m_dlg->Prj() ),
1242 m_filesStack );
1243 }
1244 else
1245 {
1247 }
1248}
1249
1250
const char * name
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition dialog_shim.h:68
bool IsHorizontal() const
Definition eda_angle.h:142
virtual void SetParent(EDA_ITEM *aParent)
Definition eda_item.h:113
int GetTextHeight() const
Definition eda_text.h:267
void SetTextColor(const COLOR4D &aColor)
Definition eda_text.h:269
const VECTOR2I & GetTextPos() const
Definition eda_text.h:273
COLOR4D GetTextColor() const
Definition eda_text.h:270
bool IsItalic() const
Definition eda_text.h:169
const EDA_ANGLE & GetTextAngle() const
Definition eda_text.h:147
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
Definition eda_text.cpp:544
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:187
void SetTextPos(const VECTOR2I &aPoint)
Definition eda_text.cpp:589
KIFONT::FONT * GetFont() const
Definition eda_text.h:247
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition eda_text.cpp:428
virtual void SetVisible(bool aVisible)
Definition eda_text.cpp:397
static GR_TEXT_H_ALIGN_T MapHorizJustify(int aHorizJustify)
Definition eda_text.cpp:69
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
Definition eda_text.cpp:346
bool IsBold() const
Definition eda_text.h:184
static GR_TEXT_V_ALIGN_T MapVertJustify(int aVertJustify)
Definition eda_text.cpp:83
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition eda_text.cpp:310
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
Definition eda_text.cpp:318
void SetFont(KIFONT::FONT *aFont)
Definition eda_text.cpp:510
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition eda_text.cpp:420
wxGridCellAttr * GetAttr(int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind) override
std::vector< bool > m_isInherited
bool IsInherited(size_t aRow) const
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
void push_back(const SCH_FIELD &field)
wxGridCellAttr * m_readOnlyAttr
int GetMandatoryRowCount() const
FIELDS_GRID_TABLE(DIALOG_SHIM *aDialog, SCH_BASE_FRAME *aFrame, WX_GRID *aGrid, LIB_SYMBOL *aSymbol, std::vector< EMBEDDED_FILES * > aFilesStack={})
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
bool EraseRow(size_t row)
wxGridCellAttr * m_referenceAttr
FIELD_VALIDATOR m_referenceValidator
FIELD_VALIDATOR m_valueValidator
std::map< std::pair< int, int >, wxString > m_evalOriginal
wxGridCellAttr * m_footprintAttr
wxGridCellAttr * m_boolAttr
std::vector< EMBEDDED_FILES * > m_filesStack
int GetFieldRow(FIELD_T aFieldId)
bool BoolFromString(const wxString &aValue) const
wxGridCellAttr * m_fontAttr
wxGridCellAttr * m_urlAttr
wxGridCellAttr * m_valueAttr
wxGridCellAttr * m_hAlignAttr
void AddInheritedField(const SCH_FIELD &aParent)
wxGridCellAttr * m_orientationAttr
void SetValue(int aRow, int aCol, const wxString &aValue) override
wxGridCellAttr * m_vAlignAttr
wxGridCellAttr * m_filepathAttr
SCH_FIELD & getField(int aRow)
wxGridCellAttr * m_netclassAttr
void SetValueAsBool(int aRow, int aCol, bool aValue) override
wxString GetValue(int aRow, int aCol) override
void SwapRows(size_t a, size_t b)
void onUnitsChanged(wxCommandEvent &aEvent)
std::unique_ptr< NUMERIC_EVALUATOR > m_eval
std::vector< SCH_FIELD > m_parentFields
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)
std::vector< EMBEDDED_FILES * > m_filesStack
void doPopupSelection(wxCommandEvent &event) override
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.
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.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Define a library symbol object.
Definition lib_symbol.h:87
wxArrayString GetFPFilters() const
Definition lib_symbol.h:219
std::vector< SCH_PIN * > GetGraphicalPins(int aUnit=0, int aBodyStyle=0) const
Graphical pins: Return schematic pin objects as drawn (unexpanded), filtered by unit/body.
The backing store for a PROJECT, in JSON format.
std::shared_ptr< NET_SETTINGS > & NetSettings()
static SEARCH_STACK * SchSearchS(PROJECT *aProject)
Accessor for Eeschema search stack.
virtual PROJECT_FILE & GetProjectFile() const
Definition project.h:204
These are loaded from Eeschema settings but then overwritten by the project settings.
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
Schematic editor (Eeschema) main window.
GR_TEXT_V_ALIGN_T GetEffectiveVertJustify() const
bool IsMandatory() const
bool IsNameShown() const
Definition sch_field.h:201
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
bool IsHorizJustifyFlipped() const
Return whether the field will be rendered with the horizontal justification inverted due to rotation ...
bool IsVertJustifyFlipped() const
FIELD_T GetId() const
Definition sch_field.h:116
void SetCanAutoplace(bool aCanPlace)
Definition sch_field.h:213
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
GR_TEXT_H_ALIGN_T GetEffectiveHorizJustify() const
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
void SetName(const wxString &aName)
bool CanAutoplace() const
Definition sch_field.h:212
void SetText(const wxString &aText) override
void OnScintillaCharAdded(SCINTILLA_TRICKS *aScintillaTricks, wxStyledTextEvent &aEvent) const
void SetNameShown(bool aShown=true)
Definition sch_field.h:202
void SetPrivate(bool aPrivate)
Definition sch_item.h:252
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:244
bool IsPrivate() const
Definition sch_item.h:253
static const wxString GetDefaultFieldName(const wxString &aName, bool aUseDefaultName)
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.
const TEMPLATE_FIELDNAME * GetFieldName(const wxString &aName)
Search for aName in the template field name list.
wxGridCellAttr * enhanceAttr(wxGridCellAttr *aInputAttr, int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind)
Definition wx_grid.cpp:46
void SetupColumnAutosizer(int aFlexibleCol)
Set autosize behaviour using wxFormBuilder column widths as minimums, with a single specified growabl...
Definition wx_grid.cpp:989
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:429
@ MYID_SELECT_FOOTPRINT
#define _(s)
static constexpr EDA_ANGLE ANGLE_VERTICAL
Definition eda_angle.h:408
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
Definition eda_angle.h:407
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, PROJECT *aProject, SEARCH_STACK *aPaths, std::vector< EMBEDDED_FILES * > aFilesStack)
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)
@ 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()
@ 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:913
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
@ CTX_LIBID
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...
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ DATASHEET
name of datasheet
@ 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:152
@ SCH_SYMBOL_T
Definition typeinfo.h:176
@ SCH_SHEET_T
Definition typeinfo.h:179
@ SCH_LABEL_LOCATE_ANY_T
Definition typeinfo.h:195
#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.