summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <jstebbins.hb@gmail.com>2009-04-14 22:56:37 +0000
committerjstebbins <jstebbins.hb@gmail.com>2009-04-14 22:56:37 +0000
commit52e7add532d5dc983b328917924459d2ea3873a9 (patch)
tree8b3e1e9cceb2b726b6484cca7062479a1bb70cab /gtk
parenta1365b1285c50c34e58172289330c089125c6f93 (diff)
LinGui: fix some bugs in the new anamorphic settings
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2329 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/callbacks.c38
-rw-r--r--gtk/src/ghb.ui5
-rw-r--r--gtk/src/hb-backend.c68
-rw-r--r--gtk/src/preview.c5
4 files changed, 48 insertions, 68 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 61b6bf89a..e003ffc1c 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -1256,7 +1256,8 @@ scale_width_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
g_debug("scale_width_changed_cb ()");
ghb_widget_to_setting(ud->settings, widget);
ghb_check_dependency(ud, widget);
- ghb_set_scale (ud, GHB_SCALE_KEEP_WIDTH);
+ if (GTK_WIDGET_SENSITIVE(widget))
+ ghb_set_scale (ud, GHB_SCALE_KEEP_WIDTH);
update_preview = TRUE;
gchar *text;
gint width = ghb_settings_get_int(ud->settings, "scale_width");
@@ -1274,7 +1275,8 @@ scale_height_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
g_debug("scale_height_changed_cb ()");
ghb_widget_to_setting(ud->settings, widget);
ghb_check_dependency(ud, widget);
- ghb_set_scale (ud, GHB_SCALE_KEEP_HEIGHT);
+ if (GTK_WIDGET_SENSITIVE(widget))
+ ghb_set_scale (ud, GHB_SCALE_KEEP_HEIGHT);
update_preview = TRUE;
gchar *text;
gint width = ghb_settings_get_int(ud->settings, "scale_width");
@@ -1295,7 +1297,8 @@ crop_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
g_debug("crop_changed_cb ()");
ghb_widget_to_setting(ud->settings, widget);
ghb_check_dependency(ud, widget);
- ghb_set_scale (ud, GHB_SCALE_KEEP_NONE);
+ if (GTK_WIDGET_SENSITIVE(widget))
+ ghb_set_scale (ud, GHB_SCALE_KEEP_NONE);
crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
@@ -1324,6 +1327,32 @@ crop_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
}
void
+display_width_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
+{
+ g_debug("scale_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_SCALE_KEEP_NONE);
+ update_preview = TRUE;
+}
+
+void
+display_height_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
+{
+ g_debug("scale_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_SCALE_KEEP_NONE);
+ update_preview = TRUE;
+}
+
+void
scale_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("scale_changed_cb ()");
@@ -1331,7 +1360,8 @@ scale_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_check_dependency(ud, widget);
ghb_clear_presets_selection(ud);
ghb_live_reset(ud);
- ghb_set_scale (ud, GHB_SCALE_KEEP_NONE);
+ if (GTK_WIDGET_SENSITIVE(widget))
+ ghb_set_scale (ud, GHB_SCALE_KEEP_NONE);
update_preview = TRUE;
gchar *text;
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index e4cc7bec4..d2620f3c0 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -4102,7 +4102,6 @@ location as the movie.</property>
</child>
</object>
<object class="GtkWindow" id="settings_window">
- <property name="opacity">.85</property>
<property name="title" translatable="yes">Picture Settings</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
@@ -4596,7 +4595,7 @@ location as the movie.</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">adjustment25</property>
<property name="snap_to_ticks">True</property>
- <signal name="value_changed" handler="scale_changed_cb"/>
+ <signal name="value_changed" handler="display_width_changed_cb"/>
</object>
<packing>
<property name="expand">False</property>
@@ -4620,7 +4619,7 @@ location as the movie.</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">adjustment26</property>
- <signal name="value_changed" handler="scale_changed_cb"/>
+ <signal name="value_changed" handler="display_height_changed_cb"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 5a1bc135b..21635a24a 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -78,7 +78,6 @@ combo_opts_t par_opts =
static options_map_t d_alignment_opts[] =
{
- {"1", "1", 1, "1"},
{"2", "2", 2, "2"},
{"4", "4", 4, "4"},
{"8", "8", 8, "8"},
@@ -2592,12 +2591,9 @@ picture_settings_deps(signal_user_data_t *ud)
scale_height = ghb_settings_get_int(ud->settings, "scale_height");
enable_scale_width = !autoscale && (pic_par != 1);
- enable_scale_height = !autoscale &&
- ((pic_par == 0 && !keep_aspect) || (pic_par == 3));
- enable_disp_width = (pic_par == 3) && !keep_aspect &&
- (disp_height == scale_height);
- enable_disp_height = (pic_par == 3) && !keep_aspect &&
- (disp_width == scale_width);
+ enable_scale_height = !autoscale && (pic_par != 1);
+ enable_disp_width = (pic_par == 3) && !keep_aspect;
+ enable_disp_height = FALSE;
GtkWidget *widget;
widget = GHB_WIDGET(ud->builder, "scale_width");
@@ -2664,38 +2660,12 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
keep_width = FALSE;
keep_height = FALSE;
}
- if (keep_aspect)
- {
- keep_height = FALSE;
- }
// Step needs to be at least 2 because odd widths cause scaler crash
step = mod;
widget = GHB_WIDGET (ud->builder, "scale_width");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, mod);
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 16);
widget = GHB_WIDGET (ud->builder, "scale_height");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, mod);
- if (mod == 1)
- {
- widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 2);
- widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 2);
- widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 2);
- widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 2);
- }
- else
- {
- widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 1);
- widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 1);
- widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 1);
- widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 1);
- }
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 16);
ghb_title_info_t tinfo;
if (autocrop && ghb_get_title_info (&tinfo, titleindex))
{
@@ -2801,6 +2771,8 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
// The scaler crashes if the dimensions are not divisible by 2
// Align mod 2. And so does something in x264_encoder_headers()
job->anamorphic.modulus = mod;
+ if (keep_height && pic_par == 2)
+ width = ((double)height * crop_width / crop_height) + 0.5;
job->width = width;
job->height = height;
if (max_width)
@@ -2814,15 +2786,6 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
gint dar_width, dar_height;
dar_width = ghb_settings_get_int(ud->settings, "PictureDisplayWidth");
dar_height = ghb_settings_get_int(ud->settings, "PictureDisplayHeight");
- if (dar_width > width)
- dar_height = height;
- else if (dar_height > height)
- dar_width = width;
- else
- {
- dar_width = width;
- dar_height = height;
- }
job->anamorphic.dar_width = dar_width;
job->anamorphic.dar_height = dar_height;
}
@@ -2888,20 +2851,11 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
ghb_ui_update(ud, "scale_width", ghb_int64_value(width));
ghb_ui_update(ud, "scale_height", ghb_int64_value(height));
- gint disp_width, disp_height, dar_width, dar_height;
+ gint disp_width, dar_width, dar_height;
gchar *str;
- disp_width = width;
- disp_height = height;
- if (par_width >= par_height)
- {
- disp_width = par_width * width / par_height;
- }
- else
- {
- disp_height = par_height * height / par_width;
- }
- hb_reduce(&dar_width, &dar_height, disp_width, disp_height);
+ disp_width = par_width * width / par_height;
+ hb_reduce(&dar_width, &dar_height, disp_width, height);
if (dar_width > 2 * dar_height)
{
@@ -2917,7 +2871,7 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
ghb_ui_update(ud, "pixel_aspect", ghb_string_value(str));
g_free(str);
ghb_ui_update(ud, "PictureDisplayWidth", ghb_int64_value(disp_width));
- ghb_ui_update(ud, "PictureDisplayHeight", ghb_int64_value(disp_height));
+ ghb_ui_update(ud, "PictureDisplayHeight", ghb_int64_value(height));
picture_settings_deps(ud);
}
diff --git a/gtk/src/preview.c b/gtk/src/preview.c
index cbb7184d6..6164270de 100644
--- a/gtk/src/preview.c
+++ b/gtk/src/preview.c
@@ -105,10 +105,7 @@ ghb_par_scale(signal_user_data_t *ud, gint *width, gint *height, gint par_n, gin
num = par_n * disp_par_d;
den = par_d * disp_par_n;
- if (num > den)
- *width = *width * num / den;
- else
- *height = *height * den / num;
+ *width = *width * num / den;
}
void