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



commit 3ed4b3bbeca4b812f82fe94968ad118b181a322d
Author: Michael Natterer <mitch gimp org>
Date:   Tue Sep 20 20:43:01 2016 +0200

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

 app/actions/buffers-actions.c  |    7 +++++++
 app/actions/buffers-commands.c |    7 +++++++
 app/actions/buffers-commands.h |    2 ++
 app/actions/edit-actions.c     |   16 ++++++++--------
 app/actions/edit-commands.c    |   20 ++++++++++----------
 app/actions/edit-commands.h    |    4 ++--
 app/widgets/gimpbufferview.c   |    7 +++++++
 app/widgets/gimpbufferview.h   |    1 +
 app/widgets/gimphelp-ids.h     |    3 ++-
 menus/buffers-menu.xml         |    1 +
 menus/image-menu.xml.in        |    2 +-
 11 files changed, 48 insertions(+), 22 deletions(-)
---
diff --git a/app/actions/buffers-actions.c b/app/actions/buffers-actions.c
index 91bf0ff..488d08f 100644
--- a/app/actions/buffers-actions.c
+++ b/app/actions/buffers-actions.c
@@ -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);
 
diff --git a/app/actions/buffers-commands.c b/app/actions/buffers-commands.c
index 813e1c1..11c14a0 100644
--- a/app/actions/buffers-commands.c
+++ b/app/actions/buffers-commands.c
@@ -67,6 +67,13 @@ buffers_paste_into_cmd_callback (GtkAction *action,
 }
 
 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)
 {
diff --git a/app/actions/buffers-commands.h b/app/actions/buffers-commands.h
index 36b462c..8c4dcf5 100644
--- a/app/actions/buffers-commands.h
+++ b/app/actions/buffers-commands.h
@@ -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,
diff --git a/app/actions/edit-actions.c b/app/actions/edit-actions.c
index 6b3ec04..96fcd1a 100644
--- a/app/actions/edit-actions.c
+++ b/app/actions/edit-actions.c
@@ -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);
diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c
index f571775..6da6710 100644
--- a/app/actions/edit-commands.c
+++ b/app/actions/edit-commands.c
@@ -353,6 +353,16 @@ edit_paste_into_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_paste_as_new_image_cmd_callback (GtkAction *action,
                                       gpointer   data)
 {
@@ -399,16 +409,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)
 {
diff --git a/app/actions/edit-commands.h b/app/actions/edit-commands.h
index f52edd0..940dcc7 100644
--- a/app/actions/edit-commands.h
+++ b/app/actions/edit-commands.h
@@ -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);
diff --git a/app/widgets/gimpbufferview.c b/app/widgets/gimpbufferview.c
index 2b3366d..5f605af 100644
--- a/app/widgets/gimpbufferview.c
+++ b/app/widgets/gimpbufferview.c
@@ -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);
@@ -206,6 +210,9 @@ gimp_buffer_view_new (GimpViewType     view_type,
                                   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);
   gimp_container_view_enable_dnd (editor->view,
diff --git a/app/widgets/gimpbufferview.h b/app/widgets/gimpbufferview.h
index 6f9b415..5438cac 100644
--- a/app/widgets/gimpbufferview.h
+++ b/app/widgets/gimpbufferview.h
@@ -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;
 };
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index 872c0ca..58233e9 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -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"
 
diff --git a/menus/buffers-menu.xml b/menus/buffers-menu.xml
index 8d35d03..840ef61 100644
--- a/menus/buffers-menu.xml
+++ b/menus/buffers-menu.xml
@@ -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 />
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index e98a77b..682fbf0 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -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" />


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]