darktable-org / darktable-org/darktable
percentage slider setup
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 13.1k
- Forks
- 1.4k
- Avg merge
- 22h 14m
- Merged PRs (30d)
- 198
Description
Is there an existing issue for this?
- I checked and did not find my issue in the already reported ones
Describe the bug
Following up on a discussion with @dterrahe regarding sliders.
AFAIK, there is no bug on the current UI; however, there is a problem in the framework, and potential incorrect usage.
In bauhaus.c, the following function has a heuristic to set the number of digits. If a naïve dev sets up a slider as:
// suppose the model is a real number, hard_max is 10 or below;
// dev wants to set up single-digit percentages, e.g. 12.3%
dt_bauhaus_slider_set_digits(slider, 1);
dt_bauhaus_slider_set_format(slider, "%);
then the actual code sets digits = -1:
void dt_bauhaus_slider_set_format(GtkWidget *widget,
const char *format)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(widget);
if(w->type != DT_BAUHAUS_SLIDER) return;
dt_bauhaus_slider_data_t *d = &w->slider;
d->format = g_intern_string(format);
if(strstr(format,"%") && fabsf(d->hard_max) <= 10)
{
if(d->factor == 1.0f) d->factor = 100;
d->digits -= 2;
}
}
Questions:
- do we want to prevent this, or it will be caught during testing, anyway?
- should we prevent negative
digitsindt_bauhaus_slider_set_format - is setting the digits recommended before or after? Before: sets the real number digits (e.g. 4 means 0.1234, 12.34), but is subject to the 'max 10' heuristics; after: explicit.
useless.cuses before:dt_bauhaus_slider_set_digits(g->factor, 2); // Additional parameters determine how the value will be shown. dt_bauhaus_slider_set_format(g->factor, "%");
I've extracted the digit/format pairs, where the digits are set first (hope I got them all).
Steps to reproduce
No reproducible bug
Expected behavior
No response
Logfile | Screenshot | Screencast
No response
Commit
No response
Where did you obtain darktable from?
darktable.org / GitHub release
darktable version
all versions
What OS are you using?
Linux
What is the version of your OS?
all platforms
Describe your system
No response
Are you using OpenCL GPU in darktable?
None
If yes, what is the GPU card and driver?
No response
Please provide additional context if applicable. You can attach files too, but might need to rename to .txt or .zip
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in bauhaus.c at dt_bauhaus_slider_set_format and inspect how digits, factor, hard_max, and percentage formats interact. Compare the digit/format pairs in sliders.txt with the setup in useless.c; this issue is done when the desired ordering and handling of negative digits are agreed and the affected slider configurations behave consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100