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