2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2003-01-11 01:55:53 +08:00
|
|
|
* 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"
|
|
|
|
|
2004-04-20 21:25:55 +08:00
|
|
|
#include "actions-types.h"
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2006-09-06 05:36:20 +08:00
|
|
|
#include "core/gimp.h"
|
|
|
|
#include "core/gimpcontext.h"
|
2003-01-11 01:55:53 +08:00
|
|
|
|
|
|
|
#include "widgets/gimpmenufactory.h"
|
2004-05-05 23:54:42 +08:00
|
|
|
#include "widgets/gimpuimanager.h"
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2004-05-06 15:41:53 +08:00
|
|
|
#include "menus/menus.h"
|
|
|
|
|
2005-06-27 17:56:25 +08:00
|
|
|
#include "actions.h"
|
2003-01-11 01:55:53 +08:00
|
|
|
#include "debug-commands.h"
|
|
|
|
|
|
|
|
|
2004-02-05 20:52:35 +08:00
|
|
|
#ifdef ENABLE_DEBUG_MENU
|
2003-01-11 01:55:53 +08:00
|
|
|
|
|
|
|
/* local function prototypes */
|
|
|
|
|
2006-09-06 05:36:20 +08:00
|
|
|
static void debug_dump_menus_recurse_menu (GtkWidget *menu,
|
|
|
|
gint depth,
|
|
|
|
gchar *path);
|
|
|
|
static void debug_print_qdata (GimpObject *object);
|
|
|
|
static void debug_print_qdata_foreach (GQuark key_id,
|
|
|
|
gpointer data,
|
|
|
|
gpointer user_data);
|
2003-01-11 01:55:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
2004-05-05 23:54:42 +08:00
|
|
|
void
|
|
|
|
debug_mem_profile_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2005-06-27 17:56:25 +08:00
|
|
|
extern gboolean gimp_debug_memsize;
|
|
|
|
Gimp *gimp;
|
|
|
|
return_if_no_gimp (gimp, data);
|
2004-05-05 23:54:42 +08:00
|
|
|
|
|
|
|
gimp_debug_memsize = TRUE;
|
|
|
|
|
2005-06-27 17:56:25 +08:00
|
|
|
gimp_object_get_memsize (GIMP_OBJECT (gimp), NULL);
|
2004-05-05 23:54:42 +08:00
|
|
|
|
|
|
|
gimp_debug_memsize = FALSE;
|
|
|
|
}
|
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
debug_dump_menus_cmd_callback (GtkAction *action,
|
2004-04-20 00:00:54 +08:00
|
|
|
gpointer data)
|
2003-01-11 01:55:53 +08:00
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
for (list = global_menu_factory->registered_menus;
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
GimpMenuFactoryEntry *entry = list->data;
|
2005-09-26 19:06:15 +08:00
|
|
|
GList *managers;
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2005-09-26 19:06:15 +08:00
|
|
|
managers = gimp_ui_managers_from_name (entry->identifier);
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2005-09-26 19:06:15 +08:00
|
|
|
if (managers)
|
2003-01-11 01:55:53 +08:00
|
|
|
{
|
2005-09-26 19:06:15 +08:00
|
|
|
GimpUIManager *manager = managers->data;
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
for (list = manager->registered_uis; list; list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GimpUIManagerUIEntry *ui_entry = list->data;
|
|
|
|
|
|
|
|
if (GTK_IS_MENU_SHELL (ui_entry->widget))
|
|
|
|
{
|
|
|
|
g_print ("\n\n========================================\n"
|
|
|
|
"Menu: %s%s\n"
|
|
|
|
"========================================\n\n",
|
|
|
|
entry->identifier, ui_entry->ui_path);
|
|
|
|
|
|
|
|
debug_dump_menus_recurse_menu (ui_entry->widget, 1,
|
|
|
|
entry->identifier);
|
|
|
|
g_print ("\n");
|
|
|
|
}
|
|
|
|
}
|
2003-01-11 01:55:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-05 23:54:42 +08:00
|
|
|
debug_dump_managers_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
2003-01-11 01:55:53 +08:00
|
|
|
{
|
2004-05-05 23:54:42 +08:00
|
|
|
GList *list;
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2004-05-05 23:54:42 +08:00
|
|
|
for (list = global_menu_factory->registered_menus;
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GimpMenuFactoryEntry *entry = list->data;
|
|
|
|
GList *managers;
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2004-05-05 23:54:42 +08:00
|
|
|
managers = gimp_ui_managers_from_name (entry->identifier);
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2004-05-05 23:54:42 +08:00
|
|
|
if (managers)
|
|
|
|
{
|
|
|
|
g_print ("\n\n========================================\n"
|
|
|
|
"UI Manager: %s\n"
|
|
|
|
"========================================\n\n",
|
|
|
|
entry->identifier);
|
|
|
|
|
|
|
|
g_print (gtk_ui_manager_get_ui (managers->data));
|
|
|
|
}
|
|
|
|
}
|
2003-01-11 01:55:53 +08:00
|
|
|
}
|
|
|
|
|
2006-09-06 05:36:20 +08:00
|
|
|
void
|
|
|
|
debug_dump_attached_data_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
Gimp *gimp = action_data_get_gimp (data);
|
|
|
|
GimpContext *user_context = gimp_get_user_context (gimp);
|
|
|
|
|
|
|
|
debug_print_qdata (GIMP_OBJECT (gimp));
|
|
|
|
debug_print_qdata (GIMP_OBJECT (user_context));
|
|
|
|
}
|
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
|
|
|
debug_dump_menus_recurse_menu (GtkWidget *menu,
|
|
|
|
gint depth,
|
|
|
|
gchar *path)
|
|
|
|
{
|
2005-09-26 19:06:15 +08:00
|
|
|
GtkWidget *menu_item;
|
|
|
|
GList *list;
|
|
|
|
const gchar *label;
|
|
|
|
gchar *help_page;
|
|
|
|
gchar *full_path;
|
|
|
|
gchar *format_str;
|
2003-01-11 01:55:53 +08:00
|
|
|
|
|
|
|
for (list = GTK_MENU_SHELL (menu)->children; list; list = g_list_next (list))
|
|
|
|
{
|
|
|
|
menu_item = GTK_WIDGET (list->data);
|
2003-08-25 18:49:33 +08:00
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
if (GTK_IS_LABEL (GTK_BIN (menu_item)->child))
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
|
|
|
label = gtk_label_get_text (GTK_LABEL (GTK_BIN (menu_item)->child));
|
|
|
|
full_path = g_strconcat (path, "/", label, NULL);
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2005-09-26 19:06:15 +08:00
|
|
|
help_page = g_object_get_data (G_OBJECT (menu_item), "gimp-help-id");
|
2003-08-25 18:49:33 +08:00
|
|
|
help_page = g_strdup (help_page);
|
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
format_str = g_strdup_printf ("%%%ds%%%ds %%-20s %%s\n",
|
|
|
|
depth * 2, depth * 2 - 40);
|
|
|
|
g_print (format_str,
|
|
|
|
"", label, "", help_page ? help_page : "");
|
|
|
|
g_free (format_str);
|
|
|
|
g_free (help_page);
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
if (GTK_MENU_ITEM (menu_item)->submenu)
|
|
|
|
debug_dump_menus_recurse_menu (GTK_MENU_ITEM (menu_item)->submenu,
|
2003-01-11 01:55:53 +08:00
|
|
|
depth + 1, full_path);
|
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
g_free (full_path);
|
|
|
|
}
|
2003-01-11 01:55:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-06 05:36:20 +08:00
|
|
|
static void
|
|
|
|
debug_print_qdata (GimpObject *object)
|
|
|
|
{
|
|
|
|
g_print ("\nData attached to '%s':\n\n", gimp_object_get_name (object));
|
|
|
|
g_datalist_foreach (&G_OBJECT (object)->qdata,
|
|
|
|
debug_print_qdata_foreach,
|
|
|
|
NULL);
|
|
|
|
g_print ("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
debug_print_qdata_foreach (GQuark key_id,
|
|
|
|
gpointer data,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
g_print ("%s: %p\n", g_quark_to_string (key_id), data);
|
|
|
|
}
|
|
|
|
|
2004-02-05 20:52:35 +08:00
|
|
|
#endif /* ENABLE_DEBUG_MENU */
|