Commit a11f3334 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

The GIMP Help System part II: press "F1" while browsing a menu to show the

1999-10-03  Michael Natterer  <mitch@gimp.org>

	The GIMP Help System part II: press "F1" while browsing a menu
	to show the help page for the menu entry you're currently over
	with the mouse.

	* app/color_notebook.c: all color selectors have to register with
	a help page now.

	* app/color_select.[ch]: register with a help string. Removed
	the dialog part of the files because it's use was deprecated
	anyway (use color notebooks instead).

	* app/colormap_dialog.i.c
	* app/colormap_dialog.p.h
	* app/palette.c
	* app/palette_select.c: use a color notebook instead of a color
	selector.

	* app/gimphelp.c
	* app/gimpui.c: minor changes.

	* app/gimprc.c: "use help" defaults to TRUE now.

	* app/lc_dialog.c
	* app/lc_dialogP.h: a special help function which shows the help
	for the currently selected notebook page.

	* app/menus.c: some weird code which catches "key_press_event"
	in all menu shells and pops up the corresp. help page for the
	selected item. Embedded the GtkItemFactoryEntry in a new
	GimpItemFactoryEntry to allow a help path to be stored.
	Will be partially exported and moved to gimphelp.[ch] later to
	catch key_press for plug-in menu items (don't try this now ;-)

	* app/app_procs.c
	* app/brush_edit.c
	* app/brush_select.c
	* app/channel_ops.c
	* app/channels_dialog.c
	* app/commands.c
	* app/convert.c
	* app/devices.c
	* app/file_new_dialog.c
	* app/fileops.c
	* app/gdisplay.c
	* app/gdisplay_color.c
	* app/gdisplay_color_ui.c
	* app/gdisplay_ops.c
	* app/global_edit.c
	* app/gradient.c
	* app/gradient_select.c
	* app/interface.c
	* app/layers_dialog.c
	* app/module_db.c
	* app/paths_dialog.c
	* app/pattern_select.c
	* app/preferences_dialog.c
	* app/qmask.c
	* app/resize.c
	* app/undo_history.c: changed all dialog constructors to point
	to the right place in the new help file structure.

	* configure.in
	* help/*: the basic new help file structure.

	* modules/colorsel_gtk.c
	* modules/colorsel_triangle.c
	* modules/colorsel_water.c: register a help page.

	* plug-ins/helpbrowser/helpbrowser.c: load the help files
	according to the new help file structure.
parent d28bd8b6
1999-10-03 Michael Natterer <mitch@gimp.org>
The GIMP Help System part II: press "F1" while browsing a menu
to show the help page for the menu entry you're currently over
with the mouse.
* app/color_notebook.c: all color selectors have to register with
a help page now.
* app/color_select.[ch]: register with a help string. Removed
the dialog part of the files because it's use was deprecated
anyway (use color notebooks instead).
* app/colormap_dialog.i.c
* app/colormap_dialog.p.h
* app/palette.c
* app/palette_select.c: use a color notebook instead of a color
selector.
* app/gimphelp.c
* app/gimpui.c: minor changes.
* app/gimprc.c: "use help" defaults to TRUE now.
* app/lc_dialog.c
* app/lc_dialogP.h: a special help function which shows the help
for the currently selected notebook page.
* app/menus.c: some weird code which catches "key_press_event"
in all menu shells and pops up the corresp. help page for the
selected item. Embedded the GtkItemFactoryEntry in a new
GimpItemFactoryEntry to allow a help path to be stored.
Will be partially exported and moved to gimphelp.[ch] later to
catch key_press for plug-in menu items (don't try this now ;-)
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/channel_ops.c
* app/channels_dialog.c
* app/commands.c
* app/convert.c
* app/devices.c
* app/file_new_dialog.c
* app/fileops.c
* app/gdisplay.c
* app/gdisplay_color.c
* app/gdisplay_color_ui.c
* app/gdisplay_ops.c
* app/global_edit.c
* app/gradient.c
* app/gradient_select.c
* app/interface.c
* app/layers_dialog.c
* app/module_db.c
* app/paths_dialog.c
* app/pattern_select.c
* app/preferences_dialog.c
* app/qmask.c
* app/resize.c
* app/undo_history.c: changed all dialog constructors to point
to the right place in the new help file structure.
* configure.in
* help/*: the basic new help file structure.
* modules/colorsel_gtk.c
* modules/colorsel_triangle.c
* modules/colorsel_water.c: register a help page.
* plug-ins/helpbrowser/helpbrowser.c: load the help files
according to the new help file structure.
1999-10-03 Tor Lillqvist <tml@iki.fi>
* app/cursorutil.h app/session.c app/text_tool.c: Change the
......
......@@ -352,7 +352,7 @@ select_border_cmd_callback (GtkWidget *widget,
qbox = gimp_query_size_box (_("Border Selection"),
gimp_standard_help_func,
"dialogs/border_selection_dialog.html",
"dialogs/border_selection.html",
_("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->gimage->unit,
......@@ -375,7 +375,7 @@ select_feather_cmd_callback (GtkWidget *widget,
qbox = gimp_query_size_box (_("Feather Selection"),
gimp_standard_help_func,
"dialogs/feather_selection_dialog.html",
"dialogs/feather_selection.html",
_("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->gimage->unit,
......@@ -398,7 +398,7 @@ select_grow_cmd_callback (GtkWidget *widget,
qbox = gimp_query_size_box (_("Grow Selection"),
gimp_standard_help_func,
"dialogs/grow_selection_dialog.html",
"dialogs/grow_selection.html",
_("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->gimage->unit,
......@@ -423,7 +423,7 @@ select_shrink_cmd_callback (GtkWidget *widget,
shrink_dialog =
gimp_query_size_box (N_("Shrink Selection"),
gimp_standard_help_func,
"dialogs/shrink_selection_dialog.html",
"dialogs/shrink_selection.html",
N_("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->gimage->unit,
......@@ -1195,7 +1195,7 @@ void
gimp_help_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
gimp_help ("");
gimp_help (NULL);
}
void
......
......@@ -248,7 +248,7 @@ edit_qmask_channel_query (GDisplay * gdisp)
options->query_box =
gimp_dialog_new (_("Edit Qmask Attributes"), "edit_qmask_attributes",
gimp_standard_help_func,
"dialogs/edit_qmask_attributes_dialog.html",
"dialogs/edit_qmask_attributes.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
......
......@@ -248,7 +248,7 @@ edit_qmask_channel_query (GDisplay * gdisp)
options->query_box =
gimp_dialog_new (_("Edit Qmask Attributes"), "edit_qmask_attributes",
gimp_standard_help_func,
"dialogs/edit_qmask_attributes_dialog.html",
"dialogs/edit_qmask_attributes.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
......
......@@ -728,7 +728,7 @@ really_quit_dialog (void)
dialog = gimp_dialog_new (_("Really Quit?"), "really_quit",
gimp_standard_help_func,
"dialogs/really_quit_dialog.html",
"dialogs/really_quit.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
......
......@@ -207,7 +207,7 @@ brush_edit_generated_new ()
begw->shell = gimp_dialog_new (_("Brush Editor"), "generated_brush_editor",
gimp_standard_help_func,
"dialogs/generated_brush_editor_dialog.html",
"dialogs/generated_brush_editor.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
......
......@@ -200,7 +200,7 @@ brush_select_new (gchar *title,
{
bsp->shell = gimp_dialog_new (title, "brush_selection",
gimp_standard_help_func,
"dialogs/brush_selection_dialog.html",
"dialogs/brush_selection.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
......@@ -218,7 +218,7 @@ brush_select_new (gchar *title,
{
bsp->shell = gimp_dialog_new (_("Brush Selection"), "brush_selection",
gimp_standard_help_func,
"dialogs/brush_selection_dialog.html",
"dialogs/brush_selection.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
......
......@@ -85,7 +85,7 @@ channel_ops_offset (GimpImage* gimage)
off_d->dlg = gimp_dialog_new (_("Offset"), "offset",
gimp_standard_help_func,
"dialogs/offset_dialog.html",
"dialogs/offset.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
......
......@@ -2391,7 +2391,7 @@ channels_dialog_new_channel_query (GimpImage* gimage)
options->query_box =
gimp_dialog_new (_("New Channel Options"), "new_channel_options",
gimp_standard_help_func,
"dialogs/channels_dialog.html",
"dialogs/channels/dialogs/new_channel.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
......@@ -2565,7 +2565,7 @@ channels_dialog_edit_channel_query (ChannelWidget *channel_widget)
options->query_box =
gimp_dialog_new (_("Edit Channel Attributes"), "edit_channel_attributes",
gimp_standard_help_func,
"dialogs/channels_dialog.html",
"dialogs/channels/dialogs/edit_channel_attributes.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
......
......@@ -37,11 +37,14 @@
static void color_notebook_ok_callback (GtkWidget *, gpointer);
static void color_notebook_cancel_callback (GtkWidget *, gpointer);
static void color_notebook_update_callback (void *, int, int, int);
static void color_notebook_page_switch (GtkWidget *, GtkNotebookPage *, guint);
static void color_notebook_page_switch (GtkWidget *, GtkNotebookPage *,
guint);
static void color_notebook_help_func (gpointer data);
/* information we keep on each registered colour selector */
typedef struct _ColorSelectorInfo {
char *name; /* label used in notebook tab */
char *help_page;
GimpColorSelectorMethods m;
int refs; /* number of instances around */
gboolean active;
......@@ -100,8 +103,7 @@ color_notebook_new (int r,
cnp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection",
gimp_standard_help_func,
"dialogs/color_notebook_dialog.html",
color_notebook_help_func, cnp,
GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE,
......@@ -134,7 +136,7 @@ color_notebook_new (int r,
if (info->active)
{
csel = g_malloc (sizeof (ColorSelectorInstance));
csel = g_new (ColorSelectorInstance, 1);
csel->color_notebook = cnp;
csel->info = info;
info->refs++;
......@@ -336,12 +338,28 @@ color_notebook_page_switch (GtkWidget *widget,
TRUE);
}
static void
color_notebook_help_func (gpointer data)
{
ColorNotebookP cnp;
gchar *help_path;
cnp = (ColorNotebookP) data;
help_path = g_strconcat ("dialogs/color_selectors/",
cnp->cur_page->info->help_page,
NULL);
gimp_help (help_path);
g_free (help_path);
}
/**************************************************************/
/* Registration functions */
G_MODULE_EXPORT
GimpColorSelectorID
gimp_color_selector_register (const char *name,
const char *help_page,
GimpColorSelectorMethods *methods)
{
ColorSelectorInfo *info;
......@@ -355,9 +373,10 @@ gimp_color_selector_register (const char *name,
info = info->next;
}
info = g_malloc (sizeof (ColorSelectorInfo));
info = g_new (ColorSelectorInfo, 1);
info->name = g_strdup (name);
info->help_page = g_strdup (help_page);
info->m = *methods;
info->refs = 0;
info->active = TRUE;
......
......@@ -45,6 +45,13 @@
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | \
GDK_BUTTON1_MOTION_MASK | GDK_ENTER_NOTIFY_MASK
typedef enum
{
COLOR_SELECT_OK,
COLOR_SELECT_CANCEL,
COLOR_SELECT_UPDATE
} ColorSelectState;
typedef enum
{
HUE = 0,
......@@ -72,6 +79,33 @@ typedef enum
UPDATE_CALLER = 1 << 6
} ColorSelectUpdateType;
typedef void (*ColorSelectCallback) (gint, gint, gint, ColorSelectState, void *);
typedef struct _ColorSelect ColorSelect, *ColorSelectP;
struct _ColorSelect
{
GtkWidget *xy_color;
GtkWidget *z_color;
GtkWidget *new_color;
GtkWidget *orig_color;
GtkWidget *toggles[6];
GtkWidget *entries[6];
GtkWidget *hex_entry;
GtkAdjustment *slider_data[6];
gint pos[3];
gint values[6];
gint z_color_fill;
gint xy_color_fill;
gint orig_values[3];
gboolean wants_updates;
GdkGC *gc;
ColorSelectCallback callback;
void *client_data;
};
typedef struct _ColorSelectFill ColorSelectFill;
typedef void (*ColorSelectFillUpdateProc) (ColorSelectFill *);
......@@ -110,8 +144,6 @@ static void color_select_update_sliders (ColorSelect *, gint);
static void color_select_update_entries (ColorSelect *, gint);
static void color_select_update_colors (ColorSelect *, gint);
static void color_select_ok_callback (GtkWidget *, gpointer);
static void color_select_cancel_callback (GtkWidget *, gpointer);
static gint color_select_xy_expose (GtkWidget *, GdkEventExpose *,
ColorSelect *);
static gint color_select_xy_events (GtkWidget *, GdkEvent *,
......@@ -180,60 +212,22 @@ static GtkTargetEntry color_select_target_table[] =
static guint n_color_select_targets = (sizeof (color_select_target_table) /
sizeof (color_select_target_table[0]));
ColorSelect *
color_select_new (gint r,
gint g,
gint b,
ColorSelectCallback callback,
gpointer data,
gboolean wants_updates)
{
ColorSelect *csp;
GtkWidget *main_vbox;
csp = g_new (ColorSelect, 1);
csp->callback = callback;
csp->client_data = data;
csp->z_color_fill = HUE;
csp->xy_color_fill = SATURATION_VALUE;
csp->gc = NULL;
csp->wants_updates = wants_updates;
csp->values[RED] = csp->orig_values[0] = r;
csp->values[GREEN] = csp->orig_values[1] = g;
csp->values[BLUE] = csp->orig_values[2] = b;
color_select_update_hsv_values (csp);
color_select_update_pos (csp);
csp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection",
gimp_standard_help_func,
"dialogs/color_selection_dialog.html",
GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE,
wants_updates ? _("Close") : _("OK"),
color_select_ok_callback,
csp, NULL, TRUE, FALSE,
wants_updates ? _("Revert to Old Color") : _("Cancel"),
color_select_cancel_callback,
csp, NULL, FALSE, TRUE,
NULL);
main_vbox = color_select_widget_new (csp, r, g, b);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (csp->shell)->vbox), main_vbox);
gtk_widget_show (main_vbox);
color_select_image_fill (csp->z_color, csp->z_color_fill, csp->values);
color_select_image_fill (csp->xy_color, csp->xy_color_fill, csp->values);
gtk_widget_show (csp->shell);
/* Register the GIMP colour selector with the color notebook */
void
color_select_init (void)
{
GimpColorSelectorMethods methods =
{
color_select_notebook_new,
color_select_notebook_free,
color_select_notebook_setcolor
};
return csp;
gimp_color_selector_register ("GIMP", "built_in.html", &methods);
}
static GtkWidget *
color_select_widget_new (ColorSelect *csp,
gint r,
......@@ -504,47 +498,7 @@ color_select_drag_old_color (GtkWidget *widget,
*b = (guchar) csp->orig_values[2];
}
/* Register the GIMP colour selector with the color notebook */
void
color_select_init (void)
{
GimpColorSelectorMethods methods =
{
color_select_notebook_new,
color_select_notebook_free,
color_select_notebook_setcolor
};
gimp_color_selector_register ("GIMP", &methods);
}
void
color_select_show (ColorSelect *csp)
{
if (csp)
gtk_widget_show (csp->shell);
}
void
color_select_hide (ColorSelect *csp)
{
if (csp)
gtk_widget_hide (csp->shell);
}
void
color_select_free (ColorSelect *csp)
{
if (csp)
{
if (csp->shell)
gtk_widget_destroy (csp->shell);
gdk_gc_destroy (csp->gc);
g_free (csp);
}
}
void
static void
color_select_set_color (ColorSelect *csp,
gint r,
gint g,
......@@ -963,42 +917,6 @@ color_select_update_colors (ColorSelect *csp,
}
}
static void
color_select_ok_callback (GtkWidget *widget,
gpointer data)
{
ColorSelect *csp;
csp = (ColorSelect *) data;
if (csp)
{
if (csp->callback)
(* csp->callback) (csp->values[RED],
csp->values[GREEN],
csp->values[BLUE],
COLOR_SELECT_OK,
csp->client_data);
}
}
static void
color_select_cancel_callback (GtkWidget *widget,
gpointer data)
{
ColorSelect *csp;
csp = (ColorSelect *) data;
if (csp)
{
if (csp->callback)
(* csp->callback) (csp->orig_values[0],
csp->orig_values[1],
csp->orig_values[2],
COLOR_SELECT_CANCEL,
csp->client_data);
}
}
static gint
color_select_xy_expose (GtkWidget *widget,
GdkEventExpose *event,
......@@ -2176,9 +2094,6 @@ color_select_notebook_new (gint r,
glue->main_vbox = color_select_widget_new (csp, r, g, b);
/* the shell is provided by the notebook */
csp->shell = NULL;
color_select_image_fill (csp->z_color, csp->z_color_fill, csp->values);
color_select_image_fill (csp->xy_color, csp->xy_color_fill, csp->values);
......@@ -2186,13 +2101,13 @@ color_select_notebook_new (gint r,
return glue->main_vbox;
}
static void
color_select_notebook_free (void *data)
{
notebook_glue *glue = data;
color_select_free (glue->csp);
gdk_gc_destroy (glue->csp->gc);
g_free (glue->csp);
/* don't need to destroy the widget, since it's done by the caller
* of this function */
g_free (glue);
......
......@@ -18,53 +18,6 @@
#ifndef __COLOR_SELECT_H__
#define __COLOR_SELECT_H__
typedef enum
{
COLOR_SELECT_OK,
COLOR_SELECT_CANCEL,
COLOR_SELECT_UPDATE
} ColorSelectState;
typedef void (*ColorSelectCallback) (gint, gint, gint, ColorSelectState, void *);
typedef struct _ColorSelect ColorSelect, *ColorSelectP;
struct _ColorSelect
{
GtkWidget *shell;
GtkWidget *xy_color;
GtkWidget *z_color;
GtkWidget *new_color;
GtkWidget *orig_color;
GtkWidget *toggles[6];
GtkWidget *entries[6];
GtkWidget *hex_entry;
GtkAdjustment *slider_data[6];
gint pos[3];
gint values[6];
gint z_color_fill;
gint xy_color_fill;
gint orig_values[3];
gboolean wants_updates;
GdkGC *gc;
ColorSelectCallback callback;
void *client_data;
};
void color_select_init (void);
ColorSelectP color_select_new (gint r,
gint g,
gint b,
ColorSelectCallback callback,
gpointer client_data,
gboolean wants_update);
void color_select_show (ColorSelectP);
void color_select_hide (ColorSelectP);
void color_select_free (ColorSelectP);
void color_select_set_color (ColorSelectP,
gint, gint, gint, gint);
#endif /* __COLOR_SELECT_H__ */
......@@ -5,7 +5,7 @@
#include "gdk/gdkkeysyms.h"