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