← Back to team overview

kicad-developers team mailing list archive

Re: 0.1 degrees

 

On 4/11/2016 10:39 AM, jp charras wrote:
> Le 11/04/2016 16:07, Wayne Stambaugh a écrit :
>> On 4/11/2016 9:43 AM, jp charras wrote:
>>> Le 11/04/2016 15:12, Nick Østergaard a écrit :
>>>> In addition I would vote for a proper validator that accepts units. We
>>>> already have the feature to enter 42.34 mm even if you are in inch
>>>> mode globally. With the wxvalidator you can not enter letters at all,
>>>> and hence not the unit.
>>>
>>> For this feature, see:
>>> double DoubleValueFromString(  EDA_UNITS_T aUnits, const wxString& aTextValue );
>>> It accepts units and both separators in the text value (for angles, degrees or radians).
>>
>> This isn't a validator.  DoubleValueFromString() has to be called after
>> the data is entered into the text control.  Properly designed validators
>> will filter illegal characters and display error messages if the
>> validation fails.  It's a much cleaner design.  Eventually I would like
>> to see most if not all of our dialogs use validators.  We just need to
>> create a decent set of stock validators that handle the data entry we
>> use.  Once we have a decent set of stock validators, it should be fairly
>> trivial to fix our dialogs.
>>
> 
> Of course, it is not a validator, but shows what a good validator should accept.
> 
> Just when creating validators for values (coordinates, angles) keep in mind the presence of units,
> taking in account the I18n constraints.
> A validator for coordinates and angles is more complicated than the wxValidators from wxWidgets, if
> we want to specify units in values (I have to say I do not use this feature, but it currently exists)

wxWidgets just provides a minimal set of generic validators which are
useful for deriving more application specific validators.  I've seen
some useful validator examples with numeric clamping and other clever
validation.  One of the more useful validators we should create is to
handle coordinate entry which could include things like adding units,
clamping, and conversion to and from board and schematic internal units.
 Also keep in mind that if you pass a pointer of the data type to the
validator, it will auto-magically handle transferring the between the
control and the pointer to the data.  This can simplify things even more.



Follow ups

References