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
423 m_frame->Bind( EDA_EVT_UNITS_CHANGED, &FIELDS_GRID_TABLE::onUnitsChanged, this );
424}
425
426
428{
429 m_readOnlyAttr->DecRef();
430 m_fieldNameAttr->DecRef();
431 m_boolAttr->DecRef();
432 m_referenceAttr->DecRef();
433 m_valueAttr->DecRef();
434 m_footprintAttr->DecRef();
435 m_urlAttr->DecRef();
436 m_nonUrlAttr->DecRef();
437 m_filepathAttr->DecRef();
438 m_vAlignAttr->DecRef();
439 m_hAlignAttr->DecRef();
440 m_orientationAttr->DecRef();
441 m_netclassAttr->DecRef();
442 m_fontAttr->DecRef();
443 m_colorAttr->DecRef();
444
445 for( SCH_FIELD& field : m_parentFields )
446 field.SetParent( nullptr );
447
448 m_frame->Unbind( EDA_EVT_UNITS_CHANGED, &FIELDS_GRID_TABLE::onUnitsChanged, this );
449}
450
451
452void FIELDS_GRID_TABLE::onUnitsChanged( wxCommandEvent& aEvent )
453{
454 if( GetView() )
455 GetView()->ForceRefresh();
456
457 aEvent.Skip();
458}
459
460
462{
463 if( m_frame->GetFrameType() == FRAME_SCH
464 || m_frame->GetFrameType() == FRAME_SCH_VIEWER )
465 {
466 return FDC_SCH_EDIT_COUNT;
467 }
468 else
469 {
471 }
472}
473
474
476{
477 if( m_frame->GetFrameType() == FRAME_SCH
478 || m_frame->GetFrameType() == FRAME_SCH_VIEWER )
479 {
480 int visibleRows = 0;
481
482 for( const SCH_FIELD& field : *this )
483 {
484 if( !field.IsPrivate() )
485 visibleRows++;
486 }
487
488 return visibleRows;
489 }
490
491 return (int) this->size();
492}
493
494
496{
497 if( m_frame->GetFrameType() == FRAME_SCH
498 || m_frame->GetFrameType() == FRAME_SCH_VIEWER )
499 {
500 int visibleRow = 0;
501
502 for( SCH_FIELD& field : *this )
503 {
504 if( field.IsPrivate() )
505 continue;
506
507 if( visibleRow == aRow )
508 return field;
509
510 ++visibleRow;
511 }
512
513 wxFAIL_MSG( wxT( "Row index off end of visible row count" ) );
514 }
515
516 return this->at( aRow );
517}
518
519
521{
522 switch( aCol )
523 {
524 case FDC_NAME: return _( "Name" );
525 case FDC_VALUE: return _( "Value" );
526 case FDC_SHOWN: return _( "Show" );
527 case FDC_SHOW_NAME: return _( "Show Name" );
528 case FDC_H_ALIGN: return _( "H Align" );
529 case FDC_V_ALIGN: return _( "V Align" );
530 case FDC_ITALIC: return _( "Italic" );
531 case FDC_BOLD: return _( "Bold" );
532 case FDC_TEXT_SIZE: return _( "Text Size" );
533 case FDC_ORIENTATION: return _( "Orientation" );
534 case FDC_POSX: return _( "X Position" );
535 case FDC_POSY: return _( "Y Position" );
536 case FDC_FONT: return _( "Font" );
537 case FDC_COLOR: return _( "Color" );
538 case FDC_ALLOW_AUTOPLACE: return _( "Allow Autoplacement" );
539 case FDC_PRIVATE: return _( "Private" );
540 default: wxFAIL; return wxEmptyString;
541 }
542}
543
544
545bool FIELDS_GRID_TABLE::CanGetValueAs( int aRow, int aCol, const wxString& aTypeName )
546{
547 switch( aCol )
548 {
549 case FDC_NAME:
550 case FDC_VALUE:
551 case FDC_H_ALIGN:
552 case FDC_V_ALIGN:
553 case FDC_TEXT_SIZE:
554 case FDC_ORIENTATION:
555 case FDC_POSX:
556 case FDC_POSY:
557 case FDC_FONT:
558 case FDC_COLOR:
559 return aTypeName == wxGRID_VALUE_STRING;
560
561 case FDC_SHOWN:
562 case FDC_SHOW_NAME:
563 case FDC_ITALIC:
564 case FDC_BOLD:
566 case FDC_PRIVATE:
567 return aTypeName == wxGRID_VALUE_BOOL;
568
569 default:
570 wxFAIL;
571 return false;
572 }
573}
574
575
576bool FIELDS_GRID_TABLE::CanSetValueAs( int aRow, int aCol, const wxString& aTypeName )
577{
578 return CanGetValueAs( aRow, aCol, aTypeName );
579}
580
581
582wxGridCellAttr* FIELDS_GRID_TABLE::GetAttr( int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind )
583{
584 wxCHECK( aRow < GetNumberRows(), nullptr );
585
586 const SCH_FIELD& field = getField( aRow );
587 wxGridCellAttr* attr = nullptr;
588
589 switch( aCol )
590 {
591 case FDC_NAME:
592 if( field.IsMandatory() )
593 {
594 attr = m_fieldNameAttr->Clone();
595 attr->SetReadOnly( true );
596 }
597 else
598 {
599 m_fieldNameAttr->IncRef();
600 attr = m_fieldNameAttr;
601 }
602
603 break;
604
605 case FDC_VALUE:
606 if( field.GetId() == FIELD_T::REFERENCE )
607 {
608 m_referenceAttr->IncRef();
609 attr = m_referenceAttr;
610 }
611 else if( field.GetId() == FIELD_T::VALUE )
612 {
613 m_valueAttr->IncRef();
614 attr = m_valueAttr;
615 }
616 else if( field.GetId() == FIELD_T::FOOTPRINT )
617 {
618 // Power symbols have do not appear in the board, so don't allow
619 // a footprint (m_part can be nullptr when loading a old schematic
620 // (for instance Kicad 4) with libraries missing)
621 if( m_part && m_part->IsPower() )
622 {
623 m_readOnlyAttr->IncRef();
624 attr = m_readOnlyAttr;
625 }
626 else
627 {
628 m_footprintAttr->IncRef();
629 attr = m_footprintAttr;
630 }
631 }
632 else if( field.GetId() == FIELD_T::DATASHEET )
633 {
634 m_urlAttr->IncRef();
635 attr = m_urlAttr;
636 }
637 else if( field.GetId() == FIELD_T::SHEET_NAME )
638 {
639 m_referenceAttr->IncRef();
640 attr = m_referenceAttr;
641 }
642 else if( field.GetId() == FIELD_T::SHEET_FILENAME )
643 {
644 m_filepathAttr->IncRef();
645 attr = m_filepathAttr;
646 }
648 && field.GetCanonicalName() == wxT( "Netclass" ) )
649 {
650 m_netclassAttr->IncRef();
651 attr = m_netclassAttr;
652 }
653 else
654 {
655 wxString fn = GetValue( aRow, FDC_NAME );
656
657 SCHEMATIC_SETTINGS* settings = m_frame->Prj().GetProjectFile().m_SchematicSettings;
658
659 const TEMPLATE_FIELDNAME* templateFn =
660 settings ? settings->m_TemplateFieldNames.GetFieldName( fn ) : nullptr;
661
662 if( ( templateFn && templateFn->m_URL ) || field.IsHypertext() )
663 {
664 m_urlAttr->IncRef();
665 attr = m_urlAttr;
666 }
667 else
668 {
669 m_nonUrlAttr->IncRef();
670 attr = m_nonUrlAttr;
671 }
672 }
673
674 break;
675
676 case FDC_TEXT_SIZE:
677 case FDC_POSX:
678 case FDC_POSY:
679 break;
680
681 case FDC_H_ALIGN:
682 m_hAlignAttr->IncRef();
683 attr = m_hAlignAttr;
684 break;
685
686 case FDC_V_ALIGN:
687 m_vAlignAttr->IncRef();
688 attr = m_vAlignAttr;
689 break;
690
691 case FDC_ORIENTATION:
692 m_orientationAttr->IncRef();
693 attr = m_orientationAttr;
694 break;
695
696 case FDC_SHOWN:
697 case FDC_SHOW_NAME:
698 case FDC_ITALIC:
699 case FDC_BOLD:
701 case FDC_PRIVATE:
702 m_boolAttr->IncRef();
703 attr = m_boolAttr;
704 break;
705
706 case FDC_FONT:
707 m_fontAttr->IncRef();
708 attr = m_fontAttr;
709 break;
710
711 case FDC_COLOR:
712 m_colorAttr->IncRef();
713 attr = m_colorAttr;
714 break;
715
716 default:
717 attr = nullptr;
718 break;
719 }
720
721 if( !attr )
722 return nullptr;
723
724 attr = enhanceAttr( attr, aRow, aCol, aKind );
725
726 if( IsInherited( aRow ) )
727 {
728 wxGridCellAttr* text_attr = attr ? attr->Clone() : new wxGridCellAttr;
729 wxFont font;
730
731 if( !text_attr->HasFont() )
732 font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
733 else
734 font = text_attr->GetFont();
735
736 font.MakeItalic();
737 text_attr->SetFont( font );
738 text_attr->SetTextColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
739
740 if( attr )
741 attr->DecRef();
742
743 attr = text_attr;
744 }
745
746 return attr;
747}
748
749
750wxString FIELDS_GRID_TABLE::GetValue( int aRow, int aCol )
751{
752 wxCHECK( aRow < GetNumberRows(), wxEmptyString );
753
754 wxGrid* grid = GetView();
755 const SCH_FIELD& field = getField( aRow );
756
757 if( grid->GetGridCursorRow() == aRow && grid->GetGridCursorCol() == aCol
758 && grid->IsCellEditControlShown() )
759 {
760 auto it = m_evalOriginal.find( { aRow, aCol } );
761
762 if( it != m_evalOriginal.end() )
763 return it->second;
764 }
765
766 switch( aCol )
767 {
768 case FDC_NAME:
769 // Use default field names for mandatory and system fields because they are translated
770 // according to the current locale
772 {
774 }
775 else
776 {
777 if( field.IsMandatory() )
778 return GetDefaultFieldName( field.GetId(), DO_TRANSLATE );
779 else
780 return field.GetName( false );
781 }
782
783 case FDC_VALUE:
784 return EscapeString( UnescapeString( field.GetText() ), CTX_LINE );
785
786 case FDC_SHOWN:
787 return StringFromBool( field.IsVisible() );
788
789 case FDC_SHOW_NAME:
790 return StringFromBool( field.IsNameShown() );
791
792 case FDC_H_ALIGN:
793 switch ( field.GetEffectiveHorizJustify() )
794 {
795 case GR_TEXT_H_ALIGN_LEFT: return _( "Left" );
796 case GR_TEXT_H_ALIGN_CENTER: return _( "Center" );
797 case GR_TEXT_H_ALIGN_RIGHT: return _( "Right" );
799 }
800
801 break;
802
803 case FDC_V_ALIGN:
804 switch ( field.GetEffectiveVertJustify() )
805 {
806 case GR_TEXT_V_ALIGN_TOP: return _( "Top" );
807 case GR_TEXT_V_ALIGN_CENTER: return _( "Center" );
808 case GR_TEXT_V_ALIGN_BOTTOM: return _( "Bottom" );
810 }
811
812 break;
813
814 case FDC_ITALIC:
815 return StringFromBool( field.IsItalic() );
816
817 case FDC_BOLD:
818 return StringFromBool( field.IsBold() );
819
820 case FDC_TEXT_SIZE:
821 return m_frame->StringFromValue( field.GetTextHeight(), true );
822
823 case FDC_ORIENTATION:
824 if( field.GetTextAngle().IsHorizontal() )
825 return _( "Horizontal" );
826 else
827 return _( "Vertical" );
828
829 case FDC_POSX:
830 return m_frame->StringFromValue( field.GetTextPos().x, true );
831
832 case FDC_POSY:
833 return m_frame->StringFromValue( field.GetTextPos().y, true );
834
835 case FDC_FONT:
836 if( field.GetFont() )
837 return field.GetFont()->GetName();
838 else
839 return DEFAULT_FONT_NAME;
840
841 case FDC_COLOR:
842 return field.GetTextColor().ToCSSString();
843
845 return StringFromBool( field.CanAutoplace() );
846
847 case FDC_PRIVATE:
848 return StringFromBool( field.IsPrivate() );
849
850 default:
851 // we can't assert here because wxWidgets sometimes calls this without checking
852 // the column type when trying to see if there's an overflow
853 break;
854 }
855
856 return wxT( "bad wxWidgets!" );
857}
858
859
860bool FIELDS_GRID_TABLE::GetValueAsBool( int aRow, int aCol )
861{
862 wxCHECK( aRow < GetNumberRows(), false );
863 const SCH_FIELD& field = getField( aRow );
864
865 switch( aCol )
866 {
867 case FDC_SHOWN: return field.IsVisible();
868 case FDC_SHOW_NAME: return field.IsNameShown();
869 case FDC_ITALIC: return field.IsItalic();
870 case FDC_BOLD: return field.IsBold();
871 case FDC_ALLOW_AUTOPLACE: return field.CanAutoplace();
872 case FDC_PRIVATE: return field.IsPrivate();
873 default:
874 wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) );
875 return false;
876 }
877}
878
879
880void FIELDS_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
881{
882 wxCHECK( aRow < GetNumberRows(), /*void*/ );
883 SCH_FIELD& field = getField( aRow );
884 VECTOR2I pos;
885 wxString value = aValue;
886
887 switch( aCol )
888 {
889 case FDC_TEXT_SIZE:
890 case FDC_POSX:
891 case FDC_POSY:
892 m_eval->SetDefaultUnits( m_frame->GetUserUnits() );
893
894 if( m_eval->Process( value ) )
895 {
896 m_evalOriginal[ { aRow, aCol } ] = value;
897 value = m_eval->Result();
898 }
899
900 break;
901
902 default:
903 break;
904 }
905
906 switch( aCol )
907 {
908 case FDC_NAME:
909 field.SetName( value );
910 break;
911
912 case FDC_VALUE:
913 {
915 {
917 }
918 else if( m_parentType == LIB_SYMBOL_T && field.GetId() == FIELD_T::VALUE )
919 {
920 value = EscapeString( value, CTX_LIBID );
921 }
922
923 field.SetText( UnescapeString( value ) );
924 break;
925 }
926
927 case FDC_SHOWN:
928 field.SetVisible( BoolFromString( value ) );
929 break;
930
931 case FDC_SHOW_NAME:
932 field.SetNameShown( BoolFromString( value ) );
933 break;
934
935 case FDC_H_ALIGN:
936 {
937 GR_TEXT_H_ALIGN_T horizontalJustification = GR_TEXT_H_ALIGN_CENTER;
938
939 if( value == _( "Left" ) )
940 horizontalJustification = GR_TEXT_H_ALIGN_LEFT;
941 else if( value == _( "Center" ) )
942 horizontalJustification = GR_TEXT_H_ALIGN_CENTER;
943 else if( value == _( "Right" ) )
944 horizontalJustification = GR_TEXT_H_ALIGN_RIGHT;
945
946 // Note that we must set justifications before we can ask if they're flipped. If the old
947 // justification is center then it won't know (whereas if the new justification is center
948 // the we don't care).
949 field.SetHorizJustify( horizontalJustification );
950
951 if( field.IsHorizJustifyFlipped() )
952 field.SetHorizJustify( EDA_TEXT::MapHorizJustify( - horizontalJustification ) );
953
954 break;
955 }
956
957 case FDC_V_ALIGN:
958 {
959 GR_TEXT_V_ALIGN_T verticalJustification = GR_TEXT_V_ALIGN_BOTTOM;
960
961 if( value == _( "Top" ) )
962 verticalJustification = GR_TEXT_V_ALIGN_TOP;
963 else if( value == _( "Center" ) )
964 verticalJustification = GR_TEXT_V_ALIGN_CENTER;
965 else if( value == _( "Bottom" ) )
966 verticalJustification = GR_TEXT_V_ALIGN_BOTTOM;
967
968 // Note that we must set justifications before we can ask if they're flipped. If the old
969 // justification is center then it won't know (whereas if the new justification is center
970 // the we don't care).
971 field.SetVertJustify( verticalJustification );
972
973 if( field.IsVertJustifyFlipped() )
974 field.SetVertJustify( EDA_TEXT::MapVertJustify( -verticalJustification ) );
975
976 break;
977 }
978
979 case FDC_ITALIC:
980 field.SetItalic( BoolFromString( value ) );
981 break;
982
983 case FDC_BOLD:
984 field.SetBold( BoolFromString( value ) );
985 break;
986
987 case FDC_TEXT_SIZE:
988 field.SetTextSize( VECTOR2I( m_frame->ValueFromString( value ),
989 m_frame->ValueFromString( value ) ) );
990 break;
991
992 case FDC_ORIENTATION:
993 if( value == _( "Horizontal" ) )
995 else if( value == _( "Vertical" ) )
997 else
998 wxFAIL_MSG( wxT( "unknown orientation: " ) + value );
999
1000 break;
1001
1002 case FDC_POSX:
1003 case FDC_POSY:
1004 pos = field.GetTextPos();
1005
1006 if( aCol == FDC_POSX )
1007 pos.x = m_frame->ValueFromString( value );
1008 else
1009 pos.y = m_frame->ValueFromString( value );
1010
1011 field.SetTextPos( pos );
1012 break;
1013
1014 case FDC_FONT:
1015 if( value == DEFAULT_FONT_NAME )
1016 field.SetFont( nullptr );
1017 else if( value == KICAD_FONT_NAME )
1018 field.SetFont( KIFONT::FONT::GetFont( wxEmptyString, field.IsBold(), field.IsItalic() ) );
1019 else
1020 field.SetFont( KIFONT::FONT::GetFont( aValue, field.IsBold(), field.IsItalic() ) );
1021
1022 break;
1023
1024 case FDC_COLOR:
1025 field.SetTextColor( wxColor( value ) );
1026 break;
1027
1029 field.SetCanAutoplace( BoolFromString( value ) );
1030 break;
1031
1032 case FDC_PRIVATE:
1033 field.SetPrivate( BoolFromString( value ) );
1034 break;
1035
1036 default:
1037 wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a string value" ), aCol ) );
1038 break;
1039 }
1040
1041 m_dialog->OnModify();
1042
1043 GetView()->Refresh();
1044}
1045
1046
1047void FIELDS_GRID_TABLE::SetValueAsBool( int aRow, int aCol, bool aValue )
1048{
1049 wxCHECK( aRow < GetNumberRows(), /*void*/ );
1050 SCH_FIELD& field = getField( aRow );
1051
1052 switch( aCol )
1053 {
1054 case FDC_SHOWN:
1055 field.SetVisible( aValue );
1056 break;
1057
1058 case FDC_SHOW_NAME:
1059 field.SetNameShown( aValue );
1060 break;
1061
1062 case FDC_ITALIC:
1063 field.SetItalic( aValue );
1064 break;
1065
1066 case FDC_BOLD:
1067 field.SetBold( aValue );
1068 break;
1069
1071 field.SetCanAutoplace( aValue );
1072 break;
1073
1074 case FDC_PRIVATE:
1075 field.SetPrivate( aValue );
1076 break;
1077
1078 default:
1079 wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) );
1080 break;
1081 }
1082
1083 m_dialog->OnModify();
1084}
1085
1086
1087wxString FIELDS_GRID_TABLE::StringFromBool( bool aValue ) const
1088{
1089 if( aValue )
1090 return wxT( "1" );
1091 else
1092 return wxT( "0" );
1093}
1094
1095
1096bool FIELDS_GRID_TABLE::BoolFromString( const wxString& aValue ) const
1097{
1098 if( aValue == wxS( "1" ) )
1099 {
1100 return true;
1101 }
1102 else if( aValue == wxS( "0" ) )
1103 {
1104 return false;
1105 }
1106 else
1107 {
1108 wxFAIL_MSG( wxString::Format( "string '%s' can't be converted to boolean correctly and "
1109 "will be perceived as FALSE", aValue ) );
1110 return false;
1111 }
1112}
1113
1114
1116{
1117 for( SCH_FIELD& field : *this )
1118 {
1119 if( field.GetId() == aFieldId )
1120 return &field;
1121 }
1122
1123 return nullptr;
1124}
1125
1126
1128{
1129 for( int ii = 0; ii < (int) this->size(); ++ii )
1130 {
1131 if( this->at( ii ).GetId() == aFieldId )
1132 return ii;
1133 }
1134
1135 return -1;
1136}
1137
1139{
1140 push_back( aParent );
1141 back().SetParent( m_part );
1142 m_isInherited.back() = true;
1143 m_parentFields.back() = aParent;
1144}
1145
1147{
1148 if( m_isInherited.size() > aRow )
1149 {
1150 // You can't erase inherited fields, but you can reset them to the parent value.
1151 if( m_isInherited[aRow] )
1152 {
1153 at( aRow ) = m_parentFields[aRow];
1154 return false;
1155 }
1156
1157 m_isInherited.erase( m_isInherited.begin() + aRow );
1158 }
1159
1160 if( m_parentFields.size() > aRow )
1161 m_parentFields.erase( m_parentFields.begin() + aRow );
1162
1163 std::vector<SCH_FIELD>::erase( begin() + aRow );
1164 return true;
1165}
1166
1167void FIELDS_GRID_TABLE::SwapRows( size_t a, size_t b )
1168{
1169 wxCHECK( a < this->size() && b < this->size(), /*void*/ );
1170
1171 std::swap( at( a ), at( b ) );
1172
1173 bool tmpInherited = m_isInherited[a];
1175 m_isInherited[b] = tmpInherited;
1176
1177 std::swap( m_parentFields[a], m_parentFields[b] );
1178}
1179
1180
1182{
1183 for( SCH_FIELD& field : *this )
1184 field.SetParent( nullptr );
1185
1186 for( SCH_FIELD& field : m_parentFields )
1187 field.SetParent( nullptr );
1188}
1189
1190
1192{
1193 return static_cast<FIELDS_GRID_TABLE*>( m_grid->GetTable() )->GetFieldRow( aFieldId );
1194}
1195
1196
1197void FIELDS_GRID_TRICKS::showPopupMenu( wxMenu& menu, wxGridEvent& aEvent )
1198{
1199 if( m_grid->GetGridCursorRow() == getFieldRow( FIELD_T::FOOTPRINT )
1200 && m_grid->GetGridCursorCol() == FDC_VALUE
1201 && !m_grid->IsReadOnly( getFieldRow( FIELD_T::FOOTPRINT ), FDC_VALUE ) )
1202 {
1203 menu.Append( MYID_SELECT_FOOTPRINT, _( "Select Footprint..." ),
1204 _( "Browse for footprint" ) );
1205 menu.AppendSeparator();
1206 }
1207 else if( m_grid->GetGridCursorRow() == getFieldRow( FIELD_T::DATASHEET )
1208 && m_grid->GetGridCursorCol() == FDC_VALUE
1209 && !m_grid->IsReadOnly( getFieldRow( FIELD_T::DATASHEET ), FDC_VALUE ) )
1210 {
1211 menu.Append( MYID_SHOW_DATASHEET, _( "Show Datasheet" ),
1212 _( "Show datasheet in browser" ) );
1213 menu.AppendSeparator();
1214 }
1215
1216 GRID_TRICKS::showPopupMenu( menu, aEvent );
1217}
1218
1219
1220void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
1221{
1222 if( event.GetId() == MYID_SELECT_FOOTPRINT )
1223 {
1224 // pick a footprint using the footprint picker.
1225 wxString fpid = m_grid->GetCellValue( getFieldRow( FIELD_T::FOOTPRINT ), FDC_VALUE );
1226
1227 if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg ) )
1228 {
1229 if( frame->ShowModal( &fpid, m_dlg ) )
1230 m_grid->SetCellValue( getFieldRow( FIELD_T::FOOTPRINT ), FDC_VALUE, fpid );
1231
1232 frame->Destroy();
1233 }
1234 }
1235 else if (event.GetId() == MYID_SHOW_DATASHEET )
1236 {
1237 wxString datasheet_uri = m_grid->GetCellValue( getFieldRow( FIELD_T::DATASHEET ), FDC_VALUE );
1238
1239 GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj(), PROJECT_SCH::SchSearchS( &m_dlg->Prj() ),
1240 m_filesStack );
1241 }
1242 else
1243 {
1245 }
1246}
1247
1248
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:266
void SetTextColor(const COLOR4D &aColor)
Definition eda_text.h:268
const VECTOR2I & GetTextPos() const
Definition eda_text.h:272
COLOR4D GetTextColor() const
Definition eda_text.h:269
bool IsItalic() const
Definition eda_text.h:168
const EDA_ANGLE & GetTextAngle() const
Definition eda_text.h:146
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
Definition eda_text.cpp:534
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:97
virtual bool IsVisible() const
Definition eda_text.h:186
void SetTextPos(const VECTOR2I &aPoint)
Definition eda_text.cpp:579
KIFONT::FONT * GetFont() const
Definition eda_text.h:246
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition eda_text.cpp:418
virtual void SetVisible(bool aVisible)
Definition eda_text.cpp:387
static GR_TEXT_H_ALIGN_T MapHorizJustify(int aHorizJustify)
Definition eda_text.cpp:68
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
Definition eda_text.cpp:336
bool IsBold() const
Definition eda_text.h:183
static GR_TEXT_V_ALIGN_T MapVertJustify(int aVertJustify)
Definition eda_text.cpp:82
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition eda_text.cpp:300
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
Definition eda_text.cpp:308
void SetFont(KIFONT::FONT *aFont)
Definition eda_text.cpp:500
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition eda_text.cpp:410
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: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:202
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:214
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:213
void SetText(const wxString &aText) override
void OnScintillaCharAdded(SCINTILLA_TRICKS *aScintillaTricks, wxStyledTextEvent &aEvent) const
void SetNameShown(bool aShown=true)
Definition sch_field.h:203
void SetPrivate(bool aPrivate)
Definition sch_item.h:249
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:217
bool IsPrivate() const
Definition sch_item.h:250
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: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: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:150
@ SCH_SYMBOL_T
Definition typeinfo.h:174
@ SCH_SHEET_T
Definition typeinfo.h:177
@ SCH_LABEL_LOCATE_ANY_T
Definition typeinfo.h:193
#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.