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



commit b0ab2b65644b4b086ecd5e24c4a55b9b7a5f5df8
Author: Ell <ell_se yahoo com>
Date:   Mon Feb 4 09:52:53 2019 -0500

    app: improve rotate-tool undo description
    
    When rotating an item around its center using the rotate tool,
    i.e., if the pivot point hasn't been moved, don't include the pivot
    coordinates in the undo description.
    
    (cherry picked from commit 44c8a1f27494c6717bda6664f53e81b7b47090d5)

 app/tools/gimprotatetool.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/app/tools/gimprotatetool.c b/app/tools/gimprotatetool.c
index 3d7ac1c4b1..cdf40b388e 100644
--- a/app/tools/gimprotatetool.c
+++ b/app/tools/gimprotatetool.c
@@ -187,11 +187,21 @@ gimp_rotate_tool_get_undo_desc (GimpTransformTool *tr_tool)
 {
   GimpTransformGridTool *tg_tool = GIMP_TRANSFORM_GRID_TOOL (tr_tool);
 
-  return g_strdup_printf (C_("undo-type",
-                             "Rotate by %-3.3g° around (%g, %g)"),
-                          gimp_rad_to_deg (tg_tool->trans_info[ANGLE]),
-                          tg_tool->trans_info[PIVOT_X],
-                          tg_tool->trans_info[PIVOT_Y]);
+  if (tg_tool->trans_info[PIVOT_X] == (tr_tool->x1 + tr_tool->x2) / 2.0 &&
+      tg_tool->trans_info[PIVOT_Y] == (tr_tool->y1 + tr_tool->y2) / 2.0)
+    {
+      return g_strdup_printf (C_("undo-type",
+                                 "Rotate by %-3.3g°"),
+                              gimp_rad_to_deg (tg_tool->trans_info[ANGLE]));
+    }
+  else
+    {
+      return g_strdup_printf (C_("undo-type",
+                                 "Rotate by %-3.3g° around (%g, %g)"),
+                              gimp_rad_to_deg (tg_tool->trans_info[ANGLE]),
+                              tg_tool->trans_info[PIVOT_X],
+                              tg_tool->trans_info[PIVOT_Y]);
+    }
 }
 
 static void


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