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

« back to all changes in this revision

Viewing changes to app/actions/image-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
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
41
41
#include "gimp-intl.h"
42
42
 
43
43
 
44
 
static GimpActionEntry image_actions[] =
 
44
static const GimpActionEntry image_actions[] =
45
45
{
46
46
  { "toolbox-menubar", NULL,
47
47
    N_("Toolbox Menu"), NULL, NULL, NULL,
55
55
    N_("Image Menu"), NULL, NULL, NULL,
56
56
    GIMP_HELP_IMAGE_WINDOW },
57
57
 
58
 
  { "extensions-menu",      NULL, N_("_Xtns")      },
59
 
  { "image-menu",           NULL, N_("_Image")     },
60
 
  { "image-mode-menu",      NULL, N_("_Mode")      },
61
 
  { "image-transform-menu", NULL, N_("_Transform") },
62
 
  { "image-guides-menu",    NULL, N_("_Guides")    },
 
58
  { "extensions-menu",        NULL, N_("_Xtns")       },
 
59
 
 
60
  { "image-menu",             NULL, N_("_Image")      },
 
61
  { "image-mode-menu",        NULL, N_("_Mode")       },
 
62
  { "image-transform-menu",   NULL, N_("_Transform")  },
 
63
  { "image-guides-menu",      NULL, N_("_Guides")     },
 
64
 
 
65
  { "colors-menu",            NULL, N_("_Colors")     },
 
66
  { "colors-info-menu",       NULL, N_("I_nfo")       },
 
67
  { "colors-auto-menu",       NULL, N_("_Auto")       },
 
68
  { "colors-map-menu",        NULL, N_("_Map")        },
 
69
  { "colors-components-menu", NULL, N_("C_omponents") },
63
70
 
64
71
  { "image-new", GTK_STOCK_NEW,
65
 
    N_("_New..."), "<control>N", NULL,
 
72
    N_("_New..."), "<control>N",
 
73
    N_("Create a new image"),
66
74
    G_CALLBACK (image_new_cmd_callback),
67
75
    GIMP_HELP_FILE_NEW },
68
76
 
69
77
  { "image-new-from-image", GTK_STOCK_NEW,
70
 
    N_("_New..."), NULL, NULL,
 
78
    N_("_New..."), NULL,
 
79
    N_("Create a new image"),
71
80
    G_CALLBACK (image_new_from_image_cmd_callback),
72
81
    GIMP_HELP_FILE_NEW },
73
82
 
74
83
  { "image-resize", GIMP_STOCK_RESIZE,
75
 
    N_("Can_vas Size..."), NULL, NULL,
 
84
    N_("Can_vas Size..."), NULL,
 
85
    N_("Adjust the image dimensions"),
76
86
    G_CALLBACK (image_resize_cmd_callback),
77
87
    GIMP_HELP_IMAGE_RESIZE },
78
88
 
79
89
  { "image-resize-to-layers", NULL,
80
 
    N_("F_it Canvas to Layers"), NULL, NULL,
 
90
    N_("F_it Canvas to Layers"), NULL,
 
91
    N_("Resize the image to enclose all layers"),
81
92
    G_CALLBACK (image_resize_to_layers_cmd_callback),
82
93
    GIMP_HELP_IMAGE_RESIZE_TO_LAYERS },
83
94
 
84
95
  { "image-print-size", GIMP_STOCK_PRINT_RESOLUTION,
85
 
    N_("_Print Size..."), NULL, NULL,
 
96
    N_("_Print Size..."), NULL,
 
97
    N_("Adjust the print resolution"),
86
98
    G_CALLBACK (image_print_size_cmd_callback),
87
99
    GIMP_HELP_IMAGE_PRINT_SIZE },
88
100
 
89
101
  { "image-scale", GIMP_STOCK_SCALE,
90
 
    N_("_Scale Image..."), NULL, NULL,
 
102
    N_("_Scale Image..."), NULL,
 
103
    N_("Change the size of the image content"),
91
104
    G_CALLBACK (image_scale_cmd_callback),
92
105
    GIMP_HELP_IMAGE_SCALE },
93
106
 
94
107
  { "image-crop", GIMP_STOCK_TOOL_CROP,
95
 
    N_("_Crop Image"), NULL, NULL,
 
108
    N_("_Crop Image"), NULL,
 
109
    N_("Crop the image to the extents of the selection"),
96
110
    G_CALLBACK (image_crop_cmd_callback),
97
111
    GIMP_HELP_IMAGE_CROP },
98
112
 
99
113
  { "image-duplicate", GIMP_STOCK_DUPLICATE,
100
 
    N_("_Duplicate"), "<control>D", NULL,
 
114
    N_("_Duplicate"), "<control>D",
 
115
    N_("Create a duplicate of this image"),
101
116
    G_CALLBACK (image_duplicate_cmd_callback),
102
117
    GIMP_HELP_IMAGE_DUPLICATE },
103
118
 
104
119
  { "image-merge-layers", NULL,
105
 
    N_("Merge Visible _Layers..."), "<control>M", NULL,
 
120
    N_("Merge Visible _Layers..."), "<control>M",
 
121
    N_("Merge all visible layers into one layer"),
106
122
    G_CALLBACK (image_merge_layers_cmd_callback),
107
123
    GIMP_HELP_IMAGE_MERGE_LAYERS },
108
124
 
109
125
  { "image-flatten", NULL,
110
 
    N_("_Flatten Image"), NULL, NULL,
 
126
    N_("_Flatten Image"), NULL,
 
127
    N_("Merge all layers into one and remove transparency"),
111
128
    G_CALLBACK (image_flatten_image_cmd_callback),
112
129
    GIMP_HELP_IMAGE_FLATTEN },
113
130
 
114
131
  { "image-configure-grid", GIMP_STOCK_GRID,
115
 
    N_("Configure G_rid..."), NULL, NULL,
 
132
    N_("Configure G_rid..."), NULL,
 
133
    N_("Configure the grid for this image"),
116
134
    G_CALLBACK (image_configure_grid_cmd_callback),
117
 
    GIMP_HELP_IMAGE_GRID }
 
135
    GIMP_HELP_IMAGE_GRID },
 
