KiCad PCB EDA Suite
UNIT_BINDER Class Reference

#include <unit_binder.h>

Inheritance diagram for UNIT_BINDER:

Public Member Functions

 UNIT_BINDER (EDA_DRAW_FRAME *aParent, wxStaticText *aLabel, wxWindow *aValueCtrl, wxStaticText *aUnitLabel, bool aAllowEval=true)
 
 ~UNIT_BINDER () override
 
virtual void SetUnits (EDA_UNITS aUnits)
 Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DEGREES for angular controls. More...
 
virtual void SetPrecision (int aLength)
 Normally not needed, but can be used to set the precision when using internal units that are floats (not integers) like DEGREES or PERCENT. More...
 
void SetDataType (EDA_DATA_TYPE aDataType)
 Used to override the datatype of the displayed property (default is DISTANCE) More...
 
virtual void SetValue (int aValue)
 Set new value (in Internal Units) for the text field, taking care of units conversion. More...
 
void SetValue (wxString aValue)
 
virtual void SetDoubleValue (double aValue)
 Set new value (in Internal Units) for the text field, taking care of units conversion. More...
 
virtual void ChangeValue (int aValue)
 Change the value (in Internal Units) for the text field, taking care of units conversion but does not trigger the update routine. More...
 
void ChangeValue (const wxString &aValue)
 
virtual long long int GetValue ()
 Return the current value in Internal Units. More...
 
virtual double GetDoubleValue ()
 Return the current value in Internal Units. More...
 
bool IsIndeterminate () const
 Return true if the control holds the indeterminate value (for instance, if it represents a multiple selection of differing values). More...
 
wxString GetOriginalText () const
 Return the pre-evaluated text (or the current text if evaluation is not supported). More...
 
virtual bool Validate (double aMin, double aMax, EDA_UNITS aUnits=EDA_UNITS::UNSCALED)
 Validate the control against the given range, informing the user of any errors found. More...
 
void SetLabel (const wxString &aLabel)
 
void Enable (bool aEnable)
 Enable/disable the label, widget and units label. More...
 
void Show (bool aShow, bool aResize=false)
 Show/hide the label, widget and units label. More...
 
ORIGIN_TRANSFORMS::COORD_TYPES_T GetCoordType () const
 Get the origin transforms coordinate type. More...
 
void SetCoordType (ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
 Set the current origin transform mode. More...
 

Protected Member Functions

void onSetFocus (wxFocusEvent &aEvent)
 
void onKillFocus (wxFocusEvent &aEvent)
 
void delayedFocusHandler (wxCommandEvent &aEvent)
 
void onUnitsChanged (wxCommandEvent &aEvent)
 
double setPrecision (double aValue, bool aValueUsesUserUnits)
 When m_precision > 0 truncate the value aValue to show only m_precision digits in mantissa. More...
 

Protected Attributes

EDA_DRAW_FRAMEm_frame
 The bound widgets. More...
 
wxStaticText * m_label
 
wxWindow * m_valueCtrl
 
wxStaticText * m_unitLabel
 
EDA_UNITS m_units
 < Currently used units. More...
 
EDA_DATA_TYPE m_dataType
 
int m_precision
 
wxString m_errorMessage
 < Validation support. More...
 
NUMERIC_EVALUATOR m_eval
 
bool m_allowEval
 
bool m_needsEval
 Selection start and end of the original text. More...
 
long m_selStart
 
long m_selEnd
 
ORIGIN_TRANSFORMSm_originTransforms
 A reference to an ORIGIN_TRANSFORMS object. More...
 
ORIGIN_TRANSFORMS::COORD_TYPES_T m_coordType
 Type of coordinate for display origin transforms. More...
 

Detailed Description

Definition at line 41 of file unit_binder.h.

Constructor & Destructor Documentation

◆ UNIT_BINDER()

UNIT_BINDER::UNIT_BINDER ( EDA_DRAW_FRAME aParent,
wxStaticText *  aLabel,
wxWindow *  aValueCtrl,
wxStaticText *  aUnitLabel,
bool  aAllowEval = true 
)
Parameters
aParentis the parent EDA_DRAW_FRAME.
aLabelis the static text used to label the text input widget (note: the label text, trimmed of its colon, will also be used in error messages)
aValueCtrlis the control used to edit or display the given value (wxTextCtrl, wxComboBox, wxStaticText, etc.).
aUnitLabelis the units label displayed after the text input widget Can be nullptr.
aAllowEvalindicates aTextInput's content should be eval'ed before storing

Definition at line 38 of file unit_binder.cpp.

39  :
40  m_frame( aParent ),
41  m_label( aLabel ),
42  m_valueCtrl( aValueCtrl ),
43  m_unitLabel( aUnitLabel ),
44  m_eval( aParent->GetUserUnits() ),
47 {
48  m_units = aParent->GetUserUnits();
50  m_precision = 0;
51  m_allowEval = allowEval && dynamic_cast<wxTextEntry*>( m_valueCtrl );
52  m_needsEval = false;
53  m_selStart = 0;
54  m_selEnd = 0;
55 
56  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
57 
58  if( textEntry )
59  {
60  // Use ChangeValue() instead of SetValue() so we don't generate events.
61  textEntry->ChangeValue( wxT( "0" ) );
62  }
63 
64  if( m_unitLabel )
66 
67  m_valueCtrl->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( UNIT_BINDER::onSetFocus ), NULL, this );
68  m_valueCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( UNIT_BINDER::onKillFocus ), NULL, this );
69  Connect( DELAY_FOCUS, wxCommandEventHandler( UNIT_BINDER::delayedFocusHandler ), NULL, this );
70 
71  m_frame->Connect( UNITS_CHANGED, wxCommandEventHandler( UNIT_BINDER::onUnitsChanged ), nullptr, this );
72 }
ORIGIN_TRANSFORMS::COORD_TYPES_T m_coordType
Type of coordinate for display origin transforms.
Definition: unit_binder.h:227
EDA_DRAW_FRAME * m_frame
The bound widgets.
Definition: unit_binder.h:199
void delayedFocusHandler(wxCommandEvent &aEvent)
ORIGIN_TRANSFORMS & m_originTransforms
A reference to an ORIGIN_TRANSFORMS object.
Definition: unit_binder.h:224
virtual ORIGIN_TRANSFORMS & GetOriginTransforms()
Return a reference to the default ORIGIN_TRANSFORMS object.
bool m_needsEval
Selection start and end of the original text.
Definition: unit_binder.h:217
wxString GetAbbreviatedUnitsLabel(EDA_UNITS aUnit, EDA_DATA_TYPE aType)
Get the units string for a given units type.
Definition: base_units.cpp:472
EDA_UNITS m_units
< Currently used units.
Definition: unit_binder.h:207
#define NULL
wxStaticText * m_label
Definition: unit_binder.h:202
EDA_DATA_TYPE m_dataType
Definition: unit_binder.h:208
wxStaticText * m_unitLabel
Definition: unit_binder.h:204
NUMERIC_EVALUATOR m_eval
Definition: unit_binder.h:215
wxWindow * m_valueCtrl
Definition: unit_binder.h:203
bool m_allowEval
Definition: unit_binder.h:216
void onKillFocus(wxFocusEvent &aEvent)
void onSetFocus(wxFocusEvent &aEvent)
void onUnitsChanged(wxCommandEvent &aEvent)
long m_selStart
Definition: unit_binder.h:220
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References delayedFocusHandler(), DISTANCE, GetAbbreviatedUnitsLabel(), EDA_BASE_FRAME::GetUserUnits(), m_allowEval, m_dataType, m_frame, m_needsEval, m_precision, m_selEnd, m_selStart, m_unitLabel, m_units, m_valueCtrl, NULL, onKillFocus(), onSetFocus(), and onUnitsChanged().

