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 "templates-actions.h"
|
2004-04-20 21:25:55 +08:00
|
|
|
#include "templates-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 templates_actions[] =
|
2004-04-19 22:54:24 +08:00
|
|
|
{
|
2004-10-18 19:29:58 +08:00
|
|
|
{ "templates-popup", GIMP_STOCK_TEMPLATE,
|
2008-12-03 23:27:42 +08:00
|
|
|
NC_("templates-action", "Templates Menu"), NULL, NULL, NULL,
|
2004-05-02 16:56:07 +08:00
|
|
|
GIMP_HELP_TEMPLATE_DIALOG },
|
2004-04-22 00:10:00 +08:00
|
|
|
|
2004-04-19 22:54:24 +08:00
|
|
|
{ "templates-create-image", GIMP_STOCK_IMAGE,
|
2008-12-03 23:27:42 +08:00
|
|
|
NC_("templates-action", "_Create Image from Template"), "",
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("templates-action", "Create a new image from the selected template"),
|
2004-04-19 22:54:24 +08:00
|
|
|
G_CALLBACK (templates_create_image_cmd_callback),
|
|
|
|
GIMP_HELP_TEMPLATE_IMAGE_NEW },
|
|
|
|
|
|
|
|
{ "templates-new", GTK_STOCK_NEW,
|
2008-12-03 23:27:42 +08:00
|
|
|
NC_("templates-action", "_New Template..."), "",
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("templates-action", "Create a new template"),
|
2005-01-14 21:30:05 +08:00
|
|
|
G_CALLBACK (templates_new_cmd_callback),
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_TEMPLATE_NEW },
|
|
|
|
|
|
|
|
{ "templates-duplicate", GIMP_STOCK_DUPLICATE,
|
2008-12-03 23:27:42 +08:00
|
|
|
NC_("templates-action", "D_uplicate Template..."), "",
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("templates-action", "Duplicate this template"),
|
2005-01-14 21:30:05 +08:00
|
|
|
G_CALLBACK (templates_duplicate_cmd_callback),
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_TEMPLATE_DUPLICATE },
|
|
|
|
|
2005-09-19 21:07:24 +08:00
|
|
|
{ "templates-edit", GTK_STOCK_EDIT,
|
2008-12-03 23:27:42 +08:00
|
|
|
NC_("templates-action", "_Edit Template..."), "",
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("templates-action", "Edit this template"),
|
2005-01-14 21:30:05 +08:00
|
|
|
G_CALLBACK (templates_edit_cmd_callback),
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_TEMPLATE_EDIT },
|
|
|
|
|
|
|
|
{ "templates-delete", GTK_STOCK_DELETE,
|
2008-12-03 23:27:42 +08:00
|
|
|
NC_("templates-action", "_Delete Template"), "",
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("templates-action", "Delete this template"),
|
2005-01-14 21:30:05 +08:00
|
|
|
G_CALLBACK (templates_delete_cmd_callback),
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_TEMPLATE_DELETE }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2004-04-27 21:55:26 +08:00
|
|
|
templates_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, "templates-action",
|
2004-04-19 22:54:24 +08:00
|
|
|
templates_actions,
|
2004-04-27 21:55:26 +08:00
|
|
|
G_N_ELEMENTS (templates_actions));
|
2004-04-19 22:54:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
templates_actions_update (GimpActionGroup *group,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2004-10-18 19:29:58 +08:00
|
|
|
GimpContext *context = action_data_get_context (data);
|
2004-05-12 00:05:21 +08:00
|
|
|
GimpTemplate *template = NULL;
|
2004-04-19 22:54:24 +08:00
|
|
|
|
2004-05-12 00:05:21 +08:00
|
|
|
if (context)
|
|
|
|
template = gimp_context_get_template (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 ("templates-create-image", template);
|
2004-10-18 19:29:58 +08:00
|
|
|
SET_SENSITIVE ("templates-new", context);
|
2004-04-19 22:54:24 +08:00
|
|
|
SET_SENSITIVE ("templates-duplicate", template);
|
|
|
|
SET_SENSITIVE ("templates-edit", template);
|
|
|
|
SET_SENSITIVE ("templates-delete", template);
|
|
|
|
|
|
|
|
#undef SET_SENSITIVE
|
|
|
|
}
|