136
 
 
137
  { "image-properties", GTK_STOCK_INFO,
 
138
    N_("Image Pr_operties"), NULL,
 
139
    N_("Display information about this image"),
 
140
    G_CALLBACK (image_properties_cmd_callback),
 
141
    GIMP_HELP_IMAGE_PROPERTIES }
118
142
};
119
143
 
120
 
static GimpEnumActionEntry image_convert_actions[] =
 
144
static const GimpRadioActionEntry image_convert_actions[] =
121
145
{
122
146
  { "image-convert-rgb", GIMP_STOCK_CONVERT_RGB,
123
 
    N_("_RGB"), NULL, NULL,
124
 
    GIMP_RGB, FALSE,
125
 
    GIMP_HELP_IMAGE_CONVERT_RGB },
 
147
    N_("_RGB"), NULL,
 
148
    N_("Convert the image to the RGB colorspace"),
 
149
    GIMP_RGB, GIMP_HELP_IMAGE_CONVERT_RGB },
126
150
 
127
151
  { "image-convert-grayscale", GIMP_STOCK_CONVERT_GRAYSCALE,
128
 
    N_("_Grayscale"), NULL, NULL,
129
 
    GIMP_GRAY, FALSE,
130
 
    GIMP_HELP_IMAGE_CONVERT_GRAYSCALE },
 
152
    N_("_Grayscale"), NULL,
 
153
    N_("Convert the image to grayscale"),
 
154
    GIMP_GRAY, GIMP_HELP_IMAGE_CONVERT_GRAYSCALE },
131
155
 
132
156
  { "image-convert-indexed", GIMP_STOCK_CONVERT_INDEXED,
133
 
    N_("_Indexed..."), NULL, NULL,
134
 
    GIMP_INDEXED, FALSE,
135
 
    GIMP_HELP_IMAGE_CONVERT_INDEXED }
 
157
    N_("_Indexed..."), NULL,
 
158
    N_("Convert the image to indexed colors"),
 
159
    GIMP_INDEXED, GIMP_HELP_IMAGE_CONVERT_INDEXED }
136
160
};
137
161
 
138
 
static GimpEnumActionEntry image_flip_actions[] =
 
