gimpitemfactory.c 69.7 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>

27
#include "libgimp/gimpenv.h"
28 29
#include "libgimpwidgets/gimpwidgets.h"

Sven Neumann's avatar
Sven Neumann committed
30 31
#include "apptypes.h"

32 33
#include "gui/dialogs-commands.h"

34 35 36
#include "tools/gimptoolinfo.h"
#include "tools/tool_manager.h"

37
#include "channels_dialog.h"
Elliot Lee's avatar
Elliot Lee committed
38
#include "commands.h"
39
#include "dialog_handler.h"
Michael Natterer's avatar
Michael Natterer committed
40 41
#include "file-open.h"
#include "file-save.h"
42
#include "gdisplay.h"
43
#include "gimphelp.h"
44
#include "gimplist.h"
Elliot Lee's avatar
Elliot Lee committed
45
#include "gimprc.h"
46
#include "layers_dialog.h"
Elliot Lee's avatar
Elliot Lee committed
47
#include "menus.h"
48
#include "paths_dialog.h"
49

50 51 52
/* test dialogs */
#include "test_commands.h"

53 54 55
#include "libgimp/gimpintl.h"


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

59 60 61
static void   menus_create_item     (GtkItemFactory       *item_factory,
				     GimpItemFactoryEntry *entry,
				     gpointer              callback_data,
62 63
				     guint                 callback_type,
				     gboolean              create_tearoff);
64 65 66 67
static void   menus_create_items    (GtkItemFactory       *item_factory,
				     guint                 n_entries,
				     GimpItemFactoryEntry *entries,
				     gpointer              callback_data,
68 69
				     guint                 callback_type,
				     gboolean              create_tearoff);
70 71 72
static void   menus_create_branches (GtkItemFactory	  *item_factory,
				     GimpItemFactoryEntry *entry);
static void   menus_init            (void);
73 74

#ifdef ENABLE_NLS
75 76
static gchar *menu_translate        (const gchar          *path,
				     gpointer              data);
77 78 79 80
#else
#define menu_translate NULL
#endif

81 82 83
static void   tearoff_cmd_callback  (GtkWidget            *widget,
				     gpointer              callback_data,
				     guint                 callback_action);
Daniel Egger's avatar
Daniel Egger committed
84 85 86
static gint   tearoff_delete_cb     (GtkWidget		  *widget, 
    				     GdkEvent		  *event,
				     gpointer		   data);
87

88
#ifdef ENABLE_DEBUG_ENTRY
89 90 91 92 93 94
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);
95
#endif  /*  ENABLE_DEBUG_ENTRY  */
96

97

98 99
static GSList *last_opened_raw_filenames = NULL;

100

101 102
/*****  <Toolbox>  *****/

