[gimp] Start separating the logic for "locked" and "is group" again



commit e979c081335030c1f77c1d7908b1e5ccd05d844f
Author: Michael Natterer <mitch gimp org>
Date:   Fri Aug 28 20:07:14 2009 +0200

    Start separating the logic for "locked" and "is group" again
    
    The idea that group layers count as locked was a bad one, start adding
    separate checks for group layers, and refuse to modify them with
    distinct error messages.

 app/tools/gimpblendtool.c      |   10 +++++++++-
 app/tools/gimpbucketfilltool.c |   10 +++++++++-
 app/tools/gimpimagemaptool.c   |    7 +++++++
 app/tools/gimppainttool.c      |   10 +++++++++-
 4 files changed, 34 insertions(+), 3 deletions(-)
---
diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c
index 81268dd..36d7fef 100644
--- a/app/tools/gimpblendtool.c
+++ b/app/tools/gimpblendtool.c
@@ -167,6 +167,13 @@ gimp_blend_tool_initialize (GimpTool     *tool,
       return FALSE;
     }
 
+  if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
+    {
+      g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
+			   _("Cannot modify the pixels of group layers."));
+      return FALSE;
+    }
+
   if (gimp_item_get_lock_content (GIMP_ITEM (drawable)))
     {
       g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
@@ -355,7 +362,8 @@ gimp_blend_tool_cursor_update (GimpTool         *tool,
 
   drawable = gimp_image_get_active_drawable (display->image);
 
-  if (gimp_drawable_is_indexed (drawable) ||
+  if (gimp_drawable_is_indexed (drawable)                   ||
+      gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
       gimp_item_get_lock_content (GIMP_ITEM (drawable)))
     {
       modifier = GIMP_CURSOR_MODIFIER_BAD;
diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c
index 2028632..99cb8be 100644
--- a/app/tools/gimpbucketfilltool.c
+++ b/app/tools/gimpbucketfilltool.c
@@ -128,6 +128,13 @@ gimp_bucket_fill_tool_initialize (GimpTool     *tool,
       return FALSE;
     }
 
+  if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
+    {
+      g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
+			   _("Cannot modify the pixels of group layers."));
+      return FALSE;
+    }
+
   if (gimp_item_get_lock_content (GIMP_ITEM (drawable)))
     {
       g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
@@ -245,7 +252,8 @@ gimp_bucket_fill_tool_cursor_update (GimpTool         *tool,
     {
       GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
 
-      if (! gimp_item_get_lock_content (GIMP_ITEM (drawable)))
+      if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+          ! gimp_item_get_lock_content (GIMP_ITEM (drawable)))
         {
           switch (options->fill_mode)
             {
diff --git a/app/tools/gimpimagemaptool.c b/app/tools/gimpimagemaptool.c
index 32c35c4..ec21982 100644
--- a/app/tools/gimpimagemaptool.c
+++ b/app/tools/gimpimagemaptool.c
@@ -269,6 +269,13 @@ gimp_image_map_tool_initialize (GimpTool     *tool,
 
   drawable = gimp_image_get_active_drawable (display->image);
 
+  if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
+    {
+      g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
+			   _("Cannot modify the pixels of group layers."));
+      return FALSE;
+    }
+
   if (gimp_item_get_lock_content (GIMP_ITEM (drawable)))
     {
       g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c
index 21c7d2d..e576d36 100644
--- a/app/tools/gimppainttool.c
+++ b/app/tools/gimppainttool.c
@@ -274,6 +274,13 @@ gimp_paint_tool_button_press (GimpTool            *tool,
 
   drawable = gimp_image_get_active_drawable (display->image);
 
+  if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
+    {
+      gimp_tool_message_literal (tool, display,
+                                 _("Cannot paint on group layers."));
+      return;
+    }
+
   if (gimp_item_get_lock_content (GIMP_ITEM (drawable)))
     {
       gimp_tool_message_literal (tool, display,
@@ -533,7 +540,8 @@ gimp_paint_tool_cursor_update (GimpTool         *tool,
     {
       GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
 
-      if (gimp_item_get_lock_content (GIMP_ITEM (drawable)))
+      if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
+          gimp_item_get_lock_content (GIMP_ITEM (drawable)))
         {
           modifier        = GIMP_CURSOR_MODIFIER_BAD;
           toggle_modifier = GIMP_CURSOR_MODIFIER_BAD;



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