[gimp] Add "layers-merge-group" action, callback and menu items



commit 90893cea8441389d582d2e680ec80047be0a2710
Author: Michael Natterer <mitch gimp org>
Date:   Mon Sep 21 19:17:02 2009 +0200

    Add "layers-merge-group" action, callback and menu items

 app/actions/layers-actions.c  |    9 +++++++++
 app/actions/layers-commands.c |   12 ++++++++++++
 app/actions/layers-commands.h |    2 ++
 app/widgets/gimphelp-ids.h    |    1 +
 menus/image-menu.xml.in       |    1 +
 menus/layers-menu.xml         |    1 +
 6 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c
index efb125e..0361990 100644
--- a/app/actions/layers-actions.c
+++ b/app/actions/layers-actions.c
@@ -152,6 +152,12 @@ static const GimpActionEntry layers_actions[] =
     G_CALLBACK (layers_merge_down_cmd_callback),
     GIMP_HELP_LAYER_MERGE_DOWN },
 
+  { "layers-merge-group", NULL,
+    NC_("layers-action", "Merge Layer Group"), NULL,
+    NC_("layers-action", "Merge the layer group's layers into one normal layer"),
+    G_CALLBACK (layers_merge_group_cmd_callback),
+    GIMP_HELP_LAYER_MERGE_GROUP },
+
   { "layers-merge-layers", NULL,
     NC_("layers-action", "Merge _Visible Layers..."), NULL,
     NC_("layers-action", "Merge all visible layers into one layer"),
@@ -592,6 +598,9 @@ layers_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("layers-anchor",           layer &&  fs && !ac);
   SET_SENSITIVE ("layers-merge-down",       layer && !fs && !ac &&
                                             !children && next_visible);
+  SET_VISIBLE   ("layers-merge-group",      children);
+  SET_SENSITIVE ("layers-merge-group",      layer && !fs && !ac &&
+                                            children);
   SET_SENSITIVE ("layers-merge-layers",     layer && !fs && !ac);
   SET_SENSITIVE ("layers-flatten-image",    layer && !fs && !ac);
 
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 7bc3dbc..b18aec1 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -506,6 +506,18 @@ layers_merge_down_cmd_callback (GtkAction *action,
 }
 
 void
+layers_merge_group_cmd_callback (GtkAction *action,
+                                 gpointer   data)
+{
+  GimpImage *image;
+  GimpLayer *layer;
+  return_if_no_layer (image, layer, data);
+
+  gimp_image_merge_group_layer (image, GIMP_GROUP_LAYER (layer));
+  gimp_image_flush (image);
+}
+
+void
 layers_delete_cmd_callback (GtkAction *action,
                             gpointer   data)
 {
diff --git a/app/actions/layers-commands.h b/app/actions/layers-commands.h
index 9c9a019..6505684 100644
--- a/app/actions/layers-commands.h
+++ b/app/actions/layers-commands.h
@@ -53,6 +53,8 @@ void   layers_anchor_cmd_callback             (GtkAction   *action,
                                                gpointer     data);
 void   layers_merge_down_cmd_callback         (GtkAction   *action,
                                                gpointer     data);
+void   layers_merge_group_cmd_callback        (GtkAction   *action,
+                                               gpointer     data);
 void   layers_delete_cmd_callback             (GtkAction   *action,
                                                gpointer     data);
 void   layers_text_discard_cmd_callback       (GtkAction   *action,
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index 21827de..fc9153e 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -144,6 +144,7 @@
 #define GIMP_HELP_LAYER_DUPLICATE                 "gimp-layer-duplicate"
 #define GIMP_HELP_LAYER_ANCHOR                    "gimp-layer-anchor"
 #define GIMP_HELP_LAYER_MERGE_DOWN                "gimp-layer-merge-down"
+#define GIMP_HELP_LAYER_MERGE_GROUP               "gimp-layer-merge-group"
 #define GIMP_HELP_LAYER_DELETE                    "gimp-layer-delete"
 #define GIMP_HELP_LAYER_TEXT_DISCARD              "gimp-layer-text-discard"
 #define GIMP_HELP_LAYER_TEXT_TO_PATH              "gimp-layer-text-to-path"
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index fef0ab8..6542177 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -365,6 +365,7 @@
       <placeholder name="Structure">
         <menuitem action="layers-anchor" />
         <menuitem action="layers-merge-down" />
+        <menuitem action="layers-merge-group" />
         <menuitem action="layers-delete" />
       </placeholder>
       <separator />
diff --git a/menus/layers-menu.xml b/menus/layers-menu.xml
index 0fecd3d..6bf50b7 100644
--- a/menus/layers-menu.xml
+++ b/menus/layers-menu.xml
@@ -18,6 +18,7 @@
     <menuitem action="layers-duplicate" />
     <menuitem action="layers-anchor" />
     <menuitem action="layers-merge-down" />
+    <menuitem action="layers-merge-group" />
     <menuitem action="layers-delete" />
     <separator />
     <menuitem action="layers-text-discard" />



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