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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://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
|
|
|
{
|
2004-10-18 19:29:58 +08:00
|
|
|
{ "buffers-popup", GIMP_STOCK_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
|
|
|
|
2014-05-12 04:49:22 +08:00
|
|
|
{ "buffers-paste", "edit-paste",
|
|
|
|
NC_("buffers-action", "_Paste Buffer"), NULL,
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("buffers-action", "Paste the selected buffer"),
|
2005-01-14 21:30:05 +08:00
|
|
|
G_CALLBACK (buffers_paste_cmd_callback),
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_BUFFER_PASTE },
|
|
|
|
|
2004-04-22 00:10:00 +08:00
|
|
|
{ "buffers-paste-into", GIMP_STOCK_PASTE_INTO,
|
2008-12-03 23:27:42 +08:00
|
|
|
NC_("buffers-action", "Paste Buffer _Into"), NULL,
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("buffers-action", "Paste the selected buffer into the selection"),
|
2005-01-14 21:30:05 +08:00
|
|
|
G_CALLBACK (buffers_paste_into_cmd_callback),
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_BUFFER_PASTE_INTO },
|
|
|
|
|
|
|
|
{ "buffers-paste-as-new", GIMP_STOCK_PASTE_AS_NEW,
|
2008-12-03 23:27:42 +08:00
|
|
|
NC_("buffers-action", "Paste Buffer as _New"), NULL,
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("buffers-action", "Paste the selected buffer as a new image"),
|
2005-01-14 21:30:05 +08:00
|
|
|
G_CALLBACK (buffers_paste_as_new_cmd_callback),
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_BUFFER_PASTE_AS_NEW },
|
|
|
|
|
2014-05-12 04:49:22 +08:00
|
|
|
{ "buffers-delete", "edit-delete",
|
|
|
|
NC_("buffers-action", "_Delete Buffer"), NULL,
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("buffers-action", "Delete the selected buffer"),
|
2005-01-14 21:30:05 +08:00
|
|
|
G_CALLBACK (buffers_delete_cmd_callback),
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_BUFFER_DELETE }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
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));
|
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)
|
|
|
|
|
|
|
|
SET_SENSITIVE ("buffers-paste", buffer);
|
|
|
|
SET_SENSITIVE ("buffers-paste-into", buffer);
|
|
|
|
SET_SENSITIVE ("buffers-paste-as-new", buffer);
|
|
|
|
SET_SENSITIVE ("buffers-delete", buffer);
|
|
|
|
|
|
|
|
#undef SET_SENSITIVE
|
|
|
|
}
|