configure.in app/Makefile.am app/menus/.cvsignore app/menus/Makefile.am

2004-05-06  Michael Natterer  <mitch@gimp.org>

	* configure.in
	* app/Makefile.am
	* app/menus/.cvsignore
	* app/menus/Makefile.am
	* app/menus/menus-types.h
	* app/menus/menus.[ch]
	* app/menus/file-open-menu.[ch]
	* app/menus/file-save-menu.[ch]
	* app/menus/image-menu.[ch]
	* app/menus/plug-in-menus.[ch]
	* app/menus/tool-options-menu.[ch]
	* app/menus/toolbox-menu.[ch]: moved all menus files to their
	own directory.

	* app/gui/Makefile.am
	* app/gui/menus.[ch]
	* app/gui/file-open-menu.[ch]
	* app/gui/file-save-menu.[ch]
	* app/gui/image-menu.[ch]
	* app/gui/plug-in-menus.[ch]
	* app/gui/tool-options-menu.[ch]
	* app/gui/toolbox-menu.[ch]: removed them here.

	* app/actions/debug-commands.c
	* app/actions/file-commands.c
	* app/gui/brush-select.c
	* app/gui/dialogs.c
	* app/gui/font-select.c
	* app/gui/gradient-select.c
	* app/gui/gui-vtable.c
	* app/gui/gui.c
	* app/gui/palette-select.c
	* app/gui/pattern-select.c
	* app/gui/preferences-dialog.c: changed #includes accordingly.
This commit is contained in:
Michael Natterer 2004-05-06 07:41:53 +00:00 committed by Michael Natterer
parent 98f6cfa9c8
commit d3439fc3af
40 changed files with 121 additions and 1245 deletions

View File

@ -1,3 +1,40 @@
2004-05-06 Michael Natterer <mitch@gimp.org>
* configure.in
* app/Makefile.am
* app/menus/.cvsignore
* app/menus/Makefile.am
* app/menus/menus-types.h
* app/menus/menus.[ch]
* app/menus/file-open-menu.[ch]
* app/menus/file-save-menu.[ch]
* app/menus/image-menu.[ch]
* app/menus/plug-in-menus.[ch]
* app/menus/tool-options-menu.[ch]
* app/menus/toolbox-menu.[ch]: moved all menus files to their
own directory.
* app/gui/Makefile.am
* app/gui/menus.[ch]
* app/gui/file-open-menu.[ch]
* app/gui/file-save-menu.[ch]
* app/gui/image-menu.[ch]
* app/gui/plug-in-menus.[ch]
* app/gui/tool-options-menu.[ch]
* app/gui/toolbox-menu.[ch]: removed them here.
* app/actions/debug-commands.c
* app/actions/file-commands.c
* app/gui/brush-select.c
* app/gui/dialogs.c
* app/gui/font-select.c
* app/gui/gradient-select.c
* app/gui/gui-vtable.c
* app/gui/gui.c
* app/gui/palette-select.c
* app/gui/pattern-select.c
* app/gui/preferences-dialog.c: changed #includes accordingly.
2004-05-05 Sven Neumann <sven@gimp.org>
* app/gui/file-new-dialog.c: use a normal GimpDialog instead of a

View File

@ -23,6 +23,7 @@ SUBDIRS = \
widgets \
display \
actions \
menus \
gui \
pdb
@ -96,6 +97,7 @@ gimp_2_1_LDFLAGS = \
gimp_2_1_LDADD = \
config/libappconfig.a \
gui/libappgui.a \
menus/libappmenus.a \
actions/libappactions.a \
display/libappdisplay.a \
tools/libapptools.a \

View File

@ -31,8 +31,9 @@
#include "widgets/gimpmenufactory.h"
#include "widgets/gimpuimanager.h"
#include "menus/menus.h"
#include "debug-commands.h"
#include "gui/menus.h"
#ifdef ENABLE_DEBUG_MENU

View File

@ -45,11 +45,12 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "menus/menus.h"
#include "gui/dialogs.h"
#include "gui/file-new-dialog.h"
#include "gui/file-open-dialog.h"
#include "gui/file-save-dialog.h"
#include "gui/menus.h"
#include "actions.h"
#include "file-commands.h"

View File

