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