KiCad PCB EDA Suite
unit_binder.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) 2014-2015 CERN
5 * Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 * Author: Maciej Suminski <[email protected]>
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 <wx/clipbrd.h>
27#include <wx/stattext.h>
28#include <wx/textentry.h>
29#include <eda_units.h>
30#include <eda_draw_frame.h>
31#include <confirm.h>
32
33#include "widgets/unit_binder.h"
34#include "wx/dcclient.h"
35
36
37wxDEFINE_EVENT( DELAY_FOCUS, wxCommandEvent );
38
39
40UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent, wxStaticText* aLabel, wxWindow* aValueCtrl,
41 wxStaticText* aUnitLabel, bool allowEval, bool aBindFrameEvents ) :
42 UNIT_BINDER( aParent, aParent, aLabel, aValueCtrl, aUnitLabel, allowEval, aBindFrameEvents )
43{
44}
45
46UNIT_BINDER::UNIT_BINDER( UNITS_PROVIDER* aUnitsProvider, wxWindow* aEventSource,
47 wxStaticText* aLabel, wxWindow* aValueCtrl, wxStaticText* aUnitLabel,
48 bool aAllowEval, bool aBindFocusEvent ) :
49 m_eventSource( aEventSource ),
50 m_bindFocusEvent( aBindFocusEvent ),
51 m_label( aLabel ),
52 m_valueCtrl( aValueCtrl ),
53 m_unitLabel( aUnitLabel ),
54 m_iuScale( &aUnitsProvider->GetIuScale() ),
55 m_negativeZero( false ),
56 m_dataType( EDA_DATA_TYPE::DISTANCE ),
57 m_precision( 0 ),
58 m_eval( aUnitsProvider->GetUserUnits() ),
59 m_unitsInValue( false ),
60 m_originTransforms( aUnitsProvider->GetOriginTransforms() ),
61 m_coordType( ORIGIN_TRANSFORMS::NOT_A_COORD )
62{
63 init( aUnitsProvider );
64 m_allowEval = aAllowEval && ( !m_valueCtrl || dynamic_cast<wxTextEntry*>( m_valueCtrl ) );
65 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
66
67 if( textEntry )
68 {
69 wxClientDC dc( m_valueCtrl );
70 wxSize minSize = m_valueCtrl->GetMinSize();
71 int minWidth = dc.GetTextExtent( wxT( "XXX.XXXXXXX" ) ).GetWidth();
72
73 if( minSize.GetWidth() < minWidth )
74 m_valueCtrl->SetMinSize( wxSize( minWidth, minSize.GetHeight() ) );
75
76 // Use ChangeValue() instead of SetValue() so we don't generate events.
77 if( m_negativeZero )
78 textEntry->ChangeValue( wxT( "-0" ) );
79 else
80 textEntry->ChangeValue( wxT( "0" ) );
81 }
82
83 if( m_unitLabel )
85
86 if( m_valueCtrl )
87 {
88 m_valueCtrl->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( UNIT_BINDER::onSetFocus ),
89 nullptr, this );
90 m_valueCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( UNIT_BINDER::onKillFocus ),
91 nullptr, this );
92 m_valueCtrl->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( UNIT_BINDER::onClick ),
93 nullptr, this );
94 }
95
97 {
98 Connect( DELAY_FOCUS, wxCommandEventHandler( UNIT_BINDER::delayedFocusHandler ), nullptr,
99 this );
100 }
101
102 if( m_eventSource )
103 {
104 m_eventSource->Connect( UNITS_CHANGED, wxCommandEventHandler( UNIT_BINDER::onUnitsChanged ),
105 nullptr, this );
106 }
107}
108
109
111{
112 if( m_bindFocusEvent )
113 {
114 Disconnect( DELAY_FOCUS, wxCommandEventHandler( UNIT_BINDER::delayedFocusHandler ), nullptr,
115 this );
116 }
117
118 if( m_eventSource )
119 {
120 m_eventSource->Disconnect( UNITS_CHANGED, wxCommandEventHandler( UNIT_BINDER::onUnitsChanged ),
121 nullptr, this );
122 }
123
124 if( m_valueCtrl )
125 {
126 m_valueCtrl->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( UNIT_BINDER::onSetFocus ),
127 nullptr, this );
128 m_valueCtrl->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( UNIT_BINDER::onKillFocus ),
129 nullptr, this );
130 m_valueCtrl->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( UNIT_BINDER::onClick ),
131 nullptr, this );
132 }
133}
134
135
137{
138 m_units = aProvider->GetUserUnits();
139 m_needsEval = false;
140 m_selStart = 0;
141 m_selEnd = 0;
142}
143
144
146{
147 m_units = aUnits;
148
150 m_eval.LocaleChanged(); // In case locale changed since last run
151
152 if( m_unitLabel )
154}
155
156
157void UNIT_BINDER::SetPrecision( int aLength )
158{
159 m_precision = std::min( aLength, 6 );
160}
161
162
164{
165 m_dataType = aDataType;
166
167 if( m_unitLabel )
169}
170
171
172void UNIT_BINDER::onUnitsChanged( wxCommandEvent& aEvent )
173{
174 EDA_BASE_FRAME* provider = static_cast<EDA_BASE_FRAME*>( aEvent.GetClientData() );
175
179 {
180 int temp = (int) GetValue();
181
182 SetUnits( provider->GetUserUnits() );
183 m_iuScale = &provider->GetIuScale();
184
185 if( !IsIndeterminate() )
186 SetValue( temp );
187 }
188
189 aEvent.Skip();
190}
191
192
193void UNIT_BINDER::onClick( wxMouseEvent& aEvent )
194{
195 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
196
197 if( textEntry && ( textEntry->GetValue() == INDETERMINATE_ACTION
198 || textEntry->GetValue() == INDETERMINATE_STATE ) )
199 {
200 // These are tokens, not strings, so do a select all
201 textEntry->SelectAll();
202 }
203
204 // Needed at least on Windows to avoid hanging
205 aEvent.Skip();
206}
207
208
209void UNIT_BINDER::onSetFocus( wxFocusEvent& aEvent )
210{
211 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
212
213 if( textEntry )
214 {
215 if( m_allowEval )
216 {
217 wxString oldStr = m_eval.OriginalText();
218
219 if( oldStr.length() && oldStr != textEntry->GetValue() )
220 {
221 textEntry->SetValue( oldStr );
222 textEntry->SetSelection( m_selStart, m_selEnd );
223 }
224
225 m_needsEval = true;
226 }
227
228 if( textEntry->GetValue() == INDETERMINATE_ACTION
229 || textEntry->GetValue() == INDETERMINATE_STATE )
230 {
231 // These are tokens, not strings, so do a select all
232 textEntry->SelectAll();
233 }
234 }
235
236 aEvent.Skip();
237}
238
239
240void UNIT_BINDER::onKillFocus( wxFocusEvent& aEvent )
241{
242 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
243
244 if( m_allowEval && textEntry )
245 {
246 if( m_eval.Process( textEntry->GetValue() ) )
247 {
248 textEntry->GetSelection( &m_selStart, &m_selEnd );
249
250 wxString value = m_eval.Result();
251
252 if( m_unitsInValue )
253 {
255 value += wxT( " " );
256
258 }
259
260 textEntry->ChangeValue( value );
261
262#ifdef __WXGTK__
263 // Manually copy the selected text to the primary selection clipboard
264 if( wxTheClipboard->Open() )
265 {
266 wxString sel = textEntry->GetStringSelection();
267 bool clipTarget = wxTheClipboard->IsUsingPrimarySelection();
268 wxTheClipboard->UsePrimarySelection( true );
269 wxTheClipboard->SetData( new wxTextDataObject( sel ) );
270 wxTheClipboard->UsePrimarySelection( clipTarget );
271 wxTheClipboard->Close();
272 }
273#endif
274 }
275
276 m_needsEval = false;
277 }
278
279 aEvent.Skip();
280}
281
282
283wxString valueDescriptionFromLabel( wxStaticText* aLabel )
284{
285 wxString desc = aLabel->GetLabel();
286
287 desc.EndsWith( wxT( ":" ), &desc );
288 return desc;
289}
290
291
292void UNIT_BINDER::delayedFocusHandler( wxCommandEvent& )
293{
294 if( !m_errorMessage.IsEmpty() )
295 DisplayError( m_valueCtrl->GetParent(), m_errorMessage );
296
297 m_errorMessage = wxEmptyString;
298 m_valueCtrl->SetFocus();
299}
300
301
302bool UNIT_BINDER::Validate( double aMin, double aMax, EDA_UNITS aUnits )
303{
304 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
305
306 if( !textEntry
307 || textEntry->GetValue() == INDETERMINATE_ACTION
308 || textEntry->GetValue() == INDETERMINATE_STATE )
309 {
310 return true;
311 }
312
313 // TODO: Validate() does not currently support m_dataType being anything other than DISTANCE
314 // Note: aMin and aMax are not always given in internal units
315 if( GetValue() < EDA_UNIT_UTILS::UI::FromUserUnit( *m_iuScale, aUnits, aMin ) )
316 {
317 double val_min_iu = EDA_UNIT_UTILS::UI::FromUserUnit( *m_iuScale, aUnits, aMin );
318 m_errorMessage = wxString::Format( _( "%s must be at least %s." ),
321 val_min_iu, true ) );
322
323 textEntry->SelectAll();
324
325 // Don't focus directly; we might be inside a KillFocus event handler
326 wxPostEvent( this, wxCommandEvent( DELAY_FOCUS ) );
327
328 return false;
329 }
330
331 if( GetValue() > EDA_UNIT_UTILS::UI::FromUserUnit( *m_iuScale, aUnits, aMax ) )
332 {
333 double val_max_iu = EDA_UNIT_UTILS::UI::FromUserUnit( *m_iuScale, aUnits, aMax );
334 m_errorMessage = wxString::Format( _( "%s must be less than %s." ),
337 val_max_iu, true ) );
338
339 textEntry->SelectAll();
340
341 // Don't focus directly; we might be inside a KillFocus event handler
342 wxPostEvent( this, wxCommandEvent( DELAY_FOCUS ) );
343
344 return false;
345 }
346
347 return true;
348}
349
350
351void UNIT_BINDER::SetValue( long long int aValue )
352{
353 double displayValue = m_originTransforms.ToDisplay( aValue, m_coordType );
354 wxString textValue = EDA_UNIT_UTILS::UI::StringFromValue( *m_iuScale, m_units, displayValue,
355 false, m_dataType );
356
357 if( displayValue == 0 && m_negativeZero )
358 SetValue( wxT( "-" ) + textValue );
359 else
360 SetValue( textValue );
361}
362
363
364void UNIT_BINDER::SetDoubleValue( double aValue )
365{
366 double displayValue = m_originTransforms.ToDisplay( aValue, m_coordType );
368 setPrecision( displayValue, false ),
369 false, m_dataType );
370
371 if( displayValue == 0 && m_negativeZero )
372 SetValue( wxT( "-" ) + textValue );
373 else
374 SetValue( textValue );
375}
376
377
379{
380 SetDoubleValue( aValue.AsDegrees() );
381}
382
383
384void UNIT_BINDER::SetValue( const wxString& aValue )
385{
386 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
387 wxStaticText* staticText = dynamic_cast<wxStaticText*>( m_valueCtrl );
388
389 wxString value = aValue;
390
391 if( m_unitsInValue )
392 {
394 value += wxT( " " );
395
397 }
398
399 if( textEntry )
400 textEntry->SetValue( value );
401 else if( staticText )
402 staticText->SetLabel( value );
403
404 if( m_allowEval )
405 m_eval.Clear();
406
407 if( m_unitLabel )
409
410}
411
412
413void UNIT_BINDER::ChangeValue( int aValue )
414{
415 double displayValue = m_originTransforms.ToDisplay( aValue, m_coordType );
417 setPrecision( displayValue, false ),
418 false, m_dataType );
419
420 if( displayValue == 0 && m_negativeZero )
421 ChangeValue( wxT( "-" ) + textValue );
422 else
423 ChangeValue( textValue );
424}
425
426
428{
429 double displayValue = m_originTransforms.ToDisplay( aValue, m_coordType );
431 setPrecision( displayValue, false ),
432 false, m_dataType );
433
434 if( displayValue == 0 && m_negativeZero )
435 ChangeValue( wxT( "-" ) + textValue );
436 else
437 ChangeValue( textValue );
438}
439
440
442{
443 ChangeDoubleValue( aValue.AsDegrees() );
444}
445
446
447void UNIT_BINDER::ChangeValue( const wxString& aValue )
448{
449 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
450 wxStaticText* staticText = dynamic_cast<wxStaticText*>( m_valueCtrl );
451
452 wxString value = aValue;
453
454 if( m_unitsInValue )
455 {
457 value += wxT( " " );
458
460 }
461
462 if( textEntry )
463 textEntry->ChangeValue( value );
464 else if( staticText )
465 staticText->SetLabel( value );
466
467 if( m_allowEval )
468 m_eval.Clear();
469
470 if( m_unitLabel )
472}
473
474
476{
477 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
478 wxStaticText* staticText = dynamic_cast<wxStaticText*>( m_valueCtrl );
479 wxString value;
480
481 if( textEntry )
482 {
483 if( m_needsEval && m_eval.Process( textEntry->GetValue() ) )
484 value = m_eval.Result();
485 else
486 value = textEntry->GetValue();
487 }
488 else if( staticText )
489 {
490 value = staticText->GetLabel();
491 }
492 else
493 {
494 return 0;
495 }
496
497 long long int displayValue = EDA_UNIT_UTILS::UI::ValueFromString( *m_iuScale, m_units, value,
498 m_dataType );
499 return m_originTransforms.FromDisplay( displayValue, m_coordType );
500}
501
502
503double UNIT_BINDER::setPrecision( double aValue, bool aValueUsesUserUnits )
504{
505 if( m_precision > 1 )
506 {
507 int scale = pow( 10, m_precision );
508 int64_t tmp = aValue;
509 if( !aValueUsesUserUnits )
510 {
512 }
513
514 aValue = static_cast<double>( tmp ) / scale;
515
516 if( !aValueUsesUserUnits )
518 }
519
520 return aValue;
521}
522
523
525{
526 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
527 wxStaticText* staticText = dynamic_cast<wxStaticText*>( m_valueCtrl );
528 wxString value;
529
530 if( textEntry )
531 {
532 if( m_needsEval && m_eval.Process( textEntry->GetValue() ) )
533 value = m_eval.Result();
534 else
535 value = textEntry->GetValue();
536 }
537 else if( staticText )
538 {
539 value = staticText->GetLabel();
540 }
541 else
542 {
543 return 0.0;
544 }
545
547 value, m_dataType );
548 displayValue = setPrecision( displayValue, false );
549
550 return m_originTransforms.FromDisplay( displayValue, m_coordType );
551}
552
553
555{
557}
558
559
561{
562 wxTextEntry* te = dynamic_cast<wxTextEntry*>( m_valueCtrl );
563
564 if( te )
565 return te->GetValue() == INDETERMINATE_STATE || te->GetValue() == INDETERMINATE_ACTION;
566
567 return false;
568}
569
570
572{
573 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
574 wxStaticText* staticText = dynamic_cast<wxStaticText*>( m_valueCtrl );
575
576 if( m_allowEval )
577 return m_eval.OriginalText();
578 else if( textEntry )
579 return textEntry->GetValue();
580 else if( staticText )
581 return staticText->GetLabel();
582 else
583 return wxEmptyString;
584}
585
586
587void UNIT_BINDER::SetLabel( const wxString& aLabel )
588{
589 m_label->SetLabel( aLabel );
590}
591
592
593void UNIT_BINDER::Enable( bool aEnable )
594{
595 m_label->Enable( aEnable );
596 m_valueCtrl->Enable( aEnable );
597
598 if( m_unitLabel )
599 m_unitLabel->Enable( aEnable );
600}
601
602
603void UNIT_BINDER::Show( bool aShow, bool aResize )
604{
605 m_label->Show( aShow );
606 m_valueCtrl->Show( aShow );
607
608 if( m_unitLabel )
609 m_unitLabel->Show( aShow );
610
611 if( aResize )
612 {
613 if( aShow )
614 {
615 m_label->SetSize( -1, -1 );
616 m_valueCtrl->SetSize( -1, -1 );
617
618 if( m_unitLabel )
619 m_unitLabel->SetSize( -1, -1 );
620 }
621 else
622 {
623 m_label->SetSize( 0, 0 );
624 m_valueCtrl->SetSize( 0, 0 );
625
626 if( m_unitLabel )
627 m_unitLabel->SetSize( 0, 0 );
628 }
629 }
630}
631
632
634 UNIT_BINDER( aParent, nullptr, nullptr, nullptr, true, false )
635{
636 m_unitsInValue = true;
637}
638
639
641{
642}
643
645{
646 m_valueCtrl = aControl;
647
648 if( m_valueCtrl )
649 {
650 m_valueCtrl->Bind( wxEVT_SET_FOCUS, &PROPERTY_EDITOR_UNIT_BINDER::onSetFocus, this );
651 m_valueCtrl->Bind( wxEVT_KILL_FOCUS, &PROPERTY_EDITOR_UNIT_BINDER::onKillFocus, this );
652 m_valueCtrl->Bind( wxEVT_LEFT_UP, &PROPERTY_EDITOR_UNIT_BINDER::onClick, this );
653
654 m_valueCtrl->Bind( wxEVT_SHOW,
655 [&]( wxShowEvent& e )
656 {
657 if( !e.IsShown() )
658 SetControl( nullptr );
659 } );
660 }
661}
double AsDegrees() const
Definition: eda_angle.h:149
The base frame for deriving all KiCad main window classes.
The base class for create windows for drawing purpose.
wxString OriginalText() const
wxString Result() const
void SetDefaultUnits(EDA_UNITS aUnits)
bool Process(const wxString &aString)
A class to perform either relative or absolute display origin transforms for a single axis of a point...
virtual int FromDisplay(int aValue, COORD_TYPES_T aCoordType) const
virtual int ToDisplay(int aValue, COORD_TYPES_T aCoordType) const
void SetControl(wxWindow *aControl)
PROPERTY_EDITOR_UNIT_BINDER(EDA_DRAW_FRAME *aParent)
const EDA_IU_SCALE & GetIuScale() const
EDA_UNITS GetUserUnits() const
ORIGIN_TRANSFORMS::COORD_TYPES_T m_coordType
Type of coordinate for display origin transforms.
Definition: unit_binder.h:254
virtual void ChangeDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...
wxString GetOriginalText() const
Return the pre-evaluated text (or the current text if evaluation is not supported).
void onKillFocus(wxFocusEvent &aEvent)
virtual long long int GetValue()
Return the current value in Internal Units.
void Enable(bool aEnable)
Enable/disable the label, widget and units label.
void onClick(wxMouseEvent &aEvent)
virtual void SetPrecision(int aLength)
Normally not needed, but can be used to set the precision when using internal units that are floats (...
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...
bool m_allowEval
Definition: unit_binder.h:242
const EDA_IU_SCALE * m_iuScale
Definition: unit_binder.h:233
wxString m_errorMessage
Definition: unit_binder.h:239
virtual EDA_ANGLE GetAngleValue()
bool m_negativeZero
Indicates "-0" should be displayed for 0.
Definition: unit_binder.h:235
int m_precision
0 to 6
Definition: unit_binder.h:237
wxStaticText * m_unitLabel
Can be nullptr.
Definition: unit_binder.h:230
bool m_unitsInValue
Units label should be included in value text.
Definition: unit_binder.h:248
wxWindow * m_valueCtrl
Definition: unit_binder.h:229
wxWindow * m_eventSource
Definition: unit_binder.h:224
void onSetFocus(wxFocusEvent &aEvent)
UNIT_BINDER(EDA_DRAW_FRAME *aParent, wxStaticText *aLabel, wxWindow *aValueCtrl, wxStaticText *aUnitLabel, bool aAllowEval=true, bool aBindFocusEvent=true)
Definition: unit_binder.cpp:40
wxStaticText * m_label
Definition: unit_binder.h:228
ORIGIN_TRANSFORMS & m_originTransforms
A reference to an ORIGIN_TRANSFORMS object.
Definition: unit_binder.h:251
bool m_bindFocusEvent
The bound widgets.
Definition: unit_binder.h:225
long m_selStart
Selection start and end of the original text.
Definition: unit_binder.h:245
EDA_UNITS m_units
Definition: unit_binder.h:234
virtual double GetDoubleValue()
Return the current value in Internal Units.
double setPrecision(double aValue, bool aValueUsesUserUnits)
When m_precision > 0 truncate the value aValue to show only m_precision digits in mantissa.
bool IsIndeterminate() const
Return true if the control holds the indeterminate value (for instance, if it represents a multiple s...
bool m_needsEval
Definition: unit_binder.h:243
void SetDataType(EDA_DATA_TYPE aDataType)
Used to override the datatype of the displayed property (default is DISTANCE)
void delayedFocusHandler(wxCommandEvent &aEvent)
EDA_DATA_TYPE m_dataType
Definition: unit_binder.h:236
virtual void SetAngleValue(const EDA_ANGLE &aValue)
void SetLabel(const wxString &aLabel)
void init(UNITS_PROVIDER *aProvider)
virtual void ChangeAngleValue(const EDA_ANGLE &aValue)
virtual void SetDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
virtual ~UNIT_BINDER() override
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.
virtual void ChangeValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void Show(bool aShow, bool aResize=false)
Show/hide the label, widget and units label.
NUMERIC_EVALUATOR m_eval
Definition: unit_binder.h:241
void onUnitsChanged(wxCommandEvent &aEvent)
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:300
This file is part of the common library.
const int minSize
Push and Shove router track width and via size dialog.
#define _(s)
@ DEGREES_T
Definition: eda_angle.h:31
EDA_DATA_TYPE
The type of unit.
Definition: eda_units.h:36
EDA_UNITS
Definition: eda_units.h:43
double FromUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Return in internal units the value "val" given in a real unit such as "in", "mm" or "deg".
Definition: eda_units.cpp:396
long long int ValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: eda_units.cpp:536
wxString StringFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Returns the string from aValue according to aUnits (inch, mm ...) for display.
Definition: eda_units.cpp:236
double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts aTextValue to a double.
Definition: eda_units.cpp:456
double ToUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: eda_units.cpp:201
wxString GetLabel(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
Definition: eda_units.cpp:125
int GetUserUnits()
Return the currently selected user unit value for the interface.
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
const int scale
#define INDETERMINATE_ACTION
Definition: ui_common.h:43
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
Definition: ui_common.h:42
wxDEFINE_EVENT(DELAY_FOCUS, wxCommandEvent)
wxString valueDescriptionFromLabel(wxStaticText *aLabel)