Bug 763734 - better decimal places for physical units.
Compute the ideal decimal precision for cursor position and length status so that you get the best precision on physical units depending on the current resolution, yet avoiding over-precision (which can be misleading). The unit's "digits" value is now used as a minimum precision only.
This commit is contained in:
parent
5da89f0daf
commit
f836892314
1 changed files with 21 additions and 4 deletions
|
|
@ -1345,16 +1345,33 @@ gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
|
|||
}
|
||||
else /* show real world units */
|
||||
{
|
||||
gint w_digits = 0;
|
||||
gint h_digits = 0;
|
||||
gint length_digits;
|
||||
|
||||
if (image)
|
||||
{
|
||||
w_digits = ceil (log10 (image_width /
|
||||
gimp_pixels_to_units (image_width,
|
||||
shell->unit,
|
||||
image_xres)));
|
||||
h_digits = ceil (log10 (image_width /
|
||||
gimp_pixels_to_units (image_height,
|
||||
shell->unit,
|
||||
image_yres)));
|
||||
}
|
||||
w_digits = MAX (w_digits, gimp_unit_get_digits (shell->unit));
|
||||
h_digits = MAX (h_digits, gimp_unit_get_digits (shell->unit));
|
||||
length_digits = MAX (w_digits, h_digits);
|
||||
|
||||
g_snprintf (statusbar->cursor_format_str,
|
||||
sizeof (statusbar->cursor_format_str),
|
||||
"%%s%%.%df%%s%%.%df%%s",
|
||||
gimp_unit_get_digits (shell->unit),
|
||||
gimp_unit_get_digits (shell->unit));
|
||||
w_digits, h_digits);
|
||||
strcpy (statusbar->cursor_format_str_f, statusbar->cursor_format_str);
|
||||
g_snprintf (statusbar->length_format_str,
|
||||
sizeof (statusbar->length_format_str),
|
||||
"%%s%%.%df%%s",
|
||||
gimp_unit_get_digits (shell->unit));
|
||||
"%%s%%.%df%%s", length_digits);
|
||||
}
|
||||
|
||||
gimp_statusbar_update_cursor (statusbar, GIMP_CURSOR_PRECISION_SUBPIXEL,
|
||||
|
|
|
|||
Loading…
Reference in a new issue