bumped our version number to 1.3.6. Added check for libgtkhtml-2.0.

2002-05-05  Sven Neumann  <sven@gimp.org>

	* configure.in: bumped our version number to 1.3.6. Added check
	for libgtkhtml-2.0.

	* plug-ins/helpbrowser/Makefile.am
	* plug-ins/helpbrowser/helpbrowser.c: started to port the help browser
	to GtkHtml2. Not all features are working yet.

	* plug-ins/helpbrowser/back.xpm
	* plug-ins/helpbrowser/forward.xpm: removed.
This commit is contained in:
Sven Neumann 2002-05-05 17:01:44 +00:00 committed by Sven Neumann
parent 257aaddc18
commit 5c6cf5491e
7 changed files with 231 additions and 487 deletions

View File

@ -1,3 +1,15 @@
2002-05-05 Sven Neumann <sven@gimp.org>
* configure.in: bumped our version number to 1.3.6. Added check
for libgtkhtml-2.0.
* plug-ins/helpbrowser/Makefile.am
* plug-ins/helpbrowser/helpbrowser.c: started to port the help browser
to GtkHtml2. Not all features are working yet.
* plug-ins/helpbrowser/back.xpm
* plug-ins/helpbrowser/forward.xpm: removed.
2002-05-04 Sven Neumann <sven@gimp.org>
* README: updated Bugs section. Mention gdkxft to avoid more

10
README
View File

@ -1,11 +1,11 @@
The GIMP: The GNU Image Manipulation Program
============================================
This is version 1.3, the developers version of The GIMP. Only use
it if you are brave and curious and want to participate development
towards the next stable release version 1.4. Please do not yet report
bugs in this version. This is a developers version. We know it has
bugs and it might not even compile. You have been warned!
This is version 1.3, the developers version of The GIMP. Only use it
if you are brave and curious and want to participate development
towards the next stable release version 1.4. This is a developers
version. We know it has bugs and it might not even compile. You have
been warned!
Some features that were present in GIMP 1.2 are disabled or not even
included in this release. This includes the Perl extension and thus

View File

