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