[gimp] Don't allow stroking to locked items and group items



commit e6235cd98219bfd17c6ea7c2ddc87ce737b933f2
Author: Michael Natterer <mitch gimp org>
Date:   Sat Aug 29 20:20:25 2009 +0200

    Don't allow stroking to locked items and group items

 app/actions/select-actions.c  |    4 +-
 app/actions/vectors-actions.c |   47 ++++++++++++++++++++++++++++------------
 2 files changed, 35 insertions(+), 16 deletions(-)
---
diff --git a/app/actions/select-actions.c b/app/actions/select-actions.c
index 04198f6..9527bcb 100644
--- a/app/actions/select-actions.c
+++ b/app/actions/select-actions.c
@@ -171,8 +171,8 @@ select_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("select-border",  drawable && sel);
 
   SET_SENSITIVE ("select-save",               drawable && !fs);
-  SET_SENSITIVE ("select-stroke",             writable && sel);
-  SET_SENSITIVE ("select-stroke-last-values", writable && sel);
+  SET_SENSITIVE ("select-stroke",             writable && !children && sel);
+  SET_SENSITIVE ("select-stroke-last-values", writable && !children && sel);
 
 #undef SET_SENSITIVE
 }
diff --git a/app/actions/vectors-actions.c b/app/actions/vectors-actions.c
index 2d86f9b..3d71f0b 100644
--- a/app/actions/vectors-actions.c
+++ b/app/actions/vectors-actions.c
@@ -243,18 +243,21 @@ void
 vectors_actions_update (GimpActionGroup *group,
                         gpointer         data)
 {
-  GimpImage   *image      = action_data_get_image (data);
-  GimpVectors *vectors    = NULL;
-  gint         n_vectors  = 0;
-  gboolean     mask_empty = TRUE;
-  gboolean     global_buf = FALSE;
-  gboolean     visible    = FALSE;
-  gboolean     linked     = FALSE;
-  gboolean     locked     = FALSE;
-  gboolean     can_lock   = FALSE;
-  gboolean     writable   = FALSE;
-  GList       *next       = NULL;
-  GList       *prev       = NULL;
+  GimpImage    *image       = action_data_get_image (data);
+  GimpVectors  *vectors     = NULL;
+  GimpDrawable *drawable    = NULL;
+  gint          n_vectors   = 0;
+  gboolean      mask_empty  = TRUE;
+  gboolean      global_buf  = FALSE;
+  gboolean      visible     = FALSE;
+  gboolean      linked      = FALSE;
+  gboolean      locked      = FALSE;
+  gboolean      can_lock    = FALSE;
+  gboolean      writable    = FALSE;
+  gboolean      dr_writable = FALSE;
+  gboolean      dr_children = FALSE;
+  GList        *next        = NULL;
+  GList        *prev        = NULL;
 
   if (image)
     {
@@ -286,6 +289,18 @@ vectors_actions_update (GimpActionGroup *group,
               next = g_list_next (list);
             }
         }
+
+      drawable = gimp_image_get_active_drawable (image);
+
+      if (drawable)
+        {
+          GimpItem *item = GIMP_ITEM (drawable);
+
+          dr_writable = ! gimp_item_is_content_locked (item);
+
+          if (gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+            dr_children = TRUE;
+        }
     }
 
 #define SET_SENSITIVE(action,condition) \
@@ -323,8 +338,12 @@ vectors_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("vectors-selection-to-vectors",          image && !mask_empty);
   SET_SENSITIVE ("vectors-selection-to-vectors-short",    image && !mask_empty);
   SET_SENSITIVE ("vectors-selection-to-vectors-advanced", image && !mask_empty);
-  SET_SENSITIVE ("vectors-stroke",                        vectors);
-  SET_SENSITIVE ("vectors-stroke-last-values",            vectors);
+  SET_SENSITIVE ("vectors-stroke",                        vectors &&
+                                                          dr_writable &&
+                                                          !dr_children);
+  SET_SENSITIVE ("vectors-stroke-last-values",            vectors &&
+                                                          dr_writable &&
+                                                          !dr_children);
 
   SET_SENSITIVE ("vectors-selection-replace",      vectors);
   SET_SENSITIVE ("vectors-selection-from-vectors", vectors);



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