2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1999-09-28 01:58:10 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* gimphelp.c
|
2004-03-09 09:37:56 +08:00
|
|
|
* Copyright (C) 1999-2004 Michael Natterer <mitch@gimp.org>
|
|
|
|
* Henrik Brix Andersen <brix@gimp.org>
|
1999-09-28 01:58:10 +08:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2000-12-29 23:22:01 +08:00
|
|
|
|
1999-12-20 01:15:11 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-06-23 08:14:07 +08:00
|
|
|
#include <string.h>
|
1999-12-20 01:15:11 +08:00
|
|
|
|
1999-09-28 01:58:10 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-05-22 04:30:16 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
#include "widgets-types.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2002-11-19 04:50:31 +08:00
|
|
|
#include "config/gimpguiconfig.h"
|
|
|
|
|
2002-04-13 02:14:13 +08:00
|
|
|
#include "core/gimp.h"
|
2004-03-17 22:10:19 +08:00
|
|
|
#include "core/gimp-utils.h"
|
2006-04-30 01:55:42 +08:00
|
|
|
#include "core/gimpparamspecs.h"
|
2002-04-13 02:14:13 +08:00
|
|
|
|
2006-04-26 17:13:47 +08:00
|
|
|
#include "pdb/gimppdb.h"
|
2006-03-31 17:15:08 +08:00
|
|
|
#include "pdb/gimpprocedure.h"
|
2002-03-21 01:46:13 +08:00
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
#include "plug-in/gimppluginmanager-help-domain.h"
|
2001-12-01 08:14:14 +08:00
|
|
|
|
1999-09-28 01:58:10 +08:00
|
|
|
#include "gimphelp.h"
|
2003-08-24 03:35:05 +08:00
|
|
|
#include "gimphelp-ids.h"
|
2004-10-13 19:57:07 +08:00
|
|
|
#include "gimpmessagebox.h"
|
2004-10-13 22:35:28 +08:00
|
|
|
#include "gimpmessagedialog.h"
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
1999-09-28 01:58:10 +08:00
|
|
|
|
These changes enable help support for 3rd party plug-ins which install
2000-05-21 Michael Natterer <mitch@gimp.org>
These changes enable help support for 3rd party plug-ins which
install their help files outside GIMP's main help dir.
Instead of calling gimp_help(), gimp_plugin_help_func() etc.,
all help callbacks now have to call gimp_standard_help_func()
which has different implementations in the app and in libgimp.
There is a new function gimp_plugin_help_register() which can
be called during plug-in query. plug_in.c keeps a list of
executable_name/help_path pairs. Plug-ins have to pass their
exec. name to gimp_help() which uses the list to find the plug-in's
help directory.
* app/gimphelp.[ch]: gimp_help() now takes a help_path parameter.
help_path == NULL means the standard help directory. Various
changes to pass the help_path to the help browser.
* app/gimprc.c: save the plug-in's help_path in the pluginrc file.
* app/menus.c: ugly hack to enable help_paths in the "F1" callback.
* app/plug_in.[ch]: many help_path related changes. Use g_basename()
instead of strrchr(str,G_DIR_SEPARATOR), cosmetic cleanups.
* app/internal_procs.c
* app/gimphelp_cmds.c
* tools/pdbgen/pdb/gimphelp.pdb: new procedure
gimp_plugin_help_register(). gimp_help() takes a second parameter
which is the executable name (not the help_path).
* app/color_notebook.c
* app/commands.c
* app/lc_dialog.c
* app/preferences_dialog.c
* app/tools.c: call gimp_standard_help_func() instead of gimp_help().
* libgimp/gimp.c: new function gimp_get_progname() which returns
the full path of the plug-in's executable.
* libgimp/gimp.h: export the new function,
removed gimp_plugin_help_func(), gimp_help() takes the executable
name as second parameter.
* libgimp/gimpcompat.h: added gimp_plugin_help_func().
* libgimp/gimphelp.c: a wrapper for gimp_plugin_help_register(),
changed the calls to gimp_help.
* libgimp/gimphelpui.[ch]: call gimp_standard_help_func() instead
of gimp_help().
* plug-ins/helpbrowser/helpbrowser.c: now called with an additional
help_path parameter. Various changes to enable
help_path != gimp_standard_help_path.
Unrelated stuff:
* app/batch.h: added missing GPL header.
* app/gimpunit.c: had a LGPL header, merged some fprintf's into
one call.
* app/procedural_db.[ch]: cosmetic: g* types, s/g_malloc/g_new/,
prototypes, indentation.
* app/resize.c: use less packing widgets. didn't find the "offset"
redraw bug :(
2000-05-22 01:41:02 +08:00
|
|
|
|
2004-03-18 20:18:12 +08:00
|
|
|
/* #define GIMP_HELP_DEBUG */
|
2004-03-09 09:37:56 +08:00
|
|
|
|
1999-11-03 17:58:46 +08:00
|
|
|
|
These changes enable help support for 3rd party plug-ins which install
2000-05-21 Michael Natterer <mitch@gimp.org>
These changes enable help support for 3rd party plug-ins which
install their help files outside GIMP's main help dir.
Instead of calling gimp_help(), gimp_plugin_help_func() etc.,
all help callbacks now have to call gimp_standard_help_func()
which has different implementations in the app and in libgimp.
There is a new function gimp_plugin_help_register() which can
be called during plug-in query. plug_in.c keeps a list of
executable_name/help_path pairs. Plug-ins have to pass their
exec. name to gimp_help() which uses the list to find the plug-in's
help directory.
* app/gimphelp.[ch]: gimp_help() now takes a help_path parameter.
help_path == NULL means the standard help directory. Various
changes to pass the help_path to the help browser.
* app/gimprc.c: save the plug-in's help_path in the pluginrc file.
* app/menus.c: ugly hack to enable help_paths in the "F1" callback.
* app/plug_in.[ch]: many help_path related changes. Use g_basename()
instead of strrchr(str,G_DIR_SEPARATOR), cosmetic cleanups.
* app/internal_procs.c
* app/gimphelp_cmds.c
* tools/pdbgen/pdb/gimphelp.pdb: new procedure
gimp_plugin_help_register(). gimp_help() takes a second parameter
which is the executable name (not the help_path).
* app/color_notebook.c
* app/commands.c
* app/lc_dialog.c
* app/preferences_dialog.c
* app/tools.c: call gimp_standard_help_func() instead of gimp_help().
* libgimp/gimp.c: new function gimp_get_progname() which returns
the full path of the plug-in's executable.
* libgimp/gimp.h: export the new function,
removed gimp_plugin_help_func(), gimp_help() takes the executable
name as second parameter.
* libgimp/gimpcompat.h: added gimp_plugin_help_func().
* libgimp/gimphelp.c: a wrapper for gimp_plugin_help_register(),
changed the calls to gimp_help.
* libgimp/gimphelpui.[ch]: call gimp_standard_help_func() instead
of gimp_help().
* plug-ins/helpbrowser/helpbrowser.c: now called with an additional
help_path parameter. Various changes to enable
help_path != gimp_standard_help_path.
Unrelated stuff:
* app/batch.h: added missing GPL header.
* app/gimpunit.c: had a LGPL header, merged some fprintf's into
one call.
* app/procedural_db.[ch]: cosmetic: g* types, s/g_malloc/g_new/,
prototypes, indentation.
* app/resize.c: use less packing widgets. didn't find the "offset"
redraw bug :(
2000-05-22 01:41:02 +08:00
|
|
|
typedef struct _GimpIdleHelp GimpIdleHelp;
|
|
|
|
|
|
|
|
struct _GimpIdleHelp
|
|
|
|
{
|
2002-04-13 02:14:13 +08:00
|
|
|
Gimp *gimp;
|
2003-08-29 02:49:11 +08:00
|
|
|
gchar *help_domain;
|
2004-03-17 21:59:42 +08:00
|
|
|
gchar *help_locales;
|
2003-08-24 03:35:05 +08:00
|
|
|
gchar *help_id;
|
These changes enable help support for 3rd party plug-ins which install
2000-05-21 Michael Natterer <mitch@gimp.org>
These changes enable help support for 3rd party plug-ins which
install their help files outside GIMP's main help dir.
Instead of calling gimp_help(), gimp_plugin_help_func() etc.,
all help callbacks now have to call gimp_standard_help_func()
which has different implementations in the app and in libgimp.
There is a new function gimp_plugin_help_register() which can
be called during plug-in query. plug_in.c keeps a list of
executable_name/help_path pairs. Plug-ins have to pass their
exec. name to gimp_help() which uses the list to find the plug-in's
help directory.
* app/gimphelp.[ch]: gimp_help() now takes a help_path parameter.
help_path == NULL means the standard help directory. Various
changes to pass the help_path to the help browser.
* app/gimprc.c: save the plug-in's help_path in the pluginrc file.
* app/menus.c: ugly hack to enable help_paths in the "F1" callback.
* app/plug_in.[ch]: many help_path related changes. Use g_basename()
instead of strrchr(str,G_DIR_SEPARATOR), cosmetic cleanups.
* app/internal_procs.c
* app/gimphelp_cmds.c
* tools/pdbgen/pdb/gimphelp.pdb: new procedure
gimp_plugin_help_register(). gimp_help() takes a second parameter
which is the executable name (not the help_path).
* app/color_notebook.c
* app/commands.c
* app/lc_dialog.c
* app/preferences_dialog.c
* app/tools.c: call gimp_standard_help_func() instead of gimp_help().
* libgimp/gimp.c: new function gimp_get_progname() which returns
the full path of the plug-in's executable.
* libgimp/gimp.h: export the new function,
removed gimp_plugin_help_func(), gimp_help() takes the executable
name as second parameter.
* libgimp/gimpcompat.h: added gimp_plugin_help_func().
* libgimp/gimphelp.c: a wrapper for gimp_plugin_help_register(),
changed the calls to gimp_help.
* libgimp/gimphelpui.[ch]: call gimp_standard_help_func() instead
of gimp_help().
* plug-ins/helpbrowser/helpbrowser.c: now called with an additional
help_path parameter. Various changes to enable
help_path != gimp_standard_help_path.
Unrelated stuff:
* app/batch.h: added missing GPL header.
* app/gimpunit.c: had a LGPL header, merged some fprintf's into
one call.
* app/procedural_db.[ch]: cosmetic: g* types, s/g_malloc/g_new/,
prototypes, indentation.
* app/resize.c: use less packing widgets. didn't find the "offset"
redraw bug :(
2000-05-22 01:41:02 +08:00
|
|
|
};
|
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
|
1999-11-20 20:12:41 +08:00
|
|
|
/* local function prototypes */
|
2001-12-01 08:14:14 +08:00
|
|
|
|
2007-05-22 23:14:41 +08:00
|
|
|
static gint gimp_idle_help (GimpIdleHelp *idle_help);
|
2004-10-13 19:57:07 +08:00
|
|
|
|
|
|
|
static gboolean gimp_help_browser (Gimp *gimp);
|
|
|
|
static void gimp_help_browser_error (Gimp *gimp,
|
|
|
|
const gchar *title,
|
|
|
|
const gchar *primary,
|
|
|
|
const gchar *text);
|
|
|
|
|
|
|
|
static void gimp_help_call (Gimp *gimp,
|
2006-04-01 01:42:13 +08:00
|
|
|
const gchar *procedure_name,
|
2004-10-13 19:57:07 +08:00
|
|
|
const gchar *help_domain,
|
|
|
|
const gchar *help_locales,
|
|
|
|
const gchar *help_id);
|
|
|
|
static gchar * gimp_help_get_locales (GimpGuiConfig *config);
|
1999-11-20 20:12:41 +08:00
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
|
1999-11-20 20:12:41 +08:00
|
|
|
/* public functions */
|
1999-11-03 17:58:46 +08:00
|
|
|
|
1999-11-20 20:12:41 +08:00
|
|
|
void
|
2004-07-11 04:29:11 +08:00
|
|
|
gimp_help_show (Gimp *gimp,
|
|
|
|
const gchar *help_domain,
|
|
|
|
const gchar *help_id)
|
1999-11-20 20:12:41 +08:00
|
|
|
{
|
2004-03-17 21:59:42 +08:00
|
|
|
GimpGuiConfig *config;
|
|
|
|
|
2002-04-13 02:14:13 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2004-03-17 21:59:42 +08:00
|
|
|
config = GIMP_GUI_CONFIG (gimp->config);
|
|
|
|
|
|
|
|
if (config->use_help)
|
1999-11-20 20:12:41 +08:00
|
|
|
{
|
2007-05-22 23:14:41 +08:00
|
|
|
GimpIdleHelp *idle_help = g_slice_new0 (GimpIdleHelp);
|
1999-11-20 20:12:41 +08:00
|
|
|
|
2002-04-13 02:14:13 +08:00
|
|
|
idle_help->gimp = gimp;
|
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
if (help_domain && strlen (help_domain))
|
2006-04-12 20:49:29 +08:00
|
|
|
idle_help->help_domain = g_strdup (help_domain);
|
These changes enable help support for 3rd party plug-ins which install
2000-05-21 Michael Natterer <mitch@gimp.org>
These changes enable help support for 3rd party plug-ins which
install their help files outside GIMP's main help dir.
Instead of calling gimp_help(), gimp_plugin_help_func() etc.,
all help callbacks now have to call gimp_standard_help_func()
which has different implementations in the app and in libgimp.
There is a new function gimp_plugin_help_register() which can
be called during plug-in query. plug_in.c keeps a list of
executable_name/help_path pairs. Plug-ins have to pass their
exec. name to gimp_help() which uses the list to find the plug-in's
help directory.
* app/gimphelp.[ch]: gimp_help() now takes a help_path parameter.
help_path == NULL means the standard help directory. Various
changes to pass the help_path to the help browser.
* app/gimprc.c: save the plug-in's help_path in the pluginrc file.
* app/menus.c: ugly hack to enable help_paths in the "F1" callback.
* app/plug_in.[ch]: many help_path related changes. Use g_basename()
instead of strrchr(str,G_DIR_SEPARATOR), cosmetic cleanups.
* app/internal_procs.c
* app/gimphelp_cmds.c
* tools/pdbgen/pdb/gimphelp.pdb: new procedure
gimp_plugin_help_register(). gimp_help() takes a second parameter
which is the executable name (not the help_path).
* app/color_notebook.c
* app/commands.c
* app/lc_dialog.c
* app/preferences_dialog.c
* app/tools.c: call gimp_standard_help_func() instead of gimp_help().
* libgimp/gimp.c: new function gimp_get_progname() which returns
the full path of the plug-in's executable.
* libgimp/gimp.h: export the new function,
removed gimp_plugin_help_func(), gimp_help() takes the executable
name as second parameter.
* libgimp/gimpcompat.h: added gimp_plugin_help_func().
* libgimp/gimphelp.c: a wrapper for gimp_plugin_help_register(),
changed the calls to gimp_help.
* libgimp/gimphelpui.[ch]: call gimp_standard_help_func() instead
of gimp_help().
* plug-ins/helpbrowser/helpbrowser.c: now called with an additional
help_path parameter. Various changes to enable
help_path != gimp_standard_help_path.
Unrelated stuff:
* app/batch.h: added missing GPL header.
* app/gimpunit.c: had a LGPL header, merged some fprintf's into
one call.
* app/procedural_db.[ch]: cosmetic: g* types, s/g_malloc/g_new/,
prototypes, indentation.
* app/resize.c: use less packing widgets. didn't find the "offset"
redraw bug :(
2000-05-22 01:41:02 +08:00
|
|
|
|
2004-09-13 20:19:34 +08:00
|
|
|
idle_help->help_locales = gimp_help_get_locales (config);
|
2003-07-25 01:30:14 +08:00
|
|
|
|
2003-08-24 03:35:05 +08:00
|
|
|
if (help_id && strlen (help_id))
|
2006-04-12 20:49:29 +08:00
|
|
|
idle_help->help_id = g_strdup (help_id);
|
These changes enable help support for 3rd party plug-ins which install
2000-05-21 Michael Natterer <mitch@gimp.org>
These changes enable help support for 3rd party plug-ins which
install their help files outside GIMP's main help dir.
Instead of calling gimp_help(), gimp_plugin_help_func() etc.,
all help callbacks now have to call gimp_standard_help_func()
which has different implementations in the app and in libgimp.
There is a new function gimp_plugin_help_register() which can
be called during plug-in query. plug_in.c keeps a list of
executable_name/help_path pairs. Plug-ins have to pass their
exec. name to gimp_help() which uses the list to find the plug-in's
help directory.
* app/gimphelp.[ch]: gimp_help() now takes a help_path parameter.
help_path == NULL means the standard help directory. Various
changes to pass the help_path to the help browser.
* app/gimprc.c: save the plug-in's help_path in the pluginrc file.
* app/menus.c: ugly hack to enable help_paths in the "F1" callback.
* app/plug_in.[ch]: many help_path related changes. Use g_basename()
instead of strrchr(str,G_DIR_SEPARATOR), cosmetic cleanups.
* app/internal_procs.c
* app/gimphelp_cmds.c
* tools/pdbgen/pdb/gimphelp.pdb: new procedure
gimp_plugin_help_register(). gimp_help() takes a second parameter
which is the executable name (not the help_path).
* app/color_notebook.c
* app/commands.c
* app/lc_dialog.c
* app/preferences_dialog.c
* app/tools.c: call gimp_standard_help_func() instead of gimp_help().
* libgimp/gimp.c: new function gimp_get_progname() which returns
the full path of the plug-in's executable.
* libgimp/gimp.h: export the new function,
removed gimp_plugin_help_func(), gimp_help() takes the executable
name as second parameter.
* libgimp/gimpcompat.h: added gimp_plugin_help_func().
* libgimp/gimphelp.c: a wrapper for gimp_plugin_help_register(),
changed the calls to gimp_help.
* libgimp/gimphelpui.[ch]: call gimp_standard_help_func() instead
of gimp_help().
* plug-ins/helpbrowser/helpbrowser.c: now called with an additional
help_path parameter. Various changes to enable
help_path != gimp_standard_help_path.
Unrelated stuff:
* app/batch.h: added missing GPL header.
* app/gimpunit.c: had a LGPL header, merged some fprintf's into
one call.
* app/procedural_db.[ch]: cosmetic: g* types, s/g_malloc/g_new/,
prototypes, indentation.
* app/resize.c: use less packing widgets. didn't find the "offset"
redraw bug :(
2000-05-22 01:41:02 +08:00
|
|
|
|
2007-05-22 23:14:41 +08:00
|
|
|
g_idle_add ((GSourceFunc) gimp_idle_help, idle_help);
|
2004-07-27 19:19:33 +08:00
|
|
|
|
|
|
|
if (gimp->be_verbose)
|
|
|
|
g_print ("HELP: request for help-id '%s' from help-domain '%s'\n",
|
|
|
|
help_id ? help_id : "(null)",
|
|
|
|
help_domain ? help_domain : "(null)");
|
2000-01-05 23:47:06 +08:00
|
|
|
}
|
1999-11-20 20:12:41 +08:00
|
|
|
}
|
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
|
|
|
|
/* private functions */
|
1999-11-20 20:12:41 +08:00
|
|
|
|
2001-08-17 22:27:31 +08:00
|
|
|
static gboolean
|
2007-05-22 23:14:41 +08:00
|
|
|
gimp_idle_help (GimpIdleHelp *idle_help)
|
1999-11-20 20:12:41 +08:00
|
|
|
{
|
2006-04-01 01:42:13 +08:00
|
|
|
GimpGuiConfig *config = GIMP_GUI_CONFIG (idle_help->gimp->config);
|
|
|
|
const gchar *procedure_name = NULL;
|
2002-11-19 04:50:31 +08:00
|
|
|
|
2004-03-18 20:18:12 +08:00
|
|
|
#ifdef GIMP_HELP_DEBUG
|
2004-03-09 09:37:56 +08:00
|
|
|
g_printerr ("Help Domain: %s\n",
|
|
|
|
idle_help->help_domain ? idle_help->help_domain : "NULL");
|
|
|
|
g_printerr ("Help ID: %s\n\n",
|
|
|
|
idle_help->help_id ? idle_help->help_id : "NULL");
|
|
|
|
#endif
|
1999-11-20 20:12:41 +08:00
|
|
|
|
2004-10-13 18:34:02 +08:00
|
|
|
if (config->help_browser == GIMP_HELP_BROWSER_GIMP)
|
1999-12-20 01:15:11 +08:00
|
|
|
{
|
2004-10-13 19:57:07 +08:00
|
|
|
if (gimp_help_browser (idle_help->gimp))
|
2006-04-01 01:42:13 +08:00
|
|
|
procedure_name = "extension-gimp-help-browser-temp";
|
2004-10-13 18:34:02 +08:00
|
|
|
}
|
1999-12-20 01:15:11 +08:00
|
|
|
|
2004-10-13 18:34:02 +08:00
|
|
|
if (config->help_browser == GIMP_HELP_BROWSER_WEB_BROWSER)
|
|
|
|
{
|
2004-03-09 09:37:56 +08:00
|
|
|
/* FIXME: should check for procedure availability */
|
2006-04-01 01:42:13 +08:00
|
|
|
procedure_name = "plug-in-web-browser";
|
1999-12-20 01:15:11 +08:00
|
|
|
}
|
|
|
|
|
2006-04-01 01:42:13 +08:00
|
|
|
if (procedure_name)
|
2004-10-13 18:34:02 +08:00
|
|
|
gimp_help_call (idle_help->gimp,
|
2006-04-01 01:42:13 +08:00
|
|
|
procedure_name,
|
2004-10-13 18:34:02 +08:00
|
|
|
idle_help->help_domain,
|
|
|
|
idle_help->help_locales,
|
|
|
|
idle_help->help_id);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
g_free (idle_help->help_domain);
|
2004-03-17 21:59:42 +08:00
|
|
|
g_free (idle_help->help_locales);
|
2003-08-24 03:35:05 +08:00
|
|
|
g_free (idle_help->help_id);
|
2007-05-22 23:14:41 +08:00
|
|
|
|
|
|
|
g_slice_free (GimpIdleHelp, idle_help);
|
1999-12-20 01:15:11 +08:00
|
|
|
|
2000-01-05 23:47:06 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
1999-12-20 01:15:11 +08:00
|
|
|
|
2000-08-26 01:41:38 +08:00
|
|
|
static gboolean
|
2004-10-13 19:57:07 +08:00
|
|
|
gimp_help_browser (Gimp *gimp)
|
1999-12-20 01:15:11 +08:00
|
|
|
{
|
2004-10-13 18:34:02 +08:00
|
|
|
static gboolean busy = FALSE;
|
2006-04-01 01:42:13 +08:00
|
|
|
GimpProcedure *procedure;
|
2003-07-25 01:30:14 +08:00
|
|
|
|
|
|
|
if (busy)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
busy = TRUE;
|
|
|
|
|
1999-11-20 20:12:41 +08:00
|
|
|
/* Check if a help browser is already running */
|
2006-04-26 17:13:47 +08:00
|
|
|
procedure = gimp_pdb_lookup_procedure (gimp->pdb,
|
|
|
|
"extension-gimp-help-browser-temp");
|
1999-11-20 20:12:41 +08:00
|
|
|
|
2006-04-01 01:42:13 +08:00
|
|
|
if (! procedure)
|
1999-11-20 20:12:41 +08:00
|
|
|
{
|
2006-11-24 05:04:41 +08:00
|
|
|
GValueArray *args = NULL;
|
|
|
|
gint n_domains = 0;
|
|
|
|
gchar **help_domains = NULL;
|
|
|
|
gchar **help_uris = NULL;
|
1999-11-20 20:12:41 +08:00
|
|
|
|
2006-04-26 17:13:47 +08:00
|
|
|
procedure = gimp_pdb_lookup_procedure (gimp->pdb,
|
|
|
|
"extension-gimp-help-browser");
|
1999-11-20 20:12:41 +08:00
|
|
|
|
2006-04-01 01:42:13 +08:00
|
|
|
if (! procedure)
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
2004-10-13 19:57:07 +08:00
|
|
|
gimp_help_browser_error (gimp,
|
|
|
|
_("Help browser not found"),
|
|
|
|
_("Could not find GIMP help browser."),
|
|
|
|
_("The GIMP help browser plug-in appears "
|
|
|
|
"to be missing from your installation."));
|
2003-07-25 01:30:14 +08:00
|
|
|
busy = FALSE;
|
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
1999-11-20 20:12:41 +08:00
|
|
|
|
2006-11-24 05:04:41 +08:00
|
|
|
n_domains = gimp_plug_in_manager_get_help_domains (gimp->plug_in_manager,
|
|
|
|
&help_domains,
|
|
|
|
&help_uris);
|
|
|
|
|
2006-04-01 01:42:13 +08:00
|
|
|
args = gimp_procedure_get_arguments (procedure);
|
2006-11-24 05:04:41 +08:00
|
|
|
gimp_value_array_truncate (args, 5);
|
2003-08-29 02:49:11 +08:00
|
|
|
|
2006-11-24 05:04:41 +08:00
|
|
|
g_value_set_int (&args->values[0], GIMP_RUN_INTERACTIVE);
|
|
|
|
g_value_set_int (&args->values[1], n_domains);
|
|
|
|
gimp_value_take_stringarray (&args->values[2], help_domains, n_domains);
|
|
|
|
g_value_set_int (&args->values[3], n_domains);
|
|
|
|
gimp_value_take_stringarray (&args->values[4], help_uris, n_domains);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2006-04-08 02:23:20 +08:00
|
|
|
gimp_procedure_execute_async (procedure, gimp,
|
|
|
|
gimp_get_user_context (gimp),
|
2006-05-05 16:29:33 +08:00
|
|
|
NULL, args, NULL);
|
2003-08-29 02:49:11 +08:00
|
|
|
|
2006-04-04 18:30:58 +08:00
|
|
|
g_value_array_free (args);
|
2003-08-29 02:49:11 +08:00
|
|
|
}
|
1999-11-20 20:12:41 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
/* Check if the help browser started properly */
|
2006-04-26 17:13:47 +08:00
|
|
|
procedure = gimp_pdb_lookup_procedure (gimp->pdb,
|
|
|
|
"extension-gimp-help-browser-temp");
|
1999-11-20 20:12:41 +08:00
|
|
|
|
2006-04-01 01:42:13 +08:00
|
|
|
if (! procedure)
|
2003-08-29 02:49:11 +08:00
|
|
|
{
|
2004-10-13 19:57:07 +08:00
|
|
|
gimp_help_browser_error (gimp,
|
|
|
|
_("Help browser doesn't start"),
|
|
|
|
_("Could not start the GIMP help browser plug-in."),
|
|
|
|
NULL);
|
2003-08-29 02:49:11 +08:00
|
|
|
busy = FALSE;
|
|
|
|
|
2004-10-13 18:34:02 +08:00
|
|
|
return FALSE;
|
1999-11-20 20:12:41 +08:00
|
|
|
}
|
2000-08-26 01:41:38 +08:00
|
|
|
|
2003-07-25 01:30:14 +08:00
|
|
|
busy = FALSE;
|
|
|
|
|
2000-08-26 01:41:38 +08:00
|
|
|
return TRUE;
|
1999-11-20 20:12:41 +08:00
|
|
|
}
|
|
|
|
|
2004-10-13 19:57:07 +08:00
|
|
|
static void
|
|
|
|
gimp_help_browser_error (Gimp *gimp,
|
|
|
|
const gchar *title,
|
|
|
|
const gchar *primary,
|
|
|
|
const gchar *text)
|
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
2004-10-13 22:35:28 +08:00
|
|
|
dialog =
|
|
|
|
gimp_message_dialog_new (title, GIMP_STOCK_WARNING,
|
|
|
|
NULL, 0,
|
|
|
|
NULL, NULL,
|
2004-10-13 19:57:07 +08:00
|
|
|
|
2004-10-13 22:35:28 +08:00
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
_("Use _web browser instead"), GTK_RESPONSE_OK,
|
2004-10-13 19:57:07 +08:00
|
|
|
|
2004-10-13 22:35:28 +08:00
|
|
|
NULL);
|
2004-10-13 19:57:07 +08:00
|
|
|
|
2004-10-13 22:35:28 +08:00
|
|
|
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box, primary);
|
|
|
|
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box, text);
|
2004-10-13 19:57:07 +08:00
|
|
|
|
|
|
|
if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
|
|
|
|
g_object_set (gimp->config,
|
2006-04-12 20:49:29 +08:00
|
|
|
"help-browser", GIMP_HELP_BROWSER_WEB_BROWSER,
|
|
|
|
NULL);
|
2004-10-13 19:57:07 +08:00
|
|
|
|
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
}
|
|
|
|
|
2000-01-07 00:40:17 +08:00
|
|
|
static void
|
2004-03-09 09:37:56 +08:00
|
|
|
gimp_help_call (Gimp *gimp,
|
2006-04-01 01:42:13 +08:00
|
|
|
const gchar *procedure_name,
|
2004-03-09 09:37:56 +08:00
|
|
|
const gchar *help_domain,
|
2004-03-17 21:59:42 +08:00
|
|
|
const gchar *help_locales,
|
2004-03-09 09:37:56 +08:00
|
|
|
const gchar *help_id)
|
1999-11-20 20:12:41 +08:00
|
|
|
{
|
2006-04-01 01:42:13 +08:00
|
|
|
GimpProcedure *procedure;
|
1999-12-20 01:15:11 +08:00
|
|
|
|
2006-11-24 05:04:41 +08:00
|
|
|
/* Special case the help browser */
|
|
|
|
if (! strcmp (procedure_name, "extension-gimp-help-browser-temp"))
|
|
|
|
{
|
|
|
|
GValueArray *return_vals;
|
|
|
|
|
|
|
|
return_vals = gimp_pdb_execute_procedure_by_name (gimp->pdb,
|
|
|
|
gimp_get_user_context (gimp),
|
|
|
|
NULL,
|
|
|
|
procedure_name,
|
|
|
|
G_TYPE_STRING, help_domain,
|
|
|
|
G_TYPE_STRING, help_locales,
|
|
|
|
G_TYPE_STRING, help_id,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
|
|
|
g_value_array_free (return_vals);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-03-09 09:37:56 +08:00
|
|
|
/* Check if a help parser is already running */
|
2006-04-26 17:13:47 +08:00
|
|
|
procedure = gimp_pdb_lookup_procedure (gimp->pdb, "extension-gimp-help-temp");
|
2003-01-09 20:45:25 +08:00
|
|
|
|
2006-04-01 01:42:13 +08:00
|
|
|
if (! procedure)
|
These changes enable help support for 3rd party plug-ins which install
2000-05-21 Michael Natterer <mitch@gimp.org>
These changes enable help support for 3rd party plug-ins which
install their help files outside GIMP's main help dir.
Instead of calling gimp_help(), gimp_plugin_help_func() etc.,
all help callbacks now have to call gimp_standard_help_func()
which has different implementations in the app and in libgimp.
There is a new function gimp_plugin_help_register() which can
be called during plug-in query. plug_in.c keeps a list of
executable_name/help_path pairs. Plug-ins have to pass their
exec. name to gimp_help() which uses the list to find the plug-in's
help directory.
* app/gimphelp.[ch]: gimp_help() now takes a help_path parameter.
help_path == NULL means the standard help directory. Various
changes to pass the help_path to the help browser.
* app/gimprc.c: save the plug-in's help_path in the pluginrc file.
* app/menus.c: ugly hack to enable help_paths in the "F1" callback.
* app/plug_in.[ch]: many help_path related changes. Use g_basename()
instead of strrchr(str,G_DIR_SEPARATOR), cosmetic cleanups.
* app/internal_procs.c
* app/gimphelp_cmds.c
* tools/pdbgen/pdb/gimphelp.pdb: new procedure
gimp_plugin_help_register(). gimp_help() takes a second parameter
which is the executable name (not the help_path).
* app/color_notebook.c
* app/commands.c
* app/lc_dialog.c
* app/preferences_dialog.c
* app/tools.c: call gimp_standard_help_func() instead of gimp_help().
* libgimp/gimp.c: new function gimp_get_progname() which returns
the full path of the plug-in's executable.
* libgimp/gimp.h: export the new function,
removed gimp_plugin_help_func(), gimp_help() takes the executable
name as second parameter.
* libgimp/gimpcompat.h: added gimp_plugin_help_func().
* libgimp/gimphelp.c: a wrapper for gimp_plugin_help_register(),
changed the calls to gimp_help.
* libgimp/gimphelpui.[ch]: call gimp_standard_help_func() instead
of gimp_help().
* plug-ins/helpbrowser/helpbrowser.c: now called with an additional
help_path parameter. Various changes to enable
help_path != gimp_standard_help_path.
Unrelated stuff:
* app/batch.h: added missing GPL header.
* app/gimpunit.c: had a LGPL header, merged some fprintf's into
one call.
* app/procedural_db.[ch]: cosmetic: g* types, s/g_malloc/g_new/,
prototypes, indentation.
* app/resize.c: use less packing widgets. didn't find the "offset"
redraw bug :(
2000-05-22 01:41:02 +08:00
|
|
|
{
|
2006-04-04 18:30:58 +08:00
|
|
|
GValueArray *args = NULL;
|
|
|
|
gint n_domains = 0;
|
|
|
|
gchar **help_domains = NULL;
|
|
|
|
gchar **help_uris = NULL;
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2006-04-26 17:13:47 +08:00
|
|
|
procedure = gimp_pdb_lookup_procedure (gimp->pdb, "extension-gimp-help");
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2006-04-01 01:42:13 +08:00
|
|
|
if (! procedure)
|
2004-10-13 18:34:02 +08:00
|
|
|
/* FIXME: error msg */
|
|
|
|
return;
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
n_domains = gimp_plug_in_manager_get_help_domains (gimp->plug_in_manager,
|
|
|
|
&help_domains,
|
|
|
|
&help_uris);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2006-04-01 01:42:13 +08:00
|
|
|
args = gimp_procedure_get_arguments (procedure);
|
2006-04-08 02:23:20 +08:00
|
|
|
gimp_value_array_truncate (args, 4);
|
2004-03-09 18:58:06 +08:00
|
|
|
|
2006-04-30 01:55:42 +08:00
|
|
|
g_value_set_int (&args->values[0], n_domains);
|
|
|
|
gimp_value_take_stringarray (&args->values[1], help_domains, n_domains);
|
|
|
|
g_value_set_int (&args->values[2], n_domains);
|
|
|
|
gimp_value_take_stringarray (&args->values[3], help_uris, n_domains);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2006-04-08 02:23:20 +08:00
|
|
|
gimp_procedure_execute_async (procedure, gimp,
|
|
|
|
gimp_get_user_context (gimp),
|
2006-05-05 16:29:33 +08:00
|
|
|
NULL, args, NULL);
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2006-04-04 18:30:58 +08:00
|
|
|
g_value_array_free (args);
|
These changes enable help support for 3rd party plug-ins which install
2000-05-21 Michael Natterer <mitch@gimp.org>
These changes enable help support for 3rd party plug-ins which
install their help files outside GIMP's main help dir.
Instead of calling gimp_help(), gimp_plugin_help_func() etc.,
all help callbacks now have to call gimp_standard_help_func()
which has different implementations in the app and in libgimp.
There is a new function gimp_plugin_help_register() which can
be called during plug-in query. plug_in.c keeps a list of
executable_name/help_path pairs. Plug-ins have to pass their
exec. name to gimp_help() which uses the list to find the plug-in's
help directory.
* app/gimphelp.[ch]: gimp_help() now takes a help_path parameter.
help_path == NULL means the standard help directory. Various
changes to pass the help_path to the help browser.
* app/gimprc.c: save the plug-in's help_path in the pluginrc file.
* app/menus.c: ugly hack to enable help_paths in the "F1" callback.
* app/plug_in.[ch]: many help_path related changes. Use g_basename()
instead of strrchr(str,G_DIR_SEPARATOR), cosmetic cleanups.
* app/internal_procs.c
* app/gimphelp_cmds.c
* tools/pdbgen/pdb/gimphelp.pdb: new procedure
gimp_plugin_help_register(). gimp_help() takes a second parameter
which is the executable name (not the help_path).
* app/color_notebook.c
* app/commands.c
* app/lc_dialog.c
* app/preferences_dialog.c
* app/tools.c: call gimp_standard_help_func() instead of gimp_help().
* libgimp/gimp.c: new function gimp_get_progname() which returns
the full path of the plug-in's executable.
* libgimp/gimp.h: export the new function,
removed gimp_plugin_help_func(), gimp_help() takes the executable
name as second parameter.
* libgimp/gimpcompat.h: added gimp_plugin_help_func().
* libgimp/gimphelp.c: a wrapper for gimp_plugin_help_register(),
changed the calls to gimp_help.
* libgimp/gimphelpui.[ch]: call gimp_standard_help_func() instead
of gimp_help().
* plug-ins/helpbrowser/helpbrowser.c: now called with an additional
help_path parameter. Various changes to enable
help_path != gimp_standard_help_path.
Unrelated stuff:
* app/batch.h: added missing GPL header.
* app/gimpunit.c: had a LGPL header, merged some fprintf's into
one call.
* app/procedural_db.[ch]: cosmetic: g* types, s/g_malloc/g_new/,
prototypes, indentation.
* app/resize.c: use less packing widgets. didn't find the "offset"
redraw bug :(
2000-05-22 01:41:02 +08:00
|
|
|
}
|
2004-03-09 09:37:56 +08:00
|
|
|
|
|
|
|
/* Check if the help parser started properly */
|
2006-04-26 17:13:47 +08:00
|
|
|
procedure = gimp_pdb_lookup_procedure (gimp->pdb, "extension-gimp-help-temp");
|
2004-03-09 09:37:56 +08:00
|
|
|
|
2006-04-01 01:42:13 +08:00
|
|
|
if (procedure)
|
2004-03-09 09:37:56 +08:00
|
|
|
{
|
2006-04-04 18:30:58 +08:00
|
|
|
GValueArray *return_vals;
|
1999-12-20 01:15:11 +08:00
|
|
|
|
2004-03-18 20:18:12 +08:00
|
|
|
#ifdef GIMP_HELP_DEBUG
|
2004-03-09 09:37:56 +08:00
|
|
|
g_printerr ("Calling help via %s: %s %s %s\n",
|
2006-04-01 01:42:13 +08:00
|
|
|
procedure_name,
|
2004-07-27 19:19:33 +08:00
|
|
|
help_domain ? help_domain : "(null)",
|
|
|
|
help_locales ? help_locales : "(null)",
|
|
|
|
help_id ? help_id : "(null)");
|
2004-03-09 09:37:56 +08:00
|
|
|
#endif
|
1999-12-20 01:15:11 +08:00
|
|
|
|
2006-04-26 17:13:47 +08:00
|
|
|
return_vals = gimp_pdb_execute_procedure_by_name (gimp->pdb,
|
|
|
|
gimp_get_user_context (gimp),
|
|
|
|
NULL,
|
|
|
|
"extension-gimp-help-temp",
|
|
|
|
G_TYPE_STRING, procedure_name,
|
|
|
|
G_TYPE_STRING, help_domain,
|
|
|
|
G_TYPE_STRING, help_locales,
|
|
|
|
G_TYPE_STRING, help_id,
|
|
|
|
G_TYPE_NONE);
|
1999-12-20 01:15:11 +08:00
|
|
|
|
2006-04-04 18:30:58 +08:00
|
|
|
g_value_array_free (return_vals);
|
2004-03-09 09:37:56 +08:00
|
|
|
}
|
1999-11-20 20:12:41 +08:00
|
|
|
}
|
2004-09-13 20:19:34 +08:00
|
|
|
|
|
|
|
static gchar *
|
|
|
|
gimp_help_get_locales (GimpGuiConfig *config)
|
|
|
|
{
|
|
|
|
if (config->help_locales && strlen (config->help_locales))
|
|
|
|
return g_strdup (config->help_locales);
|
|
|
|
|
2005-03-01 05:33:02 +08:00
|
|
|
return g_strjoinv (":", (gchar **) g_get_language_names ());
|
2004-09-13 20:19:34 +08:00
|
|
|
}
|
2004-10-13 19:57:07 +08:00
|
|
|
|