@ -1,12 +1,12 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(etc/gimprc.in)
AC_INIT(etc/gimprc.in)
GLIB_REQUIRED_VERSION=2.0.0
GTK_REQUIRED_VERSION=$GLIB_REQUIRED_VERSION
PANGOFT2_REQUIRED_VERSION=1.0.0
GTKDOC_REQUIRED_VERSION=0.9
GTKHTML2_REQUIRED_VERSION=1.99.5
#
# Making releases:
@ -19,7 +19,7 @@ GTKDOC_REQUIRED_VERSION=0.9
#
GIMP_MAJOR_VERSION=1
GIMP_MINOR_VERSION=3
GIMP_MICRO_VERSION=5
GIMP_MICRO_VERSION=6
GIMP_INTERFACE_AGE=0
GIMP_BINARY_AGE=0
GIMP_VERSION=$GIMP_MAJOR_VERSION.$GIMP_MINOR_VERSION.$GIMP_MICRO_VERSION
@ -607,45 +607,10 @@ dnl Test for libXpm
dnl This is for the help browser
dnl AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
dnl if test "$GNOME_CONFIG" = "no"; then
dnl dnl Test for standalone GtkXMHTML widget
dnl HELPBROWSER=
dnl if test -n "$LIBPNG" && test -n "$LIBJPEG" && test -n "$LIBXPM"; then
dnl helpbrowser_save_LIBS=$LIBS
dnl LIBS="$LIBS $LIBPNG $LIBJPEG $LIBXPM"
dnl AC_CHECK_LIB(gtkxmhtml, gtk_xmhtml_new,
dnl GTKXMHTML_CFLAGS=$GTK_CFLAGS
dnl GTKXMHTML_LIBS="-lgtkxmhtml $LIBPNG $LIBJPEG $LIBXPM $GTK_LIBS"
dnl HELPBROWSER=helpbrowser,
dnl AC_MSG_WARN(*** Help browser plug-in will not be built (GtkXMHTML library not found) ***))
dnl LIBS=$helpbrowser_save_LIBS
dnl else
dnl AC_MSG_WARN(*** Help browser plug-in will not be built (PNG, JPEG or XPM libraries not found) ***)
dnl fi
dnl else
dnl GTKXMHTML_CFLAGS=`$GNOME_CONFIG --cflags gnomeui`
dnl GTKXMHTML_LIBS=`$GNOME_CONFIG --libs gtkxmhtml`
dnl HELPBROWSER=helpbrowser
dnl fi
dnl Sanity check to make sure the headers are there too and that gnome-config
dnl didn't lie to us
dnl if test -n "$HELPBROWSER"; then
dnl CPPFLAGS="$CPPFLAGS $GTKXMHTML_CFLAGS"
dnl LDFLAGS="$LDFLAGS `echo $GTKXMHTML_LIBS | sed 's/\(.*\)\(-lgtkxmhtml.*\)/\1/'`"
dnl LIBS="$LIBS $GTKXMHTML_LIBS"
dnl AC_MSG_CHECKING([to see if we can build with GtkXMHTML])
dnl AC_TRY_LINK([#include <gtk-xmhtml/gtk-xmhtml.h>], [return 0;],
dnl gtkxmhtml_ok=yes, gtkxmhtml_ok=no)
dnl AC_MSG_RESULT($gtkxmhtml_ok)
dnl
dnl if test "$gtkxmhtml_ok" = no; then
dnl AC_MSG_WARN(*** Help browser plug-in will not be built (GtkXMHTML setup busted) ***)
dnl HELPBROWSER=
dnl fi
dnl fi
PKG_CHECK_MODULES(GTKHTML2, libgtkhtml-2.0 >= GTKHTML2_REQUIRED_VERSION,
HELPBROWSER=helpbrowser,
AC_MSG_WARN([*** Help browser plug-in will not be built (GtkHtml2 not found) ***]))
gimpdatadir=$datadir/$PACKAGE/$GIMP_MAJOR_VERSION.$GIMP_MINOR_VERSION
@ -851,6 +816,9 @@ AC_SUBST(PANGOFT2_LIBS)
AC_SUBST(LIBART_CFLAGS)
AC_SUBST(LIBART_LIBS)
AC_SUBST(GTKHTML2_CFLAGS)
AC_SUBST(GTKHTML2_LIBS)
AC_SUBST(PKG_CONFIG)
AC_SUBST(HAVE_GLIBC_REGEX)
@ -891,8 +859,6 @@ AC_SUBST(GIMP_PERL)
AC_SUBST(GIMP_PERL_PO)
AC_SUBST(GIMPINSTALL)
AC_SUBST(HELPBROWSER)
AC_SUBST(GTKXMHTML_CFLAGS)
AC_SUBST(GTKXMHTML_LIBS)
AC_SUBST(HTML_DIR)
AC_SUBST(GNOME_DESKTOP_PATH)
@ -916,7 +882,6 @@ dnl Output the Makefiles
dnl plug-ins/perl/config.pl
dnl plug-ins/gap/Makefile
dnl plug-ins/gdyntext/Makefile
dnl plug-ins/helpbrowser/Makefile
dnl plug-ins/perl/po/Makefile.in
AC_OUTPUT([
@ -984,6 +949,7 @@ plug-ins/gimpressionist/Makefile
plug-ins/gimpressionist/Brushes/Makefile
plug-ins/gimpressionist/Paper/Makefile
plug-ins/gimpressionist/Presets/Makefile
plug-ins/helpbrowser/Makefile
plug-ins/ifscompose/Makefile
plug-ins/imagemap/Makefile
plug-ins/maze/Makefile

View File

@ -5,8 +5,6 @@ libexecdir = $(gimpplugindir)/plug-ins
libexec_PROGRAMS = helpbrowser
helpbrowser_SOURCES = @STRIP_BEGIN@ \
back.xpm \
forward.xpm \
helpbrowser.c \
queue.c \
queue.h \
@ -18,25 +16,16 @@ AM_CPPFLAGS = @STRIP_BEGIN@ \
INCLUDES = @STRIP_BEGIN@ \
-I$(top_srcdir) \
$(GTK_CFLAGS) \
$(GTKXMHTML_CFLAGS) \
$(GTKHTML2_CFLAGS) \
-I$(includedir) \
@STRIP_END@
LDADD = @STRIP_BEGIN@ \
$(top_builddir)/libgimp/libgimpui-$(LT_RELEASE).la \
$(top_builddir)/libgimpwidgets/libgimpwidgets-$(LT_RELEASE).la \
$(top_builddir)/libgimp/libgimp-$(LT_RELEASE).la \
$(top_builddir)/libgimpwidgets/libgimpwidgets-$(LT_RELEASE).la \
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
$(top_builddir)/libgimpbase/libgimpbase-$(LT_RELEASE).la \
$(GTK_LIBS) \
$(GTKXMHTML_LIBS) \
$(GTKHTML2_LIBS) \
$(INTLLIBS) \
@STRIP_END@
.PHONY: files
files:
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
echo $$p; \
done

View File

@ -1,59 +0,0 @@
/* XPM */
static char * back_xpm[] = {
"14 14 42 1",
" c None",
". c #000000",
"+ c #C6D7C3",
"@ c #E4EBE2",
"# c #FFFFFF",
"$ c #DFE8DD",
"% c #F3F7F3",
"& c #DCE6D9",
"* c #F2F6F1",
"= c #EFF3EE",
"- c #F1F5F0",
"; c #F4F7F4",
"> c #121B12",
", c #DEE7DC",
"' c #EEF3ED",
") c #EBF1EA",
"! c #B1C7AC",
"~ c #E9EFE8",
"{ c #D7E3D5",
"] c #243221",
"^ c #375930",
"/ c #548149",
"( c #729B68",
"_ c #80A776",
": c #7DA473",
"< c #81A877",
"[ c #83AA7A",
"} c #87AC7D",
"| c #67925C",
"1 c #516F4A",
"2 c #4E7C44",
"3 c #739C6A",
"4 c #84A979",
"5 c #81A878",
"6 c #709864",
"7 c #49763F",
"8 c #719A67",
"9 c #608C56",
"0 c #46703C",
"a c #6FA763",
"b c #5B8851",
"c c #36582E",
" ..",
" ..+.",
" ..@#+.",
" ..$#%%+.",
" ..&#*=-;+.",
" .>,#'))===+.",
"..!#~{,@)===+]",
"..^/(_:<[}[}|.",
" ..1234_5}[|.",
" ..^26<_}|.",
" ..728_9.",
" ..0ab.",
" ..c.",
" .."};

View File

@ -1,66 +0,0 @@
/* XPM */
static char * forward_xpm[] = {
"14 14 49 1",
" c None",
". c #000000",
"+ c #E1EADF",
"@ c #FFFFFF",
"# c #F0F4EF",
"$ c #D4E0D1",
"% c #F3F7F3",
"& c #EDF2EB",
"* c #CEDCCB",
"= c #F4F7F4",
"- c #F1F5F0",
"; c #EFF3EE",
"> c #EBF1EA",
", c #C9D8C5",
"' c #E5ECE3",
") c #CBDAC7",
"! c #181818",
"~ c #2B2B2B",
"{ c #E4EBE2",
"] c #DEE7DC",
"^ c #D7E3D5",
"/ c #EEF3ED",
"( c #B1C7AC",
"_ c #9DBB90",
": c #88AC80",
"< c #83AA7C",
"[ c #85A879",
"} c #7EA476",
"| c #84A778",
"1 c #759B6C",
"2 c #59814F",
"3 c #3A5934",
"4 c #9ABB8F",
"5 c #83AA7A",
"6 c #87AC7D",
"7 c #82A87B",
"8 c #86A97C",
"9 c #759C6D",
"0 c #537C49",
"a c #445840",
"b c #80A776",
"c c #749868",
"d c #4B7040",
"e c #90B387",
"f c #749A6B",
"g c #3B5E31",
"h c #5D8554",
"i c #37592F",
"j c #3F6534",
".. ",
".+.. ",
".@#$.. ",
".@%&#*.. ",
".@=-;>-,.. ",
".@;;;>>'#)!. ",
"~@;;;>{]^]/(..",
"._:<:<[}|123..",
".4567|890a.. ",
".46b[c0d.. ",
".ebf0g.. ",
".<hi.. ",
".j.. ",
".. "};

View File

@ -2,8 +2,8 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* The GIMP Help Browser
* Copyright (C) 1999 Sven Neumann <sven@gimp.org>
* Michael Natterer <mitschel@cs.tu-berlin.de>
* Copyright (C) 1999-2002 Sven Neumann <sven@gimp.org>
* Michael Natterer <mitch@gimp.org>
*
* Some code & ideas stolen from the GNOME help browser.
*
@ -21,6 +21,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
@ -30,7 +31,8 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <gtk-xmhtml/gtk-xmhtml.h>
#include <libgtkhtml/gtkhtml.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
@ -39,9 +41,6 @@
#include "libgimp/stdplugins-intl.h"
#include "forward.xpm"
#include "back.xpm"
/* defines */
@ -198,7 +197,7 @@ static gboolean temp_proc_installed = FALSE;
static gint load_page (HelpPage *source_page,
HelpPage *dest_page,
gchar *ref,
const gchar *ref,
gint pos,
gboolean add_to_queue,
gboolean add_to_history);
@ -221,6 +220,7 @@ update_toolbar (HelpPage *page)
gtk_widget_set_sensitive (forward_button, queue_isnext (page->queue));
}
#if 0
static void
jump_to_anchor (HelpPage *page,
gchar *anchor)
@ -229,20 +229,14 @@ jump_to_anchor (HelpPage *page,
g_return_if_fail (page != NULL && anchor != NULL);
if (*anchor != '#')
{
gchar *a = g_strconcat ("#", anchor, NULL);
XmHTMLAnchorScrollToName (page->html, a);
g_free (a);
}
else
XmHTMLAnchorScrollToName (page->html, anchor);
html_view_jump_to_anchor (HTML_VIEW (page->html), anchor);
pos = gtk_xmhtml_get_topline (GTK_XMHTML (page->html));
queue_add (page->queue, page->current_ref, pos);
update_toolbar (page);
}
#endif
static void
forward_callback (GtkWidget *widget,
@ -282,7 +276,7 @@ entry_changed_callback (GtkWidget *widget,
{
GList *list;
HistoryItem *item;
gchar *entry_text;
const gchar *entry_text;
gchar *compare_text;
gboolean found = FALSE;
@ -316,7 +310,7 @@ entry_button_press_callback (GtkWidget *widget,
gpointer data)
{
if (current_page != &pages[HELP])
gtk_notebook_set_page (GTK_NOTEBOOK (notebook), HELP);
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), HELP);
return FALSE;
}
@ -379,10 +373,11 @@ history_add (gchar *ref,
combo_list = g_list_reverse (combo_list);
gtk_signal_handler_block_by_data (GTK_OBJECT (GTK_COMBO (combo)->entry), combo);
g_signal_handlers_block_by_func (G_OBJECT (GTK_COMBO (combo)->entry),
entry_changed_callback, combo);
gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
/* gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo)->entry), item->title); */
gtk_signal_handler_unblock_by_data (GTK_OBJECT (GTK_COMBO (combo)->entry), combo);
g_signal_handlers_unblock_by_func (G_OBJECT (GTK_COMBO (combo)->entry),
entry_changed_callback, combo);
for (list = combo_list; list; list = list->next)
g_free (list->data);
@ -391,87 +386,99 @@ history_add (gchar *ref,
}
static void
html_source (HelpPage *page,
update_state (HelpPage *page,
gchar *ref,
gint pos,
gchar *source,
gboolean add_to_queue,
gboolean add_to_history)
{
gchar *title = NULL;
g_return_if_fail (page != NULL && ref != NULL && source != NULL);
/* Load it up */
gtk_xmhtml_source (GTK_XMHTML (page->html), source);
gtk_xmhtml_set_topline (GTK_XMHTML(page->html), pos);
g_return_if_fail (page != NULL && ref != NULL);
if (add_to_queue)
queue_add (page->queue, ref, pos);
if (page->index == HELP)
{
#if 0
title = XmHTMLGetTitle (page->html);
#endif
if (!title)
title = (_("<Untitled>"));
if (add_to_history)
history_add (ref, title);
gtk_signal_handler_block_by_data (GTK_OBJECT (GTK_COMBO (combo)->entry),
combo);
g_signal_handlers_block_by_func (G_OBJECT (GTK_COMBO (combo)->entry),
entry_changed_callback, combo);
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo)->entry), title);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (GTK_COMBO (combo)->entry),
combo);
g_signal_handlers_unblock_by_func (G_OBJECT (GTK_COMBO (combo)->entry),
entry_changed_callback, combo);
}
update_toolbar (page);
}
static gint
static gboolean
load_page (HelpPage *source_page,
HelpPage *dest_page,
gchar *ref,
const gchar *ref,
gint pos,
gboolean add_to_queue,
gboolean add_to_history)
{
GString *file_contents;
FILE *afile = NULL;
char aline[1024];
HtmlDocument *doc;
FILE *fp = NULL;
gchar buf[8192];
gchar *old_dir;
gchar *new_dir, *new_base;
gchar *new_dir;
gchar *new_base;
gchar *new_ref;
gchar *tmp;
gsize bytes_read;
gboolean page_valid = FALSE;
gboolean filters_dir = FALSE;
g_return_val_if_fail (ref != NULL && source_page != NULL && dest_page != NULL, FALSE);
g_return_val_if_fail (source_page != NULL && dest_page != NULL, FALSE);
g_return_val_if_fail (ref != NULL, FALSE);
old_dir = g_dirname (source_page->current_ref);
new_dir = g_dirname (ref);
new_base = g_basename (ref);
doc = HTML_VIEW (dest_page->html)->document;
old_dir = g_path_get_dirname (source_page->current_ref);
new_dir = g_path_get_dirname (ref);
new_base = g_path_get_basename (ref);
/* return value is intentionally ignored */
chdir (old_dir);
file_contents = g_string_new (NULL);
if (chdir (new_dir) == -1)
{
gchar *msg;
if (g_path_is_absolute (ref))
new_ref = g_strdup (ref);
else
new_ref = g_build_filename (old_dir, ref, NULL);
g_string_printf (file_contents, gettext (dir_not_found_format_string),
msg = g_strdup_printf (gettext (dir_not_found_format_string),
eek_png_tag, new_dir, new_ref);
html_source (dest_page, new_ref, 0, file_contents->str, add_to_queue, FALSE);
html_document_clear (doc);
html_document_open_stream (doc, "text/html");
html_document_write_stream (doc, msg, strlen (msg));
html_document_close_stream (doc);
g_free (msg);
goto FINISH;
}
if (strcmp (g_basename (new_dir), "filters") == 0)
tmp = new_dir;
new_dir = g_path_get_basename (tmp);
g_free (tmp);
if (strcmp (new_dir, "filters") == 0)
filters_dir = TRUE;
g_free (new_dir);
@ -481,7 +488,9 @@ load_page (HelpPage *source_page,
if (strcmp (dest_page->current_ref, new_ref) == 0)
{
#if 0
gtk_xmhtml_set_topline (GTK_XMHTML (dest_page->html), pos);
#endif
if (add_to_queue)
queue_add (dest_page->queue, new_ref, pos);
@ -489,70 +498,81 @@ load_page (HelpPage *source_page,
goto FINISH;
}
html_document_clear (doc);
html_document_open_stream (doc, "text/html");
/*
* handle basename like: filename.html#11111 -> filename.html
*/
g_strdelimit (new_base,"#",'\0');
g_strdelimit (new_base, "#", '\0');
afile = fopen (new_base, "rt");
fp = fopen (new_base, "rt");
if (afile != NULL)
if (fp != NULL)
{
while (fgets (aline, sizeof (aline), afile))
file_contents = g_string_append (file_contents, aline);
fclose (afile);
while ((bytes_read =
fread (buf, sizeof (gchar), sizeof (buf), fp)) > 0)
html_document_write_stream (doc, buf, bytes_read);
}
else if (filters_dir)
{
gchar *undocumented_filter;
undocumented_filter =
gchar *undocumented_filter =
g_build_filename (new_dir, "undocumented_filter.html", NULL);
fp = fopen (undocumented_filter, "rt");
afile = fopen (undocumented_filter, "rt");
if (afile != NULL)
if (fp != NULL)
{
while (fgets (aline, sizeof (aline), afile))
file_contents = g_string_append (file_contents, aline);
fclose (afile);
while ((bytes_read =
fread (buf, sizeof (gchar), sizeof (buf), fp)) > 0)
html_document_write_stream (doc, buf, bytes_read);
}
g_free (undocumented_filter);
}
if (strlen (file_contents->str) <= 0)
if (fp)
{
chdir (old_dir);
g_string_printf (file_contents, gettext (doc_not_found_format_string),
eek_png_tag, ref);
fclose (fp);
page_valid = TRUE;
}
else
page_valid = TRUE;
{
gchar *msg = g_strdup_printf (gettext (doc_not_found_format_string),
eek_png_tag, ref);
html_source (dest_page, new_ref, 0, file_contents->str,
add_to_queue, add_to_history && page_valid);
chdir (old_dir);
html_document_write_stream (doc, msg, strlen (msg));
g_free (msg);
}
html_document_close_stream (doc);
FINISH:
g_free (dest_page->current_ref);
dest_page->current_ref = new_ref;
g_string_free (file_contents, TRUE);
g_free (old_dir);
g_free (new_dir);
g_free (new_base);
gtk_notebook_set_page (GTK_NOTEBOOK (notebook), dest_page->index);
update_state (dest_page, new_ref, 0,
add_to_queue, add_to_history && page_valid);
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), dest_page->index);
return (page_valid);
}
static void
xmhtml_activate (GtkWidget *html,
link_clicked (HtmlDocument *doc,
const gchar *url,
gpointer data)
{
XmHTMLAnchorCallbackStruct *cbs = (XmHTMLAnchorCallbackStruct *) data;
load_page (current_page, &pages[HELP], url, 0, TRUE, TRUE);
#if 0
GimpParam *return_vals;
gint nreturn_vals;
@ -577,6 +597,7 @@ xmhtml_activate (GtkWidget *html,
gimp_destroy_params (return_vals, nreturn_vals);
break;
}
#endif
}
static void
@ -585,58 +606,14 @@ notebook_switch_callback (GtkNotebook *notebook,
gint page_num,
gpointer user_data)
{
GtkXmHTML *html;
gint i;
GList *children;
g_return_if_fail (page_num >= 0 && page_num < 3);
html = GTK_XMHTML (current_page->html);
/* The html widget fails to do the following by itself */
GTK_WIDGET_UNSET_FLAGS (html->html.work_area, GTK_MAPPED);
GTK_WIDGET_UNSET_FLAGS (html->html.vsb, GTK_MAPPED);
GTK_WIDGET_UNSET_FLAGS (html->html.hsb, GTK_MAPPED);
/* Frames */
for (i = 0; i < html->html.nframes; i++)
GTK_WIDGET_UNSET_FLAGS (html->html.frames[i]->frame, GTK_MAPPED);
/* Form widgets */
for (children = html->children; children; children = children->next)
GTK_WIDGET_UNSET_FLAGS (children->data, GTK_MAPPED);
/* Set the new page */
current_page = &pages[page_num];
}
static void
notebook_switch_after_callback (GtkNotebook *notebook,
GtkNotebookPage *page,
gint page_num,
gpointer user_data)
{
GtkAccelGroup *accel_group = gtk_accel_group_get_default ();
gtk_widget_add_accelerator (GTK_XMHTML (current_page->html)->html.vsb,
"page_up", accel_group,
'b', 0, 0);
gtk_widget_add_accelerator (GTK_XMHTML (current_page->html)->html.vsb,
"page_down", accel_group,
' ', 0, 0);
gtk_widget_add_accelerator (GTK_XMHTML (current_page->html)->html.vsb,
"page_up", accel_group,
GDK_Page_Up, 0, 0);
gtk_widget_add_accelerator (GTK_XMHTML (current_page->html)->html.vsb,
"page_down", accel_group,
GDK_Page_Down, 0, 0);
update_toolbar (current_page);
}
static gint
notebook_label_button_press_callback (GtkWidget *widget,
GdkEvent *event,
@ -645,7 +622,7 @@ notebook_label_button_press_callback (GtkWidget *widget,
guint i = GPOINTER_TO_UINT (data);
if (current_page != &pages[i])
gtk_notebook_set_page (GTK_NOTEBOOK (notebook), i);
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), i);
return TRUE;
}
@ -666,82 +643,35 @@ combo_drag_handle (GtkWidget *widget,
{
HelpPage *page = (HelpPage*)data;
if (page->current_ref != NULL)
{
if (! page->current_ref)
return;
gtk_selection_data_set (selection_data,
selection_data->target,
8,
page->current_ref,
strlen (page->current_ref));
}
}
static void
page_up_callback (GtkWidget *widget,
GtkWidget *html)
{
GtkAdjustment *adj;
adj = GTK_ADJUSTMENT (GTK_XMHTML (html)->vsba);
gtk_adjustment_set_value (adj, adj->value - (adj->page_size));
}
static void
page_down_callback (GtkWidget *widget,
GtkWidget *html)
{
GtkAdjustment *adj;
adj = GTK_ADJUSTMENT (GTK_XMHTML (html)->vsba);
gtk_adjustment_set_value (adj, adj->value + (adj->page_size));
}
static gint
wheel_callback (GtkWidget *widget,
GdkEventButton *bevent,
GtkWidget *html)
{
GtkAdjustment *adj;
gfloat new_value;
if (! GTK_XMHTML (html)->html.needs_vsb)
return FALSE;
adj = GTK_ADJUSTMENT (GTK_XMHTML (html)->vsba);
switch (bevent->button)
{
case 4:
new_value = adj->value - adj->page_increment / 2;
break;
case 5:
new_value = adj->value + adj->page_increment / 2;
break;
default:
return FALSE;
}
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
gtk_adjustment_set_value (adj, new_value);
return TRUE;
}
static gint
static gboolean
set_initial_history (gpointer data)
{
gint add_to_history = GPOINTER_TO_INT (data);
gchar *title;
#if 0
title = XmHTMLGetTitle (pages[HELP].html);
#endif
title = "???";
if (add_to_history)
history_add (pages[HELP].current_ref, title);
gtk_signal_handler_block_by_data (GTK_OBJECT (GTK_COMBO (combo)->entry), combo);
g_signal_handlers_block_by_func (G_OBJECT (GTK_COMBO (combo)->entry),
entry_changed_callback, combo);
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo)->entry), title);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (GTK_COMBO (combo)->entry), combo);
g_signal_handlers_unblock_by_func (G_OBJECT (GTK_COMBO (combo)->entry),
entry_changed_callback, combo);
return FALSE;
}
@ -795,17 +725,16 @@ open_browser_dialog (gchar *help_path,
initial_dir = g_get_current_dir ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (close_callback),
g_signal_connect (G_OBJECT (window), "delete_event",
G_CALLBACK (close_callback),
NULL);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (close_callback),
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (close_callback),
NULL);
gtk_window_set_wmclass (GTK_WINDOW (window), "helpbrowser", "Gimp");
gtk_window_set_title (GTK_WINDOW (window), _("GIMP Help Browser"));
gimp_help_connect (window, gimp_standard_help_func,
"dialogs/help.html");
gimp_help_connect (window, gimp_standard_help_func, "dialogs/help.html");
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@ -814,24 +743,24 @@ open_browser_dialog (gchar *help_path,
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
bbox = gtk_hbutton_box_new ();
gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 0);
gtk_box_set_spacing (GTK_BOX (bbox), 0);
gtk_box_pack_start (GTK_BOX (hbox), bbox, FALSE, FALSE, 0);
back_button = gimp_pixmap_button_new (back_xpm, _("Back"));
back_button = gtk_button_new_from_stock (GTK_STOCK_GO_BACK);
gtk_button_set_relief (GTK_BUTTON (back_button), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (bbox), back_button);
gtk_widget_set_sensitive (GTK_WIDGET (back_button), FALSE);
gtk_signal_connect (GTK_OBJECT (back_button), "clicked",
GTK_SIGNAL_FUNC (back_callback),
g_signal_connect (G_OBJECT (back_button), "clicked",
G_CALLBACK (back_callback),
NULL);
gtk_widget_show (back_button);
forward_button = gimp_pixmap_button_new (forward_xpm, _("Forward"));
forward_button = gtk_button_new_from_stock (GTK_STOCK_GO_FORWARD);
gtk_button_set_relief (GTK_BUTTON (forward_button), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (bbox), forward_button);
gtk_widget_set_sensitive (GTK_WIDGET (forward_button), FALSE);
gtk_signal_connect (GTK_OBJECT (forward_button), "clicked",
GTK_SIGNAL_FUNC (forward_callback),
g_signal_connect (G_OBJECT (forward_button), "clicked",
G_CALLBACK (forward_callback),
NULL);
gtk_widget_show (forward_button);
@ -840,11 +769,11 @@ open_browser_dialog (gchar *help_path,
bbox = gtk_hbutton_box_new ();
gtk_box_pack_end (GTK_BOX (hbox), bbox, FALSE, FALSE, 0);
button = gtk_button_new_with_label (GTK_STOCK_CLOSE);
button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (bbox), button);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (close_callback),
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (close_callback),
NULL);
gtk_widget_show (button);
@ -853,22 +782,15 @@ open_browser_dialog (gchar *help_path,
notebook = gtk_notebook_new ();
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
gtk_notebook_set_tab_vborder (GTK_NOTEBOOK (notebook), 0);
gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0);
for (i = 0; i < 3; i++)
{
static guint page_up_signal = 0;
static guint page_down_signal = 0;
pages[i].index = i;
pages[i].html = gtk_xmhtml_new ();
pages[i].html = html_view_new ();
pages[i].queue = queue_new ();
gtk_xmhtml_set_anchor_underline_type (GTK_XMHTML (pages[i].html),
GTK_ANCHOR_SINGLE_LINE);
gtk_xmhtml_set_anchor_buttons (GTK_XMHTML (pages[i].html), FALSE);
gtk_widget_set_usize (GTK_WIDGET (pages[i].html), -1, 300);
gtk_widget_set_size_request (GTK_WIDGET (pages[i].html), -1, 300);
switch (i)
{
@ -889,27 +811,30 @@ open_browser_dialog (gchar *help_path,
title = combo = gtk_combo_new ();
drag_source = GTK_COMBO (combo)->entry;
gtk_widget_set_usize (GTK_WIDGET (combo), 300, -1);
gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
gtk_widget_set_size_request (GTK_WIDGET (combo), 300, -1);
g_object_set (G_OBJECT (GTK_COMBO (combo)->entry),
"editable", FALSE,
NULL);
gtk_combo_set_use_arrows (GTK_COMBO (combo), TRUE);
gtk_signal_connect (GTK_OBJECT (GTK_COMBO (combo)->entry),
g_signal_connect (G_OBJECT (GTK_COMBO (combo)->entry),
"changed",
GTK_SIGNAL_FUNC (entry_changed_callback),
G_CALLBACK (entry_changed_callback),
combo);
gtk_signal_connect (GTK_OBJECT (GTK_WIDGET (GTK_COMBO (combo)->entry)),
g_signal_connect (G_OBJECT (GTK_WIDGET (GTK_COMBO (combo)->entry)),
"button-press-event",
GTK_SIGNAL_FUNC (entry_button_press_callback),
G_CALLBACK (entry_button_press_callback),
NULL);
gtk_widget_show (combo);
break;
default:
title = drag_source = NULL; /* to please the compiler */
break;
}
/* connect to the button_press signal to make notebook switching work */
gtk_signal_connect (GTK_OBJECT (title), "button_press_event",
GTK_SIGNAL_FUNC (notebook_label_button_press_callback),
g_signal_connect (G_OBJECT (title), "button_press_event",
G_CALLBACK (notebook_label_button_press_callback),
GUINT_TO_POINTER (i));
/* dnd source */
@ -918,14 +843,20 @@ open_browser_dialog (gchar *help_path,
help_dnd_target_table,
G_N_ELEMENTS (help_dnd_target_table),
GDK_ACTION_MOVE | GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (drag_source), "drag_begin",
GTK_SIGNAL_FUNC (combo_drag_begin),
g_signal_connect (G_OBJECT (drag_source), "drag_begin",
G_CALLBACK (combo_drag_begin),
&pages[i]);
gtk_signal_connect (GTK_OBJECT (drag_source), "drag_data_get",
GTK_SIGNAL_FUNC (combo_drag_handle),
g_signal_connect (G_OBJECT (drag_source), "drag_data_get",
G_CALLBACK (combo_drag_handle),
&pages[i]);
html_box = gtk_vbox_new (FALSE, 0);
html_box = gtk_scrolled_window_new
(gtk_layout_get_hadjustment (GTK_LAYOUT (pages[i].html)),
gtk_layout_get_vadjustment (GTK_LAYOUT (pages[i].html)));
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (html_box),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (html_box), pages[i].html);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), html_box, title);
@ -942,69 +873,40 @@ open_browser_dialog (gchar *help_path,
g_build_filename (root_dir, locale, pages[i].home, NULL);
}
html_view_set_document (HTML_VIEW (pages[i].html), html_document_new ());
success = load_page (&pages[i], &pages[i], initial_ref, 0, TRUE, FALSE);
g_free (initial_ref);
gtk_widget_show (pages[i].html);
gtk_widget_show (html_box);
gtk_signal_connect (GTK_OBJECT (pages[i].html), "activate",
(GtkSignalFunc) xmhtml_activate,
g_signal_connect (G_OBJECT (HTML_VIEW (pages[i].html)->document),
"link_clicked",
G_CALLBACK (link_clicked),
&pages[i]);
if (! page_up_signal)
{
page_up_signal = gtk_object_class_user_signal_new
(GTK_OBJECT (GTK_XMHTML (pages[i].html)->html.vsb)->klass,
"page_up",
GTK_RUN_FIRST,
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
page_down_signal = gtk_object_class_user_signal_new
(GTK_OBJECT (GTK_XMHTML (pages[i].html)->html.vsb)->klass,
"page_down",
GTK_RUN_FIRST,
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
}
gtk_signal_connect (GTK_OBJECT (GTK_XMHTML (pages[i].html)->html.vsb),
"page_up",
GTK_SIGNAL_FUNC (page_up_callback),
pages[i].html);
gtk_signal_connect (GTK_OBJECT (GTK_XMHTML (pages[i].html)->html.vsb),
"page_down",
GTK_SIGNAL_FUNC (page_down_callback),
pages[i].html);
gtk_signal_connect (GTK_OBJECT (GTK_XMHTML (pages[i].html)->html.work_area),
"button_press_event",
GTK_SIGNAL_FUNC (wheel_callback),
pages[i].html);
}
g_free (root_dir);
gtk_signal_connect (GTK_OBJECT (notebook), "switch-page",
GTK_SIGNAL_FUNC (notebook_switch_callback),
NULL);
gtk_signal_connect_after (GTK_OBJECT (notebook), "switch-page",
GTK_SIGNAL_FUNC (notebook_switch_after_callback),
g_signal_connect (G_OBJECT (notebook), "switch-page",
G_CALLBACK (notebook_switch_callback),
NULL);
gtk_notebook_set_page (GTK_NOTEBOOK (notebook), HELP);
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), HELP);
gtk_widget_show (notebook);
gtk_widget_show (vbox);
gtk_widget_show (window);
gtk_idle_add ((GtkFunction) set_initial_history, GINT_TO_POINTER (success));
g_idle_add (set_initial_history, GINT_TO_POINTER (success));
g_free (initial_dir);
return TRUE;
}
static gint
static gboolean
idle_load_page (gpointer data)
{
gchar *path = data;
@ -1062,7 +964,7 @@ run_temp_proc (gchar *name,
g_free (locale);
g_free (help_file);
gtk_idle_add (idle_load_page, path);
g_idle_add (idle_load_page, path);
*nreturn_vals = 1;
*return_vals = values;
@ -1102,7 +1004,7 @@ install_temp_proc (void)
"DON'T USE THIS ONE",
"(Temporary procedure)",
"Sven Neumann <sven@gimp.org>, "
"Michael Natterer <mitschel@cs.tu-berlin.de>",
"Michael Natterer <mitch@gimp.org>",
"Sven Neumann & Michael Natterer",
"1999",
NULL,
@ -1171,7 +1073,7 @@ run (gchar *name,
static GimpParam values[1];
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gchar *env_root_dir = NULL;
const gchar *env_root_dir = NULL;
gchar *help_path = NULL;
gchar *locale = NULL;
gchar *help_file = NULL;