~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/actions/qmask-actions.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
2
 
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
 
 *
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.
8
 
 *
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.
13
 
 *
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.
17
 
 */
18
 
 
19
 
#include "config.h"
20
 
 
21
 
#include <gtk/gtk.h>
22
 
 
23
 
#include "libgimpwidgets/gimpwidgets.h"
24
 
 
25
 
#include "actions-types.h"
26
 
 
27
 
#include "core/gimpimage.h"
28
 
 
29
 
#include "widgets/gimpactiongroup.h"
30
 
#include "widgets/gimphelp-ids.h"
31
 
 
32
 
#include "actions.h"
33
 
#include "qmask-actions.h"
34
 
#include "qmask-commands.h"
35
 
 
36
 
#include "gimp-intl.h"
37
 
 
38
 
 
39
 
static GimpActionEntry qmask_actions[] =
40
 
{
41
 
  { "qmask-popup", NULL,
42
 
    N_("Quick Mask Menu"), NULL, NULL, NULL,
43
 
    GIMP_HELP_QMASK },
44
 
 
45
 
  { "qmask-configure", NULL,
46
 
    N_("_Configure Color and Opacity..."), NULL, NULL,
47
 
    G_CALLBACK (qmask_configure_cmd_callback),
48
 
    GIMP_HELP_QMASK_EDIT }
49
 
};
50
 
 
51
 
static GimpToggleActionEntry qmask_toggle_actions[] =
52
 
{
53
 
  { "qmask-active", NULL,
54
 
    N_("_Quick Mask Active"), NULL, NULL,
55
 
    G_CALLBACK (qmask_toggle_cmd_callback),
56
 
    FALSE,
57
 
    GIMP_HELP_QMASK_TOGGLE },
58
 
 
59
 
  { "qmask-toggle", GIMP_STOCK_QMASK_ON,
60
 
    N_("Toggle _Quick Mask"), "<shift>Q", NULL,
61
 
    G_CALLBACK (qmask_toggle_cmd_callback),
62
 
    FALSE,
63
 
    GIMP_HELP_QMASK_TOGGLE }
64
 
 
65
 
};
66
 
 
67
 
static GimpRadioActionEntry qmask_invert_actions[] =
68
 
{
69
 
  { "qmask-invert-on", NULL,
70
 
    N_("Mask _Selected Areas"), NULL, NULL,
71
 
    TRUE,
72
 
    GIMP_HELP_QMASK_INVERT },
73
 
 
74
 
  { "qmask-invert-off", NULL,
75
 
    N_("Mask _Unselected Areas"), NULL, NULL,
76
 
    FALSE,
77
 
    GIMP_HELP_QMASK_INVERT }
78
 
};
79
 
 
80
 
 
81
 
void
82
 
qmask_actions_setup (GimpActionGroup *group)
83
 
{
84
 
  GtkAction *action;
85
 
 
86
 
  gimp_action_group_add_actions (group,
87
 
                                 qmask_actions,
88
 
                                 G_N_ELEMENTS (qmask_actions));
89
 
 
90
 
  gimp_action_group_add_toggle_actions (group,
91
 
                                        qmask_toggle_actions,
92
 
                                        G_N_ELEMENTS (qmask_toggle_actions));
93
 
 
94
 
  gimp_action_group_add_radio_actions (group,
95
 
                                       qmask_invert_actions,
96
 
                                       G_N_ELEMENTS (qmask_invert_actions),
97
 
                                       FALSE,
98
 
                                       G_CALLBACK (qmask_invert_cmd_callback));
99
 
 
100
 
  action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
101
 
                                        "qmask-active");
102
 
  gtk_action_set_accel_path (action, "<Actions>/qmask/qmask-toggle");
103
 
 
104
 
#ifdef __GNUC__
105
 
#warning FIXME: remove accel_path hack
106
 
#endif
107
 
  g_object_set_data (G_OBJECT (action), "gimp-accel-path",
108
 
                     "<Actions>/qmask/qmask-toggle");
109
 
}
110
 
 
111
 
void
112
 
qmask_actions_update (GimpActionGroup *group,
113
 
                      gpointer         data)
114
 
{
115
 
  GimpImage *gimage = action_data_get_image (data);
116
 
 
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)
123
 
 
124
 
  SET_SENSITIVE ("qmask-active", gimage);
125
 
  SET_SENSITIVE ("qmask-toggle", gimage);
126
 
 
127
 
  SET_ACTIVE ("qmask-active", gimage && gimage->qmask_state);
128
 
  SET_ACTIVE ("qmask-toggle", gimage && gimage->qmask_state);
129
 
 
130
 
  SET_SENSITIVE ("qmask-invert-on",  gimage);
131
 
  SET_SENSITIVE ("qmask-invert-off", gimage);
132
 
 
133
 
  if (gimage && gimage->qmask_inverted)
134
 
    SET_ACTIVE ("qmask-invert-on", TRUE);
135
 
  else
136
 
    SET_ACTIVE ("qmask-invert-off", TRUE);
137
 
 
138
 
  SET_SENSITIVE ("qmask-configure", gimage);
139
 
 
140
 
  if (gimage)
141
 
    SET_COLOR ("qmask-configure", &gimage->qmask_color);
142
 
 
143
 
#undef SET_SENSITIVE
144
 
#undef SET_ACTIVE
145
 
#undef SET_COLOR
146
 
}