[gimp] Enable simple flip and rotate for group layers
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Enable simple flip and rotate for group layers
- Date: Mon, 24 Aug 2009 18:31:32 +0000 (UTC)
commit f65261c8ad252bf69c2f41b3d94b7fe7ce18f00d
Author: Michael Natterer <mitch gimp org>
Date: Mon Aug 24 20:29:37 2009 +0200
Enable simple flip and rotate for group layers
Flipping horizontally and vertically as well as rotating by multiples
of 90° works fine now for group layers, enable it even though they
appear locked. It seems that group == locked idea is not as allmighty
as i thought :(
app/actions/drawable-actions.c | 14 +++++++++-----
app/pdb/drawable-transform-cmds.c | 10 ++++++++--
tools/pdbgen/pdb/drawable_transform.pdb | 10 ++++++++--
3 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/app/actions/drawable-actions.c b/app/actions/drawable-actions.c
index 4e8a0e6..7aa40b8 100644
--- a/app/actions/drawable-actions.c
+++ b/app/actions/drawable-actions.c
@@ -165,6 +165,7 @@ drawable_actions_update (GimpActionGroup *group,
gboolean locked = FALSE;
gboolean can_lock = FALSE;
gboolean writable = FALSE;
+ gboolean children = FALSE;
image = action_data_get_image (data);
@@ -191,6 +192,9 @@ drawable_actions_update (GimpActionGroup *group,
locked = gimp_item_get_lock_content (item);
can_lock = gimp_item_can_lock_content (item);
writable = ! locked;
+
+ if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
+ children = TRUE;
}
}
@@ -212,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);
- SET_SENSITIVE ("drawable-flip-vertical", writable);
+ SET_SENSITIVE ("drawable-flip-horizontal", writable || children);
+ SET_SENSITIVE ("drawable-flip-vertical", writable || children);
- SET_SENSITIVE ("drawable-rotate-90", writable);
- SET_SENSITIVE ("drawable-rotate-180", writable);
- SET_SENSITIVE ("drawable-rotate-270", writable);
+ SET_SENSITIVE ("drawable-rotate-90", writable || children);
+ SET_SENSITIVE ("drawable-rotate-180", writable || children);
+ SET_SENSITIVE ("drawable-rotate-270", writable || children);
#undef SET_SENSITIVE
#undef SET_ACTIVE
diff --git a/app/pdb/drawable-transform-cmds.c b/app/pdb/drawable-transform-cmds.c
index aeed03e..983b4ed 100644
--- a/app/pdb/drawable-transform-cmds.c
+++ b/app/pdb/drawable-transform-cmds.c
@@ -68,7 +68,10 @@ drawable_transform_flip_simple_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
- success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
+ /* group items are transformable even though they appear locked */
+ success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), FALSE, error) &&
+ (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
+ gimp_pdb_item_is_writable (GIMP_ITEM (drawable), error)));
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -441,7 +444,10 @@ drawable_transform_rotate_simple_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
- success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
+ /* group items are transformable even though they appear locked */
+ success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), FALSE, error) &&
+ (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
+ gimp_pdb_item_is_writable (GIMP_ITEM (drawable), error)));
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
diff --git a/tools/pdbgen/pdb/drawable_transform.pdb b/tools/pdbgen/pdb/drawable_transform.pdb
index bbd75ff..3248462 100644
--- a/tools/pdbgen/pdb/drawable_transform.pdb
+++ b/tools/pdbgen/pdb/drawable_transform.pdb
@@ -165,7 +165,10 @@ HELP
{
gint x, y, width, height;
- success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
+ /* group items are transformable even though they appear locked */
+ success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), FALSE, error) &&
+ (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
+ gimp_pdb_item_is_writable (GIMP_ITEM (drawable), error)));
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -462,7 +465,10 @@ HELP
{
gint x, y, width, height;
- success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
+ /* group items are transformable even though they appear locked */
+ success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), FALSE, error) &&
+ (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
+ gimp_pdb_item_is_writable (GIMP_ITEM (drawable), error)));
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]