2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1997-11-25 06:05:25 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1997-11-25 06:05:25 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2000-04-28 01:27:28 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2004-07-22 00:11:31 +08:00
|
|
|
#include <errno.h>
|
2005-02-07 09:24:22 +08:00
|
|
|
|
|
|
|
#include <glib/gstdio.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
1999-10-03 21:50:19 +08:00
|
|
|
|
2001-05-22 04:30:16 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
|
2004-05-06 15:41:53 +08:00
|
|
|
#include "menus-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2007-07-20 20:41:08 +08:00
|
|
|
#include "config/gimpconfig-file.h"
|
2002-11-19 04:50:31 +08:00
|
|
|
#include "config/gimpguiconfig.h"
|
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
#include "core/gimp.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2004-09-20 22:41:54 +08:00
|
|
|
#include "widgets/gimpactionfactory.h"
|
2003-01-11 01:55:53 +08:00
|
|
|
#include "widgets/gimpmenufactory.h"
|
|
|
|
|
2005-01-29 03:48:31 +08:00
|
|
|
#include "dockable-menu.h"
|
2003-01-13 22:08:10 +08:00
|
|
|
#include "image-menu.h"
|
2001-04-18 05:43:29 +08:00
|
|
|
#include "menus.h"
|
2005-09-26 18:36:07 +08:00
|
|
|
#include "plug-in-menus.h"
|
2003-09-30 04:26:09 +08:00
|
|
|
#include "tool-options-menu.h"
|
2001-04-18 05:43:29 +08:00
|
|
|
|
2004-07-22 00:11:31 +08:00
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
2000-04-28 01:27:28 +08:00
|
|
|
|
2001-07-10 01:58:56 +08:00
|
|
|
/* local function prototypes */
|
|
|
|
|
2006-05-11 20:29:57 +08:00
|
|
|
static void menus_can_change_accels (GimpGuiConfig *config);
|
|
|
|
static void menus_remove_accels (gpointer data,
|
|
|
|
const gchar *accel_path,
|
|
|
|
guint accel_key,
|
|
|
|
GdkModifierType accel_mods,
|
|
|
|
gboolean changed);
|
2003-04-01 15:47:04 +08:00
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2003-01-13 22:08:10 +08:00
|
|
|
/* global variables */
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2004-07-22 00:11:31 +08:00
|
|
|
GimpMenuFactory * global_menu_factory = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
/* private variables */
|
|
|
|
|
|
|
|
static gboolean menurc_deleted = FALSE;
|
1999-06-07 01:26:51 +08:00
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
|
|
|
|
/* public functions */
|
2001-10-24 00:23:32 +08:00
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
void
|
2004-09-20 22:41:54 +08:00
|
|
|
menus_init (Gimp *gimp,
|
|
|
|
GimpActionFactory *action_factory)
|
2003-01-11 01:55:53 +08:00
|
|
|
{
|
2001-10-24 00:23:32 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2004-09-20 22:41:54 +08:00
|
|
|
g_return_if_fail (GIMP_IS_ACTION_FACTORY (action_factory));
|
2004-07-02 22:08:15 +08:00
|
|
|
g_return_if_fail (global_menu_factory == NULL);
|
2001-10-24 00:23:32 +08:00
|
|
|
|
2003-04-02 08:08:38 +08:00
|
|
|
/* We need to make sure the property is installed before using it */
|
|
|
|
g_type_class_ref (GTK_TYPE_MENU);
|
2003-04-01 15:47:04 +08:00
|
|
|
|
2006-04-27 17:23:14 +08:00
|
|
|
menus_can_change_accels (GIMP_GUI_CONFIG (gimp->config));
|
2003-04-01 15:47:04 +08:00
|
|
|
|
2003-04-02 08:08:38 +08:00
|
|
|
g_signal_connect (gimp->config, "notify::can-change-accels",
|
2006-04-27 17:23:14 +08:00
|
|
|
G_CALLBACK (menus_can_change_accels), NULL);
|
2003-04-02 08:08:38 +08:00
|
|
|
|
2004-09-20 22:41:54 +08:00
|
|
|
global_menu_factory = gimp_menu_factory_new (gimp, action_factory);
|
2001-10-24 00:23:32 +08:00
|
|
|
|
2004-04-21 18:55:45 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Image>",
|
2004-04-22 00:33:17 +08:00
|
|
|
"file",
|
2004-06-15 23:42:50 +08:00
|
|
|
"context",
|
2008-03-22 01:55:32 +08:00
|
|
|
"debug",
|
2007-08-30 23:00:50 +08:00
|
|
|
"help",
|
2004-04-22 00:33:17 +08:00
|
|
|
"edit",
|
|
|
|
"select",
|
|
|
|
"view",
|
|
|
|
"image",
|
|
|
|
"drawable",
|
|
|
|
"layers",
|
2004-05-05 19:40:20 +08:00
|
|
|
"channels",
|
2004-04-22 00:33:17 +08:00
|
|
|
"vectors",
|
|
|
|
"tools",
|
|
|
|
"dialogs",
|
2008-05-11 00:21:37 +08:00
|
|
|
"windows",
|
2004-04-22 00:33:17 +08:00
|
|
|
"plug-in",
|
2012-03-27 04:56:53 +08:00
|
|
|
"filters",
|
2005-09-19 20:44:06 +08:00
|
|
|
"quick-mask",
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/image-menubar",
|
2004-04-29 20:52:29 +08:00
|
|
|
"image-menu.xml", image_menu_setup,
|
2004-05-17 21:38:03 +08:00
|
|
|
"/dummy-menubar",
|
2004-04-29 20:52:29 +08:00
|
|
|
"image-menu.xml", image_menu_setup,
|
2005-09-19 20:44:06 +08:00
|
|
|
"/quick-mask-popup",
|
|
|
|
"quick-mask-menu.xml", NULL,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2005-02-01 00:09:52 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Toolbox>",
|
|
|
|
"file",
|
|
|
|
"context",
|
|
|
|
"help",
|
|
|
|
"edit",
|
|
|
|
"select",
|
2012-12-14 16:54:17 +08:00
|
|
|
"view",
|
2005-02-01 00:09:52 +08:00
|
|
|
"image",
|
|
|
|
"drawable",
|
|
|
|
"layers",
|
|
|
|
"channels",
|
|
|
|
"vectors",
|
|
|
|
"tools",
|
2008-05-11 00:21:37 +08:00
|
|
|
"windows",
|
2005-02-01 00:09:52 +08:00
|
|
|
"dialogs",
|
|
|
|
"plug-in",
|
2012-03-27 04:56:53 +08:00
|
|
|
"filters",
|
2005-09-19 20:44:06 +08:00
|
|
|
"quick-mask",
|
2005-02-01 00:09:52 +08:00
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
|
2004-05-05 05:16:40 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Dock>",
|
|
|
|
"file",
|
2004-06-15 23:42:50 +08:00
|
|
|
"context",
|
2004-05-05 05:16:40 +08:00
|
|
|
"edit",
|
|
|
|
"select",
|
2012-12-14 16:54:17 +08:00
|
|
|
"view",
|
2004-05-05 05:16:40 +08:00
|
|
|
"image",
|
|
|
|
"drawable",
|
|
|
|
"layers",
|
2004-05-05 19:40:20 +08:00
|
|
|
"channels",
|
2004-05-05 05:16:40 +08:00
|
|
|
"vectors",
|
|
|
|
"tools",
|
2008-05-11 00:21:37 +08:00
|
|
|
"windows",
|
2004-05-05 05:16:40 +08:00
|
|
|
"dialogs",
|
|
|
|
"plug-in",
|
2005-09-19 20:44:06 +08:00
|
|
|
"quick-mask",
|
2005-01-24 07:00:21 +08:00
|
|
|
"dock",
|
2004-05-05 05:16:40 +08:00
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Layers>",
|
|
|
|
"layers",
|
2006-06-17 01:02:14 +08:00
|
|
|
"plug-in",
|
2012-03-27 04:56:53 +08:00
|
|
|
"filters",
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/layers-popup",
|
2006-06-17 01:02:14 +08:00
|
|
|
"layers-menu.xml", plug_in_menus_setup,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Channels>",
|
|
|
|
"channels",
|
2006-06-17 01:02:14 +08:00
|
|
|
"plug-in",
|
2012-03-27 04:56:53 +08:00
|
|
|
"filters",
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/channels-popup",
|
2006-06-17 01:02:14 +08:00
|
|
|
"channels-menu.xml", plug_in_menus_setup,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Vectors>",
|
|
|
|
"vectors",
|
2006-06-17 01:02:14 +08:00
|
|
|
"plug-in",
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/vectors-popup",
|
2006-06-17 01:02:14 +08:00
|
|
|
"vectors-menu.xml", plug_in_menus_setup,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2006-11-18 06:07:07 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Colormap>",
|
|
|
|
"colormap",
|
|
|
|
"plug-in",
|
|
|
|
NULL,
|
|
|
|
"/colormap-popup",
|
|
|
|
"colormap-menu.xml", plug_in_menus_setup,
|
|
|
|
NULL);
|
|
|
|
|
2004-05-05 19:40:20 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Dockable>",
|
2004-04-22 00:33:17 +08:00
|
|
|
"dockable",
|
2005-01-26 21:34:41 +08:00
|
|
|
"dock",
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/dockable-popup",
|
2005-01-29 03:48:31 +08:00
|
|
|
"dockable-menu.xml", dockable_menu_setup,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Brushes>",
|
|
|
|
"brushes",
|
2005-09-26 18:36:07 +08:00
|
|
|
"plug-in",
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/brushes-popup",
|
2005-09-26 18:36:07 +08:00
|
|
|
"brushes-menu.xml", plug_in_menus_setup,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2009-10-10 01:25:07 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Dynamics>",
|
|
|
|
"dynamics",
|
|
|
|
"plug-in",
|
|
|
|
NULL,
|
|
|
|
"/dynamics-popup",
|
|
|
|
"dynamics-menu.xml", plug_in_menus_setup,
|
|
|
|
NULL);
|
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Patterns>",
|
|
|
|
"patterns",
|
2005-09-26 18:36:07 +08:00
|
|
|
"plug-in",
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/patterns-popup",
|
2005-09-26 18:36:07 +08:00
|
|
|
"patterns-menu.xml", plug_in_menus_setup,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Gradients>",
|
|
|
|
"gradients",
|
2005-09-26 18:36:07 +08:00
|
|
|
"plug-in",
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/gradients-popup",
|
2005-09-26 18:36:07 +08:00
|
|
|
"gradients-menu.xml", plug_in_menus_setup,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Palettes>",
|
|
|
|
"palettes",
|
2005-09-26 18:36:07 +08:00
|
|
|
"plug-in",
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/palettes-popup",
|
2005-09-26 18:36:07 +08:00
|
|
|
"palettes-menu.xml", plug_in_menus_setup,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2010-04-03 23:25:31 +08:00
|
|
|
|
2011-10-10 03:55:58 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<ToolPresets>",
|
|
|
|
"tool-presets",
|
2010-04-03 23:25:31 +08:00
|
|
|
"plug-in",
|
|
|
|
NULL,
|
2011-10-10 03:55:58 +08:00
|
|
|
"/tool-presets-popup",
|
|
|
|
"tool-presets-menu.xml", plug_in_menus_setup,
|
2010-04-03 23:25:31 +08:00
|
|
|
NULL);
|
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Fonts>",
|
|
|
|
"fonts",
|
2005-09-26 18:36:07 +08:00
|
|
|
"plug-in",
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/fonts-popup",
|
2005-09-26 18:36:07 +08:00
|
|
|
"fonts-menu.xml", plug_in_menus_setup,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-10-19 00:23:15 +08:00
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Buffers>",
|
|
|
|
"buffers",
|
2005-09-26 18:36:07 +08:00
|
|
|
"plug-in",
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/buffers-popup",
|
2005-09-26 18:36:07 +08:00
|
|
|
"buffers-menu.xml", plug_in_menus_setup,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Documents>",
|
|
|
|
"documents",
|
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/documents-popup",
|
2004-04-26 23:51:21 +08:00
|
|
|
"documents-menu.xml", NULL,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Templates>",
|
|
|
|
"templates",
|
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/templates-popup",
|
2004-04-26 23:51:21 +08:00
|
|
|
"templates-menu.xml", NULL,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-04-06 19:21:56 +08:00
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Images>",
|
|
|
|
"images",
|
|
|
|
NULL,
|
2004-04-23 00:18:40 +08:00
|
|
|
"/images-popup",
|
2004-04-26 23:51:21 +08:00
|
|
|
"images-menu.xml", NULL,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2005-10-26 05:38:00 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<BrushEditor>",
|
|
|
|
"brush-editor",
|
|
|
|
NULL,
|
|
|
|
"/brush-editor-popup",
|
|
|
|
"brush-editor-menu.xml", NULL,
|
|
|
|
NULL);
|
2009-10-10 01:25:07 +08:00
|
|
|
|
2009-07-29 03:52:53 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<DynamicsEditor>",
|
|
|
|
"dynamics-editor",
|
|
|
|
NULL,
|
|
|
|
"/dynamics-editor-popup",
|
|
|
|
"dynamics-editor-menu.xml", NULL,
|
|
|
|
NULL);
|
2009-10-11 21:37:14 +08:00
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<GradientEditor>",
|
|
|
|
"gradient-editor",
|
|
|
|
NULL,
|
|
|
|
"/gradient-editor-popup",
|
2004-04-26 23:51:21 +08:00
|
|
|
"gradient-editor-menu.xml", NULL,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<PaletteEditor>",
|
2004-04-23 00:18:40 +08:00
|
|
|
"palette-editor",
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL,
|
|
|
|
"/palette-editor-popup",
|
2004-04-26 23:51:21 +08:00
|
|
|
"palette-editor-menu.xml", NULL,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-01-13 22:08:10 +08:00
|
|
|
|
2010-04-11 19:40:28 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<ToolPresetEditor>",
|
|
|
|
"tool-preset-editor",
|
|
|
|
NULL,
|
|
|
|
"/tool-preset-editor-popup",
|
|
|
|
"tool-preset-editor-menu.xml", NULL,
|
|
|
|
NULL);
|
|
|
|
|
2006-11-18 06:07:07 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Selection>",
|
2004-05-13 02:36:33 +08:00
|
|
|
"select",
|
|
|
|
"vectors",
|
|
|
|
NULL,
|
2006-11-18 06:07:07 +08:00
|
|
|
"/selection-popup",
|
|
|
|
"selection-menu.xml", NULL,
|
2004-05-13 02:36:33 +08:00
|
|
|
NULL);
|
|
|
|
|
2004-09-26 23:21:44 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<NavigationEditor>",
|
|
|
|
"view",
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
|
2006-11-18 06:07:07 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<Undo>",
|
2004-05-13 02:36:33 +08:00
|
|
|
"edit",
|
|
|
|
NULL,
|
2006-11-18 06:07:07 +08:00
|
|
|
"/undo-popup",
|
|
|
|
"undo-menu.xml", NULL,
|
2004-05-13 02:36:33 +08:00
|
|
|
NULL);
|
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<ErrorConsole>",
|
|
|
|
"error-console",
|
|
|
|
NULL,
|
|
|
|
"/error-console-popup",
|
2004-04-26 23:51:21 +08:00
|
|
|
"error-console-menu.xml", NULL,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2003-09-30 04:26:09 +08:00
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<ToolOptions>",
|
|
|
|
"tool-options",
|
|
|
|
NULL,
|
|
|
|
"/tool-options-popup",
|
2004-04-30 23:29:11 +08:00
|
|
|
"tool-options-menu.xml",
|
|
|
|
tool_options_menu_setup,
|
2004-04-22 00:33:17 +08:00
|
|
|
NULL);
|
2004-11-04 22:24:32 +08:00
|
|
|
|
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<TextEditor>",
|
|
|
|
"text-editor",
|
|
|
|
NULL,
|
|
|
|
"/text-editor-toolbar",
|
|
|
|
"text-editor-toolbar.xml",
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2005-07-09 06:54:46 +08:00
|
|
|
|
2008-10-27 01:39:55 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<TextTool>",
|
|
|
|
"text-tool",
|
|
|
|
NULL,
|
|
|
|
"/text-tool-popup",
|
|
|
|
"text-tool-menu.xml",
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2009-10-10 01:25:07 +08:00
|
|
|
|
2005-07-09 06:54:46 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<CursorInfo>",
|
|
|
|
"cursor-info",
|
|
|
|
NULL,
|
|
|
|
"/cursor-info-popup",
|
|
|
|
"cursor-info-menu.xml",
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2005-07-09 19:23:15 +08:00
|
|
|
|
2006-11-18 06:07:07 +08:00
|
|
|
gimp_menu_factory_manager_register (global_menu_factory, "<SamplePoints>",
|
|
|
|
"sample-points",
|
2005-07-09 19:23:15 +08:00
|
|
|
NULL,
|
2006-11-18 06:07:07 +08:00
|
|
|
"/sample-points-popup",
|
|
|
|
"sample-points-menu.xml",
|
2005-07-09 19:23:15 +08:00
|
|
|
NULL,
|
|
|
|
NULL);
|
2003-01-11 01:55:53 +08:00
|
|
|
}
|
2002-01-26 02:34:33 +08:00
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
void
|
|
|
|
menus_exit (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2004-07-02 22:08:15 +08:00
|
|
|
g_return_if_fail (global_menu_factory != NULL);
|
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
g_object_unref (global_menu_factory);
|
|
|
|
global_menu_factory = NULL;
|
2003-04-01 15:47:04 +08:00
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (gimp->config,
|
2006-04-27 17:23:14 +08:00
|
|
|
menus_can_change_accels,
|
2003-04-01 15:47:04 +08:00
|
|
|
NULL);
|
2001-10-24 00:23:32 +08:00
|
|
|
}
|
|
|
|
|
2003-04-08 18:02:42 +08:00
|
|
|
void
|
|
|
|
menus_restore (Gimp *gimp)
|
|
|
|
{
|
2003-09-22 23:31:54 +08:00
|
|
|
gchar *filename;
|
2003-04-08 18:02:42 +08:00
|
|
|
|
2003-09-22 23:31:54 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2003-04-08 18:02:42 +08:00
|
|
|
|
2003-09-22 23:31:54 +08:00
|
|
|
filename = gimp_personal_rc_file ("menurc");
|
2005-11-07 17:39:06 +08:00
|
|
|
|
|
|
|
if (gimp->be_verbose)
|
|
|
|
g_print ("Parsing '%s'\n", gimp_filename_to_utf8 (filename));
|
|
|
|
|
2003-09-22 23:31:54 +08:00
|
|
|
gtk_accel_map_load (filename);
|
|
|
|
g_free (filename);
|
2003-04-08 18:02:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-07-22 00:11:31 +08:00
|
|
|
menus_save (Gimp *gimp,
|
|
|
|
gboolean always_save)
|
2003-04-08 18:02:42 +08:00
|
|
|
{
|
2003-09-22 23:31:54 +08:00
|
|
|
gchar *filename;
|
2003-04-08 18:02:42 +08:00
|
|
|
|
2003-09-22 23:31:54 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2003-04-08 18:02:42 +08:00
|
|
|
|
2004-07-22 00:11:31 +08:00
|
|
|
if (menurc_deleted && ! always_save)
|
|
|
|
return;
|
|
|
|
|
2003-09-22 23:31:54 +08:00
|
|
|
filename = gimp_personal_rc_file ("menurc");
|
2005-11-07 17:39:06 +08:00
|
|
|
|
|
|
|
if (gimp->be_verbose)
|
|
|
|
g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename));
|
|
|
|
|
2003-09-22 23:31:54 +08:00
|
|
|
gtk_accel_map_save (filename);
|
|
|
|
g_free (filename);
|
2004-07-22 00:11:31 +08:00
|
|
|
|
|
|
|
menurc_deleted = FALSE;
|
2003-04-08 18:02:42 +08:00
|
|
|
}
|
|
|
|
|
2004-07-22 00:11:31 +08:00
|
|
|
gboolean
|
|
|
|
menus_clear (Gimp *gimp,
|
|
|
|
GError **error)
|
2003-04-08 18:02:42 +08:00
|
|
|
{
|
2004-07-22 00:11:31 +08:00
|
|
|
gchar *filename;
|
2007-07-20 20:41:08 +08:00
|
|
|
gchar *source;
|
2004-07-22 00:11:31 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
|
|
|
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
|
|
|
|
|
|
|
filename = gimp_personal_rc_file ("menurc");
|
2007-07-20 20:41:08 +08:00
|
|
|
source = g_build_filename (gimp_sysconf_directory (), "menurc", NULL);
|
2004-07-22 00:11:31 +08:00
|
|
|
|
2012-12-12 14:30:31 +08:00
|
|
|
if (gimp_config_file_copy (source, filename, NULL, NULL, NULL))
|
2007-07-20 20:41:08 +08:00
|
|
|
{
|
|
|
|
menurc_deleted = TRUE;
|
|
|
|
}
|
|
|
|
else if (g_unlink (filename) != 0 && errno != ENOENT)
|
2004-07-22 00:11:31 +08:00
|
|
|
{
|
2008-11-12 18:56:06 +08:00
|
|
|
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
|
|
|
|
_("Deleting \"%s\" failed: %s"),
|
2004-07-22 00:11:31 +08:00
|
|
|
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
menurc_deleted = TRUE;
|
|
|
|
}
|
|
|
|
|
2007-07-20 20:41:08 +08:00
|
|
|
g_free (source);
|
2004-07-22 00:11:31 +08:00
|
|
|
g_free (filename);
|
2003-04-08 18:02:42 +08:00
|
|
|
|
2004-07-22 00:11:31 +08:00
|
|
|
return success;
|
2003-04-08 18:02:42 +08:00
|
|
|
}
|
|
|
|
|
2006-05-11 20:29:57 +08:00
|
|
|
void
|
|
|
|
menus_remove (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
gtk_accel_map_foreach (gimp, menus_remove_accels);
|
|
|
|
}
|
|
|
|
|
2003-01-13 22:08:10 +08:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
2003-04-01 15:47:04 +08:00
|
|
|
static void
|
2006-04-27 17:23:14 +08:00
|
|
|
menus_can_change_accels (GimpGuiConfig *config)
|
2003-04-01 15:47:04 +08:00
|
|
|
{
|
2003-11-02 04:06:01 +08:00
|
|
|
g_object_set (gtk_settings_get_for_screen (gdk_screen_get_default ()),
|
2003-04-02 08:08:38 +08:00
|
|
|
"gtk-can-change-accels", config->can_change_accels,
|
|
|
|
NULL);
|
2003-04-01 15:47:04 +08:00
|
|
|
}
|
2006-05-11 20:29:57 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
menus_remove_accels (gpointer data,
|
|
|
|
const gchar *accel_path,
|
|
|
|
guint accel_key,
|
|
|
|
GdkModifierType accel_mods,
|
|
|
|
gboolean changed)
|
|
|
|
{
|
|
|
|
gtk_accel_map_change_entry (accel_path, 0, 0, TRUE);
|
|
|
|
}
|