@ -27,9 +27,10 @@
#include "widgets/gimpdialogfactory.h"
#include "menus/menus.h"
#include "dialogs.h"
#include "dialogs-constructors.h"
#include "menus.h"
GimpDialogFactory *global_dialog_factory = NULL;

View File

@ -47,7 +47,8 @@
#include "widgets/gimptemplateeditor.h"
#include "widgets/gimpwidgets-utils.h"
#include "menus.h"
#include "menus/menus.h"
#include "resolution-calibrate-dialog.h"
#include "session.h"
#include "themes.h"

View File

@ -58,25 +58,8 @@ dialogs_sources = \
user-install-dialog.c \
user-install-dialog.h
menus_sources = \
file-open-menu.c \
file-open-menu.h \
file-save-menu.c \
file-save-menu.h \
image-menu.c \
image-menu.h \
menus.c \
menus.h \
plug-in-menus.c \
plug-in-menus.h \
tool-options-menu.c \
tool-options-menu.h \
toolbox-menu.c \
toolbox-menu.h
libappgui_a_SOURCES = \
$(dialogs_sources) \
$(menus_sources) \
authors.h \
color-history.c \
color-history.h \

View File

@ -41,9 +41,10 @@
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpwidgets-constructors.h"
#include "menus/menus.h"
#include "brush-select.h"
#include "dialogs-constructors.h"
#include "menus.h"
#include "gimp-intl.h"

View File

@ -27,9 +27,10 @@
#include "widgets/gimpdialogfactory.h"
#include "menus/menus.h"
#include "dialogs.h"
#include "dialogs-constructors.h"
#include "menus.h"
GimpDialogFactory *global_dialog_factory = NULL;

View File

@ -1,64 +0,0 @@
/* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "gui-types.h"
#include "core/gimp.h"
#include "plug-in/plug-in-proc.h"
#include "widgets/gimpuimanager.h"
#include "file-open-menu.h"
void
file_open_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
GSList *list;
guint merge_id;
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
for (list = manager->gimp->load_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc = list->data;
gchar *path;
if (! strcmp (file_proc->db_info.name, "gimp_xcf_load"))
path = g_strdup_printf ("%s/%s", ui_path, "Internal");
else
path = g_strdup (ui_path);
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
path,
file_proc->db_info.name,
file_proc->db_info.name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free (path);
}
}

View File

@ -1,27 +0,0 @@
/* The GIMP -- an open 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __FILE_OPEN_MENU_H__
#define __FILE_OPEN_MENU_H__
void file_open_menu_setup (GimpUIManager *manager,
const gchar *ui_path);
#endif /* __FILE_OPEN_MENU_H__ */

View File

@ -1,64 +0,0 @@
/* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "gui-types.h"
#include "core/gimp.h"
#include "plug-in/plug-in-proc.h"
#include "widgets/gimpuimanager.h"
#include "file-save-menu.h"
void
file_save_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
GSList *list;
guint merge_id;
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
for (list = manager->gimp->save_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc = list->data;
gchar *path;
if (! strcmp (file_proc->db_info.name, "gimp_xcf_save"))
path = g_strdup_printf ("%s/%s", ui_path, "Internal");
else
path = g_strdup (ui_path);
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
path,
file_proc->db_info.name,
file_proc->db_info.name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free (path);
}
}

View File

@ -1,27 +0,0 @@
/* The GIMP -- an open 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __FILE_SAVE_MENU_H__
#define __FILE_SAVE_MENU_H__
void file_save_menu_setup (GimpUIManager *manager,
const gchar *ui_path);
#endif /* __FILE_SAVE_MENU_H__ */

View File

@ -37,8 +37,9 @@
#include "widgets/gimpcontainertreeview.h"
#include "widgets/gimphelp-ids.h"
#include "menus/menus.h"
#include "dialogs-constructors.h"
#include "menus.h"
#include "font-select.h"
#include "gimp-intl.h"

View File

@ -39,9 +39,10 @@
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimphelp-ids.h"
#include "menus/menus.h"
#include "dialogs-constructors.h"
#include "gradient-select.h"
#include "menus.h"
#include "gimp-intl.h"

View File

