From 5c1676dfe6d2f3c837a5e074117b45613fd29a72 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:30:19 +0200 Subject: Adding upstream version 2.10.34. Signed-off-by: Daniel Baumann --- plug-ins/help-browser/Makefile.am | 59 ++ plug-ins/help-browser/Makefile.in | 1027 +++++++++++++++++++++++ plug-ins/help-browser/dialog.c | 1255 ++++++++++++++++++++++++++++ plug-ins/help-browser/dialog.h | 35 + plug-ins/help-browser/gimpthrobber.c | 366 ++++++++ plug-ins/help-browser/gimpthrobber.h | 68 ++ plug-ins/help-browser/gimpthrobberaction.c | 133 +++ plug-ins/help-browser/gimpthrobberaction.h | 48 ++ plug-ins/help-browser/help-browser.c | 322 +++++++ plug-ins/help-browser/uri.c | 386 +++++++++ plug-ins/help-browser/uri.h | 22 + 11 files changed, 3721 insertions(+) create mode 100644 plug-ins/help-browser/Makefile.am create mode 100644 plug-ins/help-browser/Makefile.in create mode 100644 plug-ins/help-browser/dialog.c create mode 100644 plug-ins/help-browser/dialog.h create mode 100644 plug-ins/help-browser/gimpthrobber.c create mode 100644 plug-ins/help-browser/gimpthrobber.h create mode 100644 plug-ins/help-browser/gimpthrobberaction.c create mode 100644 plug-ins/help-browser/gimpthrobberaction.h create mode 100644 plug-ins/help-browser/help-browser.c create mode 100644 plug-ins/help-browser/uri.c create mode 100644 plug-ins/help-browser/uri.h (limited to 'plug-ins/help-browser') diff --git a/plug-ins/help-browser/Makefile.am b/plug-ins/help-browser/Makefile.am new file mode 100644 index 0000000..e4f7a3b --- /dev/null +++ b/plug-ins/help-browser/Makefile.am @@ -0,0 +1,59 @@ +## Process this file with automake to produce Makefile.in + +libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la +libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la +libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la +libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la +libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la +libgimpui = $(top_builddir)/libgimp/libgimpui-$(GIMP_API_VERSION).la +libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la + +libgimphelp = $(top_builddir)/plug-ins/help/libgimphelp.a + +if OS_WIN32 +mwindows = -mwindows +endif + +if HAVE_WINDRES +include $(top_srcdir)/build/windows/gimprc-plug-ins.rule +help_browser_RC = help-browser.rc.o +endif + +AM_LDFLAGS = $(mwindows) + +libexecdir = $(gimpplugindir)/plug-ins/help-browser + +libexec_PROGRAMS = help-browser + +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + $(WEBKIT_CFLAGS) \ + $(GEGL_CFLAGS) \ + -I$(includedir) + +LDADD = \ + $(libgimphelp) \ + $(libgimpui) \ + $(libgimpwidgets) \ + $(libgimpconfig) \ + $(libgimp) \ + $(libgimpcolor) \ + $(libgimpmath) \ + $(libgimpbase) \ + $(WEBKIT_LIBS) \ + $(GIO_LIBS) \ + $(GLIB_LIBS) \ + $(RT_LIBS) \ + $(INTLLIBS) \ + $(help_browser_RC) + +help_browser_SOURCES = \ + gimpthrobber.c \ + gimpthrobber.h \ + gimpthrobberaction.c \ + gimpthrobberaction.h \ + help-browser.c \ + dialog.c \ + dialog.h \ + uri.c \ + uri.h diff --git a/plug-ins/help-browser/Makefile.in b/plug-ins/help-browser/Makefile.in new file mode 100644 index 0000000..1c4601f --- /dev/null +++ b/plug-ins/help-browser/Makefile.in @@ -0,0 +1,1027 @@ +# Makefile.in generated by automake 1.16.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2020 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Version resources for Microsoft Windows + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = help-browser$(EXEEXT) +subdir = plug-ins/help-browser +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4macros/alsa.m4 \ + $(top_srcdir)/m4macros/ax_compare_version.m4 \ + $(top_srcdir)/m4macros/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4macros/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4macros/ax_prog_cc_for_build.m4 \ + $(top_srcdir)/m4macros/ax_prog_perl_version.m4 \ + $(top_srcdir)/m4macros/detectcflags.m4 \ + $(top_srcdir)/m4macros/pythondev.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(libexecdir)" +PROGRAMS = $(libexec_PROGRAMS) +am_help_browser_OBJECTS = gimpthrobber.$(OBJEXT) \ + gimpthrobberaction.$(OBJEXT) help-browser.$(OBJEXT) \ + dialog.$(OBJEXT) uri.$(OBJEXT) +help_browser_OBJECTS = $(am_help_browser_OBJECTS) +help_browser_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +help_browser_DEPENDENCIES = $(libgimphelp) $(libgimpui) \ + $(libgimpwidgets) $(libgimpconfig) $(libgimp) $(libgimpcolor) \ + $(libgimpmath) $(libgimpbase) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(help_browser_RC) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/dialog.Po \ + ./$(DEPDIR)/gimpthrobber.Po ./$(DEPDIR)/gimpthrobberaction.Po \ + ./$(DEPDIR)/help-browser.Po ./$(DEPDIR)/uri.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(help_browser_SOURCES) +DIST_SOURCES = $(help_browser_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(top_srcdir)/build/windows/gimprc-plug-ins.rule \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +AA_LIBS = @AA_LIBS@ +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALL_LINGUAS = @ALL_LINGUAS@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALTIVEC_EXTRA_CFLAGS = @ALTIVEC_EXTRA_CFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPSTREAM_UTIL = @APPSTREAM_UTIL@ +AR = @AR@ +AS = @AS@ +ATK_CFLAGS = @ATK_CFLAGS@ +ATK_LIBS = @ATK_LIBS@ +ATK_REQUIRED_VERSION = @ATK_REQUIRED_VERSION@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BABL_CFLAGS = @BABL_CFLAGS@ +BABL_LIBS = @BABL_LIBS@ +BABL_REQUIRED_VERSION = @BABL_REQUIRED_VERSION@ +BUG_REPORT_URL = @BUG_REPORT_URL@ +BUILD_EXEEXT = @BUILD_EXEEXT@ +BUILD_OBJEXT = @BUILD_OBJEXT@ +BZIP2_LIBS = @BZIP2_LIBS@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CAIRO_PDF_CFLAGS = @CAIRO_PDF_CFLAGS@ +CAIRO_PDF_LIBS = @CAIRO_PDF_LIBS@ +CAIRO_PDF_REQUIRED_VERSION = @CAIRO_PDF_REQUIRED_VERSION@ +CAIRO_REQUIRED_VERSION = @CAIRO_REQUIRED_VERSION@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CC_VERSION = @CC_VERSION@ +CFLAGS = @CFLAGS@ +CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CPP_FOR_BUILD = @CPP_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DESKTOP_DATADIR = @DESKTOP_DATADIR@ +DESKTOP_FILE_VALIDATE = @DESKTOP_FILE_VALIDATE@ +DLLTOOL = @DLLTOOL@ +DOC_SHOOTER = @DOC_SHOOTER@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_AA = @FILE_AA@ +FILE_EXR = @FILE_EXR@ +FILE_HEIF = @FILE_HEIF@ +FILE_JP2_LOAD = @FILE_JP2_LOAD@ +FILE_JPEGXL = @FILE_JPEGXL@ +FILE_MNG = @FILE_MNG@ +FILE_PDF_SAVE = @FILE_PDF_SAVE@ +FILE_PS = @FILE_PS@ +FILE_WMF = @FILE_WMF@ +FILE_XMC = @FILE_XMC@ +FILE_XPM = @FILE_XPM@ +FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ +FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ +FONTCONFIG_REQUIRED_VERSION = @FONTCONFIG_REQUIRED_VERSION@ +FREETYPE2_REQUIRED_VERSION = @FREETYPE2_REQUIRED_VERSION@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GDBUS_CODEGEN = @GDBUS_CODEGEN@ +GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@ +GDK_PIXBUF_CSOURCE = @GDK_PIXBUF_CSOURCE@ +GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@ +GDK_PIXBUF_REQUIRED_VERSION = @GDK_PIXBUF_REQUIRED_VERSION@ +GEGL = @GEGL@ +GEGL_CFLAGS = @GEGL_CFLAGS@ +GEGL_LIBS = @GEGL_LIBS@ +GEGL_MAJOR_MINOR_VERSION = @GEGL_MAJOR_MINOR_VERSION@ +GEGL_REQUIRED_VERSION = @GEGL_REQUIRED_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GEXIV2_CFLAGS = @GEXIV2_CFLAGS@ +GEXIV2_LIBS = @GEXIV2_LIBS@ +GEXIV2_REQUIRED_VERSION = @GEXIV2_REQUIRED_VERSION@ +GIMP_API_VERSION = @GIMP_API_VERSION@ +GIMP_APP_VERSION = @GIMP_APP_VERSION@ +GIMP_BINARY_AGE = @GIMP_BINARY_AGE@ +GIMP_COMMAND = @GIMP_COMMAND@ +GIMP_DATA_VERSION = @GIMP_DATA_VERSION@ +GIMP_FULL_NAME = @GIMP_FULL_NAME@ +GIMP_INTERFACE_AGE = @GIMP_INTERFACE_AGE@ +GIMP_MAJOR_VERSION = @GIMP_MAJOR_VERSION@ +GIMP_MICRO_VERSION = @GIMP_MICRO_VERSION@ +GIMP_MINOR_VERSION = @GIMP_MINOR_VERSION@ +GIMP_MKENUMS = @GIMP_MKENUMS@ +GIMP_MODULES = @GIMP_MODULES@ +GIMP_PACKAGE_REVISION = @GIMP_PACKAGE_REVISION@ +GIMP_PKGCONFIG_VERSION = @GIMP_PKGCONFIG_VERSION@ +GIMP_PLUGINS = @GIMP_PLUGINS@ +GIMP_PLUGIN_VERSION = @GIMP_PLUGIN_VERSION@ +GIMP_REAL_VERSION = @GIMP_REAL_VERSION@ +GIMP_RELEASE = @GIMP_RELEASE@ +GIMP_SYSCONF_VERSION = @GIMP_SYSCONF_VERSION@ +GIMP_TOOL_VERSION = @GIMP_TOOL_VERSION@ +GIMP_UNSTABLE = @GIMP_UNSTABLE@ +GIMP_USER_VERSION = @GIMP_USER_VERSION@ +GIMP_VERSION = @GIMP_VERSION@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GIO_UNIX_CFLAGS = @GIO_UNIX_CFLAGS@ +GIO_UNIX_LIBS = @GIO_UNIX_LIBS@ +GIO_WINDOWS_CFLAGS = @GIO_WINDOWS_CFLAGS@ +GIO_WINDOWS_LIBS = @GIO_WINDOWS_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQUIRED_VERSION = @GLIB_REQUIRED_VERSION@ +GMODULE_NO_EXPORT_CFLAGS = @GMODULE_NO_EXPORT_CFLAGS@ +GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GS_LIBS = @GS_LIBS@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +GTK_MAC_INTEGRATION_CFLAGS = @GTK_MAC_INTEGRATION_CFLAGS@ +GTK_MAC_INTEGRATION_LIBS = @GTK_MAC_INTEGRATION_LIBS@ +GTK_REQUIRED_VERSION = @GTK_REQUIRED_VERSION@ +GTK_UPDATE_ICON_CACHE = @GTK_UPDATE_ICON_CACHE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@ +HARFBUZZ_LIBS = @HARFBUZZ_LIBS@ +HARFBUZZ_REQUIRED_VERSION = @HARFBUZZ_REQUIRED_VERSION@ +HAVE_CXX14 = @HAVE_CXX14@ +HAVE_FINITE = @HAVE_FINITE@ +HAVE_ISFINITE = @HAVE_ISFINITE@ +HAVE_VFORK = @HAVE_VFORK@ +HOST_GLIB_COMPILE_RESOURCES = @HOST_GLIB_COMPILE_RESOURCES@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_REQUIRED_VERSION = @INTLTOOL_REQUIRED_VERSION@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +ISO_CODES_LOCALEDIR = @ISO_CODES_LOCALEDIR@ +ISO_CODES_LOCATION = @ISO_CODES_LOCATION@ +JPEG_LIBS = @JPEG_LIBS@ +JSON_GLIB_CFLAGS = @JSON_GLIB_CFLAGS@ +JSON_GLIB_LIBS = @JSON_GLIB_LIBS@ +JXL_CFLAGS = @JXL_CFLAGS@ +JXL_LIBS = @JXL_LIBS@ +JXL_THREADS_CFLAGS = @JXL_THREADS_CFLAGS@ +JXL_THREADS_LIBS = @JXL_THREADS_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LCMS_REQUIRED_VERSION = @LCMS_REQUIRED_VERSION@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ +LIBBACKTRACE_LIBS = @LIBBACKTRACE_LIBS@ +LIBHEIF_CFLAGS = @LIBHEIF_CFLAGS@ +LIBHEIF_LIBS = @LIBHEIF_LIBS@ +LIBHEIF_REQUIRED_VERSION = @LIBHEIF_REQUIRED_VERSION@ +LIBJXL_REQUIRED_VERSION = @LIBJXL_REQUIRED_VERSION@ +LIBLZMA_REQUIRED_VERSION = @LIBLZMA_REQUIRED_VERSION@ +LIBMYPAINT_CFLAGS = @LIBMYPAINT_CFLAGS@ +LIBMYPAINT_LIBS = @LIBMYPAINT_LIBS@ +LIBMYPAINT_REQUIRED_VERSION = @LIBMYPAINT_REQUIRED_VERSION@ +LIBOBJS = @LIBOBJS@ +LIBPNG_REQUIRED_VERSION = @LIBPNG_REQUIRED_VERSION@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIBUNWIND_REQUIRED_VERSION = @LIBUNWIND_REQUIRED_VERSION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LT_VERSION_INFO = @LT_VERSION_INFO@ +LZMA_CFLAGS = @LZMA_CFLAGS@ +LZMA_LIBS = @LZMA_LIBS@ +MAIL = @MAIL@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MIME_INFO_CFLAGS = @MIME_INFO_CFLAGS@ +MIME_INFO_LIBS = @MIME_INFO_LIBS@ +MIME_TYPES = @MIME_TYPES@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MMX_EXTRA_CFLAGS = @MMX_EXTRA_CFLAGS@ +MNG_CFLAGS = @MNG_CFLAGS@ +MNG_LIBS = @MNG_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +MYPAINT_BRUSHES_CFLAGS = @MYPAINT_BRUSHES_CFLAGS@ +MYPAINT_BRUSHES_LIBS = @MYPAINT_BRUSHES_LIBS@ +NATIVE_GLIB_CFLAGS = @NATIVE_GLIB_CFLAGS@ +NATIVE_GLIB_LIBS = @NATIVE_GLIB_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENEXR_CFLAGS = @OPENEXR_CFLAGS@ +OPENEXR_LIBS = @OPENEXR_LIBS@ +OPENEXR_REQUIRED_VERSION = @OPENEXR_REQUIRED_VERSION@ +OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@ +OPENJPEG_LIBS = @OPENJPEG_LIBS@ +OPENJPEG_REQUIRED_VERSION = @OPENJPEG_REQUIRED_VERSION@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_CFLAGS = @PANGOCAIRO_CFLAGS@ +PANGOCAIRO_LIBS = @PANGOCAIRO_LIBS@ +PANGOCAIRO_REQUIRED_VERSION = @PANGOCAIRO_REQUIRED_VERSION@ +PATHSEP = @PATHSEP@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_REQUIRED_VERSION = @PERL_REQUIRED_VERSION@ +PERL_VERSION = @PERL_VERSION@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PNG_CFLAGS = @PNG_CFLAGS@ +PNG_LIBS = @PNG_LIBS@ +POFILES = @POFILES@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_DATA_CFLAGS = @POPPLER_DATA_CFLAGS@ +POPPLER_DATA_LIBS = @POPPLER_DATA_LIBS@ +POPPLER_DATA_REQUIRED_VERSION = @POPPLER_DATA_REQUIRED_VERSION@ +POPPLER_LIBS = @POPPLER_LIBS@ +POPPLER_REQUIRED_VERSION = @POPPLER_REQUIRED_VERSION@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +PYBIN_PATH = @PYBIN_PATH@ +PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ +PYCAIRO_LIBS = @PYCAIRO_LIBS@ +PYGIMP_EXTRA_CFLAGS = @PYGIMP_EXTRA_CFLAGS@ +PYGTK_CFLAGS = @PYGTK_CFLAGS@ +PYGTK_CODEGEN = @PYGTK_CODEGEN@ +PYGTK_DEFSDIR = @PYGTK_DEFSDIR@ +PYGTK_LIBS = @PYGTK_LIBS@ +PYLINK_LIBS = @PYLINK_LIBS@ +PYTHON = @PYTHON@ +PYTHON2_REQUIRED_VERSION = @PYTHON2_REQUIRED_VERSION@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RSVG_REQUIRED_VERSION = @RSVG_REQUIRED_VERSION@ +RT_LIBS = @RT_LIBS@ +SCREENSHOT_LIBS = @SCREENSHOT_LIBS@ +SED = @SED@ +SENDMAIL = @SENDMAIL@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOCKET_LIBS = @SOCKET_LIBS@ +SSE2_EXTRA_CFLAGS = @SSE2_EXTRA_CFLAGS@ +SSE4_1_EXTRA_CFLAGS = @SSE4_1_EXTRA_CFLAGS@ +SSE_EXTRA_CFLAGS = @SSE_EXTRA_CFLAGS@ +STRIP = @STRIP@ +SVG_CFLAGS = @SVG_CFLAGS@ +SVG_LIBS = @SVG_LIBS@ +SYMPREFIX = @SYMPREFIX@ +TIFF_LIBS = @TIFF_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WEBKIT_CFLAGS = @WEBKIT_CFLAGS@ +WEBKIT_LIBS = @WEBKIT_LIBS@ +WEBKIT_REQUIRED_VERSION = @WEBKIT_REQUIRED_VERSION@ +WEBPDEMUX_CFLAGS = @WEBPDEMUX_CFLAGS@ +WEBPDEMUX_LIBS = @WEBPDEMUX_LIBS@ +WEBPMUX_CFLAGS = @WEBPMUX_CFLAGS@ +WEBPMUX_LIBS = @WEBPMUX_LIBS@ +WEBP_CFLAGS = @WEBP_CFLAGS@ +WEBP_LIBS = @WEBP_LIBS@ +WEBP_REQUIRED_VERSION = @WEBP_REQUIRED_VERSION@ +WEB_PAGE = @WEB_PAGE@ +WIN32_LARGE_ADDRESS_AWARE = @WIN32_LARGE_ADDRESS_AWARE@ +WINDRES = @WINDRES@ +WMF_CFLAGS = @WMF_CFLAGS@ +WMF_CONFIG = @WMF_CONFIG@ +WMF_LIBS = @WMF_LIBS@ +WMF_REQUIRED_VERSION = @WMF_REQUIRED_VERSION@ +XDG_EMAIL = @XDG_EMAIL@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_REQUIRED_VERSION = @XGETTEXT_REQUIRED_VERSION@ +XMC_CFLAGS = @XMC_CFLAGS@ +XMC_LIBS = @XMC_LIBS@ +XMKMF = @XMKMF@ +XMLLINT = @XMLLINT@ +XMU_LIBS = @XMU_LIBS@ +XPM_LIBS = @XPM_LIBS@ +XSLTPROC = @XSLTPROC@ +XVFB_RUN = @XVFB_RUN@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Z_LIBS = @Z_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gimpdatadir = @gimpdatadir@ +gimpdir = @gimpdir@ +gimplocaledir = @gimplocaledir@ +gimpplugindir = @gimpplugindir@ +gimpsysconfdir = @gimpsysconfdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = $(gimpplugindir)/plug-ins/help-browser +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +manpage_gimpdir = @manpage_gimpdir@ +mkdir_p = @mkdir_p@ +ms_librarian = @ms_librarian@ +mypaint_brushes_dir = @mypaint_brushes_dir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la +libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la +libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la +libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la +libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la +libgimpui = $(top_builddir)/libgimp/libgimpui-$(GIMP_API_VERSION).la +libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la +libgimphelp = $(top_builddir)/plug-ins/help/libgimphelp.a +@OS_WIN32_TRUE@mwindows = -mwindows +@HAVE_WINDRES_TRUE@GIMPPLUGINRC = $(top_builddir)/build/windows/gimp-plug-ins.rc +@HAVE_WINDRES_TRUE@help_browser_RC = help-browser.rc.o +AM_LDFLAGS = $(mwindows) +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + $(WEBKIT_CFLAGS) \ + $(GEGL_CFLAGS) \ + -I$(includedir) + +LDADD = \ + $(libgimphelp) \ + $(libgimpui) \ + $(libgimpwidgets) \ + $(libgimpconfig) \ + $(libgimp) \ + $(libgimpcolor) \ + $(libgimpmath) \ + $(libgimpbase) \ + $(WEBKIT_LIBS) \ + $(GIO_LIBS) \ + $(GLIB_LIBS) \ + $(RT_LIBS) \ + $(INTLLIBS) \ + $(help_browser_RC) + +help_browser_SOURCES = \ + gimpthrobber.c \ + gimpthrobber.h \ + gimpthrobberaction.c \ + gimpthrobberaction.h \ + help-browser.c \ + dialog.c \ + dialog.h \ + uri.c \ + uri.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/build/windows/gimprc-plug-ins.rule $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plug-ins/help-browser/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plug-ins/help-browser/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/build/windows/gimprc-plug-ins.rule $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +help-browser$(EXEEXT): $(help_browser_OBJECTS) $(help_browser_DEPENDENCIES) $(EXTRA_help_browser_DEPENDENCIES) + @rm -f help-browser$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(help_browser_OBJECTS) $(help_browser_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dialog.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpthrobber.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpthrobberaction.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help-browser.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uri.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(libexecdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/dialog.Po + -rm -f ./$(DEPDIR)/gimpthrobber.Po + -rm -f ./$(DEPDIR)/gimpthrobberaction.Po + -rm -f ./$(DEPDIR)/help-browser.Po + -rm -f ./$(DEPDIR)/uri.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/dialog.Po + -rm -f ./$(DEPDIR)/gimpthrobber.Po + -rm -f ./$(DEPDIR)/gimpthrobberaction.Po + -rm -f ./$(DEPDIR)/help-browser.Po + -rm -f ./$(DEPDIR)/uri.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libexecPROGRAMS clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libexecPROGRAMS \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-libexecPROGRAMS + +.PRECIOUS: Makefile + + +# `windres` seems a very stupid tool and it breaks with double shlashes +# in parameter paths. Strengthen the rule a little. +@HAVE_WINDRES_TRUE@%.rc.o: +@HAVE_WINDRES_TRUE@ $(WINDRES) --define ORIGINALFILENAME_STR="$*$(EXEEXT)" \ +@HAVE_WINDRES_TRUE@ --define INTERNALNAME_STR="$*" \ +@HAVE_WINDRES_TRUE@ --define TOP_SRCDIR="`echo $(top_srcdir) | sed 's*//*/*'`" \ +@HAVE_WINDRES_TRUE@ -I"`echo $(top_srcdir)/app | sed 's%/\+%/%'`" \ +@HAVE_WINDRES_TRUE@ -I"`echo $(top_builddir)/app | sed 's%/\+%/%'`"\ +@HAVE_WINDRES_TRUE@ -I"`echo $(top_builddir) | sed 's%/\+%/%'`"\ +@HAVE_WINDRES_TRUE@ $(GIMPPLUGINRC) $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plug-ins/help-browser/dialog.c b/plug-ins/help-browser/dialog.c new file mode 100644 index 0000000..af95ae9 --- /dev/null +++ b/plug-ins/help-browser/dialog.c @@ -0,0 +1,1255 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * GIMP Help Browser + * Copyright (C) 1999-2008 Sven Neumann + * Michael Natterer + * RĂ³man Joost + * + * dialog.c + * + * 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 3 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, see . + */ + +#include "config.h" + +#include +#include + +#include + +#include + +#include + +#include "libgimp/gimp.h" +#include "libgimp/gimpui.h" + +#include "plug-ins/help/gimphelp.h" + +#include "gimpthrobber.h" +#include "gimpthrobberaction.h" + +#include "dialog.h" +#include "uri.h" + +#include "libgimp/stdplugins-intl.h" + + +#define GIMP_HELP_BROWSER_DIALOG_DATA "gimp-help-browser-dialog" + +#define GIMP_HELP_BROWSER_INDEX_MAX_DEPTH 4 + + +typedef struct +{ + gint width; + gint height; + gint paned_position; + gboolean show_index; + gdouble zoom; +} DialogData; + +enum +{ + HISTORY_TITLE, + HISTORY_URI +}; + +/* local function prototypes */ + +static GtkUIManager * ui_manager_new (GtkWidget *window); + +static GtkWidget * build_searchbar (void); + +static void back_callback (GtkAction *action, + gpointer data); +static void forward_callback (GtkAction *action, + gpointer data); +static void reload_callback (GtkAction *action, + gpointer data); +static void stop_callback (GtkAction *action, + gpointer data); +static void home_callback (GtkAction *action, + gpointer data); +static void find_callback (GtkAction *action, + gpointer data); +static void find_again_callback (GtkAction *action, + gpointer data); +static void copy_location_callback (GtkAction *action, + gpointer data); +static void copy_selection_callback (GtkAction *action, + gpointer data); +static void show_index_callback (GtkAction *action, + gpointer data); +static void zoom_in_callback (GtkAction *action, + gpointer data); +static void zoom_out_callback (GtkAction *action, + gpointer data); +static void close_callback (GtkAction *action, + gpointer data); +static void website_callback (GtkAction *action, + gpointer data); + +static void update_actions (void); + +static void row_activated (GtkTreeView *tree_view, + GtkTreePath *path, + GtkTreeViewColumn *column); +static void dialog_unmap (GtkWidget *window, + GtkWidget *paned); + +static void view_realize (GtkWidget *widget); +static void view_unrealize (GtkWidget *widget); +static gboolean view_popup_menu (GtkWidget *widget, + GdkEventButton *event); +static gboolean view_button_press (GtkWidget *widget, + GdkEventButton *event); +static gboolean view_key_press (GtkWidget *widget, + GdkEventKey *event); + +static void title_changed (GtkWidget *view, + WebKitWebFrame *frame, + const gchar *title, + GtkWidget *window); +static void load_started (GtkWidget *view, + WebKitWebFrame *frame); +static void load_finished (GtkWidget *view, + WebKitWebFrame *frame); + +static void select_index (const gchar *uri); + +static void search_entry_changed (GtkWidget *entry); +static gboolean search_entry_key_press (GtkWidget *entry, + GdkEventKey *event); +static void search_prev_clicked (GtkWidget *button, + GtkWidget *entry); +static void search_next_clicked (GtkWidget *button, + GtkWidget *entry); +static void search_close_clicked (GtkWidget *button); +static void search (const gchar *text, + gboolean forward); + + +/* private variables */ + +static GHashTable *uri_hash_table = NULL; + +static GtkWidget *view = NULL; +static GtkWidget *sidebar = NULL; +static GtkWidget *searchbar = NULL; +static GtkWidget *tree_view = NULL; +static GtkUIManager *ui_manager = NULL; +static GtkWidget *button_prev = NULL; +static GtkWidget *button_next = NULL; +static GdkCursor *busy_cursor = NULL; + + +/* public functions */ + +void +browser_dialog_open (const gchar *plug_in_binary) +{ + GtkWidget *window; + GtkWidget *main_vbox; + GtkWidget *vbox; + GtkWidget *toolbar; + GtkWidget *paned; + GtkWidget *scrolled; + GtkToolItem *item; + GtkAction *action; + DialogData data = { 720, 560, 240, TRUE, 1.0 }; + + gimp_ui_init (plug_in_binary, TRUE); + + gimp_get_data (GIMP_HELP_BROWSER_DIALOG_DATA, &data); + + /* the dialog window */ + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), _("GIMP Help Browser")); + gtk_window_set_role (GTK_WINDOW (window), plug_in_binary); + gtk_window_set_icon_name (GTK_WINDOW (window), GIMP_ICON_HELP_USER_MANUAL); + + gtk_window_set_default_size (GTK_WINDOW (window), data.width, data.height); + + g_signal_connect (window, "destroy", + G_CALLBACK (gtk_main_quit), + NULL); + + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); + gtk_container_add (GTK_CONTAINER (window), vbox); + gtk_widget_show (vbox); + + ui_manager = ui_manager_new (window); + + toolbar = gtk_ui_manager_get_widget (ui_manager, "/help-browser-toolbar"); + gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS); + gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0); + gtk_widget_show (toolbar); + + item = g_object_new (GTK_TYPE_MENU_TOOL_BUTTON, NULL); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0); + gtk_widget_show (GTK_WIDGET (item)); + + action = gtk_ui_manager_get_action (ui_manager, + "/ui/help-browser-popup/forward"); + gtk_activatable_set_related_action (GTK_ACTIVATABLE (item), action); + g_object_notify (G_OBJECT (action), "tooltip"); + button_next = GTK_WIDGET (item); + + item = g_object_new (GTK_TYPE_MENU_TOOL_BUTTON, NULL); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0); + gtk_widget_show (GTK_WIDGET (item)); + + action = gtk_ui_manager_get_action (ui_manager, + "/ui/help-browser-popup/back"); + gtk_activatable_set_related_action (GTK_ACTIVATABLE (item), action); + g_object_notify (G_OBJECT (action), "tooltip"); + button_prev = GTK_WIDGET (item); + + item = + GTK_TOOL_ITEM (gtk_ui_manager_get_widget (ui_manager, + "/help-browser-toolbar/space")); + gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item), FALSE); + gtk_tool_item_set_expand (item, TRUE); + + /* the horizontal paned */ + paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); + gtk_box_pack_start (GTK_BOX (vbox), paned, TRUE, TRUE, 0); + gtk_widget_show (paned); + + scrolled = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_paned_add1 (GTK_PANED (paned), scrolled); + gtk_paned_set_position (GTK_PANED (paned), data.paned_position); + + sidebar = scrolled; + + if (data.show_index) + gtk_widget_show (sidebar); + + tree_view = gtk_tree_view_new (); + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE); + gtk_container_add (GTK_CONTAINER (scrolled), tree_view); + gtk_widget_show (tree_view); + + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), -1, + NULL, + gtk_cell_renderer_text_new (), + "text", 1, + NULL); + + g_signal_connect (tree_view, "row-activated", + G_CALLBACK (row_activated), + NULL); + + /* HTML view */ + main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_widget_show (main_vbox); + gtk_paned_pack2 (GTK_PANED (paned), main_vbox, TRUE, TRUE); + + scrolled = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + gtk_widget_set_size_request (scrolled, 300, 200); + gtk_box_pack_start (GTK_BOX (main_vbox), scrolled, TRUE, TRUE, 0); + gtk_widget_show (scrolled); + + view = webkit_web_view_new (); + webkit_web_view_set_maintains_back_forward_list (WEBKIT_WEB_VIEW (view), + TRUE); + gtk_container_add (GTK_CONTAINER (scrolled), view); + gtk_widget_show (view); + + g_signal_connect (view, "realize", + G_CALLBACK (view_realize), + NULL); + g_signal_connect (view, "unrealize", + G_CALLBACK (view_unrealize), + NULL); + + g_signal_connect (view, "popup-menu", + G_CALLBACK (view_popup_menu), + NULL); + g_signal_connect (view, "button-press-event", + G_CALLBACK (view_button_press), + NULL); + g_signal_connect (view, "key-press-event", + G_CALLBACK (view_key_press), + NULL); + + webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW (view), data.zoom); + + g_signal_connect (view, "title-changed", + G_CALLBACK (title_changed), + window); + + g_signal_connect (view, "load-started", + G_CALLBACK (load_started), + NULL); + g_signal_connect (view, "load-finished", + G_CALLBACK (load_finished), + NULL); + + gtk_widget_grab_focus (view); + + g_signal_connect (window, "unmap", + G_CALLBACK (dialog_unmap), + paned); + + update_actions (); + + /* Searchbar */ + searchbar = build_searchbar (); + gtk_box_pack_start (GTK_BOX (main_vbox), searchbar, FALSE, FALSE, 0); +} + +void +browser_dialog_load (const gchar *uri) +{ + g_return_if_fail (uri != NULL); + + webkit_web_view_load_uri (WEBKIT_WEB_VIEW (view), uri); + + select_index (uri); + + gtk_window_present (GTK_WINDOW (gtk_widget_get_toplevel (view))); +} + +static void +browser_dialog_make_index_foreach (const gchar *help_id, + GimpHelpItem *item, + GimpHelpLocale *locale) +{ + gchar *sort_key = item->title; + +#if DEBUG_SORT_HELP_ITEMS + g_printerr ("%s: processing %s (parent %s)\n", + G_STRFUNC, + item->title ? item->title : "NULL", + item->parent ? item->parent : "NULL"); +#endif + + if (item->sort && + g_regex_match_simple ("^[0-9]+([.][0-9]+)*$", item->sort, 0, 0)) + { + sort_key = item->sort; + +#if DEBUG_SORT_HELP_ITEMS + g_printerr ("%s: sort key = %s\n", G_STRFUNC, sort_key); +#endif + } + + item->index = 0; + + if (sort_key) + { + const gint max_tokens = GIMP_HELP_BROWSER_INDEX_MAX_DEPTH; + gchar* *indices = g_strsplit (sort_key, ".", max_tokens + 1); + gint i; + + for (i = 0; i < max_tokens; i++) + { + gunichar c; + + if (! indices[i]) + { + /* make sure that all item->index's are comparable */ + item->index <<= (8 * (max_tokens - i)); + break; + } + + item->index <<= 8; /* NOP if i = 0 */ + c = g_utf8_get_char (indices[i]); + if (g_unichar_isdigit (c)) + { + item->index += atoi (indices[i]); + } + else if (g_utf8_strlen (indices[i], -1) == 1) + { + item->index += (c & 0xFF); + } + } + + g_strfreev (indices); + +#if DEBUG_SORT_HELP_ITEMS + g_printerr ("%s: index = %lu\n", G_STRFUNC, item->index); +#endif + } + + if (item->parent && strlen (item->parent)) + { + GimpHelpItem *parent; + + parent = g_hash_table_lookup (locale->help_id_mapping, item->parent); + + if (parent) + { + parent->children = g_list_prepend (parent->children, item); + } + } + else + { + locale->toplevel_items = g_list_prepend (locale->toplevel_items, item); + } +} + +static gint +help_item_compare (gconstpointer a, + gconstpointer b) +{ + const GimpHelpItem *item_a = a; + const GimpHelpItem *item_b = b; + + if (item_a->index > item_b->index) + return 1; + else if (item_a->index < item_b->index) + return -1; + + return 0; +} + +static void +add_child (GtkTreeStore *store, + GimpHelpDomain *domain, + GimpHelpLocale *locale, + GtkTreeIter *parent, + GimpHelpItem *item, + gint depth) +{ + GtkTreeIter iter; + GList *list; + gchar *uri; + + gtk_tree_store_append (store, &iter, parent); + + gtk_tree_store_set (store, &iter, + 0, item, + 1, item->title, + -1); + + uri = g_strconcat (domain->help_uri, "/", + locale->locale_id, "/", + item->ref, + NULL); + + g_hash_table_insert (uri_hash_table, + uri, + gtk_tree_iter_copy (&iter)); + + if (depth + 1 == GIMP_HELP_BROWSER_INDEX_MAX_DEPTH) + return; + + item->children = g_list_sort (item->children, help_item_compare); + + for (list = item->children; list; list = g_list_next (list)) + { + GimpHelpItem *item = list->data; + + add_child (store, domain, locale, &iter, item, depth + 1); + } +} + +void +browser_dialog_make_index (GimpHelpDomain *domain, + GimpHelpLocale *locale) +{ + GtkTreeStore *store; + GList *list; + + if (! locale->toplevel_items) + { + g_hash_table_foreach (locale->help_id_mapping, + (GHFunc) browser_dialog_make_index_foreach, + locale); + + locale->toplevel_items = g_list_sort (locale->toplevel_items, + help_item_compare); + } + + store = gtk_tree_store_new (2, + G_TYPE_POINTER, + G_TYPE_STRING); + + g_object_set_data (G_OBJECT (store), "domain", domain); + g_object_set_data (G_OBJECT (store), "locale", locale); + + if (uri_hash_table) + g_hash_table_unref (uri_hash_table); + + uri_hash_table = g_hash_table_new_full (g_str_hash, + g_str_equal, + (GDestroyNotify) g_free, + (GDestroyNotify) gtk_tree_iter_free); + + for (list = locale->toplevel_items; list; list = g_list_next (list)) + { + GimpHelpItem *item = list->data; + + add_child (store, domain, locale, NULL, item, 0); + } + + gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (store)); + g_object_unref (store); +} + +static void +select_index (const gchar *uri) +{ + GtkTreeSelection *selection; + GtkTreeIter *iter = NULL; + + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)); + + if (uri) + iter = g_hash_table_lookup (uri_hash_table, uri); + + if (iter) + { + GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)); + GtkTreePath *path; + GtkTreePath *scroll_path; + + path = gtk_tree_model_get_path (model, iter); + scroll_path = gtk_tree_path_copy (path); + + gtk_tree_path_up (path); + gtk_tree_view_expand_to_path (GTK_TREE_VIEW (tree_view), path); + gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (tree_view), scroll_path, + NULL, FALSE, 0.0, 0.0); + + gtk_tree_path_free (path); + gtk_tree_path_free (scroll_path); + + gtk_tree_selection_select_iter (selection, iter); + } + else + { + gtk_tree_selection_unselect_all (selection); + } +} + + +/* private functions */ + +static GtkUIManager * +ui_manager_new (GtkWidget *window) +{ + static const GtkActionEntry actions[] = + { + { + "back", GIMP_ICON_GO_PREVIOUS, + NULL, "Left", N_("Go back one page"), + G_CALLBACK (back_callback) + }, + { + "forward", GIMP_ICON_GO_NEXT, + NULL, "Right", N_("Go forward one page"), + G_CALLBACK (forward_callback) + }, + { + "reload", GIMP_ICON_VIEW_REFRESH, + N_("_Reload"), "R", N_("Reload current page"), + G_CALLBACK (reload_callback) + }, + { + "stop", GIMP_ICON_PROCESS_STOP, + N_("_Stop"), "Escape", N_("Stop loading this page"), + G_CALLBACK (stop_callback) + }, + { + "home", GIMP_ICON_GO_HOME, + NULL, "Home", N_("Go to the index page"), + G_CALLBACK (home_callback) + }, + { + "copy-location", GIMP_ICON_EDIT_COPY, + N_("C_opy location"), "", + N_("Copy the location of this page to the clipboard"), + G_CALLBACK (copy_location_callback) + }, + { + "copy-selection", GIMP_ICON_EDIT_COPY, + NULL, "C", NULL, + G_CALLBACK (copy_selection_callback) + }, + { + "zoom-in", GIMP_ICON_ZOOM_IN, + NULL, "plus", NULL, + G_CALLBACK (zoom_in_callback) + }, + { + "zoom-out", GIMP_ICON_ZOOM_OUT, + NULL, "minus", NULL, + G_CALLBACK (zoom_out_callback) + }, + { + "find", GIMP_ICON_EDIT_FIND, + NULL, "F", N_("Find text in current page"), + G_CALLBACK (find_callback) + }, + { + "find-again", NULL, + N_("Find _Again"), "G", NULL, + G_CALLBACK (find_again_callback) + }, + { + "close", GIMP_ICON_WINDOW_CLOSE, + NULL, "W", NULL, + G_CALLBACK (close_callback) + }, + { + "quit", GIMP_ICON_APPLICATION_EXIT, + NULL, "Q", NULL, + G_CALLBACK (close_callback) + } + }; + + static const GtkToggleActionEntry toggle_actions[] = + { + { + "show-index", NULL, + N_("S_how Index"), "I", + N_("Toggle the visibility of the sidebar"), + G_CALLBACK (show_index_callback), FALSE + } + }; + + GtkUIManager *ui_manager = gtk_ui_manager_new (); + GtkActionGroup *group = gtk_action_group_new ("Actions"); + GtkAction *action; + GError *error = NULL; + + gtk_action_group_set_translation_domain (group, NULL); + gtk_action_group_add_actions (group, + actions, G_N_ELEMENTS (actions), + NULL); + gtk_action_group_add_toggle_actions (group, + toggle_actions, + G_N_ELEMENTS (toggle_actions), + NULL); + + action = gimp_throbber_action_new ("website", + "docs.gimp.org", + _("Visit the GIMP documentation website"), + GIMP_ICON_HELP_USER_MANUAL); + g_signal_connect_closure (action, "activate", + g_cclosure_new (G_CALLBACK (website_callback), + NULL, NULL), + FALSE); + gtk_action_group_add_action (group, action); + g_object_unref (action); + + gtk_window_add_accel_group (GTK_WINDOW (window), + gtk_ui_manager_get_accel_group (ui_manager)); + gtk_accel_group_lock (gtk_ui_manager_get_accel_group (ui_manager)); + + gtk_ui_manager_insert_action_group (ui_manager, group, -1); + g_object_unref (group); + + gtk_ui_manager_add_ui_from_string (ui_manager, + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + "", + -1, &error); + + if (error) + { + g_warning ("error parsing ui: %s", error->message); + g_clear_error (&error); + } + + gtk_ui_manager_add_ui_from_string (ui_manager, + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "", + -1, &error); + + if (error) + { + g_warning ("error parsing ui: %s", error->message); + g_clear_error (&error); + } + + gtk_ui_manager_add_ui_from_string (ui_manager, + "" + " " + " " + " " + "", + -1, &error); + + if (error) + { + g_warning ("error parsing ui: %s", error->message); + g_clear_error (&error); + } + + return ui_manager; +} + +static void +back_callback (GtkAction *action, + gpointer data) +{ + webkit_web_view_go_back (WEBKIT_WEB_VIEW (view)); +} + +static void +forward_callback (GtkAction *action, + gpointer data) +{ + webkit_web_view_go_forward (WEBKIT_WEB_VIEW (view)); +} + +static void +reload_callback (GtkAction *action, + gpointer data) +{ + webkit_web_view_reload (WEBKIT_WEB_VIEW (view)); +} + +static void +stop_callback (GtkAction *action, + gpointer data) +{ + webkit_web_view_stop_loading (WEBKIT_WEB_VIEW (view)); +} + +static void +home_callback (GtkAction *action, + gpointer data) +{ + GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)); + GimpHelpDomain *domain = g_object_get_data (G_OBJECT (model), "domain"); + GimpHelpLocale *locale = g_object_get_data (G_OBJECT (model), "locale"); + + if (domain && locale) + { + gchar *uri = g_strconcat (domain->help_uri, "/", + locale->locale_id, "/", + gimp_help_locale_map (locale, + GIMP_HELP_DEFAULT_ID), + NULL); + browser_dialog_load (uri); + g_free (uri); + } +} + +static void +find_callback (GtkAction *action, + gpointer data) +{ + GtkWidget *entry = g_object_get_data (G_OBJECT (searchbar), "entry"); + + gtk_widget_show (searchbar); + gtk_widget_grab_focus (entry); +} + +static void +find_again_callback (GtkAction *action, + gpointer data) +{ + GtkWidget *entry = g_object_get_data (G_OBJECT (searchbar), "entry"); + + gtk_widget_show (searchbar); + gtk_widget_grab_focus (entry); + + search (gtk_entry_get_text (GTK_ENTRY (entry)), TRUE); +} + +static void +copy_location_callback (GtkAction *action, + gpointer data) +{ + WebKitWebFrame *frame; + const gchar *uri; + + frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view)); + uri = webkit_web_frame_get_uri (frame); + + if (uri) + { + GtkClipboard *clipboard; + + clipboard = gtk_clipboard_get_for_display (gtk_widget_get_display (view), + GDK_SELECTION_CLIPBOARD); + gtk_clipboard_set_text (clipboard, uri, -1); + } +} + +static void +copy_selection_callback (GtkAction *action, + gpointer data) +{ + if (webkit_web_view_can_copy_clipboard (WEBKIT_WEB_VIEW (view))) + { + webkit_web_view_copy_clipboard (WEBKIT_WEB_VIEW (view)); + } +} + +static void +show_index_callback (GtkAction *action, + gpointer data) +{ + gtk_widget_set_visible (sidebar, + gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); +} + +static void +zoom_in_callback (GtkAction *action, + gpointer data) +{ + webkit_web_view_zoom_in (WEBKIT_WEB_VIEW (view)); +} + +static void +zoom_out_callback (GtkAction *action, + gpointer data) +{ + webkit_web_view_zoom_out (WEBKIT_WEB_VIEW (view)); +} + +static void +website_callback (GtkAction *action, + gpointer data) +{ + browser_dialog_load ("https://docs.gimp.org/"); +} + +static void +close_callback (GtkAction *action, + gpointer data) +{ + gtk_widget_destroy (gtk_widget_get_toplevel (view)); +} + +static void +menu_callback (GtkWidget *menu, + gpointer data) +{ + gint steps = GPOINTER_TO_INT (data); + + webkit_web_view_go_back_or_forward (WEBKIT_WEB_VIEW (view), steps); +} + +static GtkWidget * +build_menu (const GList *items, + gboolean back) +{ + GtkWidget *menu; + const GList *iter; + gint steps; + + if (! items) + return NULL; + + menu = gtk_menu_new (); + + for (iter = items, steps = 1; iter; iter = g_list_next (iter), steps++) + { + WebKitWebHistoryItem *item = iter->data; + const gchar *title; + + title = webkit_web_history_item_get_title (item); + + if (title) + { + GtkWidget *menu_item = gtk_menu_item_new_with_label (title); + + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); + gtk_widget_show (menu_item); + + g_signal_connect (menu_item, "activate", + G_CALLBACK (menu_callback), + GINT_TO_POINTER (back ? - steps : steps)); + } + } + + return menu; +} + +static void +update_actions (void) +{ + GtkAction *action; + WebKitWebBackForwardList *back_forward_list; + WebKitWebFrame *frame; + + back_forward_list = + webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (view)); + + /* update the back button and its menu */ + + action = gtk_ui_manager_get_action (ui_manager, + "/ui/help-browser-popup/back"); + gtk_action_set_sensitive (action, + webkit_web_view_can_go_back (WEBKIT_WEB_VIEW (view))); + + if (back_forward_list) + { + const GList *list; + + list = webkit_web_back_forward_list_get_back_list_with_limit (back_forward_list, + 12); + gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (button_prev), + build_menu (list, TRUE)); + } + else + { + gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (button_prev), NULL); + } + + /* update the forward button and its menu */ + + action = gtk_ui_manager_get_action (ui_manager, + "/ui/help-browser-popup/forward"); + gtk_action_set_sensitive (action, + webkit_web_view_can_go_forward (WEBKIT_WEB_VIEW (view))); + + if (back_forward_list) + { + const GList *list; + + list = webkit_web_back_forward_list_get_forward_list_with_limit (back_forward_list, + 12); + gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (button_next), + build_menu (list, FALSE)); + } + else + { + gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (button_next), NULL); + } + + /* update the copy-location action */ + action = gtk_ui_manager_get_action (ui_manager, + "/ui/help-browser-popup/copy-location"); + + frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view)); + gtk_action_set_sensitive (action, webkit_web_frame_get_uri (frame) != NULL); + + /* update the show-index action */ + action = gtk_ui_manager_get_action (ui_manager, + "/ui/help-browser-popup/show-index"); + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), + gtk_widget_get_visible (sidebar)); +} + +static void +row_activated (GtkTreeView *tree_view, + GtkTreePath *path, + GtkTreeViewColumn *column) +{ + GtkTreeModel *model = gtk_tree_view_get_model (tree_view); + GtkTreeIter iter; + GimpHelpDomain *domain; + GimpHelpLocale *locale; + GimpHelpItem *item; + gchar *uri; + + gtk_tree_model_get_iter (model, &iter, path); + + gtk_tree_model_get (model, &iter, + 0, &item, + -1); + + domain = g_object_get_data (G_OBJECT (model), "domain"); + locale = g_object_get_data (G_OBJECT (model), "locale"); + + uri = g_strconcat (domain->help_uri, "/", + locale->locale_id, "/", + item->ref, + NULL); + + browser_dialog_load (uri); + + g_free (uri); +} + +static void +dialog_unmap (GtkWidget *window, + GtkWidget *paned) +{ + DialogData data; + + gtk_window_get_size (GTK_WINDOW (window), &data.width, &data.height); + + data.paned_position = gtk_paned_get_position (GTK_PANED (paned)); + data.show_index = gtk_widget_get_visible (sidebar); + + data.zoom = (view ? + webkit_web_view_get_zoom_level (WEBKIT_WEB_VIEW (view)) : 1.0); + + gimp_set_data (GIMP_HELP_BROWSER_DIALOG_DATA, &data, sizeof (data)); + + gtk_main_quit (); +} + +static void +view_realize (GtkWidget *widget) +{ + g_return_if_fail (busy_cursor == NULL); + + busy_cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), + GDK_WATCH); +} + +static void +view_unrealize (GtkWidget *widget) +{ + if (busy_cursor) + { + gdk_cursor_unref (busy_cursor); + busy_cursor = NULL; + } +} + +static gboolean +view_popup_menu (GtkWidget *widget, + GdkEventButton *event) +{ + GtkWidget *menu; + const gchar *path; + + if (webkit_web_view_can_copy_clipboard (WEBKIT_WEB_VIEW (view))) + path = "/help-browser-copy-popup"; + else + path = "/help-browser-popup"; + + menu = gtk_ui_manager_get_widget (ui_manager, path); + + gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (widget)); + gtk_menu_popup (GTK_MENU (menu), + NULL, NULL, NULL, NULL, + event ? event->button : 0, + event ? event->time : gtk_get_current_event_time ()); + + return TRUE; +} + +static gboolean +view_button_press (GtkWidget *widget, + GdkEventButton *event) +{ + if (gdk_event_triggers_context_menu ((GdkEvent *) event)) + return view_popup_menu (widget, event); + + return FALSE; +} + +static gboolean +view_key_press (GtkWidget *widget, + GdkEventKey *event) +{ + if (event->keyval == GDK_KEY_slash) + { + GtkAction *action; + + action = gtk_ui_manager_get_action (ui_manager, + "/ui/help-browser-popup/find"); + gtk_action_activate (action); + + return TRUE; + } + + return FALSE; +} + +static void +title_changed (GtkWidget *view, + WebKitWebFrame *frame, + const gchar *title, + GtkWidget *window) +{ + gchar *full_title; + + full_title = g_strdup_printf ("%s - %s", + title ? title : _("Untitled"), + _("GIMP Help Browser")); + + gtk_window_set_title (GTK_WINDOW (window), full_title); + g_free (full_title); + + update_actions (); +} + +static void +load_started (GtkWidget *view, + WebKitWebFrame *frame) +{ + GtkAction *action = gtk_ui_manager_get_action (ui_manager, + "/ui/help-browser-popup/stop"); + gtk_action_set_sensitive (action, TRUE); +} + +static void +load_finished (GtkWidget *view, + WebKitWebFrame *frame) +{ + GtkAction *action = gtk_ui_manager_get_action (ui_manager, + "/ui/help-browser-popup/stop"); + gtk_action_set_sensitive (action, FALSE); + + update_actions (); + + select_index (webkit_web_frame_get_uri (frame)); +} + +static GtkWidget * +build_searchbar (void) +{ + GtkWidget *button; + GtkWidget *entry; + GtkWidget *hbox; + GtkWidget *label; + + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); + + label = gtk_label_new (_("Find:")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + entry = gtk_entry_new (); + gtk_widget_show (entry); + gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); + g_object_set_data (G_OBJECT (hbox), "entry", entry); + + g_signal_connect (entry, "changed", + G_CALLBACK (search_entry_changed), + NULL); + + g_signal_connect (entry, "key-press-event", + G_CALLBACK (search_entry_key_press), + NULL); + + button = gtk_button_new_with_mnemonic (C_("search", "_Previous")); + gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); + gtk_button_set_image (GTK_BUTTON (button), + gtk_image_new_from_icon_name (GIMP_ICON_GO_PREVIOUS, + GTK_ICON_SIZE_BUTTON)); + gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); + gtk_widget_show (button); + + g_signal_connect (button, "clicked", + G_CALLBACK (search_prev_clicked), + entry); + + button = gtk_button_new_with_mnemonic (C_("search", "_Next")); + gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); + gtk_button_set_image (GTK_BUTTON (button), + gtk_image_new_from_icon_name (GIMP_ICON_GO_NEXT, + GTK_ICON_SIZE_BUTTON)); + gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); + gtk_widget_show (button); + + g_signal_connect (button, "clicked", + G_CALLBACK (search_next_clicked), + entry); + + button = gtk_button_new_with_mnemonic (C_("search", "_Close")); + gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); + gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0); + gtk_widget_show (button); + + g_signal_connect (button, "clicked", + G_CALLBACK (search_close_clicked), + NULL); + + return hbox; +} + +static void +search_entry_changed (GtkWidget *entry) +{ + search (gtk_entry_get_text (GTK_ENTRY (entry)), TRUE); +} + +static gboolean +search_entry_key_press (GtkWidget *entry, + GdkEventKey *event) +{ + switch (event->keyval) + { + case GDK_KEY_Escape: + gtk_widget_hide (searchbar); + webkit_web_view_unmark_text_matches (WEBKIT_WEB_VIEW (view)); + return TRUE; + + case GDK_KEY_Return: + case GDK_KEY_KP_Enter: + case GDK_KEY_ISO_Enter: + search (gtk_entry_get_text (GTK_ENTRY (entry)), TRUE); + return TRUE; + } + + return FALSE; +} + +static void +search_prev_clicked (GtkWidget *button, + GtkWidget *entry) +{ + search (gtk_entry_get_text (GTK_ENTRY (entry)), FALSE); +} + +static void +search_next_clicked (GtkWidget *button, + GtkWidget *entry) +{ + search (gtk_entry_get_text (GTK_ENTRY (entry)), TRUE); +} + +static void +search (const gchar *text, + gboolean forward) +{ + if (text) + webkit_web_view_search_text (WEBKIT_WEB_VIEW (view), + text, FALSE, forward, TRUE); +} + +static void +search_close_clicked (GtkWidget *button) +{ + gtk_widget_hide (searchbar); + webkit_web_view_unmark_text_matches (WEBKIT_WEB_VIEW (view)); +} diff --git a/plug-ins/help-browser/dialog.h b/plug-ins/help-browser/dialog.h new file mode 100644 index 0000000..a895af9 --- /dev/null +++ b/plug-ins/help-browser/dialog.h @@ -0,0 +1,35 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * The GIMP Help Browser + * Copyright (C) 1999-2003 Sven Neumann + * Michael Natterer + * + * dialog.h + * + * 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 3 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, see . + */ + +#ifndef __DIALOG_H__ +#define __DIALOG_H__ + + +void browser_dialog_open (const gchar *plug_in_binary); +void browser_dialog_load (const gchar *uri); + +void browser_dialog_make_index (GimpHelpDomain *domain, + GimpHelpLocale *locale); + + +#endif /* ! __DIALOG_H__ */ diff --git a/plug-ins/help-browser/gimpthrobber.c b/plug-ins/help-browser/gimpthrobber.c new file mode 100644 index 0000000..81866f3 --- /dev/null +++ b/plug-ins/help-browser/gimpthrobber.c @@ -0,0 +1,366 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * GimpThrobber + * Copyright (C) 2005 Sven Neumann + * + * 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 3 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, see . + */ + +#include "config.h" + +#include + +#include "gimpthrobber.h" + + +enum +{ + CLICKED, + LAST_SIGNAL +}; + +enum +{ + PROP_0, + PROP_ICON_NAME, + PROP_IMAGE +}; + + +static void gimp_throbber_class_init (GimpThrobberClass *klass); + +static void gimp_throbber_init (GimpThrobber *button); + +static void gimp_throbber_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_throbber_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void gimp_throbber_finalize (GObject *object); + +static gboolean gimp_throbber_create_menu_proxy (GtkToolItem *tool_item); +static void gimp_throbber_toolbar_reconfigured (GtkToolItem *tool_item); +static void gimp_throbber_button_clicked (GtkWidget *widget, + GimpThrobber *button); + +static void gimp_throbber_construct_contents (GtkToolItem *tool_item); + + +static GObjectClass *parent_class = NULL; +static guint toolbutton_signals[LAST_SIGNAL] = { 0 }; + + +#define GIMP_THROBBER_GET_PRIVATE(obj)(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GIMP_TYPE_THROBBER, GimpThrobberPrivate)) + + +struct _GimpThrobberPrivate +{ + GtkWidget *button; + GtkWidget *image; + gchar *icon_name; +}; + + +GType +gimp_throbber_get_type (void) +{ + static GType type = 0; + + if (!type) + { + static const GTypeInfo type_info = + { + sizeof (GimpThrobberClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_throbber_class_init, + (GClassFinalizeFunc) NULL, + NULL, + sizeof (GimpThrobber), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_throbber_init, + }; + + type = g_type_register_static (GTK_TYPE_TOOL_ITEM, + "GimpThrobber", + &type_info, 0); + } + + return type; +} + +static void +gimp_throbber_class_init (GimpThrobberClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkToolItemClass *tool_item_class = GTK_TOOL_ITEM_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + object_class->set_property = gimp_throbber_set_property; + object_class->get_property = gimp_throbber_get_property; + object_class->finalize = gimp_throbber_finalize; + + tool_item_class->create_menu_proxy = gimp_throbber_create_menu_proxy; + tool_item_class->toolbar_reconfigured = gimp_throbber_toolbar_reconfigured; + + g_object_class_install_property (object_class, + PROP_ICON_NAME, + g_param_spec_string ("icon-name", NULL, NULL, + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT)); + + g_object_class_install_property (object_class, + PROP_IMAGE, + g_param_spec_object ("image", NULL, NULL, + GTK_TYPE_IMAGE, + G_PARAM_READWRITE)); + + toolbutton_signals[CLICKED] = + g_signal_new ("clicked", + G_OBJECT_CLASS_TYPE (klass), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GimpThrobberClass, clicked), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + g_type_class_add_private (object_class, sizeof (GimpThrobberPrivate)); +} + +static void +gimp_throbber_init (GimpThrobber *button) +{ + GtkToolItem *toolitem = GTK_TOOL_ITEM (button); + + button->priv = GIMP_THROBBER_GET_PRIVATE (button); + + gtk_tool_item_set_homogeneous (toolitem, TRUE); + + button->priv->button = g_object_new (GTK_TYPE_BUTTON, + "yalign", 0.0, + "focus-on-click", FALSE, + NULL); + + g_signal_connect_object (button->priv->button, "clicked", + G_CALLBACK (gimp_throbber_button_clicked), + button, 0); + + gtk_container_add (GTK_CONTAINER (button), button->priv->button); + gtk_widget_show (button->priv->button); +} + +static void +gimp_throbber_construct_contents (GtkToolItem *tool_item) +{ + GimpThrobber *button = GIMP_THROBBER (tool_item); + GtkWidget *image; + GtkToolbarStyle style; + + if (button->priv->image && gtk_widget_get_parent (button->priv->image)) + gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (button->priv->image)), + button->priv->image); + + if (gtk_bin_get_child (GTK_BIN (button->priv->button))) + gtk_widget_destroy (gtk_bin_get_child (GTK_BIN (button->priv->button))); + + style = gtk_tool_item_get_toolbar_style (tool_item); + + if (style == GTK_TOOLBAR_TEXT) + { + image = gtk_image_new_from_icon_name (button->priv->icon_name, + GTK_ICON_SIZE_MENU); + } + else if (style == GTK_TOOLBAR_ICONS) + { + image = gtk_image_new_from_icon_name (button->priv->icon_name, + GTK_ICON_SIZE_LARGE_TOOLBAR); + } + else if (button->priv->image) + { + image = button->priv->image; + } + else + { + image = gtk_image_new_from_icon_name (button->priv->icon_name, + GTK_ICON_SIZE_DND); + } + + gtk_container_add (GTK_CONTAINER (button->priv->button), image); + gtk_widget_show (image); + + gtk_button_set_relief (GTK_BUTTON (button->priv->button), + gtk_tool_item_get_relief_style (tool_item)); + + gtk_widget_queue_resize (GTK_WIDGET (button)); +} + +static void +gimp_throbber_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GimpThrobber *button = GIMP_THROBBER (object); + + switch (prop_id) + { + case PROP_ICON_NAME: + gimp_throbber_set_icon_name (button, g_value_get_string (value)); + break; + + case PROP_IMAGE: + gimp_throbber_set_image (button, g_value_get_object (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gimp_throbber_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GimpThrobber *button = GIMP_THROBBER (object); + + switch (prop_id) + { + case PROP_ICON_NAME: + g_value_set_string (value, button->priv->icon_name); + break; + + case PROP_IMAGE: + g_value_set_object (value, button->priv->image); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gimp_throbber_finalize (GObject *object) +{ + GimpThrobber *button = GIMP_THROBBER (object); + + if (button->priv->icon_name) + g_free (button->priv->icon_name); + + if (button->priv->image) + g_object_unref (button->priv->image); + + parent_class->finalize (object); +} + +static void +gimp_throbber_button_clicked (GtkWidget *widget, + GimpThrobber *button) +{ + g_signal_emit_by_name (button, "clicked"); +} + +static gboolean +gimp_throbber_create_menu_proxy (GtkToolItem *tool_item) +{ + gtk_tool_item_set_proxy_menu_item (tool_item, "gimp-throbber-menu-id", NULL); + + return FALSE; +} + +static void +gimp_throbber_toolbar_reconfigured (GtkToolItem *tool_item) +{ + gimp_throbber_construct_contents (tool_item); +} + +GtkToolItem * +gimp_throbber_new (const gchar *icon_name) +{ + return g_object_new (GIMP_TYPE_THROBBER, + "icon-name", icon_name, + NULL); +} + +void +gimp_throbber_set_icon_name (GimpThrobber *button, + const gchar *icon_name) +{ + gchar *old_icon_name; + + g_return_if_fail (GIMP_IS_THROBBER (button)); + + old_icon_name = button->priv->icon_name; + + button->priv->icon_name = g_strdup (icon_name); + gimp_throbber_construct_contents (GTK_TOOL_ITEM (button)); + + g_object_notify (G_OBJECT (button), "icon-name"); + + g_free (old_icon_name); +} + +const gchar * +gimp_throbber_get_icon_name (GimpThrobber *button) +{ + g_return_val_if_fail (GIMP_IS_THROBBER (button), NULL); + + return button->priv->icon_name; +} + +void +gimp_throbber_set_image (GimpThrobber *button, + GtkWidget *image) +{ + g_return_if_fail (GIMP_IS_THROBBER (button)); + g_return_if_fail (image == NULL || GTK_IS_IMAGE (image)); + + if (image != button->priv->image) + { + if (button->priv->image) + { + if (gtk_widget_get_parent (button->priv->image)) + gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (button->priv->image)), + button->priv->image); + + g_object_unref (button->priv->image); + } + + if (image) + g_object_ref_sink (image); + + button->priv->image = image; + + gimp_throbber_construct_contents (GTK_TOOL_ITEM (button)); + + g_object_notify (G_OBJECT (button), "image"); + } +} + +GtkWidget * +gimp_throbber_get_image (GimpThrobber *button) +{ + g_return_val_if_fail (GIMP_IS_THROBBER (button), NULL); + + return button->priv->image; +} diff --git a/plug-ins/help-browser/gimpthrobber.h b/plug-ins/help-browser/gimpthrobber.h new file mode 100644 index 0000000..215fdff --- /dev/null +++ b/plug-ins/help-browser/gimpthrobber.h @@ -0,0 +1,68 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * GimpThrobber + * Copyright (C) 2005 Sven Neumann + * + * 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 3 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, see . + */ + +#ifndef __GIMP_THROBBER_H__ +#define __GIMP_THROBBER_H__ + +G_BEGIN_DECLS + + +#define GIMP_TYPE_THROBBER (gimp_throbber_get_type ()) +#define GIMP_THROBBER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_THROBBER, GimpThrobber)) +#define GIMP_THROBBER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_THROBBER, GimpThrobberClass)) +#define GIMP_IS_THROBBER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_THROBBER)) +#define GIMP_IS_THROBBER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_THROBBER)) +#define GIMP_THROBBER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GIMP_TYPE_THROBBER, GimpThrobberClass)) + + +typedef struct _GimpThrobber GimpThrobber; +typedef struct _GimpThrobberClass GimpThrobberClass; +typedef struct _GimpThrobberPrivate GimpThrobberPrivate; + +struct _GimpThrobber +{ + GtkToolItem parent; + + /*< private >*/ + GimpThrobberPrivate *priv; +}; + +struct _GimpThrobberClass +{ + GtkToolItemClass parent_class; + + /* signal */ + void (* clicked) (GimpThrobber *button); +}; + +GType gimp_throbber_get_type (void) G_GNUC_CONST; + +GtkToolItem * gimp_throbber_new (const gchar *icon_name); +void gimp_throbber_set_icon_name (GimpThrobber *button, + const gchar *icon_name); +const gchar * gimp_throbber_get_icon_name (GimpThrobber *button); +void gimp_throbber_set_image (GimpThrobber *button, + GtkWidget *image); +GtkWidget * gimp_throbber_get_image (GimpThrobber *button); + + +G_END_DECLS + +#endif /* __GIMP_THROBBER_H__ */ diff --git a/plug-ins/help-browser/gimpthrobberaction.c b/plug-ins/help-browser/gimpthrobberaction.c new file mode 100644 index 0000000..56f617f --- /dev/null +++ b/plug-ins/help-browser/gimpthrobberaction.c @@ -0,0 +1,133 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * GimpThrobberAction + * Copyright (C) 2005 Sven Neumann + * + * 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 3 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, see . + */ + +#include "config.h" + +#include + +#include "gimpthrobberaction.h" +#include "gimpthrobber.h" + + + +static void gimp_throbber_action_class_init (GimpThrobberActionClass *klass); + +static void gimp_throbber_action_connect_proxy (GtkAction *action, + GtkWidget *proxy); +static void gimp_throbber_action_sync_property (GtkAction *action, + GParamSpec *pspec, + GtkWidget *proxy); + + +static GtkActionClass *parent_class = NULL; + + +GType +gimp_throbber_action_get_type (void) +{ + static GType type = 0; + + if (!type) + { + static const GTypeInfo type_info = + { + sizeof (GtkActionClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_throbber_action_class_init, + (GClassFinalizeFunc) NULL, + NULL, + sizeof (GtkAction), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL + }; + + type = g_type_register_static (GTK_TYPE_ACTION, + "GimpThrobberAction", + &type_info, 0); + } + + return type; +} + +static void +gimp_throbber_action_class_init (GimpThrobberActionClass *klass) +{ + GtkActionClass *action_class = GTK_ACTION_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + action_class->connect_proxy = gimp_throbber_action_connect_proxy; + action_class->toolbar_item_type = GIMP_TYPE_THROBBER; +} + +static void +gimp_throbber_action_connect_proxy (GtkAction *action, + GtkWidget *proxy) +{ + + GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy); + + if (GIMP_IS_THROBBER (proxy)) + { + GParamSpec *pspec; + + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (action), + "icon-name"); + + gimp_throbber_action_sync_property (action, pspec, proxy); + g_signal_connect_object (action, "notify::icon-name", + G_CALLBACK (gimp_throbber_action_sync_property), + proxy, 0); + + g_signal_connect_object (proxy, "clicked", + G_CALLBACK (gtk_action_activate), action, + G_CONNECT_SWAPPED); + } +} + +static void +gimp_throbber_action_sync_property (GtkAction *action, + GParamSpec *pspec, + GtkWidget *proxy) +{ + const gchar *property = g_param_spec_get_name (pspec); + GValue value = G_VALUE_INIT; + + g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); + g_object_get_property (G_OBJECT (action), property, &value); + + g_object_set_property (G_OBJECT (proxy), property, &value); + g_value_unset (&value); +} + +GtkAction * +gimp_throbber_action_new (const gchar *name, + const gchar *label, + const gchar *tooltip, + const gchar *icon_name) +{ + return g_object_new (GIMP_TYPE_THROBBER_ACTION, + "name", name, + "label", label, + "tooltip", tooltip, + "icon-name", icon_name, + NULL); +} diff --git a/plug-ins/help-browser/gimpthrobberaction.h b/plug-ins/help-browser/gimpthrobberaction.h new file mode 100644 index 0000000..502a32b --- /dev/null +++ b/plug-ins/help-browser/gimpthrobberaction.h @@ -0,0 +1,48 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * GimpThrobberAction + * Copyright (C) 2005 Sven Neumann + * + * 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 3 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, see . + */ + +#ifndef __GIMP_THROBBER_ACTION_H__ +#define __GIMP_THROBBER_ACTION_H__ + +G_BEGIN_DECLS + +#define GIMP_TYPE_THROBBER_ACTION (gimp_throbber_action_get_type ()) +#define GIMP_THROBBER_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_THROBBER_ACTION, GimpThrobberAction)) +#define GIMP_THROBBER_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_THROBBER_ACTION, GimpThrobberActionClass)) +#define GIMP_IS_THROBBER_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_THROBBER_ACTION)) +#define GIMP_IS_THROBBER_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GIMP_TYPE_THROBBER_ACTION)) +#define GIMP_THROBBER_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GIMP_TYPE_THROBBER_ACTION, GimpThrobberActionClass)) + + +typedef GtkAction GimpThrobberAction; +typedef GtkActionClass GimpThrobberActionClass; + + +GType gimp_throbber_action_get_type (void) G_GNUC_CONST; + +GtkAction * gimp_throbber_action_new (const gchar *name, + const gchar *label, + const gchar *tooltip, + const gchar *icon_name); + + +G_END_DECLS + +#endif /* __GIMP_THROBBER_ACTION_H__ */ diff --git a/plug-ins/help-browser/help-browser.c b/plug-ins/help-browser/help-browser.c new file mode 100644 index 0000000..35a2ea6 --- /dev/null +++ b/plug-ins/help-browser/help-browser.c @@ -0,0 +1,322 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * The GIMP Help Browser + * Copyright (C) 1999-2008 Sven Neumann + * Michael Natterer + * Henrik Brix Andersen + * + * Some code & ideas taken from the GNOME help browser. + * + * 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 3 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, see . + */ + +#include "config.h" + +#include /* strlen, strcmp */ + +#include + +#include + +#include "plug-ins/help/gimphelp.h" + +#include "dialog.h" + +#include "libgimp/stdplugins-intl.h" + + +/* defines */ + +#define GIMP_HELP_BROWSER_EXT_PROC "extension-gimp-help-browser" +#define GIMP_HELP_BROWSER_TEMP_EXT_PROC "extension-gimp-help-browser-temp" +#define PLUG_IN_BINARY "help-browser" +#define PLUG_IN_ROLE "gimp-help-browser" + + +/* forward declarations */ + +static void query (void); +static void run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); + +static void temp_proc_install (void); +static void temp_proc_run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); + +static gboolean help_browser_show_help (const gchar *help_domain, + const gchar *help_locales, + const gchar *help_id); + +static GimpHelpProgress * help_browser_progress_new (void); + + +/* local variables */ + +const GimpPlugInInfo PLUG_IN_INFO = +{ + NULL, /* init_proc */ + NULL, /* quit_proc */ + query, /* query_proc */ + run, /* run_proc */ +}; + + +MAIN () + +static void +query (void) +{ + static const GimpParamDef args[] = + { + { GIMP_PDB_INT32, "run-mode", "The run mode { RUN-INTERACTIVE (0) }" }, + { GIMP_PDB_INT32, "num-domain-names", "" }, + { GIMP_PDB_STRINGARRAY, "domain-names", "" }, + { GIMP_PDB_INT32, "num-domain-uris", "" }, + { GIMP_PDB_STRINGARRAY, "domain-uris", "" } + }; + + gimp_install_procedure (GIMP_HELP_BROWSER_EXT_PROC, + "Browse the GIMP user manual", + "A small and simple HTML browser optimized for " + "browsing the GIMP user manual.", + "Sven Neumann , " + "Michael Natterer " + "Henrik Brix Andersen ", + "Sven Neumann, Michael Natterer & Henrik Brix Andersen", + "1999-2008", + NULL, + "", + GIMP_EXTENSION, + G_N_ELEMENTS (args), 0, + args, NULL); +} + +static void +run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals) +{ + GimpRunMode run_mode = param[0].data.d_int32; + GimpPDBStatusType status = GIMP_PDB_SUCCESS; + + static GimpParam values[1]; + + values[0].type = GIMP_PDB_STATUS; + values[0].data.d_status = status; + + *nreturn_vals = 1; + *return_vals = values; + + INIT_I18N (); + + switch (run_mode) + { + case GIMP_RUN_INTERACTIVE: + case GIMP_RUN_NONINTERACTIVE: + case GIMP_RUN_WITH_LAST_VALS: + /* Make sure all the arguments are there! */ + if (nparams >= 1) + { + if (nparams == 5) + { + if (! gimp_help_init (param[1].data.d_int32, + param[2].data.d_stringarray, + param[3].data.d_int32, + param[4].data.d_stringarray)) + { + status = GIMP_PDB_CALLING_ERROR; + } + } + + if (status == GIMP_PDB_SUCCESS) + { + browser_dialog_open (PLUG_IN_BINARY); + + temp_proc_install (); + + gimp_extension_ack (); + gimp_extension_enable (); + + gtk_main (); + } + } + else + { + status = GIMP_PDB_CALLING_ERROR; + } + break; + + default: + status = GIMP_PDB_CALLING_ERROR; + break; + } + + values[0].data.d_status = status; +} + +static void +temp_proc_install (void) +{ + static const GimpParamDef args[] = + { + { GIMP_PDB_STRING, "help-domain", "Help domain to use" }, + { GIMP_PDB_STRING, "help-locales", "Language to use" }, + { GIMP_PDB_STRING, "help-id", "Help ID to open" } + }; + + gimp_install_temp_proc (GIMP_HELP_BROWSER_TEMP_EXT_PROC, + "DON'T USE THIS ONE", + "(Temporary procedure)", + "Sven Neumann , " + "Michael Natterer " + "Henrik Brix Andersen ", + "Sven Neumann, Michael Natterer & Henrik Brix Andersen", + "1999-2008", + NULL, + "", + GIMP_TEMPORARY, + G_N_ELEMENTS (args), 0, + args, NULL, + temp_proc_run); +} + +static void +temp_proc_run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals) +{ + static GimpParam values[1]; + GimpPDBStatusType status = GIMP_PDB_SUCCESS; + + *nreturn_vals = 1; + *return_vals = values; + + /* make sure all the arguments are there */ + if (nparams == 3) + { + const gchar *help_domain = GIMP_HELP_DEFAULT_DOMAIN; + const gchar *help_locales = NULL; + const gchar *help_id = GIMP_HELP_DEFAULT_ID; + + if (param[0].data.d_string && strlen (param[0].data.d_string)) + help_domain = param[0].data.d_string; + + if (param[1].data.d_string && strlen (param[1].data.d_string)) + help_locales = param[1].data.d_string; + + if (param[2].data.d_string && strlen (param[2].data.d_string)) + help_id = param[2].data.d_string; + + if (! help_browser_show_help (help_domain, help_locales, help_id)) + { + gtk_main_quit (); + } + } + + values[0].type = GIMP_PDB_STATUS; + values[0].data.d_status = status; +} + +static gboolean +help_browser_show_help (const gchar *help_domain, + const gchar *help_locales, + const gchar *help_id) +{ + GimpHelpDomain *domain; + gboolean success = TRUE; + + domain = gimp_help_lookup_domain (help_domain); + + if (domain) + { + GimpHelpProgress *progress = NULL; + GimpHelpLocale *locale; + GList *locales; + gchar *uri; + gboolean fatal_error; + + locales = gimp_help_parse_locales (help_locales); + + if (! g_str_has_prefix (domain->help_uri, "file:")) + progress = help_browser_progress_new (); + + uri = gimp_help_domain_map (domain, locales, help_id, + progress, &locale, &fatal_error); + + if (progress) + gimp_help_progress_free (progress); + + g_list_free_full (locales, (GDestroyNotify) g_free); + + if (uri) + { + browser_dialog_make_index (domain, locale); + browser_dialog_load (uri); + + g_free (uri); + } + else if (fatal_error) + { + success = FALSE; + } + } + + return success; +} + + +static void +help_browser_progress_start (const gchar *message, + gboolean cancelable, + gpointer user_data) +{ + gimp_progress_init (message); +} + +static void +help_browser_progress_update (gdouble value, + gpointer user_data) +{ + gimp_progress_update (value); +} + +static void +help_browser_progress_end (gpointer user_data) +{ + gimp_progress_end (); +} + +static GimpHelpProgress * +help_browser_progress_new (void) +{ + static const GimpHelpProgressVTable vtable = + { + help_browser_progress_start, + help_browser_progress_end, + help_browser_progress_update + }; + + return gimp_help_progress_new (&vtable, NULL); +} diff --git a/plug-ins/help-browser/uri.c b/plug-ins/help-browser/uri.c new file mode 100644 index 0000000..c0493fa --- /dev/null +++ b/plug-ins/help-browser/uri.c @@ -0,0 +1,386 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * The GIMP Help Browser - URI functions + * Copyright (C) 2001 Jacob Schroeder + * + * 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 3 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, see . + */ + +#include "config.h" + +#include + +#include + +#include "uri.h" + +/* #define URI_DEBUG 1 */ + +typedef enum +{ + URI_UNKNOWN, + URI_ABSURI, + URI_NETPATH, + URI_ABSPATH, + URI_RELPATH, + URI_QUERY, + URI_EMPTY, + URI_FRAGMENT, + URI_INVALID +} UriType; + + +static UriType +uri_get_type (const gchar *uri) +{ + gchar c; + const gchar *cptr; + UriType type = URI_UNKNOWN; + + if (!uri) + return type; + + cptr = uri; + c = *cptr++; + + if (g_ascii_isalpha (c)) + { + type = URI_RELPATH; /* assume relative path */ + + while ((c = *cptr++)) + { + if (g_ascii_isalnum (c) || c == '+' || c == '-' || c == '.') + continue; + + if (c == ':') + { + /* it was a scheme */ + type = URI_ABSURI; + } + break; + } + } + else + { + switch (c) + { + case '/': + if (*cptr == '/') + { + cptr++; + type = URI_NETPATH; + } + else + { + type = URI_ABSPATH; + } + break; + case '?': + type = URI_QUERY; + break; + case '#': + type = URI_FRAGMENT; + break; + case '\0': + type = URI_EMPTY; + break; + default: + type = URI_RELPATH; + break; + } + } + +#ifdef URI_DEBUG + g_print ("uri_get_type (\"%s\") -> ", uri); + switch (type) + { + case URI_UNKNOWN: g_print ("unknown"); break; + case URI_ABSURI: g_print ("absuri"); break; + case URI_NETPATH: g_print ("netpath"); break; + case URI_ABSPATH: g_print ("abspath"); break; + case URI_RELPATH: g_print ("relpath"); break; + case URI_QUERY: g_print ("query"); break; + case URI_EMPTY: g_print ("empty"); break; + case URI_FRAGMENT: g_print ("fragment"); break; + case URI_INVALID: g_print ("invalid"); break; + } + g_print ("\n"); +#endif + + return type; +} + +gchar * +uri_to_abs (const gchar *uri, + const gchar *base_uri) +{ + gchar c; + const gchar *cptr; + gchar *retval = NULL; + UriType uri_type = URI_UNKNOWN; + UriType base_type = URI_UNKNOWN; + + gint base_cnt = 0; /* no of chars to be copied from base URI */ + gint uri_cnt = 0; /* no of chars to be copied from URI */ + gint sep_cnt = 0; /* no of chars to be inserted between them */ + + const gchar *sep_str = ""; /* string to insert between base and uri */ + const gchar *part; + const gchar *last_segment = NULL; + +#ifdef URI_DEBUG + g_print ("uri_to_abs (\"%s\", \"%s\")\n", uri, base_uri); +#endif + + /* this function does not use the algorithm that is being proposed + * in RFC 2396. Instead it analyses the first characters of each + * URI to determine its kind (abs, net, path, ...). + * After that it locates the missing parts in the base URI and then + * concats everything into a newly allocated string. + */ + + /* determine the kind of the URIs */ + uri_type = uri_get_type (uri); + + if (uri_type != URI_ABSURI) + { + base_type = uri_get_type (base_uri); + + if (base_type != URI_ABSURI) + return NULL; /* neither uri nor base uri are absolute */ + } + + /* find missing parts in base URI */ + switch (uri_type) + { + case URI_ABSURI: + /* base uri not needed */ + break; + + case URI_QUERY: + /* ??? last segment? */ + uri_type = URI_RELPATH; + case URI_NETPATH: /* base scheme */ + case URI_ABSPATH: /* base scheme and authority */ + case URI_RELPATH: /* base scheme, authority and path */ + cptr = base_uri; + + /* skip scheme */ + while ((c = *cptr++) && c != ':') + ; /* nada */ + + base_cnt = cptr - base_uri; /* incl : */ + + if (*cptr != '/') + { + /* completion not possible */ + return NULL; + } + + if (uri_type == URI_NETPATH) + break; + + /* skip authority */ + if (cptr[0] == '/' && cptr[1] == '/') + { + part = cptr; + cptr += 2; + + while ((c = *cptr++) && c != '/' && c != '?' && c != '#') + ; /* nada */ + + cptr--; + base_cnt += cptr - part; + } + + if (uri_type == URI_ABSPATH) + break; + + /* skip path */ + if (*cptr != '/') + { + sep_cnt = 1; + sep_str = "/"; + break; + } + + part = cptr; + + g_assert (*cptr == '/'); + + while ((c = *cptr++) && c != '?' && c != '#') + { + if (c == '/') + last_segment = cptr - 1; + }; + + g_assert (last_segment); + + cptr = last_segment; + + while ((c = *uri) && c == '.' && cptr > part) + { + gint shift_segment = 0; + + c = uri[1]; + + if (c == '.' ) + { + c = uri[2]; + shift_segment = 1; + } + + if (c == '/') + { + uri += 2; + } + else if (c == 0 || c == '?' || c == '#') + { + uri += 1; + } + else + { + break; + } + + g_assert (*cptr == '/'); + + if (shift_segment) + { + uri += 1; + while (cptr > part && *--cptr != '/') + ; /* nada */ + } + } + + base_cnt += cptr - part + 1; + break; + + case URI_EMPTY: + case URI_FRAGMENT: + /* use whole base uri */ + base_cnt = strlen (base_uri); + break; + + case URI_UNKNOWN: + case URI_INVALID: + return NULL; + } + + /* do not include fragment part from the URI reference */ + for (cptr = uri; (c = *cptr) && c != '#'; cptr++) + ; /* nada */ + + uri_cnt = cptr - uri; + + /* allocate string and copy characters */ + + retval = g_new (gchar, base_cnt + sep_cnt + uri_cnt + 1); + + if (base_cnt) + strncpy (retval, base_uri, base_cnt); + + if (sep_cnt) + strncpy (retval + base_cnt, sep_str, sep_cnt); + + if (uri_cnt) + strncpy (retval + base_cnt + sep_cnt, uri, uri_cnt); + + retval[base_cnt + sep_cnt + uri_cnt] = '\0'; + +#ifdef URI_DEBUG + g_print (" -> \"%s\"\n", retval); +#endif + + return retval; +} + +#if 0 +RFC 2396 URI Generic Syntax August 1998 + + +A. Collected BNF for URI + + URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] + absoluteURI = scheme ":" ( hier_part | opaque_part ) + relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ] + + hier_part = ( net_path | abs_path ) [ "?" query ] + opaque_part = uric_no_slash *uric + + uric_no_slash = unreserved | escaped | ";" | "?" | ":" | "@" | + "&" | "=" | "+" | "$" | "," + + net_path = "//" authority [ abs_path ] + abs_path = "/" path_segments + rel_path = rel_segment [ abs_path ] + + rel_segment = 1*( unreserved | escaped | + ";" | "@" | "&" | "=" | "+" | "$" | "," ) + + scheme = alpha *( alpha | digit | "+" | "-" | "." ) + + authority = server | reg_name + + reg_name = 1*( unreserved | escaped | "$" | "," | + ";" | ":" | "@" | "&" | "=" | "+" ) + + server = [ [ userinfo "@" ] hostport ] + userinfo = *( unreserved | escaped | + ";" | ":" | "&" | "=" | "+" | "$" | "," ) + + hostport = host [ ":" port ] + host = hostname | IPv4address + hostname = *( domainlabel "." ) toplabel [ "." ] + domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum + toplabel = alpha | alpha *( alphanum | "-" ) alphanum + IPv4address = 1*digit "." 1*digit "." 1*digit "." 1*digit + port = *digit + + path = [ abs_path | opaque_part ] + path_segments = segment *( "/" segment ) + segment = *pchar *( ";" param ) + param = *pchar + pchar = unreserved | escaped | + ":" | "@" | "&" | "=" | "+" | "$" | "," + + query = *uric + + fragment = *uric + + uric = reserved | unreserved | escaped + reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | + "$" | "," + unreserved = alphanum | mark + mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | + "(" | ")" + + escaped = "%" hex hex + hex = digit | "A" | "B" | "C" | "D" | "E" | "F" | + "a" | "b" | "c" | "d" | "e" | "f" + + alphanum = alpha | digit + alpha = lowalpha | upalpha + + lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | + "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | + "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" + upalpha = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | + "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | + "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" + digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | + "8" | "9" + +#endif diff --git a/plug-ins/help-browser/uri.h b/plug-ins/help-browser/uri.h new file mode 100644 index 0000000..a1aaf1e --- /dev/null +++ b/plug-ins/help-browser/uri.h @@ -0,0 +1,22 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * The GIMP Help Browser - URI functions + * Copyright (C) 2001 Jacob Schroeder + * + * 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 3 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, see . + */ + +gchar * uri_to_abs (const gchar *uri, + const gchar *base_uri); -- cgit v1.2.3