OSDN Git Service

LinGui: replace drc hscale with scalebutton
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 8 Jun 2009 17:00:03 +0000 (17:00 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 8 Jun 2009 17:00:03 +0000 (17:00 +0000)
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://localhost/HandBrake/trunk@2503 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/src/audiohandler.c
gtk/src/ghb.ui
gtk/src/main.c
gtk/src/settings.c

index c018445..ba25002 100644 (file)
@@ -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)
index 95d95ca..3495cbb 100644 (file)
     <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>
                                         <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>
                                     <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>
                                       </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>
                                       </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>
index e60ffbc..043c4c6 100644 (file)
@@ -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";
index 41dd26b..f392bc2 100644 (file)
@@ -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);