@ -48,14 +48,15 @@
#include "actions/plug-in-actions.h"
#include "menus/menus.h"
#include "menus/plug-in-menus.h"
#include "brush-select.h"
#include "dialogs.h"
#include "font-select.h"
#include "gradient-select.h"
#include "menus.h"
#include "palette-select.h"
#include "pattern-select.h"
#include "plug-in-menus.h"
#include "themes.h"

View File

@ -58,11 +58,12 @@
#include "actions/actions.h"
#include "actions/dialogs-commands.h"
#include "menus/menus.h"
#include "color-history.h"
#include "dialogs.h"
#include "gui.h"
#include "gui-vtable.h"
#include "menus.h"
#include "session.h"
#include "splash.h"
#include "themes.h"

View File

@ -1,36 +0,0 @@
/* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "gui-types.h"
#include "image-menu.h"
#include "menus.h"
#include "plug-in-menus.h"
void
image_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
menus_open_recent_add (manager, ui_path);
plug_in_menus_setup (manager, ui_path);
}

View File

@ -1,362 +0,0 @@
/* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "file/file-utils.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpmenufactory.h"
#include "widgets/gimpuimanager.h"
#include "actions/actions.h"
#include "file-open-menu.h"
#include "file-save-menu.h"
#include "image-menu.h"
#include "menus.h"
#include "tool-options-menu.h"
#include "toolbox-menu.h"
#include "gimp-intl.h"
/* local function prototypes */
static void menu_can_change_accels (GimpGuiConfig *config);
/* global variables */
GimpMenuFactory *global_menu_factory = NULL;
/* private variables */
static gboolean menus_initialized = FALSE;
/* public functions */
void
menus_init (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (menus_initialized == FALSE);
menus_initialized = TRUE;
/* We need to make sure the property is installed before using it */
g_type_class_ref (GTK_TYPE_MENU);
menu_can_change_accels (GIMP_GUI_CONFIG (gimp->config));
g_signal_connect (gimp->config, "notify::can-change-accels",
G_CALLBACK (menu_can_change_accels), NULL);
global_menu_factory = gimp_menu_factory_new (gimp, global_action_factory);
gimp_menu_factory_manager_register (global_menu_factory, "<Image>",
"file",
"debug",
"help",
"edit",
"select",
"view",
"image",
"drawable",
"layers",
"channels",
"vectors",
"tools",
"dialogs",
"plug-in",
"qmask",
NULL,
"/toolbox-menubar",
"toolbox-menu.xml", toolbox_menu_setup,
"/image-menubar",
"image-menu.xml", image_menu_setup,
"/image-popup",
"image-menu.xml", image_menu_setup,
"/qmask-popup",
"qmask-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Dock>",
"file",
"edit",
"select",
"image",
"drawable",
"layers",
"channels",
"vectors",
"tools",
"dialogs",
"plug-in",
"qmask",
NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Load>",
"file-open",
NULL,
"/file-open-popup",
"file-open-menu.xml",
file_open_menu_setup,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Save>",
"file-save",
NULL,
"/file-save-popup",
"file-save-menu.xml",
file_save_menu_setup,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Layers>",
"layers",
NULL,
"/layers-popup",
"layers-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Channels>",
"channels",
NULL,
"/channels-popup",
"channels-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Vectors>",
"vectors",
NULL,
"/vectors-popup",
"vectors-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Dockable>",
"dockable",
NULL,
"/dockable-popup",
"dockable-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Brushes>",
"brushes",
NULL,
"/brushes-popup",
"brushes-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Patterns>",
"patterns",
NULL,
"/patterns-popup",
"patterns-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Gradients>",
"gradients",
NULL,
"/gradients-popup",
"gradients-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Palettes>",
"palettes",
NULL,
"/palettes-popup",
"palettes-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Fonts>",
"fonts",
NULL,
"/fonts-popup",
"fonts-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Buffers>",
"buffers",
NULL,
"/buffers-popup",
"buffers-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Documents>",
"documents",
NULL,
"/documents-popup",
"documents-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Templates>",
"templates",
NULL,
"/templates-popup",
"templates-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<Images>",
"images",
NULL,
"/images-popup",
"images-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<GradientEditor>",
"gradient-editor",
NULL,
"/gradient-editor-popup",
"gradient-editor-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<PaletteEditor>",
"palette-editor",
NULL,
"/palette-editor-popup",
"palette-editor-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<ColormapEditor>",
"colormap-editor",
NULL,
"/colormap-editor-popup",
"colormap-editor-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<ErrorConsole>",
"error-console",
NULL,
"/error-console-popup",
"error-console-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<ToolOptions>",
"tool-options",
NULL,
"/tool-options-popup",
"tool-options-menu.xml",
tool_options_menu_setup,
NULL);
}
void
menus_exit (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_object_unref (global_menu_factory);
global_menu_factory = NULL;
g_signal_handlers_disconnect_by_func (gimp->config,
menu_can_change_accels,
NULL);
}
void
menus_restore (Gimp *gimp)
{
gchar *filename;
g_return_if_fail (GIMP_IS_GIMP (gimp));
filename = gimp_personal_rc_file ("menurc");
gtk_accel_map_load (filename);
g_free (filename);
}
void
menus_save (Gimp *gimp)
{
gchar *filename;
g_return_if_fail (GIMP_IS_GIMP (gimp));
filename = gimp_personal_rc_file ("menurc");
gtk_accel_map_save (filename);
g_free (filename);
}
void
menus_clear (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_print ("TODO: implement menus_clear()\n");
}
void
menus_open_recent_add (GimpUIManager *manager,
const gchar *ui_path)
{
gint n_entries;
guint merge_id;
gint i;
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
g_return_if_fail (ui_path != NULL);
n_entries = GIMP_GUI_CONFIG (manager->gimp->config)->last_opened_size;
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
for (i = 0; i < n_entries; i++)
{
gchar *action_name;
gchar *action_path;
action_name = g_strdup_printf ("file-open-recent-%02d", i + 1);
action_path = g_strdup_printf ("%s/File/Open Recent/file-open-recent-placeholder",
ui_path);
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
action_path, action_name, action_name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free (action_name);
g_free (action_path);
}
}
/* private functions */
static void
menu_can_change_accels (GimpGuiConfig *config)
{
g_object_set (gtk_settings_get_for_screen (gdk_screen_get_default ()),
"gtk-can-change-accels", config->can_change_accels,
NULL);
}

