From 62b5c77c76938c570f1163e2fa35da1e790e2060 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Mon, 4 Oct 2004 16:21:52 +0000 Subject: [PATCH] app/config/gimpguiconfig.[ch] added gimprc option "show-help-button". 2004-10-04 Sven Neumann * app/config/gimpguiconfig.[ch] * app/config/gimprc-blurbs.h: added gimprc option "show-help-button". * app/dialogs/preferences-dialog.c: added a GUI for it. * app/dialogs/file-save-dialog.c * app/dialogs/image-new-dialog.c * app/dialogs/quit-dialog.c * app/display/gimpdisplayshell-close.c * app/widgets/gimphelp-ids.h: don't set help-ids on confirmation dialogs. * libgimpbase/gimpprotocol.[ch] * libgimp/gimp.[ch]: added boolean "show_help_button" to the config message. * app/plug-in/plug-in-run.c: pass the new preference to the plug-in. * libgimpwidgets/gimpdialog.[ch]: added new function that allows to set whether new dialogs should get a help button added. * app/gui/gui.c * libgimp/gimpui.c: call gimp_dialogs_show_help_button() according to the gimprc settings. --- ChangeLog | 27 +++++++++ app/config/gimpguiconfig.c | 11 ++++ app/config/gimpguiconfig.h | 1 + app/config/gimprc-blurbs.h | 5 ++ app/dialogs/file-save-dialog.c | 3 +- app/dialogs/image-new-dialog.c | 6 +- app/dialogs/preferences-dialog.c | 3 + app/dialogs/quit-dialog.c | 3 +- app/display/gimpdisplayshell-close.c | 3 +- app/gui/gui.c | 26 +++++++++ app/plug-in/gimppluginmanager-call.c | 49 ++++++++-------- app/plug-in/gimppluginmanager-run.c | 49 ++++++++-------- app/plug-in/plug-in-run.c | 49 ++++++++-------- app/widgets/gimphelp-ids.h | 4 -- devel-docs/libgimp/libgimp-sections.txt | 2 + devel-docs/libgimp/tmpl/gimp.sgml | 8 +++ devel-docs/libgimp/tmpl/gimpcolor.sgml | 12 ++++ devel-docs/libgimpbase/tmpl/gimpprotocol.sgml | 2 +- .../libgimpwidgets-sections.txt | 1 + .../libgimpwidgets/tmpl/gimpdialog.sgml | 8 +++ libgimp/gimp.c | 50 ++++++++++------ libgimp/gimp.def | 1 + libgimp/gimp.h | 1 + libgimp/gimpui.c | 2 + libgimpbase/gimpprotocol.c | 4 +- libgimpbase/gimpprotocol.h | 8 +-- libgimpwidgets/gimpdialog.c | 57 ++++++++++++++++++- libgimpwidgets/gimpdialog.h | 3 + libgimpwidgets/gimpwidgets.def | 1 + 29 files changed, 290 insertions(+), 109 deletions(-) diff --git a/ChangeLog b/ChangeLog index a35300423e..fc1ef431a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2004-10-04 Sven Neumann + + * app/config/gimpguiconfig.[ch] + * app/config/gimprc-blurbs.h: added gimprc option "show-help-button". + + * app/dialogs/preferences-dialog.c: added a GUI for it. + + * app/dialogs/file-save-dialog.c + * app/dialogs/image-new-dialog.c + * app/dialogs/quit-dialog.c + * app/display/gimpdisplayshell-close.c + * app/widgets/gimphelp-ids.h: don't set help-ids on confirmation + dialogs. + + * libgimpbase/gimpprotocol.[ch] + * libgimp/gimp.[ch]: added boolean "show_help_button" to the + config message. + + * app/plug-in/plug-in-run.c: pass the new preference to the plug-in. + + * libgimpwidgets/gimpdialog.[ch]: added new function that allows to + set whether new dialogs should get a help button added. + + * app/gui/gui.c + * libgimp/gimpui.c: call gimp_dialogs_show_help_button() according + to the gimprc settings. + 2004-10-04 Sven Neumann * plug-ins/script-fu/script-fu-interface.c (script_fu_about): set diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c index 8aad128d34..9cac0df358 100644 --- a/app/config/gimpguiconfig.c +++ b/app/config/gimpguiconfig.c @@ -83,6 +83,7 @@ enum PROP_THEME_PATH, PROP_THEME, PROP_USE_HELP, + PROP_SHOW_HELP_BUTTON, PROP_HELP_LOCALES, PROP_HELP_BROWSER, PROP_WEB_BROWSER, @@ -228,6 +229,10 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass) "use-help", USE_HELP_BLURB, TRUE, 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_HELP_BUTTON, + "show-help-button", SHOW_HELP_BUTTON_BLURB, + TRUE, + 0); GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_HELP_LOCALES, "help-locales", HELP_LOCALES_BLURB, "", @@ -349,6 +354,9 @@ gimp_gui_config_set_property (GObject *object, case PROP_USE_HELP: gui_config->use_help = g_value_get_boolean (value); break; + case PROP_SHOW_HELP_BUTTON: + gui_config->show_help_button = g_value_get_boolean (value); + break; case PROP_HELP_LOCALES: g_free (gui_config->help_locales); gui_config->help_locales = g_value_dup_string (value); @@ -449,6 +457,9 @@ gimp_gui_config_get_property (GObject *object, case PROP_USE_HELP: g_value_set_boolean (value, gui_config->use_help); break; + case PROP_SHOW_HELP_BUTTON: + g_value_set_boolean (value, gui_config->show_help_button); + break; case PROP_HELP_LOCALES: g_value_set_string (value, gui_config->help_locales); break; diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h index d10c6ff0e2..5d29890d70 100644 --- a/app/config/gimpguiconfig.h +++ b/app/config/gimpguiconfig.h @@ -61,6 +61,7 @@ struct _GimpGuiConfig gchar *theme_path; gchar *theme; gboolean use_help; + gboolean show_help_button; gchar *help_locales; GimpHelpBrowserType help_browser; gchar *web_browser; diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h index 8d000458db..e47fcff2aa 100644 --- a/app/config/gimprc-blurbs.h +++ b/app/config/gimprc-blurbs.h @@ -270,6 +270,11 @@ N_("Save the positions and sizes of the main dialogs when the GIMP exits.") N_("When enabled, all paint tools will show a preview of the current " \ "brush's outline.") +#define SHOW_HELP_BUTTON_BLURB \ +N_("When enabled, dialogs will show a help button that gives access to " \ + "the related help page. Without this button, the help page can still " \ + "be reached by pressing F1.") + #define SHOW_PAINT_TOOL_CURSOR_BLURB \ N_("When enabled, the cursor will be shown over the image while " \ "using a paint tool.") diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c index 1536a7efbd..5c481009f6 100644 --- a/app/dialogs/file-save-dialog.c +++ b/app/dialogs/file-save-dialog.c @@ -167,8 +167,7 @@ file_save_overwrite (GtkWidget *save_dialog, query_box = gimp_query_boolean_box (_("File exists!"), save_dialog, - gimp_standard_help_func, - GIMP_HELP_FILE_SAVE_OVERWRITE, + gimp_standard_help_func, NULL, GIMP_STOCK_QUESTION, message, _("Replace"), GTK_STOCK_CANCEL, diff --git a/app/dialogs/image-new-dialog.c b/app/dialogs/image-new-dialog.c index eab373ab11..02241bc4eb 100644 --- a/app/dialogs/image-new-dialog.c +++ b/app/dialogs/image-new-dialog.c @@ -93,8 +93,7 @@ image_new_dialog_new (Gimp *gimp) dialog->dialog = gimp_dialog_new (_("Create a New Image"), "gimp-image-new", NULL, 0, - gimp_standard_help_func, - GIMP_HELP_FILE_NEW, + gimp_standard_help_func, GIMP_HELP_FILE_NEW, GIMP_STOCK_RESET, RESPONSE_RESET, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, @@ -273,8 +272,7 @@ image_new_confirm_dialog (ImageNewDialog *dialog) dialog->confirm_dialog = gimp_query_boolean_box (_("Confirm Image Size"), dialog->dialog, - gimp_standard_help_func, - GIMP_HELP_FILE_NEW_CONFIRM, + gimp_standard_help_func, NULL, GIMP_STOCK_INFO, text, GTK_STOCK_OK, GTK_STOCK_CANCEL, diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index 809af59581..3de30f66d4 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -1500,6 +1500,9 @@ prefs_dialog_new (Gimp *gimp, prefs_check_button_add (object, "show-tool-tips", _("Show tool _tips"), GTK_BOX (vbox2)); + prefs_check_button_add (object, "show-help-button", + _("Show help _buttons"), + GTK_BOX (vbox2)); prefs_check_button_add (object, "show-tips", _("Show tips on _startup"), GTK_BOX (vbox2)); diff --git a/app/dialogs/quit-dialog.c b/app/dialogs/quit-dialog.c index 8450505d31..b6341a3b72 100644 --- a/app/dialogs/quit-dialog.c +++ b/app/dialogs/quit-dialog.c @@ -73,8 +73,7 @@ quit_dialog_new (Gimp *gimp) dialog = gimp_dialog_new (_("Quit The GIMP"), "gimp-quit", NULL, 0, - gimp_standard_help_func, - GIMP_HELP_FILE_QUIT_CONFIRM, + gimp_standard_help_func, NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("_Discard Changes"), GTK_RESPONSE_OK, diff --git a/app/display/gimpdisplayshell-close.c b/app/display/gimpdisplayshell-close.c index 5db3785e2f..e6c8826a3e 100644 --- a/app/display/gimpdisplayshell-close.c +++ b/app/display/gimpdisplayshell-close.c @@ -118,8 +118,7 @@ gimp_display_shell_close_dialog (GimpDisplayShell *shell, dialog = gimp_dialog_new (title, "gimp-display-shell-close", GTK_WIDGET (shell), 0, - gimp_standard_help_func, - GIMP_HELP_FILE_CLOSE_CONFIRM, + gimp_standard_help_func, NULL, _("Close _without Saving"), GTK_RESPONSE_CLOSE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, diff --git a/app/gui/gui.c b/app/gui/gui.c index df9878514e..028987f210 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -99,6 +99,9 @@ static gboolean gui_exit_after_callback (Gimp *gimp, static void gui_show_tooltips_notify (GimpGuiConfig *gui_config, GParamSpec *pspec, Gimp *gimp); +static void gui_show_help_button_notify (GimpGuiConfig *gui_config, + GParamSpec *pspec, + Gimp *gimp); static void gui_tearoff_menus_notify (GimpGuiConfig *gui_config, GParamSpec *pspec, GtkUIManager *manager); @@ -362,6 +365,16 @@ gui_restore_callback (Gimp *gimp, G_CALLBACK (gui_show_tooltips_notify), gimp); + gimp_dialogs_show_help_button (gui_config->use_help && + gui_config->show_help_button); + + g_signal_connect (gui_config, "notify::use-help", + G_CALLBACK (gui_show_help_button_notify), + gimp); + g_signal_connect (gui_config, "notify::show-help-button", + G_CALLBACK (gui_show_help_button_notify), + gimp); + g_signal_connect (gimp_get_user_context (gimp), "display_changed", G_CALLBACK (gui_display_changed), gimp); @@ -483,6 +496,10 @@ gui_exit_after_callback (Gimp *gimp, if (gimp->be_verbose) g_print ("EXIT: gui_exit_after_callback\n"); + g_signal_handlers_disconnect_by_func (gimp->config, + gui_show_help_button_notify, + gimp); + g_signal_handlers_disconnect_by_func (gimp->config, gui_show_tooltips_notify, gimp); @@ -521,6 +538,15 @@ gui_show_tooltips_notify (GimpGuiConfig *gui_config, gimp_help_disable_tooltips (); } +static void +gui_show_help_button_notify (GimpGuiConfig *gui_config, + GParamSpec *param_spec, + Gimp *gimp) +{ + gimp_dialogs_show_help_button (gui_config->use_help && + gui_config->show_help_button); +} + static void gui_tearoff_menus_notify (GimpGuiConfig *gui_config, GParamSpec *pspec, diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index a6d7dff994..0ec226f77d 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -93,9 +93,11 @@ plug_in_run (Gimp *gimp, if (plug_in) { - GPConfig config; - GPProcRun proc_run; - gint monitor; + GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (gimp->config); + GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config); + GPConfig config; + GPProcRun proc_run; + gint monitor; if (! plug_in_open (plug_in)) { @@ -103,26 +105,27 @@ plug_in_run (Gimp *gimp, goto done; } - config.version = GIMP_PROTOCOL_VERSION; - config.tile_width = TILE_WIDTH; - config.tile_height = TILE_HEIGHT; - config.shm_ID = plug_in_shm_get_ID (gimp); - config.check_size = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_size; - config.check_type = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_type; - config.gimp_reserved_3 = 0; - config.gimp_reserved_4 = 0; - config.gimp_reserved_5 = 0; - config.gimp_reserved_6 = 0; - config.gimp_reserved_7 = 0; - config.gimp_reserved_8 = 0; - config.install_cmap = gimp->config->install_cmap; - config.show_tool_tips = GIMP_GUI_CONFIG (gimp->config)->show_tool_tips; - config.min_colors = CLAMP (gimp->config->min_colors, 27, 256); - config.gdisp_ID = gdisp_ID; - config.app_name = (gchar *) g_get_application_name (); - config.wm_class = (gchar *) gimp_get_program_class (gimp); - config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor); - config.monitor_number = monitor; + config.version = GIMP_PROTOCOL_VERSION; + config.tile_width = TILE_WIDTH; + config.tile_height = TILE_HEIGHT; + config.shm_ID = plug_in_shm_get_ID (gimp); + config.check_size = display_config->transparency_size; + config.check_type = display_config->transparency_type; + config.show_help_button = (gui_config->use_help && + gui_config->show_help_button); + config.gimp_reserved_4 = 0; + config.gimp_reserved_5 = 0; + config.gimp_reserved_6 = 0; + config.gimp_reserved_7 = 0; + config.gimp_reserved_8 = 0; + config.install_cmap = gimp->config->install_cmap; + config.show_tool_tips = gui_config->show_tool_tips; + config.min_colors = CLAMP (gimp->config->min_colors, 27, 256); + config.gdisp_ID = gdisp_ID; + config.app_name = (gchar *) g_get_application_name (); + config.wm_class = (gchar *) gimp_get_program_class (gimp); + config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor); + config.monitor_number = monitor; proc_run.name = proc_rec->name; proc_run.nparams = argc; diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index a6d7dff994..0ec226f77d 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -93,9 +93,11 @@ plug_in_run (Gimp *gimp, if (plug_in) { - GPConfig config; - GPProcRun proc_run; - gint monitor; + GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (gimp->config); + GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config); + GPConfig config; + GPProcRun proc_run; + gint monitor; if (! plug_in_open (plug_in)) { @@ -103,26 +105,27 @@ plug_in_run (Gimp *gimp, goto done; } - config.version = GIMP_PROTOCOL_VERSION; - config.tile_width = TILE_WIDTH; - config.tile_height = TILE_HEIGHT; - config.shm_ID = plug_in_shm_get_ID (gimp); - config.check_size = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_size; - config.check_type = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_type; - config.gimp_reserved_3 = 0; - config.gimp_reserved_4 = 0; - config.gimp_reserved_5 = 0; - config.gimp_reserved_6 = 0; - config.gimp_reserved_7 = 0; - config.gimp_reserved_8 = 0; - config.install_cmap = gimp->config->install_cmap; - config.show_tool_tips = GIMP_GUI_CONFIG (gimp->config)->show_tool_tips; - config.min_colors = CLAMP (gimp->config->min_colors, 27, 256); - config.gdisp_ID = gdisp_ID; - config.app_name = (gchar *) g_get_application_name (); - config.wm_class = (gchar *) gimp_get_program_class (gimp); - config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor); - config.monitor_number = monitor; + config.version = GIMP_PROTOCOL_VERSION; + config.tile_width = TILE_WIDTH; + config.tile_height = TILE_HEIGHT; + config.shm_ID = plug_in_shm_get_ID (gimp); + config.check_size = display_config->transparency_size; + config.check_type = display_config->transparency_type; + config.show_help_button = (gui_config->use_help && + gui_config->show_help_button); + config.gimp_reserved_4 = 0; + config.gimp_reserved_5 = 0; + config.gimp_reserved_6 = 0; + config.gimp_reserved_7 = 0; + config.gimp_reserved_8 = 0; + config.install_cmap = gimp->config->install_cmap; + config.show_tool_tips = gui_config->show_tool_tips; + config.min_colors = CLAMP (gimp->config->min_colors, 27, 256); + config.gdisp_ID = gdisp_ID; + config.app_name = (gchar *) g_get_application_name (); + config.wm_class = (gchar *) gimp_get_program_class (gimp); + config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor); + config.monitor_number = monitor; proc_run.name = proc_rec->name; proc_run.nparams = argc; diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index a6d7dff994..0ec226f77d 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -93,9 +93,11 @@ plug_in_run (Gimp *gimp, if (plug_in) { - GPConfig config; - GPProcRun proc_run; - gint monitor; + GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (gimp->config); + GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config); + GPConfig config; + GPProcRun proc_run; + gint monitor; if (! plug_in_open (plug_in)) { @@ -103,26 +105,27 @@ plug_in_run (Gimp *gimp, goto done; } - config.version = GIMP_PROTOCOL_VERSION; - config.tile_width = TILE_WIDTH; - config.tile_height = TILE_HEIGHT; - config.shm_ID = plug_in_shm_get_ID (gimp); - config.check_size = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_size; - config.check_type = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_type; - config.gimp_reserved_3 = 0; - config.gimp_reserved_4 = 0; - config.gimp_reserved_5 = 0; - config.gimp_reserved_6 = 0; - config.gimp_reserved_7 = 0; - config.gimp_reserved_8 = 0; - config.install_cmap = gimp->config->install_cmap; - config.show_tool_tips = GIMP_GUI_CONFIG (gimp->config)->show_tool_tips; - config.min_colors = CLAMP (gimp->config->min_colors, 27, 256); - config.gdisp_ID = gdisp_ID; - config.app_name = (gchar *) g_get_application_name (); - config.wm_class = (gchar *) gimp_get_program_class (gimp); - config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor); - config.monitor_number = monitor; + config.version = GIMP_PROTOCOL_VERSION; + config.tile_width = TILE_WIDTH; + config.tile_height = TILE_HEIGHT; + config.shm_ID = plug_in_shm_get_ID (gimp); + config.check_size = display_config->transparency_size; + config.check_type = display_config->transparency_type; + config.show_help_button = (gui_config->use_help && + gui_config->show_help_button); + config.gimp_reserved_4 = 0; + config.gimp_reserved_5 = 0; + config.gimp_reserved_6 = 0; + config.gimp_reserved_7 = 0; + config.gimp_reserved_8 = 0; + config.install_cmap = gimp->config->install_cmap; + config.show_tool_tips = gui_config->show_tool_tips; + config.min_colors = CLAMP (gimp->config->min_colors, 27, 256); + config.gdisp_ID = gdisp_ID; + config.app_name = (gchar *) g_get_application_name (); + config.wm_class = (gchar *) gimp_get_program_class (gimp); + config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor); + config.monitor_number = monitor; proc_run.name = proc_rec->name; proc_run.nparams = argc; diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h index 3a4ceef6b4..e39493480a 100644 --- a/app/widgets/gimphelp-ids.h +++ b/app/widgets/gimphelp-ids.h @@ -26,7 +26,6 @@ #define GIMP_HELP_MAIN "gimp-main" #define GIMP_HELP_FILE_NEW "gimp-file-new" -#define GIMP_HELP_FILE_NEW_CONFIRM "gimp-file-new-confirm" #define GIMP_HELP_FILE_OPEN "gimp-file-open" #define GIMP_HELP_FILE_OPEN_AS_LAYER "gimp-file-open-as-layer" #define GIMP_HELP_FILE_OPEN_LOCATION "gimp-file-open-location" @@ -37,12 +36,9 @@ #define GIMP_HELP_FILE_SAVE_A_COPY "gimp-file-save-a-copy" #define GIMP_HELP_FILE_SAVE_AS_TEMPLATE "gimp-file-save-as-template" #define GIMP_HELP_FILE_SAVE_BY_EXTENSION "gimp-file-save-by-extension" -#define GIMP_HELP_FILE_SAVE_OVERWRITE "gimp-file-save-overwrite" #define GIMP_HELP_FILE_REVERT "gimp-file-revert" #define GIMP_HELP_FILE_CLOSE "gimp-file-close" -#define GIMP_HELP_FILE_CLOSE_CONFIRM "gimp-file-close-confirm" #define GIMP_HELP_FILE_QUIT "gimp-file-quit" -#define GIMP_HELP_FILE_QUIT_CONFIRM "gimp-file-quit-confirm" #define GIMP_HELP_EDIT_UNDO "gimp-edit-undo" #define GIMP_HELP_EDIT_REDO "gimp-edit-redo" diff --git a/devel-docs/libgimp/libgimp-sections.txt b/devel-docs/libgimp/libgimp-sections.txt index 355add9ce3..43c1c46ce1 100644 --- a/devel-docs/libgimp/libgimp-sections.txt +++ b/devel-docs/libgimp/libgimp-sections.txt @@ -35,6 +35,7 @@ gimp_gamma gimp_install_cmap gimp_min_colors gimp_show_tool_tips +gimp_show_help_button gimp_check_size gimp_check_type gimp_default_display @@ -159,6 +160,7 @@ gimp_invert gimp_curves_spline gimp_curves_explicit gimp_color_balance +gimp_colorize gimp_histogram gimp_hue_saturation gimp_threshold diff --git a/devel-docs/libgimp/tmpl/gimp.sgml b/devel-docs/libgimp/tmpl/gimp.sgml index aa780df8f3..f9217f0b24 100644 --- a/devel-docs/libgimp/tmpl/gimp.sgml +++ b/devel-docs/libgimp/tmpl/gimp.sgml @@ -327,6 +327,14 @@ all other GIMP Library headers. @Returns: + + + + + +@Returns: + + diff --git a/devel-docs/libgimp/tmpl/gimpcolor.sgml b/devel-docs/libgimp/tmpl/gimpcolor.sgml index 8bc20c98e0..16940058c3 100644 --- a/devel-docs/libgimp/tmpl/gimpcolor.sgml +++ b/devel-docs/libgimp/tmpl/gimpcolor.sgml @@ -126,6 +126,18 @@ Functions for manipulating color, including curves and histograms. @Returns: + + + + + +@drawable_ID: +@hue: +@saturation: +@lightness: +@Returns: + + diff --git a/devel-docs/libgimpbase/tmpl/gimpprotocol.sgml b/devel-docs/libgimpbase/tmpl/gimpprotocol.sgml index fc50ea8f52..191c7a5226 100644 --- a/devel-docs/libgimpbase/tmpl/gimpprotocol.sgml +++ b/devel-docs/libgimpbase/tmpl/gimpprotocol.sgml @@ -33,7 +33,7 @@ The communication protocol between GIMP and it's plug-ins. @shm_ID: @check_size: @check_type: -@gimp_reserved_3: +@show_help_button: @gimp_reserved_4: @gimp_reserved_5: @gimp_reserved_6: diff --git a/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt b/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt index 54e3969e76..af763e4f8a 100644 --- a/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt +++ b/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt @@ -384,6 +384,7 @@ gimp_dialog_new gimp_dialog_new_valist gimp_dialog_add_buttons_valist gimp_dialog_run +gimp_dialogs_show_help_button GIMP_TYPE_DIALOG GIMP_DIALOG diff --git a/devel-docs/libgimpwidgets/tmpl/gimpdialog.sgml b/devel-docs/libgimpwidgets/tmpl/gimpdialog.sgml index 3221711c30..6b64a93569 100644 --- a/devel-docs/libgimpwidgets/tmpl/gimpdialog.sgml +++ b/devel-docs/libgimpwidgets/tmpl/gimpdialog.sgml @@ -79,3 +79,11 @@ dialog-related stuff. @Returns: + + + + + +@show: + + diff --git a/libgimp/gimp.c b/libgimp/gimp.c index 58f8f1789f..d53e6b3b23 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -176,6 +176,7 @@ static guchar *_shm_addr = NULL; static gdouble _gamma_val = 1.0; static gboolean _install_cmap = FALSE; static gboolean _show_tool_tips = TRUE; +static gboolean _show_help_button = TRUE; static GimpCheckSize _check_size = GIMP_CHECK_SIZE_MEDIUM_CHECKS; static GimpCheckType _check_type = GIMP_CHECK_TYPE_GRAY_CHECKS; static gint _min_colors = 144; @@ -185,14 +186,14 @@ static gchar *_display_name = NULL; static gint _monitor_number = 0; static const gchar *progname = NULL; -static guint8 write_buffer[WRITE_BUFFER_SIZE]; -static guint write_buffer_index = 0; +static guint8 write_buffer[WRITE_BUFFER_SIZE]; +static guint write_buffer_index = 0; static GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_NEVER; -static GHashTable *temp_proc_ht = NULL; +static GHashTable *temp_proc_ht = NULL; -static guint gimp_debug_flags = 0; +static guint gimp_debug_flags = 0; static const GDebugKey gimp_debug_keys[] = { @@ -1113,6 +1114,22 @@ gimp_show_tool_tips (void) return _show_tool_tips; } +/** + * gimp_show_help_button: + * + * Returns whether or not GimpDialog should automatically add a help + * button if help_func and help_id are given. + * + * Return value: the show_help_button boolean + * + * Since: GIMP 2.2 + **/ +gboolean +gimp_show_help_button (void) +{ + return _show_help_button; +} + /** * gimp_check_size: * @@ -1634,18 +1651,19 @@ gimp_config (GPConfig *config) gimp_quit (); } - _tile_width = config->tile_width; - _tile_height = config->tile_height; - _shm_ID = config->shm_ID; - _check_size = config->check_size; - _check_type = config->check_type; - _install_cmap = config->install_cmap; - _show_tool_tips = config->show_tool_tips; - _min_colors = config->min_colors; - _gdisp_ID = config->gdisp_ID; - _wm_class = g_strdup (config->wm_class); - _display_name = g_strdup (config->display_name); - _monitor_number = config->monitor_number; + _tile_width = config->tile_width; + _tile_height = config->tile_height; + _shm_ID = config->shm_ID; + _check_size = config->check_size; + _check_type = config->check_type; + _install_cmap = config->install_cmap; + _show_tool_tips = config->show_tool_tips; + _show_help_button = config->show_help_button; + _min_colors = config->min_colors; + _gdisp_ID = config->gdisp_ID; + _wm_class = g_strdup (config->wm_class); + _display_name = g_strdup (config->display_name); + _monitor_number = config->monitor_number; if (config->app_name) g_set_application_name (config->app_name); diff --git a/libgimp/gimp.def b/libgimp/gimp.def index 19a94547e6..d6800df712 100644 --- a/libgimp/gimp.def +++ b/libgimp/gimp.def @@ -461,6 +461,7 @@ EXPORTS gimp_shear gimp_shm_ID gimp_shm_addr + gimp_show_help_button gimp_show_tool_tips gimp_smudge gimp_smudge_default diff --git a/libgimp/gimp.h b/libgimp/gimp.h index ff21b12b93..93f6c03249 100644 --- a/libgimp/gimp.h +++ b/libgimp/gimp.h @@ -315,6 +315,7 @@ gdouble gimp_gamma (void) G_GNUC_CONST; gboolean gimp_install_cmap (void) G_GNUC_CONST; gint gimp_min_colors (void) G_GNUC_CONST; gboolean gimp_show_tool_tips (void) G_GNUC_CONST; +gboolean gimp_show_help_button (void) G_GNUC_CONST; GimpCheckSize gimp_check_size (void) G_GNUC_CONST; GimpCheckType gimp_check_type (void) G_GNUC_CONST; gint32 gimp_default_display (void) G_GNUC_CONST; diff --git a/libgimp/gimpui.c b/libgimp/gimpui.c index 3db101feb7..8cf728d0c2 100644 --- a/libgimp/gimpui.c +++ b/libgimp/gimpui.c @@ -114,6 +114,8 @@ gimp_ui_init (const gchar *prog_name, if (! gimp_show_tool_tips ()) gimp_help_disable_tooltips (); + gimp_dialogs_show_help_button (gimp_show_help_button ()); + initialized = TRUE; } diff --git a/libgimpbase/gimpprotocol.c b/libgimpbase/gimpprotocol.c index 6db2c0568d..eba464283d 100644 --- a/libgimpbase/gimpprotocol.c +++ b/libgimpbase/gimpprotocol.c @@ -472,7 +472,7 @@ _gp_config_read (GIOChannel *channel, (guint8 *) &config->check_type, 1, user_data)) goto cleanup; if (! wire_read_int8 (channel, - (guint8 *) &config->gimp_reserved_3, 1, user_data)) + (guint8 *) &config->show_help_button, 1, user_data)) goto cleanup; if (! wire_read_int8 (channel, (guint8 *) &config->gimp_reserved_4, 1, user_data)) @@ -545,7 +545,7 @@ _gp_config_write (GIOChannel *channel, return; if (! wire_write_int8 (channel, (guint8*) &config->check_type, 1, user_data)) return; - if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_3, 1, user_data)) + if (! wire_write_int8 (channel, (guint8*) &config->show_help_button, 1, user_data)) return; if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_4, 1, user_data)) return; diff --git a/libgimpbase/gimpprotocol.h b/libgimpbase/gimpprotocol.h index b1cb70610b..662f64899c 100644 --- a/libgimpbase/gimpprotocol.h +++ b/libgimpbase/gimpprotocol.h @@ -68,7 +68,7 @@ struct _GPConfig gint32 shm_ID; gint8 check_size; gint8 check_type; - gint8 gimp_reserved_3; + gint8 show_help_button; gint8 gimp_reserved_4; gint8 gimp_reserved_5; gint8 gimp_reserved_6; @@ -86,9 +86,9 @@ struct _GPConfig struct _GPTileReq { - gint32 drawable_ID; - guint32 tile_num; - guint32 shadow; + gint32 drawable_ID; + guint32 tile_num; + guint32 shadow; }; struct _GPTileData diff --git a/libgimpwidgets/gimpdialog.c b/libgimpwidgets/gimpdialog.c index 3a65710317..ca05b5771c 100644 --- a/libgimpwidgets/gimpdialog.c +++ b/libgimpwidgets/gimpdialog.c @@ -56,9 +56,11 @@ static void gimp_dialog_get_property (GObject *object, static gboolean gimp_dialog_delete_event (GtkWidget *widget, GdkEventAny *event); static void gimp_dialog_close (GtkDialog *dialog); +static void gimp_dialog_help (GObject *dialog); -static GtkDialogClass *parent_class = NULL; +static GtkDialogClass *parent_class = NULL; +static gboolean show_help_button = TRUE; GType @@ -145,6 +147,23 @@ gimp_dialog_constructor (GType type, if (help_func) gimp_help_connect (GTK_WIDGET (object), help_func, help_id, object); + if (show_help_button && help_func && help_id) + { + GtkDialog *dialog = GTK_DIALOG (object); + GtkWidget *button = gtk_button_new_from_stock (GTK_STOCK_HELP); + + gtk_box_pack_end (GTK_BOX (dialog->action_area), button, FALSE, TRUE, 0); + gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (dialog->action_area), + button, TRUE); + gtk_widget_show (button); + + g_signal_connect_object (button, "clicked", + G_CALLBACK (gimp_dialog_help), + dialog, G_CONNECT_SWAPPED); + + g_object_set_data (object, "gimp-dialog-help-button", button); + } + return object; } @@ -227,6 +246,15 @@ gimp_dialog_close (GtkDialog *dialog) } } +static void +gimp_dialog_help (GObject *dialog) +{ + GimpHelpFunc help_func = g_object_get_data (dialog, "gimp-dialog-help-func"); + + if (help_func) + help_func (g_object_get_data (dialog, "gimp-dialog-help-id"), dialog); +} + /** * gimp_dialog_new: @@ -367,13 +395,22 @@ gimp_dialog_add_buttons_valist (GimpDialog *dialog, { response_id = va_arg (args, gint); - gtk_dialog_add_button (GTK_DIALOG (dialog), button_text, response_id); + /* suppress a help button if we added one already */ + if ((response_id != GTK_RESPONSE_HELP) || + (! g_object_get_data (G_OBJECT (dialog), "gimp-dialog-help-button"))) + { + gtk_dialog_add_button (GTK_DIALOG (dialog), button_text, response_id); + } if (response_id == GTK_RESPONSE_OK) - gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); + { + gtk_dialog_set_default_response (GTK_DIALOG (dialog), + GTK_RESPONSE_OK); + } } } + typedef struct { GtkDialog *dialog; @@ -485,3 +522,17 @@ gimp_dialog_run (GimpDialog *dialog) return ri.response_id; } + +/** + * gimp_dialogs_show_help_button: + * @show: whether a help button should be added when creating a GimpDialog + * + * This function is for internal use only. + * + * Since: GIMP 2.2 + **/ +void +gimp_dialogs_show_help_button (gboolean show) +{ + show_help_button = show ? TRUE : FALSE; +} diff --git a/libgimpwidgets/gimpdialog.h b/libgimpwidgets/gimpdialog.h index 436c1df964..0e1da176e7 100644 --- a/libgimpwidgets/gimpdialog.h +++ b/libgimpwidgets/gimpdialog.h @@ -80,6 +80,9 @@ void gimp_dialog_add_buttons_valist (GimpDialog *dialog, gint gimp_dialog_run (GimpDialog *dialog); +/* for internal use only! */ +void gimp_dialogs_show_help_button (gboolean show); + G_END_DECLS diff --git a/libgimpwidgets/gimpwidgets.def b/libgimpwidgets/gimpwidgets.def index 02002ba538..c964b23c9a 100644 --- a/libgimpwidgets/gimpwidgets.def +++ b/libgimpwidgets/gimpwidgets.def @@ -92,6 +92,7 @@ EXPORTS gimp_dialog_new gimp_dialog_new_valist gimp_dialog_run + gimp_dialogs_show_help_button gimp_double_adjustment_update gimp_file_entry_get_filename gimp_file_entry_get_type