gimpitemfactory.c 63.8 KB
Newer Older
Elliot Lee's avatar
Elliot Lee committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/* The GIMP -- an image manipulation program
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Elliot Lee's avatar
Elliot Lee committed
17
 */
Sven Neumann's avatar
Sven Neumann committed
18

19 20
#include "config.h"

Elliot Lee's avatar
Elliot Lee committed
21 22
#include <stdlib.h>
#include <string.h>
23

Sven Neumann's avatar
Sven Neumann committed
24
#include <gtk/gtk.h>
25 26
#include <gdk/gdkkeysyms.h>

Sven Neumann's avatar
Sven Neumann committed
27 28
#include "apptypes.h"

Elliot Lee's avatar
Elliot Lee committed
29
#include "appenv.h"
30
#include "channels_dialog.h"
Elliot Lee's avatar
Elliot Lee committed
31
#include "commands.h"
32
#include "dialog_handler.h"
Elliot Lee's avatar
Elliot Lee committed
33
#include "fileops.h"
34
#include "gdisplay.h"
35
#include "gimphelp.h"
Elliot Lee's avatar
Elliot Lee committed
36
#include "gimprc.h"
Michael Natterer's avatar
Michael Natterer committed
37
#include "gimpui.h"
38
#include "layers_dialog.h"
Elliot Lee's avatar
Elliot Lee committed
39
#include "menus.h"
40
#include "paths_dialog.h"
41
#include "preferences_dialog.h"
42
#include "toolbox.h"
43 44

#include "tools/tools.h"
Elliot Lee's avatar
Elliot Lee committed
45

Tor Lillqvist's avatar
Tor Lillqvist committed
46
#include "libgimp/gimpenv.h"
47

48 49 50
#include "libgimp/gimpintl.h"


Sven Neumann's avatar
Sven Neumann committed
51
#define MRU_MENU_ENTRY_SIZE (strlen ("/File/MRU00 ") + 1)
52 53
#define MRU_MENU_ACCEL_SIZE sizeof ("<control>0")

54 55 56 57 58 59 60 61 62 63 64 65
static void   menus_create_item     (GtkItemFactory       *item_factory,
				     GimpItemFactoryEntry *entry,
				     gpointer              callback_data,
				     guint                 callback_type);
static void   menus_create_items    (GtkItemFactory       *item_factory,
				     guint                 n_entries,
				     GimpItemFactoryEntry *entries,
				     gpointer              callback_data,
				     guint                 callback_type);
static void   menus_create_branches (GtkItemFactory	  *item_factory,
				     GimpItemFactoryEntry *entry);
static void   menus_init            (void);
66 67

#ifdef ENABLE_NLS
68 69
static gchar *menu_translate        (const gchar          *path,
				     gpointer              data);
70 71 72 73
#else
#define menu_translate NULL
#endif

74 75 76
static void   tearoff_cmd_callback  (GtkWidget            *widget,
				     gpointer              callback_data,
				     guint                 callback_action);
Daniel Egger's avatar
Daniel Egger committed
77 78 79
static gint   tearoff_delete_cb     (GtkWidget		  *widget, 
    				     GdkEvent		  *event,
				     gpointer		   data);
80
#ifdef ENABLE_DEBUG_ENTRY
81 82 83 84 85 86
static void   menus_debug_recurse_menu (GtkWidget *menu,
					gint       depth,
					gchar     *path);
static void   menus_debug_cmd_callback (GtkWidget *widget,
					gpointer   callback_data,
					guint      callback_action);
87
#endif  /*  ENABLE_DEBUG_ENTRY  */
88

89 90
static GSList *last_opened_raw_filenames = NULL;

91 92
/*****  <Toolbox>  *****/