View File

@ -1,36 +0,0 @@
/* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MENUS_H__
#define __MENUS_H__
extern GimpMenuFactory *global_menu_factory;
void menus_init (Gimp *gimp);
void menus_exit (Gimp *gimp);
void menus_restore (Gimp *gimp);
void menus_save (Gimp *gimp);
void menus_clear (Gimp *gimp);
void menus_open_recent_add (GimpUIManager *manager,
const gchar *ui_path);
#endif /* __MENUS_H__ */

View File

@ -39,8 +39,9 @@
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimphelp-ids.h"
#include "menus/menus.h"
#include "dialogs-constructors.h"
#include "menus.h"
#include "palette-select.h"
#include "gimp-intl.h"

View File

@ -40,7 +40,8 @@
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimphelp-ids.h"
#include "menus.h"
#include "menus/menus.h"
#include "pattern-select.h"
#include "gimp-intl.h"

View File

@ -1,296 +0,0 @@
/* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "string.h"
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "plug-in/plug-ins.h"
#include "plug-in/plug-in-def.h"
#include "plug-in/plug-in-proc.h"
#include "widgets/gimpuimanager.h"
#include "plug-in-menus.h"
#include "gimp-intl.h"
/* local function prototypes */
static gboolean plug_in_menus_tree_traverse (gpointer foo,
PlugInProcDef *proc_def,
GimpUIManager *manager);
static void plug_in_menus_build_path (GimpUIManager *manager,
const gchar *ui_path,
guint merge_id,
const gchar *path);
/* public functions */
void
plug_in_menus_init (Gimp *gimp,
GSList *plug_in_defs,
const gchar *std_plugins_domain)
{
GSList *domains = NULL;
GSList *tmp;
g_return_if_fail (std_plugins_domain != NULL);
domains = g_slist_append (domains, (gpointer) std_plugins_domain);
bindtextdomain (std_plugins_domain, gimp_locale_directory ());
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (std_plugins_domain, "UTF-8");
#endif
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
{
PlugInDef *plug_in_def;
const gchar *locale_domain;
const gchar *locale_path;
GSList *list;
plug_in_def = (PlugInDef *) tmp->data;
if (! plug_in_def->proc_defs)
continue;
locale_domain = plug_ins_locale_domain (gimp,
plug_in_def->prog,
&locale_path);
for (list = domains; list; list = list->next)
if (! strcmp (locale_domain, (const gchar *) list->data))
break;
if (! list)
{
domains = g_slist_append (domains, (gpointer) locale_domain);
bindtextdomain (locale_domain, locale_path);
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (locale_domain, "UTF-8");
#endif
}
}
g_slist_free (domains);
}
void
plug_in_menus_setup (GimpUIManager *manager,
const gchar *ui_path)
{
GTree *menu_entries;
GSList *list;
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
g_return_if_fail (ui_path != NULL);
menu_entries = g_tree_new_full ((GCompareDataFunc) g_utf8_collate, NULL,
g_free, NULL);
for (list = manager->gimp->plug_in_proc_defs;
list;
list = g_slist_next (list))
{
PlugInProcDef *proc_def = list->data;
if (proc_def->prog &&
proc_def->menu_path &&
! proc_def->extensions &&
! proc_def->prefixes &&
! proc_def->magics)
{
if ((! strncmp (proc_def->menu_path, "<Toolbox>", 9) &&
! strcmp (ui_path, "/toolbox-menubar")) ||
(! strncmp (proc_def->menu_path, "<Image>", 7) &&
(! strcmp (ui_path, "/image-menubar") ||
! strcmp (ui_path, "/image-popup"))))
{
const gchar *progname;
const gchar *locale_domain;
gchar *key;
progname = plug_in_proc_def_get_progname (proc_def);
locale_domain = plug_ins_locale_domain (manager->gimp,
progname, NULL);
key = gimp_strip_uline (dgettext (locale_domain,
proc_def->menu_path));
g_tree_insert (menu_entries, key, proc_def);
}
}
}
g_object_set_data (G_OBJECT (manager), "ui-path", (gpointer) ui_path);
g_tree_foreach (menu_entries,
(GTraverseFunc) plug_in_menus_tree_traverse,
manager);
g_object_set_data (G_OBJECT (manager), "ui-path", NULL);
g_tree_destroy (menu_entries);
}
void
plug_in_menus_add_proc (GimpUIManager *manager,
const gchar *ui_path,
PlugInProcDef *proc_def)
{
gchar *path;
gchar *p;
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
g_return_if_fail (ui_path != NULL);
g_return_if_fail (proc_def != NULL);
path = g_strdup (proc_def->menu_path);
p = strrchr (path, '/');
if (p)
{
gchar *action_path;
gchar *merge_key;
guint merge_id;
*p = '\0';
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
plug_in_menus_build_path (manager, ui_path, merge_id, path);
action_path = g_strdup_printf ("%s%s", ui_path, strchr (path, '/'));
#if 0
g_print ("adding UI for '%s' (@ %s)\n",
proc_def->db_info.name, action_path);
#endif
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
action_path,
proc_def->db_info.name,
proc_def->db_info.name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free (action_path);
merge_key = g_strdup_printf ("%s-merge-id", proc_def->db_info.name);
g_object_set_data (G_OBJECT (manager), merge_key,
GUINT_TO_POINTER (merge_id));
g_free (merge_key);
}
g_free (path);
}
void
plug_in_menus_remove_proc (GimpUIManager *manager,
PlugInProcDef *proc_def)
{
gchar *merge_key;
guint merge_id;
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
g_return_if_fail (proc_def != NULL);
merge_key = g_strdup_printf ("%s-merge-id", proc_def->db_info.name);
merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (manager),
merge_key));
g_free (merge_key);
if (merge_id)
gtk_ui_manager_remove_ui (GTK_UI_MANAGER (manager), merge_id);
}
/* private functions */
static gboolean
plug_in_menus_tree_traverse (gpointer foo,
PlugInProcDef *proc_def,
GimpUIManager *manager)
{
const gchar *ui_path = g_object_get_data (G_OBJECT (manager), "ui-path");
plug_in_menus_add_proc (manager, ui_path, proc_def);
return FALSE;
}
static void
plug_in_menus_build_path (GimpUIManager *manager,
const gchar *ui_path,
guint merge_id,
const gchar *path)
{
gchar *action_path;
action_path = g_strdup_printf ("%s%s", ui_path, strchr (path, '/'));
if (! gtk_ui_manager_get_widget (GTK_UI_MANAGER (manager), action_path))
{
gchar *base_path = g_strdup (path);
gchar *p;
p = strrchr (base_path, '/');
if (p)
{
gchar *name;
*p = '\0';
plug_in_menus_build_path (manager, ui_path, merge_id, base_path);
p = strrchr (action_path, '/');
*p = '\0';
#if 0
g_print ("adding UI for '%s' (@ %s)\n",
path, action_path);
#endif
name = strrchr (path, '/') + 1;
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
action_path, name, path,
GTK_UI_MANAGER_MENU,
FALSE);
}
g_free (base_path);
}
g_free (action_path);
}