162
static const GimpEnumActionEntry image_flip_actions[] =
139
163
{
140
164
  { "image-flip-horizontal", GIMP_STOCK_FLIP_HORIZONTAL,
141
 
    N_("Flip _Horizontally"), NULL, NULL,
 
165
    N_("Flip _Horizontally"), NULL,
 
166
    N_("Flip image horizontally"),
142
167
    GIMP_ORIENTATION_HORIZONTAL, FALSE,
143
168
    GIMP_HELP_IMAGE_FLIP_HORIZONTAL },
144
169
 
145
170
  { "image-flip-vertical", GIMP_STOCK_FLIP_VERTICAL,
146
 
    N_("Flip _Vertically"), NULL, NULL,
 
171
    N_("Flip _Vertically"), NULL,
 
172
    N_("Flip image vertically"),
147
173
    GIMP_ORIENTATION_VERTICAL, FALSE,
148
174
    GIMP_HELP_IMAGE_FLIP_VERTICAL }
149
175
};
150
176
 
151
 
static GimpEnumActionEntry image_rotate_actions[] =
 
177
static const GimpEnumActionEntry image_rotate_actions[] =
152
178
{
153
179
  { "image-rotate-90", GIMP_STOCK_ROTATE_90,
154
 
    /*  please use the degree symbol in the translation  */
155
 
    N_("Rotate 90 degrees _CW"), NULL, NULL,
 
180
    N_("Rotate 90° _clockwise"), NULL,
 
181
    N_("Rotate the image 90 degrees to the right"),
156
182
    GIMP_ROTATE_90, FALSE,
157
183
    GIMP_HELP_IMAGE_ROTATE_90 },
158
184
 
159
185
  { "image-rotate-180", GIMP_STOCK_ROTATE_180,
160
 
    N_("Rotate _180 degrees"), NULL, NULL,
 
186
    N_("Rotate _180°"), NULL,
 
187
    N_("Turn the image upside-down"),
161
188
    GIMP_ROTATE_180, FALSE,
162
189
    GIMP_HELP_IMAGE_ROTATE_180 },
163
190
 
164
191
  { "image-rotate-270", GIMP_STOCK_ROTATE_270,
165
 
    N_("Rotate 90 degrees CC_W"), NULL, NULL,
 
192
    N_("Rotate 90° counter-clock_wise"), NULL,
 
193
    N_("Rotate the image 90 degrees to the left"),
166
194
    GIMP_ROTATE_270, FALSE,
167
195
    GIMP_HELP_IMAGE_ROTATE_270 }
168
196
};
181
209
                                        "image-new-from-image");
182
210
  gtk_action_set_accel_path (action, "<Actions>/image/image-new");
183
211
 
184
 
#ifdef __GNUC__
185
 
#warning FIXME: remove accel_path hack
186
 
#endif
187
 
  g_object_set_data (G_OBJECT (action), "gimp-accel-path",
188
 
                     "<Actions>/image/image-new");
189
 
 
190
 
  gimp_action_group_add_enum_actions (group,
191
 
                                      image_convert_actions,
192
 
                                      G_N_ELEMENTS (image_convert_actions),
193
 
                                      G_CALLBACK (image_convert_cmd_callback));
 
212
  gimp_action_group_add_radio_actions (group,
 
213
                                       image_convert_actions,
 
214
                                       G_N_ELEMENTS (image_convert_actions),
 
215
                                       NULL, 0,
 
216
                                       G_CALLBACK (image_convert_cmd_callback));
194
217
 
