aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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(