View File

@ -1,36 +0,0 @@
/* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PLUG_IN_MENUS_H__
#define __PLUG_IN_MENUS_H__
void plug_in_menus_init (Gimp *gimp,
GSList *plug_in_defs,
const gchar *std_plugins_domain);
void plug_in_menus_setup (GimpUIManager *manager,
const gchar *ui_path);
void plug_in_menus_add_proc (GimpUIManager *manager,
const gchar *ui_path,
PlugInProcDef *proc_def);
void plug_in_menus_remove_proc (GimpUIManager *manager,
PlugInProcDef *proc_def);
#endif /* __PLUG_IN_MENUS_H__ */

View File

@ -47,7 +47,8 @@
#include "widgets/gimptemplateeditor.h"
#include "widgets/gimpwidgets-utils.h"
#include "menus.h"
#include "menus/menus.h"
#include "resolution-calibrate-dialog.h"
#include "session.h"
#include "themes.h"

View File

@ -1,164 +0,0 @@
/* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimplist.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpuimanager.h"
#include "tool-options-menu.h"
/* local function prototypes */
static void tool_options_menu_update (GimpUIManager *manager,
gpointer update_data,
const gchar *ui_path);
static void tool_options_menu_update_after (GimpUIManager *manager,
gpointer update_data,
const gchar *ui_path);
static void tool_options_menu_update_presets (GimpUIManager *manager,
guint merge_id,
const gchar *ui_path,
const gchar *menu_path,
const gchar *action_prefix,
GimpContainer *presets);
/* public functions */
void
tool_options_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
g_signal_connect (manager, "update",
G_CALLBACK (tool_options_menu_update),
(gpointer) ui_path);
g_signal_connect_after (manager, "update",
G_CALLBACK (tool_options_menu_update_after),
(gpointer) ui_path);
}
/* private functions */
static void
tool_options_menu_update (GimpUIManager *manager,
gpointer update_data,
const gchar *ui_path)
{
guint merge_id;
merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (manager),
"tool-options-merge-id"));
if (merge_id)
{
gtk_ui_manager_remove_ui (GTK_UI_MANAGER (manager), merge_id);
g_object_set_data (G_OBJECT (manager), "tool-options-merge-id",
GINT_TO_POINTER (0));
gtk_ui_manager_ensure_update (GTK_UI_MANAGER (manager));
}
}
static void
tool_options_menu_update_after (GimpUIManager *manager,
gpointer update_data,
const gchar *ui_path)
{
GimpContext *context;
GimpToolInfo *tool_info;
guint merge_id;
context = gimp_get_user_context (manager->gimp);
tool_info = gimp_context_get_tool (context);
if (! tool_info->options_presets)
return;
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
g_object_set_data (G_OBJECT (manager), "tool-options-merge-id",
GUINT_TO_POINTER (merge_id));
tool_options_menu_update_presets (manager, merge_id, ui_path,
"tool-options-save-menu",
"tool-options-save-",
tool_info->options_presets);
tool_options_menu_update_presets (manager, merge_id, ui_path,
"tool-options-restore-menu",
"tool-options-restore-",
tool_info->options_presets);
tool_options_menu_update_presets (manager, merge_id, ui_path,
"tool-options-rename-menu",
"tool-options-rename-",
tool_info->options_presets);
tool_options_menu_update_presets (manager, merge_id, ui_path,
"tool-options-delete-menu",
"tool-options-delete-",
tool_info->options_presets);
gtk_ui_manager_ensure_update (GTK_UI_MANAGER (manager));
}
static void
tool_options_menu_update_presets (GimpUIManager *manager,
guint merge_id,
const gchar *ui_path,
const gchar *menu_path,
const gchar *action_prefix,
GimpContainer *presets)
{
gint n_children;
gint i;
n_children = gimp_container_num_children (presets);
for (i = 0; i < n_children; i++)
{
gchar *action_name;
gchar *path;
path = g_strdup_printf ("%s/%s", ui_path, menu_path);
action_name = g_strdup_printf ("%s%03d", action_prefix, i);
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
path, action_name, action_name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free (action_name);
g_free (path);
}
}

