2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2004-04-19 22:54:24 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2004-04-19 22:54:24 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-04-19 22:54:24 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2004-04-19 22:54:24 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2012-03-30 01:19:01 +08:00
|
|
|
#include <gegl.h>
|
2004-04-19 22:54:24 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
|
|
#include "actions-types.h"
|
|
|
|
|
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
|
|
|
|
#include "widgets/gimpactiongroup.h"
|
|
|
|
#include "widgets/gimphelp-ids.h"
|
|
|
|
|
2004-05-12 00:05:21 +08:00
|
|
|
#include "actions.h"
|
2004-04-19 22:54:24 +08:00
|
|
|
#include "buffers-actions.h"
|
2004-04-20 21:25:55 +08:00
|
|
|
#include "buffers-commands.h"
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
|
|
|
|
2006-04-10 16:06:18 +08:00
|
|
|
static const GimpActionEntry buffers_actions[] =
|
2004-04-19 22:54:24 +08:00
|
|
|
{
|
2017-03-05 23:01:59 +08:00
|
|
|
{ "buffers-popup", GIMP_ICON_BUFFER,
|
2008-12-03 23:27:42 +08:00
|
|
|
NC_("buffers-action", "Buffers Menu"), NULL, NULL, NULL,
|
2004-05-02 16:56:07 +08:00
|
|
|
GIMP_HELP_BUFFER_DIALOG },
|
2004-04-22 00:10:00 +08:00
|
|
|
|
2017-11-13 01:41:05 +08:00
|
|
|
{ "buffers-paste-as-new-image", GIMP_ICON_EDIT_PASTE_AS_NEW,
|
|
|
|
NC_("buffers-action", "Paste Buffer as _New Image"), NULL,
|
|
|
|
NC_("buffers-action", "Paste the selected buffer as a new image"),
|
2019-07-04 07:11:48 +08:00
|
|
|
buffers_paste_as_new_image_cmd_callback,
|
2017-11-13 01:41:05 +08:00
|
|
|
GIMP_HELP_BUFFER_PASTE_AS_NEW_IMAGE },
|
|
|
|
|
|
|
|
{ "buffers-delete", GIMP_ICON_EDIT_DELETE,
|
|
|
|
NC_("buffers-action", "_Delete Buffer"), NULL,
|
|
|
|
NC_("buffers-action", "Delete the selected buffer"),
|
2019-07-04 07:11:48 +08:00
|
|
|
buffers_delete_cmd_callback,
|
2017-11-13 01:41:05 +08:00
|
|
|
GIMP_HELP_BUFFER_DELETE }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const GimpEnumActionEntry buffers_paste_actions[] =
|
|
|
|
{
|
2017-03-05 23:01:59 +08:00
|
|
|
{ "buffers-paste", GIMP_ICON_EDIT_PASTE,
|
2014-05-12 04:49:22 +08:00
|
|
|
NC_("buffers-action", "_Paste Buffer"), NULL,
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("buffers-action", "Paste the selected buffer"),
|
2017-11-13 01:41:05 +08:00
|
|
|
GIMP_PASTE_TYPE_FLOATING, FALSE,
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_BUFFER_PASTE },
|
|
|
|
|
2017-11-13 01:41:05 +08:00
|
|
|
{ "buffers-paste-in-place", GIMP_ICON_EDIT_PASTE,
|
|
|
|
NC_("buffers-action", "Paste Buffer In Pl_ace"), NULL,
|
|
|
|
NC_("buffers-action", "Paste the selected buffer at its original position"),
|
|
|
|
GIMP_PASTE_TYPE_FLOATING_IN_PLACE, FALSE,
|
|
|
|
GIMP_HELP_BUFFER_PASTE_IN_PLACE },
|
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
{ "buffers-paste-into", GIMP_ICON_EDIT_PASTE_INTO,
|
2017-11-13 06:39:41 +08:00
|
|
|
NC_("buffers-action", "Paste Buffer _Into The Selection"), NULL,
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("buffers-action", "Paste the selected buffer into the selection"),
|
2017-11-13 01:41:05 +08:00
|
|
|
GIMP_PASTE_TYPE_FLOATING_INTO, FALSE,
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_BUFFER_PASTE_INTO },
|
|
|
|
|
2017-11-13 01:41:05 +08:00
|
|
|
{ "buffers-paste-into-in-place", GIMP_ICON_EDIT_PASTE_INTO,
|
2017-11-13 06:39:41 +08:00
|
|
|
NC_("buffers-action", "Paste Buffer Into The Selection In Place"), NULL,
|
2017-11-13 01:41:05 +08:00
|
|
|
NC_("buffers-action",
|
|
|
|
"Paste the selected buffer into the selection at its original position"),
|
|
|
|
GIMP_PASTE_TYPE_FLOATING_INTO_IN_PLACE, FALSE,
|
|
|
|
GIMP_HELP_BUFFER_PASTE_INTO_IN_PLACE },
|
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
{ "buffers-paste-as-new-layer", GIMP_ICON_EDIT_PASTE_AS_NEW,
|
2016-09-21 02:43:01 +08:00
|
|
|
NC_("buffers-action", "Paste Buffer as New _Layer"), NULL,
|
|
|
|
NC_("buffers-action", "Paste the selected buffer as a new layer"),
|
2017-11-13 01:41:05 +08:00
|
|
|
GIMP_PASTE_TYPE_NEW_LAYER, FALSE,
|
2016-09-21 02:43:01 +08:00
|
|
|
GIMP_HELP_BUFFER_PASTE_AS_NEW_LAYER },
|
|
|
|
|
2017-11-13 01:41:05 +08:00
|
|
|
{ "buffers-paste-as-new-layer-in-place", GIMP_ICON_EDIT_PASTE_AS_NEW,
|
|
|
|
NC_("buffers-action", "Paste Buffer as New Layer in Place"), NULL,
|
|
|
|
NC_("buffers-action",
|
|
|
|
"Paste the selected buffer as a new layer at its original position"),
|
|
|
|
GIMP_PASTE_TYPE_NEW_LAYER_IN_PLACE, FALSE,
|
|
|
|
GIMP_HELP_BUFFER_PASTE_AS_NEW_LAYER_IN_PLACE },
|
2004-04-19 22:54:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2004-04-27 21:55:26 +08:00
|
|
|
buffers_actions_setup (GimpActionGroup *group)
|
2004-04-19 22:54:24 +08:00
|
|
|
{
|
2008-12-03 23:27:42 +08:00
|
|
|
gimp_action_group_add_actions (group, "buffers-action",
|
2004-04-19 22:54:24 +08:00
|
|
|
buffers_actions,
|
2004-04-27 21:55:26 +08:00
|
|
|
G_N_ELEMENTS (buffers_actions));
|
2017-11-13 01:41:05 +08:00
|
|
|
|
|
|
|
gimp_action_group_add_enum_actions (group, "buffers-action",
|
|
|
|
buffers_paste_actions,
|
|
|
|
G_N_ELEMENTS (buffers_paste_actions),
|
2019-07-04 07:11:48 +08:00
|
|
|
buffers_paste_cmd_callback);
|
2004-04-19 22:54:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
buffers_actions_update (GimpActionGroup *group,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2004-10-18 19:29:58 +08:00
|
|
|
GimpContext *context = action_data_get_context (data);
|
|
|
|
GimpBuffer *buffer = NULL;
|
2004-04-19 22:54:24 +08:00
|
|
|
|
2004-05-12 00:05:21 +08:00
|
|
|
if (context)
|
|
|
|
buffer = gimp_context_get_buffer (context);
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
#define SET_SENSITIVE(action,condition) \
|
|
|
|
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
|
|
|
|
|
2017-11-13 01:41:05 +08:00
|
|
|
SET_SENSITIVE ("buffers-paste", buffer);
|
|
|
|
SET_SENSITIVE ("buffers-paste-in-place", buffer);
|
|
|
|
SET_SENSITIVE ("buffers-paste-into", buffer);
|
|
|
|
SET_SENSITIVE ("buffers-paste-into-in-place", buffer);
|
|
|
|
SET_SENSITIVE ("buffers-paste-as-new-layer", buffer);
|
|
|
|
SET_SENSITIVE ("buffers-paste-as-new-layer-in-place", buffer);
|
|
|
|
SET_SENSITIVE ("buffers-paste-as-new-image", buffer);
|
|
|
|
SET_SENSITIVE ("buffers-delete", buffer);
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
#undef SET_SENSITIVE
|
|
|
|
}
|