1
/* The GIMP -- an 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 "qmask-actions.h"
34
#include "qmask-commands.h"
36
#include "gimp-intl.h"
39
static GimpActionEntry qmask_actions[] =
41
{ "qmask-popup", NULL,
42
N_("Quick Mask Menu"), NULL, NULL, NULL,
45
{ "qmask-configure", NULL,
46
N_("_Configure Color and Opacity..."), NULL, NULL,
47
G_CALLBACK (qmask_configure_cmd_callback),
48
GIMP_HELP_QMASK_EDIT }
51
static GimpToggleActionEntry qmask_toggle_actions[] =
53
{ "qmask-active", NULL,
54
N_("_Quick Mask Active"), NULL, NULL,
55
G_CALLBACK (qmask_toggle_cmd_callback),
57
GIMP_HELP_QMASK_TOGGLE },
59
{ "qmask-toggle", GIMP_STOCK_QMASK_ON,
60
N_("Toggle _Quick Mask"), "<shift>Q", NULL,
61
G_CALLBACK (qmask_toggle_cmd_callback),
63
GIMP_HELP_QMASK_TOGGLE }
67
static GimpRadioActionEntry qmask_invert_actions[] =
69
{ "qmask-invert-on", NULL,
70
N_("Mask _Selected Areas"), NULL, NULL,
72
GIMP_HELP_QMASK_INVERT },
74
{ "qmask-invert-off", NULL,
75
N_("Mask _Unselected Areas"), NULL, NULL,
77
GIMP_HELP_QMASK_INVERT }
82
qmask_actions_setup (GimpActionGroup *group)
86
gimp_action_group_add_actions (group,
88
G_N_ELEMENTS (qmask_actions));
90
gimp_action_group_add_toggle_actions (group,
92
G_N_ELEMENTS (qmask_toggle_actions));
94
gimp_action_group_add_radio_actions (group,
96
G_N_ELEMENTS (qmask_invert_actions),
98
G_CALLBACK (qmask_invert_cmd_callback));
100
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
102
gtk_action_set_accel_path (action, "<Actions>/qmask/qmask-toggle");
105
#warning FIXME: remove accel_path hack
107
g_object_set_data (G_OBJECT (action), "gimp-accel-path",
108
"<Actions>/qmask/qmask-toggle");
112
qmask_actions_update (GimpActionGroup *group,
115
GimpImage *gimage = action_data_get_image (data);
117
#define SET_SENSITIVE(action,sensitive) \
118
gimp_action_group_set_action_sensitive (group, action, (sensitive) != 0)
119
#define SET_ACTIVE(action,active) \
120
gimp_action_group_set_action_active (group, action, (active) != 0)
121
#define SET_COLOR(action,color) \
122
gimp_action_group_set_action_color (group, action, (color), FALSE)
124
SET_SENSITIVE ("qmask-active", gimage);
125
SET_SENSITIVE ("qmask-toggle", gimage);
127
SET_ACTIVE ("qmask-active", gimage && gimage->qmask_state);
128
SET_ACTIVE ("qmask-toggle", gimage && gimage->qmask_state);
130
SET_SENSITIVE ("qmask-invert-on", gimage);
131
SET_SENSITIVE ("qmask-invert-off", gimage);
133
if (gimage && gimage->qmask_inverted)
134
SET_ACTIVE ("qmask-invert-on", TRUE);
136
SET_ACTIVE ("qmask-invert-off", TRUE);
138
SET_SENSITIVE ("qmask-configure", gimage);
141
SET_COLOR ("qmask-configure", &gimage->qmask_color);