[gimp] Bug 759194 - Unified Transform Tool fails when layer is hidden



commit cea6f1dc7308fac233d34af1a194aa7f3172f1ac
Author: Ell <ell_se yahoo com>
Date:   Sun Jun 10 07:22:52 2018 -0400

    Bug 759194 - Unified Transform Tool fails when layer is hidden
    
    Last commit reintroduced this bug.
    
    Allow transforming invisible layers using transform-grid tools, by
    adding a 'drawable' member to GimpTransformTool, and setting/
    clearing it when initializing/halting a GimpTransformTool.  In
    gimp_transform_tool_check_active_item(), skip the visibility check
    if the active item equals the GimpTransformTool's 'drawable'
    member.

 app/tools/gimptransformgridtool.c | 20 ++++++++++----------
 app/tools/gimptransformtool.c     |  3 ++-
 app/tools/gimptransformtool.h     |  2 ++
 3 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/app/tools/gimptransformgridtool.c b/app/tools/gimptransformgridtool.c
index e67356087d..5cfb0f0c0b 100644
--- a/app/tools/gimptransformgridtool.c
+++ b/app/tools/gimptransformgridtool.c
@@ -247,8 +247,10 @@ gimp_transform_grid_tool_initialize (GimpTool     *tool,
   if (! item)
     return FALSE;
 
-  tool->display  = display;
-  tool->drawable = drawable;
+  tool->display     = display;
+  tool->drawable    = drawable;
+
+  tr_tool->drawable = drawable;
 
   /*  Initialize the transform_grid tool dialog  */
   if (! tg_tool->gui)
@@ -865,7 +867,8 @@ gimp_transform_grid_tool_widget_response (GimpToolWidget        *widget,
 static void
 gimp_transform_grid_tool_halt (GimpTransformGridTool *tg_tool)
 {
-  GimpTool *tool = GIMP_TOOL (tg_tool);
+  GimpTool          *tool    = GIMP_TOOL (tg_tool);
+  GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (tg_tool);
 
   if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tg_tool)))
     gimp_draw_tool_stop (GIMP_DRAW_TOOL (tg_tool));
@@ -891,8 +894,10 @@ gimp_transform_grid_tool_halt (GimpTransformGridTool *tg_tool)
 
   gimp_transform_grid_tool_show_active_item (tg_tool);
 
-  tool->display  = NULL;
-  tool->drawable = NULL;
+  tool->display     = NULL;
+  tool->drawable    = NULL;
+
+  tr_tool->drawable = NULL;
 }
 
 static void
@@ -905,11 +910,6 @@ gimp_transform_grid_tool_commit (GimpTransformGridTool *tg_tool)
   /* undraw the tool before we muck around with the transform matrix */
   gimp_draw_tool_stop (GIMP_DRAW_TOOL (tg_tool));
 
-  /* un-hide the active item before transforming, so that GimpTransformTool
-   * doesn't refuse to transform it.
-   */
-  gimp_transform_grid_tool_show_active_item (tg_tool);
-
   gimp_transform_tool_transform (tr_tool, display);
 }
 
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index f7f7ab10bd..b2230662cd 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -331,7 +331,8 @@ gimp_transform_tool_check_active_item (GimpTransformTool  *tr_tool,
           else if (gimp_item_is_position_locked (item))
             locked_message = _("The active layer's position and size are locked.");
 
-          if (! gimp_item_is_visible (item))
+          if (! gimp_item_is_visible (item) &&
+              GIMP_DRAWABLE (item) != tr_tool->drawable) /* see bug #759194 */
             {
               g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
                                    _("The active layer is not visible."));
diff --git a/app/tools/gimptransformtool.h b/app/tools/gimptransformtool.h
index 3e9c1921b1..7eeba8247b 100644
--- a/app/tools/gimptransformtool.h
+++ b/app/tools/gimptransformtool.h
@@ -47,6 +47,8 @@ struct _GimpTransformTool
 {
   GimpDrawTool  parent_instance;
 
+  GimpDrawable *drawable;
+
   gint          x1, y1;             /*  upper left hand coordinate         */
   gint          x2, y2;             /*  lower right hand coords            */
 


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