[gimp] Bug 792981 - Measure tool is measuring one pixel to the right of initial point



commit c71535b72a5d6604a765cd7aac700afc4fafada5
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jan 28 15:03:53 2018 +0100

    Bug 792981 - Measure tool is measuring one pixel to the right of initial point
    
    This reverts 2069496af35770fc964df0567e73cac3edd8c09b for
    gimpmeasuretool.c, we can't use gimp_display_shell_get_line_status()
    here because the angle to show is *not* the angle as shown in the
    paint tools (between x1,y1 and x2,y2), it is determined by a possible
    third point.
    
    Also, the info window and the statusbar were using different
    coordintates to detemine the line length. This would have been easily
    fixable, but the wrong angle wasn't.

 app/tools/gimpmeasuretool.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c
index d9d1770..76d2240 100644
--- a/app/tools/gimpmeasuretool.c
+++ b/app/tools/gimpmeasuretool.c
@@ -40,7 +40,6 @@
 #include "display/gimpdisplay.h"
 #include "display/gimpdisplayshell.h"
 #include "display/gimpdisplayshell-appearance.h"
-#include "display/gimpdisplayshell-utils.h"
 #include "display/gimptoolcompass.h"
 #include "display/gimptoolgui.h"
 
@@ -448,7 +447,6 @@ gimp_measure_tool_dialog_update (GimpMeasureTool *measure,
 {
   GimpDisplayShell *shell = gimp_display_get_shell (display);
   GimpImage        *image = gimp_display_get_image (display);
-  gchar            *status;
   gint              ax, ay;
   gint              bx, by;
   gint              pixel_width;
@@ -523,23 +521,26 @@ gimp_measure_tool_dialog_update (GimpMeasureTool *measure,
   unit_width_digits  = gimp_unit_get_scaled_digits (shell->unit, xres);
   unit_height_digits = gimp_unit_get_scaled_digits (shell->unit, yres);
 
-  status = gimp_display_shell_get_line_status (shell, "", "",
-                                               ax, ay, bx, by);
   if (shell->unit == GIMP_UNIT_PIXEL)
     {
       gimp_tool_replace_status (GIMP_TOOL (measure), display,
-                                "%s (%d × %d)",
-                                status, pixel_width, pixel_height);
+                                "%.1f %s, %.2f\302\260 (%d × %d)",
+                                pixel_distance, _("pixels"), pixel_angle,
+                                pixel_width, pixel_height);
     }
   else
     {
-      g_snprintf (format, sizeof (format), "%s (%%.%df × %%.%df)",
-                  status, unit_width_digits, unit_height_digits);
+      g_snprintf (format, sizeof (format),
+                  "%%.%df %s, %%.2f\302\260 (%%.%df × %%.%df)",
+                  unit_distance_digits,
+                  gimp_unit_get_plural (shell->unit),
+                  unit_width_digits,
+                  unit_height_digits);
 
       gimp_tool_replace_status (GIMP_TOOL (measure), display, format,
+                                unit_distance, unit_angle,
                                 unit_width, unit_height);
     }
-  g_free (status);
 
   if (measure->gui)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]