sounds good to me.

would we need any visible indication that this scale is logarithmic?
or would the number changing logarithmically be indication enough?

-jo

On Sun, Feb 14, 2016 at 2:01 AM, Ulrich Pegelow
<ulrich.pege...@tongareva.de> wrote:
> Am 13.02.2016 um 12:03 schrieb johannes hanika:
>>>
>>> short question: is there already an established way to get a bauhaus
>>> slider
>>> with a logarithmic scale?
>>
>>
>> short answer: no. (other than just mapping some mislabeled value to
>> exp(v) in the gui callback or commit_params..
>
>
> My idea: we implement a callback functionality into the bauhaus slider:
>
> void dt_bauhaus_slider_set_callback(GtkWidget *w, float
> (*value_callback)(float value, int dir))
>
> With 'dir' indicating the direction of the conversion (e.g. DT_BAUHAUS_SET
> or DT_BAUHAUS_GET). Advantage: we have quite some flexibility rather than
> just logarithmic and normal. By default the callback is NULL and the bauhaus
> slider behaves as normal.
>
> For a logarithmic slider the callback could look like:
>
> static float log_slider_callback(float inval, int dir)
> {
>   float outval;
>   switch(dir)
>   {
>     case DT_BAUHAUS_SET:
>       outval = log10(fmax(inval, 1e-15f));
>       break;
>     case DT_BAUHAUS_GET:
>       outval = exp10(inval);
>       break;
>     default:
>       outval = inval;
>   }
>   return outval;
> }
>
>
> I see five locations where the callback must take effect:
>
> 1) dt_bauhaus_slider_set() and dt_bauhaus_slider_set_soft()
> 2) dt_bauhaus_slider_get()
> 3) on displaying the slider value in the GUI
> 4) on referencing the current value as "x" in the calculator
> 5) on setting the new value in the calculator
>
> Ulrich
>
>
>> -jo
>>>
>>>
>>> Background: I would need a slider for focal length (1mm to 1000mm) and
>>> this
>>> would better scale logarithmically.
>>>
>>> Ulrich
___________________________________________________________________________
darktable developer mailing list
to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org

Reply via email to