View File

@ -1,27 +0,0 @@
/* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __TOOL_OPTIONS_MENU_H__
#define __TOOL_OPTIONS_MENU_H__
void tool_options_menu_setup (GimpUIManager *manager,
const gchar *ui_path);
#endif /* __TOOL_OPTIONS_MENU_H__ */

View File

@ -1,36 +0,0 @@
/* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "gui-types.h"
#include "menus.h"
#include "plug-in-menus.h"
#include "toolbox-menu.h"
void
toolbox_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
menus_open_recent_add (manager, ui_path);
plug_in_menus_setup (manager, ui_path);
}

View File

@ -1,27 +0,0 @@
/* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __TOOLBOX_MENU_H__
#define __TOOLBOX_MENU_H__
void toolbox_menu_setup (GimpUIManager *manager,
const gchar *ui_path);
#endif /* __TOOLBOX_MENU_H__ */

6
app/menus/.cvsignore Normal file
View File

@ -0,0 +1,6 @@
Makefile
Makefile.in
.deps
.libs
*.lo
libappmenus.la

37
app/menus/Makefile.am Normal file
View File

@ -0,0 +1,37 @@
## Process this file with automake to produce Makefile.in
noinst_LIBRARIES = libappmenus.a
libappmenus_a_SOURCES = \
menus-types.h \
menus.c \
menus.h \
\
file-open-menu.c \
file-open-menu.h \
file-save-menu.c \
file-save-menu.h \
image-menu.c \
image-menu.h \
plug-in-menus.c \
plug-in-menus.h \
tool-options-menu.c \
tool-options-menu.h \
toolbox-menu.c \
toolbox-menu.h
EXTRA_DIST = makefile.msc
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"Gimp-Menus\" \
@GIMP_THREAD_FLAGS@ \
@GIMP_MP_FLAGS@
INCLUDES = \
-I$(top_builddir) \
-I$(top_srcdir) \
-I$(top_builddir)/app \
-I$(top_srcdir)/app \
$(GTK_CFLAGS) \
-I$(includedir)

