summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/callbacks.c16
-rw-r--r--gtk/src/ghb.ui2
-rw-r--r--gtk/src/hb-backend.c9
3 files changed, 22 insertions, 5 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 9e449e34f..df76073a4 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -1563,7 +1563,7 @@ display_width_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
update_preview = TRUE;
}
-void
+G_MODULE_EXPORT void
display_height_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("display_height_changed_cb ()");
@@ -1589,7 +1589,7 @@ display_height_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
update_preview = TRUE;
}
-void
+G_MODULE_EXPORT void
scale_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("scale_changed_cb ()");
@@ -1632,6 +1632,18 @@ scale_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
}
G_MODULE_EXPORT void
+show_crop_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
+{
+ g_debug("show_crop_changed_cb ()");
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget);
+ ghb_live_reset(ud);
+ if (GTK_WIDGET_SENSITIVE(widget))
+ ghb_set_scale (ud, 0);
+ update_preview = TRUE;
+}
+
+G_MODULE_EXPORT void
generic_entry_changed_cb(GtkEntry *entry, signal_user_data_t *ud)
{
// Normally (due to user input) I only want to process the entry
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index e182d0a0a..109f0ac68 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -5385,7 +5385,7 @@ the required multiple.</property>
<property name="can_focus">True</property>
<property name="tooltip-text" translatable="yes">Show Cropped area of the preview</property>
<property name="label" translatable="yes">Show Crop</property>
- <signal name="toggled" handler="scale_changed_cb"/>
+ <signal name="toggled" handler="show_crop_changed_cb"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 7746af2cd..4b2e607c2 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -3116,12 +3116,17 @@ set_preview_job_settings(hb_job_t *job, GValue *settings)
job->height = ghb_settings_get_int(settings, "scale_height");
if (ghb_settings_get_boolean(settings, "show_crop"))
{
+ gdouble xscale = (gdouble)job->width /
+ (gdouble)(job->title->width - job->crop[2] - job->crop[3]);
+ gdouble yscale = (gdouble)job->height /
+ (gdouble)(job->title->height - job->crop[0] - job->crop[1]);
+
+ job->width += xscale * (job->crop[2] + job->crop[3]);
+ job->height += yscale * (job->crop[0] + job->crop[1]);
job->crop[0] = 0;
job->crop[1] = 0;
job->crop[2] = 0;
job->crop[3] = 0;
- job->width = job->title->width;
- job->height = job->title->height;
job->anamorphic.modulus = 2;
}