[gimp/metadata-browser] transformtool: Add one more rotation handle, in case the point you want to pivot around is close to



commit 733b078fcf0f53018a08b8f19edf2c734e9e641f
Author: Mikael Magnusson <mikachu src gnome org>
Date:   Tue Aug 14 19:11:57 2012 +0200

    transformtool: Add one more rotation handle, in case the point you want to pivot around is close to the first one

 app/tools/gimptransformtool.h        |    1 +
 app/tools/gimpunifiedtransformtool.c |   13 +++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/app/tools/gimptransformtool.h b/app/tools/gimptransformtool.h
index adbbc0a..aeca06f 100644
--- a/app/tools/gimptransformtool.h
+++ b/app/tools/gimptransformtool.h
@@ -46,6 +46,7 @@ typedef enum
   TRANSFORM_HANDLE_E_S,
   TRANSFORM_HANDLE_W_S,
   TRANSFORM_HANDLE_ROTATION, /* rotation handle */
+  TRANSFORM_HANDLE_ROTATION2, /* extra rotation handle */
 
   TRANSFORM_HANDLE_NUM /* keep this last so *handles[] is the right size */
 } TransformAction;
diff --git a/app/tools/gimpunifiedtransformtool.c b/app/tools/gimpunifiedtransformtool.c
index cd6703c..3949430 100644
--- a/app/tools/gimpunifiedtransformtool.c
+++ b/app/tools/gimpunifiedtransformtool.c
@@ -304,7 +304,7 @@ gimp_unified_transform_tool_draw_gui (GimpTransformTool *tr_tool,
                                GIMP_HANDLE_ANCHOR_CENTER);
 
 
-  /*  draw the rotation handle  */
+  /*  draw the rotation handles  */
   x = (tr_tool->tx1 * 3 + tr_tool->tx2 * 2) / 5;
   y = (tr_tool->ty1 * 3 + tr_tool->ty2 * 2) / 5;
 
@@ -315,6 +315,15 @@ gimp_unified_transform_tool_draw_gui (GimpTransformTool *tr_tool,
                                handle_w, handle_h,
                                GIMP_HANDLE_ANCHOR_CENTER);
 
+  x = (tr_tool->tx3 * 2 + tr_tool->tx4 * 3) / 5;
+  y = (tr_tool->ty3 * 2 + tr_tool->ty4 * 3) / 5;
+
+  tr_tool->handles[TRANSFORM_HANDLE_ROTATION2] =
+    gimp_draw_tool_add_handle (draw_tool,
+                               GIMP_HANDLE_FILLED_CIRCLE,
+                               x, y,
+                               handle_w, handle_h,
+                               GIMP_HANDLE_ANCHOR_CENTER);
 
   /*  draw the rotation center axis handle  */
   d = MIN (handle_w, handle_h) * 2; /* so you can grab it from under the center handle */
@@ -645,7 +654,7 @@ gimp_unified_transform_tool_motion (GimpTransformTool *transform_tool)
     }
 
   /* rotate */
-  if (function == TRANSFORM_HANDLE_ROTATION)
+  if (function == TRANSFORM_HANDLE_ROTATION || function == TRANSFORM_HANDLE_ROTATION2)
     {
       gdouble angle = calcangle (vectorsubtract (cur, pivot), vectorsubtract (mouse, pivot));
       if (options->constrain_rotate)



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