View File

@ -22,7 +22,7 @@
#include <gtk/gtk.h>
#include "gui-types.h"
#include "menus-types.h"
#include "core/gimp.h"

View File

@ -22,7 +22,7 @@
#include <gtk/gtk.h>
#include "gui-types.h"
#include "menus-types.h"
#include "core/gimp.h"

View File

@ -20,7 +20,7 @@
#include <gtk/gtk.h>
#include "gui-types.h"
#include "menus-types.h"
#include "image-menu.h"
#include "menus.h"

View File

@ -16,12 +16,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __IMAGE_MENU_H__
#define __IMAGE_MENU_H__
#ifndef __MENUS_TYPES_H__
#define __MENUS_TYPES_H__
void image_menu_setup (GimpUIManager *manager,
const gchar *ui_path);
#include "gui/gui-types.h"
#endif /* __IMAGE_MENU_H__ */
#endif /* __MENUS_TYPES_H__ */

View File

@ -23,7 +23,7 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "menus-types.h"
#include "config/gimpguiconfig.h"

View File

@ -24,7 +24,7 @@
#include "libgimpbase/gimpbase.h"
#include "gui-types.h"
#include "menus-types.h"
#include "core/gimp.h"

View File

@ -22,7 +22,7 @@
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "menus-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"

View File

@ -20,7 +20,7 @@
#include <gtk/gtk.h>
#include "gui-types.h"
#include "menus-types.h"
#include "menus.h"
#include "plug-in-menus.h"

View File

@ -1520,6 +1520,7 @@ app/core/Makefile
app/display/Makefile
app/file/Makefile
app/gui/Makefile
app/menus/Makefile
app/paint/Makefile
app/paint-funcs/Makefile
app/composite/Makefile