103 104
static GimpItemFactoryEntry toolbox_entries[] =
{
105 106
  /*  <Toolbox>/File  */

107
  /* the underscore installs an accelerator using the character that follows */
108
  { { N_("/_File"), NULL, NULL, 0, "<Branch>" },
109
    NULL, NULL },
110
  { { N_("/File/New..."), "<control>N", file_new_cmd_callback, 0 },
111
    "file/dialogs/file_new.html", NULL },
112
  { { N_("/File/Open..."), "<control>O", file_open_cmd_callback, 0 },
Daniel Egger's avatar
Daniel Egger committed
113
    "file/dialogs/file_open.html", NULL },
114 115 116

  /*  <Toolbox>/File/Acquire  */

117
  { { "/File/---", NULL, NULL, 0, "<Separator>" },
118
    NULL, NULL },
119
  { { N_("/File/Acquire"), NULL, NULL, 0, "<Branch>" },
120
    NULL, NULL },
121

122
  { { "/File/---", NULL, NULL, 0, "<Separator>" },
123
    NULL, NULL },
124
  { { N_("/File/Preferences..."), NULL, dialogs_preferences_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
125
    "file/dialogs/preferences/preferences.html", NULL },
126 127

  /*  <Toolbox>/File/Dialogs  */
128

129
  { { "/File/---", NULL, NULL, 0, "<Separator>" },
130
    NULL, NULL },
131
  { { N_("/File/Dialogs/Layers, Channels & Paths..."), "<control>L", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:lc-dialog") },
132
    "file/dialogs/layers_and_channels.html", NULL },
133
  { { N_("/File/Dialogs/Tool Options..."), "<control><shift>T", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:tool-options-dialog") },
134 135
    "file/dialogs/tool_options.html", NULL },

136
  { { "/File/Dialogs/---", NULL, NULL, 0, "<Separator>" },
137
    NULL, NULL },
138
  { { N_("/File/Dialogs/Brushes..."), "<control><shift>B", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:brush-select-dialog") },
139
    "file/dialogs/brush_selection.html", NULL },
140
  { { N_("/File/Dialogs/Patterns..."), "<control><shift>P", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:pattern-select-dialog") },
141
    "file/dialogs/pattern_selection.html", NULL },
142
  { { N_("/File/Dialogs/Gradients..."), "<control>G", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:gradient-select-dialog") },
143
    "file/dialogs/gradient_selection.html", NULL },
144
  { { N_("/File/Dialogs/Palette..."), "<control>P", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:palette-dialog") },
145
    "file/dialogs/palette_selection.html", NULL },
146 147
  { { N_("/File/Dialogs/Indexed Palette..."), NULL, dialogs_indexed_palette_cmd_callback, 0 },
    "file/dialogs/indexed_palette.html", NULL },
148

149 150
  { { "/File/Dialogs/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
151 152
  { { N_("/File/Dialogs/Input Devices..."), NULL, dialogs_input_devices_cmd_callback, 0 },
    "file/dialogs/input_devices.html", NULL },
153
  { { N_("/File/Dialogs/Device Status..."), NULL, dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:device-status-dialog") },
154
    "file/dialogs/device_status.html", NULL },
155

156
  { { "/File/Dialogs/---", NULL, NULL, 0, "<Separator>" },
157
    NULL, NULL },
158
  { { N_("/File/Dialogs/Document Index..."), NULL, dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:document-index-dialog") },
159
    "file/dialogs/document_index.html", NULL },
160
  { { N_("/File/Dialogs/Error Console..."), NULL, dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:error-console-dialog") },
161
    "file/dialogs/error_console.html", NULL },
162
#ifdef DISPLAY_FILTERS
163
  { { N_("/File/Dialogs/Display Filters..."), NULL, dialogs_display_filters_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
164
    "file/dialogs/display_filters/display_filters.html", NULL },
165
#endif /* DISPLAY_FILTERS */
166

167 168 169
  { { N_("/File/Test Dialogs/List Dock..."), NULL, test_list_dock_cmd_callback, 1 },
    NULL, NULL },
  { { N_("/File/Test Dialogs/Grid Dock..."), NULL, test_grid_dock_cmd_callback, 1 },
170 171 172 173 174
    NULL, NULL },

  { { "/File/Test Dialogs/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },

175
  { { N_("/File/Test Dialogs/Layer List..."), NULL, test_layer_list_cmd_callback, 1 },
176
    NULL, NULL },
177
  { { N_("/File/Test Dialogs/Channel List..."), NULL, test_channel_list_cmd_callback, 1 },
178 179 180 181 182
    NULL, NULL },

  { { "/File/Test Dialogs/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },

183
  { { "/File/Test Dialogs/Images List...", NULL, test_image_container_list_view_cmd_callback, 0 },
184
    NULL, NULL },
185
  { { "/File/Test Dialogs/Images Grid...", NULL, test_image_container_grid_view_cmd_callback, 0 },
186 187 188 189 190
    NULL, NULL },

  { { "/File/Test Dialogs/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },

191
  { { "/File/Test Dialogs/Brush List...", NULL, test_brush_container_list_view_cmd_callback, 0 },
192
    NULL, NULL },
193
  { { "/File/Test Dialogs/Pattern List...", NULL, test_pattern_container_list_view_cmd_callback, 0 },
194
    NULL, NULL },
195
  { { "/File/Test Dialogs/Gradient List...", NULL, test_gradient_container_list_view_cmd_callback, 0 },
196
    NULL, NULL },
197
  { { "/File/Test Dialogs/Palette List...", NULL, test_palette_container_list_view_cmd_callback, 0 },
198
    NULL, NULL },
199

200
  { { "/File/Test Dialogs/---", NULL, NULL, 0, "<Separator>" },
201
    NULL, NULL },
202

203
  { { "/File/Test Dialogs/Brush Grid...", NULL, test_brush_container_grid_view_cmd_callback, 0 },
204
    NULL, NULL },
205
  { { "/File/Test Dialogs/Pattern Grid...", NULL, test_pattern_container_grid_view_cmd_callback, 0 },
206
    NULL, NULL },
207
  { { "/File/Test Dialogs/Gradient Grid...", NULL, test_gradient_container_grid_view_cmd_callback, 0 },
208
    NULL, NULL },
209
  { { "/File/Test Dialogs/Palette Grid...", NULL, test_palette_container_grid_view_cmd_callback, 0 },
210
    NULL, NULL },
211

212 213 214
  { { "/File/Test Dialogs/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },

215
  { { "/File/Test Dialogs/Multi List...", NULL, test_multi_container_list_view_cmd_callback, 0 },
216
    NULL, NULL },
217
  { { "/File/Test Dialogs/Multi Grid...", NULL, test_multi_container_grid_view_cmd_callback, 0 },
218 219
    NULL, NULL },

220
  { { "/File/---", NULL, NULL, 0, "<Separator>" },
221
    NULL, NULL },
222 223 224 225

  /*  MRU entries are inserted here  */

  { { "/File/---MRU", NULL, NULL, 0, "<Separator>" },
226
    NULL, NULL },
227 228
  { { N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
    "file/quit.html", NULL },
229 230 231

  /*  <Toolbox>/Xtns  */

232
  /* the underscore installs an accelerator using the character that follows */
233
  { { N_("/_Xtns"), NULL, NULL, 0, "<Branch>" },
234
    NULL, NULL },
235
  { { N_("/Xtns/Module Browser..."), NULL, dialogs_module_browser_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
236
    "dialogs/module_browser.html", NULL },
237

238
  { { "/Xtns/---", NULL, NULL, 0, "<Separator>" },
239
    NULL, NULL },
240 241 242

  /*  <Toolbox>/Help  */

243
  /* the underscore installs an accelerator using the character that follows */
244
  { { N_("/_Help"), NULL, NULL, 0, "<Branch>" },
245
    NULL, NULL },
246 247 248 249
  { { 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
250
  { { N_("/Help/Tip of the Day..."), NULL, help_tips_cmd_callback, 0 },
251 252 253
    "help/dialogs/tip_of_the_day.html", NULL },
  { { N_("/Help/About..."), NULL, help_about_cmd_callback, 0 },
    "help/dialogs/about.html", NULL },
254
#ifdef ENABLE_DEBUG_ENTRY
255
  { { N_("/Help/Dump Items (Debug)"), NULL, menus_debug_cmd_callback, 0 },
256
    NULL, NULL }
257
#endif
258
};
259 260
static guint n_toolbox_entries = (sizeof (toolbox_entries) /
				  sizeof (toolbox_entries[0]));
261 262
static GtkItemFactory *toolbox_factory = NULL;

263

264 265
/*****  <Image>  *****/

266 267
static GimpItemFactoryEntry image_entries[] =
{
268
  { { "/tearoff1", NULL, tearoff_cmd_callback, 0, "<Tearoff>" },
269
    NULL, NULL },
270 271 272 273

  /*  <Image>/File  */

  { { N_("/File/New..."), "<control>N", file_new_cmd_callback, 1 },
274
    "file/dialogs/file_new.html", NULL },
275
  { { N_("/File/Open..."), "<control>O", file_open_cmd_callback, 0 },
Daniel Egger's avatar
Daniel Egger committed
276
    "file/dialogs/file_open.html", NULL },
277
  { { N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
Daniel Egger's avatar
Daniel Egger committed
278
    "file/dialogs/file_save.html", NULL },
279 280 281
  { { 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
282
    "file/dialogs/file_save.html", NULL },
283
  { { N_("/File/Revert..."), NULL, file_revert_cmd_callback, 0 },
284
    "file/revert.html", NULL },
285

286
  { { "/File/---", NULL, NULL, 0, "<Separator>" },
287
    NULL, NULL },
Michael Natterer's avatar
Michael Natterer committed
288
  { { N_( "/File/Close"), "<control>W", file_close_cmd_callback, 0 },
289 290
    "file/close.html", NULL },
  { { N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
291
    "file/quit.html", NULL },
292

293
  { { "/File/---moved", NULL, NULL, 0, "<Separator>" },
294 295
    NULL, NULL },

296 297 298 299 300 301 302
  /*  <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 },

303
  { { "/Edit/---", NULL, NULL, 0, "<Separator>" },
304
    NULL, NULL },
305 306 307 308 309 310 311 312
  { { 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
313
  { { N_("/Edit/Paste as New"), NULL, edit_paste_as_new_cmd_callback, 0 },
314
    "edit/paste_as_new.html", NULL },
315 316 317 318 319 320 321 322 323 324

  /*  <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 },

325
  { { "/Edit/---", NULL, NULL, 0, "<Separator>" },
326 327 328
    NULL, NULL },
  { { N_("/Edit/Clear"), "<control>K", edit_clear_cmd_callback, 0 },
    "edit/clear.html", NULL },
329 330 331
  { { 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 },
332 333 334
    "edit/fill.html", NULL },
  { { N_("/Edit/Stroke"), NULL, edit_stroke_cmd_callback, 0 },
    "edit/stroke.html", NULL },
335

336
  { { "/Edit/---", NULL, NULL, 0, "<Separator>" },
337
    NULL, NULL },
338 339

  /*  <Image>/Select  */
340
  
341 342 343 344 345 346 347 348
  { { 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 },
349

350
  { { "/Select/---", NULL, NULL, 0, "<Separator>" },
351
    NULL, NULL },
352
  { { N_("/Select/Feather..."), "<control><shift>F", select_feather_cmd_callback, 0 },
353 354 355
    "select/dialogs/feather_selection.html", NULL },
  { { N_("/Select/Sharpen"), "<control><shift>H", select_sharpen_cmd_callback, 0 },
    "select/sharpen.html", NULL },
356
  { { N_("/Select/Shrink..."), NULL, select_shrink_cmd_callback, 0 },
357
    "select/dialogs/shrink_selection.html", NULL },
358
  { { N_("/Select/Grow..."), NULL, select_grow_cmd_callback, 0 },
359
    "select/dialogs/grow_selection.html", NULL },
360
  { { N_("/Select/Border..."), "<control><shift>B", select_border_cmd_callback, 0 },
361
    "select/dialogs/border_selection.html", NULL },
362

363
  { { "/Select/---", NULL, NULL, 0, "<Separator>" },
364
    NULL, NULL },
Sven Neumann's avatar
Sven Neumann committed
365
  { { N_("/Select/Save to Channel"), NULL, select_save_cmd_callback, 0 },
366 367
    "select/save_to_channel.html", NULL },

368 369
  /*  <Image>/View  */

370 371 372 373
  { { 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 },
374 375 376 377

  /*  <Image>/View/Zoom  */

  { { N_("/View/Zoom/16:1"), NULL, view_zoom_16_1_cmd_callback, 0 },
378
    "view/zoom.html", NULL },
379
  { { N_("/View/Zoom/8:1"), NULL, view_zoom_8_1_cmd_callback, 0 },
380
    "view/zoom.html", NULL },
381
  { { N_("/View/Zoom/4:1"), NULL, view_zoom_4_1_cmd_callback, 0 },
382
    "view/zoom.html", NULL },
383
  { { N_("/View/Zoom/2:1"), NULL, view_zoom_2_1_cmd_callback, 0 },
384
    "view/zoom.html", NULL },
385
  { { N_("/View/Zoom/1:1"), "1", view_zoom_1_1_cmd_callback, 0 },
386
    "view/zoom.html", NULL },
387
  { { N_("/View/Zoom/1:2"), NULL, view_zoom_1_2_cmd_callback, 0 },
388
    "view/zoom.html", NULL },
389
  { { N_("/View/Zoom/1:4"), NULL, view_zoom_1_4_cmd_callback, 0 },
390
    "view/zoom.html", NULL },
391
  { { N_("/View/Zoom/1:8"), NULL, view_zoom_1_8_cmd_callback, 0 },
392
    "view/zoom.html", NULL },
393
  { { N_("/View/Zoom/1:16"), NULL, view_zoom_1_16_cmd_callback, 0 },
394
    "view/zoom.html", NULL },
395

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

399
  { { "/View/---", NULL, NULL, 0, "<Separator>" },
400 401
    NULL, NULL },
  { { N_("/View/Info Window..."), "<control><shift>I", view_info_window_cmd_callback, 0 },
402
    "view/dialogs/info_window.html", NULL },
403
  { { N_("/View/Nav. Window..."), "<control><shift>N", view_nav_window_cmd_callback, 0 },
404 405
    "view/dialogs/navigation_window.html", NULL },

406
  { { "/View/---", NULL, NULL, 0, "<Separator>" },
407 408 409 410 411 412 413 414 415
    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
416
  { { N_("/View/Snap to Guides"), NULL, view_snap_to_guides_cmd_callback, 0, "<ToggleItem>" },
417
    "view/snap_to_guides.html", NULL },
418

419
  { { "/View/---", NULL, NULL, 0, "<Separator>" },
420 421 422 423 424 425
    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 },

426 427 428 429 430 431 432 433 434
  /*  <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 },

435
  { { "/Image/Mode/---", NULL, NULL, 0, "<Separator>" },
436 437 438 439
    NULL, NULL },

  /*  <Image>/Image/Colors  */

440 441
  { { N_("/Image/Colors/Desaturate"), NULL, image_desaturate_cmd_callback, 0 },
    "image/colors/desaturate.html", NULL },
442 443 444
  { { N_("/Image/Colors/Invert"), NULL, image_invert_cmd_callback, 0 },
    "image/colors/invert.html", NULL },

445
  { { "/Image/Colors/---", NULL, NULL, 0, "<Separator>" },
446
    NULL, NULL },
447

448 449 450 451 452
  /*  <Image>/Image/Colors/Auto  */

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

453
  { { "/Image/Colors/---", NULL, NULL, 0, "<Separator>" },
454 455 456
    NULL, NULL },

  /*  <Image>/Image/Alpha  */
457 458 459 460

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

461 462 463
  /*  <Image>/Image/Transforms  */

  { { N_("/Image/Transforms/Offset..."), "<control><shift>O", image_offset_cmd_callback, 0 },
464
    "image/transforms/dialogs/offset.html", NULL },
465
  { { N_("/Image/Transforms/Rotate"), NULL, NULL, 0, "<Branch>" },
466
    NULL, NULL },
467
  { { "/Image/Transforms/---", NULL, NULL, 0, "<Separator>" },
468
    NULL, NULL },
469

470
  { { "/Image/---", NULL, NULL, 0, "<Separator>" },
471
    NULL, NULL },
472
  { { N_("/Image/Canvas Size..."), NULL, image_resize_cmd_callback, 0 },
473
    "image/dialogs/set_canvas_size.html", NULL },
474
  { { N_("/Image/Scale Image..."), NULL, image_scale_cmd_callback, 0 },
475
    "image/dialogs/scale_image.html", NULL },
476
  { { N_("/Image/Duplicate"), "<control>D", image_duplicate_cmd_callback, 0 },
477
    "image/duplicate.html", NULL },
478

479
  { { "/Image/---", NULL, NULL, 0, "<Separator>" },
480 481
    NULL, NULL },

482 483
  /*  <Image>/Layers  */

484
  { { N_("/Layers/Layers, Channels & Paths..."), "<control>L", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:lc-dialog") },
Michael Natterer's avatar
Michael Natterer committed
485
    "dialogs/layers_and_channels.html", NULL },
486 487 488 489
  { { "/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 },
490 491 492

  /*  <Image>/Layers/Stack  */

493
  { { N_("/Layers/Stack/Previous Layer"), "Prior", layers_previous_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
494
    "layers/stack/stack.html#previous_layer", NULL },
495
  { { N_("/Layers/Stack/Next Layer"), "Next", layers_next_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
496
    "layers/stack/stack.html#next_layer", NULL },
497
  { { N_("/Layers/Stack/Raise Layer"), "<shift>Prior", layers_raise_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
498
    "layers/stack/stack.html#raise_layer", NULL },
499
  { { N_("/Layers/Stack/Lower Layer"), "<shift>Next", layers_lower_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
500
    "layers/stack/stack.html#lower_layer", NULL },
501
  { { N_("/Layers/Stack/Layer to Top"), "<control>Prior", layers_raise_to_top_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
502
    "layers/stack/stack.html#layer_to_top", NULL },
503
  { { N_("/Layers/Stack/Layer to Bottom"), "<control>Next", layers_lower_to_bottom_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
504
    "layers/stack/stack.html#layer_to_bottom", NULL },
505
  { { "/Layers/Stack/---", NULL, NULL, 0, "<Separator>" },
506 507 508 509
    NULL, NULL },

  /*  <Image>/Layers/Rotate  */

510
  { { N_("/Layers/Rotate"), NULL, NULL, 0, "<Branch>" },
511 512
    NULL, NULL },

513
  { { "/Layers/---", NULL, NULL, 0, "<Separator>" },
514 515 516
    NULL, NULL },
  { { N_("/Layers/Anchor Layer"), "<control>H", layers_anchor_cmd_callback, 0 },
    "layers/anchor_layer.html", NULL },
517
  { { N_("/Layers/Merge Visible Layers..."), "<control>M", layers_merge_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
518
    "layers/dialogs/merge_visible_layers.html", NULL },
519 520
  { { N_("/Layers/Flatten Image"), NULL, layers_flatten_cmd_callback, 0 },
    "layers/flatten_image.html", NULL },
521

522
  { { "/Layers/---", NULL, NULL, 0, "<Separator>" },
523
    NULL, NULL },
Sven Neumann's avatar
Sven Neumann committed
524
  { { N_("/Layers/Mask to Selection"), NULL, layers_mask_select_cmd_callback, 0 },
525
    "layers/mask_to_selection.html", NULL },
526

527
  { { "/Layers/---", NULL, NULL, 0, "<Separator>" },
528
    NULL, NULL },
529 530
  { { 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
531
  { { N_("/Layers/Alpha to Selection"), NULL, layers_alpha_select_cmd_callback, 0 },
532 533
    "layers/alpha_to_selection.html", NULL },

534
  { { "/Layers/---", NULL, NULL, 0, "<Separator>" },
535
    NULL, NULL },
Michael Natterer's avatar
Michael Natterer committed
536

537 538
  /*  <Image>/Tools  */

539
  { { N_("/Tools/Toolbox"), NULL, tools_toolbox_raise_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
540
    "toolbox/toolbox.html", NULL },
541
  { { N_("/Tools/Default Colors"), "D", tools_default_colors_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
542
    "toolbox/toolbox.html#default_colors", NULL },
543
  { { N_("/Tools/Swap Colors"), "X", tools_swap_colors_cmd_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
544
    "toolbox/toolbox.html#swap_colors", NULL },
545 546
  { { N_("/Tools/Swap Contexts"), "<shift>X", tools_swap_contexts_cmd_callback, 0 },
    "toolbox/toolbox.html#swap_colors", NULL },
547
  { { "/Tools/---", NULL, NULL, 0, "<Separator>" },  
548
    NULL, NULL },
549

550 551
  /*  <Image>/Dialogs  */

552
  { { N_("/Dialogs/Layers, Channels & Paths..."), "<control>L", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:lc-dialog") },
553
    "dialogs/layers_and_channels.html", NULL },
554 555
  { { N_("/Dialogs/Tool Options..."), NULL,
      dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:tool-options-dialog") },
556 557 558 559
    "dialogs/tool_options.html", NULL },

  { { "/Dialogs/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
560
  { { N_("/Dialogs/Brushes..."), "<control><shift>B", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:brush-select-dialog") },
561
    "dialogs/brush_selection.html", NULL },
562
  { { N_("/Dialogs/Patterns..."), "<control><shift>P", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:pattern-select-dialog") },
563
    "dialogs/pattern_selection.html", NULL },
564
  { { N_("/Dialogs/Gradients..."), "<control>G", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:gradient-select-dialog") },
565
    "dialogs/gradient_selection.html", NULL },
566
  { { N_("/Dialogs/Palette..."), "<control>P", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:palette-dialog") },
567 568 569 570 571 572 573 574
    "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 },
575
  { { N_("/Dialogs/Device Status..."), NULL, dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:device-status-dialog") },
576 577 578 579
    "dialogs/device_status.html", NULL },

  { { "/Dialogs/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
580
  { { N_("/Dialogs/Document Index..."), NULL, dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:document-index-dialog") },
581
    "dialogs/document_index.html", NULL },
582
  { { N_("/Dialogs/Error Console..."), NULL, dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:error-console-dialog") },
583
    "dialogs/error_console.html", NULL },
584
#ifdef DISPLAY_FILTERS
585 586
  { { N_("/Dialogs/Display Filters..."), NULL, dialogs_display_filters_cmd_callback, 0 },
    "dialogs/display_filters/display_filters.html", NULL },
587
#endif /* DISPLAY_FILTERS */
588 589 590
  { { N_("/Dialogs/Undo History..."), NULL, dialogs_undo_history_cmd_callback, 0},
    "dialogs/undo_history.html", NULL },

591 592 593
  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },

594
  /*  <Image>/Filters  */
Michael Natterer's avatar
Michael Natterer committed
595

Sven Neumann's avatar
Sven Neumann committed
596
  { { N_("/Filters/Repeat Last"), "<alt>F", filters_repeat_cmd_callback, 0x0 },
597
    "filters/repeat_last.html", NULL },
Sven Neumann's avatar
Sven Neumann committed
598
  { { N_("/Filters/Re-Show Last"), "<alt><shift>F", filters_repeat_cmd_callback, 0x1 },
599
    "filters/reshow_last.html", NULL },
600

601 602 603 604
  { { "/Filters/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
  { { N_("/Filters/Blur"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
605
  { { N_("/Filters/Colors"), NULL, NULL, 0, "<Branch>" },
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632
    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 },

633
  { { "/Filters/---INSERT", NULL, NULL, 0, "<Separator>" },
634 635 636 637
    NULL, NULL },
  { { N_("/Filters/Animation"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
  { { N_("/Filters/Combine"), NULL, NULL, 0, "<Branch>" },
638
    NULL, NULL },
639 640 641 642 643

  { { "/Filters/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
  { { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" },
    NULL, NULL },
644
};
645 646
static guint n_image_entries = (sizeof (image_entries) /
				sizeof (image_entries[0]));
647
static GtkItemFactory *image_factory = NULL;
648

649

650 651
/*****  <Load>  *****/

652
static GimpItemFactoryEntry load_entries[] =
653
{
654
  { { N_("/Automatic"), NULL, file_open_by_extension_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
655
    "open_by_extension.html", NULL },
656

657 658
  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL }
659
};
660 661
static guint n_load_entries = (sizeof (load_entries) /
			       sizeof (load_entries[0]));
662
static GtkItemFactory *load_factory = NULL;
663

Manish Singh's avatar
Manish Singh committed
664
  
665 666
/*****  <Save>  *****/

667
static GimpItemFactoryEntry save_entries[] =
668
{
669
  { { N_("/By Extension"), NULL, file_save_by_extension_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
670
    "save_by_extension.html", NULL },
671

672 673
  { { "/---", NULL, NULL, 0, "<Separator>" },
    NULL, NULL },
Elliot Lee's avatar
Elliot Lee committed
674
};
675 676
static guint n_save_entries = (sizeof (save_entries) /
			       sizeof (save_entries[0]));
677
static GtkItemFactory *save_factory = NULL;
Elliot Lee's avatar
Elliot Lee committed
678

679

680 681
/*****  <Layers>  *****/

682 683
static GimpItemFactoryEntry layers_entries[] =
{
684
  { { N_("/New Layer..."), "<control>N", layers_dialog_new_layer_callback, 0 },
Michael Natterer's avatar
Michael Natterer committed
685
    "dialogs/new_layer.html", NULL },