From 85c6af5d421e77624efc0fea4bc3d5bfbd9e9da4 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sat, 29 Aug 2009 12:51:58 +0200 Subject: [PATCH] Separate checks for "writable" from "is group" when setting sensitivity --- app/actions/drawable-actions.c | 18 +++++++++--------- app/actions/edit-actions.c | 25 ++++++++++++++++--------- app/actions/layers-actions.c | 19 +++++++++++-------- app/actions/select-actions.c | 8 ++++++-- 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/app/actions/drawable-actions.c b/app/actions/drawable-actions.c index 7aa40b8779..9e34d8cafd 100644 --- a/app/actions/drawable-actions.c +++ b/app/actions/drawable-actions.c @@ -203,10 +203,10 @@ drawable_actions_update (GimpActionGroup *group, #define SET_ACTIVE(action,condition) \ gimp_action_group_set_action_active (group, action, (condition) != 0) - SET_SENSITIVE ("drawable-equalize", writable && ! is_indexed); - SET_SENSITIVE ("drawable-invert", writable && ! is_indexed); - SET_SENSITIVE ("drawable-levels-stretch", writable && is_rgb); - SET_SENSITIVE ("drawable-offset", writable); + SET_SENSITIVE ("drawable-equalize", writable && !children && !is_indexed); + SET_SENSITIVE ("drawable-invert", writable && !children && !is_indexed); + SET_SENSITIVE ("drawable-levels-stretch", writable && !children && is_rgb); + SET_SENSITIVE ("drawable-offset", writable && !children); SET_SENSITIVE ("drawable-visible", drawable); SET_SENSITIVE ("drawable-linked", drawable); @@ -216,12 +216,12 @@ drawable_actions_update (GimpActionGroup *group, SET_ACTIVE ("drawable-linked", linked); SET_ACTIVE ("drawable-lock-content", locked); - SET_SENSITIVE ("drawable-flip-horizontal", writable || children); - SET_SENSITIVE ("drawable-flip-vertical", writable || children); + SET_SENSITIVE ("drawable-flip-horizontal", writable); + SET_SENSITIVE ("drawable-flip-vertical", writable); - SET_SENSITIVE ("drawable-rotate-90", writable || children); - SET_SENSITIVE ("drawable-rotate-180", writable || children); - SET_SENSITIVE ("drawable-rotate-270", writable || children); + SET_SENSITIVE ("drawable-rotate-90", writable); + SET_SENSITIVE ("drawable-rotate-180", writable); + SET_SENSITIVE ("drawable-rotate-270", writable); #undef SET_SENSITIVE #undef SET_ACTIVE diff --git a/app/actions/edit-actions.c b/app/actions/edit-actions.c index 3de8aad9b4..9a407feca9 100644 --- a/app/actions/edit-actions.c +++ b/app/actions/edit-actions.c @@ -264,6 +264,7 @@ edit_actions_update (GimpActionGroup *group, gchar *redo_name = NULL; gchar *fade_name = NULL; gboolean writable = FALSE; + gboolean children = FALSE; gboolean undo_enabled = FALSE; gboolean fade_enabled = FALSE; @@ -274,6 +275,9 @@ edit_actions_update (GimpActionGroup *group, if (drawable) { writable = ! gimp_item_get_lock_content (GIMP_ITEM (drawable)); + + if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable))) + children = TRUE; } undo_enabled = gimp_image_undo_is_enabled (image); @@ -335,22 +339,25 @@ edit_actions_update (GimpActionGroup *group, g_free (redo_name); g_free (fade_name); - SET_SENSITIVE ("edit-cut", writable); + SET_SENSITIVE ("edit-cut", writable && !children); SET_SENSITIVE ("edit-copy", drawable); SET_SENSITIVE ("edit-copy-visible", image); - SET_SENSITIVE ("edit-paste", ! image || (! drawable || writable)); + SET_SENSITIVE ("edit-paste", !image || (!drawable || + (writable && !children))); SET_SENSITIVE ("edit-paste-as-new-layer", image); - SET_SENSITIVE ("edit-paste-into", image && (! drawable || writable)); + SET_SENSITIVE ("edit-paste-into", image && (!drawable || + (writable && !children))); - SET_SENSITIVE ("edit-named-cut", writable); + SET_SENSITIVE ("edit-named-cut", writable && !children); SET_SENSITIVE ("edit-named-copy", drawable); SET_SENSITIVE ("edit-named-copy-visible", drawable); - SET_SENSITIVE ("edit-named-paste", image && (! drawable || writable)); + SET_SENSITIVE ("edit-named-paste", image && (!drawable || + (writable && !children))); - SET_SENSITIVE ("edit-clear", writable); - SET_SENSITIVE ("edit-fill-fg", writable); - SET_SENSITIVE ("edit-fill-bg", writable); - SET_SENSITIVE ("edit-fill-pattern", writable); + SET_SENSITIVE ("edit-clear", writable && !children); + SET_SENSITIVE ("edit-fill-fg", writable && !children); + SET_SENSITIVE ("edit-fill-bg", writable && !children); + SET_SENSITIVE ("edit-fill-pattern", writable && !children); #undef SET_LABEL #undef SET_SENSITIVE diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c index e37e38486c..576c1eaad3 100644 --- a/app/actions/layers-actions.c +++ b/app/actions/layers-actions.c @@ -546,8 +546,11 @@ layers_actions_update (GimpActionGroup *group, { if (gimp_item_get_visible (next_visible->data)) { - /* next_visible is actually next_visible_and_writable */ - if (gimp_item_get_lock_content (next_visible->data)) + /* next_visible is actually next_visible and + * writable not group + */ + if (gimp_item_get_lock_content (next_visible->data) || + gimp_viewable_get_children (next_visible->data)) next_visible = NULL; break; @@ -600,20 +603,20 @@ layers_actions_update (GimpActionGroup *group, SET_VISIBLE ("layers-text-selection-subtract", text_layer && !ac); SET_VISIBLE ("layers-text-selection-intersect", text_layer && !ac); - SET_SENSITIVE ("layers-resize", (writable || children) && !ac); + SET_SENSITIVE ("layers-resize", writable && !ac); SET_SENSITIVE ("layers-resize-to-image", writable && !ac); - SET_SENSITIVE ("layers-scale", (writable || children) && !ac); + SET_SENSITIVE ("layers-scale", writable && !ac); - SET_SENSITIVE ("layers-crop", (writable || children) && sel); + SET_SENSITIVE ("layers-crop", writable && sel); - SET_SENSITIVE ("layers-alpha-add", writable && !fs && !alpha); - SET_SENSITIVE ("layers-alpha-remove", writable && !fs && alpha); + SET_SENSITIVE ("layers-alpha-add", writable && !children && !fs && !alpha); + SET_SENSITIVE ("layers-alpha-remove", writable && !children && !fs && alpha); SET_SENSITIVE ("layers-lock-alpha", can_lock_alpha); SET_ACTIVE ("layers-lock-alpha", lock_alpha); SET_SENSITIVE ("layers-mask-add", layer && !fs && !ac && !mask); - SET_SENSITIVE ("layers-mask-apply", writable && !fs && !ac && mask); + SET_SENSITIVE ("layers-mask-apply", writable && !fs && !ac && mask && !children); SET_SENSITIVE ("layers-mask-delete", layer && !fs && !ac && mask); SET_SENSITIVE ("layers-mask-edit", layer && !fs && !ac && mask); diff --git a/app/actions/select-actions.c b/app/actions/select-actions.c index 89dab5be77..0b5f02a704 100644 --- a/app/actions/select-actions.c +++ b/app/actions/select-actions.c @@ -133,11 +133,12 @@ void select_actions_update (GimpActionGroup *group, gpointer data) { - GimpImage *image = action_data_get_image (data); + GimpImage *image = action_data_get_image (data); GimpDrawable *drawable = NULL; gboolean fs = FALSE; gboolean sel = FALSE; gboolean writable = FALSE; + gboolean children = FALSE; if (image) { @@ -146,6 +147,9 @@ select_actions_update (GimpActionGroup *group, if (drawable) { writable = ! gimp_item_get_lock_content (GIMP_ITEM (drawable)); + + if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable))) + children = TRUE; } fs = (gimp_image_get_floating_selection (image) != NULL); @@ -158,7 +162,7 @@ select_actions_update (GimpActionGroup *group, SET_SENSITIVE ("select-all", drawable); SET_SENSITIVE ("select-none", drawable && sel); SET_SENSITIVE ("select-invert", drawable); - SET_SENSITIVE ("select-float", writable && sel); + SET_SENSITIVE ("select-float", writable && !children && sel); SET_SENSITIVE ("select-feather", drawable && sel); SET_SENSITIVE ("select-sharpen", drawable && sel);