summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-06-08 17:00:03 +0000
committerjstebbins <[email protected]>2009-06-08 17:00:03 +0000
commit8dc32d2cfd52a1f1b97a2360d04241c9e2d96b13 (patch)
tree4bd6289375278cd5a3ec009f8596cdb08f0ad6a4 /gtk/src
parentba55f4a2f3c85a600231223d2912d9afcada00f8 (diff)
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
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/audiohandler.c22
-rw-r--r--gtk/src/ghb.ui97
-rw-r--r--gtk/src/main.c1
-rw-r--r--gtk/src/settings.c12
4 files changed, 86 insertions, 46 deletions
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 @@
<property name="page_size">0</property>
<property name="value">1</property>
</object>
+ <object class="GtkAdjustment" id="adjustment28">
+ <property name="upper">4</property>
+ <property name="lower">0</property>
+ <property name="page_increment">1</property>
+ <property name="step_increment">0.2</property>
+ <property name="page_size">0</property>
+ <property name="value">2.6</property>
+ </object>
<object class="GtkAdjustment" id="preview_progress_adj">
<property name="upper">100</property>
<property name="lower">0</property>
@@ -1904,46 +1912,6 @@
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkAlignment" id="alignment42">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0.98000001907348633</property>
- <property name="xscale">0.40000000596046448</property>
- <child>
- <object class="GtkVBox" id="vbox18">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">Dynamic Range Compression</property>
- </object>
- </child>
- <child>
- <object class="GtkHScale" id="AudioTrackDRCSlider">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="adjustment">adjustment6</property>
- <property name="restrict_to_fill_level">False</property>
- <property name="fill_level">3823.35009765625</property>
- <property name="value_pos">GTK_POS_RIGHT</property>
- <signal handler="drc_widget_changed_cb" name="value_changed"/>
- <signal name="format_value" handler="format_drc_cb"/>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
@@ -1954,7 +1922,7 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="n_rows">2</property>
- <property name="n_columns">5</property>
+ <property name="n_columns">7</property>
<child>
<object class="GtkComboBox" id="AudioTrack">
<property name="width_request">215</property>
@@ -2058,6 +2026,18 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="label39">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">DRC</property>
+ </object>
+ <packing>
+ <property name="left_attach">5</property>
+ <property name="right_attach">7</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkComboBox" id="AudioMixdown">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -2072,6 +2052,41 @@
</packing>
</child>
<child>
+ <object class="GtkScaleButton" id="AudioTrackDRCSlider">
+ <property name="visible">True</property>
+ <property name="orientation">1</property>
+ <property name="icons">audio-volume-muted
+audio-volume-high
+audio-volume-low
+audio-volume-medium</property>
+ <property name="adjustment">adjustment28</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <signal handler="drc_widget_changed_cb" name="value_changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="drc_label">
+ <property name="visible">True</property>
+ <property name="width-chars">3</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">Off</property>
+ </object>
+ <packing>
+ <property name="left_attach">6</property>
+ <property name="right_attach">7</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkComboBox" id="AudioBitrate">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
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);