mirror of https://github.com/GNOME/gimp.git
app/actions/edit-commands.[ch] added new action "edit-paste-as-new-layer".
2008-08-07 Sven Neumann <sven@gimp.org> * app/actions/edit-commands.[ch] * app/actions/edit-actions.c: added new action "edit-paste-as-new-layer". * app/widgets/gimphelp-ids.h: added new help-id. * menus/image-menu.xml.in: added the new action. svn path=/trunk/; revision=26424
This commit is contained in:
parent
cf87743457
commit
7ee3d7f448
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2008-08-07 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/actions/edit-commands.[ch]
|
||||
* app/actions/edit-actions.c: added new action
|
||||
"edit-paste-as-new-layer".
|
||||
|
||||
* app/widgets/gimphelp-ids.h: added new help-id.
|
||||
|
||||
* menus/image-menu.xml.in: added the new action.
|
||||
|
||||
2008-08-07 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* app/config/gimpbaseconfig.c (gimp_base_config_class_init): Use
|
||||
|
|
|
@ -146,6 +146,12 @@ static const GimpActionEntry edit_actions[] =
|
|||
G_CALLBACK (edit_paste_as_new_cmd_callback),
|
||||
GIMP_HELP_EDIT_PASTE_AS_NEW },
|
||||
|
||||
{ "edit-paste-as-new-layer", NULL,
|
||||
N_("New _Layer"), NULL,
|
||||
N_("Create a new layer from the content of the clipboard"),
|
||||
G_CALLBACK (edit_paste_as_new_layer_cmd_callback),
|
||||
GIMP_HELP_EDIT_PASTE_AS_NEW_LAYER },
|
||||
|
||||
{ "edit-named-cut", GTK_STOCK_CUT,
|
||||
N_("Cu_t Named..."), "",
|
||||
N_("Move the selected pixels to a named buffer"),
|
||||
|
@ -314,21 +320,22 @@ edit_actions_update (GimpActionGroup *group,
|
|||
g_free (redo_name);
|
||||
g_free (fade_name);
|
||||
|
||||
SET_SENSITIVE ("edit-cut", drawable);
|
||||
SET_SENSITIVE ("edit-copy", drawable);
|
||||
SET_SENSITIVE ("edit-copy-visible", image);
|
||||
SET_SENSITIVE ("edit-cut", drawable);
|
||||
SET_SENSITIVE ("edit-copy", drawable);
|
||||
SET_SENSITIVE ("edit-copy-visible", image);
|
||||
/* "edit-paste" is always enabled */
|
||||
SET_SENSITIVE ("edit-paste-into", image);
|
||||
SET_SENSITIVE ("edit-paste-as-new-layer", image);
|
||||
SET_SENSITIVE ("edit-paste-into", image);
|
||||
|
||||
SET_SENSITIVE ("edit-named-cut", drawable);
|
||||
SET_SENSITIVE ("edit-named-copy", drawable);
|
||||
SET_SENSITIVE ("edit-named-copy-visible", drawable);
|
||||
SET_SENSITIVE ("edit-named-paste", image);
|
||||
|
||||
SET_SENSITIVE ("edit-clear", drawable);
|
||||
SET_SENSITIVE ("edit-fill-fg", drawable);
|
||||
SET_SENSITIVE ("edit-fill-bg", drawable);
|
||||
SET_SENSITIVE ("edit-fill-pattern", drawable);
|
||||
SET_SENSITIVE ("edit-clear", drawable);
|
||||
SET_SENSITIVE ("edit-fill-fg", drawable);
|
||||
SET_SENSITIVE ("edit-fill-bg", drawable);
|
||||
SET_SENSITIVE ("edit-fill-pattern", drawable);
|
||||
|
||||
#undef SET_LABEL
|
||||
#undef SET_SENSITIVE
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-undo.h"
|
||||
#include "core/gimpprojection.h"
|
||||
|
||||
#include "vectors/gimpvectors-import.h"
|
||||
|
||||
|
@ -300,14 +301,48 @@ edit_paste_as_new_cmd_callback (GtkAction *action,
|
|||
|
||||
image = gimp_edit_paste_as_new (gimp, action_data_get_image (data),
|
||||
buffer);
|
||||
g_object_unref (buffer);
|
||||
|
||||
if (image)
|
||||
{
|
||||
gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0);
|
||||
g_object_unref (image);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_message (gimp, NULL, GIMP_MESSAGE_WARNING,
|
||||
_("There is no image data in the clipboard to paste."));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
edit_paste_as_new_layer_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
Gimp *gimp;
|
||||
GimpImage *image;
|
||||
GimpBuffer *buffer;
|
||||
return_if_no_gimp (gimp, data);
|
||||
return_if_no_image (image, data);
|
||||
|
||||
buffer = gimp_clipboard_get_buffer (gimp);
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
GimpProjection *projection = gimp_image_get_projection (image);
|
||||
GimpImage *layer;
|
||||
|
||||
layer = gimp_layer_new_from_tiles (gimp_projection_get_tiles (projection),
|
||||
image,
|
||||
gimp_projection_get_image_type (projection),
|
||||
_("Clibboard"),
|
||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
|
||||
g_object_unref (buffer);
|
||||
|
||||
gimp_image_add_layer (image, layer, -1);
|
||||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -44,6 +44,8 @@ void edit_paste_into_cmd_callback (GtkAction *action,
|
|||
gpointer data);
|
||||
void edit_paste_as_new_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void edit_paste_as_new_layer_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void edit_named_cut_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void edit_named_copy_cmd_callback (GtkAction *action,
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#define GIMP_HELP_EDIT_PASTE "gimp-edit-paste"
|
||||
#define GIMP_HELP_EDIT_PASTE_INTO "gimp-edit-paste-into"
|
||||
#define GIMP_HELP_EDIT_PASTE_AS_NEW "gimp-edit-paste-as-new"
|
||||
#define GIMP_HELP_EDIT_PASTE_AS_NEW_LAYER "gimp-edit-paste-as-new-layer"
|
||||
#define GIMP_HELP_EDIT_CLEAR "gimp-edit-clear"
|
||||
#define GIMP_HELP_EDIT_FILL_FG "gimp-edit-fill-fg"
|
||||
#define GIMP_HELP_EDIT_FILL_BG "gimp-edit-fill-bg"
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
</placeholder>
|
||||
<menu action="edit-paste-as-menu" name="Paste as">
|
||||
<menuitem action="edit-paste-as-new-short" />
|
||||
<menuitem action="edit-paste-as-new-layer" />
|
||||
</menu>
|
||||
<menu action="edit-buffer-menu" name="Buffer">
|
||||
<menuitem action="edit-named-cut" />
|
||||
|
|
Loading…
Reference in New Issue