[gimp] app: fix right-click cancelling a transform tool



commit 372bc90f653bc8c5fe003bb2be644a79045d8a60
Author: Mikael Magnusson <mikachu gmail com>
Date:   Sun Nov 7 19:26:48 2010 +0100

    app: fix right-click cancelling a transform tool
    
    to only revert back to before the current drag, not do a full reset

 app/tools/gimptransformtool.c |   16 ++++++++++++----
 app/tools/gimptransformtool.h |    4 ++--
 2 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index c28eb07..a9e0ed2 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -209,8 +209,9 @@ gimp_transform_tool_init (GimpTransformTool *tr_tool)
 
   for (i = 0; i < TRANS_INFO_SIZE; i++)
     {
-      tr_tool->trans_info[i]     = 0.0;
-      tr_tool->old_trans_info[i] = 0.0;
+      tr_tool->trans_info[i]      = 0.0;
+      tr_tool->old_trans_info[i]  = 0.0;
+      tr_tool->prev_trans_info[i] = 0.0;
     }
 
   gimp_matrix3_identity (&tr_tool->transform);
@@ -347,7 +348,10 @@ gimp_transform_tool_initialize (GimpTool     *tool,
 
       /*  Save the current transformation info  */
       for (i = 0; i < TRANS_INFO_SIZE; i++)
-        tr_tool->old_trans_info[i] = tr_tool->trans_info[i];
+        {
+          tr_tool->old_trans_info[i]  = tr_tool->trans_info[i];
+          tr_tool->prev_trans_info[i] = tr_tool->trans_info[i];
+        }
     }
 
   return TRUE;
@@ -419,6 +423,10 @@ gimp_transform_tool_button_release (GimpTool              *tool,
         {
           gimp_transform_tool_response (NULL, GTK_RESPONSE_OK, tr_tool);
         }
+
+      /*  Restore the previous transformation info  */
+      for (i = 0; i < TRANS_INFO_SIZE; i++)
+        tr_tool->prev_trans_info[i] = tr_tool->trans_info[i];
     }
   else
     {
@@ -426,7 +434,7 @@ gimp_transform_tool_button_release (GimpTool              *tool,
 
       /*  Restore the previous transformation info  */
       for (i = 0; i < TRANS_INFO_SIZE; i++)
-        tr_tool->trans_info[i] = tr_tool->old_trans_info[i];
+        tr_tool->trans_info[i] = tr_tool->prev_trans_info[i];
 
       /*  reget the selection bounds  */
       gimp_transform_tool_bounds (tr_tool, display);
diff --git a/app/tools/gimptransformtool.h b/app/tools/gimptransformtool.h
index 40ca193..06e875b 100644
--- a/app/tools/gimptransformtool.h
+++ b/app/tools/gimptransformtool.h
@@ -69,8 +69,8 @@ struct _GimpTransformTool
 
   GimpMatrix3     transform;       /*  transformation matrix             */
   TransInfo       trans_info;      /*  transformation info               */
-
-  TransInfo       old_trans_info;  /*  for cancelling a drag operation   */
+  TransInfo       old_trans_info;  /*  for resetting everything          */
+  TransInfo       prev_trans_info; /*  for cancelling a drag operation   */
 
   TileManager    *original;        /*  pointer to original tiles         */
 



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