Commit 3ed4b3bb authored by Michael Natterer's avatar Michael Natterer 😴

app: add "paste as new layers" for the list of named buffers

and globally reorder "paste as new layer" before "paste as new image"
so it's next to "paste" and "paste into".
parent 754b9a84
......@@ -54,6 +54,12 @@ static const GimpActionEntry buffers_actions[] =
G_CALLBACK (buffers_paste_into_cmd_callback),
GIMP_HELP_BUFFER_PASTE_INTO },
{ "buffers-paste-as-new-layer", GIMP_STOCK_PASTE_AS_NEW,
NC_("buffers-action", "Paste Buffer as New _Layer"), NULL,
NC_("buffers-action", "Paste the selected buffer as a new layer"),
G_CALLBACK (buffers_paste_as_new_layer_cmd_callback),
GIMP_HELP_BUFFER_PASTE_AS_NEW_LAYER },
{ "buffers-paste-as-new-image", GIMP_STOCK_PASTE_AS_NEW,
NC_("buffers-action", "Paste Buffer as _New"), NULL,
NC_("buffers-action", "Paste the selected buffer as a new image"),
......@@ -91,6 +97,7 @@ buffers_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("buffers-paste", buffer);
SET_SENSITIVE ("buffers-paste-into", buffer);
SET_SENSITIVE ("buffers-paste-as-new-layer", buffer);
SET_SENSITIVE ("buffers-paste-as-new-image", buffer);
SET_SENSITIVE ("buffers-delete", buffer);
......
......@@ -66,6 +66,13 @@ buffers_paste_into_cmd_callback (GtkAction *action,
buffers_paste (GIMP_BUFFER_VIEW (data), GIMP_PASTE_TYPE_FLOATING_INTO);
}
void
buffers_paste_as_new_layer_cmd_callback (GtkAction *action,
gpointer data)
{
buffers_paste (GIMP_BUFFER_VIEW (data), GIMP_PASTE_TYPE_NEW_LAYER);
}
void
buffers_paste_as_new_image_cmd_callback (GtkAction *action,
gpointer data)
......
......@@ -23,6 +23,8 @@ void buffers_paste_cmd_callback (GtkAction *action,
gpointer data);
void buffers_paste_into_cmd_callback (GtkAction *action,
gpointer data);
void buffers_paste_as_new_layer_cmd_callback (GtkAction *action,
gpointer data);
void buffers_paste_as_new_image_cmd_callback (GtkAction *action,
gpointer data);
void buffers_delete_cmd_callback (GtkAction *action,
......
......@@ -139,6 +139,12 @@ static const GimpActionEntry edit_actions[] =
G_CALLBACK (edit_paste_into_cmd_callback),
GIMP_HELP_EDIT_PASTE_INTO },
{ "edit-paste-as-new-layer", NULL,
NC_("edit-action", "New _Layer"), NULL,
NC_("edit-action", "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-paste-as-new-image", GIMP_STOCK_PASTE_AS_NEW,
NC_("edit-action", "From _Clipboard"), "<primary><shift>V",
NC_("edit-action", "Create a new image from the content of the clipboard"),
......@@ -151,12 +157,6 @@ static const GimpActionEntry edit_actions[] =
G_CALLBACK (edit_paste_as_new_image_cmd_callback),
GIMP_HELP_EDIT_PASTE_AS_NEW_IMAGE },
{ "edit-paste-as-new-layer", NULL,
NC_("edit-action", "New _Layer"), NULL,
NC_("edit-action", "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", "edit-cut",
NC_("edit-action", "Cu_t Named..."), NULL,
NC_("edit-action", "Move the selected pixels to a named buffer"),
......@@ -373,13 +373,13 @@ edit_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("edit-copy", drawable);
SET_SENSITIVE ("edit-copy-visible", image);
/* "edit-paste" is always active */
SET_SENSITIVE ("edit-paste-as-new-layer", image);
SET_SENSITIVE ("edit-paste-into", image);
SET_SENSITIVE ("edit-paste-as-new-layer", image);
SET_SENSITIVE ("edit-named-cut", writable && !children);
SET_SENSITIVE ("edit-named-copy", drawable);
SET_SENSITIVE ("edit-named-copy-visible", drawable);
SET_SENSITIVE ("edit-named-paste", TRUE);
/* "edit-named-paste" is always active */
SET_SENSITIVE ("edit-clear", writable && !children);
SET_SENSITIVE ("edit-fill-fg", writable && !children);
......
......@@ -352,6 +352,16 @@ edit_paste_into_cmd_callback (GtkAction *action,
edit_paste (display, GIMP_PASTE_TYPE_FLOATING_INTO, TRUE);
}
void
edit_paste_as_new_layer_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
return_if_no_display (display, data);
edit_paste (display, GIMP_PASTE_TYPE_NEW_LAYER, FALSE);
}
void
edit_paste_as_new_image_cmd_callback (GtkAction *action,
gpointer data)
......@@ -398,16 +408,6 @@ edit_paste_as_new_image_cmd_callback (GtkAction *action,
}
}
void
edit_paste_as_new_layer_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
return_if_no_display (display, data);
edit_paste (display, GIMP_PASTE_TYPE_NEW_LAYER, FALSE);
}
void
edit_named_cut_cmd_callback (GtkAction *action,
gpointer data)
......
......@@ -44,10 +44,10 @@ void edit_paste_cmd_callback (GtkAction *action,
gpointer data);
void edit_paste_into_cmd_callback (GtkAction *action,
gpointer data);
void edit_paste_as_new_image_cmd_callback (GtkAction *action,
gpointer data);
void edit_paste_as_new_layer_cmd_callback (GtkAction *action,
gpointer data);
void edit_paste_as_new_image_cmd_callback (GtkAction *action,
gpointer data);
void edit_named_cut_cmd_callback (GtkAction *action,
gpointer data);
......
......@@ -191,6 +191,10 @@ gimp_buffer_view_new (GimpViewType view_type,
gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers",
"buffers-paste-into", NULL);
buffer_view->paste_as_new_layer_button =
gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers",
"buffers-paste-as-new-layer", NULL);
buffer_view->paste_as_new_image_button =
gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers",
"buffers-paste-as-new-image", NULL);
......@@ -205,6 +209,9 @@ gimp_buffer_view_new (GimpViewType view_type,
gimp_container_view_enable_dnd (editor->view,
GTK_BUTTON (buffer_view->paste_into_button),
GIMP_TYPE_BUFFER);
gimp_container_view_enable_dnd (editor->view,
GTK_BUTTON (buffer_view->paste_as_new_layer_button),
GIMP_TYPE_BUFFER);
gimp_container_view_enable_dnd (editor->view,
GTK_BUTTON (buffer_view->paste_as_new_image_button),
GIMP_TYPE_BUFFER);
......
......@@ -44,6 +44,7 @@ struct _GimpBufferView
GtkWidget *paste_button;
GtkWidget *paste_into_button;
GtkWidget *paste_as_new_layer_button;
GtkWidget *paste_as_new_image_button;
GtkWidget *delete_button;
};
......
......@@ -57,8 +57,8 @@
#define GIMP_HELP_EDIT_COPY_VISIBLE "gimp-edit-copy-visible"
#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_IMAGE "gimp-edit-paste-as-new-image"
#define GIMP_HELP_EDIT_PASTE_AS_NEW_LAYER "gimp-edit-paste-as-new-layer"
#define GIMP_HELP_EDIT_PASTE_AS_NEW_IMAGE "gimp-edit-paste-as-new-image"
#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"
......@@ -442,6 +442,7 @@
#define GIMP_HELP_BUFFER_COPY "gimp-buffer-copy"
#define GIMP_HELP_BUFFER_PASTE "gimp-buffer-paste"
#define GIMP_HELP_BUFFER_PASTE_INTO "gimp-buffer-paste-into"
#define GIMP_HELP_BUFFER_PASTE_AS_NEW_LAYER "gimp-buffer-paste-as-new-layer"
#define GIMP_HELP_BUFFER_PASTE_AS_NEW_IMAGE "gimp-buffer-paste-as-new-image"
#define GIMP_HELP_BUFFER_DELETE "gimp-buffer-delete"
......
......@@ -5,6 +5,7 @@
<popup action="buffers-popup">
<menuitem action="buffers-paste" />
<menuitem action="buffers-paste-into" />
<menuitem action="buffers-paste-as-new-layer" />
<menuitem action="buffers-paste-as-new-image" />
<menuitem action="buffers-delete" />
<separator />
......
......@@ -196,8 +196,8 @@
<menuitem action="edit-paste-into" />
</placeholder>
<menu action="edit-paste-as-menu" name="Paste as">
<menuitem action="edit-paste-as-new-image-short" />
<menuitem action="edit-paste-as-new-layer" />
<menuitem action="edit-paste-as-new-image-short" />
</menu>
<menu action="edit-buffer-menu" name="Buffer">
<menuitem action="edit-named-cut" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment