On 25 oct. 2013, at 09:50, Stéphane Ducasse <stephane.duca...@inria.fr> wrote:

> I was only use in stupid halos and the code is not really good.
> Now if somebody does a pass on it we could readd it to the basis. (right now 
> I just put it back for the sound package - but the sound package shows it 
> ages… the code looks strange).
> 
> floatPrecisionForDecimalPlaces: places
>       "Answer the floatPrecision that corresponds to the given number of 
> decimal places"
> 
>       ^ places caseOf:
>                       {[0]->[1] .
>                       [1]->[0.1] . 
>                       [2]->[0.01] .
>                       [3]->[0.001] .
>                       [4]->[0.0001] .
>                       [5]->[0.00001] .
>                       [6]->[0.000001] .
>                       [7]->[0.0000001] .
>                       [8]->[0.00000001] .
>                       [9]->[0.000000001]}
>               otherwise:
>                       [(10.0 raisedTo: places negated) asFloat]

Ha yes, I remember this one :D !

> 
> "
> (0 to: 6) collect: [:i | Utilities floatPrecisionForDecimalPlaces: i]
> (-10 to: 20) collect: [:i | Utilities floatPrecisionForDecimalPlaces: i]
> "
> 
> like decimalPlaces: 
> 
> valueFromContents
>       "Return a new value from the current contents string."
> 
>       format = #symbol ifTrue: [^ lastValue].
>       format = #string ifTrue: [^ contents].
>       ^ self class evaluatorClass evaluate: contents
> 
> setPrecision
>       "Allow the user to specify a number of decimal places. This UI is
>       invoked from a menu. Nowadays the precision can be set by simple
>       type-in, making this menu approach mostly obsolete. However, it's
>       still useful for read-only readouts, where type-in is not allowed."
>       | aMenu |
>       aMenu := UIManager default 
>                                newMenuIn: self for: self.
>       aMenu
>               addTitle: ('How many decimal places? (currently {1})' 
> translated format: {self decimalPlaces}).
>       0
>               to: 5 
>               do: [:places | aMenu
>                               add: places asString
>                               target: self
>                               selector: #setDecimalPlaces:
>                               argument: places].
>       aMenu popUpInWorld
> 
> 
> 
> 
> 
>> 
>> On 24 oct. 2013, at 22:07, Sean P. DeNigris <s...@clipperadams.com> wrote:
>> 
>>> What happened to it and why? I'm porting TWM to 3.0 and didn't find any
>>> mention of removal on the dev or issue mailing list... Thanks.
>> 
>> It was removed in 30507.
>> The decision to remove it has been made during the august sprint.
>> I just remember that I did the job.
>> Does someone remember why?
>> 
>>> 
>>> -----
>>> Cheers,
>>> Sean
>>> --
>>> View this message in context: 
>>> http://forum.world.st/UpdatingMenuMorph-tp4716928.html
>>> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>>> 
>> 
> 

Reply via email to