93 94
static GimpItemFactoryEntry toolbox_entries[] =
{
95 96
  /*  <Toolbox>/File  */

97
  /* the underscore installs an accelerator using the character that follows */
98
  { { N_("/_File"), NULL, NULL, 0, "<Branch>" },
99
    NULL, NULL },
100
  { { N_("/File/New..."), "<control>N", file_new_cmd_callback, 0 },
101
    "file/dialogs/file_new.html", NULL },
102
  { { N_("/File/Open..."), "<control>O", file_open_cmd_callback, 0 },
Daniel Egger's avatar
Daniel Egger committed
103
    "file/dialogs/file_open.html", NULL },
104 105 106

  /*  <Toolbox>/File/Acquire  */

107
  { { "/File/---", NULL, NULL, 0, "<Separator>" },
108
    NULL, NULL },
109
  { { N_("/File/Acquire"), NULL, NULL, 0, "<Branch>" },
110
    NULL, NULL },
111

112
  { { "/File/---", NULL, NULL, 0, "<Separator>" },
113
    NULL, NULL },
114
  { { N_("/File/Preferences..."), NULL, prefs_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
115
    "file/dialogs/preferences/preferences.html", NULL },
116 117

  /*  <Toolbox>/File/Dialogs  */
118

119
  { { "/File/---", NULL, NULL, 0, "<Separator>" },
120
    NULL, NULL },
121
  { { N_("/File/Dialogs/Layers, Channels & Paths..."), "<control>L", dialogs_lc_cmd_callback, 0 },
122 123 124 125
    "file/dialogs/layers_and_channels.html", NULL },
  { { N_("/File/Dialogs/Tool Options..."), "<control><shift>T", dialogs_tool_options_cmd_callback, 0 },
    "file/dialogs/tool_options.html", NULL },

126
  { { "/File/Dialogs/---", NULL, NULL, 0, "<Separator>" },
127
    NULL, NULL },
128 129 130 131
  { { N_("/File/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
    "file/dialogs/brush_selection.html", NULL },
  { { N_("/File/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
    "file/dialogs/pattern_selection.html", NULL },
132 133
  { { N_("/File/Dialogs/Gradients..."), "<control>G", dialogs_gradients_cmd_callback, 0 },
    "file/dialogs/gradient_selection.html", NULL },
134 135
  { { N_("/File/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
    "file/dialogs/palette_selection.html", NULL },
136 137
  { { N_("/File/Dialogs/Indexed Palette..."), NULL, dialogs_indexed_palette_cmd_callback, 0 },
    "file/dialogs/indexed_palette.html", NULL },
138

139 140
  { { "/File/Dialogs/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
141 142 143 144
  { { N_("/File/Dialogs/Input Devices..."), NULL, dialogs_input_devices_cmd_callback, 0 },
    "file/dialogs/input_devices.html", NULL },
  { { N_("/File/Dialogs/Device Status..."), NULL, dialogs_device_status_cmd_callback, 0 },
    "file/dialogs/device_status.html", NULL },
145

146
  { { "/File/Dialogs/---", NULL, NULL, 0, "<Separator>" },
147
    NULL, NULL },
148
  { { N_("/File/Dialogs/Document Index..."), NULL, dialogs_document_index_cmd_callback, 0 },
149 150 151
    "file/dialogs/document_index.html", NULL },
  { { N_("/File/Dialogs/Error Console..."), NULL, dialogs_error_console_cmd_callback, 0 },
    "file/dialogs/error_console.html", NULL },
152
#ifdef DISPLAY_FILTERS
153
  { { N_("/File/Dialogs/Display Filters..."), NULL, dialogs_display_filters_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
154
    "file/dialogs/display_filters/display_filters.html", NULL },
155
#endif /* DISPLAY_FILTERS */
156

157
  { { "/File/---", NULL, NULL, 0, "<Separator>" },
158
    NULL, NULL },
159 160 161 162

  /*  MRU entries are inserted here  */

  { { "/File/---MRU", NULL, NULL, 0, "<Separator>" },
163
    NULL, NULL },
164 165
  { { N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
    "file/quit.html", NULL },
166 167 168

  /*  <Toolbox>/Xtns  */

169
  /* the underscore installs an accelerator using the character that follows */
170
  { { N_("/_Xtns"), NULL, NULL, 0, "<Branch>" },
171
    NULL, NULL },
172
  { { N_("/Xtns/Module Browser..."), NULL, dialogs_module_browser_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
173
    "dialogs/module_browser.html", NULL },
174

175
  { { "/Xtns/---", NULL, NULL, 0, "<Separator>" },
176
    NULL, NULL },
177 178 179

  /*  <Toolbox>/Help  */

180
  /* the underscore installs an accelerator using the character that follows */
181
  { { N_("/_Help"), NULL, NULL, 0, "<Branch>" },
182
    NULL, NULL },
183 184 185 186
  { { N_("/Help/Help..."), "F1", help_help_cmd_callback, 0 },
    "help/dialogs/help.html", NULL },
  { { N_("/Help/Context Help..."), "<shift>F1", help_context_help_cmd_callback, 0 },
    "help/context_help.html", NULL },
Sven Neumann's avatar
Sven Neumann committed
187
  { { N_("/Help/Tip of the Day..."), NULL, help_tips_cmd_callback, 0 },
188 189 190
    "help/dialogs/tip_of_the_day.html", NULL },
  { { N_("/Help/About..."), NULL, help_about_cmd_callback, 0 },
    "help/dialogs/about.html", NULL },
191
#ifdef ENABLE_DEBUG_ENTRY
192
  { { N_("/Help/Dump Items (Debug)"), NULL, menus_debug_cmd_callback, 0 },
193
    NULL, NULL }
194
#endif
195
};
196

197 198
static guint n_toolbox_entries = (sizeof (toolbox_entries) /
				  sizeof (toolbox_entries[0]));
199 200
static GtkItemFactory *toolbox_factory = NULL;

201 202
/*****  <Image>  *****/

203 204
static GimpItemFactoryEntry image_entries[] =
{
205
  { { "/tearoff1", NULL, tearoff_cmd_callback, 0, "<Tearoff>" },
206
    NULL, NULL },
207 208 209 210

  /*  <Image>/File  */

  { { N_("/File/New..."), "<control>N", file_new_cmd_callback, 1 },
211
    "file/dialogs/file_new.html", NULL },
212
  { { N_("/File/Open..."), "<control>O", file_open_cmd_callback, 0 },
Daniel Egger's avatar
Daniel Egger committed
213
    "file/dialogs/file_open.html", NULL },
214
  { { N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
Daniel Egger's avatar
Daniel Egger committed
215
    "file/dialogs/file_save.html", NULL },
216 217 218
  { { N_("/File/Save as..."), NULL, file_save_as_cmd_callback, 0 },
    "file/dialogs/file_save.html", NULL },
  { { N_("/File/Save a Copy as..."), NULL, file_save_a_copy_as_cmd_callback, 0 },
Daniel Egger's avatar
Daniel Egger committed
219
    "file/dialogs/file_save.html", NULL },
220
  { { N_("/File/Revert..."), NULL, file_revert_cmd_callback, 0 },
221
    "file/revert.html", NULL },
222

223
  { { "/File/---", NULL, NULL, 0, "<Separator>" },
224
    NULL, NULL },
Michael Natterer's avatar
Michael Natterer committed
225
  { { N_( "/File/Close"), "<control>W", file_close_cmd_callback, 0 },
226 227
    "file/close.html", NULL },
  { { N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
228
    "file/quit.html", NULL },
229

230
  { { "/File/---moved", NULL, NULL, 0, "<Separator>" },
231 232
    NULL, NULL },

233 234 235 236 237 238 239
  /*  <Image>/Edit  */

  { { N_("/Edit/Undo"), "<control>Z", edit_undo_cmd_callback, 0 },
    "edit/undo.html", NULL },
  { { N_("/Edit/Redo"), "<control>R", edit_redo_cmd_callback, 0 },
    "edit/redo.html", NULL },

240
  { { "/Edit/---", NULL, NULL, 0, "<Separator>" },
241
    NULL, NULL },
242 243 244 245 246 247 248 249
  { { N_("/Edit/Cut"), "<control>X", edit_cut_cmd_callback, 0 },
    "edit/cut.html", NULL },
  { { N_("/Edit/Copy"), "<control>C", edit_copy_cmd_callback, 0 },
    "edit/copy.html", NULL },
  { { N_("/Edit/Paste"), "<control>V", edit_paste_cmd_callback, 0 },
    "edit/paste.html", NULL },
  { { N_("/Edit/Paste Into"), NULL, edit_paste_into_cmd_callback, 0 },
    "edit/paste_into.html", NULL },
Sven Neumann's avatar
Sven Neumann committed
250
  { { N_("/Edit/Paste as New"), NULL, edit_paste_as_new_cmd_callback, 0 },
251
    "edit/paste_as_new.html", NULL },
252 253 254 255 256 257 258 259 260 261

  /*  <Image>/Edit/Buffer  */

  { { N_("/Edit/Buffer/Cut Named..."), "<control><shift>X", edit_named_cut_cmd_callback, 0 },
    "edit/dialogs/cut_named.html", NULL },
  { { N_("/Edit/Buffer/Copy Named..."), "<control><shift>C", edit_named_copy_cmd_callback, 0 },
    "edit/dialogs/copy_named.html", NULL },
  { { N_("/Edit/Buffer/Paste Named..."), "<control><shift>V", edit_named_paste_cmd_callback, 0 },
    "edit/dialogs/paste_named.html", NULL },

262
  { { "/Edit/---", NULL, NULL, 0, "<Separator>" },
263 264 265
    NULL, NULL },
  { { N_("/Edit/Clear"), "<control>K", edit_clear_cmd_callback, 0 },
    "edit/clear.html", NULL },
266 267 268
  { { N_("/Edit/Fill with FG Color"), "<control>comma", edit_fill_cmd_callback, (guint)FOREGROUND_FILL },
    "edit/fill.html", NULL },
  { { N_("/Edit/Fill with BG Color"), "<control>period", edit_fill_cmd_callback, (guint)BACKGROUND_FILL },
269 270 271
    "edit/fill.html", NULL },
  { { N_("/Edit/Stroke"), NULL, edit_stroke_cmd_callback, 0 },
    "edit/stroke.html", NULL },
272

273
  { { "/Edit/---", NULL, NULL, 0, "<Separator>" },
274
    NULL, NULL },
275 276

  /*  <Image>/Select  */
277
  
278 279 280 281 282 283 284 285
  { { N_("/Select/Invert"), "<control>I", select_invert_cmd_callback, 0 },
    "select/invert.html", NULL },
  { { N_("/Select/All"), "<control>A", select_all_cmd_callback, 0 },
    "select/all.html", NULL },
  { { N_("/Select/None"), "<control><shift>A", select_none_cmd_callback, 0 },
    "select/none.html", NULL },
  { { N_("/Select/Float"), "<control><shift>L", select_float_cmd_callback, 0 },
    "select/float.html", NULL },
286

287
  { { "/Select/---", NULL, NULL, 0, "<Separator>" },
288
    NULL, NULL },
289
  { { N_("/Select/Feather..."), "<control><shift>F", select_feather_cmd_callback, 0 },
290 291 292
    "select/dialogs/feather_selection.html", NULL },
  { { N_("/Select/Sharpen"), "<control><shift>H", select_sharpen_cmd_callback, 0 },
    "select/sharpen.html", NULL },
293
  { { N_("/Select/Shrink..."), NULL, select_shrink_cmd_callback, 0 },
294
    "select/dialogs/shrink_selection.html", NULL },
295
  { { N_("/Select/Grow..."), NULL, select_grow_cmd_callback, 0 },
296
    "select/dialogs/grow_selection.html", NULL },
297
  { { N_("/Select/Border..."), "<control><shift>B", select_border_cmd_callback, 0 },
298
    "select/dialogs/border_selection.html", NULL },
299

300
  { { "/Select/---", NULL, NULL, 0, "<Separator>" },
301
    NULL, NULL },
Sven Neumann's avatar
Sven Neumann committed
302
  { { N_("/Select/Save to Channel"), NULL, select_save_cmd_callback, 0 },
303 304
    "select/save_to_channel.html", NULL },

305 306
  /*  <Image>/View  */

307 308 309 310
  { { N_("/View/Zoom In"), "equal", view_zoomin_cmd_callback, 0 },
    "view/zoom.html", NULL },
  { { N_("/View/Zoom Out"), "minus", view_zoomout_cmd_callback, 0 },
    "view/zoom.html", NULL },
311 312 313 314

  /*  <Image>/View/Zoom  */

  { { N_("/View/Zoom/16:1"), NULL, view_zoom_16_1_cmd_callback, 0 },
315
    "view/zoom.html", NULL },
316
  { { N_("/View/Zoom/8:1"), NULL, view_zoom_8_1_cmd_callback, 0 },
317
    "view/zoom.html", NULL },
318
  { { N_("/View/Zoom/4:1"), NULL, view_zoom_4_1_cmd_callback, 0 },
319
    "view/zoom.html", NULL },
320
  { { N_("/View/Zoom/2:1"), NULL, view_zoom_2_1_cmd_callback, 0 },
321
    "view/zoom.html", NULL },
322
  { { N_("/View/Zoom/1:1"), "1", view_zoom_1_1_cmd_callback, 0 },
323
    "view/zoom.html", NULL },
324
  { { N_("/View/Zoom/1:2"), NULL, view_zoom_1_2_cmd_callback, 0 },
325
    "view/zoom.html", NULL },
326
  { { N_("/View/Zoom/1:4"), NULL, view_zoom_1_4_cmd_callback, 0 },
327
    "view/zoom.html", NULL },
328
  { { N_("/View/Zoom/1:8"), NULL, view_zoom_1_8_cmd_callback, 0 },
329
    "view/zoom.html", NULL },
330
  { { N_("/View/Zoom/1:16"), NULL, view_zoom_1_16_cmd_callback, 0 },
331
    "view/zoom.html", NULL },
332

Sven Neumann's avatar
Sven Neumann committed
333
  { { N_("/View/Dot for Dot"), NULL, view_dot_for_dot_cmd_callback, 0, "<ToggleItem>" },
334
    "view/dot_for_dot.html", NULL },
335

336
  { { "/View/---", NULL, NULL, 0, "<Separator>" },
337 338
    NULL, NULL },
  { { N_("/View/Info Window..."), "<control><shift>I", view_info_window_cmd_callback, 0 },
339
    "view/dialogs/info_window.html", NULL },
340
  { { N_("/View/Nav. Window..."), "<control><shift>N", view_nav_window_cmd_callback, 0 },
341 342
    "view/dialogs/navigation_window.html", NULL },

343
  { { "/View/---", NULL, NULL, 0, "<Separator>" },
344 345 346 347 348 349 350 351 352
    NULL, NULL },
  { { N_("/View/Toggle Selection"), "<control>T", view_toggle_selection_cmd_callback, 0, "<ToggleItem>" },
    "view/toggle_selection.html", NULL },
  { { N_("/View/Toggle Rulers"), "<control><shift>R", view_toggle_rulers_cmd_callback, 0, "<ToggleItem>" },
    "view/toggle_rulers.html", NULL },
  { { N_("/View/Toggle Statusbar"), "<control><shift>S", view_toggle_statusbar_cmd_callback, 0, "<ToggleItem>" },
    "view/toggle_statusbar.html", NULL },
  { { N_("/View/Toggle Guides"), "<control><shift>T", view_toggle_guides_cmd_callback, 0, "<ToggleItem>" },
    "view/toggle_guides.html", NULL },
Sven Neumann's avatar
Sven Neumann committed
353
  { { N_("/View/Snap to Guides"), NULL, view_snap_to_guides_cmd_callback, 0, "<ToggleItem>" },
354
    "view/snap_to_guides.html", NULL },
355

356
  { { "/View/---", NULL, NULL, 0, "<Separator>" },
357 358 359 360 361 362
    NULL, NULL },
  { { N_("/View/New View"), NULL, view_new_view_cmd_callback, 0 },
    "view/new_view.html", NULL },
  { { N_("/View/Shrink Wrap"), "<control>E", view_shrink_wrap_cmd_callback, 0 },
    "view/shrink_wrap.html", NULL },

363 364 365 366 367 368 369 370 371
  /*  <Image>/Image/Mode  */

  { { N_("/Image/Mode/RGB"), "<alt>R", image_convert_rgb_cmd_callback, 0 },
    "image/mode/convert_to_rgb.html", NULL },
  { { N_("/Image/Mode/Grayscale"), "<alt>G", image_convert_grayscale_cmd_callback, 0 },
    "image/mode/convert_to_grayscale.html", NULL },
  { { N_("/Image/Mode/Indexed..."), "<alt>I", image_convert_indexed_cmd_callback, 0 },
    "image/mode/dialogs/convert_to_indexed.html", NULL },

372
  { { "/Image/Mode/---", NULL, NULL, 0, "<Separator>" },
373 374 375 376
    NULL, NULL },

  /*  <Image>/Image/Colors  */

377 378
  { { N_("/Image/Colors/Desaturate"), NULL, image_desaturate_cmd_callback, 0 },
    "image/colors/desaturate.html", NULL },
379 380 381
  { { N_("/Image/Colors/Invert"), NULL, image_invert_cmd_callback, 0 },
    "image/colors/invert.html", NULL },

382
  { { "/Image/Colors/---", NULL, NULL, 0, "<Separator>" },
383
    NULL, NULL },
384

385 386 387 388 389
  /*  <Image>/Image/Colors/Auto  */

  { { N_("/Image/Colors/Auto/Equalize"), NULL, image_equalize_cmd_callback, 0 },
    "image/colors/auto/equalize.html", NULL },

390
  { { "/Image/Colors/---", NULL, NULL, 0, "<Separator>" },
391 392 393
    NULL, NULL },

  /*  <Image>/Image/Alpha  */
394 395 396 397

  { { N_("/Image/Alpha/Add Alpha Channel"), NULL, layers_add_alpha_channel_cmd_callback, 0 },
    "layers/add_alpha_channel.html", NULL },

398 399 400
  /*  <Image>/Image/Transforms  */

  { { N_("/Image/Transforms/Offset..."), "<control><shift>O", image_offset_cmd_callback, 0 },
401
    "image/transforms/dialogs/offset.html", NULL },
402
  { { N_("/Image/Transforms/Rotate"), NULL, NULL, 0, "<Branch>" },
403
    NULL, NULL },
404
  { { "/Image/Transforms/---", NULL, NULL, 0, "<Separator>" },
405
    NULL, NULL },
406

407
  { { "/Image/---", NULL, NULL, 0, "<Separator>" },
408
    NULL, NULL },
409
  { { N_("/Image/Canvas Size..."), NULL, image_resize_cmd_callback, 0 },
410
    "image/dialogs/set_canvas_size.html", NULL },
411
  { { N_("/Image/Scale Image..."), NULL, image_scale_cmd_callback, 0 },
412
    "image/dialogs/scale_image.html", NULL },
413
  { { N_("/Image/Duplicate"), "<control>D", image_duplicate_cmd_callback, 0 },
414
    "image/duplicate.html", NULL },
415

416
  { { "/Image/---", NULL, NULL, 0, "<Separator>" },
417 418
    NULL, NULL },

419 420
  /*  <Image>/Layers  */

421
  { { N_("/Layers/Layers, Channels & Paths..."), "<control>L", dialogs_lc_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
422
    "dialogs/layers_and_channels.html", NULL },
423 424 425 426
  { { "/Layers/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
  { { N_("/Layers/Layer to Imagesize"), NULL, layers_resize_to_image_cmd_callback, 0 },
    "layers/layer_to_image_size.html", NULL },
427 428 429

  /*  <Image>/Layers/Stack  */

430
  { { N_("/Layers/Stack/Previous Layer"), "Prior", layers_previous_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
431
    "layers/stack/stack.html#previous_layer", NULL },
432
  { { N_("/Layers/Stack/Next Layer"), "Next", layers_next_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
433
    "layers/stack/stack.html#next_layer", NULL },
434
  { { N_("/Layers/Stack/Raise Layer"), "<shift>Prior", layers_raise_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
435
    "layers/stack/stack.html#raise_layer", NULL },
436
  { { N_("/Layers/Stack/Lower Layer"), "<shift>Next", layers_lower_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
437
    "layers/stack/stack.html#lower_layer", NULL },
438
  { { N_("/Layers/Stack/Layer to Top"), "<control>Prior", layers_raise_to_top_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
439
    "layers/stack/stack.html#layer_to_top", NULL },
440
  { { N_("/Layers/Stack/Layer to Bottom"), "<control>Next", layers_lower_to_bottom_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
441
    "layers/stack/stack.html#layer_to_bottom", NULL },
442
  { { "/Layers/Stack/---", NULL, NULL, 0, "<Separator>" },
443 444 445 446
    NULL, NULL },

  /*  <Image>/Layers/Rotate  */

447
  { { N_("/Layers/Rotate"), NULL, NULL, 0, "<Branch>" },
448 449
    NULL, NULL },

450
  { { "/Layers/---", NULL, NULL, 0, "<Separator>" },
451 452 453
    NULL, NULL },
  { { N_("/Layers/Anchor Layer"), "<control>H", layers_anchor_cmd_callback, 0 },
    "layers/anchor_layer.html", NULL },
454
  { { N_("/Layers/Merge Visible Layers..."), "<control>M", layers_merge_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
455
    "layers/dialogs/merge_visible_layers.html", NULL },
456 457
  { { N_("/Layers/Flatten Image"), NULL, layers_flatten_cmd_callback, 0 },
    "layers/flatten_image.html", NULL },
458

459
  { { "/Layers/---", NULL, NULL, 0, "<Separator>" },
460
    NULL, NULL },
Sven Neumann's avatar
Sven Neumann committed
461
  { { N_("/Layers/Mask to Selection"), NULL, layers_mask_select_cmd_callback, 0 },
462
    "layers/mask_to_selection.html", NULL },
463

464
  { { "/Layers/---", NULL, NULL, 0, "<Separator>" },
465
    NULL, NULL },
466 467
  { { N_("/Layers/Add Alpha Channel"), NULL, layers_add_alpha_channel_cmd_callback, 0 },
    "layers/add_alpha_channel.html", NULL },
Sven Neumann's avatar
Sven Neumann committed
468
  { { N_("/Layers/Alpha to Selection"), NULL, layers_alpha_select_cmd_callback, 0 },
469 470
    "layers/alpha_to_selection.html", NULL },

471
  { { "/Layers/---", NULL, NULL, 0, "<Separator>" },
472
    NULL, NULL },
Michael Natterer's avatar
Michael Natterer committed
473

474 475
  /*  <Image>/Tools  */

476
  { { N_("/Tools/Toolbox"), NULL, toolbox_raise_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
477
    "toolbox/toolbox.html", NULL },
478
  { { N_("/Tools/Default Colors"), "D", tools_default_colors_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
479
    "toolbox/toolbox.html#default_colors", NULL },
480
  { { N_("/Tools/Swap Colors"), "X", tools_swap_colors_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
481
    "toolbox/toolbox.html#swap_colors", NULL },
482
  { { "/Tools/---", NULL, NULL, 0, "<Separator>" },  
483
    NULL, NULL },
484

485 486
  /*  <Image>/Dialogs  */

487
  { { N_("/Dialogs/Layers, Channels & Paths..."), "<control>L", dialogs_lc_cmd_callback, 0 },
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513
    "dialogs/layers_and_channels.html", NULL },
  { { N_("/Dialogs/Tool Options..."), NULL, dialogs_tool_options_cmd_callback, 0 },
    "dialogs/tool_options.html", NULL },

  { { "/Dialogs/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
  { { N_("/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
    "dialogs/brush_selection.html", NULL },
  { { N_("/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
    "dialogs/pattern_selection.html", NULL },
  { { N_("/Dialogs/Gradients..."), "<control>G", dialogs_gradients_cmd_callback, 0 },
    "dialogs/gradient_selection.html", NULL },
  { { N_("/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
    "dialogs/palette_selection.html", NULL },
  { { N_("/Dialogs/Indexed Palette..."), NULL, dialogs_indexed_palette_cmd_callback, 0 },
    "dialogs/indexed_palette.html", NULL },

  { { "/Dialogs/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
  { { N_("/Dialogs/Input Devices..."), NULL, dialogs_input_devices_cmd_callback, 0 },
    "dialogs/input_devices.html", NULL },
  { { N_("/Dialogs/Device Status..."), NULL, dialogs_device_status_cmd_callback, 0 },
    "dialogs/device_status.html", NULL },

  { { "/Dialogs/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
514
  { { N_("/Dialogs/Document Index..."), NULL, dialogs_document_index_cmd_callback, 0 },
515 516 517
    "dialogs/document_index.html", NULL },
  { { N_("/Dialogs/Error Console..."), NULL, dialogs_error_console_cmd_callback, 0 },
    "dialogs/error_console.html", NULL },
518
#ifdef DISPLAY_FILTERS
519 520
  { { N_("/Dialogs/Display Filters..."), NULL, dialogs_display_filters_cmd_callback, 0 },
    "dialogs/display_filters/display_filters.html", NULL },
521
#endif /* DISPLAY_FILTERS */
522 523 524
  { { N_("/Dialogs/Undo History..."), NULL, dialogs_undo_history_cmd_callback, 0},
    "dialogs/undo_history.html", NULL },

525 526 527 528

  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },

529
  /*  <Image>/Filters  */
Michael Natterer's avatar
Michael Natterer committed
530

Sven Neumann's avatar
Sven Neumann committed
531
  { { N_("/Filters/Repeat Last"), "<alt>F", filters_repeat_cmd_callback, 0x0 },
532
    "filters/repeat_last.html", NULL },
Sven Neumann's avatar
Sven Neumann committed
533
  { { N_("/Filters/Re-Show Last"), "<alt><shift>F", filters_repeat_cmd_callback, 0x1 },
534
    "filters/reshow_last.html", NULL },
535

536 537 538 539
  { { "/Filters/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
  { { N_("/Filters/Blur"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
540
  { { N_("/Filters/Colors"), NULL, NULL, 0, "<Branch>" },
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
    NULL, NULL },
  { { N_("/Filters/Noise"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
  { { N_("/Filters/Edge-Detect"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
  { { N_("/Filters/Enhance"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
  { { N_("/Filters/Generic"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },

  { { "/Filters/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
  { { N_("/Filters/Glass Effects"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
  { { N_("/Filters/Light Effects"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
  { { N_("/Filters/Distorts"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
  { { N_("/Filters/Artistic"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
  { { N_("/Filters/Map"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
  { { N_("/Filters/Render"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
  { { N_("/Filters/Web"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },

568
  { { "/Filters/---INSERT", NULL, NULL, 0, "<Separator>" },
569 570 571 572
    NULL, NULL },
  { { N_("/Filters/Animation"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
  { { N_("/Filters/Combine"), NULL, NULL, 0, "<Branch>" },
573
    NULL, NULL },
574 575 576 577 578

  { { "/Filters/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
  { { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
579
};
580 581
static guint n_image_entries = (sizeof (image_entries) /
				sizeof (image_entries[0]));
582
static GtkItemFactory *image_factory = NULL;
583

584 585
/*****  <Load>  *****/

586
static GimpItemFactoryEntry load_entries[] =
587
{
588
  { { N_("/Automatic"), NULL, file_open_by_extension_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
589
    "open_by_extension.html", NULL },
590

591 592
  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL }
593
};
594 595
static guint n_load_entries = (sizeof (load_entries) /
			       sizeof (load_entries[0]));
596
static GtkItemFactory *load_factory = NULL;
Manish Singh's avatar
Manish Singh committed
597
  
598 599
/*****  <Save>  *****/

600
static GimpItemFactoryEntry save_entries[] =
601
{
602
  { { N_("/By Extension"), NULL, file_save_by_extension_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
603
    "save_by_extension.html", NULL },
604

605 606
  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
Elliot Lee's avatar
Elliot Lee committed
607
};
608 609
static guint n_save_entries = (sizeof (save_entries) /
			       sizeof (save_entries[0]));
610
static GtkItemFactory *save_factory = NULL;
Elliot Lee's avatar
Elliot Lee committed
611

612 613
/*****  <Layers>  *****/

614 615
static GimpItemFactoryEntry layers_entries[] =
{
616
  { { N_("/New Layer..."), "<control>N", layers_dialog_new_layer_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
617
    "dialogs/new_layer.html", NULL },
618 619 620

  /*  <Layers>/Stack  */

621
  { { N_("/Stack/Raise Layer"), "<control>F", layers_dialog_raise_layer_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
622
    "stack/stack.html#raise_layer", NULL },
623
  { { N_("/Stack/Lower Layer"), "<control>B", layers_dialog_lower_layer_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
624
    "stack/stack.html#lower_layer", NULL },
625
  { { N_("/Stack/Layer to Top"), "<shift><control>F", layers_dialog_raise_layer_to_top_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
626
    "stack/stack.html#later_to_top", NULL },
627
  { { N_("/Stack/Layer to Bottom"), "<shift><control>B", layers_dialog_lower_layer_to_bottom_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
628
    "stack/stack.html#layer_to_bottom", NULL },
629

630 631 632 633 634 635
  { { N_("/Duplicate Layer"), "<control>C", layers_dialog_duplicate_layer_callback, 0 },
    "duplicate_layer.html", NULL },
  { { N_("/Anchor Layer"), "<control>H", layers_dialog_anchor_layer_callback, 0 },
    "anchor_layer.html", NULL },
  { { N_("/Delete Layer"), "<control>X", layers_dialog_delete_layer_callback, 0 },
    "delete_layer.html", NULL },
636

637 638
  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
639
  { { N_("/Layer Boundary Size..."), "<control>R", layers_dialog_resize_layer_callback, 0 },
640
    "dialogs/layer_boundary_size.html", NULL },
Sven Neumann's avatar
Sven Neumann committed
641
  { { N_("/Layer to Imagesize"), NULL, layers_dialog_resize_to_image_callback, 0 },
642
    "layer_to_image_size.html", NULL },
643
  { { N_("/Scale Layer..."), "<control>S", layers_dialog_scale_layer_callback, 0 },
644
    "dialogs/scale_layer.html", NULL },
Sven Neumann's avatar
Sven Neumann committed
645
      
646 647
  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
648
  { { N_("/Merge Visible Layers..."), "<control>M", layers_dialog_merge_layers_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
649
    "dialogs/merge_visible_layers.html", NULL },
650 651 652 653
  { { N_("/Merge Down"), "<control><shift>M", layers_dialog_merge_down_callback, 0 },
    "merge_down.html", NULL },
  { { N_("/Flatten Image"), NULL, layers_dialog_flatten_image_callback, 0 },
    "flatten_image.html", NULL },
654

655 656
  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
657
  { { N_("/Add Layer Mask..."), NULL, layers_dialog_add_layer_mask_callback, 0 },
658
    "dialogs/add_layer_mask.html", NULL },
659
  { { N_("/Apply Layer Mask"), NULL, layers_dialog_apply_layer_mask_callback, 0 },
660
    "apply_mask.html", NULL },
661
  { { N_("/Delete Layer Mask"), NULL, layers_dialog_delete_layer_mask_callback, 0 },
662
    "delete_mask.html", NULL },
663 664
  { { N_("/Mask to Selection"), NULL, layers_dialog_mask_select_callback, 0 },
    "mask_to_selection.html", NULL },
665 666 667

  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
668
  { { N_("/Add Alpha Channel"), NULL, layers_dialog_add_alpha_channel_callback, 0 },
669 670
    "add_alpha_channel.html", NULL },
  { { N_("/Alpha to Selection"), NULL, layers_dialog_alpha_select_callback, 0 },
671 672 673 674 675 676
    "alpha_to_selection.html", NULL },

  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
  { { N_("/Edit Layer Attributes..."), NULL, layers_dialog_edit_layer_attributes_callback, 0 },
    "dialogs/edit_layer_attributes.html", NULL }
677
};
678 679
static guint n_layers_entries = (sizeof (layers_entries) /
				 sizeof (layers_entries[0]));
680 681
static GtkItemFactory *layers_factory = NULL;

682 683
/*****  <Channels>  *****/

684
static GimpItemFactoryEntry channels_entries[] =
685
{
686
  { { N_("/New Channel..."), "<control>N", channels_dialog_new_channel_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
687
    "dialogs/new_channel.html", NULL },
688 689 690 691 692 693
  { { N_("/Raise Channel"), "<control>F", channels_dialog_raise_channel_callback, 0 },
    "raise_channel.html", NULL },
  { { N_("/Lower Channel"), "<control>B", channels_dialog_lower_channel_callback, 0 },
    "lower_channel.html", NULL },
  { { N_("/Duplicate Channel"), "<control>C", channels_dialog_duplicate_channel_callback, 0 },
    "duplicate_channel.html", NULL },
694

695 696 697 698 699 700
  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
  { { N_("/Channel to Selection"), "<control>S", channels_dialog_channel_to_sel_callback, 0 },
    "channel_to_selection.html", NULL },
  { { N_("/Add to Selection"), NULL, channels_dialog_add_channel_to_sel_callback, 0 },
    "channel_to_selection.html#add", NULL },
Sven Neumann's avatar
Sven Neumann committed
701
  { { N_("/Subtract from Selection"), NULL, channels_dialog_sub_channel_from_sel_callback, 0 },
702
    "channel_to_selection.html#subtract", NULL },
Sven Neumann's avatar
Sven Neumann committed
703
  { { N_("/Intersect with Selection"), NULL, channels_dialog_intersect_channel_with_sel_callback, 0 },
704
    "channel_to_selection.html#intersect", NULL },
705

706 707 708
  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
  { { N_("/Delete Channel"), "<control>X", channels_dialog_delete_channel_callback, 0 },
709 710 711 712 713 714
    "delete_channel.html", NULL },

  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
  { { N_("/Edit Channel Attributes..."), NULL, channels_dialog_edit_channel_attributes_callback, 0 },
    "dialogs/edit_channel_attributes.html", NULL }
715
};
716 717
static guint n_channels_entries = (sizeof (channels_entries) /
				   sizeof (channels_entries[0]));
718 719
static GtkItemFactory *channels_factory = NULL;

720 721
/*****  <Paths>  *****/

722
static GimpItemFactoryEntry paths_entries