KiCad PCB EDA Suite
dialog_edit_one_field.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 change_log.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 <kicad_string.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 <class_library.h>
37 #include <sch_validators.h>
38 #include <schematic.h>
39 #include <dialog_edit_one_field.h>
40 #include <sch_text.h>
41 #include <scintilla_tricks.h>
42 
44  const EDA_TEXT* aTextItem ) :
45  DIALOG_LIB_EDIT_TEXT_BASE( aParent ),
46  m_posX( aParent, m_xPosLabel, m_xPosCtrl, m_xPosUnits, true ),
47  m_posY( aParent, m_yPosLabel, m_yPosCtrl, m_yPosUnits, true ),
48  m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
49  m_firstFocus( true ),
50  m_scintillaTricks( nullptr )
51 {
52  wxASSERT( aTextItem );
53 
54  SetTitle( aTitle );
55 
56  // The field ID and power status are Initialized in the derived object's ctor.
58  m_isPower = false;
59 
61 
62  m_text = aTextItem->GetText();
63  m_isItalic = aTextItem->IsItalic();
64  m_isBold = aTextItem->IsBold();
65  m_position = aTextItem->GetTextPos();
66  m_size = aTextItem->GetTextWidth();
67  m_isVertical = ( aTextItem->GetTextAngle() == TEXT_ANGLE_VERT );
68  m_verticalJustification = aTextItem->GetVertJustify() + 1;
69  m_horizontalJustification = aTextItem->GetHorizJustify() + 1;
70  m_isVisible = aTextItem->IsVisible();
71 }
72 
73 
75 {
76  delete m_scintillaTricks;
77 }
78 
79 
81 {
82  SCH_BASE_FRAME* parent = GetParent();
83  bool isSymbolEditor = parent->IsType( FRAME_SCH_SYMBOL_EDITOR );
84 
85  m_TextCtrl->SetValidator( SCH_FIELD_VALIDATOR( isSymbolEditor, m_fieldId, &m_text ) );
86 
87  // Disable options for graphic text editing which are not needed for fields.
88  m_CommonConvert->Show( false );
89  m_CommonUnit->Show( false );
90 
91  // Predefined fields cannot contain some chars, or cannot be empty,
92  // and need a SCH_FIELD_VALIDATOR (m_StyledTextCtrl cannot use a SCH_FIELD_VALIDATOR).
93  bool use_validator = m_fieldId == REFERENCE_FIELD
97  if( use_validator )
98  {
99  m_StyledTextCtrl->Show( false );
101  }
102  else
103  {
104  m_TextCtrl->Show( false );
106  }
107 
108  // Show the footprint selection dialog if this is the footprint field.
111 
112  // Value fields of power components cannot be modified. This will grey out
113  // the text box and display an explanation.
114  if( m_fieldId == VALUE_FIELD && m_isPower )
115  {
116  m_PowerComponentValues->Show( true );
117  m_TextCtrl->Enable( false );
118  }
119  else
120  {
121  m_PowerComponentValues->Show( false );
122  m_TextCtrl->Enable( true );
123  }
124 
125  m_sdbSizerButtonsOK->SetDefault();
126 
127  GetSizer()->SetSizeHints( this );
128 
129  // Adjust the height of the scintilla text editor after the first layout
130  if( m_StyledTextCtrl->IsShown() )
131  {
132  wxSize maxSize = m_StyledTextCtrl->GetSize();
133  maxSize.y = m_xPosCtrl->GetSize().y;
134  m_StyledTextCtrl->SetMaxSize( maxSize );
135  m_StyledTextCtrl->SetUseVerticalScrollBar( false );
136  m_StyledTextCtrl->SetUseHorizontalScrollBar( false );
137  }
138 
139  // Now all widgets have the size fixed, call FinishDialogSettings
141 }
142 
143 
145 {
146  // pick a footprint using the footprint picker.
147  wxString fpid;
148 
149  if( m_StyledTextCtrl->IsShown() )
150  fpid = m_StyledTextCtrl->GetValue();
151  else
152  fpid = m_TextCtrl->GetValue();
153 
155 
156  if( frame->ShowModal( &fpid, this ) )
157  {
158  if( m_StyledTextCtrl->IsShown() )
159  m_StyledTextCtrl->SetValue( fpid );
160  else
161  m_TextCtrl->SetValue( fpid );
162  }
163 
164  frame->Destroy();
165 }
166 
167 
168 void DIALOG_EDIT_ONE_FIELD::OnSetFocusText( wxFocusEvent& event )
169 {
170  if( m_firstFocus )
171  {
172 #ifdef __WXGTK__
173  // Force an update of the text control before setting the text selection
174  // This is needed because GTK seems to ignore the selection on first update
175  //
176  // Note that we can't do this on OSX as it tends to provoke Apple's
177  // "[NSAlert runModal] may not be invoked inside of transaction begin/commit pair"
178  // bug. See: https://bugs.launchpad.net/kicad/+bug/1837225
180  m_TextCtrl->Update();
181 #endif
182 
183  if( m_fieldId == REFERENCE_FIELD )
184  KIUI::SelectReferenceNumber( static_cast<wxTextEntry*>( m_TextCtrl ) );
185  else if( m_fieldId == VALUE_FIELD || m_fieldId == SHEETNAME_V )
186  m_TextCtrl->SetSelection( -1, -1 );
187 
188  m_firstFocus = false;
189  }
190 
191  event.Skip();
192 }
193 
194 
196 {
197  if( m_TextCtrl->IsShown() )
198  m_TextCtrl->SetValue( m_text );
199  else if( m_StyledTextCtrl->IsShown() )
200  m_StyledTextCtrl->SetValue( m_text );
201 
205  m_orientChoice->SetSelection( m_isVertical ? 1 : 0 );
206  m_hAlignChoice->SetSelection( m_horizontalJustification );
207  m_vAlignChoice->SetSelection( m_verticalJustification );
208  m_visible->SetValue( m_isVisible );
209  m_italic->SetValue( m_isItalic );
210  m_bold->SetValue( m_isBold );
211 
212  return true;
213 }
214 
215 
217 {
218  if( m_TextCtrl->IsShown() )
219  m_text = m_TextCtrl->GetValue();
220  else if( m_StyledTextCtrl->IsShown() )
221  m_text = m_StyledTextCtrl->GetValue();
222 
223  if( m_fieldId == REFERENCE_FIELD )
224  {
225  // Test if the reference string is valid:
227  {
228  DisplayError( this, _( "Illegal reference designator value!" ) );
229  return false;
230  }
231  }
232  else if( m_fieldId == VALUE_FIELD )
233  {
234  if( m_text.IsEmpty() )
235  {
236  DisplayError( this, _( "Value may not be empty." ) );
237  return false;
238  }
239  }
240 
241  m_isVertical = m_orientChoice->GetSelection() == 1;
242  m_position = wxPoint( m_posX.GetValue(), m_posY.GetValue() );
244  m_horizontalJustification = m_hAlignChoice->GetSelection();
245  m_verticalJustification = m_vAlignChoice->GetSelection();
246  m_isVisible = m_visible->GetValue();
247  m_isItalic = m_italic->GetValue();
248  m_isBold = m_bold->GetValue();
249 
250  return true;
251 }
252 
253 
255 {
256  aText->SetTextPos( m_position );
257  aText->SetTextSize( wxSize( m_size, m_size ) );
258  aText->SetVisible( m_isVisible );
260  aText->SetItalic( m_isItalic );
261  aText->SetBold( m_isBold );
264 }
265 
266 
268  const wxString& aTitle,
269  const LIB_FIELD* aField ) :
270  DIALOG_EDIT_ONE_FIELD( aParent, aTitle, aField )
271 {
272  m_fieldId = aField->GetId();
273 
274  // When in the library editor, power components can be renamed.
275  m_isPower = false;
276  init();
277 }
278 
279 
281  const wxString& aTitle,
282  const SCH_FIELD* aField ) :
283  DIALOG_EDIT_ONE_FIELD( aParent, aTitle, aField ),
284  m_field( aField )
285 {
286  if( aField->GetParent() && aField->GetParent()->Type() == SCH_COMPONENT_T )
287  {
288  m_fieldId = aField->GetId();
289  }
290  else if( aField->GetParent() && aField->GetParent()->Type() == SCH_SHEET_T )
291  {
292  switch( aField->GetId() )
293  {
294  case SHEETNAME: m_fieldId = SHEETNAME_V; break;
295  case SHEETFILENAME: m_fieldId = SHEETFILENAME_V; break;
296  default: m_fieldId = SHEETUSERFIELD_V; break;
297  }
298  }
299 
300  // show text variable cross-references in a human-readable format
301  m_text = aField->Schematic()->ConvertKIIDsToRefs( aField->GetText() );
302 
303  m_isPower = false;
304 
305  m_textLabel->SetLabel( m_field->GetName() + ":" );
306 
307  // The library symbol may have been removed so using SCH_COMPONENT::GetPartRef() here
308  // could result in a segfault. If the library symbol is no longer available, the
309  // schematic fields can still edit so set the power symbol flag to false. This may not
310  // be entirely accurate if the power library is missing but it's better then a segfault.
311  if( aField->GetParent() && aField->GetParent()->Type() == SCH_COMPONENT_T )
312  {
313  const SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
314  const LIB_PART* part = GetParent()->GetLibPart( component->GetLibId(), true );
315 
316  if( part && part->IsPower() )
317  m_isPower = true;
318  }
319 
320  m_StyledTextCtrl->Bind( wxEVT_STC_CHARADDED, &DIALOG_SCH_EDIT_ONE_FIELD::onScintillaCharAdded, this );
321 
322  init();
323 }
324 
325 
326 void DIALOG_SCH_EDIT_ONE_FIELD::onScintillaCharAdded( wxStyledTextEvent &aEvent )
327 {
328  SCH_EDIT_FRAME* editFrame = static_cast<SCH_EDIT_FRAME*>( GetParent() );
329  wxArrayString autocompleteTokens;
330  int pos = m_StyledTextCtrl->GetCurrentPos();
331  int start = m_StyledTextCtrl->WordStartPosition( pos, true );
332  wxString partial;
333 
334  auto textVarRef =
335  [&]( int pt )
336  {
337  return pt >= 2
338  && m_StyledTextCtrl->GetCharAt( pt - 2 ) == '$'
339  && m_StyledTextCtrl->GetCharAt( pt - 1 ) == '{';
340  };
341 
342  // Check for cross-reference
343  if( start > 1 && m_StyledTextCtrl->GetCharAt( start - 1 ) == ':' )
344  {
345  int refStart = m_StyledTextCtrl->WordStartPosition( start - 1, true );
346 
347  if( textVarRef( refStart ) )
348  {
349  partial = m_StyledTextCtrl->GetRange( start, pos );
350 
351  wxString ref = m_StyledTextCtrl->GetRange( refStart, start - 1 );
352  SCH_SHEET_LIST sheets = editFrame->Schematic().GetSheets();
353  SCH_REFERENCE_LIST refs;
354  SCH_COMPONENT* refSymbol = nullptr;
355 
356  sheets.GetSymbols( refs );
357 
358  for( size_t jj = 0; jj < refs.GetCount(); jj++ )
359  {
360  if( refs[ jj ].GetSymbol()->GetRef( &refs[ jj ].GetSheetPath(), true ) == ref )
361  {
362  refSymbol = refs[ jj ].GetSymbol();
363  break;
364  }
365  }
366 
367  if( refSymbol )
368  refSymbol->GetContextualTextVars( &autocompleteTokens );
369  }
370  }
371  else if( textVarRef( start ) )
372  {
373  partial = m_StyledTextCtrl->GetTextRange( start, pos );
374 
375  SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( m_field->GetParent() );
376  SCH_SHEET* sheet = dynamic_cast<SCH_SHEET*>( m_field->GetParent() );
377 
378  if( symbol )
379  {
380  symbol->GetContextualTextVars( &autocompleteTokens );
381 
382  SCHEMATIC* schematic = symbol->Schematic();
383 
384  if( schematic && schematic->CurrentSheet().Last() )
385  schematic->CurrentSheet().Last()->GetContextualTextVars( &autocompleteTokens );
386  }
387 
388  if( sheet )
389  sheet->GetContextualTextVars( &autocompleteTokens );
390 
391  for( std::pair<wxString, wxString> entry : Prj().GetTextVars() )
392  autocompleteTokens.push_back( entry.first );
393  }
394 
395  m_scintillaTricks->DoAutocomplete( partial, autocompleteTokens );
396  m_StyledTextCtrl->SetFocus();
397 }
398 
399 
401 {
402  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
403  SCH_ITEM* parent = dynamic_cast<SCH_ITEM*>( aField->GetParent() );
404  int fieldType = aField->GetId();
405 
406  if( parent && parent->Type() == SCH_COMPONENT_T )
407  {
408  SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( parent );
409 
410  if( fieldType == REFERENCE_FIELD )
411  symbol->SetRef( aSheetPath, m_text );
412  else if( fieldType == VALUE_FIELD )
413  symbol->SetValue( m_text );
414  else if( fieldType == FOOTPRINT_FIELD )
415  symbol->SetFootprint( m_text );
416  }
417 
418  bool positioningModified = false;
419 
420  if( aField->GetTextPos() != m_position )
421  positioningModified = true;
422 
423  if( ( aField->GetTextAngle() == TEXT_ANGLE_VERT ) != m_isVertical )
424  positioningModified = true;
425 
427  positioningModified = true;
428 
430  positioningModified = true;
431 
432  // convert any text variable cross-references to their UUIDs
433  m_text = aField->Schematic()->ConvertRefsToKIIDs( m_text );
434 
435  aField->SetText( m_text );
436  updateText( aField );
437 
438  // The value, footprint and datasheet fields should be kept in sync in multi-unit parts.
439  // Of course the component must be annotated to collect other units.
440  if( editFrame && parent && parent->Type() == SCH_COMPONENT_T )
441  {
442  SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( parent );
443 
444  if( symbol->IsAnnotated( aSheetPath ) && ( fieldType == VALUE_FIELD
445  || fieldType == FOOTPRINT_FIELD
446  || fieldType == DATASHEET_FIELD ) )
447  {
448  wxString ref = symbol->GetRef( aSheetPath );
449  int unit = symbol->GetUnit();
450 
451  for( SCH_SHEET_PATH& sheet : editFrame->Schematic().GetSheets() )
452  {
453  SCH_SCREEN* screen = sheet.LastScreen();
454  std::vector<SCH_COMPONENT*> otherUnits;
455  constexpr bool appendUndo = true;
456 
457  CollectOtherUnits( ref, unit, sheet, &otherUnits );
458 
459  for( SCH_COMPONENT* otherUnit : otherUnits )
460  {
461  editFrame->SaveCopyInUndoList( screen, otherUnit, UNDO_REDO::CHANGED,
462  appendUndo );
463 
464  if( fieldType == VALUE_FIELD )
465  otherUnit->SetValue( m_text );
466  else if( fieldType == FOOTPRINT_FIELD )
467  otherUnit->SetFootprint( m_text );
468  else
469  otherUnit->GetField( DATASHEET_FIELD )->SetText( m_text );
470 
471  editFrame->UpdateItem( otherUnit );
472  }
473  }
474  }
475  }
476 
477  if( positioningModified && parent )
478  parent->ClearFieldsAutoplaced();
479 }
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:252
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:190
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:51
void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:102
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:61
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:56
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Add a SCH_REFERENCE object to aReferences for each component in the list of sheets.
Holds all the data relating to one schematic A schematic may consist of one or more sheets (and one r...
Definition: schematic.h:58
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
SCINTILLA_TRICKS * m_scintillaTricks
This file is part of the common library.
void onScintillaCharAdded(wxStyledTextEvent &aEvent)
Add cut/copy/paste, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
void CollectOtherUnits(const wxString &aRef, int aUnit, SCH_SHEET_PATH &aSheet, std::vector< SCH_COMPONENT * > *otherUnits)
bool IsVisible() const
Definition: eda_text.h:193
void DoAutocomplete(const wxString &aPartial, const wxArrayString &aTokens)
void SetItalic(bool isItalic)
Definition: eda_text.h:186
Field object used in symbol libraries.
Definition: lib_field.h:59
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:253
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this sheet.
Definition: sch_sheet.cpp:195
void SetVisible(bool aVisible)
Definition: eda_text.h:192
double GetTextAngle() const
Definition: eda_text.h:181
int GetId() const
Definition: sch_field.h:120
void UpdateField(SCH_FIELD *aField, SCH_SHEET_PATH *aSheetPath)
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:345
Schematic editor (Eeschema) main window.
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:244
int GetId() const
Definition: lib_field.h:138
#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:98
DIALOG_EDIT_ONE_FIELD(SCH_BASE_FRAME *aParent, const wxString &aTitle, const EDA_TEXT *aTextItem)
name of datasheet
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
DIALOG_SCH_EDIT_ONE_FIELD(SCH_BASE_FRAME *aParent, const wxString &aTitle, const SCH_FIELD *aField)
bool IsItalic() const
Definition: eda_text.h:187
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:119
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:82
DIALOG_LIB_EDIT_ONE_FIELD(SCH_BASE_FRAME *aParent, const wxString &aTitle, const LIB_FIELD *aField)
DIALOG_EDIT_ONE_FIELD is a base class to edit schematic and component library fields.
int GetUnit() const
Definition: sch_symbol.h:236
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
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:121
wxString ConvertRefsToKIIDs(const wxString &aSource) const
Definition: schematic.cpp:243
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:209
Definitions of control validators for schematic dialogs.
#define SHEETFILENAME_V
SCHEMATIC & Schematic() const
Define a library symbol object.
Definition: lib_symbol.h:93
void ClearFieldsAutoplaced()
Set fields automatically placed flag false.
Definition: sch_item.h:451
EDA_ITEM * GetParent() const
Definition: eda_item.h:164
bool IsAnnotated(const SCH_SHEET_PATH *aSheet)
Checks if the component has a valid annotation (reference) for the given sheet path.
Definition: sch_symbol.cpp:532
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
const BITMAP_OPAQUE small_library_xpm[1]
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
Definition: sch_symbol.cpp:925
static EDA_TEXT_VJUSTIFY_T MapVertJustify(int aVertJustify)
Definition: eda_text.cpp:77
bool TransferDataToWindow() override
#define SHEETUSERFIELD_V
void updateText(EDA_TEXT *aText)
Class DIALOG_LIB_EDIT_TEXT_BASE.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:219
unsigned GetCount() const
wxString ConvertKIIDsToRefs(const wxString &aSource) const
Definition: schematic.cpp:303
SCH_BASE_FRAME * GetParent()
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
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:477
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:111
int GetTextWidth() const
Definition: eda_text.h:248
bool IsPower() const
Definition: lib_symbol.cpp:411
bool IsType(FRAME_T aType) const
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:208
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.
#define _(s)
Definition: 3d_actions.cpp:33
void OnTextValueSelectButtonClick(wxCommandEvent &aEvent) override
Function OnTextValueSelectButtonClick Handles the select button next to the text value field.
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:505
Schematic symbol object.
Definition: sch_symbol.h:78
virtual long long int GetValue()
Return the current value in Internal Units.
bool TransferDataFromWindow() override
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
#define TEXT_ANGLE_VERT
Definition: eda_text.h:51
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:174
A text control validator used for validating the text allowed in library and schematic component fiel...
Definition for part library class.
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:141
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
Definition: sch_symbol.cpp:609
static bool IsReferenceStringValid(const wxString &aReferenceString)
Tests for an acceptable reference string.
Definition: sch_symbol.cpp:461
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:188
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
void SetBold(bool aBold)
Definition: eda_text.h:189
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:196
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
Definition: sch_symbol.cpp:659
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:427
Field Name Module PCB, i.e. "16DIP300".
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...