From 1c7a427e614cbb97b025f7b8b21c58ed3dc386ef Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 7 Aug 2008 15:53:15 +0000 Subject: [PATCH] app/actions/layers-actions.c added new action "layers-new-from-visible". 2008-08-07 Sven Neumann * app/actions/layers-actions.c * app/actions/layers-commands.[ch]: added new action "layers-new-from-visible". * app/widgets/gimphelp-ids.h: added new help-id. * menus/layers-menu.xml * menus/image-menu.xml.in: added the new action. * app/actions/edit-actions.c: improved the blurb for "edit-copy-visible". svn path=/trunk/; revision=26421 --- ChangeLog | 14 +++++++++++ app/actions/edit-actions.c | 2 +- app/actions/layers-actions.c | 45 ++++++++++++++++++++--------------- app/actions/layers-commands.c | 22 +++++++++++++++++ app/actions/layers-commands.h | 3 +++ app/widgets/gimphelp-ids.h | 1 + menus/image-menu.xml.in | 1 + menus/layers-menu.xml | 1 + 8 files changed, 69 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ecd5219cf..9d19475e21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2008-08-07 Sven Neumann + + * app/actions/layers-actions.c + * app/actions/layers-commands.[ch]: added new action + "layers-new-from-visible". + + * app/widgets/gimphelp-ids.h: added new help-id. + + * menus/layers-menu.xml + * menus/image-menu.xml.in: added the new action. + + * app/actions/edit-actions.c: improved the blurb for + "edit-copy-visible". + 2008-08-07 Tor Lillqvist * app/main.c: Code built by the still unstable mingw-w64 toolchain diff --git a/app/actions/edit-actions.c b/app/actions/edit-actions.c index f4a2b04503..9b51328257 100644 --- a/app/actions/edit-actions.c +++ b/app/actions/edit-actions.c @@ -118,7 +118,7 @@ static const GimpActionEntry edit_actions[] = { "edit-copy-visible", NULL, /* GIMP_STOCK_COPY_VISIBLE, */ N_("Copy _Visible"), "C", - N_("Copy the selected region to the clipboard"), + N_("Copy what is visible in the the selected region"), G_CALLBACK (edit_copy_visible_cmd_callback), GIMP_HELP_EDIT_COPY_VISIBLE }, diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c index e5ee4125d1..84e180a9bc 100644 --- a/app/actions/layers-actions.c +++ b/app/actions/layers-actions.c @@ -82,8 +82,14 @@ static const GimpActionEntry layers_actions[] = G_CALLBACK (layers_new_last_vals_cmd_callback), GIMP_HELP_LAYER_NEW }, + { "layers-new-from-visible", NULL, + N_("New from Visible"), NULL, + N_("Create a new layer from what is visible in this image"), + G_CALLBACK (layers_new_from_visible_cmd_callback), + GIMP_HELP_LAYER_NEW_FROM_VISIBLE }, + { "layers-duplicate", GIMP_STOCK_DUPLICATE, - N_("D_uplicate Layer"), "D", + N_("Duplicate Layer"), "D", N_("Create a duplicate of the layer and add it to the image"), G_CALLBACK (layers_duplicate_cmd_callback), GIMP_HELP_LAYER_DUPLICATE }, @@ -510,28 +516,29 @@ layers_actions_update (GimpActionGroup *group, #define SET_ACTIVE(action,condition) \ gimp_action_group_set_action_active (group, action, (condition) != 0) - SET_VISIBLE ("layers-text-tool", text_layer && !ac); - SET_SENSITIVE ("layers-edit-attributes", layer && !fs && !ac); + SET_VISIBLE ("layers-text-tool", text_layer && !ac); + SET_SENSITIVE ("layers-edit-attributes", layer && !fs && !ac); - SET_SENSITIVE ("layers-new", image); - SET_SENSITIVE ("layers-new-last-values", image); - SET_SENSITIVE ("layers-duplicate", layer && !fs && !ac); - SET_SENSITIVE ("layers-delete", layer && !ac); + SET_SENSITIVE ("layers-new", image); + SET_SENSITIVE ("layers-new-last-values", image); + SET_SENSITIVE ("layers-new-from-visible", image); + SET_SENSITIVE ("layers-duplicate", layer && !fs && !ac); + SET_SENSITIVE ("layers-delete", layer && !ac); - SET_SENSITIVE ("layers-select-top", layer && !fs && !ac && prev); - SET_SENSITIVE ("layers-select-bottom", layer && !fs && !ac && next); - SET_SENSITIVE ("layers-select-previous", layer && !fs && !ac && prev); - SET_SENSITIVE ("layers-select-next", layer && !fs && !ac && next); + SET_SENSITIVE ("layers-select-top", layer && !fs && !ac && prev); + SET_SENSITIVE ("layers-select-bottom", layer && !fs && !ac && next); + SET_SENSITIVE ("layers-select-previous", layer && !fs && !ac && prev); + SET_SENSITIVE ("layers-select-next", layer && !fs && !ac && next); - SET_SENSITIVE ("layers-raise", layer && !fs && !ac && prev); - SET_SENSITIVE ("layers-raise-to-top", layer && !fs && !ac && prev); - SET_SENSITIVE ("layers-lower", layer && !fs && !ac && next); - SET_SENSITIVE ("layers-lower-to-bottom", layer && !fs && !ac && next); + SET_SENSITIVE ("layers-raise", layer && !fs && !ac && prev); + SET_SENSITIVE ("layers-raise-to-top", layer && !fs && !ac && prev); + SET_SENSITIVE ("layers-lower", layer && !fs && !ac && next); + SET_SENSITIVE ("layers-lower-to-bottom", layer && !fs && !ac && next); - SET_SENSITIVE ("layers-anchor", layer && fs && !ac); - SET_SENSITIVE ("layers-merge-down", layer && !fs && !ac && next); - SET_SENSITIVE ("layers-merge-layers", layer && !fs && !ac); - SET_SENSITIVE ("layers-flatten-image", layer && !fs && !ac); + SET_SENSITIVE ("layers-anchor", layer && fs && !ac); + SET_SENSITIVE ("layers-merge-down", layer && !fs && !ac && next); + SET_SENSITIVE ("layers-merge-layers", layer && !fs && !ac); + SET_SENSITIVE ("layers-flatten-image", layer && !fs && !ac); SET_VISIBLE ("layers-text-discard", text_layer && !ac); SET_VISIBLE ("layers-text-to-vectors", text_layer && !ac); diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index 25ee9f2bd9..8f9170c4ff 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -41,6 +41,7 @@ #include "core/gimplayer.h" #include "core/gimplayer-floating-sel.h" #include "core/gimplayermask.h" +#include "core/gimpprojection.h" #include "core/gimptoolinfo.h" #include "core/gimpundostack.h" #include "core/gimpprogress.h" @@ -334,6 +335,27 @@ layers_new_last_vals_cmd_callback (GtkAction *action, gimp_image_flush (image); } +void +layers_new_from_visible_cmd_callback (GtkAction *action, + gpointer data) +{ + GimpImage *image; + GimpLayer *layer; + GimpProjection *projection; + return_if_no_image (image, data); + + projection = gimp_image_get_projection (image); + + layer = gimp_layer_new_from_tiles (gimp_projection_get_tiles (projection), + image, + gimp_projection_get_image_type (projection), + _("Visible"), + GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE); + gimp_image_add_layer (image, layer, -1); + + gimp_image_flush (image); +} + void layers_select_cmd_callback (GtkAction *action, gint value, diff --git a/app/actions/layers-commands.h b/app/actions/layers-commands.h index 6b0feb782e..769c34ab29 100644 --- a/app/actions/layers-commands.h +++ b/app/actions/layers-commands.h @@ -24,10 +24,13 @@ void layers_text_tool_cmd_callback (GtkAction *action, gpointer data); void layers_edit_attributes_cmd_callback (GtkAction *action, gpointer data); + void layers_new_cmd_callback (GtkAction *action, gpointer data); void layers_new_last_vals_cmd_callback (GtkAction *action, gpointer data); +void layers_new_from_visible_cmd_callback (GtkAction *action, + gpointer data); void layers_select_cmd_callback (GtkAction *action, gint value, diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h index c0db4bcd82..9ec7c8dacb 100644 --- a/app/widgets/gimphelp-ids.h +++ b/app/widgets/gimphelp-ids.h @@ -136,6 +136,7 @@ #define GIMP_HELP_LAYER_DIALOG_LOCK_ALPHA_BUTTON "gimp-layer-dialog-lock-alpha-button" #define GIMP_HELP_LAYER_NEW "gimp-layer-new" +#define GIMP_HELP_LAYER_NEW_FROM_VISIBLE "gimp-layer-new-from-visible" #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" diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in index 482e0644fb..3608ef3920 100644 --- a/menus/image-menu.xml.in +++ b/menus/image-menu.xml.in @@ -345,6 +345,7 @@ + diff --git a/menus/layers-menu.xml b/menus/layers-menu.xml index 21d867e92d..8909fe5845 100644 --- a/menus/layers-menu.xml +++ b/menus/layers-menu.xml @@ -7,6 +7,7 @@ +