2004-04-19 22:54:24 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (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
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
|
|
#include "actions-types.h"
|
|
|
|
|
|
|
|
#include "core/gimpimage.h"
|
|
|
|
#include "core/gimplayer.h"
|
2004-09-15 21:24:45 +08:00
|
|
|
#include "core/gimplayermask.h"
|
2004-04-19 22:54:24 +08:00
|
|
|
#include "core/gimplist.h"
|
|
|
|
|
|
|
|
#include "text/gimptextlayer.h"
|
|
|
|
|
|
|
|
#include "widgets/gimphelp-ids.h"
|
|
|
|
#include "widgets/gimpactiongroup.h"
|
|
|
|
|
2004-05-03 22:03:51 +08:00
|
|
|
#include "actions.h"
|
2004-05-25 22:37:02 +08:00
|
|
|
#include "image-commands.h"
|
2004-04-19 22:54:24 +08:00
|
|
|
#include "layers-actions.h"
|
2004-04-20 21:25:55 +08:00
|
|
|
#include "layers-commands.h"
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
|
|
|
|
|
|
|
static GimpActionEntry layers_actions[] =
|
|
|
|
{
|
2004-10-18 19:29:58 +08:00
|
|
|
{ "layers-popup", GIMP_STOCK_LAYERS,
|
|
|
|
N_("Layers Menu"), NULL, NULL, NULL,
|
2004-05-02 16:56:07 +08:00
|
|
|
GIMP_HELP_LAYER_DIALOG },
|
2004-04-23 00:16:43 +08:00
|
|
|
|
2004-09-15 23:06:08 +08:00
|
|
|
{ "layers-menu", NULL, N_("_Layer") },
|
|
|
|
{ "layers-stack-menu", NULL, N_("Stac_k") },
|
|
|
|
{ "layers-colors-menu", NULL, N_("_Colors") },
|
|
|
|
{ "layers-colors-auto-menu", NULL, N_("_Auto") },
|
|
|
|
{ "layers-mask-menu", NULL, N_("_Mask") },
|
|
|
|
{ "layers-transparency-menu", NULL, N_("Tr_ansparency") },
|
|
|
|
{ "layers-transform-menu", NULL, N_("_Transform") },
|
|
|
|
{ "layers-properties-menu", NULL, N_("_Properties") },
|
|
|
|
{ "layers-opacity-menu", GIMP_STOCK_TRANSPARENCY, N_("_Opacity") },
|
|
|
|
{ "layers-mode-menu", GIMP_STOCK_TOOL_PENCIL, N_("Layer _Mode") },
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
{ "layers-text-tool", GIMP_STOCK_TOOL_TEXT,
|
|
|
|
N_("Te_xt Tool"), NULL, NULL,
|
|
|
|
G_CALLBACK (layers_text_tool_cmd_callback),
|
|
|
|
GIMP_HELP_TOOL_TEXT },
|
|
|
|
|
|
|
|
{ "layers-edit-attributes", GIMP_STOCK_EDIT,
|
2004-10-16 23:48:23 +08:00
|
|
|
N_("_Edit Layer Attributes..."), NULL,
|
|
|
|
N_("Edit layer attributes"),
|
2004-04-19 22:54:24 +08:00
|
|
|
G_CALLBACK (layers_edit_attributes_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_EDIT },
|
|
|
|
|
|
|
|
{ "layers-new", GTK_STOCK_NEW,
|
2004-10-16 23:48:23 +08:00
|
|
|
N_("_New Layer..."), "",
|
2004-10-23 08:53:48 +08:00
|
|
|
N_("New layer..."),
|
2004-04-19 22:54:24 +08:00
|
|
|
G_CALLBACK (layers_new_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_NEW },
|
|
|
|
|
2004-10-23 08:53:48 +08:00
|
|
|
{ "layers-new-last-values", GTK_STOCK_NEW,
|
2004-10-16 23:48:23 +08:00
|
|
|
N_("_New Layer"), "",
|
2004-10-23 08:53:48 +08:00
|
|
|
N_("New layer with last values"),
|
|
|
|
G_CALLBACK (layers_new_last_vals_cmd_callback),
|
2004-10-16 23:48:23 +08:00
|
|
|
GIMP_HELP_LAYER_NEW },
|
|
|
|
|
2004-04-19 22:54:24 +08:00
|
|
|
{ "layers-duplicate", GIMP_STOCK_DUPLICATE,
|
2004-10-16 23:48:23 +08:00
|
|
|
N_("D_uplicate Layer"), NULL,
|
|
|
|
N_("Duplicate layer"),
|
2004-04-19 22:54:24 +08:00
|
|
|
G_CALLBACK (layers_duplicate_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_DUPLICATE },
|
|
|
|
|
|
|
|
{ "layers-delete", GTK_STOCK_DELETE,
|
2004-10-16 23:48:23 +08:00
|
|
|
N_("_Delete Layer"), "",
|
|
|
|
N_("Delete layer"),
|
2004-04-19 22:54:24 +08:00
|
|
|
G_CALLBACK (layers_delete_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_DELETE },
|
|
|
|
|
|
|
|
{ "layers-raise", GTK_STOCK_GO_UP,
|
2004-10-16 23:48:23 +08:00
|
|
|
N_("_Raise Layer"), "",
|
|
|
|
N_("Raise layer"),
|
2004-04-19 22:54:24 +08:00
|
|
|
G_CALLBACK (layers_raise_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_RAISE },
|
|
|
|
|
|
|
|
{ "layers-raise-to-top", GTK_STOCK_GOTO_TOP,
|
2004-10-16 23:48:23 +08:00
|
|
|
N_("Layer to _Top"), "",
|
|
|
|
N_("Raise layer to top"),
|
2004-04-19 22:54:24 +08:00
|
|
|
G_CALLBACK (layers_raise_to_top_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_RAISE_TO_TOP },
|
|
|
|
|
|
|
|
{ "layers-lower", GTK_STOCK_GO_DOWN,
|
2004-10-16 23:48:23 +08:00
|
|
|
N_("_Lower Layer"), "",
|
|
|
|
N_("Lower layer"),
|
2004-04-19 22:54:24 +08:00
|
|
|
G_CALLBACK (layers_lower_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_LOWER },
|
|
|
|
|
|
|
|
{ "layers-lower-to-bottom", GTK_STOCK_GOTO_BOTTOM,
|
2004-10-16 23:48:23 +08:00
|
|
|
N_("Layer to _Bottom"), "",
|
|
|
|
N_("Lower layer to bottom"),
|
2004-04-19 22:54:24 +08:00
|
|
|
G_CALLBACK (layers_lower_to_bottom_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_LOWER_TO_BOTTOM },
|
|
|
|
|
|
|
|
{ "layers-anchor", GIMP_STOCK_ANCHOR,
|
2004-11-13 23:46:45 +08:00
|
|
|
N_("_Anchor Layer"), "<control>H",
|
2004-05-13 02:36:33 +08:00
|
|
|
N_("Anchor floating layer"),
|
2004-04-19 22:54:24 +08:00
|
|
|
G_CALLBACK (layers_anchor_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_ANCHOR },
|
|
|
|
|
|
|
|
{ "layers-merge-down", GIMP_STOCK_MERGE_DOWN,
|
|
|
|
N_("Merge Do_wn"), NULL, NULL,
|
|
|
|
G_CALLBACK (layers_merge_down_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_MERGE_DOWN },
|
|
|
|
|
|
|
|
{ "layers-merge-layers", NULL,
|
|
|
|
N_("Merge _Visible Layers..."), NULL, NULL,
|
2004-05-25 22:37:02 +08:00
|
|
|
G_CALLBACK (image_merge_layers_cmd_callback),
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_IMAGE_MERGE_LAYERS },
|
|
|
|
|
|
|
|
{ "layers-flatten-image", NULL,
|
|
|
|
N_("_Flatten Image"), NULL, NULL,
|
2004-05-25 22:37:02 +08:00
|
|
|
G_CALLBACK (image_flatten_image_cmd_callback),
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_IMAGE_FLATTEN },
|
|
|
|
|
|
|
|
{ "layers-text-discard", GIMP_STOCK_TOOL_TEXT,
|
|
|
|
N_("_Discard Text Information"), NULL, NULL,
|
|
|
|
G_CALLBACK (layers_text_discard_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_TEXT_DISCARD },
|
|
|
|
|
|
|
|
{ "layers-resize", GIMP_STOCK_RESIZE,
|
|
|
|
N_("Layer B_oundary Size..."), NULL, NULL,
|
|
|
|
G_CALLBACK (layers_resize_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_RESIZE },
|
|
|
|
|
|
|
|
{ "layers-resize-to-image", GIMP_STOCK_LAYER_TO_IMAGESIZE,
|
|
|
|
N_("Layer to _Image Size"), NULL, NULL,
|
|
|
|
G_CALLBACK (layers_resize_to_image_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_RESIZE_TO_IMAGE },
|
|
|
|
|
|
|
|
{ "layers-scale", GIMP_STOCK_SCALE,
|
|
|
|
N_("_Scale Layer..."), NULL, NULL,
|
|
|
|
G_CALLBACK (layers_scale_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_SCALE },
|
|
|
|
|
2004-04-21 18:55:45 +08:00
|
|
|
{ "layers-crop", GIMP_STOCK_TOOL_CROP,
|
|
|
|
N_("Cr_op Layer"), NULL, NULL,
|
|
|
|
G_CALLBACK (layers_crop_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_CROP },
|
|
|
|
|
2004-04-19 22:54:24 +08:00
|
|
|
{ "layers-mask-add", GIMP_STOCK_LAYER_MASK,
|
|
|
|
N_("Add La_yer Mask..."), NULL, NULL,
|
|
|
|
G_CALLBACK (layers_mask_add_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_MASK_ADD },
|
|
|
|
|
2004-06-10 22:25:04 +08:00
|
|
|
{ "layers-alpha-add", GIMP_STOCK_TRANSPARENCY,
|
|
|
|
N_("Add Alpha C_hannel"), NULL, NULL,
|
|
|
|
G_CALLBACK (layers_alpha_add_cmd_callback),
|
|
|
|
GIMP_HELP_LAYER_ALPHA_ADD }
|
|
|
|
};
|
|
|
|
|
2004-09-15 21:24:45 +08:00
|
|
|
static GimpToggleActionEntry layers_toggle_actions[] =
|
2004-08-21 06:32:14 +08:00
|
|
|
{
|
2004-09-15 21:24:45 +08:00
|
|
|
{ "layers-preserve-transparency", GIMP_STOCK_TRANSPARENCY,
|
2004-09-15 23:06:08 +08:00
|
|
|
N_("Keep Transparency"), NULL, NULL,
|
2004-09-15 21:24:45 +08:00
|
|
|
G_CALLBACK (layers_preserve_trans_cmd_callback),
|
|
|
|
FALSE,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_KEEP_TRANSPARENCY },
|
2004-09-15 21:24:45 +08:00
|
|
|
|
|
|
|
{ "layers-mask-edit", GIMP_STOCK_EDIT,
|
2004-08-21 06:32:14 +08:00
|
|
|
N_("Edit Layer Mask"), NULL, NULL,
|
|
|
|
G_CALLBACK (layers_mask_edit_cmd_callback),
|
|
|
|
FALSE,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_MASK_EDIT },
|
2004-08-21 06:32:14 +08:00
|
|
|
|
2004-09-15 21:24:45 +08:00
|
|
|
{ "layers-mask-show", GIMP_STOCK_VISIBLE,
|
2004-08-21 06:32:14 +08:00
|
|
|
N_("Show Layer Mask"), NULL, NULL,
|
|
|
|
G_CALLBACK (layers_mask_show_cmd_callback),
|
|
|
|
FALSE,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_MASK_SHOW },
|
2004-08-21 06:32:14 +08:00
|
|
|
|
|
|
|
{ "layers-mask-disable", NULL,
|
|
|
|
N_("Disable Layer Mask"), NULL, NULL,
|
|
|
|
G_CALLBACK (layers_mask_disable_cmd_callback),
|
|
|
|
FALSE,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_MASK_DISABLE }
|
2004-08-21 06:32:14 +08:00
|
|
|
};
|
|
|
|
|
2004-06-10 22:25:04 +08:00
|
|
|
static GimpEnumActionEntry layers_mask_apply_actions[] =
|
|
|
|
{
|
2004-04-19 22:54:24 +08:00
|
|
|
{ "layers-mask-apply", NULL,
|
|
|
|
N_("Apply Layer _Mask"), NULL, NULL,
|
2004-06-10 22:25:04 +08:00
|
|
|
GIMP_MASK_APPLY,
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_LAYER_MASK_APPLY },
|
|
|
|
|
|
|
|
{ "layers-mask-delete", GTK_STOCK_DELETE,
|
|
|
|
N_("Delete Layer Mas_k"), "", NULL,
|
2004-06-10 22:25:04 +08:00
|
|
|
GIMP_MASK_DISCARD,
|
|
|
|
GIMP_HELP_LAYER_MASK_DELETE }
|
2004-04-19 22:54:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static GimpEnumActionEntry layers_mask_to_selection_actions[] =
|
|
|
|
{
|
|
|
|
{ "layers-mask-selection-replace", GIMP_STOCK_SELECTION_REPLACE,
|
|
|
|
N_("_Mask to Selection"), NULL, NULL,
|
|
|
|
GIMP_CHANNEL_OP_REPLACE,
|
|
|
|
GIMP_HELP_LAYER_MASK_SELECTION_REPLACE },
|
|
|
|
|
2004-04-21 18:55:45 +08:00
|
|
|
{ "layers-mask-selection-add", GIMP_STOCK_SELECTION_ADD,
|
2004-04-19 22:54:24 +08:00
|
|
|
N_("_Add to Selection"), NULL, NULL,
|
|
|
|
GIMP_CHANNEL_OP_ADD,
|
|
|
|
GIMP_HELP_LAYER_MASK_SELECTION_ADD },
|
|
|
|
|
|
|
|
{ "layers-mask-selection-subtract", GIMP_STOCK_SELECTION_SUBTRACT,
|
|
|
|
N_("_Subtract from Selection"), NULL, NULL,
|
|
|
|
GIMP_CHANNEL_OP_SUBTRACT,
|
|
|
|
GIMP_HELP_LAYER_MASK_SELECTION_SUBTRACT },
|
|
|
|
|
|
|
|
{ "layers-mask-selection-intersect", GIMP_STOCK_SELECTION_INTERSECT,
|
|
|
|
N_("_Intersect with Selection"), NULL, NULL,
|
|
|
|
GIMP_CHANNEL_OP_INTERSECT,
|
|
|
|
GIMP_HELP_LAYER_MASK_SELECTION_INTERSECT }
|
|
|
|
};
|
|
|
|
|
|
|
|
static GimpEnumActionEntry layers_alpha_to_selection_actions[] =
|
|
|
|
{
|
|
|
|
{ "layers-alpha-selection-replace", GIMP_STOCK_SELECTION_REPLACE,
|
|
|
|
N_("Al_pha to Selection"), NULL, NULL,
|
|
|
|
GIMP_CHANNEL_OP_REPLACE,
|
|
|
|
GIMP_HELP_LAYER_ALPHA_SELECTION_REPLACE },
|
|
|
|
|
|
|
|
{ "layers-alpha-selection-add", GIMP_STOCK_SELECTION_ADD,
|
|
|
|
N_("A_dd to Selection"), NULL, NULL,
|
|
|
|
GIMP_CHANNEL_OP_ADD,
|
|
|
|
GIMP_HELP_LAYER_ALPHA_SELECTION_ADD },
|
|
|
|
|
|
|
|
{ "layers-alpha-selection-subtract", GIMP_STOCK_SELECTION_SUBTRACT,
|
|
|
|
N_("_Subtract from Selection"), NULL, NULL,
|
|
|
|
GIMP_CHANNEL_OP_SUBTRACT,
|
|
|
|
GIMP_HELP_LAYER_ALPHA_SELECTION_SUBTRACT },
|
|
|
|
|
2004-04-21 18:55:45 +08:00
|
|
|
{ "layers-alpha-selection-intersect", GIMP_STOCK_SELECTION_INTERSECT,
|
2004-04-19 22:54:24 +08:00
|
|
|
N_("_Intersect with Selection"), NULL, NULL,
|
|
|
|
GIMP_CHANNEL_OP_INTERSECT,
|
|
|
|
GIMP_HELP_LAYER_ALPHA_SELECTION_INTERSECT }
|
|
|
|
};
|
|
|
|
|
2004-06-23 08:23:25 +08:00
|
|
|
static GimpEnumActionEntry layers_select_actions[] =
|
|
|
|
{
|
|
|
|
{ "layers-select-top", NULL,
|
|
|
|
N_("Select _Top Layer"), "Home", NULL,
|
|
|
|
GIMP_ACTION_SELECT_FIRST,
|
|
|
|
GIMP_HELP_LAYER_TOP },
|
|
|
|
|
|
|
|
{ "layers-select-bottom", NULL,
|
|
|
|
N_("Select _Bottom Layer"), "End", NULL,
|
|
|
|
GIMP_ACTION_SELECT_LAST,
|
|
|
|
GIMP_HELP_LAYER_BOTTOM },
|
|
|
|
|
|
|
|
{ "layers-select-previous", NULL,
|
|
|
|
N_("Select _Previous Layer"), "Prior", NULL,
|
|
|
|
GIMP_ACTION_SELECT_PREVIOUS,
|
|
|
|
GIMP_HELP_LAYER_PREVIOUS },
|
|
|
|
|
|
|
|
{ "layers-select-next", NULL,
|
|
|
|
N_("Select _Next Layer"), "Next", NULL,
|
|
|
|
GIMP_ACTION_SELECT_NEXT,
|
|
|
|
GIMP_HELP_LAYER_NEXT }
|
|
|
|
};
|
|
|
|
|
|
|
|
static GimpEnumActionEntry layers_opacity_actions[] =
|
|
|
|
{
|
|
|
|
{ "layers-opacity-set", GIMP_STOCK_TRANSPARENCY,
|
|
|
|
N_("Set Opacity"), NULL, NULL,
|
|
|
|
GIMP_ACTION_SELECT_SET,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_OPACITY },
|
|
|
|
{ "layers-opacity-transparent", GIMP_STOCK_TRANSPARENCY,
|
2004-06-23 08:23:25 +08:00
|
|
|
"Completely Transparent", NULL, NULL,
|
|
|
|
GIMP_ACTION_SELECT_FIRST,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_OPACITY },
|
|
|
|
{ "layers-opacity-opaque", GIMP_STOCK_TRANSPARENCY,
|
2004-06-23 08:23:25 +08:00
|
|
|
"Completely Opaque", NULL, NULL,
|
|
|
|
GIMP_ACTION_SELECT_LAST,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_OPACITY },
|
|
|
|
{ "layers-opacity-decrease", GIMP_STOCK_TRANSPARENCY,
|
2004-06-23 08:23:25 +08:00
|
|
|
"More Transparent", NULL, NULL,
|
|
|
|
GIMP_ACTION_SELECT_PREVIOUS,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_OPACITY },
|
|
|
|
{ "layers-opacity-increase", GIMP_STOCK_TRANSPARENCY,
|
2004-06-23 08:23:25 +08:00
|
|
|
"More Opaque", NULL, NULL,
|
|
|
|
GIMP_ACTION_SELECT_NEXT,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_OPACITY },
|
|
|
|
{ "layers-opacity-decrease-skip", GIMP_STOCK_TRANSPARENCY,
|
2004-06-23 08:23:25 +08:00
|
|
|
"10% More Transparent", NULL, NULL,
|
|
|
|
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_OPACITY },
|
|
|
|
{ "layers-opacity-increase-skip", GIMP_STOCK_TRANSPARENCY,
|
2004-06-23 08:23:25 +08:00
|
|
|
"10% More Opaque", NULL, NULL,
|
|
|
|
GIMP_ACTION_SELECT_SKIP_NEXT,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_OPACITY }
|
2004-06-23 08:23:25 +08:00
|
|
|
};
|
|
|
|
|
2004-09-15 23:06:08 +08:00
|
|
|
static GimpEnumActionEntry layers_mode_actions[] =
|
2004-09-15 21:24:45 +08:00
|
|
|
{
|
2004-09-15 23:06:08 +08:00
|
|
|
{ "layers-mode-first", GIMP_STOCK_TOOL_PENCIL,
|
|
|
|
"First Layer Mode", NULL, NULL,
|
2004-09-15 21:24:45 +08:00
|
|
|
GIMP_ACTION_SELECT_FIRST,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_MODE },
|
|
|
|
{ "layers-mode-last", GIMP_STOCK_TOOL_PENCIL,
|
|
|
|
"Last Layer Mode", NULL, NULL,
|
2004-09-15 21:24:45 +08:00
|
|
|
GIMP_ACTION_SELECT_LAST,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_MODE },
|
|
|
|
{ "layers-mode-previous", GIMP_STOCK_TOOL_PENCIL,
|
|
|
|
"Previous Layer Mode", NULL, NULL,
|
2004-09-15 21:24:45 +08:00
|
|
|
GIMP_ACTION_SELECT_PREVIOUS,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_MODE },
|
|
|
|
{ "layers-mode-next", GIMP_STOCK_TOOL_PENCIL,
|
|
|
|
"Next Layer Mode", NULL, NULL,
|
2004-09-15 21:24:45 +08:00
|
|
|
GIMP_ACTION_SELECT_NEXT,
|
2004-09-15 23:06:08 +08:00
|
|
|
GIMP_HELP_LAYER_MODE }
|
2004-09-15 21:24:45 +08:00
|
|
|
};
|
|
|
|
|
2004-06-23 08:23:25 +08:00
|
|
|
|
2004-04-19 22:54:24 +08:00
|
|
|
void
|
2004-04-27 21:55:26 +08:00
|
|
|
layers_actions_setup (GimpActionGroup *group)
|
2004-04-19 22:54:24 +08:00
|
|
|
{
|
|
|
|
gimp_action_group_add_actions (group,
|
|
|
|
layers_actions,
|
2004-04-27 21:55:26 +08:00
|
|
|
G_N_ELEMENTS (layers_actions));
|
2004-04-19 22:54:24 +08:00
|
|
|
|
2004-09-15 21:24:45 +08:00
|
|
|
gimp_action_group_add_toggle_actions (group,
|
|
|
|
layers_toggle_actions,
|
|
|
|
G_N_ELEMENTS (layers_toggle_actions));
|
|
|
|
|
2004-06-10 22:25:04 +08:00
|
|
|
gimp_action_group_add_enum_actions (group,
|
|
|
|
layers_mask_apply_actions,
|
|
|
|
G_N_ELEMENTS (layers_mask_apply_actions),
|
|
|
|
G_CALLBACK (layers_mask_apply_cmd_callback));
|
|
|
|
|
2004-04-19 22:54:24 +08:00
|
|
|
gimp_action_group_add_enum_actions (group,
|
|
|
|
layers_mask_to_selection_actions,
|
|
|
|
G_N_ELEMENTS (layers_mask_to_selection_actions),
|
2004-04-27 21:55:26 +08:00
|
|
|
G_CALLBACK (layers_mask_to_selection_cmd_callback));
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
gimp_action_group_add_enum_actions (group,
|
|
|
|
layers_alpha_to_selection_actions,
|
|
|
|
G_N_ELEMENTS (layers_alpha_to_selection_actions),
|
2004-04-27 21:55:26 +08:00
|
|
|
G_CALLBACK (layers_alpha_to_selection_cmd_callback));
|
2004-06-23 08:23:25 +08:00
|
|
|
|
|
|
|
gimp_action_group_add_enum_actions (group,
|
|
|
|
layers_select_actions,
|
|
|
|
G_N_ELEMENTS (layers_select_actions),
|
|
|
|
G_CALLBACK (layers_select_cmd_callback));
|
2004-09-15 21:24:45 +08:00
|
|
|
|
2004-06-23 08:23:25 +08:00
|
|
|
gimp_action_group_add_enum_actions (group,
|
|
|
|
layers_opacity_actions,
|
|
|
|
G_N_ELEMENTS (layers_opacity_actions),
|
|
|
|
G_CALLBACK (layers_opacity_cmd_callback));
|
2004-09-15 21:24:45 +08:00
|
|
|
|
|
|
|
gimp_action_group_add_enum_actions (group,
|
2004-09-15 23:06:08 +08:00
|
|
|
layers_mode_actions,
|
|
|
|
G_N_ELEMENTS (layers_mode_actions),
|
|
|
|
G_CALLBACK (layers_mode_cmd_callback));
|
2004-04-19 22:54:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
layers_actions_update (GimpActionGroup *group,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2004-10-18 19:29:58 +08:00
|
|
|
GimpImage *gimage = action_data_get_image (data);
|
2004-09-15 21:24:45 +08:00
|
|
|
GimpLayer *layer = NULL;
|
|
|
|
GimpLayerMask *mask = FALSE; /* layer mask */
|
|
|
|
gboolean fs = FALSE; /* floating sel */
|
|
|
|
gboolean ac = FALSE; /* active channel */
|
2004-10-12 23:51:43 +08:00
|
|
|
gboolean sel = FALSE;
|
2004-09-15 21:24:45 +08:00
|
|
|
gboolean alpha = FALSE; /* alpha channel present */
|
|
|
|
gboolean indexed = FALSE; /* is indexed */
|
|
|
|
gboolean preserve = FALSE;
|
|
|
|
gboolean next_alpha = FALSE;
|
|
|
|
gboolean text_layer = FALSE;
|
|
|
|
GList *next = NULL;
|
|
|
|
GList *prev = NULL;
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
if (gimage)
|
|
|
|
{
|
2004-10-18 19:29:58 +08:00
|
|
|
fs = (gimp_image_floating_sel (gimage) != NULL);
|
|
|
|
ac = (gimp_image_get_active_channel (gimage) != NULL);
|
|
|
|
sel = ! gimp_channel_is_empty (gimp_image_get_mask (gimage));
|
|
|
|
indexed = (gimp_image_base_type (gimage) == GIMP_INDEXED);
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
layer = gimp_image_get_active_layer (gimage);
|
|
|
|
|
|
|
|
if (layer)
|
2004-09-15 21:24:45 +08:00
|
|
|
{
|
2004-10-18 19:29:58 +08:00
|
|
|
GList *list;
|
2004-09-15 21:24:45 +08:00
|
|
|
|
2004-10-18 19:29:58 +08:00
|
|
|
mask = gimp_layer_get_mask (layer);
|
2004-09-15 21:24:45 +08:00
|
|
|
preserve = gimp_layer_get_preserve_trans (layer);
|
2004-10-18 19:29:58 +08:00
|
|
|
alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
|
2004-04-19 22:54:24 +08:00
|
|
|
|
2004-10-18 19:29:58 +08:00
|
|
|
list = g_list_find (GIMP_LIST (gimage->layers)->list, layer);
|
2004-04-19 22:54:24 +08:00
|
|
|
|
2004-10-18 19:29:58 +08:00
|
|
|
if (list)
|
2004-04-19 22:54:24 +08:00
|
|
|
{
|
|
|
|
prev = g_list_previous (list);
|
|
|
|
next = g_list_next (list);
|
|
|
|
}
|
|
|
|
|
2004-10-18 19:29:58 +08:00
|
|
|
if (next)
|
|
|
|
next_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (next->data));
|
2004-04-19 22:54:24 +08:00
|
|
|
|
2004-10-18 19:29:58 +08:00
|
|
|
if (layer)
|
|
|
|
text_layer = gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer));
|
|
|
|
}
|
2004-04-19 22:54:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#define SET_VISIBLE(action,condition) \
|
|
|
|
gimp_action_group_set_action_visible (group, action, (condition) != 0)
|
|
|
|
#define SET_SENSITIVE(action,condition) \
|
|
|
|
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
|
2004-09-15 21:24:45 +08:00
|
|
|
#define SET_ACTIVE(action,condition) \
|
|
|
|
gimp_action_group_set_action_active (group, action, (condition) != 0)
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
SET_VISIBLE ("layers-text-tool", text_layer && !ac);
|
|
|
|
SET_SENSITIVE ("layers-edit-attributes", layer && !fs && !ac);
|
|
|
|
|
2004-10-23 08:53:48 +08:00
|
|
|
SET_SENSITIVE ("layers-new", gimage);
|
|
|
|
SET_SENSITIVE ("layers-new-last-values", gimage);
|
|
|
|
SET_SENSITIVE ("layers-duplicate", layer && !fs && !ac);
|
|
|
|
SET_SENSITIVE ("layers-delete", layer && !ac);
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
SET_SENSITIVE ("layers-select-top", layer && !fs && !ac && prev);
|
|
|
|
SET_SENSITIVE ("layers-select-bottom", layer && !fs && !ac && next);
|
2004-06-23 08:23:25 +08:00
|
|
|
SET_SENSITIVE ("layers-select-previous", layer && !fs && !ac && prev);
|
|
|
|
SET_SENSITIVE ("layers-select-next", layer && !fs && !ac && next);
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
SET_SENSITIVE ("layers-raise", layer && !fs && !ac && alpha && prev);
|
|
|
|
SET_SENSITIVE ("layers-raise-to-top", layer && !fs && !ac && alpha && prev);
|
|
|
|
SET_SENSITIVE ("layers-lower", layer && !fs && !ac && next && next_alpha);
|
|
|
|
SET_SENSITIVE ("layers-lower-to-bottom", layer && !fs && !ac && next && next_alpha);
|
|
|
|
|
|
|
|
SET_SENSITIVE ("layers-anchor", layer && fs && !ac);
|
|
|
|
SET_SENSITIVE ("layers-merge-down", layer && !fs && !ac && next);
|
|
|
|
SET_SENSITIVE ("layers-merge-layers", layer && !fs && !ac);
|
|
|
|
SET_SENSITIVE ("layers-flatten-image", layer && !fs && !ac);
|
|
|
|
SET_VISIBLE ("layers-text-discard", text_layer && !ac);
|
|
|
|
|
|
|
|
SET_SENSITIVE ("layers-resize", layer && !ac);
|
|
|
|
SET_SENSITIVE ("layers-resize-to-image", layer && !ac);
|
|
|
|
SET_SENSITIVE ("layers-scale", layer && !ac);
|
|
|
|
|
2004-10-12 23:51:43 +08:00
|
|
|
SET_SENSITIVE ("layers-crop", layer && sel);
|
|
|
|
|
2004-09-15 21:24:45 +08:00
|
|
|
SET_SENSITIVE ("layers-alpha-add", layer && !fs && !alpha);
|
|
|
|
|
|
|
|
SET_SENSITIVE ("layers-preserve-transparency", layer);
|
|
|
|
SET_ACTIVE ("layers-preserve-transparency", preserve);
|
|
|
|
|
2004-10-28 18:53:44 +08:00
|
|
|
SET_SENSITIVE ("layers-mask-add", layer && !fs && !ac && !mask);
|
2004-09-15 21:24:45 +08:00
|
|
|
SET_SENSITIVE ("layers-mask-apply", layer && !fs && !ac && mask);
|
|
|
|
SET_SENSITIVE ("layers-mask-delete", layer && !fs && !ac && mask);
|
|
|
|
|
|
|
|
SET_SENSITIVE ("layers-mask-edit", layer && !fs && !ac && mask);
|
|
|
|
SET_SENSITIVE ("layers-mask-show", layer && !fs && !ac && mask);
|
|
|
|
SET_SENSITIVE ("layers-mask-disable", layer && !fs && !ac && mask);
|
|
|
|
|
|
|
|
SET_ACTIVE ("layers-mask-edit", mask && gimp_layer_mask_get_edit (mask));
|
|
|
|
SET_ACTIVE ("layers-mask-show", mask && gimp_layer_mask_get_show (mask));
|
|
|
|
SET_ACTIVE ("layers-mask-disable", mask && !gimp_layer_mask_get_apply (mask));
|
2004-04-19 22:54:24 +08:00
|
|
|
|
2004-09-15 21:24:45 +08:00
|
|
|
SET_SENSITIVE ("layers-mask-selection-replace", layer && !fs && !ac && mask);
|
|
|
|
SET_SENSITIVE ("layers-mask-selection-add", layer && !fs && !ac && mask);
|
|
|
|
SET_SENSITIVE ("layers-mask-selection-subtract", layer && !fs && !ac && mask);
|
|
|
|
SET_SENSITIVE ("layers-mask-selection-intersect", layer && !fs && !ac && mask);
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
SET_SENSITIVE ("layers-alpha-selection-replace", layer && !fs && !ac);
|
|
|
|
SET_SENSITIVE ("layers-alpha-selection-add", layer && !fs && !ac);
|
|
|
|
SET_SENSITIVE ("layers-alpha-selection-subtract", layer && !fs && !ac);
|
|
|
|
SET_SENSITIVE ("layers-alpha-selection-intersect", layer && !fs && !ac);
|
|
|
|
|
|
|
|
#undef SET_VISIBLE
|
|
|
|
#undef SET_SENSITIVE
|
2004-09-15 21:24:45 +08:00
|
|
|
#undef SET_ACTIVE
|
2004-04-19 22:54:24 +08:00
|
|
|
}
|