OSDN Git Service

LinGui: Add max width/height widgets to preset save dialog
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 28 Jun 2010 15:59:31 +0000 (15:59 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 28 Jun 2010 15:59:31 +0000 (15:59 +0000)
These are only visible when autosize is disabled, meaning the user
has chosen to set specific video dimensions.  These values are used
when a preset or title is loaded to set the default storage dimensions.

This allows setting arbitrary PictureWidth/PictureHeight in the preset
which was not previously possible.  The values were previously limited
to what the currently loaded source would allow you to enter into
the picture settings width/height fields.

git-svn-id: svn://localhost/HandBrake/trunk@3417 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/src/callbacks.c
gtk/src/ghb.ui
gtk/src/hb-backend.c
gtk/src/hb-backend.h
gtk/src/makedeps.py
gtk/src/presets.c

index 0f2343f..b66e48e 100644 (file)
@@ -1460,7 +1460,7 @@ show_title_info(signal_user_data_t *ud, ghb_title_info_t *tinfo)
                ghb_ui_update(ud, "PictureRightCrop", ghb_int64_value(tinfo->crop[3]));
        }
        ud->scale_busy = FALSE;
-       ghb_set_scale (ud, GHB_PIC_KEEP_PAR);
+       ghb_set_scale (ud, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
        gint width, height, crop[4];
        crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
        crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
index 53174bf..d1019de 100644 (file)
@@ -66,7 +66,7 @@
     <property name="value">0</property>
   </object>
   <object class="GtkAdjustment" id="adjustment17">
-    <property name="upper">2000</property>
+    <property name="upper">8000</property>
     <property name="lower">0</property>
     <property name="page_increment">16</property>
     <property name="step_increment">2</property>
@@ -74,7 +74,7 @@
     <property name="value">0</property>
   </object>
   <object class="GtkAdjustment" id="adjustment18">
-    <property name="upper">1200</property>
+    <property name="upper">8000</property>
     <property name="lower">0</property>
     <property name="page_increment">16</property>
     <property name="step_increment">2</property>
     <property name="page_size">0</property>
     <property name="value">0</property>
   </object>
+  <object class="GtkAdjustment" id="adjustment32">
+    <property name="upper">8000</property>
+    <property name="lower">0</property>
+    <property name="page_increment">16</property>
+    <property name="step_increment">2</property>
+    <property name="page_size">0</property>
+    <property name="value">0</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment33">
+    <property name="upper">8000</property>
+    <property name="lower">0</property>
+    <property name="page_increment">16</property>
+    <property name="step_increment">2</property>
+    <property name="page_size">0</property>
+    <property name="value">0</property>
+  </object>
   <object class="GtkAdjustment" id="adjustment34">
     <property name="upper">2</property>
     <property name="lower">0</property>
@@ -4678,6 +4694,7 @@ no-fast-pskip=0:no-dct-decimate=0:cabac=1</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="label" translatable="yes">Preset Name:</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -4700,8 +4717,98 @@ no-fast-pskip=0:no-dct-decimate=0:cabac=1</property>
               </object>
               <packing>
                 <property name="expand">False</property>
+                               <property name="position">0</property>
+                <property name="padding">10</property>
               </packing>
             </child>
+                       <child>
+                         <object class="GtkVBox" id="PicturePresetBox">
+                               <property name="orientation">vertical</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>
+
+                               <child>
+                                 <object class="GtkLabel" id="UsingCurrentPicLabel">
+                                       <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">&lt;b&gt;Using Current Picture Settings&lt;/b&gt;</property>
+                                       <property name="xalign">0</property>
+                                       <property name="use_markup">True</property>
+                                 </object>
+                                 <packing>
+                                       <property name="expand">False</property>
+                                       <property name="position">0</property>
+                                 </packing>
+                               </child>
+                               <child>
+                                 <object class="GtkHBox" id="hbox31">
+                                       <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="spacing">4</property>
+                                       <child>
+                                         <object class="GtkLabel" id="label31">
+                                               <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">Max Width:</property>
+                                               <property name="xalign">0</property>
+                                         </object>
+                                         <packing>
+                                               <property name="expand">False</property>
+                                               <property name="position">0</property>
+                                         </packing>
+                                       </child>
+                                       <child>
+                                         <object class="GtkSpinButton" id="PictureWidth">
+                                               <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="tooltip-text" translatable="yes">This is the maximum width that the video will be stored at.  Whenever a new source is loaded, this value will be applied if the source width is greater. Setting this to 0 means there is no maximum width.</property>
+                                               <property name="adjustment">adjustment32</property>
+                                               <property name="snap_to_ticks">True</property>
+                                               <signal name="value_changed" handler="setting_widget_changed_cb"/>
+                                         </object>
+                                         <packing>
+                                               <property name="expand">False</property>
+                                               <property name="position">1</property>
+                                         </packing>
+                                       </child>
+                                       <child>
+                                         <object class="GtkLabel" id="label75">
+                                               <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">Max Height:</property>
+                                               <property name="xalign">1</property>
+                                         </object>
+                                         <packing>
+                                               <property name="expand">False</property>
+                                               <property name="position">2</property>
+                                         </packing>
+                                       </child>
+                                       <child>
+                                         <object class="GtkSpinButton" id="PictureHeight">
+                                               <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="tooltip-text" translatable="yes">This is the maximum height that the video will be stored at.  Whenever a new source is loaded, this value will be applied if the source height is greater. Setting this to 0 means there is no maximum height.</property>
+                                               <property name="adjustment">adjustment33</property>
+                                               <signal name="value_changed" handler="setting_widget_changed_cb"/>
+                                         </object>
+                                         <packing>
+                                               <property name="expand">False</property>
+                                               <property name="position">3</property>
+                                         </packing>
+                                       </child>
+                                 </object>
+                                 <packing>
+                                       <property name="expand">False</property>
+                                       <property name="position">1</property>
+                                 </packing>
+                               </child>
+                         </object>
+                         <packing>
+                               <property name="position">1</property>
+                         </packing>
+                       </child>
             <child>
               <object class="GtkFrame" id="frame14">
                 <property name="visible">True</property>
@@ -4738,8 +4845,8 @@ no-fast-pskip=0:no-dct-decimate=0:cabac=1</property>
                 </child>
               </object>
               <packing>
-                <property name="padding">2</property>
-                <property name="position">1</property>
+                <property name="padding">10</property>
+                <property name="position">2</property>
               </packing>
             </child>
           </object>
index 81742f2..1dee596 100644 (file)
@@ -3600,12 +3600,6 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
        if (ud->scale_busy) return;
        ud->scale_busy = TRUE;
 
-       if (!ud->dont_clear_presets && (keep_width || keep_height))
-       {
-               ghb_settings_set_int(ud->settings, "PictureWidth", 0);
-               ghb_settings_set_int(ud->settings, "PictureHeight", 0);
-       }
-
        // First configure widgets
        mod = ghb_settings_combo_int(ud->settings, "PictureModulus");
        pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
@@ -3708,10 +3702,13 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
        {
                width = ghb_settings_get_int(ud->settings, "scale_width");
                height = ghb_settings_get_int(ud->settings, "scale_height");
-               max_width = MOD_DOWN(
-                       ghb_settings_get_int(ud->settings, "PictureWidth"), mod);
-               max_height = MOD_DOWN(
-                       ghb_settings_get_int(ud->settings, "PictureHeight"), mod);
+               if (mode & GHB_PIC_USE_MAX)
+               {
+                       max_width = MOD_DOWN(
+                               ghb_settings_get_int(ud->settings, "PictureWidth"), mod);
+                       max_height = MOD_DOWN(
+                               ghb_settings_get_int(ud->settings, "PictureHeight"), mod);
+               }
        }
        g_debug("max_width %d, max_height %d\n", max_width, max_height);
 
index 8395b79..10f9e97 100644 (file)
@@ -59,6 +59,7 @@ typedef struct
 #define GHB_PIC_KEEP_DISPLAY_HEIGHT 0x08
 #define GHB_PIC_KEEP_DAR            0x10
 #define GHB_PIC_KEEP_PAR            0x20
+#define GHB_PIC_USE_MAX             0x40
 
 typedef struct
 {
index dbc4923..594b22f 100644 (file)
@@ -40,6 +40,7 @@ dep_map = (
        DepEntry("PictureDenoise", "PictureDenoiseCustom", "custom", False, True),
        DepEntry("PictureDecomb", "PictureDecombCustom", "custom", False, True),
        DepEntry("PictureDetelecine", "PictureDetelecineCustom", "custom", False, True),
+       DepEntry("autoscale", "PicturePresetBox", "FALSE", False, True),
        DepEntry("PictureAutoCrop", "PictureTopCrop", "FALSE", False, False),
        DepEntry("PictureAutoCrop", "PictureBottomCrop", "FALSE", False, False),
        DepEntry("PictureAutoCrop", "PictureLeftCrop", "FALSE", False, False),
index 1cb2b41..40329de 100644 (file)
@@ -3062,7 +3062,6 @@ settings_save(signal_user_data_t *ud, const GValue *path)
        GHashTableIter iter;
        gchar *key;
        GValue *value;
-       gboolean autoscale;
        gint *indices, len, count;
        gint *def_indices, def_len;
        const gchar *name;
@@ -3105,7 +3104,6 @@ settings_save(signal_user_data_t *ud, const GValue *path)
                }
        }
        current_preset = dict;
-       autoscale = ghb_settings_get_boolean(ud->settings, "autoscale");
        ghb_settings_set_int64(ud->settings, "Type", PRESETS_CUSTOM);
        ghb_settings_set_int64(ud->settings, "PresetBuildNumber", hb_get_build(NULL));
 
@@ -3117,21 +3115,8 @@ settings_save(signal_user_data_t *ud, const GValue *path)
                        &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&value))
        {
                const GValue *gval;
-               gchar *key2;
 
-               key2 = key;
-               if (!autoscale)
-               {
-                       if (strcmp(key, "PictureWidth") == 0)
-                       {
-                               key2 = "scale_width";
-                       }
-                       else if (strcmp(key, "PictureHeight") == 0)
-                       {
-                               key2 = "scale_height";
-                       }
-               }
-               gval = ghb_settings_get_value(ud->settings, key2);
+               gval = ghb_settings_get_value(ud->settings, key);
                if (gval == NULL)
                {
                        continue;
@@ -4136,7 +4121,7 @@ ghb_refresh_preset(signal_user_data_t *ud)
                                preset_update_title_deps(ud, &tinfo);
                        }
                        ud->scale_busy = FALSE;
-                       ghb_set_scale (ud, GHB_PIC_KEEP_PAR);
+                       ghb_set_scale (ud, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
                        ud->dont_clear_presets = FALSE;
 
                        gdouble vqmin, vqmax, step, page;
@@ -4216,7 +4201,7 @@ presets_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_
                                preset_update_title_deps(ud, &tinfo);
                        }
                        ud->scale_busy = FALSE;
-                       ghb_set_scale (ud, GHB_PIC_KEEP_PAR);
+                       ghb_set_scale (ud, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
                        ud->dont_clear_presets = FALSE;
 
                        gdouble vqmin, vqmax, step, page;