Re: logarithmic HScale widget



>The values are usually:
>
>slider1:
>0.00001, 0.00002, 0.00005, ... 50000, 100000
>
>slider2:
>1,2,5,10, ...,500
>
>So I thought about 2 different solutions ...
>
>Idea 1:
>- use a normal slider with e.g. 36 integer values
>   -> lookup in a table the corresponding values
>- problem: the value above my slider has the integer values
>   and it's not possible to set this value from outside ...
>
>Idea 2:
>- use the code of gtkhscale.h/c and modify it as my own widget
>   -> #include "gtkloghscale.h", ...
>   have a lookup table inside the widget ...

Idea 3:

 - don't use the slider to display a numeric value (its ugly,
     anyway); use an Entry or a Label.
 - map between the slider position (0..1.0, for example) and
     the range of the actual variable (say, -inf .. 2.0).
     you just need to write 2 functions to convert in both
     directions.

i have lots of log sliders in my audio application ardour, and there
we use Idea 3 above. not only that, our sliders are non-linear, so
that "physical" changes close to where the variable = 1.0 are more
sensitive then when its close to -inf (i.e when the slider adjustment
is 0). this is done by using non-linear scaling functions.

--p



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]