◆ ~UNIT_BINDER()

UNIT_BINDER::~UNIT_BINDER ( )
override

Definition at line 75 of file unit_binder.cpp.

76 {
77  m_frame->Disconnect( UNITS_CHANGED, wxCommandEventHandler( UNIT_BINDER::onUnitsChanged ), nullptr, this );
78 }
EDA_DRAW_FRAME * m_frame
The bound widgets.
Definition: unit_binder.h:199
void onUnitsChanged(wxCommandEvent &aEvent)

References m_frame, and onUnitsChanged().

Member Function Documentation

◆ ChangeValue() [1/2]

void UNIT_BINDER::ChangeValue ( int  aValue)
virtual

Change the value (in Internal Units) for the text field, taking care of units conversion but does not trigger the update routine.

Parameters
aValueis the new value.

Definition at line 269 of file unit_binder.cpp.

270 {
271  double value = aValue;
272  double displayValue = m_originTransforms.ToDisplay( value, m_coordType );
273  ChangeValue( StringFromValue( m_units, displayValue, false ) );
274 }
ORIGIN_TRANSFORMS::COORD_TYPES_T m_coordType
Type of coordinate for display origin transforms.
Definition: unit_binder.h:227
ORIGIN_TRANSFORMS & m_originTransforms
A reference to an ORIGIN_TRANSFORMS object.
Definition: unit_binder.h:224
EDA_UNITS m_units
< Currently used units.
Definition: unit_binder.h:207
virtual int ToDisplay(int aValue, COORD_TYPES_T aCoordType) const
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:225
virtual void ChangeValue(int aValue)
Change the value (in Internal Units) for the text field, taking care of units conversion but does not...

References m_coordType, m_originTransforms, m_units, StringFromValue(), and ORIGIN_TRANSFORMS::ToDisplay().

Referenced by DIALOG_PAD_PROPERTIES::initValues(), DIALOG_PAD_PROPERTIES::onCornerSizePercentChange(), DIALOG_TRACK_VIA_PROPERTIES::onViaSelect(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), and DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues().

◆ ChangeValue() [2/2]

void UNIT_BINDER::ChangeValue ( const wxString &  aValue)

Definition at line 277 of file unit_binder.cpp.

278 {
279  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
280  wxStaticText* staticText = dynamic_cast<wxStaticText*>( m_valueCtrl );
281 
282  if( textEntry )
283  textEntry->ChangeValue( aValue );
284  else if( staticText )
285  staticText->SetLabel( aValue );
286 
287  if( m_allowEval )
288  m_eval.Clear();
289 
290  if( m_unitLabel )
292 }
wxString GetAbbreviatedUnitsLabel(EDA_UNITS aUnit, EDA_DATA_TYPE aType)
Get the units string for a given units type.
Definition: base_units.cpp:472
EDA_UNITS m_units
< Currently used units.
Definition: unit_binder.h:207
EDA_DATA_TYPE m_dataType
Definition: unit_binder.h:208
wxStaticText * m_unitLabel
Definition: unit_binder.h:204
NUMERIC_EVALUATOR m_eval
Definition: unit_binder.h:215
wxWindow * m_valueCtrl
Definition: unit_binder.h:203
bool m_allowEval
Definition: unit_binder.h:216

References NUMERIC_EVALUATOR::Clear(), GetAbbreviatedUnitsLabel(), m_allowEval, m_dataType, m_eval, m_unitLabel, m_units, and m_valueCtrl.

◆ delayedFocusHandler()

void UNIT_BINDER::delayedFocusHandler ( wxCommandEvent &  aEvent)
protected

Definition at line 180 of file unit_binder.cpp.

181 {
182  if( !m_errorMessage.IsEmpty() )
183  DisplayError( m_valueCtrl->GetParent(), m_errorMessage );
184 
185  m_errorMessage = wxEmptyString;
186  m_valueCtrl->SetFocus();
187 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:253
wxString m_errorMessage
< Validation support.
Definition: unit_binder.h:212
wxWindow * m_valueCtrl
Definition: unit_binder.h:203

References DisplayError(), m_errorMessage, and m_valueCtrl.

Referenced by UNIT_BINDER().

◆ Enable()

void UNIT_BINDER::Enable ( bool  aEnable)

Enable/disable the label, widget and units label.

Definition at line 396 of file unit_binder.cpp.

397 {
398  m_label->Enable( aEnable );
399  m_valueCtrl->Enable( aEnable );
400 
401  if( m_unitLabel )
402  m_unitLabel->Enable( aEnable );
403 }
wxStaticText * m_label
Definition: unit_binder.h:202
wxStaticText * m_unitLabel
Definition: unit_binder.h:204
wxWindow * m_valueCtrl
Definition: unit_binder.h:203

References m_label, m_unitLabel, and m_valueCtrl.

Referenced by DIALOG_PAD_PROPERTIES::OnPadShapeSelection(), DIALOG_PAGES_SETTINGS::OnPaperSizeChoice(), DIALOG_TRACK_VIA_PROPERTIES::onTrackNetclassCheck(), DIALOG_PLOT_SCHEMATIC::OnUpdateUI(), DIALOG_LIB_SYMBOL_PROPERTIES::OnUpdateUI(), DIALOG_PAD_PROPERTIES::OnUpdateUI(), DIALOG_TRACK_VIA_PROPERTIES::onViaNetclassCheck(), and DIALOG_PLOT::SetPlotFormat().

◆ GetCoordType()

ORIGIN_TRANSFORMS::COORD_TYPES_T UNIT_BINDER::GetCoordType ( ) const
inline

Get the origin transforms coordinate type.

Returns
the origin transforms coordinate type

Definition at line 165 of file unit_binder.h.

166  {
167  return m_coordType;
168  }
ORIGIN_TRANSFORMS::COORD_TYPES_T m_coordType
Type of coordinate for display origin transforms.
Definition: unit_binder.h:227

References m_coordType.

◆ GetDoubleValue()

double UNIT_BINDER::GetDoubleValue ( )
virtual

Return the current value in Internal Units.

The returned value will be truncated according to the precision set by SetPrecision() (if not <= 0)

Definition at line 334 of file unit_binder.cpp.

335 {
336  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
337  wxStaticText* staticText = dynamic_cast<wxStaticText*>( m_valueCtrl );
338  wxString value;
339 
340  if( textEntry )
341  {
342  if( m_needsEval && m_eval.Process( textEntry->GetValue() ) )
343  value = m_eval.Result();
344  else
345  value = textEntry->GetValue();
346  }
347  else if( staticText )
348  {
349  value = staticText->GetLabel();
350  }
351  else
352  {
353  return 0.0;
354  }
355 
356  double displayValue = DoubleValueFromString( m_units, value, m_dataType );
357  displayValue = setPrecision( displayValue, false );
358 
359  return m_originTransforms.FromDisplay( displayValue, m_coordType );
360 }
ORIGIN_TRANSFORMS::COORD_TYPES_T m_coordType
Type of coordinate for display origin transforms.
Definition: unit_binder.h:227
ORIGIN_TRANSFORMS & m_originTransforms
A reference to an ORIGIN_TRANSFORMS object.
Definition: unit_binder.h:224
bool m_needsEval
Selection start and end of the original text.
Definition: unit_binder.h:217
EDA_UNITS m_units
< Currently used units.
Definition: unit_binder.h:207
bool Process(const wxString &aString)
EDA_DATA_TYPE m_dataType
Definition: unit_binder.h:208
NUMERIC_EVALUATOR m_eval
Definition: unit_binder.h:215
wxWindow * m_valueCtrl
Definition: unit_binder.h:203
wxString Result() const
virtual int FromDisplay(int aValue, COORD_TYPES_T aCoordType) const
double setPrecision(double aValue, bool aValueUsesUserUnits)
When m_precision > 0 truncate the value aValue to show only m_precision digits in mantissa.
double DoubleValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function DoubleValueFromString converts aTextValue to a double.
Definition: base_units.cpp:338

References DoubleValueFromString(), ORIGIN_TRANSFORMS::FromDisplay(), m_coordType, m_dataType, m_eval, m_needsEval, m_originTransforms, m_units, m_valueCtrl, NUMERIC_EVALUATOR::Process(), NUMERIC_EVALUATOR::Result(), and setPrecision().

Referenced by DIALOG_POSITION_RELATIVE::GetTranslationInIU(), DIALOG_MOVE_EXACT::GetTranslationInIU(), DIALOG_POSITION_RELATIVE::OnClear(), DIALOG_POSITION_RELATIVE::OnOkClick(), DIALOG_POSITION_RELATIVE::OnPolarChanged(), DIALOG_MOVE_EXACT::OnPolarChanged(), DIALOG_MOVE_EXACT::OnTextChanged(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_MOVE_EXACT::TransferDataFromWindow().

◆ GetOriginalText()

wxString UNIT_BINDER::GetOriginalText ( ) const

Return the pre-evaluated text (or the current text if evaluation is not supported).

Used primarily to remember values between dialog invocations.

Definition at line 374 of file unit_binder.cpp.

375 {
376  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
377  wxStaticText* staticText = dynamic_cast<wxStaticText*>( m_valueCtrl );
378 
379  if( m_allowEval )
380  return m_eval.OriginalText();
381  else if( textEntry )
382  return textEntry->GetValue();
383  else if( staticText )
384  return staticText->GetLabel();
385  else
386  return wxEmptyString;
387 }
wxString OriginalText() const
NUMERIC_EVALUATOR m_eval
Definition: unit_binder.h:215
wxWindow * m_valueCtrl
Definition: unit_binder.h:203
bool m_allowEval
Definition: unit_binder.h:216

References m_allowEval, m_eval, m_valueCtrl, and NUMERIC_EVALUATOR::OriginalText().

Referenced by DIALOG_MOVE_EXACT::TransferDataFromWindow().

◆ GetValue()

long long int UNIT_BINDER::GetValue ( )
virtual

Return the current value in Internal Units.

Definition at line 295 of file unit_binder.cpp.

296 {
297  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
298  wxStaticText* staticText = dynamic_cast<wxStaticText*>( m_valueCtrl );
299  wxString value;
300 
301  if( textEntry )
302  {
303  if( m_needsEval && m_eval.Process( textEntry->GetValue() ) )
304  value = m_eval.Result();
305  else
306  value = textEntry->GetValue();
307  }
308  else if( staticText )
309  value = staticText->GetLabel();
310  else
311  return 0;
312 
313  long long int displayValue = ValueFromString( m_units, value, m_dataType );
314  return m_originTransforms.FromDisplay( displayValue, m_coordType );
315 }
ORIGIN_TRANSFORMS::COORD_TYPES_T m_coordType
Type of coordinate for display origin transforms.
Definition: unit_binder.h:227
ORIGIN_TRANSFORMS & m_originTransforms
A reference to an ORIGIN_TRANSFORMS object.
Definition: unit_binder.h:224
bool m_needsEval
Selection start and end of the original text.
Definition: unit_binder.h:217
EDA_UNITS m_units
< Currently used units.
Definition: unit_binder.h:207
bool Process(const wxString &aString)
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:451
EDA_DATA_TYPE m_dataType
Definition: unit_binder.h:208
NUMERIC_EVALUATOR m_eval
Definition: unit_binder.h:215
wxWindow * m_valueCtrl
Definition: unit_binder.h:203
wxString Result() const
virtual int FromDisplay(int aValue, COORD_TYPES_T aCoordType) const

References ORIGIN_TRANSFORMS::FromDisplay(), m_coordType, m_dataType, m_eval, m_needsEval, m_originTransforms, m_units, m_valueCtrl, NUMERIC_EVALUATOR::Process(), NUMERIC_EVALUATOR::Result(), and ValueFromString().

Referenced by DIALOG_PNS_LENGTH_TUNING_SETTINGS::AcceptOptions(), DIALOG_COPPER_ZONE::AcceptOptions(), DIALOG_PLOT::applyPlotSettings(), DIALOG_CREATE_ARRAY::calculateCircularArrayProperties(), PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral(), PROPERTIES_FRAME::CopyPrmsFromPanelToItem(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_PAGES_SETTINGS::GetCustomSizeMilsFromDialog(), DIALOG_LIB_NEW_COMPONENT::GetPinTextPosition(), DIALOG_PLOT_SCHEMATIC::getPlotOptions(), WX_UNIT_ENTRY_DIALOG::GetValue(), DIALOG_LIB_EDIT_DRAW_ITEM::GetWidth(), DIALOG_PAD_PROPERTIES::onCornerRadiusChange(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::onPaintPolyPanel(), DIALOG_PIN_PROPERTIES::OnPropertiesChange(), onUnitsChanged(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_PLOT_SCHEMATIC::SetHPGLPenWidth(), DIALOG_JUNCTION_PROPS::TransferDataFromWindow(), DIALOG_GRID_SETTINGS::TransferDataFromWindow(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_TRACK_VIA_SIZE::TransferDataFromWindow(), PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataFromWindow(), DIALOG_EDIT_LINE_STYLE::TransferDataFromWindow(), DIALOG_PNS_DIFF_PAIR_DIMENSIONS::TransferDataFromWindow(), PANEL_SETUP_FORMATTING::TransferDataFromWindow(), DIALOG_PNS_LENGTH_TUNING_SETTINGS::TransferDataFromWindow(), PANEL_SYM_EDITING_OPTIONS::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow(), PANEL_SETUP_MASK_AND_PASTE::TransferDataFromWindow(), PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataFromWindow(), DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow(), DIALOG_CREATE_ARRAY::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), PANEL_SETUP_CONSTRAINTS::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_COPPER_ZONE::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::transferDataToPad(), DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), PANEL_SETUP_TRACKS_AND_VIAS::Validate(), DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate(), Validate(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsIndeterminate()

bool UNIT_BINDER::IsIndeterminate ( ) const

Return true if the control holds the indeterminate value (for instance, if it represents a multiple selection of differing values).

Definition at line 363 of file unit_binder.cpp.

364 {
365  wxTextEntry* te = dynamic_cast<wxTextEntry*>( m_valueCtrl );
366 
367  if( te )
368  return te->GetValue() == INDETERMINATE_STATE || te->GetValue() == INDETERMINATE_ACTION;
369 
370  return false;
371 }
wxWindow * m_valueCtrl
Definition: unit_binder.h:203
#define INDETERMINATE_ACTION
Definition: base_units.h:49
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
Definition: base_units.h:48

References INDETERMINATE_ACTION, INDETERMINATE_STATE, and m_valueCtrl.

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_JUNCTION_PROPS::TransferDataFromWindow(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_LINE_STYLE::TransferDataFromWindow(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ onKillFocus()

void UNIT_BINDER::onKillFocus ( wxFocusEvent &  aEvent)
protected

Definition at line 138 of file unit_binder.cpp.

139 {
140  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
141 
142  if( m_allowEval && textEntry )
143  {
144  if( m_eval.Process( textEntry->GetValue() ) )
145  {
146  textEntry->GetSelection( &m_selStart, &m_selEnd );
147  wxString sel = textEntry->GetStringSelection();
148 
149  textEntry->ChangeValue( m_eval.Result() );
150 
151 #ifdef __WXGTK__
152  // Manually copy the selected text to the primary selection clipboard
153  if( wxTheClipboard->Open() )
154  {
155  bool clipTarget = wxTheClipboard->IsUsingPrimarySelection();
156  wxTheClipboard->UsePrimarySelection( true );
157  wxTheClipboard->SetData( new wxTextDataObject( sel ) );
158  wxTheClipboard->UsePrimarySelection( clipTarget );
159  wxTheClipboard->Close();
160  }
161 #endif
162  }
163 
164  m_needsEval = false;
165  }
166 
167  aEvent.Skip();
168 }
bool m_needsEval
Selection start and end of the original text.
Definition: unit_binder.h:217
bool Process(const wxString &aString)
NUMERIC_EVALUATOR m_eval
Definition: unit_binder.h:215
wxWindow * m_valueCtrl
Definition: unit_binder.h:203
bool m_allowEval
Definition: unit_binder.h:216
wxString Result() const
long m_selStart
Definition: unit_binder.h:220

References m_allowEval, m_eval, m_needsEval, m_selEnd, m_selStart, m_valueCtrl, NUMERIC_EVALUATOR::Process(), and NUMERIC_EVALUATOR::Result().

Referenced by UNIT_BINDER().

◆ onSetFocus()

void UNIT_BINDER::onSetFocus ( wxFocusEvent &  aEvent)
protected

Definition at line 117 of file unit_binder.cpp.

118 {
119  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
120 
121  if( m_allowEval && textEntry )
122  {
123  wxString oldStr = m_eval.OriginalText();
124 
125  if( oldStr.length() )
126  {
127  textEntry->SetValue( oldStr );
128  textEntry->SetSelection( m_selStart, m_selEnd );
129  }
130 
131  m_needsEval = true;
132  }
133 
134  aEvent.Skip();
135 }
wxString OriginalText() const
bool m_needsEval
Selection start and end of the original text.
Definition: unit_binder.h:217
NUMERIC_EVALUATOR m_eval
Definition: unit_binder.h:215
wxWindow * m_valueCtrl
Definition: unit_binder.h:203
bool m_allowEval
Definition: unit_binder.h:216
long m_selStart
Definition: unit_binder.h:220

References m_allowEval, m_eval, m_needsEval, m_selEnd, m_selStart, m_valueCtrl, and NUMERIC_EVALUATOR::OriginalText().

Referenced by UNIT_BINDER().

◆ onUnitsChanged()

void UNIT_BINDER::onUnitsChanged ( wxCommandEvent &  aEvent)
protected

Definition at line 105 of file unit_binder.cpp.

106 {
107  int temp = (int) GetValue();
108 
110 
111  SetValue( temp );
112 
113  aEvent.Skip();
114 }
EDA_DRAW_FRAME * m_frame
The bound widgets.
Definition: unit_binder.h:199
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
Definition: unit_binder.cpp:81
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
virtual long long int GetValue()
Return the current value in Internal Units.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References EDA_BASE_FRAME::GetUserUnits(), GetValue(), m_frame, SetUnits(), and SetValue().

Referenced by UNIT_BINDER(), and ~UNIT_BINDER().

◆ SetCoordType()

◆ SetDataType()

void UNIT_BINDER::SetDataType ( EDA_DATA_TYPE  aDataType)

Used to override the datatype of the displayed property (default is DISTANCE)

Parameters
aDataTypeis the datatype to use for the units text display

Definition at line 96 of file unit_binder.cpp.

97 {
98  m_dataType = aDataType;
99 
100  if( m_unitLabel )
102 }
wxString GetAbbreviatedUnitsLabel(EDA_UNITS aUnit, EDA_DATA_TYPE aType)
Get the units string for a given units type.
Definition: base_units.cpp:472
EDA_UNITS m_units
< Currently used units.
Definition: unit_binder.h:207
EDA_DATA_TYPE m_dataType
Definition: unit_binder.h:208
wxStaticText * m_unitLabel
Definition: unit_binder.h:204

References GetAbbreviatedUnitsLabel(), m_dataType, m_unitLabel, and m_units.

Referenced by DIALOG_COPPER_ZONE::TransferDataToWindow().

◆ SetDoubleValue()

void UNIT_BINDER::SetDoubleValue ( double  aValue)
virtual

Set new value (in Internal Units) for the text field, taking care of units conversion.

Parameters
aValueis the new value. the initialized value will be truncated according to the precision set by SetPrecision() (if not <= 0)

Definition at line 243 of file unit_binder.cpp.

244 {
245  double displayValue = m_originTransforms.ToDisplay( aValue, m_coordType );
246  displayValue = setPrecision( displayValue, false );
247  SetValue( StringFromValue( m_units, displayValue, false, m_dataType ) );
248 }
ORIGIN_TRANSFORMS::COORD_TYPES_T m_coordType
Type of coordinate for display origin transforms.
Definition: unit_binder.h:227
ORIGIN_TRANSFORMS & m_originTransforms
A reference to an ORIGIN_TRANSFORMS object.
Definition: unit_binder.h:224
EDA_UNITS m_units
< Currently used units.
Definition: unit_binder.h:207
EDA_DATA_TYPE m_dataType
Definition: unit_binder.h:208
virtual int ToDisplay(int aValue, COORD_TYPES_T aCoordType) const
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:225
double setPrecision(double aValue, bool aValueUsesUserUnits)
When m_precision > 0 truncate the value aValue to show only m_precision digits in mantissa.

References m_coordType, m_dataType, m_originTransforms, m_units, setPrecision(), SetValue(), StringFromValue(), and ORIGIN_TRANSFORMS::ToDisplay().

Referenced by PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel(), PROPERTIES_FRAME::CopyPrmsFromItemToPanel(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_POSITION_RELATIVE::OnClear(), DIALOG_POSITION_RELATIVE::OnPolarChanged(), DIALOG_MOVE_EXACT::OnPolarChanged(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), and DIALOG_COPPER_ZONE::TransferDataToWindow().

◆ SetLabel()

void UNIT_BINDER::SetLabel ( const wxString &  aLabel)

Definition at line 390 of file unit_binder.cpp.

391 {
392  m_label->SetLabel( aLabel );
393 }
wxStaticText * m_label
Definition: unit_binder.h:202

References m_label.

Referenced by DIALOG_POSITION_RELATIVE::updateDialogControls(), and DIALOG_MOVE_EXACT::updateDialogControls().

◆ SetPrecision()

void UNIT_BINDER::SetPrecision ( int  aLength)
virtual

Normally not needed, but can be used to set the precision when using internal units that are floats (not integers) like DEGREES or PERCENT.

Not used for integer values in IU

Parameters
aLengthis the number of digits for mantissa (0 = no truncation) must be <= 6

Definition at line 90 of file unit_binder.cpp.

91 {
92  m_precision = std::min( aLength, 6 );
93 }

References m_precision.

Referenced by DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES().

◆ setPrecision()

double UNIT_BINDER::setPrecision ( double  aValue,
bool  aValueUsesUserUnits 
)
protected

When m_precision > 0 truncate the value aValue to show only m_precision digits in mantissa.

used in GetDoubleValue to return a rounded value. Mainly for units set to DEGREES.

Parameters
aValueis the value to modify.
aValueUsesUserUnitsmust be set to true if aValue is a user value, and set to false if aValue is a internal unit value.
Returns
the "rounded" value.

Definition at line 318 of file unit_binder.cpp.

319 {
320  if( m_precision > 1 )
321  {
322  int scale = pow( 10, m_precision );
323  long long tmp = aValueUsesUserUnits ? aValue : To_User_Unit( m_units, aValue ) * scale;
324  aValue = static_cast<double>( tmp ) / scale;
325 
326  if( !aValueUsesUserUnits )
327  aValue = From_User_Unit( m_units, aValue );
328  }
329 
330  return aValue;
331 }
EDA_UNITS m_units
< Currently used units.
Definition: unit_binder.h:207
double To_User_Unit(EDA_UNITS aUnit, double aValue)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: base_units.cpp:91
const int scale
double From_User_Unit(EDA_UNITS aUnits, double aValue)
Return in internal units the value "val" given in a real unit such as "in", "mm" or "deg".
Definition: base_units.cpp:313

References From_User_Unit(), m_precision, m_units, scale, and To_User_Unit().

Referenced by GetDoubleValue(), and SetDoubleValue().

◆ SetUnits()

void UNIT_BINDER::SetUnits ( EDA_UNITS  aUnits)
virtual

◆ SetValue() [1/2]

void UNIT_BINDER::SetValue ( int  aValue)
virtual

Set new value (in Internal Units) for the text field, taking care of units conversion.

Parameters
aValueis the new value.

Definition at line 235 of file unit_binder.cpp.

236 {
237  double value = aValue;
238  double displayValue = m_originTransforms.ToDisplay( value, m_coordType );
239  SetValue( StringFromValue( m_units, displayValue, false, m_dataType ) );
240 }
ORIGIN_TRANSFORMS::COORD_TYPES_T m_coordType
Type of coordinate for display origin transforms.
Definition: unit_binder.h:227
ORIGIN_TRANSFORMS & m_originTransforms
A reference to an ORIGIN_TRANSFORMS object.
Definition: unit_binder.h:224
EDA_UNITS m_units
< Currently used units.
Definition: unit_binder.h:207
EDA_DATA_TYPE m_dataType
Definition: unit_binder.h:208
virtual int ToDisplay(int aValue, COORD_TYPES_T aCoordType) const
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:225

References m_coordType, m_dataType, m_originTransforms, m_units, StringFromValue(), and ORIGIN_TRANSFORMS::ToDisplay().

Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), DIALOG_PLOT::applyPlotSettings(), DIALOG_CREATE_ARRAY::calculateCircularArrayProperties(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), PANEL_SETUP_FORMATTING::ImportSettingsFrom(), DIALOG_PLOT::init_Dialog(), DIALOG_PLOT_SCHEMATIC::initDlg(), DIALOG_POSITION_RELATIVE::OnClear(), DIALOG_MOVE_EXACT::OnClear(), DIALOG_PAD_PROPERTIES::OnOffsetCheckbox(), DIALOG_PAD_PROPERTIES::OnPadToDieCheckbox(), DIALOG_GRID_SETTINGS::OnResetGridOriginClick(), onUnitsChanged(), DIALOG_JUNCTION_PROPS::resetDefaults(), DIALOG_EDIT_LINE_STYLE::resetDefaults(), SetDoubleValue(), DIALOG_LIB_NEW_COMPONENT::SetPinTextPosition(), DIALOG_JUNCTION_PROPS::TransferDataToWindow(), PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataToWindow(), DIALOG_GRID_SETTINGS::TransferDataToWindow(), DIALOG_EDIT_LINE_STYLE::TransferDataToWindow(), DIALOG_TRACK_VIA_SIZE::TransferDataToWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), PANEL_SETUP_FORMATTING::TransferDataToWindow(), DIALOG_LIB_EDIT_DRAW_ITEM::TransferDataToWindow(), DIALOG_PNS_DIFF_PAIR_DIMENSIONS::TransferDataToWindow(), DIALOG_PNS_LENGTH_TUNING_SETTINGS::TransferDataToWindow(), PANEL_SYM_EDITING_OPTIONS::TransferDataToWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_TARGET_PROPERTIES::TransferDataToWindow(), DIALOG_LIB_EDIT_TEXT::TransferDataToWindow(), PANEL_SETUP_MASK_AND_PASTE::TransferDataToWindow(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow(), PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataToWindow(), DIALOG_EDIT_ONE_FIELD::TransferDataToWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), DIALOG_PAGES_SETTINGS::TransferDataToWindow(), PANEL_SETUP_CONSTRAINTS::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_COPPER_ZONE::TransferDataToWindow(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow(), DIALOG_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::TransferDataToWindow(), and WX_UNIT_ENTRY_DIALOG::WX_UNIT_ENTRY_DIALOG().

◆ SetValue() [2/2]

void UNIT_BINDER::SetValue ( wxString  aValue)

Definition at line 251 of file unit_binder.cpp.

252 {
253  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
254  wxStaticText* staticText = dynamic_cast<wxStaticText*>( m_valueCtrl );
255 
256  if( textEntry )
257  textEntry->SetValue( aValue );
258  else if( staticText )
259  staticText->SetLabel( aValue );
260 
261  if( m_allowEval )
262  m_eval.Clear();
263 
264  if( m_unitLabel )
266 }
wxString GetAbbreviatedUnitsLabel(EDA_UNITS aUnit, EDA_DATA_TYPE aType)
Get the units string for a given units type.
Definition: base_units.cpp:472
EDA_UNITS m_units
< Currently used units.
Definition: unit_binder.h:207
EDA_DATA_TYPE m_dataType
Definition: unit_binder.h:208
wxStaticText * m_unitLabel
Definition: unit_binder.h:204
NUMERIC_EVALUATOR m_eval
Definition: unit_binder.h:215
wxWindow * m_valueCtrl
Definition: unit_binder.h:203
bool m_allowEval
Definition: unit_binder.h:216

References NUMERIC_EVALUATOR::Clear(), GetAbbreviatedUnitsLabel(), m_allowEval, m_dataType, m_eval, m_unitLabel, m_units, and m_valueCtrl.

◆ Show()

void UNIT_BINDER::Show ( bool  aShow,
bool  aResize = false 
)

Show/hide the label, widget and units label.

Parameters
aShowcalled for the Show() routine in wx
aResizeif true, the element will be sized to 0 on hide and -1 on show

Definition at line 406 of file unit_binder.cpp.

407 {
408  m_label->Show( aShow );
409  m_valueCtrl->Show( aShow );
410 
411  if( m_unitLabel )
412  m_unitLabel->Show( aShow );
413 
414  if( aResize )
415  {
416  if( aShow )
417  {
418  m_label->SetSize( -1, -1 );
419  m_valueCtrl->SetSize( -1, -1 );
420 
421  if( m_unitLabel )
422  m_unitLabel->SetSize( -1, -1 );
423  }
424  else
425  {
426  m_label->SetSize( 0, 0 );
427  m_valueCtrl->SetSize( 0, 0 );
428 
429  if( m_unitLabel )
430  m_unitLabel->SetSize( 0, 0 );
431  }
432  }
433 }
wxStaticText * m_label
Definition: unit_binder.h:202
wxStaticText * m_unitLabel
Definition: unit_binder.h:204
wxWindow * m_valueCtrl
Definition: unit_binder.h:203

References m_label, m_unitLabel, and m_valueCtrl.

Referenced by PROPERTIES_FRAME::CopyPrmsFromItemToPanel(), DIALOG_PAD_PROPERTIES::OnUpdateUI(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), and DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow().

◆ Validate()

bool UNIT_BINDER::Validate ( double  aMin,
double  aMax,
EDA_UNITS  aUnits = EDA_UNITS::UNSCALED 
)
virtual

Validate the control against the given range, informing the user of any errors found.

Parameters
aMina minimum value for validation
aMaxa maximum value for validation
aUnitsthe units of the min/max parameters (use UNSCALED for internal units)
Returns
false on error.

Definition at line 190 of file unit_binder.cpp.

191 {
192  wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
193 
194  if( !textEntry
195  || textEntry->GetValue() == INDETERMINATE_ACTION
196  || textEntry->GetValue() == INDETERMINATE_STATE )
197  {
198  return true;
199  }
200 
201  // TODO: Validate() does not currently support m_dataType being anything other than DISTANCE
202  // Note: aMin and aMax are not always given in internal units
203  if( GetValue() < From_User_Unit( aUnits, aMin ) )
204  {
205  double val_min_iu = From_User_Unit( aUnits, aMin );
206  m_errorMessage = wxString::Format( _( "%s must be at least %s." ),
208  StringFromValue( m_units, val_min_iu, true ) );
209 
210  textEntry->SelectAll();
211  // Don't focus directly; we might be inside a KillFocus event handler
212  wxPostEvent( this, wxCommandEvent( DELAY_FOCUS ) );
213 
214  return false;
215  }
216 
217  if( GetValue() > From_User_Unit( aUnits, aMax ) )
218  {
219  double val_max_iu = From_User_Unit( aUnits, aMax );
220  m_errorMessage = wxString::Format( _( "%s must be less than %s." ),
222  StringFromValue( m_units, val_max_iu, true ) );
223 
224  textEntry->SelectAll();
225  // Don't focus directly; we might be inside a KillFocus event handler
226  wxPostEvent( this, wxCommandEvent( DELAY_FOCUS ) );
227 
228  return false;
229  }
230 
231  return true;
232 }
wxString m_errorMessage
< Validation support.
Definition: unit_binder.h:212
wxString valueDescriptionFromLabel(wxStaticText *aLabel)
EDA_UNITS m_units
< Currently used units.
Definition: unit_binder.h:207
wxStaticText * m_label
Definition: unit_binder.h:202
wxWindow * m_valueCtrl
Definition: unit_binder.h:203
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
#define _(s)
Definition: 3d_actions.cpp:33
virtual long long int GetValue()
Return the current value in Internal Units.
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:225
#define INDETERMINATE_ACTION
Definition: base_units.h:49
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
Definition: base_units.h:48
double From_User_Unit(EDA_UNITS aUnits, double aValue)
Return in internal units the value "val" given in a real unit such as "in", "mm" or "deg".
Definition: base_units.cpp:313

References _, Format(), From_User_Unit(), GetValue(), INDETERMINATE_ACTION, INDETERMINATE_STATE, m_errorMessage, m_label, m_units, m_valueCtrl, StringFromValue(), and valueDescriptionFromLabel().

Referenced by DIALOG_PNS_LENGTH_TUNING_SETTINGS::AcceptOptions(), DIALOG_COPPER_ZONE::AcceptOptions(), DIALOG_GRID_SETTINGS::TransferDataFromWindow(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow(), DIALOG_PAGES_SETTINGS::TransferDataFromWindow(), PANEL_SETUP_CONSTRAINTS::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::transferDataToPad(), DIALOG_FOOTPRINT_FP_EDITOR::Validate(), and DIALOG_FOOTPRINT_PROPERTIES::Validate().

Member Data Documentation

◆ m_allowEval

bool UNIT_BINDER::m_allowEval
protected

◆ m_coordType

ORIGIN_TRANSFORMS::COORD_TYPES_T UNIT_BINDER::m_coordType
protected

Type of coordinate for display origin transforms.

Definition at line 227 of file unit_binder.h.

Referenced by ChangeValue(), GetCoordType(), GetDoubleValue(), GetValue(), SetCoordType(), SetDoubleValue(), and SetValue().

◆ m_dataType

EDA_DATA_TYPE UNIT_BINDER::m_dataType
protected

◆ m_errorMessage

wxString UNIT_BINDER::m_errorMessage
protected

< Validation support.

Evaluator

Definition at line 212 of file unit_binder.h.

Referenced by delayedFocusHandler(), and Validate().

◆ m_eval

NUMERIC_EVALUATOR UNIT_BINDER::m_eval
protected

◆ m_frame

EDA_DRAW_FRAME* UNIT_BINDER::m_frame
protected

The bound widgets.

Definition at line 199 of file unit_binder.h.

Referenced by onUnitsChanged(), UNIT_BINDER(), and ~UNIT_BINDER().

◆ m_label

wxStaticText* UNIT_BINDER::m_label
protected

Definition at line 202 of file unit_binder.h.

Referenced by Enable(), SetLabel(), Show(), and Validate().

◆ m_needsEval

bool UNIT_BINDER::m_needsEval
protected

Selection start and end of the original text.

Definition at line 217 of file unit_binder.h.

Referenced by GetDoubleValue(), GetValue(), onKillFocus(), onSetFocus(), and UNIT_BINDER().

◆ m_originTransforms

ORIGIN_TRANSFORMS& UNIT_BINDER::m_originTransforms
protected

A reference to an ORIGIN_TRANSFORMS object.

Definition at line 224 of file unit_binder.h.

Referenced by ChangeValue(), GetDoubleValue(), GetValue(), SetDoubleValue(), and SetValue().

◆ m_precision

int UNIT_BINDER::m_precision
protected

Definition at line 209 of file unit_binder.h.

Referenced by SetPrecision(), setPrecision(), and UNIT_BINDER().

◆ m_selEnd

long UNIT_BINDER::m_selEnd
protected

Definition at line 221 of file unit_binder.h.

Referenced by onKillFocus(), onSetFocus(), and UNIT_BINDER().

◆ m_selStart

long UNIT_BINDER::m_selStart
protected

Definition at line 220 of file unit_binder.h.

Referenced by onKillFocus(), onSetFocus(), and UNIT_BINDER().

◆ m_unitLabel

wxStaticText* UNIT_BINDER::m_unitLabel
protected

Definition at line 204 of file unit_binder.h.

Referenced by ChangeValue(), Enable(), SetDataType(), SetUnits(), SetValue(), Show(), and UNIT_BINDER().

◆ m_units

EDA_UNITS UNIT_BINDER::m_units
protected

◆ m_valueCtrl


The documentation for this class was generated from the following files: