[gimp/gimp-2-10] app: improve measure-tool undo description



commit 054d441a8dceeb20fed44e5e197c4f9af9752488
Author: Ell <ell_se yahoo com>
Date:   Mon Feb 4 09:43:54 2019 -0500

    app: improve measure-tool undo description
    
    When straightening an item using the measure-tool, include the
    orientation and angle in the undo description.
    
    (cherry picked from commit b95bf3fb9339522b204b13449f7301ee5a51cce9)

 app/tools/gimpmeasuretool.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
---
diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c
index 2d72384fe7..66f1eca396 100644
--- a/app/tools/gimpmeasuretool.c
+++ b/app/tools/gimpmeasuretool.c
@@ -346,7 +346,36 @@ gimp_measure_tool_recalc_matrix (GimpTransformTool *tr_tool)
 static gchar *
 gimp_measure_tool_get_undo_desc (GimpTransformTool *tr_tool)
 {
-  return g_strdup (_("Straighten"));
+  GimpMeasureTool        *measure = GIMP_MEASURE_TOOL (tr_tool);
+  GimpCompassOrientation  orientation;
+  gdouble                 angle;
+
+  g_object_get (measure->widget,
+                "effective-orientation", &orientation,
+                "pixel-angle",           &angle,
+                NULL);
+
+  angle = gimp_rad_to_deg (fabs (angle));
+
+  switch (orientation)
+    {
+    case GIMP_COMPASS_ORIENTATION_AUTO:
+      return g_strdup_printf (C_("undo-type",
+                                 "Straighten by %-3.3g°"),
+                              angle);
+
+    case GIMP_COMPASS_ORIENTATION_HORIZONTAL:
+      return g_strdup_printf (C_("undo-type",
+                                 "Straighten Horizontally by %-3.3g°"),
+                              angle);
+
+    case GIMP_COMPASS_ORIENTATION_VERTICAL:
+      return g_strdup_printf (C_("undo-type",
+                                 "Straighten Vertically by %-3.3g°"),
+                              angle);
+    }
+
+  g_return_val_if_reached (NULL);
 }
 
 static void


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