From 8dc32d2cfd52a1f1b97a2360d04241c9e2d96b13 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Mon, 8 Jun 2009 17:00:03 +0000 Subject: LinGui: replace drc hscale with scalebutton scale button pops up a scale when needed, so is more compact. audio settings now all fit in one row. this opens the possibility of making the audio tab behave more like the mac ui's git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2503 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- gtk/src/audiohandler.c | 22 +++++++++--- gtk/src/ghb.ui | 97 +++++++++++++++++++++++++++++--------------------- gtk/src/main.c | 1 + gtk/src/settings.c | 12 +++++++ 4 files changed, 86 insertions(+), 46 deletions(-) (limited to 'gtk') diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c index c018445ae..ba250020c 100644 --- a/gtk/src/audiohandler.c +++ b/gtk/src/audiohandler.c @@ -402,13 +402,25 @@ drc_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { GValue *asettings; gdouble val; + GtkLabel *label; + gchar *drc; g_debug("drc_widget_changed_cb ()"); - val = gtk_range_get_value(GTK_RANGE(widget)); - if (val < 0.5) - gtk_range_set_value(GTK_RANGE(widget), 0.0); - else if (val < 1.0) - gtk_range_set_value(GTK_RANGE(widget), 1.0); + val = gtk_scale_button_get_value(GTK_SCALE_BUTTON(widget)); + if (val > 0.8 && val < 1.0) + gtk_scale_button_set_value(GTK_SCALE_BUTTON(widget), 1.0); + if (val <= 0.8 && val > 0.5) + gtk_scale_button_set_value(GTK_SCALE_BUTTON(widget), 0.0); + else if (val > 0.0 && val <= 0.5) + gtk_scale_button_set_value(GTK_SCALE_BUTTON(widget), 1.0); + + label = GTK_LABEL(GHB_WIDGET(ud->builder, "drc_label")); + if (val < 1.0) + drc = g_strdup_printf("Off"); + else + drc = g_strdup_printf("%.1f", val); + gtk_label_set_text(label, drc); + g_free(drc); ghb_check_dependency(ud, widget); asettings = get_selected_asettings(ud); if (asettings != NULL) diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index 95d95caca..3495cbb76 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -217,6 +217,14 @@ 0 1 + + 4 + 0 + 1 + 0.2 + 0 + 2.6 + 100 0 @@ -1904,46 +1912,6 @@ 1 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0.98000001907348633 - 0.40000000596046448 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Dynamic Range Compression - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - adjustment6 - False - 3823.35009765625 - GTK_POS_RIGHT - - - - - 1 - - - - - - - 2 - - False @@ -1954,7 +1922,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 2 - 5 + 7 215 @@ -2057,6 +2025,18 @@ GTK_FILL + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + DRC + + + 5 + 7 + GTK_FILL + + True @@ -2071,6 +2051,41 @@ GTK_FILL + + + True + 1 + audio-volume-muted +audio-volume-high +audio-volume-low +audio-volume-medium + adjustment28 + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + 5 + 6 + 1 + 2 + GTK_FILL + + + + + True + 3 + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Off + + + 6 + 7 + 1 + 2 + GTK_FILL + + True diff --git a/gtk/src/main.c b/gtk/src/main.c index e60ffbc39..043c4c6b3 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -625,6 +625,7 @@ const gchar *hud_rcstyle = "fg[PRELIGHT]=\"white\"\n" "}\n" "widget_class \"*.GtkComboBox.GtkToggleButton\" style \"ghb-combo\"\n" +"widget_class \"*.GtkScaleButton\" style \"ghb-combo\"\n" "widget_class \"*.GtkEntry\" style \"ghb-entry\"\n" "widget \"preview_window.*.preview_hud.*\" style \"ghb-hud\"\n" "widget \"preview_window\" style \"ghb-preview\"\n"; diff --git a/gtk/src/settings.c b/gtk/src/settings.c index 41dd26ba2..f392bc281 100644 --- a/gtk/src/settings.c +++ b/gtk/src/settings.c @@ -322,6 +322,13 @@ ghb_widget_value(GtkWidget *widget) value = ghb_int_value_new(dval); } } + else if (type == GTK_TYPE_SCALE_BUTTON) + { + gdouble dval; + + dval = gtk_scale_button_get_value(GTK_SCALE_BUTTON(widget)); + value = ghb_double_value_new(dval); + } else if (type == GTK_TYPE_TEXT_VIEW) { GtkTextBuffer *buffer; @@ -588,6 +595,11 @@ update_widget(GtkWidget *widget, const GValue *value) g_debug("hscale"); gtk_range_set_value(GTK_RANGE(widget), dval); } + else if (type == GTK_TYPE_SCALE_BUTTON) + { + g_debug("scale_button"); + gtk_scale_button_set_value(GTK_SCALE_BUTTON(widget), dval); + } else if (type == GTK_TYPE_TEXT_VIEW) { g_debug("textview (%s)", str); -- cgit v1.2.3