[gimp] app: more gimp_unit_get_scaled_digits() usage.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: more gimp_unit_get_scaled_digits() usage.
- Date: Mon, 23 Jan 2017 23:28:59 +0000 (UTC)
commit f44fb1ece4648bea50ed8723b0769524af33a47a
Author: Jehan <jehan girinstud io>
Date: Tue Jan 24 00:22:42 2017 +0100
app: more gimp_unit_get_scaled_digits() usage.
The print size displayed in image property and title format should use
gimp_unit_get_scaled_digits() instead of gimp_unit_get_digits() and
adding 1, which is quite random or magic number-y.
app/display/gimpdisplayshell-title.c | 8 ++++----
app/widgets/gimpimagepropview.c | 6 ++----
2 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-title.c b/app/display/gimpdisplayshell-title.c
index 0191e9e..c528ba9 100644
--- a/app/display/gimpdisplayshell-title.c
+++ b/app/display/gimpdisplayshell-title.c
@@ -360,7 +360,7 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
gimp_image_get_resolution (image, &xres, &yres);
g_snprintf (unit_format, sizeof (unit_format), "%%.%df",
- gimp_unit_get_digits (shell->unit) + 1);
+ gimp_unit_get_scaled_digits (shell->unit, xres));
i += print (title, title_len, i, unit_format,
gimp_pixels_to_units (gimp_image_get_width (image),
shell->unit, xres));
@@ -383,7 +383,7 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
gimp_image_get_resolution (image, &xres, &yres);
g_snprintf (unit_format, sizeof (unit_format), "%%.%df",
- gimp_unit_get_digits (shell->unit) + 1);
+ gimp_unit_get_scaled_digits (shell->unit, yres));
i += print (title, title_len, i, unit_format,
gimp_pixels_to_units (gimp_image_get_height (image),
shell->unit, yres));
@@ -416,7 +416,7 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
gimp_image_get_resolution (image, &xres, &yres);
g_snprintf (unit_format, sizeof (unit_format), "%%.%df",
- gimp_unit_get_digits (shell->unit) + 1);
+ gimp_unit_get_scaled_digits (shell->unit, xres));
i += print (title, title_len, i, unit_format,
gimp_pixels_to_units (gimp_item_get_width
(GIMP_ITEM (drawable)),
@@ -441,7 +441,7 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
gimp_image_get_resolution (image, &xres, &yres);
g_snprintf (unit_format, sizeof (unit_format), "%%.%df",
- gimp_unit_get_digits (shell->unit) + 1);
+ gimp_unit_get_scaled_digits (shell->unit, yres));
i += print (title, title_len, i, unit_format,
gimp_pixels_to_units (gimp_item_get_height
(GIMP_ITEM (drawable)),
diff --git a/app/widgets/gimpimagepropview.c b/app/widgets/gimpimagepropview.c
index 9b28e76..08fc72f 100644
--- a/app/widgets/gimpimagepropview.c
+++ b/app/widgets/gimpimagepropview.c
@@ -417,7 +417,6 @@ gimp_image_prop_view_update (GimpImagePropView *view)
GimpPrecision precision;
GimpUnit unit;
gdouble unit_factor;
- gint unit_digits;
const gchar *desc;
gchar format_buf[32];
gchar buf[256];
@@ -437,10 +436,9 @@ gimp_image_prop_view_update (GimpImagePropView *view)
/* print size */
unit = gimp_get_default_unit ();
- unit_digits = gimp_unit_get_digits (unit);
-
g_snprintf (format_buf, sizeof (format_buf), "%%.%df × %%.%df %s",
- unit_digits + 1, unit_digits + 1,
+ gimp_unit_get_scaled_digits (unit, xres),
+ gimp_unit_get_scaled_digits (unit, yres),
gimp_unit_get_plural (unit));
g_snprintf (buf, sizeof (buf), format_buf,
gimp_pixels_to_units (gimp_image_get_width (image), unit, xres),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]