app/actions/layers-actions.c added new action "layers-new-from-visible".

2008-08-07  Sven Neumann  <sven@gimp.org>

	* 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
This commit is contained in:
Sven Neumann 2008-08-07 15:53:15 +00:00 committed by Sven Neumann
parent c1d3d25ef2
commit 1c7a427e61
8 changed files with 69 additions and 20 deletions

View File

@ -1,3 +1,17 @@
2008-08-07 Sven Neumann <sven@gimp.org>
* 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 <tml@novell.com>
* app/main.c: Code built by the still unstable mingw-w64 toolchain

View File

@ -118,7 +118,7 @@ static const GimpActionEntry edit_actions[] =
{ "edit-copy-visible", NULL, /* GIMP_STOCK_COPY_VISIBLE, */
N_("Copy _Visible"), "<control><shift>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 },

View File

@ -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"), "<control><shift>D",
N_("Duplicate Layer"), "<control><shift>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);

View File

@ -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,

View File

@ -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,

View File

@ -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"

View File

@ -345,6 +345,7 @@
<menu action="layers-menu" name="Layer">
<placeholder name="New">
<menuitem action="layers-new" />
<menuitem action="layers-new-from-visible" />
<menuitem action="layers-duplicate" />
</placeholder>
<placeholder name="Structure">

View File

@ -7,6 +7,7 @@
<menuitem action="layers-edit-attributes" />
<separator />
<menuitem action="layers-new" />
<menuitem action="layers-new-from-visible" />
<!--
<menuitem action="layers-raise" />
<menuitem action="layers-raise-to-top" />