Commit 829449a8 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/widgets/gimpitemfactory.[ch] added a help_id to GimpItemFactory. It's

2003-08-25  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpitemfactory.[ch]
	* app/widgets/gimpmenufactory.[ch]: added a help_id to
	GimpItemFactory.  It's basically the code I removed some days ago,
	but this time it's used as default help_id for the factory (e.g.
	if F1 is pressed over a separator), and not to construct html
	links.

	* app/widgets/gimphelp-ids.h: added some missing help IDs.

	* app/gui/menus.c: register a help IDs with each item factory.

	* app/display/gimpdisplayshell.c
	* app/gui/dialogs-menu.c: some more forgotten help IDs.
parent 2d5fe07a
2003-08-25 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpitemfactory.[ch]
* app/widgets/gimpmenufactory.[ch]: added a help_id to
GimpItemFactory. It's basically the code I removed some days ago,
but this time it's used as default help_id for the factory (e.g.
if F1 is pressed over a separator), and not to construct html
links.
* app/widgets/gimphelp-ids.h: added some missing help IDs.
* app/gui/menus.c: register a help IDs with each item factory.
* app/display/gimpdisplayshell.c
* app/gui/dialogs-menu.c: some more forgotten help IDs.
2003-08-25 Michael Natterer <mitch@gimp.org>
* app/widgets/gimphelp-ids.h
......@@ -337,7 +337,7 @@ gimp_display_shell_init (GimpDisplayShell *shell)
shell);
gimp_help_connect (GTK_WIDGET (shell), gimp_standard_help_func,
"image/image_window.html", NULL);
GIMP_HELP_IMAGE_WINDOW, NULL);
}
......
......@@ -337,7 +337,7 @@ gimp_display_shell_init (GimpDisplayShell *shell)
shell);
gimp_help_connect (GTK_WIDGET (shell), gimp_standard_help_func,
"image/image_window.html", NULL);
GIMP_HELP_IMAGE_WINDOW, NULL);
}
......
......@@ -48,10 +48,12 @@
(id), (help_id), NULL }
#define PREVIEW_SIZE(path,size) \
{ { (path), NULL, dialogs_preview_size_cmd_callback, \
(size), "/Preview Size/Tiny" }, NULL, NULL, NULL }
(size), "/Preview Size/Tiny" }, \
NULL, GIMP_HELP_DOCK_PREVIEW_SIZE, NULL }
#define TAB_STYLE(path,style) \
{ { (path), NULL, dialogs_tab_style_cmd_callback, \
(style), "/Tab Style/Icon" }, NULL, NULL, NULL }
(style), "/Tab Style/Icon" }, \
NULL, GIMP_HELP_DOCK_TAB_STYLE, NULL }
GimpItemFactoryEntry dialogs_menu_entries[] =
......@@ -119,7 +121,8 @@ GimpItemFactoryEntry dialogs_menu_entries[] =
{ { N_("/_Remove Tab"), NULL,
dialogs_remove_tab_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REMOVE },
NULL, NULL, NULL },
NULL,
GIMP_HELP_DOCK_TAB_REMOVE, NULL },
MENU_SEPARATOR ("/---"),
......@@ -128,7 +131,8 @@ GimpItemFactoryEntry dialogs_menu_entries[] =
{ { N_("/Preview Size/_Tiny"), NULL,
dialogs_preview_size_cmd_callback,
GIMP_PREVIEW_SIZE_TINY, "<RadioItem>" },
NULL, NULL, NULL },
NULL,
GIMP_HELP_DOCK_PREVIEW_SIZE, NULL },
PREVIEW_SIZE (N_("/Preview Size/E_xtra Small"), GIMP_PREVIEW_SIZE_EXTRA_SMALL),
PREVIEW_SIZE (N_("/Preview Size/_Small"), GIMP_PREVIEW_SIZE_SMALL),
......@@ -144,7 +148,8 @@ GimpItemFactoryEntry dialogs_menu_entries[] =
{ { N_("/Tab Style/_Icon"), NULL,
dialogs_tab_style_cmd_callback,
GIMP_TAB_STYLE_ICON, "<RadioItem>" },
NULL, NULL, NULL },
NULL,
GIMP_HELP_DOCK_TAB_STYLE, NULL },
TAB_STYLE (N_("/Tab Style/Current _Status"), GIMP_TAB_STYLE_PREVIEW),
TAB_STYLE (N_("/Tab Style/_Text"), GIMP_TAB_STYLE_NAME),
......@@ -153,10 +158,12 @@ GimpItemFactoryEntry dialogs_menu_entries[] =
{ { N_("/View as _List"), NULL,
dialogs_toggle_view_cmd_callback, GIMP_VIEW_TYPE_LIST, "<RadioItem>" },
NULL, NULL, NULL },
NULL,
GIMP_HELP_DOCK_VIEW_AS_LIST, NULL },
{ { N_("/View as _Grid"), NULL,
dialogs_toggle_view_cmd_callback, GIMP_VIEW_TYPE_GRID, "/View as List" },
NULL, NULL, NULL },
NULL,
GIMP_HELP_DOCK_VIEW_AS_GRID, NULL },
MENU_SEPARATOR ("/image-menu-separator"),
......
......@@ -108,107 +108,128 @@ menus_init (Gimp *gimp)
global_menu_factory = gimp_menu_factory_new (gimp);
gimp_menu_factory_menu_register (global_menu_factory, "<Toolbox>",
GIMP_HELP_TOOLBOX,
toolbox_menu_setup, NULL, FALSE,
n_toolbox_menu_entries,
toolbox_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Image>",
GIMP_HELP_IMAGE_WINDOW,
image_menu_setup, image_menu_update, FALSE,
n_image_menu_entries,
image_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Load>",
GIMP_HELP_FILE_OPEN,
file_open_menu_setup, NULL, FALSE,
n_file_open_menu_entries,
file_open_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Save>",
GIMP_HELP_FILE_SAVE,
file_save_menu_setup,
file_save_menu_update, FALSE,
n_file_save_menu_entries,
file_save_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Layers>",
GIMP_HELP_LAYER_DIALOG,
NULL, layers_menu_update, TRUE,
n_layers_menu_entries,
layers_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Channels>",
GIMP_HELP_CHANNEL_DIALOG,
NULL, channels_menu_update, TRUE,
n_channels_menu_entries,
channels_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Vectors>",
GIMP_HELP_PATH_DIALOG,
NULL, vectors_menu_update, TRUE,
n_vectors_menu_entries,
vectors_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Dialogs>",
GIMP_HELP_DOCK,
NULL, dialogs_menu_update, TRUE,
n_dialogs_menu_entries,
dialogs_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Brushes>",
GIMP_HELP_BRUSH_DIALOG,
NULL, brushes_menu_update, TRUE,
n_brushes_menu_entries,
brushes_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Patterns>",
GIMP_HELP_PATTERN_DIALOG,
NULL, patterns_menu_update, TRUE,
n_patterns_menu_entries,
patterns_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Gradients>",
GIMP_HELP_GRADIENT_DIALOG,
NULL, gradients_menu_update, TRUE,
n_gradients_menu_entries,
gradients_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Palettes>",
GIMP_HELP_PALETTE_DIALOG,
NULL, palettes_menu_update, TRUE,
n_palettes_menu_entries,
palettes_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Buffers>",
GIMP_HELP_BUFFER_DIALOG,
NULL, buffers_menu_update, TRUE,
n_buffers_menu_entries,
buffers_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Documents>",
GIMP_HELP_DOCUMENT_DIALOG,
NULL, documents_menu_update, TRUE,
n_documents_menu_entries,
documents_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Templates>",
GIMP_HELP_TEMPLATE_DIALOG,
NULL, templates_menu_update, TRUE,
n_templates_menu_entries,
templates_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Images>",
GIMP_HELP_IMAGE_DIALOG,
NULL, images_menu_update, TRUE,
n_images_menu_entries,
images_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<GradientEditor>",
GIMP_HELP_GRADIENT_EDITOR_DIALOG,
NULL, gradient_editor_menu_update, TRUE,
n_gradient_editor_menu_entries,
gradient_editor_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<PaletteEditor>",
GIMP_HELP_PALETTE_EDITOR_DIALOG,
NULL, palette_editor_menu_update, TRUE,
n_palette_editor_menu_entries,
palette_editor_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<ColormapEditor>",
GIMP_HELP_INDEXED_PALETTE_DIALOG,
NULL, colormap_editor_menu_update, TRUE,
n_colormap_editor_menu_entries,
colormap_editor_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<QMask>",
GIMP_HELP_QMASK,
NULL, qmask_menu_update, TRUE,
n_qmask_menu_entries,
qmask_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<ErrorConsole>",
GIMP_HELP_ERRORS_DIALOG,
NULL, error_console_menu_update, TRUE,
n_error_console_menu_entries,
error_console_menu_entries);
......
......@@ -108,107 +108,128 @@ menus_init (Gimp *gimp)
global_menu_factory = gimp_menu_factory_new (gimp);
gimp_menu_factory_menu_register (global_menu_factory, "<Toolbox>",
GIMP_HELP_TOOLBOX,
toolbox_menu_setup, NULL, FALSE,
n_toolbox_menu_entries,
toolbox_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Image>",
GIMP_HELP_IMAGE_WINDOW,
image_menu_setup, image_menu_update, FALSE,
n_image_menu_entries,
image_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Load>",
GIMP_HELP_FILE_OPEN,
file_open_menu_setup, NULL, FALSE,
n_file_open_menu_entries,
file_open_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Save>",
GIMP_HELP_FILE_SAVE,
file_save_menu_setup,
file_save_menu_update, FALSE,
n_file_save_menu_entries,
file_save_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Layers>",
GIMP_HELP_LAYER_DIALOG,
NULL, layers_menu_update, TRUE,
n_layers_menu_entries,
layers_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Channels>",
GIMP_HELP_CHANNEL_DIALOG,
NULL, channels_menu_update, TRUE,
n_channels_menu_entries,
channels_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Vectors>",
GIMP_HELP_PATH_DIALOG,
NULL, vectors_menu_update, TRUE,
n_vectors_menu_entries,
vectors_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Dialogs>",
GIMP_HELP_DOCK,
NULL, dialogs_menu_update, TRUE,
n_dialogs_menu_entries,
dialogs_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Brushes>",
GIMP_HELP_BRUSH_DIALOG,
NULL, brushes_menu_update, TRUE,
n_brushes_menu_entries,
brushes_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Patterns>",
GIMP_HELP_PATTERN_DIALOG,
NULL, patterns_menu_update, TRUE,
n_patterns_menu_entries,
patterns_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Gradients>",
GIMP_HELP_GRADIENT_DIALOG,
NULL, gradients_menu_update, TRUE,
n_gradients_menu_entries,
gradients_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Palettes>",
GIMP_HELP_PALETTE_DIALOG,
NULL, palettes_menu_update, TRUE,
n_palettes_menu_entries,
palettes_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Buffers>",
GIMP_HELP_BUFFER_DIALOG,
NULL, buffers_menu_update, TRUE,
n_buffers_menu_entries,
buffers_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Documents>",
GIMP_HELP_DOCUMENT_DIALOG,
NULL, documents_menu_update, TRUE,
n_documents_menu_entries,
documents_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Templates>",
GIMP_HELP_TEMPLATE_DIALOG,
NULL, templates_menu_update, TRUE,
n_templates_menu_entries,
templates_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<Images>",
GIMP_HELP_IMAGE_DIALOG,
NULL, images_menu_update, TRUE,
n_images_menu_entries,
images_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<GradientEditor>",
GIMP_HELP_GRADIENT_EDITOR_DIALOG,
NULL, gradient_editor_menu_update, TRUE,
n_gradient_editor_menu_entries,
gradient_editor_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<PaletteEditor>",
GIMP_HELP_PALETTE_EDITOR_DIALOG,
NULL, palette_editor_menu_update, TRUE,
n_palette_editor_menu_entries,
palette_editor_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<ColormapEditor>",
GIMP_HELP_INDEXED_PALETTE_DIALOG,
NULL, colormap_editor_menu_update, TRUE,
n_colormap_editor_menu_entries,
colormap_editor_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<QMask>",
GIMP_HELP_QMASK,
NULL, qmask_menu_update, TRUE,
n_qmask_menu_entries,
qmask_menu_entries);
gimp_menu_factory_menu_register (global_menu_factory, "<ErrorConsole>",
GIMP_HELP_ERRORS_DIALOG,
NULL, error_console_menu_update, TRUE,
n_error_console_menu_entries,
error_console_menu_entries);
......
......@@ -88,6 +88,7 @@
#define GIMP_HELP_VIEW_SHRINK_WRAP "view/shrink_wrap.html"
#define GIMP_HELP_VIEW_FULLSCREEN "view/fullscreen.html"
#define GIMP_HELP_IMAGE_WINDOW "dialogs/image_window.html"
#define GIMP_HELP_IMAGE_DIALOG "dialogs/image_dialog.html"
#define GIMP_HELP_IMAGE_CONVERT_RGB "image/mode/convert_to_rgb.html"
#define GIMP_HELP_IMAGE_CONVERT_GRAYSCALE "image/mode/convert_to_grayscale.html"
......@@ -161,6 +162,7 @@
#define GIMP_HELP_CHANNEL_SELECTION_INTERSECT "channels/channel_to_selection.html#intersect"
#define GIMP_HELP_CHANNEL_EDIT "dialogs/edit_channel_attributes.html"
#define GIMP_HELP_QMASK "select/quickmask.html"
#define GIMP_HELP_QMASK_TOGGLE "select/quickmask.html"
#define GIMP_HELP_QMASK_INVERT "select/quickmask.html"
#define GIMP_HELP_QMASK_EDIT "dialogs/edit_qmask_attributes.html"
......@@ -349,6 +351,14 @@
#define GIMP_HELP_PREFS_FOLDERS_ENVIRONMENT "dialogs/preferences/folders.html#environ"
#define GIMP_HELP_PREFS_FOLDERS_THEMES "dialogs/preferences/folders.html#themes"
#define GIMP_HELP_DOCK "dialogs/dock.html"
#define GIMP_HELP_DOCK_TAB_ADD "dialogs/dock.html"
#define GIMP_HELP_DOCK_TAB_REMOVE "dialogs/dock.html"
#define GIMP_HELP_DOCK_PREVIEW_SIZE "dialogs/dock.html"
#define GIMP_HELP_DOCK_TAB_STYLE "dialogs/dock.html"
#define GIMP_HELP_DOCK_VIEW_AS_LIST "dialogs/dock.html"
#define GIMP_HELP_DOCK_VIEW_AS_GRID "dialogs/dock.html"
#define GIMP_HELP_COLOR_DIALOG "dialogs/color.html"
#define GIMP_HELP_DEVICE_STATUS_DIALOG "dialogs/device_status.html"
#define GIMP_HELP_MODULE_DIALOG "dialogs/module_manager.html"
......
......@@ -46,6 +46,7 @@
static void gimp_item_factory_class_init (GimpItemFactoryClass *klass);
static void gimp_item_factory_init (GimpItemFactory *factory);
static void gimp_item_factory_finalize (GObject *object);
static void gimp_item_factory_destroy (GtkObject *object);
static void gimp_item_factory_create_branches (GimpItemFactory *factory,
......@@ -94,13 +95,17 @@ gimp_item_factory_get_type (void)
static void
gimp_item_factory_class_init (GimpItemFactoryClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GtkObjectClass *gtk_object_class;
object_class = GTK_OBJECT_CLASS (klass);
object_class = G_OBJECT_CLASS (klass);
gtk_object_class = GTK_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_item_factory_destroy;
object_class->finalize = gimp_item_factory_finalize;
gtk_object_class->destroy = gimp_item_factory_destroy;
klass->factories = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
......@@ -112,6 +117,23 @@ gimp_item_factory_init (GimpItemFactory *factory)
factory->gimp = NULL;
factory->update_func = NULL;
factory->update_on_popup = FALSE;
factory->help_id = NULL;
}
static void
gimp_item_factory_finalize (GObject *object)
{
GimpItemFactory *factory;
factory = GIMP_ITEM_FACTORY (object);
if (factory->help_id)
{
g_free (factory->help_id);
factory->help_id = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
......@@ -156,6 +178,7 @@ GimpItemFactory *
gimp_item_factory_new (Gimp *gimp,
GType container_type,
const gchar *factory_path,
const gchar *help_id,
GimpItemFactoryUpdateFunc update_func,
gboolean update_on_popup,
guint n_entries,
......@@ -169,6 +192,7 @@ gimp_item_factory_new (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (factory_path != NULL, NULL);
g_return_val_if_fail (help_id != NULL, NULL);
g_return_val_if_fail (factory_path[0] == '<', NULL);
g_return_val_if_fail (factory_path[strlen (factory_path) - 1] == '>', NULL);
......@@ -189,6 +213,7 @@ gimp_item_factory_new (Gimp *gimp,
factory->gimp = gimp;
factory->update_func = update_func;
factory->update_on_popup = update_on_popup;
factory->help_id = g_strdup (help_id);
list = g_hash_table_lookup (factory_class->factories, factory_path);
......@@ -908,7 +933,7 @@ gimp_item_factory_item_key_press (GtkWidget *widget,
/* ...finally, if F1 was pressed over any menu, show it's help page... */
if (! help_id)
help_id = GIMP_HELP_MAIN;
help_id = item_factory->help_id;
{
gchar *help_path = NULL;
......
......@@ -50,6 +50,7 @@ struct _GimpItemFactory
Gimp *gimp;
GimpItemFactoryUpdateFunc update_func;
gboolean update_on_popup;
gchar *help_id;
};
struct _GimpItemFactoryClass
......@@ -65,6 +66,7 @@ GType gimp_item_factory_get_type (void) G_GNUC_CONST;
GimpItemFactory * gimp_item_factory_new (Gimp *gimp,
GType container_type,
const gchar *factory_path,
const gchar *help_id,
GimpItemFactoryUpdateFunc update_func,
gboolean update_on_popup,
guint n_entries,
......
......@@ -106,6 +106,7 @@ gimp_menu_factory_finalize (GObject *object)
entry = (GimpMenuFactoryEntry *) list->data;
g_free (entry->identifier);
g_free (entry->help_id);
g_free (entry);
}
......@@ -132,6 +133,7 @@ gimp_menu_factory_new (Gimp *gimp)
void
gimp_menu_factory_menu_register (GimpMenuFactory *factory,
const gchar *identifier,
const gchar *help_id,
GimpItemFactorySetupFunc setup_func,
GimpItemFactoryUpdateFunc update_func,
gboolean update_on_popup,
......@@ -142,12 +144,14 @@ gimp_menu_factory_menu_register (GimpMenuFactory *factory,
g_return_if_fail (GIMP_IS_MENU_FACTORY (factory));
g_return_if_fail (identifier != NULL);
g_return_if_fail (help_id != NULL);
g_return_if_fail (n_entries > 0);
g_return_if_fail (entries != NULL);
entry = g_new0 (GimpMenuFactoryEntry, 1);
entry->identifier = g_strdup (identifier);
entry->help_id = g_strdup (help_id);
entry->setup_func = setup_func;
entry->update_func = update_func;
entry->update_on_popup = update_on_popup ? TRUE : FALSE;
......@@ -180,6 +184,7 @@ gimp_menu_factory_menu_new (GimpMenuFactory *factory,
item_factory = gimp_item_factory_new (factory->gimp,
container_type,
entry->identifier,
entry->help_id,
entry->update_func,
entry->update_on_popup,
entry->n_entries,
......
......@@ -31,6 +31,7 @@ typedef struct _GimpMenuFactoryEntry GimpMenuFactoryEntry;
struct _GimpMenuFactoryEntry
{
gchar *identifier;
gchar *help_id;
GimpItemFactorySetupFunc setup_func;
GimpItemFactoryUpdateFunc update_func;
gboolean update_on_popup;
......@@ -69,6 +70,7 @@ GimpMenuFactory * gimp_menu_factory_new (Gimp *gimp);
void gimp_menu_factory_menu_register (GimpMenuFactory *factory,
const gchar *identifier,
const gchar *help_id,
GimpItemFactorySetupFunc setup_func,
GimpItemFactoryUpdateFunc update_func,
gboolean update_on_popup,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment