[gimp] app: if there is no selection, don't cut/transform/paste in the transform tool



commit 3ed87015a66489dbd53a96473778dd6d2653d1b4
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 25 21:50:58 2011 +0100

    app: if there is no selection, don't cut/transform/paste in the transform tool
    
    instead, take the easy path that simply calls gimp_item_transform()
    and does exactly the same, just less weird.

 app/tools/gimpfliptool.c      |   12 ------------
 app/tools/gimptransformtool.c |   24 ++----------------------
 app/tools/gimptransformtool.h |    1 -
 3 files changed, 2 insertions(+), 35 deletions(-)
---
diff --git a/app/tools/gimpfliptool.c b/app/tools/gimpfliptool.c
index 4eafd18..f612543 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,
-                                                   gboolean           mask_empty,
                                                    GimpDisplay       *display);
 
 
@@ -176,7 +175,6 @@ gimp_flip_tool_cursor_update (GimpTool         *tool,
 static TileManager *
 gimp_flip_tool_transform (GimpTransformTool *trans_tool,
                           GimpItem          *active_item,
-                          gboolean           mask_empty,
                           GimpDisplay       *display)
 {
   GimpFlipOptions *options = GIMP_FLIP_TOOL_GET_OPTIONS (trans_tool);
@@ -204,16 +202,6 @@ gimp_flip_tool_transform (GimpTransformTool *trans_tool,
     gimp_item_linked_flip (active_item, context, options->flip_type, axis,
                            FALSE);
 
-  if (GIMP_IS_LAYER (active_item) &&
-      gimp_layer_get_mask (GIMP_LAYER (active_item)) &&
-      mask_empty)
-    {
-      GimpLayerMask *mask = gimp_layer_get_mask (GIMP_LAYER (active_item));
-
-      gimp_item_flip (GIMP_ITEM (mask), context,
-                      options->flip_type, axis, FALSE);
-    }
-
   if (trans_tool->original)
     {
       /*  this happens when transforming a normal drawable or the
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 7da5eff..353ddfc 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -124,7 +124,6 @@ static void      gimp_transform_tool_dialog_update          (GimpTransformTool
 static TileManager *
                  gimp_transform_tool_real_transform         (GimpTransformTool     *tr_tool,
                                                              GimpItem              *item,
-                                                             gboolean               mask_empty,
                                                              GimpDisplay           *display);
 
 static void      gimp_transform_tool_halt                   (GimpTransformTool     *tr_tool);
@@ -1141,7 +1140,6 @@ gimp_transform_tool_dialog_update (GimpTransformTool *tr_tool)
 static TileManager *
 gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
                                     GimpItem          *active_item,
-                                    gboolean           mask_empty,
                                     GimpDisplay       *display)
 {
   GimpTool             *tool    = GIMP_TOOL (tr_tool);
@@ -1162,21 +1160,6 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
                                 options->clip,
                                 progress);
 
-  if (GIMP_IS_LAYER (active_item) &&
-      gimp_layer_get_mask (GIMP_LAYER (active_item)) &&
-      mask_empty)
-    {
-      GimpLayerMask *mask = gimp_layer_get_mask (GIMP_LAYER (active_item));
-
-      gimp_item_transform (GIMP_ITEM (mask), context,
-                           &tr_tool->transform,
-                           options->direction,
-                           options->interpolation,
-                           options->recursion_level,
-                           options->clip,
-                           progress);
-    }
-
   if (tr_tool->original)
     {
       /*  this happens when transforming a normal drawable or the
@@ -1234,7 +1217,6 @@ gimp_transform_tool_transform (GimpTransformTool *tr_tool,
   const gchar          *null_message   = NULL;
   const gchar          *locked_message = NULL;
   gboolean              new_layer;
-  gboolean              mask_empty;
 
   switch (options->type)
     {
@@ -1275,8 +1257,6 @@ gimp_transform_tool_transform (GimpTransformTool *tr_tool,
   if (tr_tool->dialog)
     gimp_dialog_factory_hide_dialog (tr_tool->dialog);
 
-  mask_empty = gimp_channel_is_empty (gimp_image_get_mask (image));
-
   gimp_set_busy (display->gimp);
 
   /* undraw the tool before we muck around with the transform matrix */
@@ -1303,7 +1283,8 @@ gimp_transform_tool_transform (GimpTransformTool *tr_tool,
   switch (options->type)
     {
     case GIMP_TRANSFORM_TYPE_LAYER:
-      if (! gimp_viewable_get_children (GIMP_VIEWABLE (tool->drawable)))
+      if (! gimp_viewable_get_children (GIMP_VIEWABLE (tool->drawable)) &&
+          ! gimp_channel_is_empty (gimp_image_get_mask (image)))
         tr_tool->original = gimp_drawable_transform_cut (tool->drawable,
                                                          context,
                                                          &new_layer);
@@ -1322,7 +1303,6 @@ gimp_transform_tool_transform (GimpTransformTool *tr_tool,
    */
   new_tiles = GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->transform (tr_tool,
                                                                   active_item,
-                                                                  mask_empty,
                                                                   display);
 
   switch (options->type)
diff --git a/app/tools/gimptransformtool.h b/app/tools/gimptransformtool.h
index 06e875b..433bbf8 100644
--- a/app/tools/gimptransformtool.h
+++ b/app/tools/gimptransformtool.h
@@ -117,7 +117,6 @@ struct _GimpTransformToolClass
                                    GimpDisplay       *display);
   TileManager * (* transform)     (GimpTransformTool *tool,
                                    GimpItem          *item,
-                                   gboolean           mask_empty,
                                    GimpDisplay       *display);
 };
 



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