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

« back to all changes in this revision

Viewing changes to app/actions/quick-mask-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
/* GIMP - The GNU 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 "quick-mask-actions.h"
 
34
#include "quick-mask-commands.h"
 
35
 
 
36
#include "gimp-intl.h"
 
37
 
 
38
 
 
39
static const GimpActionEntry quick_mask_actions[] =
 
40
{
 
41
  { "quick-mask-popup", NULL,
 
42
    N_("Quick Mask Menu"), NULL, NULL, NULL,
 
43
    GIMP_HELP_QUICK_MASK },
 
44
 
 
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 }
 
49
};
 
50
 
 
51
static const GimpToggleActionEntry quick_mask_toggle_actions[] =
 
52
{
 
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),
 
56
    FALSE,
 
57
    GIMP_HELP_QUICK_MASK_TOGGLE }
 
58
};
 
59
 
 
60
static const GimpRadioActionEntry quick_mask_invert_actions[] =
 
61
{
 
62
  { "quick-mask-invert-on", NULL,
 
63
    N_("Mask _Selected Areas"), NULL, NULL,
 
64
    TRUE,
 
65
    GIMP_HELP_QUICK_MASK_INVERT },
 
66
 
 
67
  { "quick-mask-invert-off", NULL,
 
68
    N_("Mask _Unselected Areas"), NULL, NULL,
 
69
    FALSE,
 
70
    GIMP_HELP_QUICK_MASK_INVERT }
 
71
};
 
72
 
 
73
 
 
74
void
 
75
quick_mask_actions_setup (GimpActionGroup *group)
 
76
{
 
77
  gimp_action_group_add_actions (group,
 
78
                                 quick_mask_actions,
 
79
                                 G_N_ELEMENTS (quick_mask_actions));
 
80
 
 
81
  gimp_action_group_add_toggle_actions (group,
 
82
                                        quick_mask_toggle_actions,
 
83
                                        G_N_ELEMENTS (quick_mask_toggle_actions));
 
84
 
 
85
  gimp_action_group_add_radio_actions (group,
 
86
                                       quick_mask_invert_actions,
 
87
                                       G_N_ELEMENTS (quick_mask_invert_actions),
 
88
                                       NULL,
 
89
                                       FALSE,
 
90
                                       G_CALLBACK (quick_mask_invert_cmd_callback));
 
91
}
 
92
 
 
93
void
 
94
quick_mask_actions_update (GimpActionGroup *group,
 
95
                           gpointer         data)
 
96
{
 
97
  GimpImage *image = action_data_get_image (data);
 
98
 
 
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)
 
105
 
 
106
  SET_SENSITIVE ("quick-mask-toggle", image);
 
107
  SET_ACTIVE    ("quick-mask-toggle", image && image->quick_mask_state);
 
108
 
 
109
  SET_SENSITIVE ("quick-mask-invert-on",  image);
 
110
  SET_SENSITIVE ("quick-mask-invert-off", image);
 
111
 
 
112
  if (image && image->quick_mask_inverted)
 
113
    SET_ACTIVE ("quick-mask-invert-on", TRUE);
 
114
  else
 
115
    SET_ACTIVE ("quick-mask-invert-off", TRUE);
 
116
 
 
117
  SET_SENSITIVE ("quick-mask-configure", image);
 
118
 
 
119
  if (image)
 
120
    SET_COLOR ("quick-mask-configure", &image->quick_mask_color);
 
121
 
 
122
#undef SET_SENSITIVE
 
123
#undef SET_ACTIVE
 
124
#undef SET_COLOR
 
125
}