KiCad PCB EDA Suite
dialog_field_properties.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) 2012 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com
5  * Copyright (C) 2016 Wayne Stambaugh, stambaughw@gmail.com
6  * Copyright (C) 2004-2021 KiCad Developers, see AITHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #include <bitmaps.h>
27 #include <kiway.h>
28 #include <confirm.h>
29 #include <string_utils.h>
30 #include <sch_base_frame.h>
31 #include <sch_edit_frame.h>
32 #include <ee_collectors.h>
33 #include <sch_symbol.h>
34 #include <lib_field.h>
35 #include <template_fieldnames.h>
36 #include <symbol_library.h>
37 #include <sch_validators.h>
38 #include <schematic.h>
40 #include <sch_text.h>
41 #include <scintilla_tricks.h>
43 
44 
46  const EDA_TEXT* aTextItem ) :
48  m_posX( aParent, m_xPosLabel, m_xPosCtrl, m_xPosUnits, true ),
49  m_posY( aParent, m_yPosLabel, m_yPosCtrl, m_yPosUnits, true ),
50  m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
51  m_firstFocus( true ),
52  m_scintillaTricks( nullptr )
53 {
54  wxASSERT( aTextItem );
55 
56  SetTitle( aTitle );
57 
58  m_note->SetFont( KIUI::GetInfoFont( this ).Italic() );
59  m_note->Show( false );
60 
61  // The field ID and power status are Initialized in the derived object's ctor.
63  m_isPower = false;
64 
65  m_scintillaTricks = new SCINTILLA_TRICKS( m_StyledTextCtrl, wxT( "{}" ), true,
66  [this]()
67  {
68  wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
69  } );
70  m_StyledTextCtrl->SetEOLMode( wxSTC_EOL_LF ); // Normalize EOL across platforms
71 
72  m_text = aTextItem->GetText();
73  m_isItalic = aTextItem->IsItalic();
74  m_isBold = aTextItem->IsBold();
75  m_position = aTextItem->GetTextPos();
76  m_size = aTextItem->GetTextWidth();
77  m_isVertical = ( aTextItem->GetTextAngle() == TEXT_ANGLE_VERT );
78  m_verticalJustification = aTextItem->GetVertJustify() + 1;
79  m_horizontalJustification = aTextItem->GetHorizJustify() + 1;
80  m_isVisible = aTextItem->IsVisible();
81 }
82 
83 
85 {
86  delete m_scintillaTricks;
87 }
88 
89 
91 {
92  SCH_BASE_FRAME* parent = GetParent();
93  bool isSymbolEditor = parent && parent->IsType( FRAME_SCH_SYMBOL_EDITOR );
94 
95  // Disable options for graphic text editing which are not needed for fields.
96  m_CommonConvert->Show( false );
97  m_CommonUnit->Show( false );
98 
99  // Predefined fields cannot contain some chars, or cannot be empty,
100  // and need a SCH_FIELD_VALIDATOR (m_StyledTextCtrl cannot use a SCH_FIELD_VALIDATOR).
101  bool use_validator = m_fieldId == REFERENCE_FIELD
102  || m_fieldId == VALUE_FIELD
105  || m_fieldId == SHEETNAME_V
107 
108  if( use_validator )
109  {
110  m_TextCtrl->SetValidator( SCH_FIELD_VALIDATOR( isSymbolEditor, m_fieldId, &m_text ) );
112 
113  m_StyledTextCtrl->Show( false );
114  }
115  else
116  {
118 
119  m_TextCtrl->Show( false );
120  }
121 
122  // Show the footprint selection dialog if this is the footprint field.
125 
126  // Value fields of power symbols cannot be modified. This will grey out
127  // the text box and display an explanation.
128  if( m_fieldId == VALUE_FIELD && m_isPower )
129  {
130  m_note->SetLabel( wxString::Format( m_note->GetLabel(),
131  _( "Power symbol value field text cannot be changed." ) ) );
132  m_note->Show( true );
133  m_TextCtrl->Enable( false );
134  }
135  else
136  {
137  m_TextCtrl->Enable( true );
138  }
139 
140  m_sdbSizerButtonsOK->SetDefault();
141 
142  GetSizer()->SetSizeHints( this );
143 
144  // Adjust the height of the scintilla text editor after the first layout
145  // To show only one line
146  // (multiline text are is supported in fields and will be removed)
147  if( m_StyledTextCtrl->IsShown() )
148  {
149  wxSize maxSize = m_StyledTextCtrl->GetSize();
150  maxSize.x = -1; // Do not fix the max width
151  maxSize.y = m_xPosCtrl->GetSize().y;
152  m_StyledTextCtrl->SetMaxSize( maxSize );
153  m_StyledTextCtrl->SetUseVerticalScrollBar( false );
154  m_StyledTextCtrl->SetUseHorizontalScrollBar( false );
155  }
156 
157  // Now all widgets have the size fixed, call FinishDialogSettings
159 }
160 
161 
163 {
164  // pick a footprint using the footprint picker.
165  wxString fpid;
166 
167  if( m_StyledTextCtrl->IsShown() )
168  fpid = m_StyledTextCtrl->GetValue();
169  else
170  fpid = m_TextCtrl->GetValue();
171 
173 
174  if( frame->ShowModal( &fpid, this ) )
175  {
176  if( m_StyledTextCtrl->IsShown() )
177  m_StyledTextCtrl->SetValue( fpid );
178  else
179  m_TextCtrl->SetValue( fpid );
180  }
181 
182  frame->Destroy();
183 }
184 
185 
186 void DIALOG_FIELD_PROPERTIES::OnSetFocusText( wxFocusEvent& event )
187 {
188  if( m_firstFocus )
189  {
190 #ifdef __WXGTK__
191  // Force an update of the text control before setting the text selection
192  // This is needed because GTK seems to ignore the selection on first update
193  //
194  // Note that we can't do this on OSX as it tends to provoke Apple's
195  // "[NSAlert runModal] may not be invoked inside of transaction begin/commit pair"
196  // bug. See: https://bugs.launchpad.net/kicad/+bug/1837225
198  m_TextCtrl->Update();
199 #endif
200 
201  if( m_fieldId == REFERENCE_FIELD )
202  KIUI::SelectReferenceNumber( static_cast<wxTextEntry*>( m_TextCtrl ) );
203  else if( m_fieldId == VALUE_FIELD || m_fieldId == SHEETNAME_V )
204  m_TextCtrl->SetSelection( -1, -1 );
205 
206  m_firstFocus = false;
207  }
208 
209  event.Skip();
210 }
211 
212 
214 {
215  if( m_TextCtrl->IsShown() )
216  m_TextCtrl->SetValue( m_text );
217  else if( m_StyledTextCtrl->IsShown() )
218  m_StyledTextCtrl->SetValue( m_text );
219 
223  m_orientChoice->SetSelection( m_isVertical ? 1 : 0 );
224  m_hAlignChoice->SetSelection( m_horizontalJustification );
225  m_vAlignChoice->SetSelection( m_verticalJustification );
226  m_visible->SetValue( m_isVisible );
227  m_italic->SetValue( m_isItalic );
228  m_bold->SetValue( m_isBold );
229 
230  return true;
231 }
232 
233 
235 {
236  if( m_TextCtrl->IsShown() )
237  m_text = m_TextCtrl->GetValue();
238  else if( m_StyledTextCtrl->IsShown() )
239  m_text = m_StyledTextCtrl->GetValue();
240 
241  if( m_fieldId == REFERENCE_FIELD )
242  {
243  // Test if the reference string is valid:
245  {
246  DisplayError( this, _( "Illegal reference designator value!" ) );
247  return false;
248  }
249  }
250  else if( m_fieldId == VALUE_FIELD )
251  {
252  if( m_text.IsEmpty() )
253  {
254  DisplayError( this, _( "Value may not be empty." ) );
255  return false;
256  }
257  }
258  else if( m_fieldId == SHEETFILENAME_V )
259  {
260  wxFileName fn( m_text );
261 
262  // It's annoying to throw up nag dialogs when the extension isn't right. Just
263  // fix it.
264  if( fn.GetExt().CmpNoCase( KiCadSchematicFileExtension ) != 0 )
265  {
266  fn.SetExt( KiCadSchematicFileExtension );
267  m_text = fn.GetFullPath();
268  }
269  }
270 
271  m_isVertical = m_orientChoice->GetSelection() == 1;
272  m_position = wxPoint( m_posX.GetValue(), m_posY.GetValue() );
274  m_horizontalJustification = m_hAlignChoice->GetSelection();
275  m_verticalJustification = m_vAlignChoice->GetSelection();
276  m_isVisible = m_visible->GetValue();
277  m_isItalic = m_italic->GetValue();
278  m_isBold = m_bold->GetValue();
279 
280  return true;
281 }
282 
283 
285 {
286  aText->SetTextPos( m_position );
287 
288  if( aText->GetTextWidth() != m_size )
289  aText->SetTextSize( wxSize( m_size, m_size ) );
290 
291  aText->SetVisible( m_isVisible );
293  aText->SetItalic( m_isItalic );
294  aText->SetBold( m_isBold );
297 }
298 
299 
301  const wxString& aTitle,
302  const LIB_FIELD* aField ) :
303  DIALOG_FIELD_PROPERTIES( aParent, aTitle, aField )
304 {
305  m_fieldId = aField->GetId();
306 
307  if( m_fieldId == VALUE_FIELD )
308  m_text = UnescapeString( aField->GetText() );
309 
310  // When in the library editor, power symbols can be renamed.
311  m_isPower = false;
312  init();
313 }
314 
315 
317  const wxString& aTitle,
318  const SCH_FIELD* aField ) :
319  DIALOG_FIELD_PROPERTIES( aParent, aTitle, aField ),
320  m_field( aField )
321 {
322  m_isSheetFilename = false;
323 
324  if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
325  {
326  m_fieldId = aField->GetId();
327  }
328  else if( aField->GetParent() && aField->GetParent()->Type() == SCH_SHEET_T )
329  {
330  switch( aField->GetId() )
331  {
332  case SHEETNAME:
334  break;
335 
336  case SHEETFILENAME:
337  m_isSheetFilename = true;
339  m_note->SetLabel( wxString::Format( m_note->GetLabel(),
340  _( "Sheet filename can only be modified in Sheet Properties dialog." ) ) );
341  m_note->Show( true );
342  break;
343 
344  default:
346  break;
347  }
348  }
349 
350  // show text variable cross-references in a human-readable format
351  m_text = aField->Schematic()->ConvertKIIDsToRefs( aField->GetText() );
352 
353  m_isPower = false;
354 
355  m_textLabel->SetLabel( m_field->GetName() + ":" );
356 
357  // The library symbol may have been removed so using SCH_SYMBOL::GetLibSymbolRef() here
358  // could result in a segfault. If the library symbol is no longer available, the
359  // schematic fields can still edit so set the power symbol flag to false. This may not
360  // be entirely accurate if the power library is missing but it's better then a segfault.
361  if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
362  {
363  const SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aField->GetParent() );
364  const LIB_SYMBOL* libSymbol = GetParent()->GetLibSymbol( symbol->GetLibId(), true );
365 
366  if( libSymbol && libSymbol->IsPower() )
367  m_isPower = true;
368  }
369 
370  m_StyledTextCtrl->Bind( wxEVT_STC_CHARADDED,
372 
373  init();
374 
375  if( m_isSheetFilename )
376  {
377  m_StyledTextCtrl->Enable( false );
378  m_TextCtrl->Enable( false );
379  }
380 }
381 
382 
383 void DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
384 {
385  int key = aEvent.GetKey();
386 
387  SCH_EDIT_FRAME* editFrame = static_cast<SCH_EDIT_FRAME*>( GetParent() );
388  wxArrayString autocompleteTokens;
389  int pos = m_StyledTextCtrl->GetCurrentPos();
390  int start = m_StyledTextCtrl->WordStartPosition( pos, true );
391  wxString partial;
392 
393  // Currently, '\n' is not allowed in fields. So remove it when entered
394  // TODO: see if we must close the dialog. However this is not obvious, as
395  // if a \n is typed (and removed) when a text is selected, this text is deleted
396  // (in fact replaced by \n, that is removed by the filter)
397  if( key == '\n' )
398  {
399  wxString text = m_StyledTextCtrl->GetText();
400  int currpos = m_StyledTextCtrl->GetCurrentPos();
401  text.Replace( "\n", "" );
402  m_StyledTextCtrl->SetText( text );
403  m_StyledTextCtrl->GotoPos( currpos-1 );
404  return;
405  }
406 
407  auto textVarRef =
408  [&]( int pt )
409  {
410  return pt >= 2
411  && m_StyledTextCtrl->GetCharAt( pt - 2 ) == '$'
412  && m_StyledTextCtrl->GetCharAt( pt - 1 ) == '{';
413  };
414 
415  // Check for cross-reference
416  if( start > 1 && m_StyledTextCtrl->GetCharAt( start - 1 ) == ':' )
417  {
418  int refStart = m_StyledTextCtrl->WordStartPosition( start - 1, true );
419 
420  if( textVarRef( refStart ) )
421  {
422  partial = m_StyledTextCtrl->GetRange( start, pos );
423 
424  wxString ref = m_StyledTextCtrl->GetRange( refStart, start - 1 );
425  SCH_SHEET_LIST sheets = editFrame->Schematic().GetSheets();
426  SCH_REFERENCE_LIST refs;
427  SCH_SYMBOL* refSymbol = nullptr;
428 
429  sheets.GetSymbols( refs );
430 
431  for( size_t jj = 0; jj < refs.GetCount(); jj++ )
432  {
433  if( refs[ jj ].GetSymbol()->GetRef( &refs[ jj ].GetSheetPath(), true ) == ref )
434  {
435  refSymbol = refs[ jj ].GetSymbol();
436  break;
437  }
438  }
439 
440  if( refSymbol )
441  refSymbol->GetContextualTextVars( &autocompleteTokens );
442  }
443  }
444  else if( textVarRef( start ) )
445  {
446  partial = m_StyledTextCtrl->GetTextRange( start, pos );
447 
448  SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( m_field->GetParent() );
449  SCH_SHEET* sheet = dynamic_cast<SCH_SHEET*>( m_field->GetParent() );
450 
451  if( symbol )
452  {
453  symbol->GetContextualTextVars( &autocompleteTokens );
454 
455  SCHEMATIC* schematic = symbol->Schematic();
456 
457  if( schematic && schematic->CurrentSheet().Last() )
458  schematic->CurrentSheet().Last()->GetContextualTextVars( &autocompleteTokens );
459  }
460 
461  if( sheet )
462  sheet->GetContextualTextVars( &autocompleteTokens );
463 
464  for( std::pair<wxString, wxString> entry : Prj().GetTextVars() )
465  autocompleteTokens.push_back( entry.first );
466  }
467 
468  m_scintillaTricks->DoAutocomplete( partial, autocompleteTokens );
469  m_StyledTextCtrl->SetFocus();
470 }
471 
472 
474 {
475  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
476  SCH_ITEM* parent = dynamic_cast<SCH_ITEM*>( aField->GetParent() );
477  int fieldType = aField->GetId();
478 
479  if( parent && parent->Type() == SCH_SYMBOL_T )
480  {
481  SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( parent );
482 
483  if( fieldType == REFERENCE_FIELD )
484  symbol->SetRef( aSheetPath, m_text );
485  else if( fieldType == VALUE_FIELD )
486  symbol->SetValue( m_text );
487  else if( fieldType == FOOTPRINT_FIELD )
488  symbol->SetFootprint( m_text );
489  }
490 
491  bool positioningModified = false;
492 
493  if( aField->GetTextPos() != m_position )
494  positioningModified = true;
495 
496  if( ( aField->GetTextAngle() == TEXT_ANGLE_VERT ) != m_isVertical )
497  positioningModified = true;
498 
500  positioningModified = true;
501 
503  positioningModified = true;
504 
505  // convert any text variable cross-references to their UUIDs
506  m_text = aField->Schematic()->ConvertRefsToKIIDs( m_text );
507 
508  aField->SetText( m_text );
509  updateText( aField );
510 
511  // The value, footprint and datasheet fields should be kept in sync in multi-unit parts.
512  // Of course the symbol must be annotated to collect other units.
513  if( editFrame && parent && parent->Type() == SCH_SYMBOL_T )
514  {
515  SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( parent );
516 
517  if( symbol->IsAnnotated( aSheetPath ) && ( fieldType == VALUE_FIELD
518  || fieldType == FOOTPRINT_FIELD
519  || fieldType == DATASHEET_FIELD ) )
520  {
521  wxString ref = symbol->GetRef( aSheetPath );
522  int unit = symbol->GetUnit();
523  LIB_ID libId = symbol->GetLibId();
524 
525  for( SCH_SHEET_PATH& sheet : editFrame->Schematic().GetSheets() )
526  {
527  SCH_SCREEN* screen = sheet.LastScreen();
528  std::vector<SCH_SYMBOL*> otherUnits;
529  constexpr bool appendUndo = true;
530 
531  CollectOtherUnits( ref, unit, libId, sheet, &otherUnits );
532 
533  for( SCH_SYMBOL* otherUnit : otherUnits )
534  {
535  editFrame->SaveCopyInUndoList( screen, otherUnit, UNDO_REDO::CHANGED,
536  appendUndo );
537 
538  if( fieldType == VALUE_FIELD )
539  otherUnit->SetValue( m_text );
540  else if( fieldType == FOOTPRINT_FIELD )
541  otherUnit->SetFootprint( m_text );
542  else
543  otherUnit->GetField( DATASHEET_FIELD )->SetText( m_text );
544 
545  editFrame->UpdateItem( otherUnit, false, true );
546  }
547  }
548  }
549  }
550 
551  if( positioningModified && parent )
552  parent->ClearFieldsAutoplaced();
553 }
Field Reference of part, i.e. "IC21".
virtual bool ShowModal(wxString *aResult=nullptr, wxWindow *aResultantFocusWindow=nullptr)
Show this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until t...
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:279
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
#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
bool IsBold() const
Definition: eda_text.h:183
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:49
void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:185
Class DIALOG_LIB_TEXT_PROPERTIES_BASE.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:64
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:199
Holds all the data relating to one schematic.
Definition: schematic.h:59
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
This file is part of the common library.
Add cut/copy/paste, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
A base class to edit schematic and symbol library fields.
void DoAutocomplete(const wxString &aPartial, const wxArrayString &aTokens)
void updateText(EDA_TEXT *aText)
void SetItalic(bool isItalic)
Definition: eda_text.h:179
Field object used in symbol libraries.
Definition: lib_field.h:59
DIALOG_SCH_FIELD_PROPERTIES(SCH_BASE_FRAME *aParent, const wxString &aTitle, const SCH_FIELD *aField)
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
Definition: sch_symbol.cpp:594
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:246
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:144
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this sheet.
Definition: sch_sheet.cpp:196
double GetTextAngle() const
Definition: eda_text.h:174
int GetId() const
Definition: sch_field.h:113
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:383
Schematic editor (Eeschema) main window.
void CollectOtherUnits(const wxString &aRef, int aUnit, const LIB_ID &aLibId, SCH_SHEET_PATH &aSheet, std::vector< SCH_SYMBOL * > *otherUnits)
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:237
int GetId() const
Definition: lib_field.h:115
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:441
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
Define a library symbol object.
Definition: lib_symbol.h:96
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
Definition: sch_symbol.cpp:645
#define SHEETNAME_V
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:97
name of datasheet
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
bool IsItalic() const
Definition: eda_text.h:180
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:119
void onScintillaCharAdded(wxStyledTextEvent &aEvent)
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
Definition: sch_symbol.cpp:928
virtual void SetVisible(bool aVisible)
Definition: eda_text.h:185
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:198
static EDA_TEXT_HJUSTIFY_T MapHorizJustify(int aHorizJustify)
Definition: eda_text.cpp:63
Field Value of part, i.e. "3.3K".
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:114
wxString ConvertRefsToKIIDs(const wxString &aSource) const
Definition: schematic.cpp:288
virtual bool IsVisible() const
Definition: eda_text.h:186
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:202
Definitions of control validators for schematic dialogs.
#define SHEETFILENAME_V
DIALOG_FIELD_PROPERTIES(SCH_BASE_FRAME *aParent, const wxString &aTitle, const EDA_TEXT *aTextItem)
SCHEMATIC & Schematic() const
Definition of file extensions used in Kicad.
size_t GetCount() const
void ClearFieldsAutoplaced()
Definition: sch_item.h:421
Definition for symbol library class.
EDA_ITEM * GetParent() const
Definition: eda_item.h:115
#define _(s)
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void OnTextValueSelectButtonClick(wxCommandEvent &aEvent) override
Handle the select button next to the text value field.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
static EDA_TEXT_VJUSTIFY_T MapVertJustify(int aVertJustify)
Definition: eda_text.cpp:77
#define SHEETUSERFIELD_V
wxString UnescapeString(const wxString &aSource)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
bool IsAnnotated(const SCH_SHEET_PATH *aSheet)
Check if the symbol has a valid annotation (reference) for the given sheet path.
Definition: sch_symbol.cpp:517
SCINTILLA_TRICKS * m_scintillaTricks
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
wxString ConvertKIIDsToRefs(const wxString &aSource) const
Definition: schematic.cpp:344
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:87
int GetTextWidth() const
Definition: eda_text.h:241
DIALOG_LIB_FIELD_PROPERTIES(SCH_BASE_FRAME *aParent, const wxString &aTitle, const LIB_FIELD *aField)
Schematic symbol object.
Definition: sch_symbol.h:78
bool IsType(FRAME_T aType) const
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:201
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend)
Create a copy of the current schematic item, and put it in the undo list.
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
Definition: sch_symbol.cpp:481
wxString GetName(bool aUseDefaultName=true) const
Return the field name.
Definition: sch_field.cpp:582
const std::string KiCadSchematicFileExtension
virtual long long int GetValue()
Return the current value in Internal Units.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
LIB_SYMBOL * GetLibSymbol(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
#define TEXT_ANGLE_VERT
Definition: eda_text.h:51
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:167
void UpdateField(SCH_FIELD *aField, SCH_SHEET_PATH *aSheetPath)
A text control validator used for validating the text allowed in library and schematic symbol fields.
int GetUnit() const
Definition: sch_symbol.h:195
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:121
static bool IsReferenceStringValid(const wxString &aReferenceString)
Test for an acceptable reference string.
Definition: sch_symbol.cpp:475
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
void SetBold(bool aBold)
Definition: eda_text.h:182
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
virtual void OnSetFocusText(wxFocusEvent &event) override
Used to select the variant part of some text fields (for instance, the question mark or number in a r...
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:147
Field Name Module PCB, i.e. "16DIP300".