gimp r26424 - in trunk: . app/actions app/widgets menus
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26424 - in trunk: . app/actions app/widgets menus
- Date: Thu, 7 Aug 2008 16:25:47 +0000 (UTC)
Author: neo
Date: Thu Aug 7 16:25:46 2008
New Revision: 26424
URL: http://svn.gnome.org/viewvc/gimp?rev=26424&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/app/actions/edit-actions.c
trunk/app/actions/edit-commands.c
trunk/app/actions/edit-commands.h
trunk/app/widgets/gimphelp-ids.h
trunk/menus/image-menu.xml.in
Modified: trunk/app/actions/edit-actions.c
==============================================================================
--- trunk/app/actions/edit-actions.c (original)
+++ trunk/app/actions/edit-actions.c Thu Aug 7 16:25:46 2008
@@ -146,6 +146,12 @@
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 @@
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
Modified: trunk/app/actions/edit-commands.c
==============================================================================
--- trunk/app/actions/edit-commands.c (original)
+++ trunk/app/actions/edit-commands.c Thu Aug 7 16:25:46 2008
@@ -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 @@
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
{
Modified: trunk/app/actions/edit-commands.h
==============================================================================
--- trunk/app/actions/edit-commands.h (original)
+++ trunk/app/actions/edit-commands.h Thu Aug 7 16:25:46 2008
@@ -44,6 +44,8 @@
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,
Modified: trunk/app/widgets/gimphelp-ids.h
==============================================================================
--- trunk/app/widgets/gimphelp-ids.h (original)
+++ trunk/app/widgets/gimphelp-ids.h Thu Aug 7 16:25:46 2008
@@ -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"
Modified: trunk/menus/image-menu.xml.in
==============================================================================
--- trunk/menus/image-menu.xml.in (original)
+++ trunk/menus/image-menu.xml.in Thu Aug 7 16:25:46 2008
@@ -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" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]