diff options
author | jstebbins <[email protected]> | 2009-06-16 19:21:33 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-06-16 19:21:33 +0000 |
commit | f72bd4b23937ab7b3de50dd763c20ee6f7cfebe4 (patch) | |
tree | 2be9acc05ceb859e46cfce707fd6e614497b4ecf | |
parent | e75fe00dfa9c1c750b14e670f7f7b106feacd6a3 (diff) |
LinGui: add controls to all setting an explicit par in ana mode 3
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2544 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | gtk/src/callbacks.c | 34 | ||||
-rw-r--r-- | gtk/src/ghb.ui | 115 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 31 | ||||
-rw-r--r-- | gtk/src/presets.c | 19 |
4 files changed, 104 insertions, 95 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 13599df20..aa5635fc2 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -1548,18 +1548,6 @@ display_width_changed_cb(GtkWidget *widget, signal_user_data_t *ud) if (GTK_WIDGET_SENSITIVE(widget)) ghb_set_scale (ud, GHB_PIC_KEEP_DISPLAY_WIDTH); - gint pic_par; - - pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR"); - if (pic_par == 3) - { - gint par_width, par_height; - - par_width = ghb_settings_get_int(ud->settings, "par_width"); - par_height = ghb_settings_get_int(ud->settings, "par_height"); - ghb_settings_set_int(ud->settings, "PicturePARWidth", par_width); - ghb_settings_set_int(ud->settings, "PicturePARHeight", par_height); - } update_preview = TRUE; } @@ -1574,18 +1562,20 @@ display_height_changed_cb(GtkWidget *widget, signal_user_data_t *ud) if (GTK_WIDGET_SENSITIVE(widget)) ghb_set_scale (ud, GHB_PIC_KEEP_DISPLAY_HEIGHT); - gint pic_par; + update_preview = TRUE; +} - pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR"); - if (pic_par == 3) - { - gint par_width, par_height; +G_MODULE_EXPORT void +par_changed_cb(GtkWidget *widget, signal_user_data_t *ud) +{ + g_debug("par_changed_cb ()"); + ghb_widget_to_setting(ud->settings, widget); + ghb_check_dependency(ud, widget); + ghb_clear_presets_selection(ud); + ghb_live_reset(ud); + if (GTK_WIDGET_SENSITIVE(widget)) + ghb_set_scale (ud, GHB_PIC_KEEP_PAR); - par_width = ghb_settings_get_int(ud->settings, "par_width"); - par_height = ghb_settings_get_int(ud->settings, "par_height"); - ghb_settings_set_int(ud->settings, "PicturePARWidth", par_width); - ghb_settings_set_int(ud->settings, "PicturePARHeight", par_height); - } update_preview = TRUE; } diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index b29717ef1..233d583fd 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -225,6 +225,22 @@ <property name="page_size">0</property> <property name="value">0.0</property> </object> + <object class="GtkAdjustment" id="adjustment29"> + <property name="upper">2000</property> + <property name="lower">0</property> + <property name="page_increment">16</property> + <property name="step_increment">1</property> + <property name="page_size">0</property> + <property name="value">0</property> + </object> + <object class="GtkAdjustment" id="adjustment30"> + <property name="upper">1200</property> + <property name="lower">0</property> + <property name="page_increment">16</property> + <property name="step_increment">1</property> + <property name="page_size">0</property> + <property name="value">0</property> + </object> <object class="GtkAdjustment" id="preview_progress_adj"> <property name="upper">100</property> <property name="lower">0</property> @@ -4793,33 +4809,15 @@ the required multiple.</property> </packing> </child> <child> - <object class="GtkCheckButton" id="PictureKeepRatio"> - <property name="label" translatable="yes">Keep Aspect</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="scale_changed_cb"/> - </object> - <packing> - <property name="expand">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox53"> + <object class="GtkHBox" id="hbox79"> <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="label93"> - <property name="width_request">100</property> - <property name="xalign">0</property> + <object class="GtkLabel" id="label98"> <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">Display Aspect:</property> + <property name="label" translatable="yes">Pixel Aspect:</property> </object> <packing> <property name="expand">False</property> @@ -4827,71 +4825,92 @@ the required multiple.</property> </packing> </child> <child> - <object class="GtkLabel" id="display_aspect"> + <object class="GtkSpinButton" id="PicturePARWidth"> <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="label" translatable="yes">--:--</property> + <property name="adjustment">adjustment29</property> + <property name="snap_to_ticks">True</property> + <signal name="value_changed" handler="par_changed_cb"/> </object> <packing> <property name="expand">False</property> <property name="position">1</property> </packing> </child> - </object> - <packing> - <property name="expand">False</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox76"> - <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="label94"> - <property name="width_request">100</property> - <property name="xalign">0</property> + <object class="GtkLabel" id="label99"> <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">Pixel Aspect:</property> + <property name="label" translatable="yes">:</property> </object> <packing> <property name="expand">False</property> - <property name="position">0</property> + <property name="position">2</property> </packing> </child> <child> - <object class="GtkLabel" id="par_width"> + <object class="GtkSpinButton" id="PicturePARHeight"> <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="label" translatable="yes">--</property> + <property name="adjustment">adjustment30</property> + <signal name="value_changed" handler="par_changed_cb"/> </object> <packing> <property name="expand">False</property> - <property name="position">1</property> + <property name="position">3</property> </packing> </child> + </object> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="PictureKeepRatio"> + <property name="label" translatable="yes">Keep Aspect</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="scale_changed_cb"/> + </object> + <packing> + <property name="expand">False</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox53"> + <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="pixel_aspect"> + <object class="GtkLabel" id="label93"> + <property name="width_request">100</property> + <property name="xalign">0</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">:</property> + <property name="label" translatable="yes">Display Aspect:</property> </object> <packing> <property name="expand">False</property> - <property name="position">2</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkLabel" id="par_height"> + <object class="GtkLabel" id="display_aspect"> <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">--</property> + <property name="label" translatable="yes">--:--</property> </object> <packing> <property name="expand">False</property> - <property name="position">3</property> + <property name="position">1</property> </packing> </child> </object> diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 13b0ad6e8..7e05e639f 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -2765,7 +2765,7 @@ picture_settings_deps(signal_user_data_t *ud) { gboolean autoscale, keep_aspect, enable_keep_aspect; gboolean enable_scale_width, enable_scale_height; - gboolean enable_disp_width, enable_disp_height; + gboolean enable_disp_width, enable_disp_height, enable_par; gint pic_par; GtkWidget *widget; @@ -2787,6 +2787,7 @@ picture_settings_deps(signal_user_data_t *ud) enable_scale_width = !autoscale && (pic_par != 1); enable_scale_height = !autoscale && (pic_par != 1); enable_disp_width = (pic_par == 3) && !keep_aspect; + enable_par = (pic_par == 3) && !keep_aspect; enable_disp_height = FALSE; widget = GHB_WIDGET(ud->builder, "PictureModulus"); @@ -2801,6 +2802,10 @@ picture_settings_deps(signal_user_data_t *ud) gtk_widget_set_sensitive(widget, enable_disp_width); widget = GHB_WIDGET(ud->builder, "PictureDisplayHeight"); gtk_widget_set_sensitive(widget, enable_disp_height); + widget = GHB_WIDGET(ud->builder, "PicturePARWidth"); + gtk_widget_set_sensitive(widget, enable_par); + widget = GHB_WIDGET(ud->builder, "PicturePARHeight"); + gtk_widget_set_sensitive(widget, enable_par); widget = GHB_WIDGET(ud->builder, "PictureKeepRatio"); gtk_widget_set_sensitive(widget, enable_keep_aspect); widget = GHB_WIDGET(ud->builder, "autoscale"); @@ -2993,12 +2998,11 @@ ghb_set_scale(signal_user_data_t *ud, gint mode) gint dar_width, dar_height; if (mode & GHB_PIC_KEEP_PAR) { - par_width = ghb_settings_get_int(ud->settings, + dar_width = dar_height = 0; + job->anamorphic.par_width = ghb_settings_get_int(ud->settings, "PicturePARWidth"); - par_height = ghb_settings_get_int(ud->settings, + job->anamorphic.par_height = ghb_settings_get_int(ud->settings, "PicturePARHeight"); - dar_width = ((gdouble)width * par_width / par_height) + 0.5; - dar_height = height; } else { @@ -3013,12 +3017,25 @@ ghb_set_scale(signal_user_data_t *ud, gint mode) } else { + job->anamorphic.par_width = title->pixel_aspect_width; + job->anamorphic.par_height = title->pixel_aspect_height; job->anamorphic.dar_width = 0; job->anamorphic.dar_height = 0; job->anamorphic.keep_display_aspect = 1; } hb_set_anamorphic_size( job, &width, &height, &par_width, &par_height ); + if (job->anamorphic.mode == 3 && !keep_aspect && + mode & GHB_PIC_KEEP_PAR) + { + // hb_set_anamorphic_size reduces the par, which we + // don't want in this case because the user is + // explicitely specifying it. + par_width = ghb_settings_get_int(ud->settings, + "PicturePARWidth"); + par_height = ghb_settings_get_int(ud->settings, + "PicturePARHeight"); + } } else { @@ -3097,8 +3114,8 @@ ghb_set_scale(signal_user_data_t *ud, gint mode) } ghb_ui_update(ud, "display_aspect", ghb_string_value(str)); g_free(str); - ghb_ui_update(ud, "par_width", ghb_int64_value(par_width)); - ghb_ui_update(ud, "par_height", ghb_int64_value(par_height)); + ghb_ui_update(ud, "PicturePARWidth", ghb_int64_value(par_width)); + ghb_ui_update(ud, "PicturePARHeight", ghb_int64_value(par_height)); ghb_ui_update(ud, "PictureDisplayWidth", ghb_int64_value(disp_width)); ghb_ui_update(ud, "PictureDisplayHeight", ghb_int64_value(height)); busy = FALSE; diff --git a/gtk/src/presets.c b/gtk/src/presets.c index 6c490de0a..b419414e6 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -2346,7 +2346,7 @@ import_xlat_preset(GValue *dict) { gboolean uses_max; gint uses_pic; - gint par, par_width, par_height; + gint par; gint vqtype; g_debug("import_xlat_preset ()"); @@ -2356,12 +2356,6 @@ import_xlat_preset(GValue *dict) preset_dict_get_value(dict, "UsesPictureSettings")); par = ghb_value_int(preset_dict_get_value(dict, "PicturePAR")); vqtype = ghb_value_int(preset_dict_get_value(dict, "VideoQualityType")); - par_width = ghb_value_int(preset_dict_get_value(dict, "PicturePARWidth")); - par_height = ghb_value_int(preset_dict_get_value(dict, "PicturePARHeight")); - ghb_dict_insert(dict, g_strdup("par_width"), - ghb_int_value_new(par_width)); - ghb_dict_insert(dict, g_strdup("par_height"), - ghb_int_value_new(par_height)); if (uses_max || uses_pic == 2) { @@ -2505,7 +2499,6 @@ static void export_xlat_preset(GValue *dict) { gboolean autoscale, target, br, constant; - gint par_width, par_height; g_debug("export_xlat_prest ()"); autoscale = ghb_value_boolean(preset_dict_get_value(dict, "autoscale")); @@ -2515,10 +2508,6 @@ export_xlat_preset(GValue *dict) preset_dict_get_value(dict, "vquality_type_bitrate")); constant = ghb_value_boolean( preset_dict_get_value(dict, "vquality_type_constant")); - par_width = ghb_value_int( - preset_dict_get_value(dict, "par_width")); - par_height = ghb_value_int( - preset_dict_get_value(dict, "par_height")); if (autoscale) ghb_dict_insert(dict, g_strdup("UsesPictureSettings"), @@ -2563,17 +2552,11 @@ export_xlat_preset(GValue *dict) } } - ghb_dict_insert(dict, g_strdup("PicturePARWidth"), - ghb_int_value_new(par_width)); - ghb_dict_insert(dict, g_strdup("PicturePARHeight"), - ghb_int_value_new(par_height)); ghb_dict_remove(dict, "UsesMaxPictureSettings"); ghb_dict_remove(dict, "autoscale"); ghb_dict_remove(dict, "vquality_type_target"); ghb_dict_remove(dict, "vquality_type_bitrate"); ghb_dict_remove(dict, "vquality_type_constant"); - ghb_dict_remove(dict, "par_width"); - ghb_dict_remove(dict, "par_height"); export_value_xlat(dict); } |