After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 565656 - Add marks to scales
Add marks to scales
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 565144
 
 
Reported: 2008-12-25 23:34 UTC by Matthias Clasen
Modified: 2009-01-20 05:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (29.04 KB, patch)
2008-12-25 23:34 UTC, Matthias Clasen
none Details | Review
test cases (6.42 KB, text/plain)
2008-12-25 23:37 UTC, Matthias Clasen
  Details
screenshot (28.22 KB, image/png)
2008-12-25 23:38 UTC, Matthias Clasen
  Details

Description Matthias Clasen 2008-12-25 23:34:28 UTC
Sometimes it is useful to point out certain values in a scale, and make it easy for the user to select them exactly. See e.g bug 565144 where a scale is used for fade control between left and right, and midpoint would be very beneficial. Another use case would be to mark the 0dB position on a volume slider.

Here is a patch that adds this feature to GtkScale. It allows to place "marks" on either side of the scale, optionally with text or icons. Behaviour-wise, selecting the mark values is made easier by adding a little resistance while dragging the slider with the mouse, and making keynav go exactly to the mark value instead of stepping over it.

I'm not entirely sold on the api, and allowing icons as decoration may be a bit over the top.
Comment 1 Matthias Clasen 2008-12-25 23:34:55 UTC
Created attachment 125316 [details] [review]
patch
Comment 2 Matthias Clasen 2008-12-25 23:37:40 UTC
Created attachment 125317 [details]
test cases
Comment 3 Matthias Clasen 2008-12-25 23:38:09 UTC
Created attachment 125318 [details]
screenshot
Comment 4 Matthias Clasen 2009-01-20 05:10:58 UTC
I've decided to leave out icons for now. If we want them later on, we
can add another function for that.


        Bug 565656 – Add marks to scales

        * gtk/gtkrange.[hc]: Add internal api to define 'stop values'
        that have a little resistance when dragging the slider over it.

        * gtk/gtk.symbols:
        * gtk/gtkscale.[hc] (gtk_scale_add_mark): New function to add
        a 'mark' to a scale, which will draws a tick, plus optionally
        some text, and makes the value a stop value.
        (gtk_scale_clear_values): Removes all marks.

        * tests/testscale.c: Test for marks on scales
        * tests/Makefile.am: Integrate it