aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-05-26 19:40:05 +0000
committerDavid Robillard <d@drobilla.net>2013-05-26 19:40:05 +0000
commit181d5f98ca3e6fe9730ae799328edda66b0cbfb0 (patch)
tree7912175b9bdf1fad2cb1b7bf785428974ba5cff4
parent3f2b8f817b22c36317b4b24ad98f6f142b220f81 (diff)
downloadjalv-181d5f98ca3e6fe9730ae799328edda66b0cbfb0.tar.gz
jalv-181d5f98ca3e6fe9730ae799328edda66b0cbfb0.tar.bz2
jalv-181d5f98ca3e6fe9730ae799328edda66b0cbfb0.zip
Work around Gtk bug for labels on sliders (patch from Robin Gareus).
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@5110 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--AUTHORS4
-rw-r--r--NEWS3
-rw-r--r--src/jalv_gtk.c22
3 files changed, 21 insertions, 8 deletions
diff --git a/AUTHORS b/AUTHORS
index a482496..8429456 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,8 +1,8 @@
Author:
David Robillard <d@drobilla.net>
-GTK2 Generic Plugin UI:
+Original GTK2 Generic Plugin UI:
Nick Lanham <nick@afternight.org>
-UI update rate option:
+Various UI improvements:
Robin Gareus <robin@gareus.org>
diff --git a/NEWS b/NEWS
index d56e7e8..adbd21b 100644
--- a/NEWS
+++ b/NEWS
@@ -4,8 +4,9 @@ jalv (1.4.1) unstable;
* Add command-line option to control UI update frequency
* Fix default setting for non-sequential enumeration ports
(patch from Robin Gareus)
+ * Work around Gtk bug for labels on sliders (patch from Robin Gareus)
- -- David Robillard <d@drobilla.net> Sun, 26 May 2013 15:15:09 -0400
+ -- David Robillard <d@drobilla.net> Sun, 26 May 2013 15:36:05 -0400
jalv (1.4.0) stable;
diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c
index 00cbf27..1698f32 100644
--- a/src/jalv_gtk.c
+++ b/src/jalv_gtk.c
@@ -405,6 +405,14 @@ dcmp(gconstpointer a, gconstpointer b)
return y < z ? -1 : z < y ? 1 : 0;
}
+static gint
+drcmp(gconstpointer a, gconstpointer b)
+{
+ double y = *(double*)a;
+ double z = *(double*)b;
+ return y < z ? 1 : z < y ? -1 : 0;
+}
+
static Controller*
make_controller(GtkSpinButton* spin, GtkWidget* control)
{
@@ -449,12 +457,11 @@ make_combo(struct Port* port, GHashTable* points)
}
static void
-add_mark(void* key, void* value, void* scale)
+add_mark(gdouble key, const gchar* value, void* scale)
{
gchar* str = g_markup_printf_escaped("<span font_size=\"small\">%s</span>",
- (const char*)value);
- gtk_scale_add_mark(GTK_SCALE(scale), *(double*)key, GTK_POS_TOP, str);
- g_free(str);
+ value);
+ gtk_scale_add_mark(GTK_SCALE(scale), key, GTK_POS_TOP, str);
}
static Controller*
@@ -490,7 +497,12 @@ make_slider(struct Port* port, GHashTable* points,
gtk_range_set_value(GTK_RANGE(scale), port->control);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), port->control);
if (points) {
- g_hash_table_foreach(points, add_mark, scale);
+ GList* list = g_hash_table_get_keys(points);
+ for (GList* cur = g_list_sort(list, drcmp); cur; cur = cur->next) {
+ add_mark(*(gdouble*)cur->data,
+ g_hash_table_lookup(points, cur->data),
+ scale);
+ }
}
g_signal_connect(