KiCad PCB EDA Suite
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 (C) 2018-2020 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 <kiway.h>
25 #include <kiway_player.h>
26 #include <dialog_shim.h>
27 #include <fields_grid_table.h>
28 #include <sch_base_frame.h>
29 #include <sch_field.h>
30 #include <sch_validators.h>
31 #include <validators.h>
32 #include <class_library.h>
33 #include <template_fieldnames.h>
37 #include <project/project_file.h>
38 #include "eda_doc.h"
39 
40 
41 enum
42 {
43  MYID_SELECT_FOOTPRINT = 991, // must be within GRID_TRICKS' enum range
45 };
46 
47 
48 template <class T>
50  LIB_PART* aPart ) :
51  m_frame( aFrame ),
52  m_userUnits( aDialog->GetUserUnits() ),
53  m_parentType( SCH_COMPONENT_T ),
54  m_mandatoryFieldCount( MANDATORY_FIELDS ),
55  m_part( aPart ),
56  m_fieldNameValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_NAME ),
57  m_referenceValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), REFERENCE_FIELD ),
58  m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), VALUE_FIELD ),
59  m_libIdValidator( LIB_ID::ID_PCB ),
60  m_urlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
61  m_nonUrlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
62  m_filepathValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), SHEETFILENAME )
63 {
64  initGrid( aDialog );
65 }
66 
67 
68 template <class T>
70  SCH_SHEET* aSheet ) :
71  m_frame( aFrame ),
72  m_userUnits( aDialog->GetUserUnits() ),
73  m_parentType( SCH_SHEET_T ),
74  m_mandatoryFieldCount( SHEET_MANDATORY_FIELDS ),
75  m_part( nullptr ),
76  m_fieldNameValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_NAME ),
77  m_referenceValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), SHEETNAME_V ),
78  m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), VALUE_FIELD ),
79  m_libIdValidator( LIB_ID::ID_PCB ),
80  m_urlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
81  m_nonUrlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
82  m_filepathValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), SHEETFILENAME_V )
83 {
84  initGrid( aDialog );
85 }
86 
87 
88 template <class T>
90 {
91  // Build the various grid cell attributes.
92  // NOTE: validators and cellAttrs are member variables to get the destruction order
93  // right. wxGrid is VERY cranky about this.
94 
95  m_readOnlyAttr = new wxGridCellAttr;
96  m_readOnlyAttr->SetReadOnly( true );
97 
98  m_fieldNameAttr = new wxGridCellAttr;
99  GRID_CELL_TEXT_EDITOR* nameEditor = new GRID_CELL_TEXT_EDITOR();
100  nameEditor->SetValidator( m_fieldNameValidator );
101  m_fieldNameAttr->SetEditor( nameEditor );
102 
103  m_referenceAttr = new wxGridCellAttr;
104  GRID_CELL_TEXT_EDITOR* referenceEditor = new GRID_CELL_TEXT_EDITOR();
105  referenceEditor->SetValidator( m_referenceValidator );
106  m_referenceAttr->SetEditor( referenceEditor );
107 
108  m_valueAttr = new wxGridCellAttr;
109  GRID_CELL_TEXT_EDITOR* valueEditor = new GRID_CELL_TEXT_EDITOR();
110  valueEditor->SetValidator( m_valueValidator );
111  m_valueAttr->SetEditor( valueEditor );
112 
113  m_footprintAttr = new wxGridCellAttr;
115  fpIdEditor->SetValidator( m_libIdValidator );
116  m_footprintAttr->SetEditor( fpIdEditor );
117 
118  m_urlAttr = new wxGridCellAttr;
119  GRID_CELL_URL_EDITOR* urlEditor = new GRID_CELL_URL_EDITOR( aDialog );
120  urlEditor->SetValidator( m_urlValidator );
121  m_urlAttr->SetEditor( urlEditor );
122 
123  m_nonUrlAttr = new wxGridCellAttr;
124  GRID_CELL_TEXT_EDITOR* nonUrlEditor = new GRID_CELL_TEXT_EDITOR();
125  nonUrlEditor->SetValidator( m_nonUrlValidator );
126  m_nonUrlAttr->SetEditor( nonUrlEditor );
127 
128  m_curdir = m_frame->Prj().GetProjectPath();
129  m_filepathAttr = new wxGridCellAttr;
130 
131  // Create a wild card using wxFileDialog syntax.
132  wxString wildCard( _( "Schematic Files" ) );
133  std::vector<std::string> exts;
134  exts.push_back( KiCadSchematicFileExtension );
135  wildCard += AddFileExtListToFilter( exts );
136 
137  auto filepathEditor = new GRID_CELL_PATH_EDITOR( aDialog, &m_curdir, wildCard );
138  filepathEditor->SetValidator( m_filepathValidator );
139  m_filepathAttr->SetEditor( filepathEditor );
140 
141  m_boolAttr = new wxGridCellAttr;
142  m_boolAttr->SetRenderer( new wxGridCellBoolRenderer() );
143  m_boolAttr->SetEditor( new wxGridCellBoolEditor() );
144  m_boolAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
145 
146  wxArrayString vAlignNames;
147  vAlignNames.Add( _( "Top" ) );
148  vAlignNames.Add( _( "Center" ) );
149  vAlignNames.Add( _( "Bottom" ) );
150  m_vAlignAttr = new wxGridCellAttr;
151  m_vAlignAttr->SetEditor( new wxGridCellChoiceEditor( vAlignNames ) );
152  m_vAlignAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
153 
154  wxArrayString hAlignNames;
155  hAlignNames.Add( _( "Left" ) );
156  hAlignNames.Add(_( "Center" ) );
157  hAlignNames.Add(_( "Right" ) );
158  m_hAlignAttr = new wxGridCellAttr;
159  m_hAlignAttr->SetEditor( new wxGridCellChoiceEditor( hAlignNames ) );
160  m_hAlignAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
161 
162  wxArrayString orientationNames;
163  orientationNames.Add( _( "Horizontal" ) );
164  orientationNames.Add(_( "Vertical" ) );
165  m_orientationAttr = new wxGridCellAttr;
166  m_orientationAttr->SetEditor( new wxGridCellChoiceEditor( orientationNames ) );
167  m_orientationAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
168 }
169 
170 
171 template <class T>
173 {
174  m_readOnlyAttr->DecRef();
175  m_fieldNameAttr->DecRef();
176  m_boolAttr->DecRef();
177  m_referenceAttr->DecRef();
178  m_valueAttr->DecRef();
179  m_footprintAttr->DecRef();
180  m_urlAttr->DecRef();
181  m_nonUrlAttr->DecRef();
182  m_filepathAttr->DecRef();
183  m_vAlignAttr->DecRef();
184  m_hAlignAttr->DecRef();
185  m_orientationAttr->DecRef();
186 }
187 
188 
189 template <class T>
191 {
192  switch( aCol )
193  {
194  case FDC_NAME: return _( "Name" );
195  case FDC_VALUE: return _( "Value" );
196  case FDC_SHOWN: return _( "Show" );
197  case FDC_H_ALIGN: return _( "H Align" );
198  case FDC_V_ALIGN: return _( "V Align" );
199  case FDC_ITALIC: return _( "Italic" );
200  case FDC_BOLD: return _( "Bold" );
201  case FDC_TEXT_SIZE: return _( "Text Size" );
202  case FDC_ORIENTATION: return _( "Orientation" );
203  case FDC_POSX: return _( "X Position" );
204  case FDC_POSY: return _( "Y Position" );
205  default: wxFAIL; return wxEmptyString;
206  }
207 }
208 
209 
210 template <class T>
211 bool FIELDS_GRID_TABLE<T>::CanGetValueAs( int aRow, int aCol, const wxString& aTypeName )
212 {
213  switch( aCol )
214  {
215  case FDC_NAME:
216  case FDC_VALUE:
217  case FDC_H_ALIGN:
218  case FDC_V_ALIGN:
219  case FDC_TEXT_SIZE:
220  case FDC_ORIENTATION:
221  case FDC_POSX:
222  case FDC_POSY:
223  return aTypeName == wxGRID_VALUE_STRING;
224 
225  case FDC_SHOWN:
226  case FDC_ITALIC:
227  case FDC_BOLD:
228  return aTypeName == wxGRID_VALUE_BOOL;
229 
230  default:
231  wxFAIL;
232  return false;
233  }
234 }
235 
236 
237 template <class T>
238 bool FIELDS_GRID_TABLE<T>::CanSetValueAs( int aRow, int aCol, const wxString& aTypeName )
239 {
240  return CanGetValueAs( aRow, aCol, aTypeName );
241 }
242 
243 
244 template <class T>
245 wxGridCellAttr* FIELDS_GRID_TABLE<T>::GetAttr( int aRow, int aCol, wxGridCellAttr::wxAttrKind )
246 {
247  wxGridCellAttr* tmp;
248 
249  switch( aCol )
250  {
251  case FDC_NAME:
252  if( aRow < m_mandatoryFieldCount )
253  {
254  tmp = m_fieldNameAttr->Clone();
255  tmp->SetReadOnly( true );
256  return tmp;
257  }
258  else
259  {
260  m_fieldNameAttr->IncRef();
261  return m_fieldNameAttr;
262  }
263 
264  case FDC_VALUE:
265  if( m_parentType == SCH_COMPONENT_T && aRow == REFERENCE_FIELD )
266  {
267  m_referenceAttr->IncRef();
268  return m_referenceAttr;
269  }
270  else if( m_parentType == SCH_COMPONENT_T && aRow == VALUE_FIELD )
271  {
272  // For power symbols, the value is not editable, because value and pin name must
273  // be the same and can be edited only in library editor.
274  if( ( m_part && m_part->IsPower() && !m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) )
275  {
276  tmp = m_readOnlyAttr->Clone();
277  tmp->SetReadOnly( true );
278  tmp->SetTextColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
279  return tmp;
280  }
281  else
282  {
283  m_valueAttr->IncRef();
284  return m_valueAttr;
285  }
286  }
287  else if( m_parentType == SCH_COMPONENT_T && aRow == FOOTPRINT_FIELD )
288  {
289  m_footprintAttr->IncRef();
290  return m_footprintAttr;
291  }
292  else if( m_parentType == SCH_COMPONENT_T && aRow == DATASHEET_FIELD )
293  {
294  m_urlAttr->IncRef();
295  return m_urlAttr;
296  }
297  else if( m_parentType == SCH_SHEET_T && aRow == SHEETNAME )
298  {
299  m_referenceAttr->IncRef();
300  return m_referenceAttr;
301  }
302  else if( m_parentType == SCH_SHEET_T && aRow == SHEETFILENAME )
303  {
304  m_filepathAttr->IncRef();
305  return m_filepathAttr;
306  }
307  else
308  {
309  wxString fn = GetValue( aRow, FDC_NAME );
310 
311  SCHEMATIC_SETTINGS* settings = m_frame->Prj().GetProjectFile().m_SchematicSettings;
312 
313  const TEMPLATE_FIELDNAME* templateFn =
314  settings ? settings->m_TemplateFieldNames.GetFieldName( fn ) : nullptr;
315 
316  if( templateFn && templateFn->m_URL )
317  {
318  m_urlAttr->IncRef();
319  return m_urlAttr;
320  }
321  else
322  {
323  m_nonUrlAttr->IncRef();
324  return m_nonUrlAttr;
325  }
326  }
327 
328  return nullptr;
329 
330  case FDC_TEXT_SIZE:
331  case FDC_POSX:
332  case FDC_POSY:
333  return nullptr;
334 
335  case FDC_H_ALIGN:
336  m_hAlignAttr->IncRef();
337  return m_hAlignAttr;
338 
339  case FDC_V_ALIGN:
340  m_vAlignAttr->IncRef();
341  return m_vAlignAttr;
342 
343  case FDC_ORIENTATION:
344  m_orientationAttr->IncRef();
345  return m_orientationAttr;
346 
347  case FDC_SHOWN:
348  case FDC_ITALIC:
349  case FDC_BOLD:
350  m_boolAttr->IncRef();
351  return m_boolAttr;
352 
353  default:
354  wxFAIL;
355  return nullptr;
356  }
357 }
358 
359 
360 template <class T>
361 wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol )
362 {
363  wxCHECK( aRow < GetNumberRows(), wxEmptyString );
364  const T& field = this->at( (size_t) aRow );
365 
366  switch( aCol )
367  {
368  case FDC_NAME:
369  // Use default field name for mandatory fields, because they are translated
370  // according to the current locale
371  if( aRow < m_mandatoryFieldCount )
372  {
373  if( m_parentType == SCH_COMPONENT_T )
375  else if( m_parentType == SCH_SHEET_T )
376  return SCH_SHEET::GetDefaultFieldName( aRow );
377  }
378 
379  return field.GetName( false );
380 
381  case FDC_VALUE:
382  return field.GetText();
383 
384  case FDC_SHOWN:
385  return StringFromBool( field.IsVisible() );
386 
387  case FDC_H_ALIGN:
388  switch ( field.GetHorizJustify() )
389  {
390  case GR_TEXT_HJUSTIFY_LEFT: return _( "Left" );
391  case GR_TEXT_HJUSTIFY_CENTER: return _( "Center" );
392  case GR_TEXT_HJUSTIFY_RIGHT: return _( "Right" );
393  }
394 
395  break;
396 
397  case FDC_V_ALIGN:
398  switch ( field.GetVertJustify() )
399  {
400  case GR_TEXT_VJUSTIFY_TOP: return _( "Top" );
401  case GR_TEXT_VJUSTIFY_CENTER: return _( "Center" );
402  case GR_TEXT_VJUSTIFY_BOTTOM: return _( "Bottom" );
403  }
404 
405  break;
406 
407  case FDC_ITALIC:
408  return StringFromBool( field.IsItalic() );
409 
410  case FDC_BOLD:
411  return StringFromBool( field.IsBold() );
412 
413  case FDC_TEXT_SIZE:
414  return StringFromValue( m_userUnits, field.GetTextSize().GetHeight() );
415 
416  case FDC_ORIENTATION:
417  switch ( (int) field.GetTextAngle() )
418  {
419  case TEXT_ANGLE_HORIZ: return _( "Horizontal" );
420  case TEXT_ANGLE_VERT: return _( "Vertical" );
421  }
422 
423  break;
424 
425  case FDC_POSX:
426  return StringFromValue( m_userUnits, field.GetTextPos().x );
427 
428  case FDC_POSY:
429  return StringFromValue( m_userUnits, field.GetTextPos().y );
430 
431  default:
432  // we can't assert here because wxWidgets sometimes calls this without checking
433  // the column type when trying to see if there's an overflow
434  break;
435  }
436 
437  return wxT( "bad wxWidgets!" );
438 }
439 
440 
441 template <class T>
442 bool FIELDS_GRID_TABLE<T>::GetValueAsBool( int aRow, int aCol )
443 {
444  wxCHECK( aRow < GetNumberRows(), false );
445  const T& field = this->at( (size_t) aRow );
446 
447  switch( aCol )
448  {
449  case FDC_SHOWN: return field.IsVisible();
450  case FDC_ITALIC: return field.IsItalic();
451  case FDC_BOLD: return field.IsBold();
452  default:
453  wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) );
454  return false;
455  }
456 }
457 
458 
459 template <class T>
460 void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue )
461 {
462  wxCHECK( aRow < GetNumberRows(), /*void*/ );
463  T& field = this->at( (size_t) aRow );
464  wxPoint pos;
465 
466  switch( aCol )
467  {
468  case FDC_NAME:
469  field.SetName( aValue );
470  break;
471 
472  case FDC_VALUE:
473  field.SetText( aValue );
474  break;
475 
476  case FDC_SHOWN:
477  field.SetVisible( BoolFromString( aValue ) );
478  break;
479 
480  case FDC_H_ALIGN:
481  if( aValue == _( "Left" ) )
482  field.SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
483  else if( aValue == _( "Center" ) )
484  field.SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
485  else if( aValue == _( "Right" ) )
486  field.SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
487  else
488  wxFAIL_MSG( wxT( "unknown horizontal alignment: " ) + aValue );
489  break;
490 
491  case FDC_V_ALIGN:
492  if( aValue == _( "Top" ) )
493  field.SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
494  else if( aValue == _( "Center" ) )
495  field.SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
496  else if( aValue == _( "Bottom" ) )
497  field.SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
498  else
499  wxFAIL_MSG( wxT( "unknown vertical alignment: " ) + aValue);
500  break;
501 
502  case FDC_ITALIC:
503  field.SetItalic( BoolFromString( aValue ) );
504  break;
505 
506  case FDC_BOLD:
507  field.SetBold( BoolFromString( aValue ) );
508  break;
509 
510  case FDC_TEXT_SIZE:
511  field.SetTextSize( wxSize( ValueFromString( m_userUnits, aValue ),
512  ValueFromString( m_userUnits, aValue ) ) );
513  break;
514 
515  case FDC_ORIENTATION:
516  if( aValue == _( "Horizontal" ) )
517  field.SetTextAngle( TEXT_ANGLE_HORIZ );
518  else if( aValue == _( "Vertical" ) )
519  field.SetTextAngle( TEXT_ANGLE_VERT );
520  else
521  wxFAIL_MSG( wxT( "unknown orientation: " ) + aValue );
522  break;
523 
524  case FDC_POSX:
525  case FDC_POSY:
526  pos = field.GetTextPos();
527  if( aCol == FDC_POSX )
528  pos.x = ValueFromString( m_userUnits, aValue );
529  else
530  pos.y = ValueFromString( m_userUnits, aValue );
531  field.SetTextPos( pos );
532  break;
533 
534  default:
535  wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a string value" ), aCol ) );
536  break;
537  }
538 
539  GetView()->Refresh();
540 }
541 
542 
543 template <class T>
544 void FIELDS_GRID_TABLE<T>::SetValueAsBool( int aRow, int aCol, bool aValue )
545 {
546  wxCHECK( aRow < GetNumberRows(), /*void*/ );
547  T& field = this->at( (size_t) aRow );
548 
549  switch( aCol )
550  {
551  case FDC_SHOWN:
552  field.SetVisible( aValue );
553  break;
554  case FDC_ITALIC:
555  field.SetItalic( aValue );
556  break;
557  case FDC_BOLD:
558  field.SetBold( aValue );
559  break;
560  default:
561  wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) );
562  break;
563  }
564 }
565 
566 
567 // Explicit Instantiations
568 
569 template class FIELDS_GRID_TABLE<SCH_FIELD>;
570 template class FIELDS_GRID_TABLE<LIB_FIELD>;
571 
572 
574 {
575  if( m_grid->GetGridCursorRow() == FOOTPRINT_FIELD && m_grid->GetGridCursorCol() == FDC_VALUE )
576  {
577  menu.Append( MYID_SELECT_FOOTPRINT, _( "Select Footprint..." ),
578  _( "Browse for footprint" ) );
579  menu.AppendSeparator();
580  }
581  else if( m_grid->GetGridCursorRow() == DATASHEET_FIELD && m_grid->GetGridCursorCol() == FDC_VALUE )
582  {
583  menu.Append( MYID_SHOW_DATASHEET, _( "Show Datasheet" ),
584  _( "Show datasheet in browser" ) );
585  menu.AppendSeparator();
586  }
587 
589 }
590 
591 
592 void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
593 {
594  if( event.GetId() == MYID_SELECT_FOOTPRINT )
595  {
596  // pick a footprint using the footprint picker.
597  wxString fpid = m_grid->GetCellValue( FOOTPRINT_FIELD, FDC_VALUE );
599 
600  if( frame->ShowModal( &fpid, m_dlg ) )
601  m_grid->SetCellValue( FOOTPRINT_FIELD, FDC_VALUE, fpid );
602 
603  frame->Destroy();
604  }
605  else if (event.GetId() == MYID_SHOW_DATASHEET )
606  {
607  wxString datasheet_uri = m_grid->GetCellValue( DATASHEET_FIELD, FDC_VALUE );
608  GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj() );
609  }
610  else
611  {
613  }
614 }
615 
616 
617 template <class T>
618 wxString FIELDS_GRID_TABLE<T>::StringFromBool( bool aValue ) const
619 {
620  if( aValue )
621  return wxT( "1" );
622  else
623  return wxT( "0" );
624 }
625 
626 
627 template <class T>
628 bool FIELDS_GRID_TABLE<T>::BoolFromString( wxString aValue ) const
629 {
630  if( aValue == "1" )
631  {
632  return true;
633  }
634  else if( aValue == "0" )
635  {
636  return false;
637  }
638  else
639  {
640  wxFAIL_MSG( wxString::Format( "string \"%s\" can't be converted to boolean "
641  "correctly, it will have been perceived as FALSE", aValue ) );
642  return false;
643  }
644 }
bool BoolFromString(wxString aValue) const
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: eda_text.h:50
virtual void showPopupMenu(wxMenu &menu) override
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, PROJECT *aProject)
Function GetAssociatedDocument open a document (file) with the suitable browser.
Definition: eda_doc.cpp:79
KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of ...
Definition: kiway_player.h:61
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
int GetUserUnits()
Returns the currently selected user unit value for the interface.
bool CanSetValueAs(int aRow, int aCol, const wxString &aTypeName) override
The first 2 are mandatory, and must be instantiated in SCH_SHEET.
Definition: sch_sheet.h:71
This file is part of the common library.
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
TEMPLATES m_TemplateFieldNames
#define FIELD_VALUE
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:83
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
wxString GetColLabelValue(int aCol) override
#define SHEETNAME_V
name of datasheet
This class works around a bug in wxGrid where the first keystroke doesn't get sent through the valida...
Definition: validators.h:44
Field Value of part, i.e. "3.3K".
WX_GRID * m_grid
I don't own the grid, but he owns me.
Definition: grid_tricks.h:59
wxString StringFromBool(bool aValue) const
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:345
long long int ValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: base_units.cpp:444
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
Definitions of control validators for schematic dialogs.
wxString GetValue(int aRow, int aCol) override
#define SHEETFILENAME_V
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override
Define a library symbol object.
Definition of file extensions used in Kicad.
#define FIELD_NAME
static const wxString GetDefaultFieldName(int aFieldNdx)
Definition: sch_sheet.cpp:44
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslate=true)
Function GetDefaultFieldName returns a default symbol field name for field aFieldNdx for all componen...
Editor for wxGrid cells that adds a file/folder browser to the grid input field.
wxGridCellAttr * GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind) override
void initGrid(DIALOG_SHIM *aDialog)
virtual void SetValidator(const wxValidator &validator) override
Definition: validators.cpp:46
const TEMPLATE_FIELDNAME * GetFieldName(const wxString &aName)
Function GetFieldName searches for aName in the the template field name list.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:219
Field Name Module PCB, i.e. "16DIP300".
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
virtual void doPopupSelection(wxCommandEvent &event)
bool GetValueAsBool(int aRow, int aCol) override
virtual void showPopupMenu(wxMenu &menu)
void SetValue(int aRow, int aCol, const wxString &aValue) override
#define _(s)
Definition: 3d_actions.cpp:33
const std::string KiCadSchematicFileExtension
These settings were stored in SCH_BASE_FRAME previously.
Struct TEMPLATE_FIELDNAME holds a name of a component's field, field value, and default visibility.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:220
#define TEXT_ANGLE_VERT
Definition: eda_text.h:51
Definition for part library class.
FIELDS_GRID_TABLE(DIALOG_SHIM *aDialog, SCH_BASE_FRAME *aFrame, LIB_PART *aPart)
void SetValueAsBool(int aRow, int aCol, bool aValue) override
Field Reference of part, i.e. "IC21".
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
virtual void doPopupSelection(wxCommandEvent &event) override
virtual bool ShowModal(wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxF...
Custom text control validator definitions.
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.