1
/* GIMP - The GNU Image Manipulation Program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
#include "libgimpwidgets/gimpwidgets.h"
25
#include "actions-types.h"
27
#include "core/gimpimage.h"
29
#include "widgets/gimpactiongroup.h"
30
#include "widgets/gimphelp-ids.h"
33
#include "quick-mask-actions.h"
34
#include "quick-mask-commands.h"
36
#include "gimp-intl.h"
39
static const GimpActionEntry quick_mask_actions[] =
41
{ "quick-mask-popup", NULL,
42
N_("Quick Mask Menu"), NULL, NULL, NULL,
43
GIMP_HELP_QUICK_MASK },
45
{ "quick-mask-configure", NULL,
46
N_("_Configure Color and Opacity..."), NULL, NULL,
47
G_CALLBACK (quick_mask_configure_cmd_callback),
48
GIMP_HELP_QUICK_MASK_EDIT }
51
static const GimpToggleActionEntry quick_mask_toggle_actions[] =
53
{ "quick-mask-toggle", GIMP_STOCK_QUICK_MASK_ON,
54
N_("Toggle _Quick Mask"), "<shift>Q", N_("Toggle Quick Mask"),
55
G_CALLBACK (quick_mask_toggle_cmd_callback),
57
GIMP_HELP_QUICK_MASK_TOGGLE }
60
static const GimpRadioActionEntry quick_mask_invert_actions[] =
62
{ "quick-mask-invert-on", NULL,
63
N_("Mask _Selected Areas"), NULL, NULL,
65
GIMP_HELP_QUICK_MASK_INVERT },
67
{ "quick-mask-invert-off", NULL,
68
N_("Mask _Unselected Areas"), NULL, NULL,
70
GIMP_HELP_QUICK_MASK_INVERT }
75
quick_mask_actions_setup (GimpActionGroup *group)
77
gimp_action_group_add_actions (group,
79
G_N_ELEMENTS (quick_mask_actions));
81
gimp_action_group_add_toggle_actions (group,
82
quick_mask_toggle_actions,
83
G_N_ELEMENTS (quick_mask_toggle_actions));
85
gimp_action_group_add_radio_actions (group,
86
quick_mask_invert_actions,
87
G_N_ELEMENTS (quick_mask_invert_actions),
90
G_CALLBACK (quick_mask_invert_cmd_callback));
94
quick_mask_actions_update (GimpActionGroup *group,
97
GimpImage *image = action_data_get_image (data);
99
#define SET_SENSITIVE(action,sensitive) \
100
gimp_action_group_set_action_sensitive (group, action, (sensitive) != 0)
101
#define SET_ACTIVE(action,active) \
102
gimp_action_group_set_action_active (group, action, (active) != 0)
103
#define SET_COLOR(action,color) \
104
gimp_action_group_set_action_color (group, action, (color), FALSE)
106
SET_SENSITIVE ("quick-mask-toggle", image);
107
SET_ACTIVE ("quick-mask-toggle", image && image->quick_mask_state);
109
SET_SENSITIVE ("quick-mask-invert-on", image);
110
SET_SENSITIVE ("quick-mask-invert-off", image);
112
if (image && image->quick_mask_inverted)
113
SET_ACTIVE ("quick-mask-invert-on", TRUE);
115
SET_ACTIVE ("quick-mask-invert-off", TRUE);
117
SET_SENSITIVE ("quick-mask-configure", image);
120
SET_COLOR ("quick-mask-configure", &image->quick_mask_color);