[gimp] app: remove display parameters from all virtual GimpTransformTool functions



commit fb2ba3f289058367f434da595849e0cdbcb913ff
Author: Michael Natterer <mitch gimp org>
Date:   Sun Mar 27 22:39:31 2011 +0200

    app: remove display parameters from all virtual GimpTransformTool functions

 app/tools/gimpfliptool.c        |    2 --
 app/tools/gimpperspectivetool.c |   18 ++++++------------
 app/tools/gimprotatetool.c      |   27 +++++++++++----------------
 app/tools/gimpscaletool.c       |   21 ++++++++-------------
 app/tools/gimpsheartool.c       |   22 ++++++++--------------
 app/tools/gimptransformtool.c   |   27 ++++++++++-----------------
 app/tools/gimptransformtool.h   |   13 ++++---------
 7 files changed, 47 insertions(+), 83 deletions(-)
---
diff --git a/app/tools/gimpfliptool.c b/app/tools/gimpfliptool.c
index 0c6b63c..7377011 100644
--- a/app/tools/gimpfliptool.c
+++ b/app/tools/gimpfliptool.c
@@ -58,7 +58,6 @@ static void          gimp_flip_tool_cursor_update (GimpTool          *tool,
 
 static TileManager * gimp_flip_tool_transform     (GimpTransformTool *tool,
                                                    GimpItem          *item,
-                                                   GimpDisplay       *display,
                                                    TileManager       *orig_tiles,
                                                    gint               orig_offset_x,
                                                    gint               orig_offset_y,
@@ -180,7 +179,6 @@ gimp_flip_tool_cursor_update (GimpTool         *tool,
 static TileManager *
 gimp_flip_tool_transform (GimpTransformTool *trans_tool,
                           GimpItem          *active_item,
-                          GimpDisplay       *display,
                           TileManager       *orig_tiles,
                           gint               orig_offset_x,
                           gint               orig_offset_y,
diff --git a/app/tools/gimpperspectivetool.c b/app/tools/gimpperspectivetool.c
index 630a967..3a05912 100644
--- a/app/tools/gimpperspectivetool.c
+++ b/app/tools/gimpperspectivetool.c
@@ -45,12 +45,9 @@
 
 static void   gimp_perspective_tool_dialog        (GimpTransformTool *tr_tool);
 static void   gimp_perspective_tool_dialog_update (GimpTransformTool *tr_tool);
-static void   gimp_perspective_tool_prepare       (GimpTransformTool *tr_tool,
-                                                   GimpDisplay       *display);
-static void   gimp_perspective_tool_motion        (GimpTransformTool *tr_tool,
-                                                   GimpDisplay       *display);
-static void   gimp_perspective_tool_recalc        (GimpTransformTool *tr_tool,
-                                                   GimpDisplay       *display);
+static void   gimp_perspective_tool_prepare       (GimpTransformTool *tr_tool);
+static void   gimp_perspective_tool_motion        (GimpTransformTool *tr_tool);
+static void   gimp_perspective_tool_recalc        (GimpTransformTool *tr_tool);
 
 
 G_DEFINE_TYPE (GimpPerspectiveTool, gimp_perspective_tool,
@@ -158,8 +155,7 @@ gimp_perspective_tool_dialog_update (GimpTransformTool *tr_tool)
 }
 
 static void
-gimp_perspective_tool_prepare (GimpTransformTool  *tr_tool,
-                               GimpDisplay        *display)
+gimp_perspective_tool_prepare (GimpTransformTool  *tr_tool)
 {
   tr_tool->trans_info[X0] = (gdouble) tr_tool->x1;
   tr_tool->trans_info[Y0] = (gdouble) tr_tool->y1;
@@ -172,8 +168,7 @@ gimp_perspective_tool_prepare (GimpTransformTool  *tr_tool,
 }
 
 static void
-gimp_perspective_tool_motion (GimpTransformTool *transform_tool,
-                              GimpDisplay       *display)
+gimp_perspective_tool_motion (GimpTransformTool *transform_tool)
 {
   gdouble diff_x, diff_y;
 
@@ -214,8 +209,7 @@ gimp_perspective_tool_motion (GimpTransformTool *transform_tool,
 }
 
 static void
-gimp_perspective_tool_recalc (GimpTransformTool *tr_tool,
-                              GimpDisplay       *display)
+gimp_perspective_tool_recalc (GimpTransformTool *tr_tool)
 {
   gimp_matrix3_identity (&tr_tool->transform);
   gimp_transform_matrix_perspective (&tr_tool->transform,
diff --git a/app/tools/gimprotatetool.c b/app/tools/gimprotatetool.c
index a306f1b..ce8e20f 100644
--- a/app/tools/gimprotatetool.c
+++ b/app/tools/gimprotatetool.c
@@ -61,12 +61,9 @@ static gboolean gimp_rotate_tool_key_press     (GimpTool            *tool,
                                                 GimpDisplay         *display);
 static void     gimp_rotate_tool_dialog        (GimpTransformTool   *tr_tool);
 static void     gimp_rotate_tool_dialog_update (GimpTransformTool   *tr_tool);
-static void     gimp_rotate_tool_prepare       (GimpTransformTool   *tr_tool,
-                                                GimpDisplay         *display);
-static void     gimp_rotate_tool_motion        (GimpTransformTool   *tr_tool,
-                                                GimpDisplay         *display);
-static void     gimp_rotate_tool_recalc        (GimpTransformTool   *tr_tool,
-                                                GimpDisplay         *display);
+static void     gimp_rotate_tool_prepare       (GimpTransformTool   *tr_tool);
+static void     gimp_rotate_tool_motion        (GimpTransformTool   *tr_tool);
+static void     gimp_rotate_tool_recalc        (GimpTransformTool   *tr_tool);
 static void     rotate_angle_changed           (GtkAdjustment       *adj,
                                                 GimpTransformTool   *tr_tool);
 static void     rotate_center_changed          (GtkWidget           *entry,
@@ -241,11 +238,11 @@ gimp_rotate_tool_dialog_update (GimpTransformTool *tr_tool)
 }
 
 static void
-gimp_rotate_tool_prepare (GimpTransformTool *tr_tool,
-                          GimpDisplay       *display)
+gimp_rotate_tool_prepare (GimpTransformTool *tr_tool)
 {
-  GimpRotateTool *rotate = GIMP_ROTATE_TOOL (tr_tool);
-  GimpImage      *image  = gimp_display_get_image (display);
+  GimpRotateTool *rotate  = GIMP_ROTATE_TOOL (tr_tool);
+  GimpDisplay    *display = GIMP_TOOL (tr_tool)->display;
+  GimpImage      *image   = gimp_display_get_image (display);
   gdouble         xres;
   gdouble         yres;
 
@@ -288,8 +285,7 @@ gimp_rotate_tool_prepare (GimpTransformTool *tr_tool,
 }
 
 static void
-gimp_rotate_tool_motion (GimpTransformTool *tr_tool,
-                         GimpDisplay       *display)
+gimp_rotate_tool_motion (GimpTransformTool *tr_tool)
 {
   GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
   gdouble               angle1, angle2, angle;
@@ -352,8 +348,7 @@ gimp_rotate_tool_motion (GimpTransformTool *tr_tool,
 }
 
 static void
-gimp_rotate_tool_recalc (GimpTransformTool *tr_tool,
-                         GimpDisplay       *display)
+gimp_rotate_tool_recalc (GimpTransformTool *tr_tool)
 {
   tr_tool->cx = tr_tool->trans_info[CENTER_X];
   tr_tool->cy = tr_tool->trans_info[CENTER_Y];
@@ -379,7 +374,7 @@ rotate_angle_changed (GtkAdjustment     *adj,
 
       tr_tool->trans_info[REAL_ANGLE] = tr_tool->trans_info[ANGLE] = value;
 
-      gimp_transform_tool_recalc (tr_tool, GIMP_TOOL (tr_tool)->display);
+      gimp_transform_tool_recalc (tr_tool);
 
       gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
     }
@@ -404,7 +399,7 @@ rotate_center_changed (GtkWidget         *widget,
       tr_tool->cx = cx;
       tr_tool->cy = cy;
 
-      gimp_transform_tool_recalc (tr_tool, GIMP_TOOL (tr_tool)->display);
+      gimp_transform_tool_recalc (tr_tool);
 
       gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
     }
diff --git a/app/tools/gimpscaletool.c b/app/tools/gimpscaletool.c
index 199acf0..cb2d00c 100644
--- a/app/tools/gimpscaletool.c
+++ b/app/tools/gimpscaletool.c
@@ -48,12 +48,9 @@
 
 static void   gimp_scale_tool_dialog        (GimpTransformTool  *tr_tool);
 static void   gimp_scale_tool_dialog_update (GimpTransformTool  *tr_tool);
-static void   gimp_scale_tool_prepare       (GimpTransformTool  *tr_tool,
-                                             GimpDisplay        *display);
-static void   gimp_scale_tool_motion        (GimpTransformTool  *tr_tool,
-                                             GimpDisplay        *display);
-static void   gimp_scale_tool_recalc        (GimpTransformTool  *tr_tool,
-                                             GimpDisplay        *display);
+static void   gimp_scale_tool_prepare       (GimpTransformTool  *tr_tool);
+static void   gimp_scale_tool_motion        (GimpTransformTool  *tr_tool);
+static void   gimp_scale_tool_recalc        (GimpTransformTool  *tr_tool);
 
 static void   gimp_scale_tool_size_notify   (GtkWidget          *box,
                                              GParamSpec         *pspec,
@@ -132,11 +129,11 @@ gimp_scale_tool_dialog_update (GimpTransformTool *tr_tool)
 }
 
 static void
-gimp_scale_tool_prepare (GimpTransformTool *tr_tool,
-                         GimpDisplay       *display)
+gimp_scale_tool_prepare (GimpTransformTool *tr_tool)
 {
   GimpScaleTool        *scale   = GIMP_SCALE_TOOL (tr_tool);
   GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
+  GimpDisplay          *display = GIMP_TOOL (tr_tool)->display;
   gdouble               xres;
   gdouble               yres;
 
@@ -180,8 +177,7 @@ gimp_scale_tool_prepare (GimpTransformTool *tr_tool,
 }
 
 static void
-gimp_scale_tool_motion (GimpTransformTool *tr_tool,
-                        GimpDisplay       *display)
+gimp_scale_tool_motion (GimpTransformTool *tr_tool)
 {
   GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
   gdouble              *x1;
@@ -304,8 +300,7 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool,
 }
 
 static void
-gimp_scale_tool_recalc (GimpTransformTool *tr_tool,
-                        GimpDisplay       *display)
+gimp_scale_tool_recalc (GimpTransformTool *tr_tool)
 {
   gimp_matrix3_identity (&tr_tool->transform);
   gimp_transform_matrix_scale (&tr_tool->transform,
@@ -349,7 +344,7 @@ gimp_scale_tool_size_notify (GtkWidget         *box,
           tr_tool->trans_info[X1] = tr_tool->trans_info[X0] + width;
           tr_tool->trans_info[Y1] = tr_tool->trans_info[Y0] + height;
 
-          gimp_transform_tool_recalc (tr_tool, GIMP_TOOL (tr_tool)->display);
+          gimp_transform_tool_recalc (tr_tool);
 
           gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
         }
diff --git a/app/tools/gimpsheartool.c b/app/tools/gimpsheartool.c
index d329762..49623bd 100644
--- a/app/tools/gimpsheartool.c
+++ b/app/tools/gimpsheartool.c
@@ -53,12 +53,9 @@
 static void   gimp_shear_tool_dialog        (GimpTransformTool  *tr_tool);
 static void   gimp_shear_tool_dialog_update (GimpTransformTool  *tr_tool);
 
-static void   gimp_shear_tool_prepare       (GimpTransformTool  *tr_tool,
-                                             GimpDisplay        *display);
-static void   gimp_shear_tool_motion        (GimpTransformTool  *tr_tool,
-                                             GimpDisplay        *display);
-static void   gimp_shear_tool_recalc        (GimpTransformTool  *tr_tool,
-                                             GimpDisplay        *display);
+static void   gimp_shear_tool_prepare       (GimpTransformTool  *tr_tool);
+static void   gimp_shear_tool_motion        (GimpTransformTool  *tr_tool);
+static void   gimp_shear_tool_recalc        (GimpTransformTool  *tr_tool);
 
 static void   shear_x_mag_changed           (GtkAdjustment      *adj,
                                              GimpTransformTool  *tr_tool);
@@ -158,8 +155,7 @@ gimp_shear_tool_dialog_update (GimpTransformTool *tr_tool)
 }
 
 static void
-gimp_shear_tool_prepare (GimpTransformTool *tr_tool,
-                         GimpDisplay       *display)
+gimp_shear_tool_prepare (GimpTransformTool *tr_tool)
 {
   tr_tool->trans_info[HORZ_OR_VERT] = GIMP_ORIENTATION_UNKNOWN;
   tr_tool->trans_info[XSHEAR]       = 0.0;
@@ -167,8 +163,7 @@ gimp_shear_tool_prepare (GimpTransformTool *tr_tool,
 }
 
 static void
-gimp_shear_tool_motion (GimpTransformTool *tr_tool,
-                        GimpDisplay       *display)
+gimp_shear_tool_motion (GimpTransformTool *tr_tool)
 {
   gdouble diffx = tr_tool->curx - tr_tool->lastx;
   gdouble diffy = tr_tool->cury - tr_tool->lasty;
@@ -218,8 +213,7 @@ gimp_shear_tool_motion (GimpTransformTool *tr_tool,
 }
 
 static void
-gimp_shear_tool_recalc (GimpTransformTool *tr_tool,
-                        GimpDisplay       *display)
+gimp_shear_tool_recalc (GimpTransformTool *tr_tool)
 {
   gdouble amount;
 
@@ -259,7 +253,7 @@ shear_x_mag_changed (GtkAdjustment     *adj,
 
       tr_tool->trans_info[XSHEAR] = value;
 
-      gimp_transform_tool_recalc (tr_tool, GIMP_TOOL (tr_tool)->display);
+      gimp_transform_tool_recalc (tr_tool);
 
       gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
     }
@@ -280,7 +274,7 @@ shear_y_mag_changed (GtkAdjustment     *adj,
 
       tr_tool->trans_info[YSHEAR] = value;
 
-      gimp_transform_tool_recalc (tr_tool, GIMP_TOOL (tr_tool)->display);
+      gimp_transform_tool_recalc (tr_tool);
 
       gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
     }
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index a64202c..96f8c4c 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -125,7 +125,6 @@ static void      gimp_transform_tool_dialog_update          (GimpTransformTool
 static TileManager *
                  gimp_transform_tool_real_transform         (GimpTransformTool     *tr_tool,
                                                              GimpItem              *item,
-                                                             GimpDisplay           *display,
                                                              TileManager           *orig_tiles,
                                                              gint                   orig_offset_x,
                                                              gint                   orig_offset_y,
@@ -295,7 +294,7 @@ gimp_transform_tool_initialize (GimpTool     *tool,
       gimp_transform_tool_prepare (tr_tool, display);
 
       /*  Recalculate the transform tool  */
-      gimp_transform_tool_recalc (tr_tool, display);
+      gimp_transform_tool_recalc (tr_tool);
 
       /*  start drawing the bounding box and handles...  */
       gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
@@ -327,7 +326,7 @@ gimp_transform_tool_control (GimpTool       *tool,
 
     case GIMP_TOOL_ACTION_RESUME:
       gimp_transform_tool_bounds (tr_tool, display);
-      gimp_transform_tool_recalc (tr_tool, display);
+      gimp_transform_tool_recalc (tr_tool);
       break;
 
     case GIMP_TOOL_ACTION_HALT:
@@ -396,7 +395,7 @@ gimp_transform_tool_button_release (GimpTool              *tool,
       gimp_transform_tool_bounds (tr_tool, display);
 
       /*  recalculate the tool's transformation matrix  */
-      gimp_transform_tool_recalc (tr_tool, display);
+      gimp_transform_tool_recalc (tr_tool);
 
       gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
     }
@@ -428,9 +427,9 @@ gimp_transform_tool_motion (GimpTool         *tool,
 
   if (tr_tool_class->motion)
     {
-      tr_tool_class->motion (tr_tool, display);
+      tr_tool_class->motion (tr_tool);
 
-      gimp_transform_tool_recalc (tr_tool, display);
+      gimp_transform_tool_recalc (tr_tool);
     }
 
   tr_tool->lastx = tr_tool->curx;
@@ -724,7 +723,7 @@ gimp_transform_tool_options_notify (GimpTool         *tool,
                   gimp_transform_tool_bounds (tr_tool, tool->display);
 
                   /*  recalculate the tool's transformation matrix  */
-                  gimp_transform_tool_recalc (tr_tool, tool->display);
+                  gimp_transform_tool_recalc (tr_tool);
                 }
             }
         }
@@ -1043,7 +1042,6 @@ gimp_transform_tool_dialog_update (GimpTransformTool *tr_tool)
 static TileManager *
 gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
                                     GimpItem          *active_item,
-                                    GimpDisplay       *display,
                                     TileManager       *orig_tiles,
                                     gint               orig_offset_x,
                                     gint               orig_offset_y,
@@ -1185,8 +1183,6 @@ gimp_transform_tool_transform (GimpTransformTool *tr_tool,
   gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
                                tr_tool->undo_desc);
 
-  tool->drawable = gimp_image_get_active_drawable (image);
-
   switch (options->type)
     {
     case GIMP_TRANSFORM_TYPE_LAYER:
@@ -1215,7 +1211,6 @@ gimp_transform_tool_transform (GimpTransformTool *tr_tool,
    */
   new_tiles = GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->transform (tr_tool,
                                                                   active_item,
-                                                                  display,
                                                                   orig_tiles,
                                                                   orig_offset_x,
                                                                   orig_offset_y,
@@ -1536,18 +1531,16 @@ gimp_transform_tool_prepare (GimpTransformTool *tr_tool,
     }
 
   if (GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->prepare)
-    GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->prepare (tr_tool, display);
+    GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->prepare (tr_tool);
 }
 
 void
-gimp_transform_tool_recalc (GimpTransformTool *tr_tool,
-                            GimpDisplay       *display)
+gimp_transform_tool_recalc (GimpTransformTool *tr_tool)
 {
   g_return_if_fail (GIMP_IS_TRANSFORM_TOOL (tr_tool));
-  g_return_if_fail (GIMP_IS_DISPLAY (display));
 
   if (GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->recalc)
-    GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->recalc (tr_tool, display);
+    GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->recalc (tr_tool);
 
   gimp_transform_tool_transform_bounding_box (tr_tool);
 
@@ -1580,7 +1573,7 @@ gimp_transform_tool_response (GtkWidget         *widget,
         gimp_transform_tool_bounds (tr_tool, tool->display);
 
         /*  recalculate the tool's transformation matrix  */
-        gimp_transform_tool_recalc (tr_tool, tool->display);
+        gimp_transform_tool_recalc (tr_tool);
 
         gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
       }
diff --git a/app/tools/gimptransformtool.h b/app/tools/gimptransformtool.h
index ee407ec..4e9167a 100644
--- a/app/tools/gimptransformtool.h
+++ b/app/tools/gimptransformtool.h
@@ -112,15 +112,11 @@ struct _GimpTransformToolClass
   /*  virtual functions  */
   void          (* dialog)        (GimpTransformTool *tool);
   void          (* dialog_update) (GimpTransformTool *tool);
-  void          (* prepare)       (GimpTransformTool *tool,
-                                   GimpDisplay       *display);
-  void          (* motion)        (GimpTransformTool *tool,
-                                   GimpDisplay       *display);
-  void          (* recalc)        (GimpTransformTool *tool,
-                                   GimpDisplay       *display);
+  void          (* prepare)       (GimpTransformTool *tool);
+  void          (* motion)        (GimpTransformTool *tool);
+  void          (* recalc)        (GimpTransformTool *tool);
   TileManager * (* transform)     (GimpTransformTool *tool,
                                    GimpItem          *item,
-                                   GimpDisplay       *display,
                                    TileManager       *orig_tiles,
                                    gint               orig_offset_x,
                                    gint               orig_offset_y,
@@ -131,8 +127,7 @@ struct _GimpTransformToolClass
 
 GType   gimp_transform_tool_get_type (void) G_GNUC_CONST;
 
-void    gimp_transform_tool_recalc   (GimpTransformTool *tr_tool,
-                                      GimpDisplay       *display);
+void    gimp_transform_tool_recalc   (GimpTransformTool *tr_tool);
 
 
 #endif  /*  __GIMP_TRANSFORM_TOOL_H__  */



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