kopia lustrzana https://gitlab.com/sane-project/frontends
Fix format scale
rodzic
6243f046f5
commit
4f74200e8c
|
@ -539,6 +539,13 @@ value_changed:
|
|||
return;
|
||||
}
|
||||
|
||||
// Fonction pour formater la valeur affichée par le GtkScale
|
||||
static gchar*
|
||||
format_value(GtkScale *scale, gdouble value, gpointer user_data) {
|
||||
// Formater la valeur en entier
|
||||
return g_strdup_printf("%d", (int)value);
|
||||
}
|
||||
|
||||
static void
|
||||
scale_new (GtkWidget * parent, const char *name, gfloat val,
|
||||
gfloat min, gfloat max, gfloat quant, int automatic,
|
||||
|
@ -549,17 +556,17 @@ scale_new (GtkWidget * parent, const char *name, gfloat val,
|
|||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
|
||||
gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
|
||||
gtk_box_prepend (GTK_BOX (parent), hbox);
|
||||
gtk_box_pack_start (GTK_BOX (parent), hbox, FALSE, FALSE, 5);
|
||||
|
||||
label = gtk_label_new ((char *) name);
|
||||
gtk_box_prepend(GTK_BOX (hbox), label);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
|
||||
|
||||
elem->data = gtk_adjustment_new (val, min, max, quant, 1.0, 0.0);
|
||||
scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT(elem->data));
|
||||
/*
|
||||
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, min, max, quant);
|
||||
elem->data = gtk_range_get_adjustment (GTK_RANGE (scale));
|
||||
*/
|
||||
gtk_scale_set_value_pos(GTK_SCALE(scale), GTK_POS_TOP);
|
||||
gtk_scale_set_draw_value(GTK_SCALE(scale), TRUE);
|
||||
gtk_scale_set_format_value_func(GTK_SCALE(scale), format_value, NULL, NULL);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT(elem->data), val);
|
||||
set_tooltip (scale, desc);
|
||||
gtk_widget_set_size_request (scale, 200, 0);
|
||||
|
@ -567,7 +574,7 @@ scale_new (GtkWidget * parent, const char *name, gfloat val,
|
|||
if (automatic)
|
||||
autobutton_new (hbox, elem, scale);
|
||||
else
|
||||
gtk_box_prepend (GTK_BOX (hbox), scale);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), scale, FALSE, FALSE, 0);
|
||||
|
||||
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
||||
if (quant - (int) quant == 0.0)
|
||||
|
|
Ładowanie…
Reference in New Issue