[gimp] plug-ins: use an epsilon to compare double values.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: use an epsilon to compare double values.
- Date: Tue, 20 Dec 2016 15:22:57 +0000 (UTC)
commit 0cdca57d126f2714d761e3e3dcd663722e6fda47
Author: Jehan <jehan girinstud io>
Date: Tue Dec 20 04:07:45 2016 +0100
plug-ins: use an epsilon to compare double values.
Also take into account the case when the minimum possible print
resolution is higher than the expected image resolution. We don't want
to remember the print resolution if it is this lower value either.
See commit 7335dc8.
plug-ins/print/print-page-layout.c | 2 ++
plug-ins/print/print-settings.c | 9 ++++++++-
plug-ins/print/print.h | 2 ++
3 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/print/print-page-layout.c b/plug-ins/print/print-page-layout.c
index 48f0a64..3af04bc 100644
--- a/plug-ins/print/print-page-layout.c
+++ b/plug-ins/print/print-page-layout.c
@@ -918,6 +918,8 @@ print_size_info_set_page_setup (PrintSizeInfo *info)
x = y = max;
}
+ data->min_xres = x;
+ data->min_yres = y;
gimp_size_entry_set_refval_boundaries (info->resolution_entry, 0,
x, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval_boundaries (info->resolution_entry, 1,
diff --git a/plug-ins/print/print-settings.c b/plug-ins/print/print-settings.c
index 5fe9c00..9bb9c33 100644
--- a/plug-ins/print/print-settings.c
+++ b/plug-ins/print/print-settings.c
@@ -88,7 +88,14 @@ print_settings_save (PrintData *data)
g_key_file_set_integer (key_file, "image-setup",
"unit", data->unit);
- if (xres != data->xres || yres != data->yres)
+ /* Do not save the print resolution when it is the expected image
+ * resolution so that changing it (i.e. in "print size" dialog)
+ * is not overrided by any previous prints.
+ */
+ if ((data->min_xres <= xres && ABS (xres - data->xres) > 0.1) ||
+ (data->min_yres <= yres && ABS (yres - data->yres) > 0.1) ||
+ (data->min_xres > xres && ABS (data->min_xres - data->xres) > 0.1) ||
+ (data->min_yres > yres && ABS (data->min_yres - data->yres) > 0.1))
{
g_key_file_set_double (key_file, "image-setup",
"x-resolution", data->xres);
diff --git a/plug-ins/print/print.h b/plug-ins/print/print.h
index 3236a5b..f665f94 100644
--- a/plug-ins/print/print.h
+++ b/plug-ins/print/print.h
@@ -44,6 +44,8 @@ typedef struct
GimpUnit unit;
gdouble xres;
gdouble yres;
+ gdouble min_xres;
+ gdouble min_yres;
GimpUnit image_unit;
gdouble offset_x;
gdouble offset_y;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]