195
218
  gimp_action_group_add_enum_actions (group,
196
219
                                      image_flip_actions,
207
230
image_actions_update (GimpActionGroup *group,
208
231
                      gpointer         data)
209
232
{
210
 
  GimpImage *gimage     = action_data_get_image (data);
211
 
  gboolean   is_rgb     = FALSE;
212
 
  gboolean   is_gray    = FALSE;
213
 
  gboolean   is_indexed = FALSE;
214
 
  gboolean   fs         = FALSE;
215
 
  gboolean   aux        = FALSE;
216
 
  gboolean   lp         = FALSE;
217
 
  gboolean   sel        = FALSE;
 
233
  GimpImage *image = action_data_get_image (data);
 
234
  gboolean   fs    = FALSE;
 
235
  gboolean   aux   = FALSE;
 
236
  gboolean   lp    = FALSE;
 
237
  gboolean   sel   = FALSE;
218
238
 
219
 
  if (gimage)
 
239
  if (image)
220
240
    {
221
 
      GimpImageBaseType base_type;
222
 
 
223
 
      base_type = gimp_image_base_type (gimage);
224
 
 
225
 
      is_rgb     = (base_type == GIMP_RGB);
226
 
      is_gray    = (base_type == GIMP_GRAY);
227
 
      is_indexed = (base_type == GIMP_INDEXED);
228
 
 
229
 
      fs  = (gimp_image_floating_sel (gimage) != NULL);
230
 
      aux = (gimp_image_get_active_channel (gimage) != NULL);
231
 
      lp  = ! gimp_image_is_empty (gimage);
232
 
      sel = ! gimp_channel_is_empty (gimp_image_get_mask (gimage));
 
241
      const gchar *action = NULL;
 
242
 
 
243
      switch (gimp_image_base_type (image))
 
244
        {
 
245
        case GIMP_RGB:
 
246
          action = "image-convert-rgb";
 
247
          break;
 
248
 
 
249
        case GIMP_GRAY:
 
250
          action = "image-convert-grayscale";
 
251
          break;
 
252
 
 
253
        case GIMP_INDEXED:
 
254
          action = "image-convert-indexed";
 
255
          break;
 
256
        }
 
257
 
 
258
      gimp_action_group_set_action_active (group, action, TRUE);
 
259
 
 
260
      fs  = (gimp_image_floating_sel (image) != NULL);
 
261
      aux = (gimp_image_get_active_channel (image) != NULL);
 
262
      lp  = ! gimp_image_is_empty (image);
 
263
      sel = ! gimp_channel_is_empty (gimp_image_get_mask (image));
233
264
    }
234
265
 
235
266
#define SET_SENSITIVE(action,condition) \
236
267
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
237
268
 
238
 
  SET_SENSITIVE ("image-convert-rgb",       gimage && ! is_rgb);
239
 
  SET_SENSITIVE ("image-convert-grayscale", gimage && ! is_gray);
240
 
  SET_SENSITIVE ("image-convert-indexed",   gimage && ! is_indexed);
241
 
 
242
 
  SET_SENSITIVE ("image-flip-horizontal", gimage);
243
 
  SET_SENSITIVE ("image-flip-vertical",   gimage);
244
 
  SET_SENSITIVE ("image-rotate-90",       gimage);
245
 
  SET_SENSITIVE ("image-rotate-180",      gimage);
246
 
  SET_SENSITIVE ("image-rotate-270",      gimage);
247
 
 
248
 
  SET_SENSITIVE ("image-resize",           gimage);
249
 
  SET_SENSITIVE ("image-resize-to-layers", gimage);
250
 
  SET_SENSITIVE ("image-print-size",       gimage);
251
 
  SET_SENSITIVE ("image-scale",            gimage);
252
 
  SET_SENSITIVE ("image-crop",             gimage && sel);
253
 
  SET_SENSITIVE ("image-duplicate",        gimage);
254
 
  SET_SENSITIVE ("image-merge-layers",     gimage && !fs && !aux && lp);
255
 
  SET_SENSITIVE ("image-flatten",          gimage && !fs && !aux && lp);
256
 
  SET_SENSITIVE ("image-configure-grid",   gimage);
 
269
  SET_SENSITIVE ("image-convert-rgb",       image);
 
270
  SET_SENSITIVE ("image-convert-grayscale", image);
 
271
  SET_SENSITIVE ("image-convert-indexed",   image);
 
272
 
 
273
  SET_SENSITIVE ("image-flip-horizontal", image);
 
274
  SET_SENSITIVE ("image-flip-vertical",   image);
 
275
  SET_SENSITIVE ("image-rotate-90",       image);
 
276
  SET_SENSITIVE ("image-rotate-180",      image);
 
277
  SET_SENSITIVE ("image-rotate-270",      image);
 
278
 
 
279
  SET_SENSITIVE ("image-resize",           image);
 
280
  SET_SENSITIVE ("image-resize-to-layers", image);
 
281
  SET_SENSITIVE ("image-print-size",       image);
 
282
  SET_SENSITIVE ("image-scale",            image);
 
283
  SET_SENSITIVE ("image-crop",             image && sel);
 
284
  SET_SENSITIVE ("image-duplicate",        image);
 
285
  SET_SENSITIVE ("image-merge-layers",     image && !fs && !aux && lp);
 
286
  SET_SENSITIVE ("image-flatten",          image && !fs && !aux && lp);
 
287
  SET_SENSITIVE ("image-configure-grid",   image);
 
288
  SET_SENSITIVE ("image-properties",       image);
257
289
 
258
290
#undef SET_SENSITIVE
259
291
}