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. > >> >> 2016-04-11 15:09 GMT+02:00 jp charras <jp.char...@wanadoo.fr>: >>> Le 11/04/2016 14:10, Chris Pavlina a écrit : >>>> ...why would I make some special entry box for this? What's wrong with what >>>> I've already done? >>> >>> Nothing really wrong, but: >>> >>> * At least on Windows, wxFloatingPointValidator does not work fine: >>> - as long you are using the default language, it works. >>> - if you are switching to an other language (in my case from French >>> (default) to English, it does >>> not work anymore (neither the '.' nor the ',' are accepted, you cannot >>> enter a value with mantissa) >>> This was already reported in a bug report (See >>> https://bugs.launchpad.net/kicad/+bug/1568302). >>> * in all other dialogs which accept floating point coordinates, both the >>> separators are accepted (. >>> or ,) and correctly parsed and the value is correctly converted, This is a >>> very serious enhancement >>> for guys like me who are living in countries using the ',' as separator. >>> >>> So, I agree with Lorenzo: a derivative entry box which works on Windows, >>> handles both separators and >>> returns the right value is better than a wxFloatingPointValidator which >>> does not work very well. >>> >>>> On Apr 11, 2016 2:18 AM, "Lorenzo Marcantonio" >>>> <l.marcanto...@cz-dynamic.it> >>>> wrote: >>>> >>>>> On Sat, Apr 09, 2016 at 10:37:43AM -0400, Chris Pavlina wrote: >>>>>> Anyone mind if I go through and fix the "in 0.1 degrees" units that are >>>>> all >>>>>> over pcbnew? I don't see any reason why we can't let the user enter unit >>>>>> degrees with a decimal point. >>>>> >>>>> Probably stems for avoiding floats around the code, which is a good >>>>> idea... we sometime went thru horrible linear algebra things to avoid >>>>> trigonometric code and the resulting rounding issues. >>>>> >>>>> If you really want to fix it I'd suggest to make a derivative entry box >>>>> that handles it and returns the value in decidegrees. Look how the >>>>> current 'mils/inch/mm' entry box does it to centralize the >>>>> conversion/check. >>>>> >>>>> -- >>>>> Lorenzo Marcantonio >>>>> CZ Srl - Parma > > _______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp