diff -uNr gnome-0.10/AUTHORS gnome-0.11/AUTHORS --- gnome-0.10/AUTHORS Tue Nov 25 01:21:29 1997 +++ gnome-0.11/AUTHORS Fri Jan 2 13:27:39 1998 @@ -10,3 +10,5 @@ Jens Christian Restemeier Tom Tromey Marius Vollmer +Eckehard Berns +George Lebl diff -uNr gnome-0.10/ChangeLog gnome-0.11/ChangeLog --- gnome-0.10/ChangeLog Mon Dec 8 07:44:19 1997 +++ gnome-0.11/ChangeLog Wed Jan 7 13:21:09 1998 @@ -1,3 +1,254 @@ +1998-01-06 Elliot Lee + + * programs/girc: New program. It even works (I think). + +Tue Jan 6 19:52:15 1998 Miguel de Icaza + + * configure.in: Include gtk-xmhtml in the distribution, it is + ready for use. + + * gtk-xmhtml: many many changes. From now on, I will keep logs on + it ;-). + +Tue Jan 6 13:43:45 1998 Miguel de Icaza + + * libgnome/gnome-app-helper.c: Splited from gnome-app to avoid + people believing that they need to use the wrappers for toolbar + and menubar creation. + + * libgnome/gnome-app.c: Do not remove from the parent container if + we have not been added yet. + +Sat Jan 3 16:53:27 1998 Miguel de Icaza + + * libgnome/gnome-config.c (parse_path): Handle gnome-relative + files with more than one nesting level (you can now access files + inside directories with gnome-config). + + This does not create the directories if they do not exist. This + needs to be fixes + +Fri Jan 2 16:32:11 1998 Miguel de Icaza + + * configure.in: Check for gmp lib (needed to avoid compiling + Genius); added gtt/genius + +Wed Dec 31 18:21:41 1997 Miguel de Icaza + + * programs/same-gnome/same-gnome.c (main): use GnomeApp widget. + Should we make GnomeApp a container probably? So we could get rid + of gnome_app_set_contents and use gtk_container_add + + * libgnomeui/gnome-app.c (gnome_app_set_toolbar, + gnome_app_set_menu): Bind the button_press_event to the handle + box, not the toolbar nor the menubar, this way you can click right + button on the little handle on the screen. + +Fri Jan 2 14:53:14 1998 Federico Mena + + * programs/linux-conf/conf.c: Added #include + + * programs/gnomine/gnomine.c (main): Removed some unused variables. + + * programs/desktop-properties/property-background.c: Added + #include . + + * programs/desktop-properties/property-keyboard.c + (rbutton_toggled, rate_changed, delay_changed, cbutton_toggled, + cvol_changed): Made these functions return void, same as below. + + * programs/desktop-properties/property-mouse.c (scale_moved, + button_toggled): Made these functions return void in agreement + with the signal they handle. + + * libgnome/gnome-history.c (write_history): Removed unused + variable t. + + * programs/panel/netwatch/netwatch.c (create_netwatch): Added + parentheses around assignment used as truth value. + + * programs/panel/batmon/batmon.c (destroy_module): Replaced + gtk_tooltips_destroy() by gtk_tooltips_unref(). + + * programs/panel/mailcheck/mailcheck.c (next_frame): Make the + timeout handler return TRUE. + + * Lots of fixes for warnings that I forgot to add in the + ChangeLog, sorry :-( + +Fri Jan 2 00:15:32 1998 Tom Tromey + + * programs/notepad/notepad.scm (file-menu): Added session + debugging item to File menu. + + * programs/test-suite/Makefile.am (bin_PROGRAMS): Removed. + (test): Likewise. + (EXTRA_DIST): New macro. + (TESTS): Likewise. + (TESTS_ENVIRONMENT): Likewise. + + * guile-gnome/session.c (connected_p): New function. + (request_save): New function. + + * libgnome/gnome-config.c (gnome_config_push_prefix): Made path + argument const. + (gnome_config_set_bool): Likewise. + (gnome_config_set_int): Likewise. + (gnome_config_set_string): Likewise. + (gnome_config_get_bool_with_default): Likewise. + (gnome_config_get_string_with_default): Likewise. + (gnome_config_get_int_with_default): Likewise. + (gnome_config_has_section): Likewise. + (gnome_config_clean_key): Likewise. + (gnome_config_clean_section): Likewise. + (gnome_config_init_iterator): Likewise. + (gnome_config_clean_file): Likewise. + (parse_path): Likewise. + (access_config): Made several arguments const. + (is_loaded): Made filename argument const. + (load): Made file argument const. + (new_key): Made key_name, value arguments const. + + * programs/same-gnome/same-gnome.c (create_main_window): Declare + return type. + (main): Cast app to right type. + +Wed Dec 31 17:32:00 1997 Miguel de Icaza + + * libgnomeui/gnome-app.h, libgnomeui/gnome-app.c: Changed the + names for the constants to look more GTK/GNOMEish. + + (gnome_app_create_menus, gnome_app_create_toolbar): avoid code + duplication they now call gnome_app_set_menus and + gnome_app_set_toolbar. + + (gnome_app_set_toolbar, gnome_app_set_menus): they now place the + components depending on the settings for this particular + application using gnome-config. + + (gnome_app_new): Now takes two parameter: the application + configuration file and the title (used for loading/saving + configuration) + + * programs/gmailman/gmailman.m: Use the new gnome-app constants. + + * programs/gulp/gulp.m: Use the new gnome-app constants. + + * obgnome/ObgnomeAppWin.m: Adopt to new gnome-app. + +Mon Dec 29 20:40:36 1997 Miguel de Icaza + + * libgnomeui/gnome-init.c (gnome_rc_parse): Do not call the + parsing routines if we got an empty filename. + +Sat Dec 27 12:55:10 1997 Tom Tromey + + * libgnomeui/gnome-session.c (gnome_session_set_restart_style): + Take address of character, not style. + +1997-12-28 Elliot Lee + + * autogen.sh: Script to help people get up and running. + +Sat Dec 27 12:46:41 1997 Nathan Bryant + + * libgnome/gnome-config.c (gnome_config_push_prefix): Small fix, + prefix list was never assigned the new element. + +Fri Dec 26 13:45:01 1997 Miguel de Icaza + + * libgnome/gnome-score-helper.c (gnome_get_program_name): Use + g_copy_strings to assemble file names. Dont use statically + allocated arrays. + + * libgnome/gnome-score-helper.c: use GNOMEBINDIR as the prefix, + not /usr/local/bin; Use GNOMELOCALSTATEDIR+"games" as the + directory name for storing score files, not /var/lib/games. + + * libgnome/Makefile.am: export GNOMEBINDIR (used by the scoring + routines). + +Wed Dec 24 00:49:31 1997 Tom Tromey + + * libgnomeui/Makefile.am (libgnomeui_la_SOURCES): Added + gnome-ice.c. + (libgnomeuiinclude_HEADERS): Added gnome-ice.h. + * libgnomeui/gnome-session.c: Moved ICE code into gnome-ice.c. + (gnome_session_init): Call gnome_ice_init. + * libgnomeui/gnome-ice.c: New file. + * libgnomeui/gnome-ice.h: New file. + + * programs/notepad/notepad.scm (fill-text-widget): Call + gnome-history-recently-used. + + * guile-gnome/gnomeg.c (guile_gnome_history_recent): New + function. + (init_guile_gnome_defs): Register new function. + +Wed Dec 24 15:11:30 1997 Miguel de Icaza + + * libgnome/gnome-config.c (decode_string_and_dup): Decode escaped + strings (escape_string_and_dup): encode strings with special + characters. + +1997-12-20 Miguel de Icaza + + * libgnome/gnome-config.c: gnome_config_set_prefix and + gnome_config_drop_prefix are now gone. They are replaced by + gnome_config_push_prefix and gnome_config_pop_prefix that + implement a stack of prefixes. + + * guile-gnome/gnomeg.c: updated to above changes + * guile-gnome/gnome-dentry.c: likewise + +Tue Dec 23 10:22:24 1997 Tom Tromey + + * libgnome/gnome-string.c (gnome_chomp_string): Initialize `end', + not `*end'. + +Sat Dec 20 22:27:18 1997 Tom Tromey + + * programs/gulp/Makefile.am (bin_PROGRAMS): Only define if + OBJECTIVE_C. + * obgtk/Makefile.am (CC): New macro. + (lib_LTLIBRARIES): Only define if OBJECTIVE_C. + * configure.in: Check for Objective C compiler. + +Wed Dec 17 22:22:27 1997 Tom Tromey + + * programs/panel/panel.c (panel_session_save): New function. + (panel_quit): Use session management commands when appropriate. + + * programs/panel/applet_files.c (get_dl_func): Print function name + in error message. + * programs/panel/main.c (init_session_management): New function. + (main): Call it. + * configure.in: Create programs/panel/logout/Makefile. + * programs/panel/Makefile.am (SUBDIRS): Include logout directory. + * programs/panel/logout/Makefile.am: New file. + * programs/panel/logout/logout.c: New file. + + * libgnomeui/gnome-session.h: Declare new functions. + * libgnomeui/gnome-session.c (gnome_session_request_save, + gnome_session_connected_p): New functions. + +Sun Dec 14 13:30:44 1997 Tom Tromey + + * programs/notepad/notepad.scm (fill-text-widget): Write + "forward", not "forewards". + (notepad-close): Likewise. + +Wed Dec 10 17:46:07 1997 Tom Tromey + + Reports from Bruce Perens: + * programs/gnometalk/global.h: Include . + * libgnome/gnome-i18n.h: Put text after #endif in comment. + * programs/desktop-properties/main.c (display_properties_setup): + Use C-style comment. + * libgnomeui/gnome-properties.c + (gnome_property_configurator_request): Use C-style comment. + * configure.in (USE_GNOME): Correctly export for vanilla sh. + Sun Dec 7 12:05:25 1997 Tom Tromey * programs/find-file/nsearch.scm (make-command-buttons): Removed diff -uNr gnome-0.10/HACKING gnome-0.11/HACKING --- gnome-0.10/HACKING Tue Nov 25 20:36:01 1997 +++ gnome-0.11/HACKING Mon Dec 22 23:59:04 1997 @@ -2,7 +2,7 @@ to have the following packages installed: - GNU autoconf 2.12 - - GNU automake 1.2c + - GNU automake 1.2d Available in ftp://ftp.cygnus.com/pub/tromey - GNU libtool 1.0c - GNU guile 1.2 diff -uNr gnome-0.10/Makefile.am gnome-0.11/Makefile.am --- gnome-0.10/Makefile.am Tue Nov 25 01:21:29 1997 +++ gnome-0.11/Makefile.am Tue Jan 6 14:05:14 1998 @@ -1,6 +1,8 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = po intl libgnome libgnomeui lib obgtk guile-gtk programs guile-gnome +SUBDIRS = po intl libgnome libgnomeui gtk-xmhtml lib \ + obgtk obgnome guile-gtk guile-gnome \ + programs DISTCLEANFILES = stamp-v diff -uNr gnome-0.10/Makefile.in gnome-0.11/Makefile.in --- gnome-0.10/Makefile.in Mon Dec 8 12:37:25 1997 +++ gnome-0.11/Makefile.in Wed Jan 7 20:30:41 1998 @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.2c from Makefile.am +# Makefile.in generated automatically by automake 1.2d from Makefile.am # Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -49,12 +49,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ -NORMAL_INSTALL = true -PRE_INSTALL = true -POST_INSTALL = true -NORMAL_UNINSTALL = true -PRE_UNINSTALL = true -POST_UNINSTALL = true +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : host_alias = @host_alias@ host_triplet = @host@ CATALOGS = @CATALOGS@ @@ -77,6 +77,7 @@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ INTLSUB = @INTLSUB@ +JPEG_LIBS = @JPEG_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ @@ -86,8 +87,10 @@ MAKEINFO = @MAKEINFO@ MSGFMT = @MSGFMT@ NM = @NM@ +OBJC = @OBJC@ OSOCKADDR_CFLAGS = @OSOCKADDR_CFLAGS@ PACKAGE = @PACKAGE@ +PNG_LIBS = @PNG_LIBS@ POFILES = @POFILES@ POSUB = @POSUB@ PTHREAD_LIB = @PTHREAD_LIB@ @@ -97,9 +100,14 @@ TERMCAP_LIB = @TERMCAP_LIB@ VERSION = @VERSION@ XF86MISC_LIBS = @XF86MISC_LIBS@ +XPM_LIBS = @XPM_LIBS@ +YACC = @YACC@ +Z_LIBS = @Z_LIBS@ x_libs = @x_libs@ -SUBDIRS = po intl libgnome libgnomeui lib obgtk guile-gtk programs guile-gnome +SUBDIRS = po intl libgnome libgnomeui gtk-xmhtml lib \ + obgtk obgnome guile-gtk guile-gnome \ + programs DISTCLEANFILES = stamp-v @@ -193,7 +201,7 @@ installdirs-recursive install-recursive uninstall-recursive \ check-recursive installcheck-recursive info-recursive dvi-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ - for subdir in $(SUBDIRS); do \ + list='$(SUBDIRS)'; for subdir in $$list; do \ target=`echo $@ | sed s/-recursive//`; \ echo "Making $$target in $$subdir"; \ (cd $$subdir && $(MAKE) $$target) \ @@ -203,7 +211,9 @@ mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ - rev=''; for subdir in $(SUBDIRS); do rev="$$subdir $$rev"; done; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + done; \ for subdir in $$rev; do \ target=`echo $@ | sed s/-recursive//`; \ echo "Making $$target in $$subdir"; \ @@ -217,17 +227,18 @@ tags: TAGS -ID: $(HEADERS) $(SOURCES) - here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS) +ID: $(HEADERS) $(SOURCES) $(LISP) + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ done; \ - test -z "$(ETAGS_ARGS)config.h.in$(SOURCES)$(HEADERS)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $(SOURCES) $(HEADERS) -o $$here/TAGS) + test -z "$(ETAGS_ARGS)config.h.in$(SOURCES)$(HEADERS)$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $(SOURCES) $(HEADERS) $(LISP) -o $$here/TAGS) mostlyclean-tags: diff -uNr gnome-0.10/README gnome-0.11/README --- gnome-0.10/README Tue Nov 25 01:21:29 1997 +++ gnome-0.11/README Wed Jan 7 18:43:17 1998 @@ -1,17 +1,17 @@ This document includes: -* General information -* Licensing -* Requirements + * General information + * Licensing + * Requirements * General information -This is the initial distribution of GNOME. - -This is beta software. + This is a snapshot of GNOME, the GNU desktop. -It is here to provide a framework for GNOME developers. + This is alpha software, there are many bugs and applications are +not yet ready for daily use. We encourage users to try the software +and submit fixes and improvements. * Licensing @@ -26,23 +26,43 @@ The Gnome desktop environment depends on a couple of extra packages for working properly: + - Guile 1.2: FSF's scheme interpreter. + + ftp://prep.ai.mit.edu/pub/gnu/guile-1.2.tar.gz + + - GNU gettext: + + ftp://prep.ai.mit.edu/pub/gnu + + - Gtk+ 0.99.1 + + ftp://ftp.gimp.org/pub/gtk/ + + - SLIB 2b3 + See http://www-swiss.ai.mit.edu/~jaffer/SLIB.html + - desktop_properties: This program requires that you have installed the latest BETA of the xlockmore program, available from: ftp://wauug.erols.com/pub/X-Windows/xlockmore/index.html - - Guile 1.2: FSF's scheme interpreter. - - ftp://prep.ai.mit.edu/pub/gnu/guile-1.2.tar.gz + - libXpm. - - Latest Gtk+: This is the release of the Gtk+ toolkit, the - toolkit used to build graphic applications with Gnome. +Optional libraries that might be used during compile: - ftp://ftp.gimp.org/pub/gtk/ + - JPEG, PNG and zlib are optionally used by the HTML display + engine. If found the engine will support those image formats. * Getting GNOME - ftp://ftp.nuclecu.unam.mx/GNOME/ - CVSROOT=:pserver:anonymous@gnome.org:/home/cvs - empty password +Available by FTP from: + + ftp://ftp.nuclecu.unam.mx/GNOME/ + +Available from Anonymous CVS: + + $ export CVSROOT=':pserver:anonymous@cvs.gimp.org:/debian/home/gnomecvs' + $ cvs login + (there is no password, just hit return) + $ cvs -z9 checkout gnome diff -uNr gnome-0.10/TODO gnome-0.11/TODO --- gnome-0.10/TODO Tue Nov 25 01:29:40 1997 +++ gnome-0.11/TODO Tue Jan 6 22:18:38 1998 @@ -1,61 +1,469 @@ -Panel: - - The menu should display a default icon if a - menu entry does not have one. +Tasks for the GNOME project: - - Should have a configuration window. + - The gnome-dns functions should use an external helper + program, instead of forking off. This is to reduce + memory usage (i.e. four little server programs take + up less memory than four copies of the same program, + even with copy-on-write taken into consideration) -Phaser Chess: + - Someone has started on a Calendar kind of thing. The + interface to the internals of the calendar should be + exported with CORBA. - - Should provide a way to quit. + See: http://www.triode.net.au/~csmall/gnome.html -Cromagnon: + I want to see something like ical as shipped with Red hat + with gnome, and to export the calendar interface. - - About box needs an ok button. - - Look should be enhanced + - We need a gnome_about function that would display an about + box for applications. Something like: -Same-Gnome: + gnome_about (char *author_stuff, *bug_report_stuff) + + This is just an idea. + *update* Use the GnomeMessageBox widget. + + - A font selector program or a library routine. + + To let the users choose a font with a nice dialog box. + *update* need to snarf it from the gimp, perhaps. + *update* Done... Need to make a config app + to let users make typeface suitcases (i.e. "Headlines", + "sans serifs", "serifs"), and then have this dialog + allow users to choose from typefaces in suitcases. + +keycaps: - - Colors should be fixed. - - Add code to figure out when the game is over. - - Give extra points for cleaing the whole field (1000 points). - - disable resize - - keep scores - - preferences + - Port the XKeycaps to Gtk. + +Panel: + + - Very important: a docking applet that would allow regular + programs to be docket into the panel, here is what KDE is + doing on this regard: http://www.gnome.org/kde-dock.txt + + *update* you already had the "swallow" applet here, + and it is exactly the same thing (I think): + - Swallow applet. We need something to swallow running X + applications into the panel. It should be easy to do. + + We could have applications dock via either title (the + traditional fvwm way of doing it) or via setting the property + (the KDE way of doing it). + + - If the panel is started for the first time, it should load a + couple of applets in default locations. Currently, it just + sticks them all at 0,0 (making people complain about this). + + - The panel needs some ways to configure its behaviour. The + code for the behaviour is there, the dialog box is not. + + - The panel should provide other ways of hiding it, not just + moving down like it is doing right now. It should also + allow something like the MacOS8 thing that + collapses/minimizes itself. + + - An applet that would talk to some existing window managers + for controlling the virtual desktop. + + This applet should at least be able to talk to fvwm (we can + write an fvwm module that would talk to our panel in this + case). Supporting WindowMaker and supporting E is also + important. -Linux Conf: + - A talk notification program (see Gnome/Talk below) - finish + - Caldendar applet. Should talk corba with the real + calendar. -GnomeZilla: + - The Panel could use an applet that contacts the session + manager and requests a logout. (I think this would be easy to do. -tom) - - Finish. - - Add icons + - CPUload applet. + +Window manager: + + - The window managers should be patches to support the following: + + - Some kind of hint for having windows without much decoration + (for the floating menus/toolbars). + +CORBA: + + - We need an ORB. It must support C bindings at least, + and have a license that is compatible with Gnome (i.e. + it must be BSD-style or GPL-style). + + - We need to figure out some way to start corba services. At + this point. + + Ie, have some way for applications to start up servers on + demand (the BOA thing), at this point we can just assume + that everything will be running on the local host. + + I have completely ignored this, as I am working + on getting the XmHTML engine working on Gtk. We are just 1 + file away from getting it to link. Then we will need to get + it working. + + - An interface to talk to the calendar through corba and + display a nice calendar with things marked of when you have + somehting to do. + +Same-Gnome: + - It doesn't work - it needs left & right buttons pressed together + to get rid of balls, and changing pixmaps doesn't work + + - Colors should be fixed. + + - Add code to figure out when the game is over. + and + - Give extra points for cleaing the whole field (1000 points). + + - disable resize + + - preferences + + - same-gnome needs to have an end-of-game state where it logs the + score using gnome-score system, shows the list to the player, etc. Gulp: + + - GULP is horrible right now. + + - We need to fix the look of GULP to look -at least- like + KDE's klpd program. + + - GULP needs to talk the LPD protocol instead of relying on + the lpc/lpq commands. + *psst* *hint* I'm waiting for GtkCList + *psst* Jay is busy changing this widget, we'll have to + wait. + +Gnome/Talk: + + - We should probably drop Gnome/Talk in favor of the GNU/Talk. + + GNU/Talk has a bunch of frontends (Motif, Xaw, and ncurses + are supported). So, doing a Gtk version should be easy + according to the author. + + GNU/Talk comes with an enhanced daemon that knows how to + talk to an X application if the user is running X to notify + him. This guy did the work for us :-). - - The look need improvement. + So, we probably want to port his code and probably reuse + some of the work we have (mainly using GtkTerm widget for + this). + + More details here: + + http://www.ultranet.com/~zappo/gtalk.shtml + *update* I couldn't get it to run. Anyone else want to try? + - Elliot + +Games: + - We need a general gnome-score program that would take care + of all the scoring issues: displaying player names, scores + and so on. + + This can be made a shared library, I do not really care that + much. + * Written. It's part of libgnome. + + - keep scores (the score keeping facility should be using + gnome-config routines to access the information, and not a + hand crafted routine). + * Written. However, I don't think it should use gnome_config + - we don't want to turn gnome_config into a catch-all + database. Any other ideas? + +GMIX: + - Add nice icons and update the interface to make it look + sexy. + - Allow user to show only a subset of the available sliders. + + - Export functionality via CORBA or whatever to allow other + multimedia programs to access the mixer. -Network utilities: +GemVT: - - Should scroll + - We need to add dingus support to it (http://dingus.mit.edu). + * Nat will do this soon. -Guile/Gnome: + - Use the terminal widget to implement a decent terminal: + with menus for doing all of the relevant tasks. - - Export the toolbar - - Export gnoem-config iterators + - Add some way to change the color scheme: xterm colors; rxvt + colors; Linux console colors (just like KDE has). -gmix: - - Add icons - - Add about box. - - Allow the app to start and then let the user select the mixer device. + - Support for changing the font. Use the font selector. -Games: - A Score facility + - Check gnome/programs/gemvt/TODO for more information on what + is missing on it. + +GTop: + + - Integrate into the Gnome tree. + + - Use Jay Painters's GtkCList widget for displaying the + information + + - Either do it, or help out Radek finishing this. + +Logging: + + - Write either an panel applet or a program that would let + you quickly review the system logs. Many good idesa on + this subject were presented on the Gnome mailing lists. + + This has been done by Cesar (miquel@dfuba.df.uba.ar) + Look here: + http://www.df.uba.ar/~hprel/miquel/logview.html + +Desktop-Properties: + + - bug in gtk - when rc changes font => improper geometry management + background screensaver + + - position of xlock parent window - something is wrong + + - special handling for random mode - maybe make own + + - xlock global settings + xlock settings window buttons don't work (except Cancel) + xlock Apply button should ghost + xlock settings window should probably do local grab + + - change double-click speed on mouse page + this requires changes to gtk + + - need configurator to change language and other locale things + + - Preview of the background image should be scaled + + - An application that would you configure the current + resolution (this is already on some KDE conrtol panel). + + - xlock could use a way to contact the session manager and request a + logout. + +Gtk/Gdk improvements: + + - We need a routine that would scale a bitmap. + + Rasterman's IMBLIb comes to mind. If we can put this to use + under the Gdk framework (or merge it there, the better). + + - At this point the code is consuming a lot of colors while + displaying pixmaps. We need this to be corrected. The last + version of gdk as found on the cvs tree include the color + context code (gdkcc.c) that can be used to some extent. + This code is from the guy that did the Mathematica/Motif + code, and is used by XmHTML. It greatly simplifies X color + allocation. + + Anyways, we need someone that understands colors to look at + this and to look at some decent way to not steal the whole + palette from X. + + - We should provide some way of reconfiguring the look of the + Gtk widgets (only their colors for now). + + This will be used to provide the color schemes for the + currently running Gnome applications. + + - The color selector needs a list of system colors and custom + colors (allow users to have their own set of predefined + colors, like the Next color selector). + + - Extra modes for the color selector (like the next has). + + - A drop down list widget (combobox). + + - Notebook widgets at some point should start stacking instead + of making the window bigger. + + - Gdk pixmap loading performance is pretty bad. We should change + the code to use the libXpm if it is found on the system at + compile time in the worst case. Right now, loading a 48x48 xpm + takes around 1 sec on an 486/66mhz. + +Web/FTP site: + + - Move them to redhat. + + - Make daily snapshots of the CVS tree. + + - Update the Web pages to reflect the project status. + +Oleo (a spreadsheet): + + - Someone at GNU is working on getting this working with Gtk. + + We need to help him with the Gtk stuff. We do not want a + crappy Spreadsheet for Gnome, we want something that is + equivalent to Excel. So, he may use some help. + + - I can provide his email address to anyone interested in + helping him. + +ICQ: + + - People like this thing. It is horrible, but they love it. + + - Someone in LinuxNet has reverse enginered the protocol (name + withheld until I figure out if he does not mind to put his + name here). + +CD-Player: + + - This should be allowed to run as an applet I think. + + - Actually, provide a GnomeCDPlayer widget. Thus, the applet + and the main program can just use this widget. + + - It should provide all the cool features on other cd players, + like using a database of cds to recognize the cd name and + the songs. + + Pista, Ching Hui and tc have both implemented some of this. + Sigh, what a shame. + +Session Management: + + - We have some code contributed by Tom Tromey and Elliot Lee, + they are working on this. + +XDM: + + - We want an XDM replacement or at least an XDM that is as + cute as the SGI one. This lists all the users on the system + with icons. + + - Users can override the default icon for themselves. + + Apparently the XDM-photo program does something like this, + it is rumoured that the code is available in sunsite. + +File Manager: + + - the port is being worked on. + +Gnome/IRC: + + - Pista has intentions of working on this. Anyoen else? + +PPP dialer: + + - Use Jay Painter's Gtk version of his EzPPP program + + - This program should support defining a provider as a set of + phone numbers, so that they are tried one after the other + (like XISP does). + +Mail program: + + - Jay painter has Balsa, it needs to be finished. + + (http://www.serv.net/~jpaint/balsa) + + - Lars Wirzenius has this one written in Python, some ideas + must definetly be incorporated into our mailer: + + http://www.iki.fi/liw/Slime + + - Another existing Gtk-based mail reader is GMail: + http://cc1000916-a.avnl1.nj.home.com/gmail/gmail.html + +Ghostscript frontend: + + - We have some code on the CVS repository that talks to + ghostscript (this was taken from gv and ghostview). We need + to finish the Gnome version of this. + +News program: + + - Port some existing code to Gtk. Slrn is a good candidate. + + - I personally would like to see Gnus ported, but it may be + a difficult task. + +FAX send/receive program: + + - This is being worked on (http://www.bowtie.nl/gnfax). + + +Calculator: + + - We have a calculator from Marius, it needs to be made nicer. + - George Lebl has written GNOME Genius, look here for + more information: http://www.5z.com/jirka/linux.html + +Calendar/Rolodex/Appointment: + + - This is being worked on by csmall@scooter.o.i.net + (http://www.triode.net.au/~csmall/gnome.html). + + - We want to make it interoperable with the existing + standards. draft-ietf-calsch-ical-01.txt is available + on your favorite internet drafts repository + (ftp://ds.internic.net/internet-drafts is a good starting point). + +Cromagnon: + + - It needs to use the GtkCList widget. + + - It needs to be made prettier. + +PDF viewer: + + - A Gnome interface to xpdf + +Tasks that are partially done now: + + - A GnomeToolbar widget. + + This should provide a Toolbar like those that are + found on Excel and Word. + + *update* Federico has done this GtkToolbar + + - A GnomeApp widget that would create a menubar, a toolbar, a + status bar and a region for the program to display its + information. + + *update* This has been done by Elliot Lee. + *update* Miguel is going to update the API a little. + + This would take care of connecting the toolbar signals to + allow the toolbar to be dragged outside of the main + application and to allow it to redock itself. + + *update* GtkHandleBox has been written by Elliot Lee. + + I believe this can be done quickly by having this widget + have a GtkTable inside that would be used to stick all of + these elements inside. + + - Recently Used documents api: + + Provide an API for programs to register when a document has + been visited. This puts a file in ~/.gnome/recent-docs with + some information: creator, string describing what this is + and the document name: + + gnome_recently_used (char *creator, char *desc, char *name) + + example: + gnome_recently_used ("Word", "Word document", "/home/mydoc") + gnome_recently_used ("GnomeTalk", "Talk session", "miguel@gnu.org") + *update* Mostly implemented in gnome-history.[ch] by Elliot -* Write a lisp/scheme scanner for xgettext -* Modify GTk so that color schemes can easily be changed -* Likewise modify GTk so that double/triple click times are - configurable -* Change xkeycaps to use GTk. + - File conversion code. Partially done in + libgnome/gnome-fileconvert.[ch], but need to change + gfc_get_path() to allow indirect conversion paths + through multiple filters. (Anyone know of a good algorithm + for this?) diff -uNr gnome-0.10/aclocal.m4 gnome-0.11/aclocal.m4 --- gnome-0.10/aclocal.m4 Mon Dec 8 12:17:07 1997 +++ gnome-0.11/aclocal.m4 Wed Jan 7 18:44:15 1998 @@ -1,4 +1,4 @@ -dnl aclocal.m4 generated automatically by aclocal 1.2c +dnl aclocal.m4 generated automatically by aclocal 1.2d dnl Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. dnl This Makefile.in is free software; the Free Software Foundation @@ -322,8 +322,8 @@ ifelse([$3],, AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) -AM_SANITY_CHECK -AC_ARG_PROGRAM +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) dnl FIXME This is truly gross. missing_dir=`cd $ac_aux_dir && pwd` AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) @@ -331,7 +331,7 @@ AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_PROG_MAKE_SET]) +AC_REQUIRE([AC_PROG_MAKE_SET])]) # serial 1 @@ -362,6 +362,17 @@ # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + test "[$]2" = conftestfile ) then @@ -391,7 +402,7 @@ AC_SUBST($1)]) -# serial 12 AM_PROG_LIBTOOL +# serial 18 AM_PROG_LIBTOOL AC_DEFUN(AM_PROG_LIBTOOL, [AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_PROG_RANLIB]) @@ -401,17 +412,18 @@ AC_REQUIRE([AC_PROG_LN_S]) # Always use our own libtool. -LIBTOOL='$(top_builddir)/libtool' +LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL) dnl Allow the --disable-shared flag to stop us from building shared libs. AC_ARG_ENABLE(shared, [ --enable-shared build shared libraries [default=yes]], [if test "$enableval" = no; then - enable_shared=no + libtool_enable_shared=no else - enable_shared=yes + libtool_enable_shared=yes fi]) +test -n "$libtool_enable_shared" && enable_shared="$libtool_enable_shared" libtool_shared= test "$enable_shared" = no && libtool_shared=" --disable-shared" @@ -419,10 +431,11 @@ AC_ARG_ENABLE(static, [ --enable-static build static libraries [default=yes]], [if test "$enableval" = no; then - enable_static=no + libtool_enable_static=no else - enable_static=yes + libtool_enable_static=yes fi]) +test -n "$libtool_enable_static" && enable_static="$libtool_enable_static" libtool_static= test "$enable_static" = no && libtool_static=" --disable-static" @@ -436,12 +449,28 @@ [case "$host" in *-*-irix6*) ac_save_CFLAGS="$CFLAGS" - # -n32 always needs to be added to the linker when using GCC. - test "$ac_cv_prog_gcc" = yes && CFLAGS="$CFLAGS -n32" - for f in '-32' '-64' '-cckr' '-n32' '-mips1' '-mips2' '-mips3' '-mips4'; do - if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then - LD="${LD-ld} $f" - fi + flag_passed=no + for f in -32 -64 -n32 ABI -cckr -mips1 -mips2 -mips3 -mips4; do + case "$f" in + ABI) + test -n "$SGI_ABI" && flag_passed=yes + if test "$flag_passed" = no && test "$ac_cv_prog_gcc" = yes; then + # Choose the ABI flag according to GCC's specs. + if $CC -dumpspecs 2>&1 | sed '/^\*link:$/,/^$/!d' | egrep -e '[ ]-32' >/dev/null; then + LD="${LD-ld} -32" + else + LD="${LD-ld} -n32" + fi + fi + ;; + + *) + if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then + flag_passed=yes + LD="${LD-ld} $f" + fi + ;; + esac done CFLAGS="$ac_save_CFLAGS" ;; @@ -473,7 +502,9 @@ ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. - /*) ;; + /*) + test -z "$LD" && LD="$ac_prog" + ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld @@ -489,12 +520,7 @@ AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(ac_cv_path_LD, -[LD=${LD-$ac_prog} -case "$LD" in - /*) - ac_cv_path_LD="$LD" # Let the user override the test with a path. - ;; - *) +[if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. @@ -511,8 +537,9 @@ fi done IFS="$ac_save_ifs" - ;; -esac]) +else + ac_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) LD="$ac_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) @@ -544,13 +571,15 @@ ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in /usr/ucb:$PATH:/bin; do + for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do test -z "$ac_dir" && dir=. if test -f $ac_dir/nm; then # Check to see if the nm accepts a BSD-compat flag. - if ($ac_dir/nm -B /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then + # Adding the `sed 1!d' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1!d'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -B" - elif ($ac_dir/nm -p /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1!d'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -p" else ac_cv_path_NM="$ac_dir/nm" @@ -566,4 +595,17 @@ AC_MSG_RESULT([$NM]) AC_SUBST(NM) ]) + +# Define a conditional. + +AC_DEFUN(AM_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) diff -uNr gnome-0.10/configure gnome-0.11/configure --- gnome-0.10/configure Mon Dec 8 12:17:11 1997 +++ gnome-0.11/configure Wed Jan 7 18:44:17 1998 @@ -620,24 +620,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -PACKAGE=gnome - -VERSION=0.10 - -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } -fi -cat >> confdefs.h <> confdefs.h <&6 -echo "configure:641: checking whether build environment is sane" >&5 +echo "configure:625: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -652,6 +636,17 @@ # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + test "$2" = conftestfile ) then @@ -682,9 +677,54 @@ # sed with no file args requires a program. test "$program_transform_name" = "" && program_transform_name="s,x,x," +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:682: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=gnome + +VERSION=0.11 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 -echo "configure:688: checking for working aclocal" >&5 +echo "configure:728: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -697,7 +737,7 @@ fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:701: checking for working autoconf" >&5 +echo "configure:741: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -710,7 +750,7 @@ fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:714: checking for working automake" >&5 +echo "configure:754: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -723,7 +763,7 @@ fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:727: checking for working autoheader" >&5 +echo "configure:767: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -736,7 +776,7 @@ fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:740: checking for working makeinfo" >&5 +echo "configure:780: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -748,42 +788,17 @@ echo "$ac_t""missing" 1>&6 fi -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:753: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi -export USE_GNOME=yes +USE_GNOME=yes +export USE_GNOME # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:787: checking for $ac_word" >&5 +echo "configure:802: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -812,7 +827,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:816: checking for $ac_word" >&5 +echo "configure:831: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -860,7 +875,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:864: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:879: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -870,11 +885,11 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -894,12 +909,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:898: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:913: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:903: checking whether we are using GNU C" >&5 +echo "configure:918: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -908,7 +923,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:912: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:927: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -923,7 +938,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:927: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:942: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -957,7 +972,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:961: checking host system type" >&5 +echo "configure:976: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -980,7 +995,7 @@ # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:984: checking for $ac_word" >&5 +echo "configure:999: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1019,11 +1034,13 @@ if test "$ac_cv_prog_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1023: checking for ld used by GCC" >&5 +echo "configure:1038: checking for ld used by GCC" >&5 ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. - /*) ;; + /*) + test -z "$LD" && LD="$ac_prog" + ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld @@ -1035,20 +1052,15 @@ esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1039: checking for GNU ld" >&5 +echo "configure:1056: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1042: checking for non-GNU ld" >&5 +echo "configure:1059: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - LD=${LD-$ac_prog} -case "$LD" in - /*) - ac_cv_path_LD="$LD" # Let the user override the test with a path. - ;; - *) + if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. @@ -1065,8 +1077,9 @@ fi done IFS="$ac_save_ifs" - ;; -esac +else + ac_cv_path_LD="$LD" # Let the user override the test with a path. +fi fi LD="$ac_cv_path_LD" @@ -1078,7 +1091,7 @@ test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1082: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1095: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1094,7 +1107,7 @@ echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1098: checking for BSD-compatible nm" >&5 +echo "configure:1111: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1104,13 +1117,15 @@ ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in /usr/ucb:$PATH:/bin; do + for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do test -z "$ac_dir" && dir=. if test -f $ac_dir/nm; then # Check to see if the nm accepts a BSD-compat flag. - if ($ac_dir/nm -B /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then + # Adding the `sed 1!d' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1!d'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -B" - elif ($ac_dir/nm -p /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1!d'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -p" else ac_cv_path_NM="$ac_dir/nm" @@ -1129,7 +1144,7 @@ echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1133: checking whether ln -s works" >&5 +echo "configure:1148: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1157,19 +1172,20 @@ # Always use our own libtool. -LIBTOOL='$(top_builddir)/libtool' +LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" if test "$enableval" = no; then - enable_shared=no + libtool_enable_shared=no else - enable_shared=yes + libtool_enable_shared=yes fi fi +test -n "$libtool_enable_shared" && enable_shared="$libtool_enable_shared" libtool_shared= test "$enable_shared" = no && libtool_shared=" --disable-shared" @@ -1177,12 +1193,13 @@ if test "${enable_static+set}" = set; then enableval="$enable_static" if test "$enableval" = no; then - enable_static=no + libtool_enable_static=no else - enable_static=yes + libtool_enable_static=yes fi fi +test -n "$libtool_enable_static" && enable_static="$libtool_enable_static" libtool_static= test "$enable_static" = no && libtool_static=" --disable-static" @@ -1196,12 +1213,28 @@ case "$host" in *-*-irix6*) ac_save_CFLAGS="$CFLAGS" - # -n32 always needs to be added to the linker when using GCC. - test "$ac_cv_prog_gcc" = yes && CFLAGS="$CFLAGS -n32" - for f in '-32' '-64' '-cckr' '-n32' '-mips1' '-mips2' '-mips3' '-mips4'; do - if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then - LD="${LD-ld} $f" - fi + flag_passed=no + for f in -32 -64 -n32 ABI -cckr -mips1 -mips2 -mips3 -mips4; do + case "$f" in + ABI) + test -n "$SGI_ABI" && flag_passed=yes + if test "$flag_passed" = no && test "$ac_cv_prog_gcc" = yes; then + # Choose the ABI flag according to GCC's specs. + if $CC -dumpspecs 2>&1 | sed '/^\*link:$/,/^$/!d' | egrep -e '[ ]-32' >/dev/null; then + LD="${LD-ld} -32" + else + LD="${LD-ld} -n32" + fi + fi + ;; + + *) + if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then + flag_passed=yes + LD="${LD-ld} $f" + fi + ;; + esac done CFLAGS="$ac_save_CFLAGS" ;; @@ -1220,7 +1253,7 @@ || { echo "configure: error: libtool configure failed" 1>&2; exit 1; } echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1224: checking how to run the C preprocessor" >&5 +echo "configure:1257: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1235,13 +1268,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1245: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1278: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1252,13 +1285,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1262: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1295: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1281,12 +1314,12 @@ echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1285: checking for ANSI C header files" >&5 +echo "configure:1318: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1294,7 +1327,7 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1298: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1331: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1311,7 +1344,7 @@ if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1329,7 +1362,7 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1350,7 +1383,7 @@ : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1361,7 +1394,7 @@ exit (0); } EOF -if { (eval echo configure:1365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1411,19 +1444,20 @@ # Always use our own libtool. -LIBTOOL='$(top_builddir)/libtool' +LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" if test "$enableval" = no; then - enable_shared=no + libtool_enable_shared=no else - enable_shared=yes + libtool_enable_shared=yes fi fi +test -n "$libtool_enable_shared" && enable_shared="$libtool_enable_shared" libtool_shared= test "$enable_shared" = no && libtool_shared=" --disable-shared" @@ -1431,12 +1465,13 @@ if test "${enable_static+set}" = set; then enableval="$enable_static" if test "$enableval" = no; then - enable_static=no + libtool_enable_static=no else - enable_static=yes + libtool_enable_static=yes fi fi +test -n "$libtool_enable_static" && enable_static="$libtool_enable_static" libtool_static= test "$enable_static" = no && libtool_static=" --disable-static" @@ -1450,12 +1485,28 @@ case "$host" in *-*-irix6*) ac_save_CFLAGS="$CFLAGS" - # -n32 always needs to be added to the linker when using GCC. - test "$ac_cv_prog_gcc" = yes && CFLAGS="$CFLAGS -n32" - for f in '-32' '-64' '-cckr' '-n32' '-mips1' '-mips2' '-mips3' '-mips4'; do - if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then - LD="${LD-ld} $f" - fi + flag_passed=no + for f in -32 -64 -n32 ABI -cckr -mips1 -mips2 -mips3 -mips4; do + case "$f" in + ABI) + test -n "$SGI_ABI" && flag_passed=yes + if test "$flag_passed" = no && test "$ac_cv_prog_gcc" = yes; then + # Choose the ABI flag according to GCC's specs. + if $CC -dumpspecs 2>&1 | sed '/^\*link:$/,/^$/!d' | egrep -e '[ ]-32' >/dev/null; then + LD="${LD-ld} -32" + else + LD="${LD-ld} -n32" + fi + fi + ;; + + *) + if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then + flag_passed=yes + LD="${LD-ld} $f" + fi + ;; + esac done CFLAGS="$ac_save_CFLAGS" ;; @@ -1479,7 +1530,7 @@ # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:1483: checking for X" >&5 +echo "configure:1534: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -1541,12 +1592,12 @@ # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1550: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1601: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1615,14 +1666,14 @@ ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -1728,17 +1779,17 @@ case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:1732: checking whether -R must be followed by a space" >&5 +echo "configure:1783: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_nospace=yes else @@ -1754,14 +1805,14 @@ else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_space=yes else @@ -1793,7 +1844,7 @@ # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:1797: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:1848: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1801,7 +1852,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1834,7 +1885,7 @@ if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:1838: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:1889: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1842,7 +1893,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1882,12 +1933,12 @@ # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:1886: checking for gethostbyname" >&5 +echo "configure:1937: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -1931,7 +1982,7 @@ if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1935: checking for gethostbyname in -lnsl" >&5 +echo "configure:1986: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1939,7 +1990,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1980,12 +2031,12 @@ # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:1984: checking for connect" >&5 +echo "configure:2035: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -2029,7 +2080,7 @@ if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:2033: checking for connect in -lsocket" >&5 +echo "configure:2084: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2037,7 +2088,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2072,12 +2123,12 @@ # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:2076: checking for remove" >&5 +echo "configure:2127: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -2121,7 +2172,7 @@ if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:2125: checking for remove in -lposix" >&5 +echo "configure:2176: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2129,7 +2180,7 @@ ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2164,12 +2215,12 @@ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:2168: checking for shmat" >&5 +echo "configure:2219: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -2213,7 +2264,7 @@ if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:2217: checking for shmat in -lipc" >&5 +echo "configure:2268: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2221,7 +2272,7 @@ ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2287: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2265,7 +2316,7 @@ # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:2269: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:2320: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2273,7 +2324,7 @@ ac_save_LIBS="$LIBS" LIBS="-lICE $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2316,7 +2367,7 @@ LDFLAGS="$X_LDFLAGS $X_LIBS" echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 -echo "configure:2320: checking for XOpenDisplay in -lX11" >&5 +echo "configure:2371: checking for XOpenDisplay in -lX11" >&5 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2324,7 +2375,7 @@ ac_save_LIBS="$LIBS" LIBS="-lX11 $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2361,7 +2412,7 @@ LDFLAGS="$saved_ldflags $X_LDFLAGS $X_LIBS $x_libs" echo $ac_n "checking for XShmAttach in -lXext""... $ac_c" 1>&6 -echo "configure:2365: checking for XShmAttach in -lXext" >&5 +echo "configure:2416: checking for XShmAttach in -lXext" >&5 ac_lib_var=`echo Xext'_'XShmAttach | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2369,7 +2420,7 @@ ac_save_LIBS="$LIBS" LIBS="-lXext $x_libs $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2401,10 +2452,13 @@ fi + export xx_libs + export xX_LIBS + export xGTK_LIBS LDFLAGS="$saved_ldflags $X_LDFLAGS $X_LIBS" echo $ac_n "checking for SmcSaveYourselfDone in -lSM""... $ac_c" 1>&6 -echo "configure:2408: checking for SmcSaveYourselfDone in -lSM" >&5 +echo "configure:2462: checking for SmcSaveYourselfDone in -lSM" >&5 ac_lib_var=`echo SM'_'SmcSaveYourselfDone | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2412,7 +2466,7 @@ ac_save_LIBS="$LIBS" LIBS="-lSM $x_libs -lICE $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2448,27 +2502,27 @@ fi - echo $ac_n "checking for gtk_button_new in -lgtk""... $ac_c" 1>&6 -echo "configure:2453: checking for gtk_button_new in -lgtk" >&5 -ac_lib_var=`echo gtk'_'gtk_button_new | sed 'y%./+-%__p_%'` + echo $ac_n "checking for gdk_pixmap_unref in -lgtk""... $ac_c" 1>&6 +echo "configure:2507: checking for gdk_pixmap_unref in -lgtk" >&5 +ac_lib_var=`echo gtk'_'gdk_pixmap_unref | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lgtk -lgdk -lglib $x_libs -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2486,13 +2540,56 @@ GTK_LIBS="-lgtk -lgdk -lglib -lm" else echo "$ac_t""no" 1>&6 -{ echo "configure: error: Can not link with gtk/gdk/glib" 1>&2; exit 1; } +{ echo "configure: error: Can not find a Gtk 0.99.1" 1>&2; exit 1; } +fi + + + + XPM_LIBS="" + echo $ac_n "checking for XpmFree in -lXpm""... $ac_c" 1>&6 +echo "configure:2551: checking for XpmFree in -lXpm" >&5 +ac_lib_var=`echo Xpm'_'XpmFree | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lXpm $x_libs $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + XPM_LIBS="-lXpm" +else + echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:2496: checking for pthread_create in -lpthread" >&5 +echo "configure:2593: checking for pthread_create in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2500,7 +2597,7 @@ ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2541,7 +2638,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2545: checking for $ac_word" >&5 +echo "configure:2642: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2572,7 +2669,7 @@ echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2576: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:2673: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2582,11 +2679,11 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2612,12 +2709,12 @@ { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2616: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2713: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:2621: checking whether we are using GNU C++" >&5 +echo "configure:2718: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2626,7 +2723,7 @@ yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2630: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2727: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -2641,7 +2738,7 @@ ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:2645: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:2742: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2668,10 +2765,39 @@ test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" fi +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2772: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2675: checking for $ac_word" >&5 +echo "configure:2801: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2704,7 +2830,7 @@ *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:2708: checking for yywrap in -l$ac_lib" >&5 +echo "configure:2834: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2712,7 +2838,7 @@ ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2746,7 +2872,7 @@ fi echo $ac_n "checking lex output file root""... $ac_c" 1>&6 -echo "configure:2750: checking lex output file root" >&5 +echo "configure:2876: checking lex output file root" >&5 if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2767,7 +2893,7 @@ LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6 -echo "configure:2771: checking whether yytext is a pointer" >&5 +echo "configure:2897: checking whether yytext is a pointer" >&5 if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2779,14 +2905,14 @@ ac_save_LIBS="$LIBS" LIBS="$LIBS $LEXLIB" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_prog_lex_yytext_pointer=yes else @@ -2808,17 +2934,79 @@ fi +for ac_prog in $OBJC gcc +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2943: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$OBJC"; then + ac_cv_prog_OBJC="$OBJC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_OBJC="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +OBJC="$ac_cv_prog_OBJC" +if test -n "$OBJC"; then + echo "$ac_t""$OBJC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$OBJC" && break +done +test -n "$OBJC" || OBJC="""" + +result=1 +if test -n "$OBJC"; then + echo $ac_n "checking for Objective C compiler""... $ac_c" 1>&6 +echo "configure:2975: checking for Objective C compiler" >&5 + cat > conftest.m <&5 2>&1 + result=$? + rm -f conftest* +fi + + +if test "$result" -eq 0; then + OBJECTIVE_C_TRUE= + OBJECTIVE_C_FALSE='#' +else + OBJECTIVE_C_TRUE='#' + OBJECTIVE_C_FALSE= +fi +if test $result -eq 0; then + echo "$ac_t""found" 1>&6 +else + echo "$ac_t""not found" 1>&6 +fi + echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2817: checking for working const" >&5 +echo "configure:3005: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3059: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2888,21 +3076,21 @@ fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2892: checking for inline" >&5 +echo "configure:3080: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3094: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2928,12 +3116,12 @@ esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2932: checking for off_t" >&5 +echo "configure:3120: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2961,12 +3149,12 @@ fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2965: checking for size_t" >&5 +echo "configure:3153: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2996,19 +3184,19 @@ # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:3000: checking for working alloca.h" >&5 +echo "configure:3188: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3029,12 +3217,12 @@ fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3033: checking for alloca" >&5 +echo "configure:3221: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3089,12 +3277,12 @@ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3093: checking whether alloca needs Cray hooks" >&5 +echo "configure:3281: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -echo "configure:3123: checking for $ac_func" >&5 +echo "configure:3311: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3174,7 +3362,7 @@ fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3178: checking stack direction for C alloca" >&5 +echo "configure:3366: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3182,7 +3370,7 @@ ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3226,17 +3414,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3230: checking for $ac_hdr" >&5 +echo "configure:3418: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3240: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3265,12 +3453,12 @@ for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3269: checking for $ac_func" >&5 +echo "configure:3457: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3318,7 +3506,7 @@ done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3322: checking for working mmap" >&5 +echo "configure:3510: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3326,7 +3514,7 @@ ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -3493,17 +3681,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3497: checking for $ac_hdr" >&5 +echo "configure:3685: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3507: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3532,12 +3720,12 @@ for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3536: checking for $ac_func" >&5 +echo "configure:3724: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3589,12 +3777,12 @@ for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3593: checking for $ac_func" >&5 +echo "configure:3781: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3651,19 +3839,19 @@ if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3655: checking for LC_MESSAGES" >&5 +echo "configure:3843: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'ud_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ud_cv_val_LC_MESSAGES=yes else @@ -3684,7 +3872,7 @@ fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3688: checking whether NLS is requested" >&5 +echo "configure:3876: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -3701,7 +3889,7 @@ EOF echo $ac_n "checking for explicitly using GNU gettext""... $ac_c" 1>&6 -echo "configure:3705: checking for explicitly using GNU gettext" >&5 +echo "configure:3893: checking for explicitly using GNU gettext" >&5 # Check whether --with-gnu-gettext or --without-gnu-gettext was given. if test "${with_gnu_gettext+set}" = set; then withval="$with_gnu_gettext" @@ -3716,7 +3904,7 @@ nls_cv_use_gnu_gettext=yes else echo $ac_n "checking for main in -lintl""... $ac_c" 1>&6 -echo "configure:3720: checking for main in -lintl" >&5 +echo "configure:3908: checking for main in -lintl" >&5 ac_lib_var=`echo intl'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3724,14 +3912,14 @@ ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3759,7 +3947,7 @@ fi echo $ac_n "checking for main in -li""... $ac_c" 1>&6 -echo "configure:3763: checking for main in -li" >&5 +echo "configure:3951: checking for main in -li" >&5 ac_lib_var=`echo i'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3767,14 +3955,14 @@ ac_save_LIBS="$LIBS" LIBS="-li $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3803,12 +3991,12 @@ CATOBJEXT=NONE echo $ac_n "checking for gettext""... $ac_c" 1>&6 -echo "configure:3807: checking for gettext" >&5 +echo "configure:3995: checking for gettext" >&5 if eval "test \"`echo '$''{'ac_cv_func_gettext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gettext=yes" else @@ -3852,7 +4040,7 @@ # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3856: checking for $ac_word" >&5 +echo "configure:4044: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3889,12 +4077,12 @@ for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3893: checking for $ac_func" >&5 +echo "configure:4081: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3944,7 +4132,7 @@ # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3948: checking for $ac_word" >&5 +echo "configure:4136: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3981,7 +4169,7 @@ # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3985: checking for $ac_word" >&5 +echo "configure:4173: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4026,12 +4214,12 @@ if test "$CATOBJEXT" = "NONE"; then echo $ac_n "checking for catgets""... $ac_c" 1>&6 -echo "configure:4030: checking for catgets" >&5 +echo "configure:4218: checking for catgets" >&5 if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_catgets=yes" else @@ -4076,7 +4264,7 @@ # Extract the first word of "gencat", so it can be a program name with args. set dummy gencat; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4080: checking for $ac_word" >&5 +echo "configure:4268: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GENCAT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4110,7 +4298,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4114: checking for $ac_word" >&5 +echo "configure:4302: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4145,7 +4333,7 @@ # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4149: checking for $ac_word" >&5 +echo "configure:4337: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4204,7 +4392,7 @@ # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4208: checking for $ac_word" >&5 +echo "configure:4396: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4241,7 +4429,7 @@ # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4245: checking for $ac_word" >&5 +echo "configure:4433: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4278,7 +4466,7 @@ # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4282: checking for $ac_word" >&5 +echo "configure:4470: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4355,7 +4543,7 @@ LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4359: checking for catalogs to be installed" >&5 +echo "configure:4547: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4375,17 +4563,17 @@ if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4379: checking for linux/version.h" >&5 +echo "configure:4567: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4389: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4426,7 +4614,7 @@ sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ < $srcdir/po/POTFILES.in > po/POTFILES -ALL_LINGUAS="cs it" +ALL_LINGUAS="cs it ko" if test x$ac_cv_func_gettext = xno; then LIBS="$LIBS -lintl -L\$(topbuilddir)/intl" @@ -4435,7 +4623,7 @@ echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:4439: checking for main in -lm" >&5 +echo "configure:4627: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4443,14 +4631,14 @@ ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4478,7 +4666,7 @@ fi echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:4482: checking for dlopen in -ldl" >&5 +echo "configure:4670: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4486,7 +4674,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4520,7 +4708,7 @@ echo $ac_n "checking for main in -lqthreads""... $ac_c" 1>&6 -echo "configure:4524: checking for main in -lqthreads" >&5 +echo "configure:4712: checking for main in -lqthreads" >&5 ac_lib_var=`echo qthreads'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4528,14 +4716,14 @@ ac_save_LIBS="$LIBS" LIBS="-lqthreads $LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4553,7 +4741,7 @@ QTTHREADS_LIB="-lqthreads" echo $ac_n "checking for main in -ltermcap""... $ac_c" 1>&6 -echo "configure:4557: checking for main in -ltermcap" >&5 +echo "configure:4745: checking for main in -ltermcap" >&5 ac_lib_var=`echo termcap'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4561,14 +4749,14 @@ ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4589,7 +4777,7 @@ fi echo $ac_n "checking for main in -lreadline""... $ac_c" 1>&6 -echo "configure:4593: checking for main in -lreadline" >&5 +echo "configure:4781: checking for main in -lreadline" >&5 ac_lib_var=`echo readline'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4597,14 +4785,14 @@ ac_save_LIBS="$LIBS" LIBS="-lreadline $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4629,7 +4817,7 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for qt_null in -lqt""... $ac_c" 1>&6 -echo "configure:4633: checking for qt_null in -lqt" >&5 +echo "configure:4821: checking for qt_null in -lqt" >&5 ac_lib_var=`echo qt'_'qt_null | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4637,7 +4825,7 @@ ac_save_LIBS="$LIBS" LIBS="-lqt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4676,15 +4864,15 @@ echo $ac_n "checking for scm_boot_guile in -lguile""... $ac_c" 1>&6 -echo "configure:4680: checking for scm_boot_guile in -lguile" >&5 +echo "configure:4868: checking for scm_boot_guile in -lguile" >&5 ac_lib_var=`echo guile'_'scm_boot_guile | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" -LIBS="-lguile $LIBS $LIBS" +LIBS="-lguile $QTTHREADS_LIB $LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4723,12 +4911,12 @@ for ac_func in strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4727: checking for $ac_func" >&5 +echo "configure:4915: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4777,22 +4965,314 @@ +Z_LIBS="" +JPEG_LIBS="" +PNG_LIBS="" +echo $ac_n "checking for inflate in -lz""... $ac_c" 1>&6 +echo "configure:4973: checking for inflate in -lz" >&5 +ac_lib_var=`echo z'_'inflate | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lz $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + Z_LIBS="-lz" +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for jpeg_abort in -ljpeg""... $ac_c" 1>&6 +echo "configure:5013: checking for jpeg_abort in -ljpeg" >&5 +ac_lib_var=`echo jpeg'_'jpeg_abort | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ljpeg $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + JPEG_LIBS="-ljpeg" +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for png_read_image in -lpng""... $ac_c" 1>&6 +echo "configure:5053: checking for png_read_image in -lpng" >&5 +ac_lib_var=`echo png'_'png_read_image | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpng $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + PNG_LIBS="-lpng" +else + echo "$ac_t""no" 1>&6 +fi + + + + +LIBS=$oLIBS + + +echo $ac_n "checking for mpz_init_set in -lgmp""... $ac_c" 1>&6 +echo "configure:5099: checking for mpz_init_set in -lgmp" >&5 +ac_lib_var=`echo gmp'_'mpz_init_set | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lgmp $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + we_have_gmp=true +else + echo "$ac_t""no" 1>&6 +we_have_gmp=false +fi + + + +if $we_have_gmp; then + HAVE_LIBGMP_TRUE= + HAVE_LIBGMP_FALSE='#' +else + HAVE_LIBGMP_TRUE='#' + HAVE_LIBGMP_FALSE= +fi +if $we_have_gmp; then + # Extract the first word of "flex", so it can be a program name with args. +set dummy flex; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:5152: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_LEX="flex" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" +fi +fi +LEX="$ac_cv_prog_LEX" +if test -n "$LEX"; then + echo "$ac_t""$LEX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$LEXLIB" +then + case "$LEX" in + flex*) ac_lib=fl ;; + *) ac_lib=l ;; + esac + echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 +echo "configure:5185: checking for yywrap in -l$ac_lib" >&5 +ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-l$ac_lib $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LEXLIB="-l$ac_lib" +else + echo "$ac_t""no" 1>&6 +fi + +fi + + for ac_prog in 'bison -y' byacc +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:5231: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_YACC="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +YACC="$ac_cv_prog_YACC" +if test -n "$YACC"; then + echo "$ac_t""$YACC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" + +fi for ac_hdr in linux/soundcard.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4786: checking for $ac_hdr" >&5 +echo "configure:5266: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4796: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5276: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4823,17 +5303,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4827: checking for $ac_hdr" >&5 +echo "configure:5307: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4837: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5317: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4862,9 +5342,9 @@ echo $ac_n "checking for struct osockaddr""... $ac_c" 1>&6 -echo "configure:4866: checking for struct osockaddr" >&5 +echo "configure:5346: checking for struct osockaddr" >&5 cat > conftest.$ac_ext < int main() { @@ -4873,7 +5353,7 @@ } ; return 0; } EOF -if { (eval echo configure:4877: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -5005,28 +5485,35 @@ lib/desktop-links/Makefile lib/pixmaps/Makefile obgtk/Makefile +obgnome/Makefile +gtk-xmhtml/Makefile po/Makefile.in programs/Makefile programs/cromagnon/Makefile programs/desktop-properties/Makefile programs/gmix/Makefile programs/gnometalk/Makefile +programs/gmailman/Makefile +programs/same-gnome/Makefile +programs/girc/Makefile programs/gnomine/Makefile programs/gulp/Makefile +programs/genius/Makefile programs/find-file/Makefile programs/linux-conf/Makefile programs/network-utilities/Makefile programs/notepad/Makefile programs/phaser-chess/Makefile +programs/gtt/Makefile programs/panel/Makefile programs/panel/batmon/Makefile programs/panel/clock/Makefile programs/panel/mailcheck/Makefile programs/panel/launcher/Makefile +programs/panel/logout/Makefile programs/panel/batmon/Makefile programs/panel/menu/Makefile programs/panel/netwatch/Makefile -programs/same-gnome/Makefile programs/test-suite/Makefile version.h stamp.h config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 @@ -5088,11 +5575,15 @@ s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g s%@x_libs@%$x_libs%g s%@GTK_LIBS@%$GTK_LIBS%g +s%@XPM_LIBS@%$XPM_LIBS%g s%@PTHREAD_LIB@%$PTHREAD_LIB%g s%@CXX@%$CXX%g s%@LEX@%$LEX%g s%@LEXLIB@%$LEXLIB%g s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g +s%@OBJC@%$OBJC%g +s%@OBJECTIVE_C_TRUE@%$OBJECTIVE_C_TRUE%g +s%@OBJECTIVE_C_FALSE@%$OBJECTIVE_C_FALSE%g s%@ALLOCA@%$ALLOCA%g s%@MSGFMT@%$MSGFMT%g s%@GMSGFMT@%$GMSGFMT%g @@ -5114,6 +5605,12 @@ s%@READLINE_LIB@%$READLINE_LIB%g s%@QTTHREADS_LIB@%$QTTHREADS_LIB%g s%@GUILE_LIBS@%$GUILE_LIBS%g +s%@Z_LIBS@%$Z_LIBS%g +s%@JPEG_LIBS@%$JPEG_LIBS%g +s%@PNG_LIBS@%$PNG_LIBS%g +s%@HAVE_LIBGMP_TRUE@%$HAVE_LIBGMP_TRUE%g +s%@HAVE_LIBGMP_FALSE@%$HAVE_LIBGMP_FALSE%g +s%@YACC@%$YACC%g s%@XF86MISC_LIBS@%$XF86MISC_LIBS%g s%@OSOCKADDR_CFLAGS@%$OSOCKADDR_CFLAGS%g s%@subdirs@%$subdirs%g @@ -5167,28 +5664,35 @@ lib/desktop-links/Makefile lib/pixmaps/Makefile obgtk/Makefile +obgnome/Makefile +gtk-xmhtml/Makefile po/Makefile.in programs/Makefile programs/cromagnon/Makefile programs/desktop-properties/Makefile programs/gmix/Makefile programs/gnometalk/Makefile +programs/gmailman/Makefile +programs/same-gnome/Makefile +programs/girc/Makefile programs/gnomine/Makefile programs/gulp/Makefile +programs/genius/Makefile programs/find-file/Makefile programs/linux-conf/Makefile programs/network-utilities/Makefile programs/notepad/Makefile programs/phaser-chess/Makefile +programs/gtt/Makefile programs/panel/Makefile programs/panel/batmon/Makefile programs/panel/clock/Makefile programs/panel/mailcheck/Makefile programs/panel/launcher/Makefile +programs/panel/logout/Makefile programs/panel/batmon/Makefile programs/panel/menu/Makefile programs/panel/netwatch/Makefile -programs/same-gnome/Makefile programs/test-suite/Makefile version.h stamp.h"} diff -uNr gnome-0.10/configure.in gnome-0.11/configure.in --- gnome-0.10/configure.in Mon Dec 8 12:17:00 1997 +++ gnome-0.11/configure.in Wed Jan 7 18:37:21 1998 @@ -4,12 +4,13 @@ AC_INIT(gnome.h) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(gnome, 0.10) +AM_INIT_AUTOMAKE(gnome, 0.11) dnl dnl let applications configure for gnome dnl -export USE_GNOME=yes +USE_GNOME=yes +export USE_GNOME AC_DEFUN(AC_GNOME_CHECK, [ @@ -35,6 +36,9 @@ x_libs="$x_libs -lXext", , $x_libs) + export xx_libs + export xX_LIBS + export xGTK_LIBS LDFLAGS="$saved_ldflags $X_LDFLAGS $X_LIBS" dnl Assume that if we have -lSM then we also have -lICE. @@ -44,12 +48,16 @@ x_libs="$x_libs -lSM -lICE"], , $x_libs -lICE) - AC_CHECK_LIB(gtk, gtk_button_new, + AC_CHECK_LIB(gtk, gdk_pixmap_unref, GTK_LIBS="-lgtk -lgdk -lglib -lm", - [AC_MSG_ERROR(Can not link with gtk/gdk/glib)], + [AC_MSG_ERROR(Can not find a Gtk 0.99.1, probably you have an older version?)], -lgdk -lglib $x_libs -lm) AC_SUBST(GTK_LIBS) + XPM_LIBS="" + AC_CHECK_LIB(Xpm, XpmFree, [XPM_LIBS="-lXpm"], , $x_libs) + AC_SUBST(XPM_LIBS) + AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread") AC_SUBST(PTHREAD_LIB) @@ -64,15 +72,42 @@ AM_PROG_LIBTOOL AC_GNOME_CHECK AC_PROG_CXX +AC_PROG_RANLIB AC_PROG_LEX AC_DECL_YYTEXT +dnl Look for an ObjC compiler. +dnl FIXME: extend list of possible names of ObjC compilers. +AC_CHECK_PROGS(OBJC, $OBJC gcc, "") +dnl FIXME: I don't actually know if this works. But we try a link +dnl of a simple ObjC file. +result=1 +if test -n "$OBJC"; then + AC_MSG_CHECKING([for Objective C compiler]) + cat > conftest.m <&AC_FD_CC 2>&1 + result=$? + rm -f conftest* +fi +AM_CONDITIONAL(OBJECTIVE_C, test "$result" -eq 0) +if test $result -eq 0; then + AC_MSG_RESULT(found) +else + AC_MSG_RESULT(not found) +fi + AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) AM_GNU_GETTEXT -ALL_LINGUAS="cs it" +ALL_LINGUAS="cs it ko" dnl dnl If no gettext is found, default to gnu gettext @@ -100,7 +135,7 @@ AC_CHECK_LIB(guile, scm_boot_guile,GUILE_LIBS="-lguile",[ AC_MSG_ERROR(Can not find Guile 1.2 on the system) -], $LIBS) +], $QTTHREADS_LIB $LIBS) AC_SUBST(GUILE_LIBS) dnl @@ -113,9 +148,31 @@ dnl dnl +dnl The Gtk/XmHTML code +dnl +Z_LIBS="" +JPEG_LIBS="" +PNG_LIBS="" +AC_CHECK_LIB(z, inflate, [Z_LIBS="-lz"]) +AC_CHECK_LIB(jpeg, jpeg_abort, [JPEG_LIBS="-ljpeg"]) +AC_CHECK_LIB(png, png_read_image, [PNG_LIBS="-lpng"]) +AC_SUBST(Z_LIBS) +AC_SUBST(JPEG_LIBS) +AC_SUBST(PNG_LIBS) +LIBS=$oLIBS + +dnl dnl The programs specific checks dnl +dnl genius +AC_CHECK_LIB(gmp, mpz_init_set, we_have_gmp=true, we_have_gmp=false) +AM_CONDITIONAL(HAVE_LIBGMP, $we_have_gmp) +if $we_have_gmp; then + AC_PROG_LEX + AC_PROG_YACC +fi + dnl gmix AC_CHECK_HEADERS(linux/soundcard.h) @@ -151,28 +208,35 @@ lib/desktop-links/Makefile lib/pixmaps/Makefile obgtk/Makefile +obgnome/Makefile +gtk-xmhtml/Makefile po/Makefile.in programs/Makefile programs/cromagnon/Makefile programs/desktop-properties/Makefile programs/gmix/Makefile programs/gnometalk/Makefile +programs/gmailman/Makefile +programs/same-gnome/Makefile +programs/girc/Makefile programs/gnomine/Makefile programs/gulp/Makefile +programs/genius/Makefile programs/find-file/Makefile programs/linux-conf/Makefile programs/network-utilities/Makefile programs/notepad/Makefile programs/phaser-chess/Makefile +programs/gtt/Makefile programs/panel/Makefile programs/panel/batmon/Makefile programs/panel/clock/Makefile programs/panel/mailcheck/Makefile programs/panel/launcher/Makefile +programs/panel/logout/Makefile programs/panel/batmon/Makefile programs/panel/menu/Makefile programs/panel/netwatch/Makefile -programs/same-gnome/Makefile programs/test-suite/Makefile version.h stamp.h],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile]) diff -uNr gnome-0.10/gtk-xmhtml/ChangeLog gnome-0.11/gtk-xmhtml/ChangeLog --- gnome-0.10/gtk-xmhtml/ChangeLog Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/ChangeLog Tue Jan 6 19:52:10 1998 @@ -0,0 +1,14 @@ +Wed Dec 24 12:05:31 1997 Miguel de Icaza + + * XmHTML-motif.c, XmHTML.c, XmHTMLP.h, callbacks.c, forms.c, + frames.c, gtk-xmhtml.c gtk-xmhtml.h images.c, map.c, test.c, + toolkit.c: More code sharing between the Motif frontend an the Gtk + frontned; More portability macros; + + * The widget now emits signals for all of the events that are + interesting (same as the Motif ones, but signalified). + + * Lots of events are now handled, only missing are the keybaord + events. + + diff -uNr gnome-0.10/gtk-xmhtml/HTML.h gnome-0.11/gtk-xmhtml/HTML.h --- gnome-0.10/gtk-xmhtml/HTML.h Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/HTML.h Mon Dec 29 16:37:40 1997 @@ -0,0 +1,1102 @@ +/***** +* HTML.h : XmHTML Widget public header file. +* Resource defines, enumerations and structures. +* +* This file Version $Revision: 1.5 $ +* +* Creation date: Tue Apr 15 23:39:26 GMT+0100 1997 +* Last modification: $Date: 1997/12/29 22:16:18 $ +* By: $Author: unammx $ +* Current State: $State: Exp $ +* +* Author: newt +* +* Copyright (C) 1994-1997 by Ripley Software Development +* All Rights Reserved +* +* This file is part of the XmHTML Widget Library +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Library General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library 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 +* Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public +* License along with this library; if not, write to the Free +* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +*****/ +/***** +* $Source: /debian/home/gnomecvs/gnome/gtk-xmhtml/HTML.h,v $ +*****/ +/***** +* ChangeLog +* $Log: HTML.h,v $ +* Revision 1.5 1997/12/29 22:16:18 unammx +* This version does: +* +* - Sync with Koen to version Beta 1.1.2c of the XmHTML widget. +* Includes various table fixes. +* +* - Callbacks are now properly checked for the Gtk edition (ie, +* signals). +* +* Revision 1.4 1997/12/26 23:54:37 unammx +* More Gtk/XmHTML work: now a number of features can be configured on +* the widget, look at the gazillions of options in gtk-xmhtml.h for +* more information. This is probably not complete, I have to read +* over the XmHTML/Motif docs for figuring which other bits I am missing. +* +* Known bug: the parser is not fixing documents without tags, +* so this means that the program is crashing if you pass a document +* withou the BODY. I bet this is caused by some mistake of mine in +* the handling of the old/new/current widgets as created by Motif. +* +* Miguel. +* +* Revision 1.3 1997/12/25 01:34:08 unammx +* Good news for the day: +* +* I have upgraded our XmHTML sources to XmHTML 1.1.1. +* +* This basically means that we got table support :-) +* +* Still left to do: +* +* - Set/Get gtk interface for all of the toys in the widget. +* - Frame support is broken, dunno why. +* - Form support (ie adding widgets to it) +* +* Miguel. +* +* Revision 1.2 1997/12/11 21:20:19 unammx +* Step 2: more gtk/xmhtml code, still non-working - mig +* +* Revision 1.1 1997/11/28 03:38:53 gnomecvs +* Work in progress port of XmHTML; No, it does not compile, don't even try -mig +* +* Revision 1.6 1997/10/23 00:24:27 newt +* XmHTML Beta 1.1.0 release +* +* Revision 1.5 1997/08/31 17:30:39 newt +* Removed HT_TEXTFLOW +* +* Revision 1.4 1997/08/30 00:22:46 newt +* Alpha channel resources: XmNalphaChannelProcessing and +* XmNimageRGBConversion. Updated comments and reorganized a bunch of things. +* +* Revision 1.3 1997/08/01 12:52:11 newt +* Progressive image loading changes +* +* Revision 1.2 1997/05/28 01:29:28 newt +* XmImage changes: added the XmImageConfig structure and configuration flags. +* Added support for the XmNdecodeGIFProc resource. +* +* Revision 1.1 1997/04/29 14:19:18 newt +* Initial Revision +* +*****/ + +#ifndef _HTML_h_ +#define _HTML_h_ + +/* include our new resources */ +#ifdef WITH_MOTIF +# include +#endif + +/****************************************************************************** +* Enumerations and other constants +******************************************************************************/ + +/***** +* HTML Elements internal id's +* This list is alphabetically sorted to speed up the searching process. +* DO NOT MODIFY +*****/ +typedef enum{ +HT_DOCTYPE, HT_A, HT_ADDRESS, HT_APPLET, HT_AREA, HT_B, HT_BASE, HT_BASEFONT, +HT_BIG, HT_BLOCKQUOTE, HT_BODY, HT_BR, HT_CAPTION, HT_CENTER, HT_CITE, HT_CODE, +HT_DD, HT_DFN, HT_DIR, HT_DIV, HT_DL, HT_DT, HT_EM, HT_FONT, HT_FORM, HT_FRAME, +HT_FRAMESET, HT_H1, HT_H2, HT_H3, HT_H4, HT_H5, HT_H6, HT_HEAD, HT_HR, HT_HTML, +HT_I, HT_IMG, HT_INPUT, HT_ISINDEX, HT_KBD, HT_LI, HT_LINK, HT_MAP, HT_MENU, +HT_META, HT_NOFRAMES, HT_OL, HT_OPTION, HT_P, HT_PARAM, HT_PRE, HT_SAMP, +HT_SCRIPT, HT_SELECT, HT_SMALL, HT_STRIKE, HT_STRONG, HT_STYLE, HT_SUB, +HT_SUP, HT_TAB, HT_TABLE, HT_TD, HT_TEXTAREA, HT_TH, HT_TITLE, +HT_TR, HT_TT, HT_U, HT_UL, HT_VAR, HT_ZTEXT +}htmlEnum; + +/***** +* Corresponding HTML element name table. Indexing with the above enumeration +* will give the corresponding element name. +*****/ +extern String html_tokens[]; + +/***** +* XmHTML defines the following callback reasons. This might produce strange +* results once Motif decides to uses enum values above 16383. +* Send us a mail at ripley@xs4all.nl if you get problems that are due to +* these enumeration values. +*****/ +enum{ + XmCR_HTML_ANCHORTRACK = 16384, /* XmNanchorTrackCallback */ + XmCR_HTML_DOCUMENT, /* XmNdocumentCallback */ + XmCR_HTML_FORM, /* XmNformCallback */ + XmCR_HTML_FRAME, /* XmNframeCallback */ + XmCR_HTML_FRAMECREATE, /* XmNframeCallback */ + XmCR_HTML_FRAMEDESTROY, /* XmNframeCallback */ + XmCR_HTML_IMAGEMAPACTIVATE, /* XmNimagemapCallback */ + XmCR_HTML_IMAGEMAP, /* XmNimagemapCallback */ + XmCR_HTML_LINK, /* XmNlinkCallback */ + XmCR_HTML_MODIFYING_TEXT_VALUE, /* XmNmodifyVerifyCallback */ + XmCR_HTML_MOTIONTRACK, /* XmNmotionTrackCallback */ + XmCR_HTML_PARSER, /* XmNparserCallback */ + XmCR_HTML_EVENT, /* XmNeventCallback */ + XmCR_HTML_EVENTDESTROY /* XmNeventCallback */ +}; + +/***** +* XmNeventCallback sub event types +*****/ +enum{ + /* Document/Frame specific events */ + XmCR_HTML_LOAD = 0, /* onLoad */ + XmCR_HTML_UNLOAD, /* onUnLoad */ + + /* HTML Form specific events */ + XmCR_HTML_SUBMIT, /* onSubmit */ + XmCR_HTML_RESET, /* onReset */ + XmCR_HTML_FOCUS, /* onFocus */ + XmCR_HTML_BLUR, /* onBlur */ + XmCR_HTML_SELECT, /* onSelect */ + XmCR_HTML_CHANGE, /* onChange */ + + /* object events */ + XmCR_HTML_CLICK, /* onClick */ + XmCR_HTML_DOUBLE_CLICK, /* onDblClick */ + XmCR_HTML_MOUSEDOWN, /* onMouseDown */ + XmCR_HTML_MOUSEUP, /* onMouseUp */ + XmCR_HTML_MOUSEOVER, /* onMouseOver */ + XmCR_HTML_MOUSEMOVE, /* onMouseMove */ + XmCR_HTML_MOUSEOUT, /* onMouseOut */ + XmCR_HTML_KEYPRESS, /* onKeyPress */ + XmCR_HTML_KEYDOWN, /* onKeyDown */ + XmCR_HTML_KEYUP, /* onKeyUp */ + XmCR_HTML_USEREVENT /* must always be last */ +}; + +/***** +* URL types XmHTML knows of. +* The hostnames, files and port numbers are only shown for demonstration +* purposes, XmHTML doesn't care whether they are present or not. +*****/ +typedef enum{ + ANCHOR_UNKNOWN = 0, /* unknown href */ + ANCHOR_NAMED, /* name="...." */ + ANCHOR_JUMP, /* href="#..." */ + ANCHOR_FILE_LOCAL, /* href="file.html" + * href="file:/file.html" (clearly local) + * href="file:///file.html" (NULL host) + * href="file://localhost/file.html" (localhost) + */ + ANCHOR_FILE_REMOTE, /* href="file://foo.bar/file.html" */ + ANCHOR_FTP, /* href="ftp://foo.bar/file" */ + ANCHOR_HTTP, /* href="http://foo.bar/file.html" */ + ANCHOR_SECURE_HTTP, /* href="https://foo.bar/file.html" */ + ANCHOR_GOPHER, /* href="gopher://foo.bar:70" */ + ANCHOR_WAIS, /* href="wais://foo.bar" */ + ANCHOR_NEWS, /* href="news://foo.bar" */ + ANCHOR_TELNET, /* href="telnet://foo.bar:23" */ + ANCHOR_MAILTO, /* href="mailto:foo@bar" */ + ANCHOR_EXEC, /* href="exec:foo_bar" */ + ANCHOR_PIPE, /* href="pipe:foo_bar" */ + ANCHOR_ABOUT, /* href="about:..." */ + ANCHOR_INFO, /* href="info:.." */ + ANCHOR_MAN, /* href="man:..." */ + ANCHOR_FORM_IMAGE /* , only used internally */ +}URLType; + +/***** +* Procedure to be called whenever a script is encountered +* Arguments: +* Tidget: XmHTMLWidget id +* String: script source text +* TPointer: XmNclientData value +* Return value: +* data to be stored whenever a document event should be processed. +* This data is unused internally and is provided as the user_data +* argument in the XmHTMLEvent structure. For example, the return value +* could be a pointer into some internal procedural database, a ptr to a +* compiled script procedure or the script source text if you want to +* process it at some later time (when the event occurs). +* +* When NULL is returned the event in question is disabled. +*****/ +typedef TPointer (*XmHTMLEventProc)(TWidget, String, TPointer); + +/***** +* HTML Form component types +*****/ +typedef enum{ + FORM_TEXT = 1, /* textfield */ + FORM_PASSWD, /* password textfield */ + FORM_CHECK, /* checkbox */ + FORM_RADIO, /* radiobox */ + FORM_RESET, /* reset button */ + FORM_FILE, /* filelisting */ + FORM_SELECT, /* select parent */ + FORM_OPTION, /* select child */ + FORM_TEXTAREA, /* multiline edit field */ + FORM_IMAGE, /* drawbutton */ + FORM_HIDDEN, /* hidden input */ + FORM_SUBMIT /* submit button */ +}componentType; + +/***** +* Supported HTML Form method types +*****/ +enum{ + XmHTML_FORM_GET = 0, /* method = get */ + XmHTML_FORM_POST, /* method = post */ + XmHTML_FORM_PIPE /* method = pipe */ +}; + +/***** +* possible error codes for XmNparserCallback +*****/ +typedef enum{ + HTML_UNKNOWN_ELEMENT = 1, /* unknown HTML element */ + HTML_BAD, /* very badly placed element */ + HTML_OPEN_BLOCK, /* block still open while new block started */ + HTML_CLOSE_BLOCK, /* block closed but was never opened */ + HTML_OPEN_ELEMENT, /* unbalanced terminator */ + HTML_NESTED, /* improperly nested element */ + HTML_VIOLATION, /* bad content for current block/element */ + HTML_NOTIFY, /* notification of text insertion/removal */ + HTML_INTERNAL /* internal parser error */ +}parserError; + +/***** +* And corresponding values for XmNenableBadHTMLWarnings. +* These are or'd together. +* XmNONE disables warnings and XmHTML_ALL enables all warnings. +* See parserError for their meaning. +*****/ +enum{ + XmHTML_NONE = 0, /* no warnings */ + XmHTML_UNKNOWN_ELEMENT = 1, + XmHTML_BAD = 2, + XmHTML_OPEN_BLOCK = 4, + XmHTML_CLOSE_BLOCK = 8, + XmHTML_OPEN_ELEMENT = 16, + XmHTML_NESTED = 32, + XmHTML_VIOLATION = 64, + XmHTML_ALL = 127 /* all warnings */ +}; + +/***** +* possible action codes for the action field in the XmHTMLParserCallbackStruct +*****/ +enum{ + HTML_REMOVE = 1, /* remove offending element */ + HTML_INSERT, /* insert missing element */ + HTML_SWITCH, /* switch offending and expected element */ + HTML_KEEP, /* keep offending element */ + HTML_IGNORE, /* ignore, proceed as if nothing happened */ + HTML_ALIAS, /* alias an unknown element to known one */ + HTML_TERMINATE /* terminate parser */ +}; + +/***** +* Possible return codes for XmHTMLImageGetType(). +*****/ +enum{ + IMAGE_ERROR = 0, /* error on image loading */ + IMAGE_UNKNOWN, /* unknown image */ + IMAGE_XPM, /* X11 pixmap */ + IMAGE_XBM, /* X11 bitmap */ + IMAGE_GIF, /* CompuServe(C) Gif87a or Gif89a */ + IMAGE_GIFANIM, /* animated gif */ + IMAGE_GIFANIMLOOP, /* animated gif with loop extension */ + IMAGE_GZF, /* compatible Gif87a or Gif89a */ + IMAGE_GZFANIM, /* compatible animated gif */ + IMAGE_GZFANIMLOOP, /* compatible animated gif */ + IMAGE_JPEG, /* JPEG image */ + IMAGE_PNG, /* PNG image */ + IMAGE_FLG /* Fast Loadable Graphic */ +}; + +/***** +* Possible return values for a function installed on the +* XmNprogressiveReadProc resource. +*****/ +#define STREAM_OK 1 /* internally used value */ +#define STREAM_END 0 /* data stream ended (no more data) */ +#define STREAM_SUSPEND -1 /* data stream suspended (not enough data) */ +#define STREAM_ABORT -2 /* data stream aborted */ +#define STREAM_RESIZE -3 /* resize input buffer */ + +/***** +* Possible return values for the XmNdecodeGIFProc resource and +* values for the XmHTMLGIFStream state. +*****/ +#define GIF_STREAM_OK 2 +#define GIF_STREAM_END 1 +#define GIF_STREAM_ERR 0 +#define GIF_STREAM_INIT -1 +#define GIF_STREAM_FINAL -2 + +/***** +* Possible return values from a number of image related routines. +* The actual meaning depends on the routine used. +*****/ +typedef enum{ + XmIMAGE_ERROR = 0, /* unknown error occured */ + XmIMAGE_BAD, /* bad function call: missing arg or so */ + XmIMAGE_UNKNOWN, /* provided XmImage/XmImageInfo unknown/unbound */ + XmIMAGE_ALMOST, /* action completed, further response necessary */ + XmIMAGE_OK /* action completed. */ +}XmImageStatus; + +/***** +* Possible values for transparency (value for the "bg" field in both +* XmImage and XmImageInfo structures). Possible values are: +* +* XmIMAGE_NONE +* indicates the image is not transparent +* XmIMAGE_TRANSPARENCY_BG +* indicates the image achieves transparency by substituting the current +* background setting (can be a single color or background image. Internally, +* such transparency is achieved by using a clipmask). +* XmIMAGE_TRANSPARENCY_ALPHA +* indicates the image achieves transparency by using an alpha channel. +* This transparency is currently only used by PNG images with an alpha +* channel or a tRNS chunk (which is expanded to an alpha channel internally). +*****/ +enum{ + XmIMAGE_NONE = 0, + XmIMAGE_TRANSPARENCY_BG, + XmIMAGE_TRANSPARENCY_ALPHA +}; + +/***** +* Possible values for the colorspace value. +* +* XmIMAGE_COLORSPACE_GRAYSCALE +* image contains only shades of gray. The colorcube is reduced to a 1D +* representation. All components in a shade have the same value. The +* pixel values are equal to the value of a single color component. +* XmIMAGE_COLORSPACE_INDEXED +* image uses a fixed palette. Colorcube is mapped to a 1D lookup-table. +* XmIMAGE_COLORSPACE_RGB +* image uses a full 3D colorcube. +*****/ +enum{ + /* XmIMAGE_NONE */ + XmIMAGE_COLORSPACE_GRAYSCALE = 1, + XmIMAGE_COLORSPACE_INDEXED, + XmIMAGE_COLORSPACE_RGB +}; + +/***** +* XmImageInfo structure options field bits. +* The ``Set by default'' indicates a bit set when the XmHTMLImageDefaultProc +* is used to read an image. The ``Read Only'' indicates a bit you should +* consider as read-only. +* XmIMAGE_DELAYED +* Indicates the image is delayed, e.i. it will be provided at a later stage; +* XmIMAGE_DEFERRED_FREE +* Indicates XmHTML may free this structure when a new document is loaded. +* XmIMAGE_IMMEDIATE_FREE +* Indicates XmHTML may free this structure when XmHTML no longer needs it; +* XmIMAGE_RGB_SINGLE +* Indicates that the reds, greens and blues fields are allocated in a single +* memory area instead of three seperate memory arrays. +* XmIMAGE_ALLOW_SCALE +* Indicates that scaling an image is allowed. +* XmIMAGE_FRAME_IGNORE +* Use with animations: set this bit when a frame falls outside the logical +* screen area. No pixmap is created but the timeout for the frame is kept. +* XmIMAGE_CLIPMASK +* This bit is set when the returned XmImageInfo structure contains clipmask +* data. XmHTML uses this info to create a clipping bitmap. Changing this +* bit from set to unset will lead to a memory leak while changing it from +* unset to set *without* providing a clipmask yourself *will* cause an error +* to happen. You can set this bit when you are providing your own clipmask +* (to provide non-rectangular images for example), PROVIDED you fill the +* ``clip'' field with valid bitmap data (a stream of bytes in XYBitmap format +* and the same size of the image). +* XmIMAGE_SHARED_DATA +* This bit is set when images share data. XmHTML sets this bit when the image +* in question is an internal image, e.i., one for which the image data may +* never be freed. Be carefull setting this bit yourself, since it prevents +* XmHTML from freeing the image data present in the XmImageInfo structure. +* It can easily lead to memory leaks when an image is *not* an internal +* image. +* XmIMAGE_PROGRESSIVE +* Setting this bit will enable XmHTML progressive image loading. A function +* *must* have been installed on the XmNprogressiveReadProc resource *prior* +* to setting this bit. Installing a function on the XmNprogressiveEndProc +* is optional. When this bit is set all other bits will be ignored. +* XmIMAGE_DELAYED_CREATION +* This bit is read-only. It is used internally by XmHTML for images with +* an alpha channel. Alpha channel processing merges the current background +* with the original RGB data from the image and uses the result to compose +* the actual on-screen image (the merged data is stored in the ``data'' +* field of the XmImageInfo structure). XmHTML needs to store the original +* data somewhere, and when this bit is set it is stored in the ``rgb'' field +* of the XmImageInfo structure. +* When this bit is set, the returned XmImageInfo may *NOT BE FREED* as long +* as the current document is alive. You can discard it as soon as a new +* document is loaded. +*****/ +#define XmIMAGE_DELAYED (1<<1) +#define XmIMAGE_DEFERRED_FREE (1<<2) /* set by default */ +#define XmIMAGE_IMMEDIATE_FREE (1<<3) +#define XmIMAGE_RGB_SINGLE (1<<4) /* set by default */ +#define XmIMAGE_ALLOW_SCALE (1<<5) /* set by default */ +#define XmIMAGE_FRAME_IGNORE (1<<6) +#define XmIMAGE_CLIPMASK (1<<7) /* Read Only */ +#define XmIMAGE_SHARED_DATA (1<<8) /* Read Only */ +#define XmIMAGE_PROGRESSIVE (1<<9) + +#define XmIMAGE_DELAYED_CREATION (1<<10) /* Read Only */ + +/***** +* XmImageInfo animation disposal values +* A disposal method specifies what should be done before the current frame is +* rendered. Possible values are: +* XmIMAGE_DISPOSE_NONE +* do nothing, overlays the previous frame with the current frame. +* XmIMAGE_DISPOSE_BY_BACKGROUND +* Restore to background color. The area used by the previous frame must +* be restored to the background color/image +* XmIMAGE_DISPOSE_BY_PREVIOUS +* Restore to previous. The area used by the previous frame must be +* restored to what was there prior to rendering the previous frame. +*****/ +enum{ + /* XmIMAGE_NONE */ + XmIMAGE_DISPOSE_NONE = 1, /* default behaviour */ + XmIMAGE_DISPOSE_BY_BACKGROUND, + XmIMAGE_DISPOSE_BY_PREVIOUS +}; + +/***** +* Primary image cache actions +* (unimplemented) +*****/ +#define IMAGE_STORE 0 /* store an image in the cache */ +#define IMAGE_GET 1 /* retrieve an image from the cache */ +#define IMAGE_DISCARD 2 /* discard an image from the cache */ + +/***** +* XmNperfectColors/XmNalphaChannelProcessing resource values. +* +* Note: these values are represented by the XmCEnableMode resource class. +*****/ +enum{ + /* XmAUTOMATIC */ + XmALWAYS = 1, + XmNEVER +}; + +/***** +* Possible XmNimageMapToPalette/XmNimageRGBConversion resource values: +* +* XmQUICK +* RGBConversion: +* first checks if the 24bit image contains less than XmNmaxImageColors. +* If not, XmHTML will dither to a fixed palette. This is fast but has +* the disadvantage that the background color in an alpha channelled +* image will not be matched exactly. +* MapToPalette: +* Use closest distance algorithm to map colors to the palette. No +* error correction is performed. Reasonably fast, but quality +* heavily depends on the distribution of the colors in the image. +* XmBEST +* RGBConversion (default): +* first checks if the 24bit image contains less than XmNmaxImageColors. +* If it is, the actual image colors are used. If not, a histogram of the +* image is computed, the most used colors are selected and the resulting +* image is dithered to this palette. +* Offers best 24 to 8bit conversion and is probably faster than XmSLOW +* as only images with more than XmNmaxImageColors will be dithered. +* MapToPalette: +* Ordered dithering using predefined error matrices. Reasonably fast and +* quite good results; +* XmFAST +* RGBConversion: +* Skips the check and dithers to a fixed palette right away. This is the +* fastest way to do 24 to 8bit conversion but has the disadvantage that +* every 24bit image is dithered to a fixed palette, regardless of the +* actual no of colors in the image. +* MapToPalette: +* Simple ordered dithering. Fastest but probably the poorest results. +* XmSLOW +* RGBConversion: +* Skips the check and does histogram stuff right away. +* MapToPalette: +* closest distance algorithm to map image colors to the palette and use +* dynamic error correction. Slowest but best results; +* XmDISABLED +* RGBConversion: +* ignored; +* MapToPalette (default): +* Disables palette mapping; +* +* Note: these values are represented by the XmCConversionMode resource class. +*****/ +typedef enum { + XmQUICK = 0, + XmBEST, + XmFAST, + XmSLOW, + XmDISABLED +} XmHTMLDitherType; + +/***** +* Search directions: forward or backward search +*****/ +typedef enum{ + XmHTML_FORWARD, + XmHTML_BACKWARD +}XmHTMLDirection; + +/***** +* XmHTMLPosition is a fully opaque type +*****/ +typedef struct _XmHTMLObjectTableElement *XmHTMLPosition; + +/***** +* Custom Papersize dimension unit type +* (under construction) +*****/ +enum{ + XmHTML_CHAR = 0, + XmHTML_CENTIMETER, /* 1cm = 0.39in */ + XmHTML_MILLIMETER, /* 1mm = 0.1cm */ + XmHTML_INCH, /* 1in = 2.54cm */ + XmHTML_PICA, /* 1pc = 12pt */ + XmHTML_POINT /* 1in = 72.27pt, 1cm = 28.45pt */ +}; + +/***** +* XmHTMLTextGetFormatted paper size defines +* (under construction) +*****/ +enum{ + XmHTMLTEXT_PAPERSIZE_A4 = 0, + XmHTMLTEXT_PAPERSIZE_LETTER, + XmHTMLTEXT_PAPERSIZE_CUSTOM +}; + +/***** +* XmHTMLTextGetFormatted type definitions +* (under construction) +*****/ +enum{ + XmHTMLTEXT_PLAIN = 0, /* generate plain ASCII document */ + XmHTMLTEXT_FORMATTED, /* generate formatted ASCII document */ + XmHTMLTEXT_POSTSCRIPT /* generate formatted Postscript output */ +}; + +/***** +* XmHTMLTextGetFormatted Postscript option bits +* (under construction) +* The MIMIC_FONTS bit instructs XmHTML to use any of the supported postscript +* fonts to approach the fonts used in the document. When set, all other font +* bits are ignored. When not used, the PSFONT bits can be or'd together. +* XmHTML will attempt to do the following mapping: +* PSFONT_ROMAN/PSFONT_CENTURY -> default text font; +* PSFONT_HELVETICA/PSFONT_LUCIDA -> fixed width font; +* If only one of the PSFONT bits is set, the entire document will be rendered +* in that font. +*****/ +#define XmHTMLTEXT_ADDHEADER (1<<1) +#define XmHTMLTEXT_ADDFOOTER (1<<2) +#define XmHTMLTEXT_PSFONT_ROMAN (1<<3) +#define XmHTMLTEXT_PSFONT_HELVETICA (1<<4) +#define XmHTMLTEXT_PSFONT_CENTURY (1<<5) +#define XmHTMLTEXT_PSFONT_LUCIDA (1<<6) +#define XmHTMLTEXT_MIMIC_FONTS (1<<7) + +/***** +* XmHTMLGetHeadAttributes mask bits +*****/ +#define HeadClear ((unsigned char)0) /* clear everything */ +#define HeadDocType (1<<0) /* fill doctype member */ +#define HeadTitle (1<<1) /* fill title member */ +#define HeadIsIndex (1<<2) /* fill isIndex member */ +#define HeadBase (1<<3) /* fill Base member */ +#define HeadMeta (1<<4) /* fill meta members */ +#define HeadLink (1<<5) /* fill link members */ +#define HeadScript (1<<6) /* fill script members */ +#define HeadStyle (1<<7) /* fill Style members */ +#define HeadAll ((unsigned char)~0) /* fill all members */ + +/***** +* XmImage frame selection flags. +* any positive number will return the requested frame. If larger than +* total framecount, last frame is returned. +*****/ +#define AllFrames -1 /* do all frames */ +#define FirstFrame -2 /* only use first frame */ +#define LastFrame -3 /* only do last frame */ + +/***** +* XmImage configuration flags +*****/ +#define ImageFSDither (1L<<1) /* Floyd-Steinberg on quantized images */ +#define ImageCreateGC (1L<<2) /* create gc for image */ +#define ImageWorkSpace (1L<<3) /* create animation workspace */ +#define ImageClipmask (1L<<4) /* create clipmask */ +#define ImageBackground (1L<<5) /* substitute background pixel */ +#define ImageQuantize (1L<<6) /* quantize image */ +#define ImageMaxColors (1L<<7) /* sets maximum colors */ +#define ImageGifDecodeProc (1L<<8) /* gif lzw decoder function */ +#define ImageGifzCmd (1L<<9) /* gif lzw uncompress command */ +#define ImageFrameSelect (1L<<10)/* frame selection */ +#define ImageScreenGamma (1L<<11)/* gamma correction. JPEG and PNG only */ + +/****************************************************************************** +* Commonly used structures +******************************************************************************/ + +/***** +* Representation of parsed HTML elements +*****/ +typedef struct _XmHTMLObject{ + htmlEnum id; /* internal ID for this element */ + String element; /* element text */ + String attributes; /* element attributes (if any) */ + Boolean is_end; /* true if this is a closing element */ + Boolean terminated; /* true if element has closing counterpart */ + Cardinal line; /* line number in input for this element */ + struct _XmHTMLObject *next; + struct _XmHTMLObject *prev; +}XmHTMLObject; + +/***** +* Custom papersize definition +*****/ +typedef struct _XmHTMLPaperSize{ + unsigned char unit_type; /* unit in which dimensions are specified */ + unsigned char paper_type; /* type of paper: A4, US or custom */ + Cardinal width; /* total paper width */ + Cardinal height; /* total paper height */ + Cardinal left_margin; /* left text margin */ + Cardinal right_margin; /* right text margin */ + Cardinal top_margin; /* top text margin */ + Cardinal bottom_margin; /* bottom text margin */ +}XmHTMLPaperSize; + +/***** +* The following structure is returned by the XmHTMLImageDefaultProc convenience +* function. When a procedure for the XmNimageProc resource is installed, +* it *must* return this structure. +*****/ +typedef struct _XmImageInfo +{ + /* regular image fields */ + String url; /* original location of image */ + unsigned char *data; /* raw image data. ZPixmap format */ + unsigned char *clip; /* raw clipmask data. XYBitmap format */ + Dimension width; /* used image width, in pixels */ + Dimension height; /* used image height, in pixels */ + Dimension *reds; /* red image pixels */ + Dimension *greens; /* green image pixels */ + Dimension *blues; /* blue image pixels */ + int bg; /* transparent pixel index/type */ + unsigned int ncolors; /* Number of colors in the image */ + unsigned int options; /* image option bits */ + + /* image classification fields and original data */ + unsigned char type; /* image type, see the IMAGE_ enum above */ + unsigned char depth; /* bits per pixel for this image */ + unsigned char colorspace; /* colorspace for this image */ + unsigned char transparency; /* transparency type for this image */ + Dimension swidth; /* image width as read from image */ + Dimension sheight; /* image height as read from image */ + unsigned int scolors; /* Original number of colors in the image */ + + /* Special fields for images with an alpha channel */ + unsigned char *alpha; /* alpha channel data */ + float fg_gamma; /* image gamma */ + + /* Additional animation data */ + int x; /* logical screen x-position for this frame */ + int y; /* logical screen y-position for this frame */ + int loop_count; /* animation loop count */ + unsigned char dispose; /* image disposal method */ + int timeout; /* frame refreshment in milliseconds */ + int nframes; /* no of animation frames remaining */ + struct _XmImageInfo *frame; /* ptr to next animation frame */ + + TPointer user_data; /* any data to be stored with this image */ +}XmImageInfo, *XmImageInfoStruct; + +/* XmHTML method to load images */ +typedef XmImageInfo* (*XmImageProc)(TWidget, String, TPointer); + +/**** +* The next two structures constitute the XmImage definition which are used by +* the XmImageCreate and XmImageDestroy routines. Please note that the *only* +* safe way to destroy an XmImage is to use the XmImageDestroy function. +* XmHTML does not use the XmImage structure, it is provided for your +* convenience. +****/ +/**** +* Animation frame data. +****/ +typedef struct{ + int x; /* x position in logical screen */ + int y; /* y position in logical screen */ + int w; /* width of this particular frame */ + int h; /* height of this particular frame */ + int timeout; /* timeout for the next frame */ + unsigned char dispose; /* previous frame disposal method */ + TPixmap pixmap; /* actual image */ + TPixmap clip; /* image clipmask */ + TPixmap prev_state; /* previous screen state */ +}XmImageFrame; + +/***** +* Actual image definition. +* If you want access to the xcc member, include the XCC.h header file. +*****/ +typedef struct{ + String file; /* originating file */ + unsigned char type; /* image type, see the IMAGE_ enum below */ + TPixmap pixmap; /* actual image */ + TPixmap clip; /* for transparant pixmaps */ + unsigned int options; /* image option bits */ + int width; /* current image width, in pixels */ + int height; /* current image height, in pixels */ + int ncolors; /* no of colors in this image */ + int scolors; /* specified no of colors */ + int swidth; /* image width as read from image */ + int sheight; /* image height as read from image */ + int depth; /* depth of this image */ + int npixels; /* no of really allocated pixels */ + TGC gc; /* graphics context for rendering */ + + /* animation data */ + XmImageFrame *frames; /* array of animation frames */ + int nframes; /* no of frames following */ + int current_frame; /* current frame count */ + int current_loop; /* current loop count */ + int loop_count; /* maximum loop count */ + TIntervalId proc_id; /* timer id for animations */ + TWidget w; /* image owner */ + TAppContext context; /* Application context for animations */ + + /* private data */ + struct _XColorContext *xcc; /* a lot of visual info */ +}XmImage; + +/***** +* Link member information. +*****/ +typedef struct +{ + String url; /* value of URL tag */ + String rel; /* value of REL tag */ + String rev; /* value of REV tag */ + String title; /* value of TITLE tag */ +}XmHTMLLinkDataRec, *XmHTMLLinkDataPtr; + +/***** +* Meta member information. +*****/ +typedef struct +{ + String http_equiv; /* value of HTTP-EQUIV tag */ + String name; /* value of NAME tag */ + String content; /* value of CONTENT tag */ +}XmHTMLMetaDataRec, *XmHTMLMetaDataPtr; + +/***** +* XmHTMLHeadAttributes definition +*****/ +typedef struct{ + String doctype; /* doctype data */ + String title; /* document title */ + Boolean is_index; /* true when the element exists */ + String base; /* value of the element */ + int num_meta; /* number of META info to process */ + XmHTMLMetaDataPtr meta; /* array of META info to process */ + int num_link; /* number of LINK info to process */ + XmHTMLLinkDataPtr link; /* array of LINK info to process */ + String style_type; /* value of the style type element tag */ + String style; /* contents */ + String script_lang; /* value of the language element tag */ + String script; /* contents */ +}XmHTMLHeadAttributes; + +/***** +* XmHTMLFontCacheInfo definition. This structure is returned by the +* XmHTMLGetFontCacheInfo convenience routine and contains information about +* the font cache bound to the display of a given widget. +* The fonts and mapping arrays are in sync: when a name in the fonts array +* has a non-NULL entry at the corresponding position in the mapping array, +* the value of the mapping entry is the real font being used. +*****/ +typedef struct{ + int nentries; /* total no of cached fonts */ + int nmaps; /* of which this many are mapped fonts */ + int nlookups; /* no of search actions */ + int nrequests; /* no of requests made */ + int hits; /* no of hits */ + int misses; /* no of misses */ + String *fonts; /* array of font names, size nentries */ + String *mapping; /* array of font mappings, size nentries */ + int nwidgets; /* no of widgets using this cache */ + WidgetList widgets; /* array of widgets */ +}XmHTMLFontCacheInfo; + +/***** +* forward declaration of XmHTMLAnchorCallback structure +*****/ +typedef struct _XmHTMLAnchorCallbackStruct *XmHTMLAnchorPtr; + +/***** +* XmHTMLXYToInfo return value +* This structure and any of it members may *never* be freed by the caller. +*****/ +typedef struct +{ + Cardinal line; /* line number at selected position */ + Boolean is_map; /* true when clicked image is an imagemap */ + int x,y; /* position relative to image corner */ + XmImageInfo *image; /* image data */ + XmHTMLAnchorPtr anchor; /* possible anchor data */ +}XmHTMLInfoStructure, *XmHTMLInfoPtr; + +/***** +* XmHTML progressive object loading +* (PLC stands for Progressive Loader Context) +*****/ +typedef struct _XmHTMLPLCStream{ + Cardinal total_in; /* no of bytes received so far */ + Cardinal min_out; /* minimum number of bytes requested */ + Cardinal max_out; /* maximum number of bytes requested */ + TPointer user_data; /* any data registered on this PLC */ + unsigned char pad[24]; /* reserved for future use */ +}XmHTMLPLCStream; + +/***** +* External GIF decoder stream object. This is the only argument to any +* procedure installed on the XmNdecodeGIFProc resource. +* +* The first block is kept up to date by XmHTML and is read-only. When state +* is GIF_STREAM_INIT, the decoder should initialize it's private data and store +* it in the external_state field so that it can be used for successive calls +* to the decoder. When state is GIF_STREAM_FINAL, the decoder should wrapup +* and flush all pending data. It can also choose to destruct it's internal +* data structures here (another call with state set to GIF_STREAM_END will be +* made when the internal loader is destroying it's internal objects as +* well). +* +* All following fields are the ``public'' fields and must be updated by the +* external decoder. The msg field can be set to an error message if the +* external decoder fails for some reason. XmHTML will then display this +* error message and abort this image. +*****/ +typedef struct _XmHTMLGIFStream{ + /* read-only fields */ + int state; /* decoder state */ + int codesize; /* initial LZW codesize */ + Boolean is_progressive; /* when used by a progressive loader */ + unsigned char *next_in; /* next input byte */ + Cardinal avail_in; /* number of bytes available at next_in */ + Cardinal total_in; /* total nb of input bytes read so far */ + + /* fields to be updated by caller */ + unsigned char *next_out; /* next output byte should be put there */ + Cardinal avail_out; /* remaining free space at next_out */ + Cardinal total_out; /* total nb of bytes output so far */ + + String msg; /* last error message, or NULL */ + TPointer external_state; /* room for decoder-specific data */ +}XmHTMLGIFStream; + +/* and the proto for the XmNdecodeGIFProc resource */ +typedef int (*XmImageGifProc)(XmHTMLGIFStream*); + +/***** +* Progressive Loading function prototypes. +* XmHTMLGetDataProc: proto for function installed on the +* XmNprogressiveReadProc resource; +* XmHTMLEndDataProc: proto for function installed on the +* XmNprogressiveEndProc resource; +*****/ +typedef int (*XmHTMLGetDataProc)(XmHTMLPLCStream*, TPointer); +typedef void (*XmHTMLEndDataProc)(XmHTMLPLCStream*, TPointer, int, Boolean); + +/***** +* possible values for the third argument on the EndDataProc +*****/ +enum{ + /* XmHTML_NONE = 0 */ /* PLCObject referenced by all objects */ + XmPLC_IMAGE, /* PLCObject for an image */ + XmPLC_DOCUMENT, /* PLCObject for a document */ + XmPLC_FINISHED /* indicates all plc's have been processed */ +}; + +/***** +* XmImage configuration +*****/ +typedef struct{ + unsigned long flags; /* XmImage configuration flags, see above */ + int ncolors; /* desired number of colors */ + int which_frames; /* animation frames selection flag */ + int bg_color; /* background pixel on transparent images */ + String z_cmd; /* gif uncompress command */ + XmImageGifProc gif_proc; /* external gif decoder */ + float gamma; /* gamma correction. JPEG and PNG only */ +}XmImageConfig; + +/****************************************************************************** +* Callback structures +* Unless explicitly mentioned, *none* of these structures (or any of its +* members) may be freed. +******************************************************************************/ + +/***** +* XmNactivateCallback and XmNanchorTrackCallback callback structure. +*****/ +typedef struct _XmHTMLAnchorCallbackStruct{ + int reason; /* the reason the callback was called */ + TEvent *event; /* event structure that triggered callback */ + URLType url_type; /* type of url referenced */ + Cardinal line; /* line number of the selected anchor */ + String href; /* pointer to the anchor value */ + String target; /* pointer to target value */ + String rel; /* pointer to rel value */ + String rev; /* pointer to rev value */ + String title; /* pointer to title value */ + Boolean is_frame; /* true when inside a frame */ + Boolean doit; /* local anchor vetoing flag */ + Boolean visited; /* local anchor visited flag */ +}XmHTMLAnchorCallbackStruct; + +typedef Boolean (*XmHTMLAnchorProc)(TWidget, String, TPointer); + +/***** +* XmNeventCallback callback structure. +*****/ +typedef struct{ + int reason; /* the reason the event was called */ + TEvent *event; /* event triggering this action */ + int type; /* HTML4.0 event type, see above */ + TPointer data; /* HTML4.0 event callback data */ +}XmHTMLEventCallbackStruct; + +/***** +* XmNdocumentCallback callback structure. +*****/ +typedef struct +{ + int reason; /* the reason the callback was called */ + TEvent *event; /* always NULL for XmNdocumentCallback */ + Boolean html32; /* True if document was HTML 3.2 conforming */ + Boolean verified; /* True if document has been verified */ + Boolean balanced; /* True if parser tree is balanced */ + Boolean terminated; /* True if parser terminated prematurely */ + int pass_level; /* current parser level count. Starts at 1 */ + Boolean redo; /* perform another pass? */ +}XmHTMLDocumentCallbackStruct, *XmHTMLDocumentPtr; + +/***** +* XmNformCallback callback structure. +*****/ +/***** +* Form Component data +*****/ +typedef struct +{ + componentType type; /* Form component type */ + String name; /* component name */ + String value; /* component value */ +}XmHTMLFormDataRec, *XmHTMLFormDataPtr; + +/***** +* Actual XmNformCallback callback structure. +*****/ +typedef struct +{ + int reason; /* the reason the callback was called */ + TEvent *event; /* event structure that triggered callback */ + String action; /* URL or cgi-bin destination */ + String enctype; /* form encoding */ + int method; /* Form Method, GET, POST or PIPE */ + int ncomponents; /* no of components in this form */ + XmHTMLFormDataPtr components; +}XmHTMLFormCallbackStruct, *XmHTMLFormPtr; + +/***** +* XmNframeCallback callback structure. +* This callback is activated when one of the following events occurs: +* 1. XmHTML wants to create a frame, reason = XmCR_HTML_FRAMECREATE +* can be veto'd by setting doit to False and supplying a HTML widget +* id yourself; +* 2. XmHTML wants to destroy a frame, reason = XmCR_HTML_FRAMEDESTROY +* can be veto'd by setting doit to False (widget reuse). +* 3. XmHTML has finished creating a frame, reason = XmCR_HTML_FRAME. +* This is the time to attach callbacks and set additional resources on the +* newly created XmHTMLWidget. +*****/ +typedef struct +{ + int reason; /* the reason the callback was called */ + TEvent *event; /* event structure that triggered callback */ + String src; /* requested document */ + String name; /* frame name */ + TWidget html; /* XmHTML widget id */ + Boolean doit; /* destroy/create vetoing flag */ +}XmHTMLFrameCallbackStruct, *XmHTMLFramePtr; + +/***** +* XmNimagemapCallback callback structure. +* callback reasons can be one of the following: +* XmCR_HTML_IMAGEMAP_ACTIVATE +* user clicked on an image. Valid fields are x, y and image_name. x and y +* are relative to the upper-left corner of the image. Only invoked when +* an image has it's ismap attribute set and no usemap is present for this +* image. +* XmCR_HTML_IMAGEMAP +* an image requires an external imagemap. The only valid field is map_name +* which contains the location of the imagemap to fetch. If the contents +* of this imagemap is set in the map_contents field, it will be loaded +* by the widget. Alternatively, one could also use the XmHTMLAddImagemap +* convenience routine to set an imagemap into the widget. +*****/ +typedef struct +{ + int reason; /* the reason the callback was called */ + TEvent *event; /* event structure that triggered callback */ + int x,y; /* position relative to the upper-left image corner */ + String image_name; /* name of referenced image, value of src attribute */ + String map_name; /* name of imagemap to fetch */ + String map_contents;/* contents of fetched imagemap */ + XmImageInfo *image; /* image data */ +}XmHTMLImagemapCallbackStruct, *XmHTMLImagemapPtr; + +/***** +* XmNlinkCallback callback structure. +*****/ +typedef struct{ + int reason; /* the reason the callback was called */ + TEvent *event; /* event structure that triggered callback */ + int num_link; /* number of LINK info to process */ + XmHTMLLinkDataPtr link; /* array of LINK info to process */ +}XmHTMLLinkCallbackStruct, *XmHTMLLinkPtr; + +/* Don't add anything after this endif! */ +#endif /* _HTML_h_ */ diff -uNr gnome-0.10/gtk-xmhtml/LZWStream.c gnome-0.11/gtk-xmhtml/LZWStream.c --- gnome-0.10/gtk-xmhtml/LZWStream.c Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/LZWStream.c Tue Jan 6 19:58:13 1998 @@ -0,0 +1,1009 @@ +#ifndef lint +static char rcsId[]="$Header: /debian/home/gnomecvs/gnome/gtk-xmhtml/LZWStream.c,v 1.2 1998/01/07 01:45:33 unammx Exp $"; +#endif +/***** +* LZWStream.c : LZW uncompressor that doesn't use the LZW algorithm but +* converts LZW compressed data to compress LZW data and +* calls compress to do the uncompressing. +* +* This file Version $Revision: 1.2 $ +* +* Creation date: Thu May 8 04:53:42 GMT+0100 1997 +* Last modification: $Date: 1998/01/07 01:45:33 $ +* By: $Author: unammx $ +* Current State: $State: Exp $ +* +* Author: newt +* +* Copyright (C) 1994-1997 by Ripley Software Development +* All Rights Reserved +* +* This file is part of the XmHTML Widget Library. +* +* Permission to use, copy, modify, and distribute this software and its +* documentation for any purpose and without fee is hereby granted, provided +* that the above copyright notice appear in all copies and that both that +* copyright notice and this permission notice appear in supporting +* documentation. This software is provided "as is" without express or +* implied warranty. +* +* Based on an idea from Derek D. Noonburg , author of +* the public domain xpdf package, a PDF viewer. +* +*****/ +/***** +* ChangeLog +* $Log: LZWStream.c,v $ +* Revision 1.2 1998/01/07 01:45:33 unammx +* Gtk/XmHTML is ready to be used by the Gnome hackers now! +* Weeeeeee! +* +* This afternoon: +* +* - Changes to integrate gtk-xmhtml into an autoconf setup. +* +* - Changes to make gtk-xmhtml a library to be used by Gnome +* (simply include +#include +#include +#include + +#ifndef NO_XmHTML /* defined when compiling for standalone */ +#ifdef WITH_GTK +# include +#else +# include +#endif /* WITH_GTK */ +#include "XmHTMLfuncs.h" +#else +#include "ImBuffer.h" /* ImageBuffer stuff */ +typedef unsigned char Boolean; +#define True 1 +#define False 0 +#endif + +#ifdef WITH_MOTIF +# include +# include +#else +# include +# include +#endif + + +/*** External Function Prototype Declarations ***/ + +/*** Public Variable Declarations ***/ +#ifdef DEBUG +int lzw_debug = False; +#endif + +/*** Private Datatype Declarations ****/ + +#define INIT_BITS 9 /* minimum compress codeSize */ +#define MAX_LZW_BITS 12 /* maximum GIF LZW codeSize */ +#define MAX_BITS 13 /* maximum compress codeSize */ +#define MAX_LZW_CODE (1<acount > 0) \ + { \ + fwrite(lzw->accum, (size_t)1, (size_t)lzw->acount, lzw->f); \ + lzw->acount = 0; \ + } \ +} + +/* buffer output and flush when full */ +#define charOut(C) { lzw->accum[lzw->acount++] = (unsigned char)C; \ + if(lzw->acount >= BUFFERSIZE-1) \ + flushBuf; \ +} + +#define MAXCODE(n_bits) ((1L << (n_bits)) - 1) + +/*** Private Variable Declarations ***/ +#ifdef DEBUG +static int bytes_out; +#endif + +static char msg_buf[1024]; + +/* bit packing masks */ +static Byte lmask[9] = {0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00}; +static Byte rmask[9] = {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff}; + +/***** +* Name: LZWStreamGetCode +* Return Type: int +* Description: gets next code signal from the LZW stream +* In: +* lzw: current LZWStream +* Returns: +* code signal or -1 on end of data. +*****/ +static int +LZWStreamGetCode(LZWStream *lzw) +{ + int code = 0; + register int i, j; + + if(lzw->error) + { + lzw->error = 0; + return(lzw->clearCode); + } + + /* about to overflow the input buffer, get a new one */ + if((lzw->curBit + lzw->codeBits) >= lzw->lastBit) + { + int count; + + if(lzw->done) + { + /* + * when lzw->curBit >= lzw->lastBit there was less data than + * required. This is a common occurance for gif images. + */ + return(-1); + } + + /* + * Keep two last codes of current buffer, they haven't been processed + * yet. + */ + lzw->buf[0] = (int)((Byte)lzw->buf[lzw->lastByte-2]); + lzw->buf[1] = (int)((Byte)lzw->buf[lzw->lastByte-1]); + + /* get next data */ + if((count = (int)lzw->getData(lzw->ib, + (Byte*)&(lzw->buf[2]))) == 0) + lzw->done = 1; + + lzw->lastByte = 2 + count; + lzw->curBit = (lzw->curBit - lzw->lastBit) + 16; + lzw->lastBit = (2+count)*8 ; + } + + /* compute LZW code */ + for(i = lzw->curBit, j = 0; j < lzw->codeBits; ++i, ++j) + code |= (((int)((Byte)lzw->buf[i / 8]) & (1 << (i % 8))) != 0) << j; + + lzw->curBit += lzw->codeBits; + + return(code); +} + +/***** +* Name: LZWStreamUncompressData +* Return Type: int +* Description: calls "uncompress" to uncompress the LZW-compressed GIF raster +* data +* In: +* lzw: current LZWStream +* Returns: +* True upon success, False on error. +*****/ +static int +LZWStreamUncompressData(LZWStream *lzw) +{ + /* no error */ + lzw->err_msg = NULL; + + if(lzw->zPipe == NULL) + { + /* flush output file */ + fflush(lzw->f); + + /* call uncompress on our converted GIF lzw data */ + if(system(lzw->zCmd)) + { + sprintf(msg_buf, "LZWStream Error: Couldn't execute '%s'.", + lzw->zCmd); + lzw->err_msg = msg_buf; + unlink(lzw->zName); + lzw->error = True; + return(False); + } + /* open the output file */ + lzw->zName[strlen(lzw->zName) - 2] = '\0'; + if((lzw->zPipe = fopen(lzw->zName, "r")) == NULL) + { + sprintf(msg_buf, "LZWStream Error: Couldn't open uncompress " + "file '%s'. Corrupt data?", lzw->zName); + lzw->err_msg = msg_buf; + unlink(lzw->zName); + lzw->error = True; + return(False); + } + } + lzw->uncompressed = True; + return(True); +} + +/***** +* Name: LZWStreamPackBits +* Return Type: void +* Description: buffers LZW codes and writes them out when the buffer is full. +* In: +* lzw: current LZWStream +* code: LZW code to be written. +* Returns: +* nothing +* Note: +* This routine is for gif images with less than 8 bits per pixel (= codeSize) +* and packs the LZW codes the same way compress does. This is ABSOLUTELY +* REQUIRED since compress only deals with codes between 8 and 15 bits. +* This piece of code has been lifted almost literally from the public domain +* compress. +*****/ +static void +LZWStreamPackBits(LZWStream *lzw, int code) +{ + register int r_off = lzw->offset; /* current offset in output buffer */ + register int bits = lzw->n_bits; /* bits per pixel */ + register char *bp = lzw->outBuf; /* ptr to current pos in buffer */ + +#ifdef DEBUG + static int col = 0; + if(lzw_debug == 2) + fprintf(stderr, "%5d%c", code, + (col+=6) >= 74 ? (col = 0, '\n') : ' ' ); +#endif /* DEBUG */ + + if(code >= 0) + { + /* Get to the first byte. */ + bp += (r_off >> 3); + r_off &= 7; + /* + * Since code is always >= 8 bits, only need to mask the first + * hunk on the left. + */ + *bp = (*bp & rmask[r_off]) | ((code << r_off) & lmask[r_off]); + bp++; + bits -= (8 - r_off); + code >>= 8 - r_off; + + /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */ + if(bits >= 8) + { + *bp++ = code; + code >>= 8; + bits -= 8; + } + /* Last bits. */ + if(bits) + *bp = code; + + lzw->offset += lzw->n_bits; + if(lzw->offset == (lzw->n_bits << 3)) + { + bp = lzw->outBuf; + bits = lzw->n_bits; +#ifdef DEBUG + bytes_out += bits; +#endif + do + { + charOut(*bp++); + } + while(--bits); + lzw->offset = 0; + } + + /* + * If the next entry is going to be too big for the code size, + * then increase it, if possible. + */ + if(lzw->freeEntry > lzw->maxcode8 || lzw->clearFlag) + { + /* flush contents of output buffer */ + flushBuf; + + /* + * Write the whole buffer, because the input side won't + * discover the size increase until after it has read it. + */ + if(lzw->offset > 0) + { + fwrite(lzw->outBuf, 1, lzw->n_bits, lzw->f); +#ifdef DEBUG + bytes_out += lzw->n_bits; +#endif + } + lzw->offset = 0; + + if(lzw->clearFlag) + { + lzw->maxcode8 = MAXCODE(lzw->n_bits = INIT_BITS); + lzw->clearFlag = False; + } + else + { + lzw->n_bits++; + if (lzw->n_bits == MAX_BITS) + lzw->maxcode8 = MAX_CODE; + else + lzw->maxcode8 = MAXCODE(lzw->n_bits); + } +#ifdef DEBUG + if(lzw_debug == 2) + { + fprintf(stderr, "\nChange to %d bits\n", lzw->n_bits ); + col = 0; + } +#endif /* DEBUG */ + } + } + /* flush rest of buffer at EOF */ + else + { + /* flush contents of output buffer */ + flushBuf; + +#ifdef DEBUG + if(lzw_debug == 2) + fprintf(stderr, "\n" ); +#endif /* DEBUG */ + if(lzw->offset > 0) + { + /* flush out remaining chars */ + fwrite(lzw->outBuf, 1, (lzw->offset+7)/8, lzw->f); + +#ifdef DEBUG + bytes_out += (lzw->offset + 7)/8; +#endif + lzw->offset = 0; + fflush(lzw->f); + } + } +} + +/***** +* Name: LZWStreamConvertBelow8 +* Return Type: void +* Description: converts the GIF LZW compressed raster data to the compress +* compressed data format. codeSize < 8 +* In: +* lzw: current LZWStream object +* Returns: +* nothing +*****/ +static void +LZWStreamConvertBelow8(LZWStream *lzw) +{ + int inCode, outCode; /* input and output codes */ + Boolean eod = False; /* set when end-of-data is reached */ + Boolean first; /* indicates first code word after clear */ + int offset; + +#ifdef DEBUG + bytes_out = 3; /* includes 3-byte header mojo */ +#endif + + /* clear table */ + first = True; + offset = 255 - lzw->clearCode; + lzw->error = True; /* skips first clearCode in raster data */ + lzw->nextCode = lzw->maxCode; + lzw->freeEntry = FIRST; + + /* + * mimic compress behaviour but get LZW code instead of computing it. + * GIF LZW code needs to be corrected to match fixed compress codes so we + * can properly reset the tables if required. We also must keep track of + * the LZW codesize since it influences the values of the LZW codes. + */ + while((inCode = LZWStreamGetCode(lzw)) != -1 && !eod) + { + /***** + * First part: verify and adjust GIF LZW code signal. + *****/ + + /* + * clearCode sets everything back to their initial values and then + * reads the next code. + */ + if(inCode == lzw->clearCode) + { + /* reset code table */ + lzw->codeBits = lzw->codeSize + 1; + lzw->clearCode = 1 << lzw->codeSize; + lzw->endCode = lzw->clearCode + 1; + lzw->maxCodeSize = 2*lzw->clearCode; + lzw->maxCode = lzw->clearCode + 2; + lzw->nextCode = lzw->maxCode - 1; + offset = 255 - lzw->clearCode; + + /* keep output side in sync */ + if(first) + first = False; + else + { + lzw->freeEntry = FIRST; + lzw->clearFlag = True; + LZWStreamPackBits(lzw, CLEAR); +#ifdef DEBUG + if(lzw_debug == 2) + fprintf(stderr, "clear\n"); +#endif /* DEBUG */ + } + /* get next code */ + do + { + inCode = LZWStreamGetCode(lzw); + if (inCode == -1) + { + /* end-of-data, break out of it */ + eod = True; + inCode = lzw->endCode; + break; + } + }while(inCode == lzw->clearCode); + } + + /* End-of-data, compress doesn't have this , so just break */ + if(inCode == lzw->endCode) + { + outCode = 0; + eod = True; + break; + } + /* + * Check input code size and adjust if the next code would overflow + * the LZW tables. Compressed GIF raster data uses a range starting + * at codeSize + 1 up to 12 bits per code. + */ + if((++lzw->nextCode >= lzw->maxCodeSize) && + (lzw->maxCodeSize < MAX_LZW_CODE)) + { + lzw->maxCodeSize *= 2; + lzw->codeBits++; + } + + /***** + * Second part: write corrected LZW code + * + * write output block: the output buffer contains a series of bytes + * with lengths anywhere between 3 and 12. Compress can only handle + * codeSize 8 or up, anything below must be packed according to the + * format compress expects. + * This was the most difficult part to figure out, but its as simple + * as this: the GIF lzw codes are just increased with the difference + * of compress clearCode (fixed value of 256) and the current GIF + * clearCode... + *****/ + + /* correct and flush */ + LZWStreamPackBits(lzw, + inCode < lzw->clearCode ? inCode : inCode + offset); + + if(lzw->freeEntry < MAX_CODE) + lzw->freeEntry++; + } + /* flush output buffer */ + LZWStreamPackBits(lzw, -1); + + /* and close output file */ + fflush(lzw->f); + fclose(lzw->f); + lzw->f = NULL; +} + +/***** +* Name: LZWStreamConvert8OrAbove +* Return Type: void +* Description: converts the GIF LZW compressed raster data to the compress +* compressed data format. codeSize >= 8 +* In: +* lzw: current LZWStream object +* Returns: +* nothing +*****/ +static void +LZWStreamConvert8OrAbove(LZWStream *lzw) +{ + int outBuf[8]; + int inCode, outCode; /* input and output codes */ + int outCodeBits; /* size of output code */ + int maxOutSize; /* maximum output signal */ + Boolean eod = False; /* set when end-of-data is reached */ + Boolean clear; /* set if table needs to be cleared */ + Boolean first; /* indicates first code word after clear */ + int i, j; + int outData, outBits; + +#ifdef DEBUG + bytes_out = 3; /* includes 3-byte header mojo */ +#endif + + /* init output side */ + outCodeBits = lzw->codeBits; + maxOutSize = 2*lzw->clearCode; + + /* clear table */ + first = True; + lzw->error = True; /* skips first clearCode in raster data */ + lzw->nextCode = lzw->maxCode - 1; + clear = False; + + do + { + /* create output buffer */ + for (i = 0; i < 8; ++i) + { + /* check for table overflow */ + if(lzw->nextCode + 1 > 0x1001) + { + /* clear string table */ + inCode = 256; + } + /* read input code */ + else + { + do + { + inCode = LZWStreamGetCode(lzw); + if (inCode == -1) + { + eod = True; + inCode = 0; + } + }while (first && inCode == lzw->clearCode); + first = False; + } + + /* + * code signal less than clear code signal: compressed data, + * store it. + */ + if (inCode < lzw->clearCode) + { + outCode = inCode; + } + /* + * code signal equals clear code. Set flag so string table will + * be cleared. GIF clearCode signal value is dynamic, whereas + * compress uses a fixed value of 256. + */ + else if (inCode == lzw->clearCode) + { + outCode = 256; + clear = True; + first = False; + } + /* + * end code signal. Compress does not have this signal so just set + * the end-of-data flag. + */ + else if (inCode == lzw->endCode) + { + outCode = 0; + eod = True; + } + else + /* + * code signal higher than end code signal: compressed data, + * store it. + */ + outCode = inCode - 1; + + outBuf[i] = outCode; + + /* + * check input code size. Compressed GIF raster data uses a range + * starting at codeSize + 1 up to 12 bits per code. + */ + if((++lzw->nextCode >= lzw->maxCodeSize) && + (lzw->maxCodeSize < MAX_LZW_CODE)) + { + lzw->maxCodeSize *= 2; + ++lzw->codeBits; + } + + /* check for eod/clear */ + if (eod) + { + break; + } + if(clear) + { + i = 8; + break; + } + } + + /* + * write output block: the output buffer contains a series of bytes + * with lengths anywhere between 8 and 12. The output buffer is just + * packed in the same way an LZW gif *writer* does it. + */ + outBits = 0; /* max output code */ + outData = 0; /* temporary output buffer */ + j = 0; + while(j < i || outBits > 0) + { + /* package all codes */ + if(outBits < 8 && j < i) + { + outData = outData | (outBuf[j++] << outBits); + outBits += outCodeBits; + } + charOut(outData & 0xff); + outData >>= 8; + outBits -= 8; + } + +#ifdef DEBUG + bytes_out += outCodeBits; +#endif + if(lzw->nextCode - 1 == maxOutSize) + { + outCodeBits = lzw->codeBits; + maxOutSize *= 2; + } + + /* clear table if necessary */ + if(clear) + { + lzw->codeBits = lzw->codeSize + 1; + lzw->clearCode = 1 << lzw->codeSize; + lzw->endCode = lzw->clearCode + 1; + lzw->maxCodeSize = 2*lzw->clearCode; + lzw->maxCode = lzw->clearCode + 2; + lzw->nextCode = lzw->maxCode - 1; + maxOutSize = 2*lzw->clearCode; + outCodeBits = lzw->codeBits; + clear = False; + } + }while (!eod); + + /* flush any chars left */ + flushBuf; + + /* and close output file */ + fflush(lzw->f); + fclose(lzw->f); + lzw->f = NULL; +} + +/******* +*** Public Functions +*******/ + +/***** +* Name: LZWStreamConvert +* Return Type: void +* Description: LZW decoder driver +* In: +* lzw: current LZWStream +* Returns: +* nothing +*****/ +void +LZWStreamConvert(LZWStream *lzw) +{ + if(lzw->codeSize >= 8) + LZWStreamConvert8OrAbove(lzw); + else + LZWStreamConvertBelow8(lzw); +} + +/***** +* Name: LZWStreamInit +* Return Type: int +* Description: initializes the given stream +* In: +* lzw: current LZWStream +* Returns: +* 0 when codeSize is wrong, -1 when no temporary file could be created, +* 1 otherwise. +*****/ +int +LZWStreamInit(LZWStream *lzw) +{ + Byte c; + int i; + + /* no error */ + lzw->err_msg = NULL; + + /* check if we have the read functions */ + if(lzw->readOK == NULL || lzw->getData == NULL) + { + sprintf(msg_buf, "LZWStream Error: no read functions attached!"); + lzw->err_msg = msg_buf; + return(-2); + } + + /* init input side */ + lzw->done = 0; + lzw->curBit = 0; + lzw->lastBit = 0; + lzw->lastByte = 2; + + for(i = 0; i < 280; i++) + lzw->buf[i] = 0; + for(i = 0; i < 16; i++) + lzw->outBuf[i] = 0; + + /* initialize buffered output */ + memset(lzw->accum, '\0', BUFFERSIZE); + lzw->acount = 0; + + /* close any open files */ + if(lzw->zPipe) + { + fclose(lzw->zPipe); + lzw->zPipe = NULL; + } + if(lzw->f) + { + fclose(lzw->f); + lzw->f = NULL; + unlink(lzw->zName); + } + + /* no data to uncompress yet */ + lzw->error = False; + lzw->uncompressed = False; + + /* temporary output file */ + tmpnam(lzw->zName); + strcat(lzw->zName, ".Z"); + + /* open it */ + if(!(lzw->f = fopen(lzw->zName, "w"))) + { + sprintf(msg_buf, "LZWStream Error: couldn't open temporary file " + "'%s'.", lzw->zName); + lzw->err_msg = msg_buf; + return(-1); + } + + /* + * get codeSize (= how many bits each pixel takes) from ImageBuffer. + */ + if((lzw->readOK(lzw->ib, &c, 1)) == 0) + { + sprintf(msg_buf, "LZWStream Error: couldn't read GIF codesize."); + lzw->err_msg = msg_buf; + return(0); + } + + /* GIF lzw codes */ + lzw->codeSize = (int)((Byte)c); /* initial bits per pixel */ + + /* initialize input side */ + lzw->codeBits = lzw->codeSize + 1; + lzw->clearCode = 1 << lzw->codeSize; + lzw->endCode = lzw->clearCode + 1; + lzw->maxCodeSize = 2*lzw->clearCode; + lzw->maxCode = lzw->clearCode + 2; + lzw->nextCode = lzw->maxCode; + + /* initialize codeSize < 8 output side */ + lzw->offset = 0; + lzw->clearFlag = False; + lzw->n_bits = INIT_BITS; + lzw->maxcode8 = MAXCODE(lzw->n_bits); + lzw->freeEntry = FIRST; + + /* check clearCode value */ + if(lzw->clearCode >= MAX_LZW_CODE) + { + sprintf(msg_buf, "LZWStream Error: corrupt raster data: bad " + "GIF codesize (%i).", lzw->codeSize); + lzw->err_msg = msg_buf; + return(0); + } + + /* Write compress header */ + charOut(0x1f); + charOut(0x9d); + + /* gif max code length + 1, block mode flag */ + charOut((MAX_BITS & 0x1f) | 0x80); + + return(1); +} + +/***** +* Name: LZWStreamCreate +* Return Type: LZWStream +* Description: allocates a new stream +* In: +* ib: data input buffer +* Returns: +* a newly created stream object. +*****/ +LZWStream* +LZWStreamCreate(ImageBuffer *ib, char *zCmd) +{ + static LZWStream *lzw; + + /* create a new stream */ + if((lzw = (LZWStream*)calloc(1, sizeof(LZWStream))) == NULL) + return(NULL); + + /* store ptr to input buffer */ + lzw->ib = ib; + + /* create uncompress command */ + strcpy(lzw->zCmd, zCmd != NULL ? zCmd : "uncompress"); + strcat(lzw->zCmd, " "); + + /* offset for temporary file in which compressed data is to be stored */ + lzw->zName = lzw->zCmd + strlen(lzw->zCmd); + + /* no default readOK and getData, they need to be set by caller */ + + /* and return the new stream */ + return(lzw); +} + +/***** +* Name: LZWStreamDestroy +* Return Type: void +* Description: destroys the given LZW stream +* In: +* lzw: LZWStream to destroy +* Returns: +* nothing. +*****/ +void +LZWStreamDestroy(LZWStream *lzw) +{ + if(lzw == NULL) + return; + + if(lzw->zPipe) + fclose(lzw->zPipe); + if(lzw->f) + fclose(lzw->f); + unlink(lzw->zName); + free(lzw); +} + +/***** +* Name: LZWStreamFillBuffer +* Return Type: int +* Description: read uncompressed data from the stream +* In: +* lzw: current LZWStream object +* data: output buffer +* size: size of output buffer +* Returns: +* no of chars read from stream +*****/ +int +LZWStreamFillBuffer(LZWStream *lzw, unsigned char *data, int size) +{ + int n; + + if(lzw->error) + return(0); + + /* uncompress data if not yet done */ + if(!lzw->uncompressed || lzw->zPipe == NULL) + { + if(!(LZWStreamUncompressData(lzw))) + return(0); + } + n = fread(data, 1, size, lzw->zPipe); + return(n); +} + +/***** +* Name: LZWStreamUncompress +* Return Type: unsigned char * +* Description: return an allocated buffer with uncompressed stream data +* In: +* lzw: current LZWStream +* size: size of data read, filled upon return. +* Returns: +* An allocated buffer when succesfully uncompressed and size is updated to +* contain the no of characters read. Upon error, NULL is returned and size +* is set to 0. +*****/ +unsigned char * +LZWStreamUncompress(LZWStream *lzw, int *size) +{ + static unsigned char *data; + + *size = 0; + + if(lzw->error) + return(NULL); + + /* no error */ + lzw->err_msg = NULL; + + /* uncompress data if not yet done */ + if(!lzw->uncompressed || lzw->zPipe == NULL) + { + if(!(LZWStreamUncompressData(lzw))) + return(NULL); + } + + fseek(lzw->zPipe, 0L, SEEK_END); + *size = ftell(lzw->zPipe); + + /* sanity check */ + if(*size == 0) + { + sprintf(msg_buf, "LZWStream Error: zero-length data file."); + lzw->err_msg = msg_buf; + return(NULL); + } + + rewind(lzw->zPipe); + + data = (unsigned char*)malloc(*size*sizeof(unsigned char)); + + /* read it all */ + (void)fread(data, *size, 1, lzw->zPipe); + + /* close and remove file */ + if(lzw->zPipe) + { + fclose(lzw->zPipe); + lzw->zPipe = NULL; + } + if(lzw->f) + { + fclose(lzw->f); + lzw->f = NULL; + unlink(lzw->zName); + } + /* and return it */ + return(data); +} + +int +LZWStreamGetCodeSize(LZWStream *lzw) +{ + return(lzw->codeSize); +} diff -uNr gnome-0.10/gtk-xmhtml/LZWStream.h gnome-0.11/gtk-xmhtml/LZWStream.h --- gnome-0.10/gtk-xmhtml/LZWStream.h Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/LZWStream.h Sat Dec 6 09:01:53 1997 @@ -0,0 +1,128 @@ +/***** +* LZWStream.h : LZW uncompressor public header file +* +* This file Version $Revision: 1.1 $ +* +* Creation date: Thu May 8 04:57:06 GMT+0100 1997 +* Last modification: $Date: 1997/11/28 03:38:53 $ +* By: $Author: gnomecvs $ +* Current State: $State: Exp $ +* +* Author: newt +* +* Copyright (C) 1994-1997 by Ripley Software Development +* All Rights Reserved +* +* This file is part of the XmHTML Widget Library. +* +* Permission to use, copy, modify, and distribute this software and its +* documentation for any purpose and without fee is hereby granted, provided +* that the above copyright notice appear in all copies and that both that +* copyright notice and this permission notice appear in supporting +* documentation. This software is provided "as is" without express or +* implied warranty. +* +* Based on an idea from Derek D. Noonburg , author of +* the public domain xpdf package, a PDF viewer. +* +*****/ +/***** +* $Source: /debian/home/gnomecvs/gnome/gtk-xmhtml/LZWStream.h,v $ +*****/ +/***** +* ChangeLog +* $Log: LZWStream.h,v $ +* Revision 1.1 1997/11/28 03:38:53 gnomecvs +* Work in progress port of XmHTML; No, it does not compile, don't even try -mig +* +* Revision 1.3 1997/08/30 00:25:02 newt +* Changed copyright. Use of the LZWStream package is now totally unrestricted. +* +* Revision 1.2 1997/08/01 12:52:23 newt +* Progressive image loading changes +* +* Revision 1.1 1997/05/28 01:27:04 newt +* Initial Revision +* +*****/ + +#ifndef _LZWStream_h_ +#define _LZWStream_h_ + +#define BUFFERSIZE 512 + +/***** +* LZW stream definition +*****/ +typedef struct _LZWStream{ + FILE *zPipe; /* uncompress file handle */ + FILE *f; /* compress file handle */ + char zCmd[256]; /* uncompress command */ + char *zName; /* compress file name, indexes in zCmd */ + int error; /* uncompress error flag */ + int uncompressed; /* uncompress finished flag */ + ImageBuffer *ib; /* master input buffer */ + + unsigned char accum[BUFFERSIZE]; /* buffered output */ + int acount; /* current char count */ + + /* LZW code computation variables */ + char buf[280]; /* input buffer */ + int curBit; /* no of bits processed so far */ + int lastBit; /* bitcount of last bit in input buffer */ + int lastByte; /* last known processed byte */ + int done; /* input done flag */ + int nextCode; /* LZW code counter */ + + /* global raster data variables */ + int codeSize; /* bits per pixel */ + int codeBits; /* bits used by each LZW code */ + int clearCode; /* reset signal table signal */ + int endCode; /* end-of-data signal */ + int maxCode; /* start code signal */ + int maxCodeSize; /* maximum signal table size */ + char outBuf[16]; /* compress output buffer */ + + /* variables for images with 7 or less bits per pixel */ + int offset; /* current bit offset */ + int freeEntry; /* compress code counter */ + int n_bits; /* output code size */ + int maxcode8; /* maximum output signal */ + int clearFlag; /* clear signal table flag */ + + /* data readers */ + size_t (*readOK)(ImageBuffer*, unsigned char*, int); + size_t (*getData)(ImageBuffer*, unsigned char*); + + char *err_msg; /* error description */ +}LZWStream; + +/* create a new stream object */ +extern LZWStream *LZWStreamCreate(ImageBuffer *ib, char *zCmd); + +/***** +* Initialize uncompression. Possible return codes: +* -2: the read functions haven't been set; +* -1: temp file couldn't be opened; +* 0: gif code size is invalid/couldn't be read; +* 1: success. +*****/ +extern int LZWStreamInit(LZWStream *lzw); + +/* convert GIF LZW to compress LZW */ +extern void LZWStreamConvert(LZWStream *lzw); + +/* destroy the stream object */ +extern void LZWStreamDestroy(LZWStream *lzw); + +/* return an allocated buffer with uncompressed stream data */ +extern unsigned char *LZWStreamUncompress(LZWStream *lzw, int *size); + +/* read uncompressed data from the stream */ +extern int LZWStreamFillBuffer(LZWStream *lzw, unsigned char *data, int size); + +/* return original bits per pixel */ +extern int LZWStreamGetCodeSize(LZWStream *lzw); + +/* Don't add anything after this endif! */ +#endif /* _LZWStream_h_ */ diff -uNr gnome-0.10/gtk-xmhtml/Makefile.am gnome-0.11/gtk-xmhtml/Makefile.am --- gnome-0.10/gtk-xmhtml/Makefile.am Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/Makefile.am Wed Jan 7 20:17:45 1998 @@ -0,0 +1,75 @@ +## Procesed by automake to procduce Makefile.in + +libgtkxmhtmlincludedir = $(includedir)/gtk-xmhtml + +INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) -DWITH_GTK -DDEBUG -DGNOME_LIB + + +lib_LTLIBRARIES = libgtkxmhtml.la + +libgtkxmhtml_la_SOURCES = \ + XmHTML.c \ + gtk-error.c \ + gtk-forms.c \ + frames.c \ + parse.c \ + StringUtil.c \ + fonts.c \ + paint.c \ + map.c \ + callbacks.c \ + format.c \ + plc.c \ + readXPM.c \ + readJPEG.c \ + readJPEGplc.c \ + readBitmap.c \ + readGIF.c \ + LZWStream.c \ + LZWStream.h \ + readGIFplc.c \ + readFLG.c \ + readPNG.c \ + colors.c \ + images.c \ + quantize.c \ + layout.c \ + events.c \ + debug.c \ + XmHTML-motif.h \ + XmHTMLfuncs.h \ + debug.h \ + escapes.h \ + motif.h \ + plc.h + +libgtkxmhtmlinclude_HEADERS = \ + miniparse.h \ + HTML.h \ + XmHTML.h \ + XmHTMLI.h \ + XmHTMLP.h \ + gtk-xmhtml-p.h \ + gtk-xmhtml.h \ + toolkit.h + +libgtkxmhtml_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir) +libgtkxmhtml_la_LIBADD = $(GTK_LIBS) $(X_LIBS) $(x_libs) + +bin_PROGRAMS = htmltest + +htmltest_SOURCES = test.c +htmltest_LDADD = $(top_builddir)/gtk-xmhtml/libgtkxmhtml.la \ + $(GTK_LIBS) $(X_LIBS) $(x_libs) $(Z_LIBS) $(JPEG_LIBS) $(PNG_LIBS) $(XPM_LIBS) + +## These are included by XmHTML.c: + +EXTRA_DIST = gtk-xmhtml.c XmHTML-motif.c + +dist-hook: + mkdir $(distdir)/bitmaps + cp bitmaps/*.xpm bitmaps/*.xbm $(distdir)/bitmaps + +## If I dont do this, for some wierdo reason, it tries to compile gtk-xmhtml.o +gtk-xmhtml: + echo diff -uNr gnome-0.10/gtk-xmhtml/Makefile.in gnome-0.11/gtk-xmhtml/Makefile.in --- gnome-0.10/gtk-xmhtml/Makefile.in Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/Makefile.in Wed Jan 7 20:30:49 1998 @@ -0,0 +1,518 @@ +# Makefile.in generated automatically by automake 1.2d from Makefile.am + +# Copyright (C) 1994, 1995, 1996, 1997 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. + + +SHELL = /bin/sh + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +DATADIRNAME = @DATADIRNAME@ +DL_LIB = @DL_LIB@ +ELCFILES = @ELCFILES@ +EMACS = @EMACS@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GTK_LIBS = @GTK_LIBS@ +GUILE_LIBS = @GUILE_LIBS@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +INTLSUB = @INTLSUB@ +JPEG_LIBS = @JPEG_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LIBTOOL = @LIBTOOL@ +LISPDIR = @LISPDIR@ +LN_S = @LN_S@ +MAKEINFO = @MAKEINFO@ +MSGFMT = @MSGFMT@ +NM = @NM@ +OBJC = @OBJC@ +OSOCKADDR_CFLAGS = @OSOCKADDR_CFLAGS@ +PACKAGE = @PACKAGE@ +PNG_LIBS = @PNG_LIBS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PTHREAD_LIB = @PTHREAD_LIB@ +QTTHREADS_LIB = @QTTHREADS_LIB@ +RANLIB = @RANLIB@ +READLINE_LIB = @READLINE_LIB@ +TERMCAP_LIB = @TERMCAP_LIB@ +VERSION = @VERSION@ +XF86MISC_LIBS = @XF86MISC_LIBS@ +XPM_LIBS = @XPM_LIBS@ +YACC = @YACC@ +Z_LIBS = @Z_LIBS@ +x_libs = @x_libs@ + +libgtkxmhtmlincludedir = $(includedir)/gtk-xmhtml + +INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) -DWITH_GTK -DDEBUG -DGNOME_LIB + +lib_LTLIBRARIES = libgtkxmhtml.la + +libgtkxmhtml_la_SOURCES = \ + XmHTML.c \ + gtk-error.c \ + gtk-forms.c \ + frames.c \ + parse.c \ + StringUtil.c \ + fonts.c \ + paint.c \ + map.c \ + callbacks.c \ + format.c \ + plc.c \ + readXPM.c \ + readJPEG.c \ + readJPEGplc.c \ + readBitmap.c \ + readGIF.c \ + LZWStream.c \ + LZWStream.h \ + readGIFplc.c \ + readFLG.c \ + readPNG.c \ + colors.c \ + images.c \ + quantize.c \ + layout.c \ + events.c \ + debug.c \ + XmHTML-motif.h \ + XmHTMLfuncs.h \ + debug.h \ + escapes.h \ + motif.h \ + plc.h + +libgtkxmhtmlinclude_HEADERS = \ + miniparse.h \ + HTML.h \ + XmHTML.h \ + XmHTMLI.h \ + XmHTMLP.h \ + gtk-xmhtml-p.h \ + gtk-xmhtml.h \ + toolkit.h + +libgtkxmhtml_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir) +libgtkxmhtml_la_LIBADD = $(GTK_LIBS) $(X_LIBS) $(x_libs) + +bin_PROGRAMS = htmltest + +htmltest_SOURCES = test.c +htmltest_LDADD = $(top_builddir)/gtk-xmhtml/libgtkxmhtml.la \ + $(GTK_LIBS) $(X_LIBS) $(x_libs) $(Z_LIBS) $(JPEG_LIBS) $(PNG_LIBS) $(XPM_LIBS) + +EXTRA_DIST = gtk-xmhtml.c XmHTML-motif.c +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +LIBS = @LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_LIBS = @X_LIBS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +libgtkxmhtml_la_DEPENDENCIES = +libgtkxmhtml_la_OBJECTS = XmHTML.lo gtk-error.lo gtk-forms.lo frames.lo \ +parse.lo StringUtil.lo fonts.lo paint.lo map.lo callbacks.lo format.lo \ +plc.lo readXPM.lo readJPEG.lo readJPEGplc.lo readBitmap.lo readGIF.lo \ +LZWStream.lo readGIFplc.lo readFLG.lo readPNG.lo colors.lo images.lo \ +quantize.lo layout.lo events.lo debug.lo +PROGRAMS = $(bin_PROGRAMS) + +htmltest_OBJECTS = test.o +htmltest_DEPENDENCIES = $(top_builddir)/gtk-xmhtml/libgtkxmhtml.la +htmltest_LDFLAGS = +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ +HEADERS = $(libgtkxmhtmlinclude_HEADERS) + +DIST_COMMON = ChangeLog Makefile.am Makefile.in TODO + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP = --best +SOURCES = $(libgtkxmhtml_la_SOURCES) $(htmltest_SOURCES) +OBJECTS = $(libgtkxmhtml_la_OBJECTS) $(htmltest_OBJECTS) + +default: all + +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps gtk-xmhtml/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-libLTLIBRARIES: + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + +distclean-libLTLIBRARIES: + +maintainer-clean-libLTLIBRARIES: + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(libdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(libdir)/$$p; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + $(NORMAL_UNINSTALL) + list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(libdir)/$$p; \ + done + +.c.o: + $(COMPILE) -c $< + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +libgtkxmhtml.la: $(libgtkxmhtml_la_OBJECTS) $(libgtkxmhtml_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libgtkxmhtml_la_LDFLAGS) $(libgtkxmhtml_la_OBJECTS) $(libgtkxmhtml_la_LIBADD) $(LIBS) + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`"; \ + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + $(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \ + done + +htmltest: $(htmltest_OBJECTS) $(htmltest_DEPENDENCIES) + @rm -f htmltest + $(LINK) $(htmltest_LDFLAGS) $(htmltest_OBJECTS) $(htmltest_LDADD) $(LIBS) + +install-libgtkxmhtmlincludeHEADERS: $(libgtkxmhtmlinclude_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(libgtkxmhtmlincludedir) + @list='$(libgtkxmhtmlinclude_HEADERS)'; for p in $$list; do \ + echo " $(INSTALL_DATA) $(srcdir)/$$p $(libgtkxmhtmlincludedir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(libgtkxmhtmlincludedir)/$$p; \ + done + +uninstall-libgtkxmhtmlincludeHEADERS: + $(NORMAL_UNINSTALL) + list='$(libgtkxmhtmlinclude_HEADERS)'; for p in $$list; do \ + rm -f $(libgtkxmhtmlincludedir)/$$p; \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = gtk-xmhtml + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done + $(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook +LZWStream.o LZWStream.lo: LZWStream.c XmHTMLP.h toolkit.h XmHTML.h \ + HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h \ + debug.h LZWStream.h +StringUtil.o StringUtil.lo: StringUtil.c toolkit.h XmHTMLP.h XmHTML.h \ + HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h \ + debug.h escapes.h +XmHTML.o XmHTML.lo: XmHTML.c ../config.h XmHTMLP.h toolkit.h XmHTML.h \ + HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h \ + debug.h bitmaps/fingers.xbm bitmaps/fingers_m.xbm gtk-xmhtml.c +callbacks.o callbacks.lo: callbacks.c XmHTMLP.h toolkit.h XmHTML.h \ + HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h \ + debug.h toolkit.h +colors.o colors.lo: colors.c XmHTMLP.h toolkit.h XmHTML.h HTML.h \ + XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h debug.h +debug.o debug.lo: debug.c XmHTMLfuncs.h debug.h +events.o events.lo: events.c XmHTMLP.h toolkit.h XmHTML.h HTML.h \ + XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h debug.h +fonts.o fonts.lo: fonts.c XmHTMLP.h toolkit.h XmHTML.h HTML.h XmHTMLI.h \ + gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h debug.h +format.o format.lo: format.c XmHTMLP.h toolkit.h XmHTML.h HTML.h \ + XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h debug.h +frames.o frames.lo: frames.c XmHTMLP.h toolkit.h XmHTML.h HTML.h \ + XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h debug.h \ + toolkit.h +gtk-error.o gtk-error.lo: gtk-error.c XmHTMLP.h toolkit.h XmHTML.h \ + HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h \ + debug.h +gtk-forms.o gtk-forms.lo: gtk-forms.c XmHTMLP.h toolkit.h XmHTML.h \ + HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h \ + debug.h +images.o images.lo: images.c ../config.h XmHTMLP.h toolkit.h XmHTML.h \ + HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h \ + debug.h plc.h toolkit.h LZWStream.h bitmaps/boomerang.xpm \ + bitmaps/noboomerang.xpm +layout.o layout.lo: layout.c XmHTMLP.h toolkit.h XmHTML.h HTML.h \ + XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h debug.h +map.o map.lo: map.c XmHTMLP.h toolkit.h XmHTML.h HTML.h XmHTMLI.h \ + gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h debug.h +paint.o paint.lo: paint.c XmHTMLP.h toolkit.h XmHTML.h HTML.h XmHTMLI.h \ + gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h debug.h +parse.o parse.lo: parse.c XmHTMLP.h toolkit.h XmHTML.h HTML.h XmHTMLI.h \ + gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h debug.h +plc.o plc.lo: plc.c ../config.h toolkit.h XmHTMLP.h XmHTML.h HTML.h \ + XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h debug.h \ + plc.h toolkit.h LZWStream.h +quantize.o quantize.lo: quantize.c XmHTMLP.h toolkit.h XmHTML.h HTML.h \ + XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h debug.h +readBitmap.o readBitmap.lo: readBitmap.c ../config.h XmHTMLP.h toolkit.h \ + XmHTML.h HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h \ + XmHTMLfuncs.h debug.h plc.h toolkit.h LZWStream.h +readFLG.o readFLG.lo: readFLG.c ../config.h XmHTMLP.h toolkit.h XmHTML.h \ + HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h \ + debug.h +readGIF.o readGIF.lo: readGIF.c ../config.h XmHTMLP.h toolkit.h XmHTML.h \ + HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h \ + debug.h LZWStream.h +readGIFplc.o readGIFplc.lo: readGIFplc.c ../config.h XmHTMLP.h toolkit.h \ + XmHTML.h HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h \ + XmHTMLfuncs.h debug.h LZWStream.h plc.h toolkit.h +readJPEG.o readJPEG.lo: readJPEG.c ../config.h XmHTMLP.h toolkit.h \ + XmHTML.h HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h \ + XmHTMLfuncs.h debug.h +readJPEGplc.o readJPEGplc.lo: readJPEGplc.c ../config.h XmHTMLP.h \ + toolkit.h XmHTML.h HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h \ + XmHTMLfuncs.h debug.h plc.h toolkit.h LZWStream.h +readPNG.o readPNG.lo: readPNG.c ../config.h XmHTMLP.h toolkit.h XmHTML.h \ + HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h \ + debug.h +readXPM.o readXPM.lo: readXPM.c ../config.h XmHTMLP.h toolkit.h XmHTML.h \ + HTML.h XmHTMLI.h gtk-xmhtml-p.h gtk-xmhtml.h XmHTMLfuncs.h \ + debug.h plc.h toolkit.h LZWStream.h +test.o test.lo: test.c gtk-xmhtml.h toolkit.h XmHTML.h HTML.h XmHTMLP.h \ + XmHTMLI.h gtk-xmhtml-p.h + +info: +dvi: +check: all + $(MAKE) +installcheck: +install-exec: install-libLTLIBRARIES install-binPROGRAMS + @$(NORMAL_INSTALL) + +install-data: install-libgtkxmhtmlincludeHEADERS + @$(NORMAL_INSTALL) + +install: install-exec install-data all + @: + +uninstall: uninstall-libLTLIBRARIES uninstall-binPROGRAMS uninstall-libgtkxmhtmlincludeHEADERS + +all: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) + +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install +installdirs: + $(mkinstalldirs) $(libdir) $(bindir) $(libgtkxmhtmlincludedir) + + +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(DISTCLEANFILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean: mostlyclean-libLTLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-binPROGRAMS \ + mostlyclean-tags mostlyclean-generic + +clean: clean-libLTLIBRARIES clean-compile clean-libtool \ + clean-binPROGRAMS clean-tags clean-generic mostlyclean + +distclean: distclean-libLTLIBRARIES distclean-compile distclean-libtool \ + distclean-binPROGRAMS distclean-tags distclean-generic \ + clean + -rm -f config.status + -rm -f libtool + +maintainer-clean: maintainer-clean-libLTLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-binPROGRAMS maintainer-clean-tags \ + maintainer-clean-generic distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +.PHONY: default mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \ +clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \ +uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \ +distclean-compile clean-compile maintainer-clean-compile \ +mostlyclean-libtool distclean-libtool clean-libtool \ +maintainer-clean-libtool mostlyclean-binPROGRAMS distclean-binPROGRAMS \ +clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \ +install-binPROGRAMS uninstall-libgtkxmhtmlincludeHEADERS \ +install-libgtkxmhtmlincludeHEADERS tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info dvi installcheck \ +install-exec install-data install uninstall all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +dist-hook: + mkdir $(distdir)/bitmaps + cp bitmaps/*.xpm bitmaps/*.xbm $(distdir)/bitmaps + +gtk-xmhtml: + echo + +# 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 -uNr gnome-0.10/gtk-xmhtml/StringUtil.c gnome-0.11/gtk-xmhtml/StringUtil.c --- gnome-0.10/gtk-xmhtml/StringUtil.c Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/StringUtil.c Tue Jan 6 19:58:15 1998 @@ -0,0 +1,1197 @@ +#ifndef lint +static char rcsId[]="$Header: /debian/home/gnomecvs/gnome/gtk-xmhtml/StringUtil.c,v 1.3 1998/01/07 01:45:34 unammx Exp $"; +#endif +/***** +* StringUtil.c: badly named file with misc. routines that don't fit anywhere +* else. +* +* This file Version $Revision: 1.3 $ +* +* Creation date: Wed May 29 22:35:32 GMT+0100 1996 +* Last modification: $Date: 1998/01/07 01:45:34 $ +* By: $Author: unammx $ +* Current State: $State: Exp $ +* +* Author: newt +* (C)Copyright 1995 Ripley Software Development +* All Rights Reserved +* +* Hashing routines Copyright (c) 1997 Alfredo K. Kojima +* +* This file is part of the XmHTML Widget Library. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Library General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library 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 +* Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public +* License along with this library; if not, write to the Free +* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* Source History: +* ForUtil-0.52 +* newt +*****/ +/***** +* ChangeLog +* $Log: StringUtil.c,v $ +* Revision 1.3 1998/01/07 01:45:34 unammx +* Gtk/XmHTML is ready to be used by the Gnome hackers now! +* Weeeeeee! +* +* This afternoon: +* +* - Changes to integrate gtk-xmhtml into an autoconf setup. +* +* - Changes to make gtk-xmhtml a library to be used by Gnome +* (simply include +#include +#include +#include /* toupper, tolower, isspace */ +#include + +#ifdef WITH_MOTIF +# include +#else +# include +#endif + +#include "XmHTMLP.h" +#include "XmHTMLfuncs.h" +#include "escapes.h" + + +/*** External Function Prototype Declarations ***/ + +/*** Public Variable Declarations ***/ + +/*** +* Character translation table for converting from upper to lower case +* Since this is a table lookup, it might perform better than the libc +* tolower routine on a number of systems. +***/ + +const Byte __my_translation_table[256]={ + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44, + 45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,97,98, + 99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115, + 116,117,118,119,120,121,122,91,92,93,94,95,96,97,98,99,100,101,102, + 103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119, + 120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136, + 137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153, + 154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170, + 171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187, + 188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204, + 205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221, + 222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, + 239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255}; + +/*** Private Function Prototype Declarations ****/ +static String to_ascii(int val); +static String to_roman(int val); + +/* convert a character escape sequence */ +static char tokenToEscape(char **escape, Boolean warn); + +/*** Private Variable Declarations ***/ +static char *Ones[] = + {"i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix"}; +static char *Tens[] = + {"x", "xx", "xxx", "xl", "l", "lx", "lxx", "lxxx", "xc"}; +static char *Hundreds[] = + {"c", "cc", "ccc", "cd", "d", "dc", "dcc", "dccc", "cm"}; + +/***** +* Name: my_upcase +* Return Type: void +* Description: makes a string all uppercase +* In: +* string: string to translate to uppercase +* Returns: +* nothing, string is changed upon return. +*****/ +void +my_upcase(char *string) +{ + register char *outPtr = string; + for(outPtr = string; *outPtr != '\0'; + *(outPtr++) = toupper(*(string++))); +} + +/***** +* Name: my_locase +* Return Type: void +* Description: make a string all lower case +* In: +* string: string to translate to lowercase +* Returns: +* nothing, string is changed upon return. +*****/ +void +my_locase(char *string) +{ + register char *outPtr = string; + for(outPtr = string; *outPtr != '\0'; + *(outPtr++) = _FastLower(*(string++))); +} + +/***** +* Name: my_strcasestr +* Return Type: char * +* Description: returns the starting address of s2 in s1, ignoring case +* In: +* s1: string to examine +* s2: string to find +* Returns: +* a ptr to the position in s1 where s2 is found, or NULL if s2 is not found. +*****/ +char * +my_strcasestr(const char *s1, const char *s2) +{ + register int i; + register const char *p1, *p2, *s = s1; + + for (p2 = s2, i = 0; *s; p2 = s2, i++, s++) + { + for (p1 = s; *p1 && *p2 && _FastLower(*p1) == _FastLower(*p2); + p1++, p2++) + ; + if(!*p2) + break; + } + if (!*p2) + return((char*)s1 + i); + return 0; +} + +#ifdef DEBUG +/***** +* Name: __rsd_strdup +* Return Type: char* +* Description: debugging version of strdup +* In: +* s1: string to be duplicated +* Returns: +* duplicated string. +*****/ +char* +__rsd_strdup(const char *s1, char *file, int line) +{ + static char *ret_val; + + /* dump if failed */ + my_assert(s1 != NULL); + + ret_val = malloc(strlen(s1)+1); + strcpy(ret_val, s1); + return(ret_val); +} +#endif + +/***** +* Name: my_strndup +* Return Type: char* +* Description: duplicates up to len chars of string s1 +* In: +* s1: source string; +* len: max no of chars to copy; +* Returns: +* a ptr to the duplicated string, padded with NULL if len is larger then +* s1. Return value is always NULL terminated. +*****/ +char * +my_strndup(const char *s1, size_t len) +{ + register int i; + register char *p2; + register const char *p1 = s1; + static char *s2; + + /* no negative lengths */ + if(len < 0 || s1 == NULL || *s1 == '\0') + return(NULL); + + /* size of text + a terminating \0 */ + s2 = (char*)malloc(len+1); + + for(p2 = s2, i = 0; *p1 && i < len; *(p2++) = *(p1++), i++); + + /* NULL padding */ + while(i++ < len) + *(p2++) = '\0'; + + *p2 = '\0'; /* NULL terminate */ + + return(s2); +} + +/***** +* UnixWare doesn't have these functions in its standard C library +* contributed by Thanh Ma (tma@encore.com), fix 02/03/97-03, tma +*****/ + +#ifdef NEED_STRCASECMP +/***** +* Name: strncasecmp +* Return Type: int +* Description: case insensitive string compare upto n characters of string +* s1. +* In: +* s1: source string +* s2: string to compare with +* n: no of characters to compare. +* Returns: +* 0 when they match, character difference otherwise. +*****/ +int +my_strncasecmp (const char *s1, const char *s2, size_t n) +{ + register int c1, c2, l=0; + + while (*s1 && *s2 && l < n) + { + c1 = _FastLower(*s1); + c2 = _FastLower(*s2); + if (c1 != c2) + return(c1 - c2); + s1++; + s2++; + l++; + } + return((int)(0)); +} + +/***** +* Name: strcasecmp +* Return Type: int +* Description: case insensitive string compare +* In: +* s1: source string +* s2: string to compare with +* Returns: +* 0 when they match, character difference otherwise. +*****/ +int +my_strcasecmp (const char *s1, const char *s2) +{ + register int c1, c2; + + while (*s1 && *s2) + { + c1 = _FastLower(*s1); + c2 = _FastLower(*s2); + if (c1 != c2) + return(c1 - c2); + s1++; + s2++; + } + return((int)(*s1 - *s2)); +} +#endif /* NEED_STRCASECMP */ + +/***** +* string to number routines +*****/ + +/***** +* Name: to_ascii +* Return Type: String +* Description: converts a numerical value to an abc representation. +* In: +* val: number to convert +* Returns: +* converted number. +*****/ +static String +to_ascii(int val) +{ + int remainder, i = 0, j = 0, value = val; + char number[10]; + static char out[10]; /* return buffer */ + + do + { + remainder = (value % 26); + number[i++] = (remainder ? remainder + 96 : 'z'); + } + while((value = (remainder ? (int)(value/26) : (int)((value-1)/26))) + && i < 10); /* no buffer overruns */ + + for(j = 0; i > 0 && j < 10; i--, j++) + out[j] = number[i-1]; + + out[j] = '\0'; /* NULL terminate */ + + return(out); +} + +/***** +* Name: to_roman +* Return Type: String +* Description: converts the given number to a lowercase roman numeral. +* In: +* val: number to convert +* Returns: +* converted number +* Note: +* This routine is based on a similar one found in the Arena browser. +*****/ +static String +to_roman(int val) +{ + int value, one, ten, hundred, thousand; + static char buf[20], *p, *q; + + value = val; + /* + * XmHTML probably crashes **long** before a number with value 10^20 is + * reached. + */ + sprintf(buf, "%i", val); + + thousand = value/1000; + value = value % 1000; + hundred = value/100; + value = value % 100; + ten = value/10; + one = value % 10; + + p = buf; + while(thousand-- > 0) + *p++ = 'm'; + + if(hundred) + { + q = Hundreds[hundred-1]; + while ((*p++ = *q++)); + --p; + } + if(ten) + { + q = Tens[ten-1]; + while ((*p++ = *q++)); + --p; + } + if(one) + { + q = Ones[one-1]; + while ((*p++ = *q++)); + --p; + } + *p = '\0'; + + return(buf); +} + +/***** +* Name: ToAsciiLower +* Return Type: String +* Description: returns the abc representation of the given number +* In: +* val: number to convert +* Returns: +* converted number +*****/ +String +ToAsciiLower(int val) +{ + return((to_ascii(val))); +} + +/***** +* Name: ToAsciiUpper +* Return Type: String +* Description: returns the ABC representation of the given number +* In: +* val: number to convert +* Returns: +* converted number +*****/ +String +ToAsciiUpper(int val) +{ + static String buf; + buf = to_ascii(val); + my_upcase(buf); + return(buf); +} + +/***** +* Name: ToRomanLower +* Return Type: String +* Description: converts numbers between 1-3999 to roman numerals, lowercase. +* In: +* value: value to convert +* Returns: +* lowercase roman numeral +*****/ +String +ToRomanLower(int val) +{ + return(to_roman(val)); +} + +/***** +* Name: ToRomanUpper +* Return Type: String +* Description: converts numbers between 1-3999 to roman numerals, uppercase. +* In: +* value: value to convert +* Returns: +* uppercase roman numeral +*****/ +String +ToRomanUpper(int val) +{ + static String buf; + buf = to_roman(val); + my_upcase(buf); + return(buf); +} + +/***** +* HTML Tag analyzers +*****/ + +/***** +* Name: tokenToEscape +* Return Type: char +* Description: converts the HTML & escapes sequences to the appropriate char. +* In: +* **escape: escape sequence to convert. This argument is updated upon +* return. +* warn: warning issue flag; +* Returns: +* the character representation of the given escape sequence +* +* Note: this routine uses a sorted table defined in the header file escapes.h +* and uses a binary search to locate the appropriate character for the given +* escape sequence. +* This table contains the hashed escapes as well as the named escapes. +* The number of elements is NUM_ESCAPES (currently 197), so a match is always +* found in less than 8 iterations (2^8=256). +* If an escape sequence is not matched and it is a hash escape, the value +* is assumed to be below 160 and converted to a char using the ASCII +* representation of the given number. For other, non-matched characters, 0 +* is returned and the return pointer is updated to point right after the +* ampersand sign. +*****/ +static char +tokenToEscape(char **escape, Boolean warn) +{ + register int mid, lo = 0, hi = NUM_ESCAPES -1; + int cmp, skip = 1; + char tmp[8]; + + /* + * first check if this is indeed an escape sequence. + * It's much more cost-effective to do this test here instead of in + * the calling routine. + */ + if(*(*escape+1) != '#' && !(isalpha(*(*escape+1)))) + { + if(warn) + { + /* bad escape, spit out a warning and continue */ + strncpy(tmp, *escape, 7); + tmp[7] = '\0'; + _XmHTMLWarning(__WFUNC__(NULL, "tokenToEscape"), + "Invalid escape sequence: %s...", tmp); + } + /* skip and return */ + *escape += 1; + return('&'); + } + /* + * run this loop twice: one time with a ; assumed present and one + * time with ; present. + */ + for(skip = 0; skip != 2; skip++) + { + lo = 0; + hi = NUM_ESCAPES - 1; + while(lo <= hi) + { + mid = (lo + hi)/2; + if((cmp = strncmp(*escape+1, escapes[mid].escape, + escapes[mid].len - skip)) == 0) + { + /* update ptr to point right after the escape sequence */ + *escape += escapes[mid].len + (1 - skip); + return(escapes[mid].token); + } + else + if(cmp < 0) /* in lower end of array */ + hi = mid - 1; + else /* in higher end of array */ + lo = mid + 1; + } + } + + /* + * If we get here, the escape sequence wasn't matched: big chance + * it uses a &# escape below 160. To deal with this, we pick up the numeric + * code and convert to a plain ASCII value which is returned to the + * caller + */ + if( *(*escape+1) == '#') + { + char *chPtr, ret_char; + int len = 0; + + *escape += 2; /* skip past the &# sequence */ + chPtr = *escape; + while(isdigit(*chPtr)) + { + chPtr++; + len++; + } + if(*chPtr == ';') + { + *chPtr = '\0'; /* null out the ; */ + len++; + } + ret_char = (char)atoi(*escape); /* get corresponding char */ + /* move past the escape sequence */ + if(*(*escape + len) == ';') + *escape += len + 1; + else + *escape += len; + return(ret_char); + } + + /* bad escape, spit out a warning and continue */ + if(warn) + { + strncpy(tmp, *escape, 7); + tmp[7] = '\0'; + _XmHTMLWarning(__WFUNC__(NULL, "tokenToEscape"), + "Invalid escape sequence %s...", tmp); + } + *escape += 1; + return('&'); +} + +/***** +* Name: _XmHTMLExpandEscapes +* Return Type: void +* Description: replaces character escapes sequences with the appropriate char. +* In: +* string: text to scan for escape sequences +* Returns: +* nothing +*****/ +void +_XmHTMLExpandEscapes(char *string, Boolean warn) +{ + register char *chPtr = string; + char escape; /* value of escape character */ + + /* scan the entire text in search of escape codes (yuck) */ + while(*string) /* fix 02/26/97-02, dp */ + { + switch(*string) + { + case '&': + if((escape = tokenToEscape(&string, warn)) != 0) + *chPtr++ = escape; + break; + default: + *(chPtr++) = *(string++); + } + if(*string == 0) + { + *chPtr = '\0'; /* NULL terminate */ + return; + } + } +} + +/***** +* Name: _XmHTMLTagCheck +* Return Type: Boolean +* Description: checks whether the given tag exists in the attributes of a +* HTML element +* In: +* attributes: attributes from an HTML element +* tag: tag to look for. +* Returns: +* True if tag is found, False otherwise. +*****/ +Boolean +_XmHTMLTagCheck(char *attributes, char *tag) +{ + char *chPtr, *start; + + /* sanity check */ + if(attributes == NULL) + return(False); + + if((chPtr = my_strcasestr(attributes, tag)) != NULL) + { + /* see if this is a valid tag: it must be preceeded with whitespace. */ + while(*(chPtr-1) && !isspace(*(chPtr-1))) + { + start = chPtr+strlen(tag); /* start right after this element */ + if((chPtr = my_strcasestr(start, tag)) == NULL) + return(False); + } + if(chPtr) + return(True); + else + return(False); + } + return(False); +} + +/***** +* Name: _XmHTMLTagGetValue +* Return Type: char * +* Description: looks for the specified tag in the given list of attributes. +* In: +* attributes: attributes from an HTML element +* tag: tag to look for. +* Returns: +* if tag exists, the value of this tag, NULL otherwise. +* return value is always malloc'd; caller must free it. +*****/ +String +_XmHTMLTagGetValue(char *attributes, char *tag) +{ + static char *buf; + char *chPtr, *start, *end; + + if(attributes == NULL || tag == NULL) /* sanity check */ + return(NULL); + + _XmHTMLDebug(4, ("parse.c: _XmHTMLTagGetValue, attributes: %s, tag %s\n", + attributes, tag)); + + if((chPtr = my_strcasestr(attributes, tag)) != NULL) + { + /* + * check if the ptr obtained is correct, eg, no whitespace before it. + * If this is not the case, get the next match. + * Need to do this since a single my_strcasestr on, for example, align + * will match both align _and_ valign. + */ + while(*(chPtr-1) && !isspace(*(chPtr-1))) + { + start = chPtr+strlen(tag); /* start right after this element */ + if((chPtr = my_strcasestr(start, tag)) == NULL) + return(NULL); + } + if(chPtr == NULL) + return(NULL); + + start = chPtr+strlen(tag); /* start right after this element */ + /* remove leading spaces */ + while(isspace(*start)) + start++; + + /* if no '=', return NULL */ + if(*start != '=') + { + _XmHTMLDebug(4, ("parse.c: _XmHTMLTagGetValue, tag has no " + "= sign.\n")); + return(NULL); + } + + start++; /* move past the '=' char */ + + /* remove more spaces */ + while(*start != '\0' && isspace(*start)) + start++; + + /* sanity check */ + if(*start == '\0') + { +#ifdef PEDANTIC + _XmHTMLWarning(__WFUNC__(NULL, "_XmHTMLTagGetValue"), + "tag %s has no value.", tag); +#endif /* PEDANTIC */ + return(NULL); + } + + /* unquoted tag values are treated differently */ + if(*start != '\"') + { + for(end = start; !(isspace(*end)) && *end != '\0' ; end++); + } + else + { + start++; + for(end = start; *end != '\"' && *end != '\0' ; end++); + } + /* empty string */ + if(end == start) + return(NULL); + + buf = my_strndup(start, end - start); + + _XmHTMLDebug(4, ("parse.c: _XmHTMLTagGetValue, returning %s\n", buf)); + + return(buf); + } + return(NULL); +} + +/***** +* Name: _XmHTMLTagGetNumber +* Return Type: int +* Description: retrieves the numerical value of the given tag. +* In: +* attributes: attributes from an HTML element +* tag: tag to look for. +* def: default value if tag is not found. +* Returns: +* if tag exists, the value of this tag, def otherwise +*****/ +int +_XmHTMLTagGetNumber(char *attributes, char *tag, int def) +{ + char *chPtr; + int ret_val = def; + + if((chPtr = _XmHTMLTagGetValue(attributes, tag)) != NULL) + { + ret_val = atoi(chPtr); + _XmHTMLDebug(4, ("parse.c: _XmHTMLTagGetNumber, value for tag %s " + "is %i\n", + tag, ret_val)); + free(chPtr); + } + return(ret_val); +} + +/***** +* Name: _XmHTMLTagCheckNumber +* Return Type: int +* Description: retrieves the numerical value of the given tag. +* If the returned no is negative, the specified value was +* a relative number. Otherwise it's an absolute number. +* In: +* attributes: attributes from an HTML element +* tag: tag to look for. +* def: default value if tag is not found. +* Returns: +* if tag exists, the value of this tag, def otherwise +*****/ +int +_XmHTMLTagCheckNumber(char *attributes, char *tag, int def) +{ + int ret_val = def; + char *chPtr; + + /* get the requested tag */ + if((chPtr = _XmHTMLTagGetValue(attributes, tag)) != NULL) + { + /* when len is negative, a percentage has been used */ + if((strpbrk(chPtr, "%")) != NULL) + ret_val = -1*atoi(chPtr); + else + ret_val = atoi(chPtr); + free(chPtr); + } + return(ret_val); +} + +/***** +* Name: _XmHTMLTagCheckValue +* Return Type: Boolean +* Description: checks whether the specified tag in the given list of attributes +* has a certain value. +* In: +* attributes: attributes from an HTML element +* tag: tag to look for. +* check: value to check. +* Returns: +* returns True if tag exists and has the correct value, False otherwise. +*****/ +Boolean +_XmHTMLTagCheckValue(char *attributes, char *tag, char *check) +{ + char *buf; + + _XmHTMLDebug(4, ("parse.c: _XmHTMLTagCheckValue: tag %s, check %s\n", + tag, check)); + + /* no sanity check, TagGetValue returns NULL if attributes is empty */ + + if((buf = _XmHTMLTagGetValue(attributes, tag)) == NULL || + strcasecmp(buf, check)) + { + if(buf != NULL) + free(buf); + return(False); + } + free(buf); /* fix 12-21-96-01, kdh */ + return(True); +} + +/***** +* Name: _XmHTMLGetImageAlignment +* Return Type: Alignment +* Description: returns any specified image alignment +* In: +* attributes: attributes +* Returns: +* specified image alignment. If none found, XmVALIGN_BOTTOM +*****/ +Alignment +_XmHTMLGetImageAlignment(char *attributes) +{ + char *buf; + Alignment ret_val = XmVALIGN_BOTTOM; + + /* First check if this tag does exist */ + if((buf = _XmHTMLTagGetValue(attributes, "align")) == NULL) + return(ret_val); + + /* transform to lowercase */ + my_locase(buf); + + if(!(strcmp(buf, "left"))) + ret_val = XmHALIGN_LEFT; + else if(!(strcmp(buf, "right"))) + ret_val = XmHALIGN_RIGHT; + else if(!(strcmp(buf, "top"))) + ret_val = XmVALIGN_TOP; + else if(!(strcmp(buf, "middle"))) + ret_val = XmVALIGN_MIDDLE; + else if(!(strcmp(buf, "bottom"))) + ret_val = XmVALIGN_BOTTOM; + else if(!(strcmp(buf, "baseline"))) + ret_val = XmVALIGN_BASELINE; + + free(buf); /* fix 01/12/97-01; kdh */ + return(ret_val); +} + +/***** +* Name: _XmHTMLGetHorizontalAlignment +* Return Type: Alignment +* Description: Retrieve the value of the ALIGN attribute +* In: +* attributes: attributes to check for the ALIGN tag +* def_align: default alignment. +* Returns: +* selected ALIGN enumeration type or def_align if no match is found. +*****/ +Alignment +_XmHTMLGetHorizontalAlignment(char *attributes, Alignment def_align) +{ + char *buf; + Alignment ret_val = def_align; + + /* First check if this tag does exist */ + if((buf = _XmHTMLTagGetValue(attributes, "align")) == NULL) + return(ret_val); + + /* transform to lowercase */ + my_locase(buf); + + if(!(strcmp(buf, "center"))) + ret_val = XmHALIGN_CENTER; + else if(!(strcmp(buf, "right"))) + ret_val = XmHALIGN_RIGHT; + else if(!(strcmp(buf, "justify"))) + ret_val = XmHALIGN_JUSTIFY; + else if(!(strcmp(buf, "left"))) + ret_val = XmHALIGN_LEFT; + + free(buf); /* fix 01/12/97-01; kdh */ + return(ret_val); +} + +/***** +* Name: _XmHTMLGetVerticalAlignment +* Return Type: Alignment +* Description: Retrieve the value of the VALIGN attribute +* In: +* attributes: attributes to check for the VALIGN tag +* Returns: +* selected VALIGN enumeration type or XmVALIGN_TOP when no valign tag +* is found among the element's attributes. +*****/ +Alignment +_XmHTMLGetVerticalAlignment(char *attributes, Alignment def_align) +{ + char *buf; + Alignment ret_val = def_align; + + /* First check if this tag does exist */ + if((buf = _XmHTMLTagGetValue(attributes, "valign")) == NULL) + return(ret_val); + + if(!(strcmp(buf, "top"))) + ret_val = XmVALIGN_TOP; + else if(!(strcmp(buf, "middle"))) + ret_val = XmVALIGN_MIDDLE; + else if(!(strcmp(buf, "bottom"))) + ret_val = XmVALIGN_BOTTOM; + else if(!(strcmp(buf, "baseline"))) + ret_val = XmVALIGN_BASELINE; + + free(buf); /* fix 01/12/97-02; kdh */ + return(ret_val); +} + +TableFraming +_XmHTMLGetFraming(String attributes, TableFraming def) +{ + char *buf; + TableFraming ret_val = def; + + /* First check if this tag does exist */ + if((buf = _XmHTMLTagGetValue(attributes, "frame")) == NULL) + return(ret_val); + + if(!(strcmp(buf, "void"))) + ret_val = TFRAME_VOID; + else if(!(strcmp(buf, "above"))) + ret_val = TFRAME_ABOVE; + else if(!(strcmp(buf, "below"))) + ret_val = TFRAME_BELOW; + else if(!(strcmp(buf, "hsides"))) + ret_val = TFRAME_HSIDES; + else if(!(strcmp(buf, "lhs"))) + ret_val = TFRAME_LEFT; + else if(!(strcmp(buf, "rhs"))) + ret_val = TFRAME_RIGHT; + else if(!(strcmp(buf, "vsides"))) + ret_val = TFRAME_VSIDES; + else if(!(strcmp(buf, "box"))) + ret_val = TFRAME_BOX; + else if(!(strcmp(buf, "border"))) + ret_val = TFRAME_BORDER; + + free(buf); + return(ret_val); +} + +TableRuling +_XmHTMLGetRuling(String attributes, TableRuling def) +{ + char *buf; + TableRuling ret_val = def; + + /* First check if this tag does exist */ + if((buf = _XmHTMLTagGetValue(attributes, "rules")) == NULL) + return(ret_val); + + if(!(strcmp(buf, "none"))) + ret_val = TRULE_NONE; + else if(!(strcmp(buf, "groups"))) + ret_val = TRULE_GROUPS; + else if(!(strcmp(buf, "rows"))) + ret_val = TRULE_ROWS; + else if(!(strcmp(buf, "cols"))) + ret_val = TRULE_COLS; + else if(!(strcmp(buf, "all"))) + ret_val = TRULE_ALL; + + free(buf); + return(ret_val); +} + +/***** +* Name: _XmHTMLGetMaxLineLength +* Return Type: Dimension +* Description: returns an estimated guess on how wide the formatted document +* will be based on the longest line in the document source. +* In: +* html: XmHTMLWidget id +* Returns: +* guess what? +*****/ +Dimension +_XmHTMLGetMaxLineLength(XmHTMLWidget html) +{ + Dimension max = 0, ret_val = 0; + int i; + String chPtr; + XmHTMLObject *tmp; + + for(tmp = html->html.elements; tmp != NULL; tmp = tmp->next) + { + if(tmp->id == HT_ZTEXT) + { + chPtr = tmp->element; + i = 0; + + /***** + * Count all chars. Tabs are expanded and newlines reset the + * linewidth. + *****/ + for(chPtr = tmp->element; *chPtr != '\0'; chPtr++) + { + switch(*chPtr) + { + case '\t': + i = ((i/8)+1)*8; + break; + case '\n': + if(ret_val < i) + ret_val = i; + i = -1; + default: + i++; + } + } + /* long lines without a newline */ + if(ret_val < i) + ret_val = i; + } + } + + /* assume 80 chars if no text found */ + if(ret_val == 0) ret_val = 80; + + /* assume an average width of 7 pixels per character */ + ret_val *= 7; + + /* we allow widths up to 75% of the screen width */ + max = (Dimension)(0.75*Toolkit_Screen_Width (html)); + + ret_val = (ret_val > max ? max : ret_val); + + _XmHTMLDebug(4, ("parse.c: _XmHTMLGetMaxLineLength, returning %d\n", + ret_val)); + + return(ret_val); +} + +/***** +* Debugging memory functions. +* These *must* be kept at the end of this file as it overrides any +* previously defined memory allocation macros. +*****/ + +#ifdef DEBUG + +/* need to undefine them or w'll get in an endless loop */ +#undef malloc +#undef calloc +#undef realloc +#undef free + +char* +__rsd_malloc(size_t size, char *file, int line) +{ + static char *ret_val; + + my_assert(size != 0); + + ret_val = (char*) malloc (size); + + /* dump if failed */ + my_assert(ret_val != NULL); + + return(ret_val); +} + +char* +__rsd_calloc(size_t nmemb, size_t size, char *file, int line) +{ + static char *ret_val; + + my_assert(nmemb != 0); + + ret_val = (char*) calloc (nmemb, size); + + /* dump if failed */ + my_assert(ret_val != NULL); + + return(ret_val); +} + +char* +__rsd_realloc(void *ptr, size_t size, char *file, int line) +{ + static char *ret_val; + + if(size == 0) + { + my_assert(ptr != NULL); + free (ptr); + return(NULL); + } + ret_val = (char*) realloc (ptr, size); + + /* dump if failed */ + my_assert(ret_val != NULL); + + return(ret_val); +} + +void +__rsd_free(void *ptr, char *file, int line) +{ + my_assert(ptr != NULL); + free (ptr); +} + +#endif /* DEBUG && !DMALLOC */ + diff -uNr gnome-0.10/gtk-xmhtml/TODO gnome-0.11/gtk-xmhtml/TODO --- gnome-0.10/gtk-xmhtml/TODO Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/TODO Tue Dec 30 23:19:17 1997 @@ -0,0 +1,21 @@ + +- Test all of the change-property routines in Gtk/XmHTML. + +- Get forms working (widgets). + +- Figure out if the problem with documents without is my fault. + + Ok, it seems it not a bug in the port, but Ripley's code + does not crash, he is testing somewhere that the was + missing (ie, the parser still has a bug, it is not inserting + the BODY element). + +- It is loading files relative to $PWD instead of the directory the + page is. + +- need_trakcing not properly set in a couple of places (not harmful) + +- Handle borders on frames + +- Resizing is not working properly: for example, frames do not get resized + when the main window is resized. diff -uNr gnome-0.10/gtk-xmhtml/XmHTML-motif.c gnome-0.11/gtk-xmhtml/XmHTML-motif.c --- gnome-0.10/gtk-xmhtml/XmHTML-motif.c Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/XmHTML-motif.c Mon Dec 29 22:03:27 1997 @@ -0,0 +1,3191 @@ +/* Static resources */ +#include "resources.h" + +/* manage scrollbars if necessary */ +#define SetScrollBars(HTML) { \ + if((HTML)->html.needs_hsb && !XtIsManaged((HTML)->html.hsb)) \ + XtManageChild(html->html.hsb); \ + if((HTML)->html.needs_vsb && !XtIsManaged((HTML)->html.vsb)) \ + XtManageChild((html)->html.vsb); \ +} + +/* check slider value and adjust if necessary */ +#define AdjustVerticalScrollValue(VSB, VAL) { \ + int max = 0, size = 0; \ + XtVaGetValues(VSB, \ + XmNmaximum, &max, \ + XmNsliderSize, &size, \ + NULL); \ + if(VAL > (max - size)) \ + VAL = (max - size); \ +} + +/*** +* Class methods +***/ +/* Primary ClassInitialize method */ +static void ClassInitialize(void); + +/* ClassPartInitialize method */ +static void ClassPartInitialize(WidgetClass wc); + +/* class initialize method */ +static void Initialize(Widget request, Widget init, ArgList args, + Cardinal *num_args); + +/* class resize method */ +static void Resize(Widget w); + +/* class expose method */ +static void Redisplay(Widget w, XEvent *event, Region region); + +/* Expose event handler for the work area */ +static void DrawRedisplay(Widget w, XmHTMLWidget html, XEvent *event); + +/* VisibilityNotify event handler for the work area */ +static void VisibilityHandler(Widget w, XmHTMLWidget html, XEvent *event); + +/* MapNotify action routine for the work area */ +static void Mapped(Widget w, XmHTMLWidget html, XEvent *event); + +/* class set_values method */ +static Boolean SetValues(Widget current, Widget request, Widget set, + ArgList args, Cardinal *num_args); + +/* class get_values_hook method */ +static void GetValues(Widget w, ArgList args, Cardinal *num_args); + +/* class geometry_manager method */ +static XtGeometryResult GeometryManager(Widget w, XtWidgetGeometry *request, + XtWidgetGeometry *geometry_return); + +/* class destroy method */ +static void Destroy(Widget w); + +/* Action routines */ +static void ExtendStart(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void ExtendAdjust(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void ExtendEnd(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void TrackMotion(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void HTMLProcessInput(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void HTMLPageUpOrLeft(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void HTMLPageDownOrRight(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void HTMLIncrementUpOrLeft(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void HTMLIncrementDownOrRight(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void HTMLTopOrBottom(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void HTMLTraverseCurrent(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void HTMLTraverseNext(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void HTMLTraversePrev(Widget w, XEvent *event, String *params, + Cardinal *num_params); +static void HTMLTraverseNextOrPrev(Widget w, XEvent *event, String *params, + Cardinal *num_params); + +/*** Private Variable Declarations ***/ +static XmRepTypeId underline_repid, sb_policy_repid; +static XmRepTypeId sb_placement_repid, string_repid; +static XmRepTypeId enable_repid, conv_repid; + +/***** +* default translations +* Order of key translations is important: placing c osfPageUp after +* osfPageUp will mask of the Ctrl key. +* XmHTML explicitly masks off all key modifiers it does not need for a +* certain action. This allows application programmers to use the same keys +* with modifiers for their own purposes and prevents that these key sequences +* are handled by these specific XmHTML action routines. +* This looks ugly, since it's a static block of text it doesn't take up that +* much data space. +*****/ +static char translations[] = +"Ctrl osfPageUp: page-up-or-left(1)\n\ +Ctrl osfPageDown: page-down-or-right(1)\n\ +Ctrl osfBeginLine: top-or-bottom(0)\n\ +Ctrl osfEndLine: top-or-bottom(1)\n\ +~Shift ~Meta ~Alt : extend-start() ManagerGadgetArm()\n\ +~Shift ~Meta ~Alt : extend-adjust() ManagerGadgetButtonMotion()\n\ +~Shift ~Meta ~Alt : extend-end(PRIMARY, CUT_BUFFER0) ManagerGadgetActivate() traverse-current()\n\ +~Shift ~Meta ~Alt :extend-start()\n\ +~Shift ~Meta ~Alt : extend-adjust()\n\ +~Shift ~Meta ~Alt : extend-end(PRIMARY, CUT_BUFFER0)\n\ +~Shift ~Meta ~Alt osfPageUp: page-up-or-left(0)\n\ +~Shift ~Meta ~Alt osfPageDown: page-down-or-right(0)\n\ +~Shift ~Meta ~Alt osfUp: increment-up-or-left(0)\n\ +~Shift ~Meta ~Alt osfLeft: increment-up-or-left(1)\n\ +~Shift ~Meta ~Alt osfDown: increment-down-or-right(0)\n\ +~Shift ~Meta ~Alt osfRight: increment-down-or-right(1)\n\ +osfHelp: ManagerGadgetHelp()\n\ +Shift Ctrl Tab: ManagerGadgetPrevTabGroup()\n\ +Ctrl Tab: ManagerGadgetNextTabGroup()\n\ +Tab: traverse-next()\n\ +: track-motion()\n\ +: track-motion()\n\ +: track-motion()\n\ +: track-motion()\n\ +: track-motion()\n\ +: process-html-input()\n\ +: process-html-input()"; + +/* Action routines provided by XmHTML */ +static XtActionsRec actions[] = +{ + {"extend-start", (XtActionProc)ExtendStart}, + {"extend-adjust", (XtActionProc)ExtendAdjust}, + {"extend-end", (XtActionProc)ExtendEnd}, + {"page-up-or-left", (XtActionProc)HTMLPageUpOrLeft}, + {"page-down-or-right", (XtActionProc)HTMLPageDownOrRight}, + {"increment-up-or-left", (XtActionProc)HTMLIncrementUpOrLeft}, + {"increment-down-or-right", (XtActionProc)HTMLIncrementDownOrRight}, + {"top-or-bottom", (XtActionProc)HTMLTopOrBottom}, + {"track-motion", (XtActionProc)TrackMotion}, + {"process-html-input", (XtActionProc)HTMLProcessInput}, + {"traverse-current", (XtActionProc)HTMLTraverseCurrent}, + {"traverse-next", (XtActionProc)HTMLTraverseNext}, + {"traverse-prev", (XtActionProc)HTMLTraversePrev}, + {"traverse-next-or-prev", (XtActionProc)HTMLTraverseNextOrPrev} +}; + +/* +* copy of original list. Motif destroys the original list and therefore +* XmHTML crashes when we try to use the above list again. +*/ +static XtActionsRec spareActions[] = +{ + {"extend-start", (XtActionProc)ExtendStart}, + {"extend-adjust", (XtActionProc)ExtendAdjust}, + {"extend-end", (XtActionProc)ExtendEnd}, + {"page-up-or-left", (XtActionProc)HTMLPageUpOrLeft}, + {"page-down-or-right", (XtActionProc)HTMLPageDownOrRight}, + {"increment-up-or-left", (XtActionProc)HTMLIncrementUpOrLeft}, + {"increment-down-or-right", (XtActionProc)HTMLIncrementDownOrRight}, + {"top-or-bottom", (XtActionProc)HTMLTopOrBottom}, + {"track-motion", (XtActionProc)TrackMotion}, + {"process-html-input", (XtActionProc)HTMLProcessInput}, + {"traverse-current", (XtActionProc)HTMLTraverseCurrent}, + {"traverse-next", (XtActionProc)HTMLTraverseNext}, + {"traverse-prev", (XtActionProc)HTMLTraversePrev}, + {"traverse-next-or-prev", (XtActionProc)HTMLTraverseNextOrPrev} +}; + +/**** +* Define the CompositeClassExtension record so we can accept objects. +****/ +static CompositeClassExtensionRec htmlCompositeExtension = { + NULL, /* next_extension */ + NULLQUARK, /* record_type */ + XtCompositeExtensionVersion, /* version */ + sizeof(CompositeClassExtensionRec), /* record_size */ + True /* accept_objects */ +#if XtSpecificationRelease >= 6 + , False /* allows_change_managed_set */ +#endif +}; + +/**** +* Define the widget class record. +****/ +XmHTMLClassRec xmHTMLClassRec = { + /* core class fields */ +{ + (WidgetClass) &xmManagerClassRec, /* superclass */ + "XmHTML", /* class_name */ + sizeof(XmHTMLRec), /* widget_size */ + ClassInitialize, /* class_initialize */ + ClassPartInitialize, /* class_part_init */ + FALSE, /* class_inited */ + (XtInitProc)Initialize, /* initialize */ + NULL, /* initialize_hook */ + XtInheritRealize, /* realize */ + actions, /* actions */ + XtNumber(actions), /* num_actions */ + resources, /* resources */ + XtNumber(resources), /* num_resources */ + NULLQUARK, /* xrm_class */ + TRUE, /* compress_motion */ + XtExposeCompressMaximal, /* compress_exposure */ + TRUE, /* compress_enterleave */ + FALSE, /* visible_interest */ + Destroy, /* destroy */ + (XtWidgetProc)Resize, /* resize */ + (XtExposeProc)Redisplay, /* expose */ + (XtSetValuesFunc)SetValues, /* set_values */ + NULL, /* set_values_hook */ + XtInheritSetValuesAlmost, /* set_values_almost */ + GetValues, /* get_values_hook */ + XtInheritAcceptFocus, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_private */ + translations, /* tm_table */ + XtInheritQueryGeometry, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator */ + NULL /* extension */ +}, + /* composite_class fields */ +{ + GeometryManager, /* geometry_manager */ + NULL, /* change_managed */ + XtInheritInsertChild, /* insert_child */ + XtInheritDeleteChild, /* delete_child */ + NULL, /* set by ClassPartInit */ +}, + /* constraint_class fields */ +{ + NULL, /* resource list */ + 0, /* num resources */ + 0, /* constraint size */ + NULL, /* init proc */ + NULL, /* destroy proc */ + NULL, /* set values proc */ + NULL /* extension */ +}, + /* manager_class fields */ +{ + XtInheritTranslations, /* translations */ + NULL, /* syn_resources */ + 0, /* num_syn_resources */ + NULL, /* syn_cont_resources */ + 0, /* num_syn_cont_resources*/ + XmInheritParentProcess, /* parent_process */ + NULL /* extension */ +}, + /* html_class fields */ +{ + 0 /* none */ +} +}; + + +/* Establish the widget class name as an externally accessible symbol. */ +WidgetClass xmHTMLWidgetClass = (WidgetClass) &xmHTMLClassRec; + +static void +TestRepId(XmRepTypeId id, String name) +{ + if(id == XmREP_TYPE_INVALID) + _XmHTMLWarning(__WFUNC__(NULL, "TestRepId"), "Representation " + "type resource convertor %s not found/installed.\n" + " Please contact ripley@xs4all.nl.", name); +} + +/***** +* Name: ClassInitialize +* Return Type: void +* Description: Called by Intrinsics the first time a widget of this class +* is instantiated +* In: +* nothing +* Returns: +* nothing +*****/ +static void +ClassInitialize(void) +{ + static char *enable_models[] = {"automatic", "always", "never"}; + static char *conv_models[] = {"quick", "best", "fast", "slow", "disabled"}; + static char *line_styles[] = {"no_line", "single_line", "double_line", + "single_dashed_line", "double_dashed_line"}; + + /* Get appropriate representation type convertor id's */ + + /* ScrollBar converters. */ + sb_policy_repid = XmRepTypeGetId(XmCScrollBarDisplayPolicy); + TestRepId(sb_policy_repid, XmCScrollBarDisplayPolicy); + + sb_placement_repid = XmRepTypeGetId(XmCScrollBarPlacement); + TestRepId(sb_placement_repid, XmCScrollBarPlacement); + + /* string direction converter */ + string_repid = XmRepTypeGetId(XmCAlignment); + TestRepId(string_repid, XmCAlignment); + + /* XmCEnableMode resource class converter */ + XmRepTypeRegister(XmCEnableMode, enable_models, NULL, 3); + enable_repid = XmRepTypeGetId(XmCEnableMode); + TestRepId(enable_repid, XmCEnableMode); + + /* XmCConversionMode resource class converter */ + XmRepTypeRegister(XmCConversionMode, conv_models, NULL, 5); + conv_repid = XmRepTypeGetId(XmCConversionMode); + TestRepId(conv_repid, XmCConversionMode); + + /* XmCAnchorUnderlineType resource class converter */ + XmRepTypeRegister(XmCAnchorUnderlineType, line_styles, NULL, 5); + underline_repid = XmRepTypeGetId(XmCAnchorUnderlineType); + TestRepId(underline_repid, XmCAnchorUnderlineType); + XtSetTypeConverter(XmRString, XmRHTMLWarningMode, + (XtTypeConverter)_XmHTMLCvtStringToWarning, NULL, 0, XtCacheAll, NULL); +} + +/***** +* Name: ClassPartInitialize +* Return Type: void +* Description: object class method to initialize class part structure fields. +* In: +* subclass: pointer to a widget class structure. +* Returns: +* nothing. +* Note: +* This routine initializes the Composite extension. XmHTML *must* be a +* subclass of composite if we want to have it accept any type of Object +* (including real Objects, Gadgets and Widgets). +* Kindly donated by Youssef Ouaghli +*****/ +static void +ClassPartInitialize(WidgetClass wc) +{ + XmHTMLWidgetClass html_wc = (XmHTMLWidgetClass)wc; + + htmlCompositeExtension.next_extension = html_wc->composite_class.extension; + htmlCompositeExtension.accepts_objects = True; + + html_wc->composite_class.extension = (XtPointer)&htmlCompositeExtension; +} + +/***** +* Name: Initialize +* Return Type: void +* Description: Called when the widget is instantiated +* In: +* request: widget with resource values set as requested by the argument +* list, resource database and widget defaults +* init: same widget with values as modified by superclass initialize() +* methods +* args: argument list passed to XtCreateWidget +* num_args: number of entries in the argument list +* Returns: +* nothing, but init is updated with checked/updated resource values. +*****/ +static void +Initialize(TWidget request, TWidget init, ArgList args, Cardinal *num_args) +{ + XmHTMLWidget html = XmHTML (init); + XmHTMLWidget req = XmHTML (request); + + /* select debug levels */ + _XmHTMLSelectDebugLevels (req->html.debug_levels); + _XmHTMLSetFullDebug(req->html.debug_full_output); + +#ifdef DEBUG + if(req->html.debug_disable_warnings) + debug_disable_warnings = True; + else + debug_disable_warnings = False; +#endif + + /* Initialize the global HTMLpart */ + _XmHTMLDebug(1, ("XmHTML.c: Initialize Start\n")); + + /* private TWidget resources */ + html->html.needs_vsb = False; + html->html.needs_hsb = False; + html->html.scroll_x = 0; + html->html.scroll_y = 0; + + CheckAnchorUnderlining(html, html); + + /* ScrollBarDisplayPolicy */ + if(!XmRepTypeValidValue(sb_policy_repid, html->html.sb_policy, + (TWidget)html)) + html->html.sb_policy = XmAS_NEEDED; + else if(html->html.sb_policy == XmSTATIC) + html->html.needs_vsb = True; + + /* ScrollBarPlacement */ + if(!XmRepTypeValidValue(sb_placement_repid, html->html.sb_placement, + (TWidget)html)) + html->html.sb_placement = XmBOTTOM_RIGHT; + + /* perfectColors */ + if(!XmRepTypeValidValue(enable_repid, html->html.perfect_colors, + (TWidget)html)) + html->html.perfect_colors = XmAUTOMATIC; + + /* AlphaChannelProcessing */ + if(!XmRepTypeValidValue(enable_repid, html->html.alpha_processing, + (TWidget)html)) + html->html.alpha_processing = XmALWAYS; + + /* ImageRGBConversion */ + if(!XmRepTypeValidValue(conv_repid, html->html.rgb_conv_mode, + (TWidget)html) || html->html.rgb_conv_mode == XmDISABLED) + html->html.rgb_conv_mode = XmBEST; + + /* ImageMapToPalette */ + if(!XmRepTypeValidValue(conv_repid, html->html.map_to_palette, + (TWidget)html)) + html->html.map_to_palette = XmDISABLED; + + XmHTML_Initialize (html, init, req->html.value); +} + +/***** +* Name: CreateAnchorCursor +* Return Type: void +* Description: creates the built-in anchor cursor +* In: +* html: XmHTMLWidget for which to create a cursor +* Returns: +* nothing. +*****/ +static void +CreateAnchorCursor(XmHTMLWidget html) +{ + _XmHTMLDebug(1, ("XmHTML.c: CreateAnchorCursor Start\n")); + + if(html->html.anchor_cursor == None) + { + Pixmap shape, mask; + XColor white_def, black_def; + Window window = XtWindow((TWidget)html); + Display *display = XtDisplay((TWidget)html); + Screen *screen = XtScreen((TWidget)html); + + if(!window) + window = RootWindowOfScreen(screen); + + shape = XCreatePixmapFromBitmapData(display, window, + (char *) fingers_bits, fingers_width, fingers_height, 1, 0, 1); + + mask = XCreatePixmapFromBitmapData(display, window, + (char *) fingers_m_bits, fingers_m_width, fingers_m_height, 1, 0, 1); + + (void)XParseColor(display, html->core.colormap, "white", + &white_def); + + (void)XParseColor(display, html->core.colormap, "black", + &black_def); + + html->html.anchor_cursor = XCreatePixmapCursor(display, shape, mask, + &white_def, &black_def, fingers_x_hot, fingers_y_hot); + } + _XmHTMLDebug(1, ("XmHTML.c: CreateAnchorCursor End\n")); +} + +/***** +* Name: OverrideExposure +* Return Type: void +* Description: expose event filter when HTML form TWidgets are being scrolled. +* In: +* w: unused; +* client_..: unused; +* event: XEvent info; +* continu..: flag to tell X whether or not to propagate this event; +* Returns: +* nothing. +* Note: +* this routine is only activated when XmHTML is moving TWidgets on it's own +* display area. It filters out any Exposure events that are generated by +* moving these TWidgets around. +*****/ +static void +OverrideExposure(TWidget w, XtPointer client_data, TEvent *event, + Boolean *continue_to_dispatch) +{ + if(event->xany.type == Expose || event->xany.type == GraphicsExpose) + { + _XmHTMLDebug(1, ("XmHTML.c: OverrideExposure, ignoring %s event\n", + (event->xany.type == Expose ? "Expose" : "GraphicsExpose"))); + *continue_to_dispatch = False; + } +#ifdef DEBUG + else + _XmHTMLDebug(1, ("XmHTML.c: OverrideExposure, wrong event %i\n", + (int)(event->xany.type))); +#endif +} + +/***** +* Name: FormScroll +* Return Type: void +* Description: scrolls all TWidgets of all forms in the current document. +* In: +* html: XmHTML TWidget id +* Returns: +* nothing. +*****/ +static void +FormScroll(XmHTMLWidget html) +{ + int x, y, xs, ys; + XmHTMLFormData *form; + XmHTMLForm *entry; + Boolean did_anything = False; + + _XmHTMLDebug(1, ("XmHTML.c: FormScroll, Start\n")); + + /***** + * To prevent the X exposure handling from going haywire, we simply + * override *any* exposure events generated by moving the TWidgets + * around. + *****/ + XtInsertEventHandler(html->html.work_area, ExposureMask, True, + (XtEventHandler)OverrideExposure, NULL, XtListHead); + + for(form = html->html.form_data; form != NULL; form = form->next) + { + for(entry = form->components; entry != NULL; entry = entry->next) + { + if(entry->w) + { + /* save current TWidget position */ + x = entry->x; + y = entry->y; + + /* compute new TWidget position */ + xs = entry->data->x - html->html.scroll_x; + ys = entry->data->y - html->html.scroll_y; + + /* check if we need to show this TWidget */ + if(xs + entry->width > 0 && xs < html->html.work_width && + ys + entry->height > 0 && ys < html->html.work_height) + { + _XmHTMLDebug(1, ("XmHTML.c: FormScroll, moving " + "TWidget %s to %ix%i\n", entry->name, xs, ys)); + + /* save new TWidget position */ + entry->x = xs; + entry->y = ys; + + /* and move to it */ + XtMoveWidget(entry->w, xs, ys); + + /* show it */ + if(!entry->mapped) + { + XtSetMappedWhenManaged(entry->w, True); + entry->mapped = True; + } + + /* restore background at previously obscured position */ + Refresh(html, x, y, entry->width, entry->height); + + did_anything = True; + } + else + { + /* hide by unmapping it */ + if(entry->mapped) + { + _XmHTMLDebug(1, ("XmHTML.c: FormScroll, hiding " + "TWidget %s\n", entry->name)); + + XtSetMappedWhenManaged(entry->w, False); + entry->mapped = False; + + /* restore background at previously obscured position */ + Refresh(html, x, y, entry->width, entry->height); + + did_anything = True; + } + } + } + } + } + /* only do this if we actually did something */ + if(did_anything) + { + XSync(XtDisplay((TWidget)html), False); + XmUpdateDisplay((TWidget)html); + } + + XtRemoveEventHandler(html->html.work_area, ExposureMask, True, + (XtEventHandler)OverrideExposure, NULL); + + _XmHTMLDebug(1, ("XmHTML.c: FormScroll, End\n")); +} + +/***** +* Name: ScrollCB +* Return Type: void +* Description: callback procedure for scrollbar movement +* In: +* w: originator +* arg1: client_data, in this case a XmHTMLWidget +* arg2: event specific callback structure. +* Returns: +* nothing +*****/ +static void +ScrollCB(TWidget w, XtPointer arg1, XtPointer arg2) +{ + XmScrollBarCallbackStruct *cbs = (XmScrollBarCallbackStruct *)arg2; + + _XmHTMLDebug(1, ("XmHTML.c: ScrollCB, calling _XmHTMLMoveToPos\n")); + _XmHTMLMoveToPos(w, XmHTML(arg1), cbs->value); +} + +/***** +* Name: CreateHTMLWidget +* Return Type: void +* Description: creates the HTML TWidget +* The actual area we use to draw into is a drawingAreaWidget. +* In: +* html: TWidget to be created. +* Returns: +* nothing +*****/ +static void +CreateHTMLWidget(XmHTMLWidget html) +{ + Arg args[15]; + Dimension argc = 0; + int vsb_width, hsb_height; + static XtTranslations trans = NULL; + + _XmHTMLDebug(1, ("XmHTML.c: CreateHTMLWidget Start\n")); + + /* Check if user provided a work area */ + if(html->html.work_area == NULL) + { + html->html.work_area = XtVaCreateWidget("workWindow", + xmDrawingAreaWidgetClass, (TWidget)html, + XmNwidth, html->core.width, + XmNheight, html->core.height, + NULL); + } + /* catch all exposure events on the render window */ + XtAddEventHandler((TWidget)html->html.work_area, ExposureMask, True, + (XtEventHandler)DrawRedisplay, (XtPointer)html); + + /* we want to know when to handle GraphicsExpose events */ + XtAddEventHandler((TWidget)html->html.work_area, VisibilityChangeMask, True, + (XtEventHandler)VisibilityHandler, (XtPointer)html); + + XtAddEventHandler((TWidget)html, SubstructureNotifyMask, + True, (XtEventHandler)Mapped, (XtPointer)html); + + /* + * For some reason, Motif fucks up the original action list, so we + * need to use a fallback copy instead. + * Crash happens in XrmStringToQuark(). + */ + XtAppAddActions(XtWidgetToApplicationContext(html->html.work_area), + spareActions, XtNumber(spareActions)); + + /* add translations for the actions */ + if(trans == NULL) + trans = XtParseTranslationTable(translations); + XtSetArg(args[0], XtNtranslations, trans); + XtSetValues(html->html.work_area, args, 1); + + argc = 0; + XtManageChild(html->html.work_area); + + if(html->html.vsb == NULL) + { + argc = 0; + XtSetArg(args[argc], XmNorientation, XmVERTICAL); argc++; + XtSetArg(args[argc], XmNrepeatDelay, html->html.repeat_delay); argc++; + /* make them a little bit more responsive */ + XtSetArg(args[argc], XmNinitialDelay, 100); argc++; + html->html.vsb = XtCreateWidget("verticalScrollBar", + xmScrollBarWidgetClass, (TWidget)html, args, argc); + } + XtManageChild(html->html.vsb); + /* Catch vertical scrollbar movement */ + XtAddCallback(html->html.vsb, XmNvalueChangedCallback, + (XtCallbackProc)ScrollCB, (XtPointer)html); + XtAddCallback(html->html.vsb, XmNdragCallback, + (XtCallbackProc)ScrollCB, (XtPointer)html); + + if(html->html.hsb == NULL) + { + argc = 0; + XtSetArg(args[argc], XmNorientation, XmHORIZONTAL); argc++; + XtSetArg(args[argc], XmNrepeatDelay, html->html.repeat_delay); argc++; + /* make them a little bit more responsive */ + XtSetArg(args[argc], XmNinitialDelay, 100); argc++; + html->html.hsb = XtCreateWidget("horizontalScrollBar", + xmScrollBarWidgetClass, (TWidget)html, args, argc); + } + XtManageChild(html->html.hsb); + /* Catch horizontal scrollbar movement */ + XtAddCallback(html->html.hsb, XmNvalueChangedCallback, + (XtCallbackProc)ScrollCB, (XtPointer)html); + XtAddCallback(html->html.hsb, XmNdragCallback, + (XtCallbackProc)ScrollCB, (XtPointer)html); + + /* + * subtract margin_width once to minimize number of calcs in + * the paint routines: every thing rendered starts at an x position + * of margin_width. + */ + GetScrollDim(html, &hsb_height, &vsb_width); + + html->html.work_width = html->core.width-html->html.margin_width-vsb_width; + html->html.work_height= html->core.height; + + _XmHTMLDebug(1, ("XmHTML.c: CreateHTMLWidget End\n")); + return; +} + +/***** +* Name: VisibilityHandler +* Return Type: void +* Description: VisibilityChangeMask event handler. Used to store the +* visibility state of the work_area so we know when to +* serve or ignore GraphicsExpose requests: if we're partially +* obscured we need to respond to them, in all other cases we +* can ignore them. +* In: +* w: owner of this eventhandler +* html: client data, XmHTMLWidget to which w belongs +* event: VisibilityNotify event data +* Returns: +* nothing, but sets the visibility field in the TWidget's instance structure. +*****/ +/*ARGSUSED*/ +static void +VisibilityHandler(TWidget w, XmHTMLWidget html, XEvent *event) +{ + if(event->type != VisibilityNotify) + return; + + _XmHTMLDebug(1, ("XmHTML.c: VisibilityHandler start\n")); + + html->html.visibility = event->xvisibility.state; + + _XmHTMLDebug(1, ("XmHTML.c: VisibilityHandler end\n")); +} + +/***** +* Name: Mapped +* Return Type: void +* Description: event handler for CreateNotify events. +* In: +* w: owner of this eventhandler +* html: client data, XmHTMLWidget to which w belongs +* event: CreateNotify event data +* Returns: +* nothing +* Note: +* We want to be notified when the window gets created. Motif seems to block +* the CreateNotify event, so we work with the MapNotify event. This is +* required to get the text rendered correctly when it has been +* set inside the Xt[Va]Create[Managed]TWidget and before XtRealizeWidget +* has been called: we do not have a window yet and thus no valid gc. Bad +* things happen otherwise. +*****/ +/*ARGSUSED*/ +static void +Mapped(TWidget w, XmHTMLWidget html, XEvent *event) +{ + /* wrong event, just return */ + if(event->type != MapNotify) + return; + + _XmHTMLDebug(1, ("XmHTML.c: Mapped start\n")); + + _XmHTMLDebug(1, ("XmHTML.c: Mapped, work area dimensions: %ix%i\n", + html->html.work_width, html->html.work_height)); + + CheckGC(html); + + /* save new height */ + html->html.work_height = html->core.height; + /* and width as well, fix 10/26/97-01, kdh */ + html->html.work_width = html->core.width - html->html.margin_width - + html->html.vsb->core.width; + + _XmHTMLDebug(1, ("XmHTML.c: Mapped, new work area dimensions: %ix%i\n", + html->html.work_width, html->html.work_height)); + + /* configure the scrollbars, will also resize work_area */ + CheckScrollBars(html); + + Layout(html); + + /* no longer needed now, so remove it */ + XtRemoveEventHandler(w, SubstructureNotifyMask, True, + (XtEventHandler)Mapped, (XtPointer)html); + + _XmHTMLDebug(1, ("XmHTML.c: Mapped end.\n")); +} + +/***** +* Name: CheckGC +* Return Type: void +* Description: creates a Graphics Context to be used for rendering +* In: +* html: XmHTMLWidget +* Returns: +* nothing, but a GC is created and stored in the TWidget's internal data +* structure. If background images are allowed, a seperate GC is created +* which is used in PaintBackground to do tiling of the background with an +* image. +*****/ +static void +CheckGC(XmHTMLWidget html) +{ + Display *dpy; + + _XmHTMLDebug(1, ("XmHTML.c: CheckGC Start\n")); + + /* sanity check */ + if(!XtIsRealized((TWidget)html)) + return; + + dpy = XtDisplay((TWidget)html); + + /* main gc */ + if(html->html.gc == NULL) + { + XGCValues xgc; + + xgc.function = GXcopy; + xgc.plane_mask = AllPlanes; + xgc.foreground = html->manager.foreground; + xgc.background = html->core.background_pixel; + html->html.gc = XCreateGC(dpy, XtWindow(html), + GCFunction | GCPlaneMask | GCForeground | GCBackground, &xgc); + + _XmHTMLRecomputeColors(html); + + _XmHTMLDebug(1, ("XmHTML.c: CheckGC, gc created\n")); + } + /* background image gc */ + if(html->html.body_images_enabled && html->html.bg_gc == NULL) + { + html->html.bg_gc = XCreateGC(dpy, XtWindow(html), 0, NULL); + XCopyGC(dpy, html->html.gc, 0xFFFF, html->html.bg_gc); + } + + _XmHTMLDebug(1, ("XmHTML.c: CheckGC End\n")); +} + +/***** +* Name: CheckScrollBars +* Return Type: void +* Description: (re)configures scrollbars +* In: +* html: HTML TWidget to configure +* Returns: +* nothing. +*****/ +static void +CheckScrollBars(XmHTMLWidget html) +{ + int dx, dy, hsb_height, vsb_width, st; + Boolean hsb_on_top, vsb_on_left; + /* forced display of scrollbars: XmSTATIC or frames with scrolling = yes */ + Boolean force_vsb = False, force_hsb = False; + Arg args[10]; + Dimension argc = 0; + + _XmHTMLDebug(1, ("XmHTML.c: CheckScrollBars, start\n")); + + /* don't do a thing if we aren't managed yet */ + if(!(XtIsManaged((TWidget)html))) + return; + + /* Initial work area offset */ + st = dx = dy = html->manager.shadow_thickness; + GetScrollDim(html, &hsb_height, &vsb_width); + + /* check if we need a vertical scrollbar */ + if(html->html.formatted_height < html->core.height) + { + html->html.needs_vsb = False; + /* don't forget! */ + html->html.scroll_y = 0; + XtUnmanageChild(html->html.vsb); + } + else + html->html.needs_vsb = True; + + /* add a scrollbar if we must and it isn't already here */ + if(!html->html.needs_vsb && html->html.sb_policy == XmSTATIC) + { + html->html.needs_vsb = True; + force_vsb = True; + } + + /* + * check if we need a horizontal scrollbar. If we have a vertical + * scrollbar, we must add it's width or text might be lost. + */ + if(html->html.formatted_width < html->core.width - + (html->html.needs_vsb ? vsb_width : 0)) /* fix 04/27/97-01, kdh */ + { + html->html.needs_hsb = False; + /* don't forget! */ + html->html.scroll_x = 0; + XtUnmanageChild(html->html.hsb); + } + else + html->html.needs_hsb = True; + + /* add a scrollbar if we must and it isn't already here */ + if(!html->html.needs_hsb && html->html.sb_policy == XmSTATIC) + { + html->html.needs_hsb = True; + force_hsb = True; + } + + /* if this is a frame, check what type of scrolling is requested */ + if(html->html.is_frame) + { + if(html->html.scroll_type == FRAME_SCROLL_NONE) + { + html->html.needs_hsb = False; + html->html.needs_vsb = False; + html->html.scroll_x = 0; + html->html.scroll_y = 0; + XtUnmanageChild(html->html.hsb); + XtUnmanageChild(html->html.vsb); + } + else if(html->html.scroll_type == FRAME_SCROLL_YES) + { + html->html.needs_vsb = True; + html->html.needs_hsb = True; + force_vsb = True; + force_hsb = True; + } + /* else scrolling is auto, just proceed */ + } + + /* return if we don't need any scrollbars */ + if(!html->html.needs_hsb && !html->html.needs_vsb) + { + _XmHTMLDebug(1, ("XmHTML.c: CheckScrollBars, end, no bars needed.\n")); + /* move work_area to it's correct position */ + XtMoveWidget(html->html.work_area, dx, dy); + XtResizeWidget(html->html.work_area, html->core.width, + html->core.height, html->html.work_area->core.border_width); + return; + } + + /* see if we have to put hsb on top */ + hsb_on_top = (html->html.sb_placement == XmTOP_LEFT || + html->html.sb_placement == XmTOP_RIGHT); + /* see if we have top put vsb on left */ + vsb_on_left = (html->html.sb_placement == XmTOP_LEFT || + html->html.sb_placement == XmBOTTOM_LEFT); + + /* horizontal sb on top */ + if(html->html.needs_hsb && hsb_on_top) + dy += hsb_height; + + /* vertical sb on left */ + if(html->html.needs_vsb && vsb_on_left) + dx += vsb_width; + + /* move work_area to it's correct position */ + XtMoveWidget(html->html.work_area, dx, dy); + + /* See what space we have to reserve for the scrollbars */ + if(html->html.needs_hsb && hsb_on_top == False) + dy += hsb_height; + if(html->html.needs_vsb && vsb_on_left == False) + dx += vsb_width; + + XtResizeWidget(html->html.work_area, + html->core.width - dx, html->core.height - dy, + html->html.work_area->core.border_width); + + if(html->html.needs_hsb == True) + { + int pinc; + + _XmHTMLDebug(1, ("XmHTML.c: CheckScrollBars, setting hsb\n")); + + /* Set hsb size; adjust x-position if we have a vsb */ + dx = (html->html.needs_vsb ? vsb_width : 0); + XtResizeWidget(html->html.hsb, + html->core.width - dx - 2*st, + html->html.hsb->core.height, + html->html.hsb->core.border_width); + + /* pageIncrement == sliderSize */ + pinc = html->html.work_width - 2*(html->html.default_font ? + html->html.default_font->xfont->max_bounds.width : + XmHTML_HORIZONTAL_SCROLL_INCREMENT); + /* sanity check */ + if(pinc < 1) + pinc = XmHTML_HORIZONTAL_SCROLL_INCREMENT; + + /* adjust horizontal scroll if necessary */ + if(html->html.scroll_x > html->html.formatted_width - pinc) + html->html.scroll_x = html->html.formatted_width - pinc; + /* fix 01/23/97-02, kdh */ + + /* + * Adjust if a horizontal scrollbar has been forced + * (can only happen for frames with scrolling = yes) + */ + if(force_hsb && pinc > html->html.formatted_width) + { + pinc = html->html.formatted_width; + html->html.scroll_x = 0; + } + + argc = 0; + XtSetArg(args[argc], XmNminimum, 0); argc++; + XtSetArg(args[argc], XmNmaximum, html->html.formatted_width); argc++; + XtSetArg(args[argc], XmNvalue, html->html.scroll_x); argc++; + XtSetArg(args[argc], XmNsliderSize, pinc); argc++; + XtSetArg(args[argc], XmNincrement, (html->html.default_font ? + html->html.default_font->xfont->max_bounds.width : + XmHTML_HORIZONTAL_SCROLL_INCREMENT)); + argc++; + XtSetArg(args[argc], XmNpageIncrement, pinc); argc++; + XtSetValues(html->html.hsb, args, argc); + + /* adjust x-position if vsb is on left */ + dx = (html->html.needs_vsb && vsb_on_left ? vsb_width : 0); + + /* place it */ + if(hsb_on_top) + XtMoveWidget(html->html.hsb, dx, 0); + else + XtMoveWidget(html->html.hsb, dx, (html->core.height - hsb_height)); + } + if(html->html.needs_vsb == True) + { + int pinc; + + _XmHTMLDebug(1, ("XmHTML.c: CheckScrollBars, setting vsb\n")); + + /* Set vsb size; adjust y-position if we have a hsb */ + dy = (html->html.needs_hsb ? hsb_height : 0); + XtResizeWidget(html->html.vsb, + html->html.vsb->core.width, + html->core.height - dy - 2*st, + html->html.vsb->core.border_width); + + /* pageIncrement == sliderSize */ + pinc = html->html.work_height - 2*(html->html.default_font ? + html->html.default_font->height : XmHTML_VERTICAL_SCROLL_INCREMENT); + /* sanity check */ + if(pinc < 1) + pinc = XmHTML_VERTICAL_SCROLL_INCREMENT; + + /* adjust vertical scroll if necessary */ + if(html->html.scroll_y > html->html.formatted_height - pinc) + html->html.scroll_y = html->html.formatted_height - pinc; + + /* + * Adjust if a vertical scrollbar has been forced + * (can only happen if scrollBarDisplayPolicy == XmSTATIC) + */ + if(force_vsb && pinc > html->html.formatted_height) + { + pinc = html->html.formatted_height; + html->html.scroll_y = 0; + } + + argc = 0; + XtSetArg(args[argc], XmNminimum, 0); argc++; + XtSetArg(args[argc], XmNmaximum, html->html.formatted_height); argc++; + XtSetArg(args[argc], XmNvalue, html->html.scroll_y); argc++; + XtSetArg(args[argc], XmNsliderSize, pinc); argc++; + XtSetArg(args[argc], XmNincrement, (html->html.default_font ? + html->html.default_font->height : XmHTML_VERTICAL_SCROLL_INCREMENT)); argc++; + XtSetArg(args[argc], XmNpageIncrement, pinc); argc++; + XtSetValues(html->html.vsb, args, argc); + + /* adjust y-position if hsb is on top */ + dy = (html->html.needs_hsb && hsb_on_top ? hsb_height : 0); + + /* place it */ + if(vsb_on_left) + XtMoveWidget(html->html.vsb, 0, dy); + else + XtMoveWidget(html->html.vsb, (html->core.width - vsb_width), dy); + } + _XmHTMLDebug(1, ("XmHTML.c: CheckScrollBars, end\n")); +} + +/***** +* Name: GeometryManager +* Return Type: XtGeometryResult +* Description: XmHTMLWidgetClass geometry_manager method +* In: +* +* Returns: +* Don't care. Just pass everything on. +*****/ +static XtGeometryResult +GeometryManager(TWidget w, XtWidgetGeometry *request, + XtWidgetGeometry *geometry_return) +{ + _XmHTMLDebug(1, ("XmHTML.c: GeometryManager Start\n")); + + if(request->request_mode & CWX) + geometry_return->x = request->x; + if(request->request_mode & CWY) + geometry_return->y = request->y; + if(request->request_mode & CWWidth) + geometry_return->width = request->width; + if(request->request_mode & CWHeight) + geometry_return->height = request->height; + if(request->request_mode & CWBorderWidth) + geometry_return->border_width = request->border_width; + geometry_return->request_mode = request->request_mode; + + _XmHTMLDebug(1, ("XmHTML.c: GeometryManager End\n")); + + return(XtGeometryYes); +} + +/***** +* Name: Destroy +* Return Type: void +* Description: XmHTMLWidgetClass destroy method. Frees up allocated resources. +* In: +* w: TWidget to destroy +* Returns: +* nothing +*****/ +static void +Destroy(TWidget w) +{ + XmHTMLWidget html = (XmHTMLWidget) w; + + _XmHTMLDebug(1, ("XmHTML.c: Destroy Start\n")); + + XmHTML_Destroy (html); + + /* remove all callbacks */ + XtRemoveAllCallbacks(w, XmNactivateCallback); + XtRemoveAllCallbacks(w, XmNarmCallback); + XtRemoveAllCallbacks(w, XmNanchorTrackCallback); + XtRemoveAllCallbacks(w, XmNframeCallback); + XtRemoveAllCallbacks(w, XmNformCallback); + XtRemoveAllCallbacks(w, XmNinputCallback); + XtRemoveAllCallbacks(w, XmNlinkCallback); + XtRemoveAllCallbacks(w, XmNmotionTrackCallback); + XtRemoveAllCallbacks(w, XmNimagemapCallback); + XtRemoveAllCallbacks(w, XmNdocumentCallback); + XtRemoveAllCallbacks(w, XmNfocusCallback); + XtRemoveAllCallbacks(w, XmNlosingFocusCallback); + XtRemoveAllCallbacks(w, XmNeventCallback); + + /* invalidate this TWidget */ + w = NULL; + + + _XmHTMLDebug(1, ("XmHTML.c: Destroy End\n")); +} + +/***** +* Name: HTMLProcessInput +* Return Type: void +* Description: handles keyboard input for the HTML TWidget. +* In: +* w: XmHTMLWidget +* event: ButtonEvent structure +* params: additional args, unused +* num_params: no of addition args, unused +* Returns: +* nothing +* Note: +* This routine calls any installed XmNinputCallback callback resources. +*****/ +static void +HTMLProcessInput(TWidget w, XEvent *event, String *params, Cardinal *num_params) +{ + XmHTMLWidget html; + /* + * If this action proc is called directly from within application code, + * w is a html TWidget. In all other cases this action proc is called + * for the translations installed on the work_area, and thus we need to + * use XtParent to get our html TWidget. + */ + if(XmIsHTML(w)) + html = XmHTML (w); + else + html = XmHTML (XtParent(w)); + + /* pass down if callback is installed */ + if(html->html.input_callback) + { + XmAnyCallbackStruct cbs; + cbs.reason = XmCR_INPUT; + cbs.event = event; + XtCallCallbackList((TWidget)html, html->html.input_callback, + &cbs); + } + _XmHTMLDebug(1, ("XmHTML.c: ProcessInput End\n")); +} + +/***** +* Name: HTMLPageUpOrLeft +* Return Type: void +* Description: keyboard navigation action routine +* In: +* w: TWidget id; XmHTMLWidget id if called from within application +* code, work_area if handled by XmHTML itself; +* event: key event; +* params: 0 for pageUp, 1 for pageLeft +* num_params: always 1 +* Returns: +* nothing +* Note: +* This routine also honors the repeatDelay resource. +*****/ +static void +HTMLPageUpOrLeft(TWidget w, XEvent *event, String *params, + Cardinal *num_params) +{ + int which; + XmHTMLWidget html; + static Time prev_time = 0; + + if(XmIsHTML(w)) + html = XmHTML (w); + else + html = XmHTML (XtParent(w)); + + if(*num_params != 1 || !XtIsRealized(w)) + { + if(*num_params != 1) + _XmHTMLWarning(__WFUNC__(w, "HTMLPageUpOrLeft"), + "page-up-or-left: invalid num_params. Must be exactly 1."); + return; + } + + /* check repeat delay */ + if(event->xkey.time - prev_time < html->html.repeat_delay) + return; + prev_time = event->xkey.time; + + which = atoi(params[0]); + + _XmHTMLDebug(1, ("XmHTML.c: HTMLPageUpOrLeft, which = %i\n", which)); + + if(which == 0 && XtIsManaged(html->html.vsb)) + XtCallActionProc(html->html.vsb, "PageUpOrLeft", event, params, 1); + else if(which == 1 && XtIsManaged(html->html.hsb)) + XtCallActionProc(html->html.hsb, "PageUpOrLeft", event, params, 1); +} + +/***** +* Name: HTMLDownOrRight +* Return Type: void +* Description: keyboard navigation action routine +* In: +* w: TWidget id; XmHTMLWidget id if called from within application +* code, work_area if handled by XmHTML itself; +* event: key event; +* params: 0 for pageDown, 1 for pageRight +* num_params: always 1 +* Returns: +* nothing +* Note: +* This routine also honors the repeatDelay resource. +*****/ +static void +HTMLPageDownOrRight(TWidget w, XEvent *event, String *params, + Cardinal *num_params) +{ + int which; + XmHTMLWidget html; + static Time prev_time = 0; + + if(XmIsHTML(w)) + html = XmHTML (w); + else + html = XmHTML (XtParent(w)); + + if(*num_params != 1 || !XtIsRealized(w)) + { + if(*num_params != 1) + _XmHTMLWarning(__WFUNC__(w, "HTMLPageDownOrRight"), + "page-down-or-right: invalid num_params. Must be exactly 1."); + return; + } + + /* check repeat delay */ + if(event->xkey.time - prev_time < html->html.repeat_delay) + return; + prev_time = event->xkey.time; + + which = atoi(params[0]); + + _XmHTMLDebug(1, ("XmHTML.c: HTMLPageDownOrRight, which = %i\n", which)); + + if(which == 0 && XtIsManaged(html->html.vsb)) + XtCallActionProc(html->html.vsb, "PageDownOrRight", event, params, 1); + else if(which == 1 && XtIsManaged(html->html.hsb)) + XtCallActionProc(html->html.hsb, "PageDownOrRight", event, params, 1); +} + +/***** +* Name: HTMLIncrementUpOrLeft +* Return Type: void +* Description: keyboard navigation action routine +* In: +* w: TWidget id; XmHTMLWidget id if called from within application +* code, work_area if handled by XmHTML itself; +* event: key event; +* params: 0 for IncrementUp, 1 for IncrementLeft +* num_params: always 1 +* Returns: +* nothing +* Note: +* This routine also honors the repeatDelay resource. +*****/ +static void +HTMLIncrementUpOrLeft(TWidget w, XEvent *event, String *params, + Cardinal *num_params) +{ + int which; + XmHTMLWidget html; + static Time prev_time = 0; + + if(XmIsHTML(w)) + html = XmHTML (w); + else + html = XmHTML (XtParent(w)); + + if(*num_params != 1 || !XtIsRealized(w)) + { + if(*num_params != 1) + _XmHTMLWarning(__WFUNC__(w, "HTMLIncrementUpOrLeft"), + "increment-up-or-left: invalid num_params. Must be exactly 1."); + return; + } + + /* check repeat delay */ + if(event->xkey.time - prev_time < html->html.repeat_delay) + return; + prev_time = event->xkey.time; + + which = atoi(params[0]); + + _XmHTMLDebug(1, ("XmHTML.c: HTMLIncrementUpOrLeft, which = %i\n", which)); + + if(which == 0 && XtIsManaged(html->html.vsb)) + XtCallActionProc(html->html.vsb, "IncrementUpOrLeft", event, + params, 1); + else if(which == 1 && XtIsManaged(html->html.hsb)) + XtCallActionProc(html->html.hsb, "IncrementUpOrLeft", event, + params, 1); +} + +/***** +* Name: HTMLIncrementDownOrRight +* Return Type: void +* Description: keyboard navigation action routine +* In: +* w: TWidget id; XmHTMLWidget id if called from within application +* code, work_area if handled by XmHTML itself; +* event: key event; +* params: 0 for IncrementDown, 1 for IncrementRight +* num_params: always 1 +* Returns: +* nothing +* Note: +* This routine also honors the repeatDelay resource. +*****/ +static void +HTMLIncrementDownOrRight(TWidget w, XEvent *event, String *params, + Cardinal *num_params) +{ + int which; + XmHTMLWidget html; + static Time prev_time = 0; + + if(XmIsHTML(w)) + html = XmHTML (w); + else + html = XmHTML (XtParent(w)); + + if(*num_params != 1 || !XtIsRealized(w)) + { + if(*num_params != 1) + _XmHTMLWarning(__WFUNC__(w, "HTMLIncrementDownOrRight"), + "increment-down-or-right: invalid num_params. Must be " + "exactly 1."); + return; + } + + /* check repeat delay */ + if(event->xkey.time - prev_time < html->html.repeat_delay) + return; + prev_time = event->xkey.time; + + which = atoi(params[0]); + + _XmHTMLDebug(1, ("XmHTML.c: HTMLIncrementDownOrRight, which = %i\n", + which)); + + if(which == 0 && XtIsManaged(html->html.vsb)) + XtCallActionProc(html->html.vsb, "IncrementDownOrRight", event, + params, 1); + else if(which == 1 && XtIsManaged(html->html.hsb)) + XtCallActionProc(html->html.hsb, "IncrementDownOrRight", event, + params, 1); +} + +/***** +* Name: HTMLTopOrBottom +* Return Type: void +* Description: keyboard navigation action routine +* In: +* w: TWidget id; XmHTMLWidget id if called from within application +* code, work_area if handled by XmHTML itself; +* event: key event; +* params: 0 for top, 1 for bottom +* num_params: always 1 +* Returns: +* nothing +* Note: +* no repeatDelay by this action routine, it only moves from top to bottom +* or vice-versa +*****/ +static void +HTMLTopOrBottom(TWidget w, XEvent *event, String *params, + Cardinal *num_params) +{ + int which; + XmHTMLWidget html; + + if(XmIsHTML(w)) + html = XmHTML (w); + else + html = XmHTML (XtParent(w)); + + if(*num_params != 1 || !XtIsRealized(w)) + { + if(*num_params != 1) + _XmHTMLWarning(__WFUNC__(w, "HTMLTopOrBottom"), + "top-or-bottom: invalid num_params. Must be exactly 1."); + return; + } + which = atoi(params[0]); + + _XmHTMLDebug(1, ("XmHTML.c: HTMLTopOrBottom, which = %i\n", which)); + + if(which == 0 && XtIsManaged(html->html.vsb)) + { + /* no move if already on top */ + if(html->html.top_line == 0) + return; + + html->html.top_line = 0; + _XmHTMLMoveToPos(html->html.vsb, html, 0); + } + else if(which == 1 && XtIsManaged(html->html.vsb)) + { + int value; + + /* no move if already on bottom */ + if(html->html.top_line == html->html.nlines) + return; + + html->html.top_line = html->html.nlines; + value = html->html.formatted_height; + + /* fix 01/30/97-04, kdh */ + AdjustVerticalScrollValue(html->html.vsb, value); + + _XmHTMLMoveToPos(html->html.vsb, html, value); + } +} + +static void +HTMLTraverseCurrent(TWidget w, XEvent *event, String *params, + Cardinal *num_params) +{ + if(!XtIsRealized(w)) + return; + _XmHTMLProcessTraversal(w, XmTRAVERSE_CURRENT); +} + +static void +HTMLTraverseNext(TWidget w, XEvent *event, String *params, + Cardinal *num_params) +{ + if(!XtIsRealized(w)) + return; + _XmHTMLProcessTraversal(w, XmTRAVERSE_NEXT); +} + +static void +HTMLTraversePrev(TWidget w, XEvent *event, String *params, + Cardinal *num_params) +{ + if(!XtIsRealized(w)) + return; + + _XmHTMLProcessTraversal(w, XmTRAVERSE_PREV); +} + +static void +HTMLTraverseNextOrPrev(TWidget w, XEvent *event, String *params, + Cardinal *num_params) +{ + int which; + + if(*num_params != 1 || !XtIsRealized(w)) + { + if(*num_params != 1) + _XmHTMLWarning(__WFUNC__(w, "HTMLTraverseNextOrPrev"), + "traverse-next-or-prev: invalid num_params. Must be " + "exactly 1."); + return; + } + which = atoi(params[0]); + if(which == 0) + _XmHTMLProcessTraversal(w, XmTRAVERSE_NEXT_TAB_GROUP); + else + _XmHTMLProcessTraversal(w, XmTRAVERSE_PREV_TAB_GROUP); +} + +/***** +* Name: XmCreateHTML +* Return Type: TWidget +* Description: creates a XmHTML TWidget +* In: +* parent: TWidget to act as parent for this new XmHTMLWidget +* name: name for the new TWidget +* arglist: arguments for this new XmHTMLWidget +* argcount: no of arguments +* Returns: +* a newly created TWidget. This routine exits if parent is NULL or a subclass +* of XmGadget. +*****/ +TWidget +XmCreateHTML(TWidget parent, String name, ArgList arglist, Cardinal argcount) +{ + if(parent && !XmIsGadget(parent)) + return(XtCreateWidget(name, xmHTMLWidgetClass, parent, + arglist, argcount)); + + _XmHTMLWarning(__WFUNC__(NULL, "XmCreateHTML"), "XmHTML requires " + "a non-%s parent", parent ? "gadget" : "NULL"); + + /* keep compiler happy */ + return(NULL); +} + +static void +XmHTML_Frontend_Redisplay (XmHTMLWidget html) +{ + _XmHTMLClearArea(html, 0, 0, html->core.width, html->core.height); + + /* sync so the display is updated */ + XSync(XtDisplay((TWidget)html), False); + + XmUpdateDisplay((TWidget)html); + if(XtIsManaged(html->html.vsb)) + XmUpdateDisplay(html->html.vsb); + if(XtIsManaged(html->html.hsb)) + XmUpdateDisplay(html->html.hsb); +} + +/***** +* Name: GetScrollDim +* Return Type: void +* Description: retrieves width & height of the scrollbars +* In: +* html: XmHTMLWidget for which to retrieve these values +* hsb_height: thickness of horizontal scrollbar, filled upon return +* vsb_width: thickness of vertical scrollbar, filled upon return +* Returns: +* nothing +* Note: +* I had a nicely working caching version of this routine under Linux & +* Motif 2.0.1, but under HPUX with 1.2.0 this never worked. This does. +*****/ +static void +GetScrollDim(XmHTMLWidget html, int *hsb_height, int *vsb_width) +{ + Arg args[1]; + Dimension height = 0, width = 0; + + if(html->html.hsb) + { +#ifdef NO_XLIB_ILLEGAL_ACCESS + XtSetArg(args[0], XmNheight, &height); + XtGetValues(html->html.hsb, args, 1); +#else + height = html->html.hsb->core.height; +#endif + + /* + * Sanity check if the scrollbar dimensions exceed the TWidget dimensions + * Not doing this would lead to X Protocol errors whenever text is set + * into the TWidget: the size of the workArea will be less than or equal + * to zero when scrollbars are required. + * We always need to do this check since it's possible that some + * user has been playing with the dimensions of the scrollbars. + */ + if(height >= html->core.height) + { + _XmHTMLWarning(__WFUNC__(html->html.hsb, "GetScrollDim"), + "Height of horizontal scrollbar (%i) exceeds height of parent " + "TWidget (%i).\n Reset to 15.", height, html->core.height); + height = 15; + XtSetArg(args[0], XmNheight, height); + XtSetValues(html->html.hsb, args, 1); + } + } + + if(html->html.vsb) + { +#ifdef NO_XLIB_ILLEGAL_ACCESS + XtSetArg(args[0], XmNwidth, &width); + XtGetValues(html->html.vsb, args, 1); +#else + width = html->html.vsb->core.width; +#endif + + if(width >= html->core.width) + { + _XmHTMLWarning(__WFUNC__(html->html.vsb, "GetScrollDim"), + "Width of vertical scrollbar (%i) exceeds width of parent " + "TWidget (%i).\n Reset to 15.", width, html->core.width); + width = 15; + XtSetArg(args[0], XmNwidth, width); + XtSetValues(html->html.vsb, args, 1); + } + } + + _XmHTMLDebug(1, ("XmHTML.c: GetScrollDim; height = %i, width = %i\n", + height, width)); + + *hsb_height = height; + *vsb_width = width; +} + +/***** +* Name: _XmHTMLCheckXCC +* Return Type: void +* Description: creates an XCC for the given XmHTMLWidget if one hasn't been +* allocated yet. +* In: +* html: XmHTMLWidget id; +* Returns: +* nothing +*****/ +void +_XmHTMLCheckXCC(XmHTMLWidget html) +{ + _XmHTMLDebug(1, ("XmHTML.c: _XmHTMLCheckXCC Start\n")); + + /* + * CheckXCC is called each time an image is loaded, so it's quite + * usefull if we have a GC around by the time the TWidget is being + * mapped to the display. + * Our SubstructureNotify event handler can fail in some cases leading to + * a situation where we don't have a GC when images are about to be + * rendered (especially background images can cause a problem, they + * are at the top of the text). + */ + CheckGC(html); + + /* + * Create an XCC. + * XmHTML never decides whether or not to use a private or standard + * colormap. A private colormap can be supplied by setting it on the + * TWidget's parent, we know how to deal with that. + */ + if(!html->html.xcc) + { + Visual *visual = NULL; + Colormap cmap = html->core.colormap; + + _XmHTMLDebug(1, ("XmHTML.c: _XmHTMLCheckXCC: creating an XCC\n")); + + /* get a visual */ + XtVaGetValues((TWidget)html, + XmNvisual, &visual, + NULL); + /* walk TWidget tree or get default visual */ + if(visual == NULL) + visual = XCCGetParentVisual((TWidget)html); + + /* create an xcc for this TWidget */ + html->html.xcc = XCCCreate((TWidget)html, visual, cmap); + } + _XmHTMLDebug(1, ("XmHTML.c: _XmHTMLCheckXCC End\n")); +} + + +/***** +* Name: autoSizeWidget +* Return Type: void +* Description: computes XmHTML's TWidget dimensions if we have to autosize +* in either direction. +* In: +* html: XmHTMLWidget id +* Returns: +* nothing. +* Note: +* This routine is fairly complicated due to the fact that the dimensions +* of the work area are partly determined by the presence of possible +* scrollbars. +*****/ +static void +autoSizeWidget(XmHTMLWidget html) +{ + int max_w, max_h, width, height, core_w, core_h; + int hsb_height = 0, vsb_width = 0, h_reserved, w_reserved; + Boolean done = False, granted = False, has_vsb = False, has_hsb = False; + Dimension new_h, new_w, width_return, height_return; + + /* get dimensions of the scrollbars */ + GetScrollDim(html, &hsb_height, &vsb_width); + + /* maximum allowable TWidget height: 80% of screen height */ + max_h = (int)(0.8*Toolkit_Screen_Height (XtScreen((TWidget)html))); + + /* make a guess at the initial TWidget width */ + max_w = _XmHTMLGetMaxLineLength(html) + 2*html->html.margin_width; + + /* save original TWidget dimensions in case our resize request is denied */ + core_w = Toolkit_Widget_Dim (html).width; + core_h = Toolkit_Widget_Dim (html).height; + + /* set initial dimensions */ + height = (core_h > max_h ? max_h : core_h); + width = max_w; + + /* + * Since we are making geometry requests, we need to compute the total + * width and height required to make all text visible. + * If we succeed, we don't require any scrollbars to be present. + * This does complicate things considerably. + * The dimensions of the work area are given by the TWidget dimensions + * minus possible margins and possible scrollbars. + */ + h_reserved = html->html.margin_height + hsb_height; + w_reserved = html->html.margin_width + vsb_width; + + do + { + /* work_width *always* includes room for a vertical scrollbar */ + html->html.work_width = width - w_reserved; + + /* Check if we need to add a vertical scrollbar. */ + if(height - h_reserved > max_h) + has_vsb = True; + else /* no vertical scrollbar needed */ + has_vsb = False; + + _XmHTMLDebug(1, ("XmHTML.c: autoSizeWidget, initial dimension: " + "%ix%i. has_vsb: %s\n", width, height, + has_vsb ? "yes" : "no")); + + /* Compute new screen layout. */ + _XmHTMLComputeLayout(html); + + /* + * We have made a pass on the document, so we know now the formatted + * dimensions. If the formatted width exceeds the maximum allowable + * width, we need to add a horizontal scrollbar, and if the formatted + * height exceeds the maximum allowable height we need to add a + * vertical scrollbar. Order of these checks is important: if a vertical + * scrollbar is present, the width of the vertical scrollbar must be + * added as well. + * formatted_height includes the vertical margin twice. + * formatted_width includes the horizontal margin once. + */ + + /* higher than available height, need a vertical scrollbar */ + if(html->html.formatted_height > max_h) + { + has_vsb = True; + height = max_h; + } + else + { + has_vsb = False; + height = html->html.formatted_height; + } + + /* wider than available width, need a horizontal scrollbar */ + if(html->html.formatted_width + html->html.margin_width > max_w) + { + has_hsb = True; + width = max_w; + } + else + { + has_hsb = False; + width = html->html.formatted_width + html->html.margin_width; + } + + /* add width of vertical scrollbar if we are to have one */ + if(has_vsb) + width += vsb_width; + + /* + * With the above checks we *know* width and height are positive + * integers smaller than 2^16 (max value of an unsigned short), so we + * don't have to check for a possible wraparound of the new dimensions. + */ + new_h = (Dimension)height; + new_w = (Dimension)width; + width_return = 0; + height_return = 0; + + _XmHTMLDebug(1, ("XmHTML.c: autoSizeWidget, geometry request with " + "dimensions: %hix%hi. has_vsb = %s, has_hsb = %s\n", new_w, new_h, + has_vsb ? "yes" : "no", has_hsb ? "yes" : "no")); + + /* make the resize request and check return value */ + switch(XtMakeResizeRequest((TWidget)html, new_w, new_h, + &width_return, &height_return)) + { + case XtGeometryAlmost: + /* + * partially granted. Set the returned width and height + * as the new TWidget dimensions and recompute the + * TWidget layout. The next time the resizeRequest is made + * it *will* be granted. + */ + width = (int)width_return; + height= (int)height_return; + break; + case XtGeometryNo: + /* revert to original TWidget dimensions */ + new_h = core_h; + new_w = core_w; + granted = False; + done = True; + break; + case XtGeometryYes: + /* Resize request was granted. */ + granted = True; + done = True; + break; + default: /* not reached, XtGeometryDone is never returned */ + done = True; + break; + } + } + while(!done); + + html->core.width = new_w; + html->core.height = html->html.work_height = new_h; + /* work_width *always* includes room for a vertical scrollbar */ + html->html.work_width = new_w - w_reserved; + + /* Make sure scrollbars don't appear when they are not needed. */ + if(!has_hsb && granted) + html->html.formatted_height = new_h - html->html.margin_height - + hsb_height - 1; + if(!has_vsb && granted) + html->html.formatted_width = new_w - 1; + + /* + * If a vertical scrollbar is present, CheckScrollBars will add a horizontal + * scrollbar if the formatted_width + vsb_width exceeds the TWidget width. + * To make sure a horizontal scrollbar does not appear when one is not + * needed, we need to adjust the formatted width accordingly. + */ + if(has_vsb && granted) + html->html.formatted_width -= vsb_width; + + /* + * If our resize request was denied we need to recompute the text + * layout using the original TWidget dimensions. The previous layout is + * invalid since it used guessed TWidget dimensions instead of the previous + * dimensions and thus it will look bad if we don't recompute it. + */ + if(!granted) + _XmHTMLComputeLayout(html); + + _XmHTMLDebug(1, ("XmHTML.c: autoSizeWidget, results:\n" + "\tRequest granted: %s\n" + "\tcore height = %i, core width = %i, work_width = %i\n" + "\tformatted_width = %i, formatted_height = %i.\n" + "\thas_vsb = %s, has_hsb = %s\n", + granted ? "yes" : "no", + html->core.height, html->core.width, html->html.work_width, + html->html.formatted_width, html->html.formatted_height, + has_vsb ? "yes" : "no", has_hsb ? "yes" : "no")); +} + +/***** +* Name: DrawRedisplay +* Return Type: void +* Description: Eventhandler for exposure events on the work_area +* In: +* w: owner of this eventhandler +* html: client data, XmHTMLWidget to which w belongs +* event: expose event data. +* Returns: +* nothing +* Note: +* This routine makes a rough guess on which ObjectTable elements +* should be used as vertical start and end points for the paint engine. +* Finetuning is done by the DrawText routine in paint.c, which uses +* the paint_x, paint_y, paint_width and paint_height fields in the +* htmlRec to determine what should be painted exactly. +*****/ +static void +DrawRedisplay(TWidget w, XmHTMLWidget html, XEvent *event) +{ + /* + * must use int for y-positions. The Position and Dimension typedefs + * are shorts, which may produce bad results if the scrolled position + * exceeds the size of a short + */ + int y1, y2, height, x1, x2, width; + XEvent expose; + + _XmHTMLDebug(1, ("XmHTML.c: DrawRedisplay Start\n")); + + /***** + * No needless exposures. Kick out graphics exposures, I don't know + * who invented these, sure as hell don't know what to do with them... + * + * Update August 26: I do know now what to do with these suckers: + * they are generated whenever a XCopyArea or XCopyPlane request couldn't + * be completed 'cause the destination area is (partially) obscured. + * This happens when some other window is placed over our display area. + * So when we get a GraphicsExpose event, we check our visibility state + * and only draw something when we are partially obscured: when we are + * fully visibile we won't get any GraphicsExpose events, and when we + * are fully obscured we won't even get Expose Events. + * The reason behind all of this are the images & anchor drawing: sometimes + * they overlap an already painted area, and drawing will then generate + * a GraphicsExpose, which in turn will trigger a redisplay of these anchors + * and then it starts all over again. Ergo: bad screen flickering. And we + * DO NOT want this. + *****/ + if(((event->xany.type != Expose) && (event->xany.type != GraphicsExpose)) + || html->html.formatted == NULL || html->html.nframes) + { + /* display scrollbars if we are in a frame */ + if(html->html.is_frame) + SetScrollBars(html); + _XmHTMLDebug(1, ("XmHTML.c: DrawRedisplay End: wrong event " + "(%i).\n", event->xany.type)); + return; + } + if(event->xany.type == GraphicsExpose && + html->html.visibility != VisibilityPartiallyObscured) + { + _XmHTMLDebug(1, ("XmHTML.c: DrawRedisplay End: bad GraphicsExpose, " + "window not partially obscured.\n")); + return; + } + + x1 = event->xexpose.x; + y1 = event->xexpose.y; + width = event->xexpose.width; + height = event->xexpose.height; + x2 = x1 + width; + + _XmHTMLDebug(1, ("XmHTML.c: DrawRedisplay, y-position of region: %i, " + "height of region: %i\n", y1, height)); + + _XmHTMLDebug(1, ("XmHTML.c: DrawRedisplay, event type: %s\n", + event->xany.type == Expose ? "Expose" : "GraphicsExpose")); + + _XmHTMLDebug(1, ("XmHTML.c: DrawRedisplay %i Expose events waiting.\n", + event->xexpose.count)); + + /* + * coalesce multiple expose events into one. + */ + while((XCheckWindowEvent(Toolkit_Display(w), Toolkit_Widget_Window(w), ExposureMask, + &expose)) == True) + { + int dx, dy, dh, dw; + + if(expose.xany.type == NoExpose || + (event->xany.type == GraphicsExpose && + html->html.visibility != VisibilityPartiallyObscured)) + continue; + + dx = expose.xexpose.x; + dy = expose.xexpose.y; + dw = expose.xexpose.width; + dh = expose.xexpose.height; + + _XmHTMLDebug(1, ("XmHTML.c: DrawRedisplay, next event, geometry of " + "exposed region: %ix%i:%i,%i\n", dx, dy, dw, dh)); + + /* right side of region */ + x2 = x1 + width; + + /* leftmost x-position of exposure region */ + if(x1 > dx) + x1 = dx; + + /* rightmost x-position of exposure region */ + if(x2 < (dx + dw)) + x2 = dx + dw; + + /* width of exposure region */ + width = x2 - x1; + + /* bottom of region */ + y2 = y1 + height; + + /* topmost y-position of exposure region */ + if(y1 > dy) + y1 = dy; + + /* bottommost y-position of exposure region */ + if(y2 < (dy + dh)) + y2 = dy + dh; + + /* height of exposure region */ + height = y2 - y1; + } + + _XmHTMLDebug(1, ("XmHTML.c: DrawRedisplay, total region geometry: " + "%ix%i:%i,%i.\n", x1, y1, width, height)); + + Refresh(html, x1, y1, width, height); + + _XmHTMLDebug(1, ("XmHTML.c: DrawRedisplay End\n")); +} + +/***** +* Name: Redisplay +* Return Type: void +* Description: xmHTMLWidgetClass expose method. +* In: +* w: TWidget to expose +* event: description of event that triggered an expose +* region: region to display. +* Returns: +* nothing +*****/ +static void +Redisplay(TWidget w, XEvent *event, Region region) +{ + _XmHTMLDebug(1, ("XmHTML.c: Redisplay Start\n")); + + /* Pass exposure events down to the children */ + _XmRedisplayGadgets(w, (XEvent*)event, region); + + _XmHTMLDebug(1, ("XmHTML.c: Redisplay End\n")); + return; +} + +/***** +* Name: SetValues +* Return Type: Boolean +* Description: xmHTMLWidgetClass SetValues method. +* In: +* current: copy of TWidget before any set_values methods are called +* request: copy of TWidget after resources have changed but before any +* set_values methods are called +* set: TWidget with resources set and as modified by any superclass +* methods that have called XtSetValues() +* args: argument list passed to XtSetValues, done by programmer +* num_args: no of args +* Returns: +* True if a changed resource requires a redisplay, False otherwise. +*****/ +static Boolean +SetValues(TWidget current, TWidget request, TWidget set, + ArgList args, Cardinal *num_args) +{ + XmHTMLWidget w_curr = XmHTML (current); + XmHTMLWidget w_req = XmHTML (request); + XmHTMLWidget w_new = XmHTML (set); + + Boolean redraw = False, parse = False; + Boolean need_reformat = False; + Boolean need_layout = False; + Boolean free_images = False; + + /* fix 06/17/97-01, aj */ + int i; + int valueReq = False; + + _XmHTMLDebug(1, ("XmHTML.c: SetValues Start\n")); + +#ifdef DEBUG + if(w_req->html.debug_levels != w_curr->html.debug_levels) + { + _XmHTMLSelectDebugLevels(w_req->html.debug_levels); + w_new->html.debug_levels = w_req->html.debug_levels; + } + _XmHTMLSetFullDebug(w_req->html.debug_full_output); + + if(w_req->html.debug_disable_warnings) + debug_disable_warnings = True; + else + debug_disable_warnings = False; +#endif + + /***** + * We always use a copy of the HTML source text that is set into + * the TWidget to prevent a crash when the user has freed it before we + * had a chance of parsing it, and we ensure new text will get set + * properly. + * + * fix 06/17/97-01, aj + * Patch to fix clearing if doing setvalues without XmNvalue + * Determine if we have a set value request and only check new source + * if it has been supplied explicitly. + * + * Addition 10/10/97, kdh: changing the palette at run-time is *never* + * allowed. + *****/ + for(i=0; i<*num_args; i++) + { + if(!strcmp(XmNvalue, args[i].name)) + valueReq = True; + + /* Check for read-only resources */ + if(!strcmp(XmNimagePalette, args[i].name) || + !strcmp(XmNhorizontalScrollBar, args[i].name) || + !strcmp(XmNverticalScrollBar, args[i].name) || + !strcmp(XmNworkWindow, args[i].name)) + { + _XmHTMLWarning(__WFUNC__(w_curr, "SetValues"), + "Attempt to modify read-only resource %s denied.", + args [i].name); + return(False); + } + } + + /* we have a new source request */ + if(valueReq) + { + /* we had a previous source */ + if(w_curr->html.source) + { + /* new text has been supplied */ + if(w_req->html.value) + { + /* see if it differs */ + if(strcmp(w_req->html.value, w_curr->html.source)) + { + parse = True; /* it does */ + + /* free previous source text */ + free(w_curr->html.source); + + /* copy new source text */ + w_new->html.source = strdup(w_req->html.value); + } + else + parse = False; /* it doesn't */ + } + else /* have to clear current text */ + { + parse = True; + + /* free previous source text */ + free(w_curr->html.source); + + /* reset to NULL */ + w_new->html.source = NULL; + } + } + else /* we didn't have any source */ + { + if(w_req->html.value) + { + /* new text */ + parse = True; + + /* copy new source text */ + w_new->html.source = strdup(w_req->html.value); + } + else + parse = False; /* still empty */ + } + } + + /***** + * Whoa!! String direction changed!!! All text will be reversed + * and default alignment changes to the other margin as well. + * Needs full reformat as this changes things profoundly... + * This requires a full reparsing of the document data as string reversal + * is done at the lowest possible level: in the parser. + *****/ + if(w_req->html.string_direction != w_curr->html.string_direction) + { + parse = True; + + /* check for alignment */ + CheckAlignment(w_new, w_req); + } + + if(parse) + { + _XmHTMLDebug(1, ("XmHTML.c: SetValues, parsing new text\n")); + + /* new text has been set, kill of any existing PLC's */ + _XmHTMLKillPLCCycler(w_curr); + + /* release event database */ + _XmHTMLFreeEventDatabase(w_curr, w_new); + + /* destroy any form data */ + _XmHTMLFreeForm(w_curr, w_curr->html.form_data); + w_new->html.form_data = (XmHTMLFormData*)NULL; + + /* Parse the raw HTML text */ + w_new->html.elements = _XmHTMLparseHTML(w_req, w_curr->html.elements, + w_req->html.value, w_new); + + /* reset topline */ + w_new->html.top_line = 0; + + /* keep current frame setting and check if new frames are allowed */ + w_new->html.is_frame = w_curr->html.is_frame; + w_new->html.nframes = _XmHTMLCheckForFrames(w_new, + w_new->html.elements); + + /* Trigger link callback */ + if(w_new->html.link_callback) + _XmHTMLLinkCallback(w_new); + + /* needs layout, a redraw and current images must be freed */ + need_reformat = True; + redraw = True; + free_images = True; + + _XmHTMLDebug(1, ("XmHTML.c: SetValues, done parsing\n")); + } + + if((w_req->html.enable_outlining != w_curr->html.enable_outlining) || + (w_req->html.alignment != w_curr->html.alignment)) + { + /* Needs full reformat, default alignment is a text property */ + CheckAlignment(w_new, w_req); + need_reformat = True; + } + + /***** + * see if fonts have changed. The bloody problem with resources of type + * String is that it's very well possible that a user is using some + * static space to store these things. In these cases, the simple + * comparisons are bound to be True every time, even though the content + * might have changed (which we won't see cause it's all in static user + * space!!), so to catch changes to this type of resources, we *MUST* + * scan the array of provided args to check if it's specified. Sigh. + *****/ + valueReq = False; + for(i = 0; i < *num_args; i++) + { + if(!strcmp(XmNcharset, args[i].name) || + !strcmp(XmNfontFamily, args[i].name) || + !strcmp(XmNfontFamilyFixed, args[i].name) || + !strcmp(XmNfontSizeFixedList, args[i].name) || + !strcmp(XmNfontSizeList, args[i].name)) + valueReq = True; + } + if(valueReq || + w_req->html.font_sizes != w_curr->html.font_sizes || + w_req->html.font_family != w_curr->html.font_family || + w_req->html.font_sizes_fixed != w_curr->html.font_sizes_fixed || + w_req->html.font_family_fixed != w_curr->html.font_family_fixed|| + w_req->html.charset != w_curr->html.charset) + { + /* reset font cache */ + w_new->html.default_font = _XmHTMLSelectFontCache(w_new, True); + need_reformat = True; + } + + /* + * Body colors. Original body colors are restored when body colors are + * disabled. + */ + if(w_req->html.body_colors_enabled != w_curr->html.body_colors_enabled) + { + /* restore original body colors */ + if(!w_req->html.body_colors_enabled) + { + w_new->html.body_fg = w_req->html.body_fg_save; + w_new->html.body_bg = w_req->html.body_bg_save; + w_new->html.anchor_fg = w_req->html.anchor_fg_save; + w_new->html.anchor_visited_fg = + w_req->html.anchor_visited_fg_save; + w_new->html.anchor_activated_fg = + w_req->html.anchor_activated_fg_save; + } + need_reformat = True; + } + + /* + * Colors. For now we redo the layout since all colors are stored + * in the ObjectTable data. + * Not that effective, perhaps use multiple GC's, but thats a lot of + * resource consuming going on then... + */ + if( (w_req->manager.foreground != w_curr->manager.foreground) || + (w_req->core.background_pixel != w_curr->core.background_pixel) || + (w_req->html.anchor_fg != w_curr->html.anchor_fg) || + (w_req->html.anchor_target_fg != w_curr->html.anchor_target_fg) || + (w_req->html.anchor_visited_fg != w_curr->html.anchor_visited_fg) || + (w_req->html.anchor_activated_fg != w_curr->html.anchor_activated_fg)|| + (w_req->html.anchor_activated_bg != w_curr->html.anchor_activated_bg)) + { + /* back and foreground pixels */ + w_new->manager.foreground = w_req->manager.foreground; + w_new->core.background_pixel = w_req->core.background_pixel; + w_new->html.body_fg = w_new->manager.foreground; + w_new->html.body_bg = w_new->core.background_pixel; + w_new->html.anchor_fg = w_req->html.anchor_fg; + w_new->html.anchor_target_fg = w_req->html.anchor_target_fg; + w_new->html.anchor_visited_fg = w_req->html.anchor_visited_fg; + w_new->html.anchor_activated_fg = w_req->html.anchor_activated_fg; + w_new->html.anchor_activated_bg = w_req->html.anchor_activated_bg; + + /* save as new default colors */ + w_new->html.body_fg_save = w_new->html.body_fg; + w_new->html.body_bg_save = w_new->html.body_bg; + w_new->html.anchor_fg_save = w_new->html.anchor_fg; + w_new->html.anchor_target_fg_save = w_new->html.anchor_target_fg; + w_new->html.anchor_visited_fg_save = w_new->html.anchor_visited_fg; + w_new->html.anchor_activated_fg_save = w_new->html.anchor_activated_fg; + w_new->html.anchor_activated_bg_save = w_new->html.anchor_activated_bg; + + /* set appropriate background color */ + XtVaSetValues(w_new->html.work_area, + XmNbackground, w_new->html.body_bg, NULL); + + /* get new values for top, bottom & highlight colors */ + _XmHTMLRecomputeColors(w_new); + need_reformat = True; + } + + /* + * anchor highlighting, must invalidate any current selection + * No need to do a redraw if the highlightcolor changes: since the + * SetValues method is chained, Manager's SetValues takes care of that. + */ + if(w_req->html.highlight_on_enter != w_curr->html.highlight_on_enter) + w_new->html.armed_anchor = (XmHTMLObjectTable*)NULL; + + /* + * anchor underlining. Also needs a full layout computation as + * underlining data is stored in the ObjectTable data + */ + if( (w_req->html.anchor_underline_type != + w_curr->html.anchor_underline_type) || + (w_req->html.anchor_visited_underline_type != + w_curr->html.anchor_visited_underline_type) || + (w_req->html.anchor_target_underline_type != + w_curr->html.anchor_target_underline_type)) + { + CheckAnchorUnderlining(w_new, w_req); + need_reformat = True; + } + else + { + /* + * Support for color & font attributes. Needs a redo of the layout + * if changed. We only need to check for this if the above test + * failed as that will also trigger a redo of the layout. + */ + if(w_req->html.allow_color_switching != + w_curr->html.allow_color_switching || + w_req->html.allow_font_switching != + w_curr->html.allow_font_switching) + need_reformat = True; + } + + /* + * on-the-fly enable/disable of dithering. + */ + if(w_req->html.map_to_palette != w_curr->html.map_to_palette) + { + /* from on to off or off to on */ + if(w_curr->html.map_to_palette == XmDISABLED || + w_req->html.map_to_palette == XmDISABLED) + { + /* free current stuff */ + XCCFree(w_curr->html.xcc); + + /* and create a new one */ + w_new->html.xcc = NULL; + _XmHTMLCheckXCC(w_new); + + /* add palette if necessary */ + if(w_req->html.map_to_palette != XmDISABLED) + _XmHTMLAddPalette(w_new); + } + else + { + /* fast & best methods require precomputed error matrices */ + if(w_req->html.map_to_palette == XmBEST || + w_req->html.map_to_palette == XmFAST) + { + XCCInitDither(w_new->html.xcc); + } + else + XCCFreeDither(w_new->html.xcc); + } + /* and in *all* cases we need a full reformat */ + need_reformat = True; + } + + /* + * maximum amount of allowable image colors. Needs a full redo + * of the layout if the current doc has got images with more colors + * than allowed or it has images which have been dithered to fit + * the previous setting. + */ + if((w_req->html.max_image_colors != w_curr->html.max_image_colors)) + { + CheckMaxColorSetting(w_new); + + /* + * check if we have any images with more colors than allowed or + * we had images that were dithered. If so we need to redo the layout + */ + if(!need_reformat) + { + XmHTMLImage *image; + int prev_max = w_curr->html.max_image_colors; + int new_max = w_req->html.max_image_colors; + + for(image = w_new->html.images; image != NULL && !free_images; + image = image->next) + { + /* ImageInfo is still available. Compare against it */ + if(!ImageInfoFreed(image)) + { + /* + * redo image composition if any of the following + * conditions is True: + * - current image has more colors than allowed; + * - current image has less colors than allowed but the + * original image had more colors than allowed previously. + */ + if(image->html_image->ncolors > new_max || + (image->html_image->scolors < new_max && + image->html_image->scolors > prev_max)) + free_images = True; + } + /* info no longer available. Check against allocated colors */ + else + if(image->npixels > new_max) + free_images = True; + } + /* need to redo the layout if we are to redo the images */ + need_reformat = free_images; + } + } + + /* Are images enabled? */ + if(w_req->html.images_enabled != w_curr->html.images_enabled) + { + /***** + * we always need to free the images if this changes. A full + * layout recomputation will load all images. + *****/ + free_images = True; + need_reformat = True; + } + + /* PLC timing intervals */ + if(w_req->html.plc_min_delay != w_curr->html.plc_min_delay || + w_req->html.plc_max_delay != w_curr->html.plc_max_delay || + w_req->html.plc_delay != w_curr->html.plc_def_delay) + CheckPLCIntervals(w_new); + + /***** + * Now format the list of parsed objects. + * Don't do a bloody thing if we are already in layout as this will + * cause unnecessary reloading and screen flickering. + *****/ + if(need_reformat && !w_curr->html.in_layout) + { + _XmHTMLDebug(1, ("XmHTML.c: SetValues, need layout\n")); + + /***** + * It the current document makes heavy use of images we first need + * to clear it. Not doing this would cause a shift in the colors of + * the current document (as they are being released) which does not + * look nice. Therefore first clear the entire display* area *before* + * freeing anything at all. + *****/ + if(w_new->html.gc != NULL) + { + XClearArea(XtDisplay(w_new->html.work_area), + XtWindow(w_new->html.work_area), 0, 0, + w_new->core.width, w_new->core.height, False); + } + + /* destroy any form data */ + _XmHTMLFreeForm(w_curr, w_curr->html.form_data); + w_new->html.form_data = (XmHTMLFormData*)NULL; + + /* Free all non-persistent resources */ + FreeExpendableResources(w_curr, free_images); + + /* reset some important vars */ + ResetWidget(w_new, free_images); + + /* reset background color */ + XtVaSetValues(w_new->html.work_area, + XmNbackground, w_new->html.body_bg, NULL); + + /* get new values for top, bottom & highlight */ + _XmHTMLRecomputeColors(w_new); + + /* go and format the parsed HTML data */ + if(!_XmHTMLCreateFrames(w_curr, w_new)) + { + w_new->html.frames = NULL; + w_new->html.nframes = 0; + /* keep current frame setting */ + w_new->html.is_frame = w_curr->html.is_frame; + } + + _XmHTMLformatObjects(w_curr, w_new); + + /* and check for possible external imagemaps */ + _XmHTMLCheckImagemaps(w_new); + + _XmHTMLDebug(1, ("XmHTML.c: SetValues, computing new layout.\n")); + + /* compute new screen layout */ + Layout(w_new); + + _XmHTMLDebug(1, ("XmHTML.c: SetValues, done with layout.\n")); + + /* if new text has been set, fire up the PLCCycler */ + if(parse) + { + w_new->html.plc_suspended = False; + _XmHTMLPLCCycler((XtPointer)w_new , NULL); + } + free_images = False; + redraw = True; + need_layout = False; + } + /***** + * Default background image changed. We don't need to do this when a + * layout recomputation was required as it will have been taken care + * of already. + *****/ + else if + (w_req->html.body_images_enabled != w_curr->html.body_images_enabled || + w_req->html.def_body_image_url != w_curr->html.def_body_image_url) + { + + /* check if body images display status is changed */ + if(w_req->html.body_images_enabled != w_curr->html.body_images_enabled) + { + if(!free_images && w_curr->html.body_image) + w_curr->html.body_image->options |= IMG_ORPHANED; + w_new->html.body_image = NULL; + } + + /* a new body image has been specified, check it */ + if(w_req->html.def_body_image_url != w_curr->html.def_body_image_url) + { + /* do we have a new image? */ + if(w_req->html.def_body_image_url) + { + /* yes we do */ + w_new->html.def_body_image_url = + strdup(w_req->html.def_body_image_url); + } + else /* no we don't */ + w_new->html.def_body_image_url = NULL; + + /* did we have a previous image? */ + if(w_curr->html.def_body_image_url) + { + /* we did, free it */ + free(w_curr->html.def_body_image_url); + + /* make it an orphan */ + if(!free_images && w_curr->html.body_image) + w_curr->html.body_image->options |= IMG_ORPHANED; + } + } + + /* + * only load background image if image support is enabled and if + * we are instructed to show a background image. + */ + if(w_req->html.images_enabled && w_req->html.body_images_enabled) + { + /* current document has a background image of it's own. */ + if(w_new->html.body_image_url) + _XmHTMLLoadBodyImage(w_new, w_new->html.body_image_url); + /* + * Only load the default background image if the doc didn't have + * it's colors changed. + */ + else if(w_new->html.def_body_image_url && + w_new->html.body_fg == w_new->html.body_fg_save && + w_new->html.body_bg == w_new->html.body_bg_save && + w_new->html.anchor_fg == w_new->html.anchor_fg_save && + w_new->html.anchor_visited_fg == + w_new->html.anchor_visited_fg_save && + w_new->html.anchor_activated_fg == + w_new->html.anchor_activated_fg_save) + _XmHTMLLoadBodyImage(w_new, w_new->html.def_body_image_url); + } + /***** + * When a body image is present it is very likely that a highlight + * color based upon the current background actually makes an anchor + * invisible when highlighting is selected. Therefore we base the + * highlight color on the activated anchor background when we have a + * body image, and on the document background when no body image is + * present. + *****/ + if(w_new->html.body_image) + _XmHTMLRecomputeHighlightColor(w_new, + w_new->html.anchor_activated_fg); + else + _XmHTMLRecomputeHighlightColor(w_new, w_new->html.body_bg); + + /* only redraw if the new body image differs from the old one */ + if(w_new->html.body_image != w_curr->html.body_image) + { + /* set alpha channel processing if not yet done */ + free_images = !parse && !need_reformat; + redraw = True; + } + } + + /* anchor button state */ + if((w_req->html.anchor_buttons != w_curr->html.anchor_buttons)) + redraw = True; + + /***** + * cursor state changes. Note that we always free the current cursor, + * even if it's created by the user. + *****/ + if((w_req->html.anchor_cursor != w_curr->html.anchor_cursor) || + (w_req->html.anchor_display_cursor != + w_curr->html.anchor_display_cursor)) + { + /* set cursor to None if we don't have to use or have a cursor */ + if(!w_new->html.anchor_display_cursor || !w_new->html.anchor_cursor) + { + if(w_curr->html.anchor_cursor != None) + XFreeCursor(XtDisplay((TWidget)w_curr), + w_curr->html.anchor_cursor); + w_new->html.anchor_cursor = None; + } + /* no redraw required */ + } + + /* + * Scroll to the requested line or restore previous line if it has been + * messed up as the result of a resource change requiring a recompuation + * of the layout. + */ + if(w_req->html.top_line != w_curr->html.top_line) + { + ScrollToLine(w_new, w_req->html.top_line); + redraw = True; + } + else if(need_reformat && !parse && + w_new->html.top_line != w_curr->html.top_line) + { + ScrollToLine(w_new, w_curr->html.top_line); + redraw = True; + } + + /* check and set scrolling delay */ + if(w_req->html.repeat_delay != w_curr->html.repeat_delay) + { + if(w_new->html.vsb && XtIsManaged(w_new->html.vsb)) + XtVaSetValues(w_new->html.vsb, + XmNrepeatDelay, w_new->html.repeat_delay, NULL); + if(w_new->html.hsb && XtIsManaged(w_new->html.hsb)) + XtVaSetValues(w_new->html.hsb, + XmNrepeatDelay, w_new->html.repeat_delay, NULL); + } + /* see if we have to restart the animations if they were frozen */ + if(!w_req->html.freeze_animations && w_curr->html.freeze_animations) + _XmHTMLRestartAnimations(w_new); + + /* do we still need pointer tracking? */ + if(!w_new->html.anchor_track_callback && + !w_new->html.anchor_cursor && + !w_new->html.highlight_on_enter && + !w_new->html.motion_track_callback && + !w_new->html.focus_callback && + !w_new->html.losing_focus_callback) + w_new->html.need_tracking = False; + else + w_new->html.need_tracking = True; + + /* only recompute new layout if we haven't done so already */ + if(need_layout && !w_curr->html.in_layout && !need_reformat) + { + Layout(w_new); + redraw = True; + } + + if(redraw) + { + /* + * If free_images is still set when we get here, check if some + * images need their delayed_creation bit set. + */ + if(free_images) + { + XmHTMLImage *img; + for(img = w_new->html.images; img != NULL; img = img->next) + { + if(!ImageInfoFreed(img) && + ImageInfoDelayedCreation(img->html_image)) + { + img->options |= IMG_DELAYED_CREATION; + w_new->html.delayed_creation = True; + } + } + if(w_new->html.delayed_creation) + _XmHTMLImageCheckDelayedCreation(w_new); + } + + _XmHTMLDebug(1, ("XmHTML.c: SetValues, calling _XMHTMLClearArea.\n")); + /***** + * To make sure the new text is displayed, we need to clear + * the current contents and generate an expose event to render + * the new text. + * We can only do this when we have been realized. If we don't have + * a gc, it means we haven't been realized yet. (fix 01/26/97-01, kdh) + *****/ + if(w_new->html.gc != NULL) + _XmHTMLClearArea(w_new, 0, 0, w_new->core.width, w_new->core.height); + } + _XmHTMLDebug(1, ("XmHTML.c: SetValues End\n")); + + return(redraw); +} + +/***** +* Name: GetValues +* Return Type: void +* Description: XmHTMLWidgetClass get_values_hook method. +* In: +* +* Returns: +* nothing +*****/ +static void +GetValues(TWidget w, ArgList args, Cardinal *num_args) +{ + register int i; + + _XmHTMLDebug(1, ("XmHTML.c: GetValues Start\n")); + + for(i = 0; i < *num_args; i++) + { + _XmHTMLDebug(1, ("XmHTML.c: GetValues, requested for %s.\n", + args[i].name)); + + /* + * We return a pointer to the source text instead of letting X do it + * since the user might have freed the original text by now. + */ + if(!(strcmp(args[i].name, XmNvalue))) + { + *((char**)args[i].value) = XmHTMLTextGetSource(w); + } + } + _XmHTMLDebug(1, ("XmHTML.c: GetValues End\n")); + return; +} + +/***** +* Name: TrackMotion +* Return Type: void +* Description: mouse tracker; calls XmNanchorTrackCallback if +* entering/leaving an anchor. +* Also calls XmNmotionTrackCallback when installed. +* In: +* w: XmHTMLWidget +* event: MotionEvent structure +* params: additional args, unused +* num_parmas: no of additional args, unused +* Returns: +* nothing +*****/ +static void +TrackMotion(TWidget w, XEvent *event, String *params, Cardinal *num_params) +{ + /* need to use XtParent since we only get motion events from work_area */ + XmHTMLWidget html = XmHTML (XtParent (w)); + XMotionEvent *motion = (XMotionEvent*)event; + int x = 0, y = 0; + XmAnyCallbackStruct cbs; + + /* no needless lingering in this routine */ + if(XtClass(XtParent(w)) != xmHTMLWidgetClass) + return; + + /* ignore if we don't have to make any more feedback to the user */ + if(!html->html.need_tracking) + return; + + /* we are already on the correct anchor, just return */ + _XmHTMLFullDebug(1, ("XmHTML.c: TrackMotion Start.\n")); + + + /* save x and y position, we need it to get anchor data */ + if(event->xany.type == MotionNotify) + { + /* pass down to motion tracker callback if installed */ + if(html->html.motion_track_callback) + { + _XmHTMLFullDebug(1, ("XmHTML.c: TrackMotion, MotionNotify.\n")); + + cbs.reason = XmCR_HTML_MOTIONTRACK; + cbs.event = event; + XtCallCallbackList((TWidget)html, html->html.motion_track_callback, + &cbs); + } + x = motion->x; + y = motion->y; + } + /* + * Since we are setting a cursor in here, we must make sure we remove it + * when we no longer have any reason to use it. + */ + else + { + /* gaining focus */ + if(event->type == FocusIn && html->html.focus_callback) + { + _XmHTMLFullDebug(1, ("XmHTML.c: TrackMotion, FocusIn.\n")); + + cbs.reason = XmCR_FOCUS; + cbs.event = event; + XtCallCallbackList((TWidget)html, html->html.focus_callback, + &cbs); + XUndefineCursor(XtDisplay(w), XtWindow(w)); + return; + } + /* + * LeaveNotify Events occur when the pointer focus is transferred + * from the DrawingArea child to another window. This can occur + * when the pointer is moved outside the Widget *OR* when a + * ButtonPress event occurs ON the drawingArea. When that happens, + * the pointer focus is transferred from the drawingArea to it's + * parent, being the Widget itself. In this case the detail + * detail member of the XEnterWindowEvent will be NotifyAncestor, + * and we would want to ignore this event (as it will cause a + * flicker of the screen or an unnecessary call to any installed + * callbacks). + */ + if(event->type == LeaveNotify && + ((XEnterWindowEvent*)event)->detail == NotifyAncestor) + { + /* store ptr coords and fall through */ + x = motion->x; + y = motion->y; + } + else if(event->type==LeaveNotify||event->type==FocusOut) + { + _XmHTMLFullDebug(1, ("XmHTML.c: TrackMotion, " + "%s.\n", event->type == LeaveNotify ? + "LeaveNotify" : "FocusOut")); + + /* invalidate current selection if there is one */ + if(html->html.anchor_track_callback && + html->html.anchor_current_cursor_element) + _XmHTMLTrackCallback(html, event, NULL); + + /* loses focus, remove anchor highlight */ + if(html->html.highlight_on_enter && html->html.armed_anchor) + LeaveAnchor(html); + + html->html.armed_anchor = NULL; + html->html.anchor_current_cursor_element = NULL; + XUndefineCursor(XtDisplay(w), XtWindow(w)); + + /* final step: call focusOut callback */ + if(event->type == FocusOut && html->html.losing_focus_callback) + { + cbs.reason = XmCR_LOSING_FOCUS; + cbs.event = event; + XtCallCallbackList((TWidget)html, + html->html.losing_focus_callback, &cbs); + } + return; + } + else /* uninteresting event, throw away */ + return; + } + AnchorTrack (html, event, x, y); + + /* we are already on the correct anchor, just return */ + _XmHTMLFullDebug(1, ("XmHTML.c: TrackMotion End, over current anchor\n")); + + return; +} + +/***** +* Name: CheckAnchorUnderlining +* Return Type: void +* Description: validate anchor underlining enumeration values. +* In: +* html: target TWidget +* req: requester TWidget +* Returns: +* nothing. +*****/ +static void +CheckAnchorUnderlining(XmHTMLWidget html, XmHTMLWidget req) +{ + /* Anchor Underlining values */ + if(!XmRepTypeValidValue(underline_repid, req->html.anchor_underline_type, + (TWidget)html)) + html->html.anchor_underline_type = XmSINGLE_LINE; + else + html->html.anchor_underline_type = req->html.anchor_underline_type; + + /* Set corresponding private resources */ + switch(html->html.anchor_underline_type) + { + case XmNO_LINE: + html->html.anchor_line = NO_LINE; + break; + case XmSINGLE_DASHED_LINE: + html->html.anchor_line = LINE_DASHED|LINE_UNDER|LINE_SINGLE; + break; + case XmDOUBLE_LINE: + html->html.anchor_line = LINE_SOLID|LINE_UNDER|LINE_DOUBLE;; + break; + case XmDOUBLE_DASHED_LINE: + html->html.anchor_line = LINE_DASHED|LINE_UNDER|LINE_DOUBLE;; + break; + case XmSINGLE_LINE: /* default */ + default: + html->html.anchor_line = LINE_SOLID | LINE_UNDER | LINE_SINGLE; + break; + } + + /* Visited Anchor Underlining values */ + if(!XmRepTypeValidValue(underline_repid, + req->html.anchor_visited_underline_type, (TWidget)html)) + html->html.anchor_visited_underline_type = XmSINGLE_LINE; + else + html->html.anchor_visited_underline_type = + req->html.anchor_visited_underline_type; + + /* Set corresponding private resources */ + switch(html->html.anchor_visited_underline_type) + { + case XmNO_LINE: + html->html.anchor_visited_line = NO_LINE; + break; + case XmSINGLE_DASHED_LINE: + html->html.anchor_visited_line = LINE_DASHED|LINE_UNDER|LINE_SINGLE; + break; + case XmDOUBLE_LINE: + html->html.anchor_visited_line = LINE_SOLID|LINE_UNDER|LINE_DOUBLE; + break; + case XmDOUBLE_DASHED_LINE: + html->html.anchor_visited_line = LINE_DASHED|LINE_UNDER|LINE_DOUBLE; + break; + case XmSINGLE_LINE: /* default */ + default: + html->html.anchor_visited_line = LINE_SOLID|LINE_UNDER|LINE_SINGLE; + break; + } + + /* Target Anchor Underlining values */ + if(!XmRepTypeValidValue(underline_repid, + html->html.anchor_target_underline_type, (TWidget)html)) + req->html.anchor_target_underline_type = XmSINGLE_DASHED_LINE; + else + html->html.anchor_target_underline_type = + req->html.anchor_target_underline_type; + + /* Set corresponding private resources */ + switch(html->html.anchor_target_underline_type) + { + case XmNO_LINE: + html->html.anchor_target_line = NO_LINE; + break; + case XmSINGLE_LINE: + html->html.anchor_target_line = LINE_DASHED|LINE_UNDER|LINE_SINGLE; + break; + case XmDOUBLE_LINE: + html->html.anchor_target_line = LINE_SOLID|LINE_UNDER|LINE_DOUBLE; + break; + case XmDOUBLE_DASHED_LINE: + html->html.anchor_target_line = LINE_DASHED|LINE_UNDER|LINE_DOUBLE; + break; + case XmSINGLE_DASHED_LINE: /* default */ + default: + html->html.anchor_target_line = LINE_DASHED|LINE_UNDER|LINE_SINGLE; + break; + } +} + +/***** +* Name: CheckAlignment +* Return Type: void +* Description: checks and sets the alignment resources +* In: +* html: target TWidget +* req: requestor TWidget +* Returns: +* nothing. +*****/ +static void +CheckAlignment(XmHTMLWidget html, XmHTMLWidget req) +{ + /* Set default alignment */ + if(req->html.enable_outlining) + html->html.default_halign = XmHALIGN_JUSTIFY; + else + { + /* default alignment depends on string direction */ + if(html->html.string_direction == XmSTRING_DIRECTION_R_TO_L) + html->html.default_halign = XmHALIGN_RIGHT; + else + html->html.default_halign = XmHALIGN_LEFT; + + /* verify alignment */ + if(XmRepTypeValidValue(string_repid, req->html.alignment, (TWidget)html)) + { + if(html->html.alignment == XmALIGNMENT_BEGINNING) + html->html.default_halign = XmHALIGN_LEFT; + if(html->html.alignment == XmALIGNMENT_END) + html->html.default_halign = XmHALIGN_RIGHT; + else if(html->html.alignment == XmALIGNMENT_CENTER) + html->html.default_halign = XmHALIGN_CENTER; + } + } +} + +/***** +* Name: ExtendAdjust +* Return Type: void +* Description: buttondrag action routine. Adjusts the selection initiated +* by ExtendStart. +* In: +* +* Returns: +* nothing. +*****/ +static void +TPROTO (ExtendAdjust, TWidget w, TEvent *event, String *params, Cardinal *num_params) +{ + XmHTMLWidget html; + + /* need to use XtParent since we only get motion events from work_area */ + if(XtClass(XtParent(w)) != xmHTMLWidgetClass) + return; + + html = XmHTML (XtParent (w)); + + _XmHTMLFullDebug(1, ("XmHTML.c: ExtendAdjust Start\n")); + + _XmHTMLFullDebug(1, ("XmHTML.c: ExtendAdjust End\n")); + + return; +} + +/***** +* Name: _XmHTMLCvtStringToWarning +* Return Type: Boolean +* Description: converts a XmHTML XmCHTMLWarningType to it's internal value. +* In: +* dpy: display with which this conversion is associated; +* args: any XrmValue arguments to this converter. Always NULL; +* num_args: no of args. Always 0; +* from_val: address and size of value to be converted; +* to_val: address where the converted value must be stored; +* convert..: data to be passed to the destructor routine. Since this +* converter doesn't allocate any data, this argument is ignored. +* Returns: +* True when the conversion was successfull, False if not. +*****/ +Boolean +_XmHTMLCvtStringToWarning(Display *dpy, XrmValuePtr args, Cardinal *num_args, + XrmValuePtr from_val, XrmValuePtr to_val, XtPointer *converter_data) +{ + static String warn_styles[] = {"unknown_element", "bad", "open_block", + "close_block", "open_element", "nested", "violation"}; + Byte warn_values[] = {XmHTML_UNKNOWN_ELEMENT, XmHTML_BAD, + XmHTML_OPEN_BLOCK, XmHTML_CLOSE_BLOCK, XmHTML_OPEN_ELEMENT, + XmHTML_NESTED, XmHTML_VIOLATION}; + + String warning = NULL; + int i; + String ptr = (String)from_val->addr; + Byte ret_val = XmHTML_NONE; + + if(*num_args != 0) + { + _XmHTMLWarning(__WFUNC__(NULL, "_XmHTMLCvtStringToWarning"), + "String to Warning conversion may not have any arguments."); + return(False); + } + + /* hmm, shouldn't happen */ + if(ptr == NULL || *ptr == '\0' || from_val->size < 3) + goto end; + + /* copy so we scan it safely */ + warning = my_strndup(ptr, from_val->size); + + /* check if we have NONE */ + if(my_strcasestr(warning, "none")) + goto end; + + /* check if we have HTML_ALL */ + if(my_strcasestr(warning, "all")) + { + ret_val = XmHTML_ALL; + goto end; + } + +#define NUM_WARNINGS 7 + /* now scan the string for the possible warning types */ + for(i = 0; i < NUM_WARNINGS; i++) + { + if(my_strcasestr(warning, warn_styles[i])) + ret_val |= warn_values[i]; + } +#undef NUM_WARNINGS + + /* this is an error */ + if(ret_val == XmHTML_NONE) + { + _XmHTMLWarning(__WFUNC__(NULL, "_XmHTMLCvtStringToWarning"), + "Cannot convert string \"%s\" to XmCWarningMode.", warning); + free(warning); + return(False); + } + +end: + /* no longer needed, free it */ + if(warning != NULL) + free(warning); + + if(to_val->addr != NULL) + { + if(to_val->size < sizeof(Byte)) + { + to_val->size = sizeof(Byte); + return(False); + } + *(Byte*)to_val->addr = ret_val; + return(True); + } + else + { + static Byte static_val; + static_val = ret_val; + to_val->addr = (XtPointer)&static_val; + to_val->size = sizeof(Byte); + return(True); + } +} + diff -uNr gnome-0.10/gtk-xmhtml/XmHTML-motif.h gnome-0.11/gtk-xmhtml/XmHTML-motif.h --- gnome-0.10/gtk-xmhtml/XmHTML-motif.h Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/XmHTML-motif.h Wed Dec 24 19:52:06 1997 @@ -0,0 +1,16 @@ +/* XmHTML type defines */ +typedef struct _XmHTMLClassRec *XmHTMLWidgetClass; +typedef struct _XmHTMLRec *XmHTMLWidget; + +externalref WidgetClass xmHTMLWidgetClass; + +/* XmHTML Widget subclassing macro */ +#ifndef XmIsHTML +#define XmIsHTML(w) XtIsSubclass(w, xmHTMLWidgetClass) +#endif /* XmIsHTML */ + +/* Create a HTML widget if parent is not null and no subclass of XmGadget */ +extern Widget XmCreateHTML(Widget parent, String name, ArgList arglist, + Cardinal argcount); + +#define XmHTML(x) (XmHTMLWidget)(x) diff -uNr gnome-0.10/gtk-xmhtml/XmHTML.c gnome-0.11/gtk-xmhtml/XmHTML.c --- gnome-0.10/gtk-xmhtml/XmHTML.c Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/XmHTML.c Tue Jan 6 19:58:18 1998 @@ -0,0 +1,3184 @@ +#ifndef lint +static char rcsId[]="$Header: /debian/home/gnomecvs/gnome/gtk-xmhtml/XmHTML.c,v 1.16 1998/01/07 01:45:35 unammx Exp $"; +#endif +/***** +* XmHTML.c : XmHTML main routines +* +* This file Version $Revision: 1.16 $ +* +* Creation date: Thu Nov 21 05:02:44 GMT+0100 1996 +* Last modification: $Date: 1998/01/07 01:45:35 $ +* By: $Author: unammx $ +* Current State: $State: Exp $ +* +* Author: newt +* (C)Copyright 1995-1996 Ripley Software Development +* All Rights Reserved +* +* This file is part of the XmHTML Widget Library. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Library General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library 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 +* Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public +* License along with this library; if not, write to the Free +* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +*****/ +/***** +* ChangeLog +* $Log: XmHTML.c,v $ +* Revision 1.16 1998/01/07 01:45:35 unammx +* Gtk/XmHTML is ready to be used by the Gnome hackers now! +* Weeeeeee! +* +* This afternoon: +* +* - Changes to integrate gtk-xmhtml into an autoconf setup. +* +* - Changes to make gtk-xmhtml a library to be used by Gnome +* (simply include tags, +* so this means that the program is crashing if you pass a document +* withou the BODY. I bet this is caused by some mistake of mine in +* the handling of the old/new/current widgets as created by Motif. +* +* Miguel. +* +* Revision 1.13 1997/12/25 01:34:09 unammx +* Good news for the day: +* +* I have upgraded our XmHTML sources to XmHTML 1.1.1. +* +* This basically means that we got table support :-) +* +* Still left to do: +* +* - Set/Get gtk interface for all of the toys in the widget. +* - Frame support is broken, dunno why. +* - Form support (ie adding widgets to it) +* +* Miguel. +* +* Revision 1.12 1997/12/24 17:53:53 unammx +* Fun stuff: +* +* The widget now handles mouse motion, mouse clicks, anchors can +* be clicked. +* +* The widget emits signals for all of the interesting events +* (the same events that were used by the Motif port, we just use +* signals instead of XtCallbacks). +* +* Boring stuff: +* +* The widget now handles focusin/focusout/enternotif/leavenotify +* +* More code sharing between the Motif frontend an the Gtk +* frontned; More portability macros; +* +* Cleaned up some more the privte widget header files. +* +* Revision 1.11 1997/12/23 04:44:27 unammx +* Ok kiddies, news for the day: +* +* It scrolls nicely. +* It now displays GIFs. +* It now displays animated GIFs. +* It now displays JPEGs. +* Colors work. +* +* Weeeeee! The beginning on an XmHTML era is here ;-) +* +* The rendering engine is pretty amazing, very accurate, looks like +* Netscape on equivalent pages :-). +* +* Miguel and Federico. +* +* Revision 1.10 1997/12/19 07:06:54 unammx +* My pretty pathetic attempt at getting scrollbars displayed on the XmHTML widget is here, make fun of me - miguel +* +* Revision 1.9 1997/12/19 03:58:10 unammx +* Simple test program works! -mig&fed +* +* Revision 1.8 1997/12/18 00:39:20 unammx +* It compiles and links -miguel +* +* Revision 1.7 1997/12/17 04:40:27 unammx +* Your daily XmHTML code is here. It almost links. Only the +* images.c file is left to port. Once this is ported we are all +* set to start debugging this baby. +* +* btw, Dickscrape is a Motif based web browser that is entirely +* based on this widget, I just tested it today, very impressive. +* +* Miguel. +* +* Revision 1.6 1997/12/16 00:34:47 unammx +* More progress on the XmHTML work. This time, I did frames.c, not +* as nice as I would like it to be. +* +* It still does not link. +* +* Revision 1.5 1997/12/14 23:20:59 unammx +* it compiles. Now we need to make it link and work -mig +* +* Revision 1.4 1997/12/13 01:49:11 unammx +* your daily dose of ported XmHTML code, non functional as usual -mig +* +* Revision 1.3 1997/12/12 00:58:40 unammx +* Most of the Motif dependant code is now splitted. +* +* There are some bits still remaining in XmHTML.c, but will be +* soonish gone. +* +* As usual, it does not compile yet :-) +* +* Miguel +* +* Revision 1.2 1997/12/11 21:20:19 unammx +* Step 2: more gtk/xmhtml code, still non-working - mig +* +* Revision 1.17 1997/10/26 23:49:18 newt +* Bugfixes 10/22/97-01, 10/26/97-01 +* +* Revision 1.16 1997/08/31 17:32:33 newt +* Again some fixes in _XmHTMLMoveToPos +* +* Revision 1.15 1997/08/30 00:38:58 newt +* Anchor Highlighting, form component traversal action routines, alpha +* channel support, loads of fixes in _XmHTMLMoveToPos, DrawRedisplay and +* SetValues. +* +* Revision 1.14 1997/08/01 12:54:48 newt +* Progressive image loading changes. +* +* Revision 1.13 1997/05/28 01:38:30 newt +* Added a check on the value of the XmNmaxImageColors resource. Added a check +* on the scrollbar dimensions. Modified the SetValues method to properly deal +* with the XmNbodyImage resource. Modified XmHTMLImageFreeImageInfo to call +* _XmHTMLFreeImageInfo. +* +* Revision 1.12 1997/04/29 14:22:14 newt +* A lot of changes in SetValues, Layout, XmHTMLTextSetString. +* Added XmHTMLXYToInfo. +* +* Revision 1.11 1997/04/03 05:31:02 newt +* Modified XmHTMLImageReplace and XmHTMLImageUpdate to immediatly render an +* image whenever possible. Added the XmHTMLFrameGetChild convenience function. +* +* Revision 1.10 1997/03/28 07:05:28 newt +* Frame interface added. +* Horizontal scrolling bugfix. +* Added all remaining action routines and adjusted translation table. +* +* Revision 1.9 1997/03/20 08:04:38 newt +* XmHTMLImageFreeImageInfo, XmNrepeatDelay, changes in public image functions +* +* Revision 1.8 1997/03/11 19:49:53 newt +* Fix 03/11/97-01, SetValues. +* Added XmHTMLImageGetType, updated XmHTMLImageReplace and XmHTMLImageUpdate +* +* Revision 1.7 1997/03/04 18:45:15 newt +* ? +* +* Revision 1.6 1997/03/04 00:55:54 newt +* Delayed Image Loading changes: XmHTMLReplaceImage, XmHTMLUpdateImage +* and XmHTMLRedisplay added +* +* Revision 1.5 1997/03/02 23:06:35 newt +* Added image/imagemap support; changed expose method; added background +* image painting +* +* Revision 1.4 1997/02/11 02:05:44 newt +* Changes related to autosizing, exposure and scrolling +* +* Revision 1.3 1997/01/09 06:54:53 newt +* expanded copyright marker +* +* Revision 1.2 1997/01/09 06:42:40 newt +* XmNresizeWidth and XmNresizeHeight updates +* +* Revision 1.1 1996/12/19 02:17:03 newt +* Initial Revision +* +*****/ +#include +#include +#include +#include +#include + +#ifdef WITH_MOTIF +# include /* Fast macros */ +# include /* for keycodes in HTMLProcessInput */ +# include + +# include /* XmField, XmPartOffset and private motif funcs. */ +# include +# include /* For motif XmN macros */ + +/***** +* Test if these macros are present. They are required for conversion of the +* enumeration resource values. I don't know if they are present in Motif 1.2.X. +* If not here, spit out an error message. +* If you can't compile this because this error occurs, please contact us +* at the address given below and state what version of Motif you are using. +* Note: these are explicit syntax errors... +*****/ +#ifndef XmPartOffset + XmPartOffset macro undefined. Please contact ripley@xs4all.nl +#endif +#ifndef XmField + XmField macro undefined. Please contact ripley@xs4all.nl +#endif + +#include +#include +#include +#include + +#endif + +/* Our private header files */ +#include "XmHTMLP.h" +#include "XmHTMLfuncs.h" + +/* This is the anchor cursor */ +#include "bitmaps/fingers.xbm" +#include "bitmaps/fingers_m.xbm" + +/*** External Function Prototype Declarations ***/ +/* +* undocumented motif functions used: (declared in XmP.h): +* _XmRedisplayGadgets (Widget, XEvent*, Region); +*/ + +/*** Public Variable Declarations ***/ + +/*** Private Datatype Declarations ****/ + +static void XmHTML_Destroy(XmHTMLWidget html); +static void XmHTML_Initialize (XmHTMLWidget html, XmHTMLWidget init, char *html_source); +static void Layout(XmHTMLWidget html); +static void CheckMaxColorSetting(XmHTMLWidget html); +static void CheckPLCIntervals(XmHTMLWidget html); +static void Refresh(XmHTMLWidget html, int x, int y, int width, int height); +static void Resize(TWidget w); +void _XmHTMLClearArea(XmHTMLWidget html, int x, int y, int width, int height); +static void AnchorTrack (XmHTMLWidget html, TEvent *event, int x, int y); +static void LeaveAnchor(XmHTMLWidget html); +static void FreeExpendableResources(XmHTMLWidget html, Boolean free_img); +static void ResetWidget(XmHTMLWidget html, Boolean free_img); +static void ScrollToLine(XmHTMLWidget html, int line); + +#ifdef WITH_MOTIF +# include "XmHTML-motif.c" +#else +# include "gtk-xmhtml.c" +#endif + +/***** +* Name: XmHTML_Initialize +* Return Type: void +* Description: Called when the TWidget is instantiated +* In: +* html: Widget +* init: Optionally the original widget (Motifish support) +* html_source: html source code. +* Returns: +* nothing, but init is updated with checked/updated resource values. +*****/ +static void +XmHTML_Initialize (XmHTMLWidget html, XmHTMLWidget init, char *html_source) +{ + /* Initialize the global HTMLpart */ + _XmHTMLDebug(1, ("XmHTML.c: Initialize Start\n")); + + /* private TWidget resources */ + html->html.needs_vsb = False; + html->html.needs_hsb = False; + html->html.scroll_x = 0; + html->html.scroll_y = 0; + +#ifdef WITH_MOTIF + CheckAnchorUnderlining(html, html); +#endif + /* repeat delay. Must be positive */ + if(html->html.repeat_delay < 1) + { + _XmHTMLWarning(__WFUNC__(html, "Initialize"), + "The specified value for XmNrepeatDelay (%i) is too small.\n" + " Reset to 25", html->html.repeat_delay); + html->html.repeat_delay = 25; + } + +#ifdef WITH_MOTIF + /* Set default text alignment */ + CheckAlignment(html, html); +#endif + + /**** + * Initialize private resources. + ****/ + /* Formatted document resources */ + html->html.formatted_width = 1; + html->html.formatted_height = 1; + html->html.elements = (XmHTMLObject*)NULL; + html->html.formatted = (XmHTMLObjectTable*)NULL; + html->html.paint_start = (XmHTMLObjectTable*)NULL; + html->html.paint_end = (XmHTMLObjectTable*)NULL; + html->html.nlines = 0; + + /* body image */ + html->html.body_image = (XmHTMLImage*)NULL; + html->html.body_image_url = (String)NULL; + + /* layout & paint engine resources */ + html->html.in_layout = False; + html->html.paint_x = 0; + html->html.paint_y = 0; + html->html.paint_width = 0; + html->html.paint_height = 0; +#ifdef WITH_MOTIF + html->html.body_fg = html->manager.foreground; + html->html.body_bg = html->core.background_pixel; +#else + html->html.body_fg = GTK_WIDGET(html)->style->fg [GTK_STATE_NORMAL].pixel; + html->html.body_bg = GTK_WIDGET(html)->style->bg [GTK_STATE_NORMAL].pixel; +#endif + html->html.images = (XmHTMLImage*)NULL; + html->html.image_maps = (XmHTMLImageMap*)NULL; + html->html.xcc = (XCC)NULL; + html->html.bg_gc = (TGC)NULL; + html->html.form_data = (XmHTMLFormData*)NULL; + html->html.delayed_creation = False; /* no delayed image creation */ + + /***** + * Original colors must be stored. They can be altered by the + * element, so if we get a body without any or some of these + * colors specified, we can use the proper default values for the + * unspecified elements. + *****/ + html->html.body_fg_save = html->html.body_fg; + html->html.body_bg_save = html->html.body_bg; + html->html.anchor_fg_save = html->html.anchor_fg; + html->html.anchor_target_fg_save = html->html.anchor_target_fg; + html->html.anchor_visited_fg_save = html->html.anchor_visited_fg; + html->html.anchor_activated_fg_save = html->html.anchor_activated_fg; + html->html.anchor_activated_bg_save = html->html.anchor_activated_bg; + + /* anchor resources */ + html->html.anchor_position_x = 0; + html->html.anchor_position_y = 0; + html->html.anchor_current_cursor_element = (XmHTMLAnchor*)NULL; + html->html.armed_anchor = (XmHTMLObjectTable*)NULL; + html->html.current_anchor = (XmHTMLObjectTable*)NULL; + html->html.num_anchors = 0; + html->html.num_named_anchors = 0; + html->html.anchors = (XmHTMLWord*)NULL; + html->html.anchor_words = 0; + html->html.named_anchors = (XmHTMLObjectTable*)NULL; + html->html.anchor_data = (XmHTMLAnchor*)NULL; + html->html.press_x = 0; + html->html.press_y = 0; + html->html.pressed_time = 0; + html->html.selected_time = 0; + html->html.selected = (XmHTMLAnchor*)NULL; + + /* Text selection resources */ + html->html.selection = (XmHTMLObjectTable*)NULL; + html->html.select_start = 0; + html->html.select_end = 0; + + /* HTML Frame resources */ + html->html.nframes = 0; + html->html.frames = NULL; + html->html.is_frame = False; + + /* PLC resources */ + html->html.plc_buffer = (PLCPtr)NULL; + html->html.num_plcs = 0; + html->html.plc_proc_id = None; + html->html.plc_suspended = True; + html->html.plc_gc = (TGC)NULL; + + /* Table resources */ + html->html.tables = (XmHTMLTable*)NULL; + + /* HTML4.0 Event database */ + html->html.events = (HTEvent*)NULL; + html->html.nevents = 0; + + /* initial mimetype */ + if(!(strcasecmp(html->html.mime_type, "text/html"))) + html->html.mime_id = XmPLC_DOCUMENT; + else if(!(strcasecmp(html->html.mime_type, "text/html-perfect"))) + html->html.mime_id = XmPLC_DOCUMENT; + else if(!(strcasecmp(html->html.mime_type, "text/plain"))) + html->html.mime_id = XmHTML_NONE; + else if(!(strncasecmp(html->html.mime_type, "image/", 6))) + html->html.mime_id = XmPLC_IMAGE; + + /* alpha channel stuff */ + html->html.alpha_buffer = (AlphaPtr)NULL; + + /* FIXME: Gtk: we need to set need_tracking correctly */ + if(!html->html.anchor_track_callback && !html->html.anchor_cursor && + !html->html.highlight_on_enter && !html->html.motion_track_callback && + !html->html.focus_callback && !html->html.losing_focus_callback) + html->html.need_tracking = False; + else + html->html.need_tracking = True; + + /* verify plc timing intervals */ + CheckPLCIntervals(html); + + /* Misc. resources */ + html->html.gc = (TGC)NULL; + + /* set maximum amount of colors for this display (also creates the XCC) */ + CheckMaxColorSetting(html); + + /* Create the anchor cursor (if any) */ + if(html->html.anchor_display_cursor && !(html->html.anchor_cursor)) + CreateAnchorCursor(XmHTML(init)); + + /* set cursor to None if we don't have to use or have a cursor */ + if(!html->html.anchor_display_cursor || !html->html.anchor_cursor) + html->html.anchor_cursor = None; + + /* Select & initialize appropriate font cache */ + html->html.default_font = _XmHTMLSelectFontCache(html, True); + + /***** + * if no width or height was specified, default to the width of 20 em + * (TeX measure for average character width) in the default font and the + * height of a single line. We need to do this check since the Core + * initialize() method doesn't do it. + *****/ +#ifdef WITH_MOTIF +# define XF(font) (font) +#else +# define XF(font) ((XFontStruct *)((GdkFontPrivate *)font)) +#endif + if(Toolkit_Widget_Dim (html).width <= 0) + { + unsigned long value = 0; + if(!(XGetFontProperty(XF (html->html.default_font->xfont), XA_QUAD_WIDTH, &value))) + { + XCharStruct ch; + int dir, ascent, descent; + XTextExtents(XF (html->html.default_font->xfont), "m", 1, &dir, &ascent, + &descent, &ch); + value = (Cardinal)ch.width; + /* sanity for non-ISO fonts */ + if(value <= 0) + value = 16; + } + Toolkit_Widget_Dim (html).width = (Dimension)(20*(Dimension)value + + 2*html->html.margin_width); + } + if(Toolkit_Widget_Dim (html).height <= 0) + Toolkit_Widget_Dim (html).height = html->html.default_font->lineheight + + 2*html->html.margin_height; + + /***** + * Now create all private TWidgets: drawing area and scrollbars. + * We couldn't do this until we knew for sure the TWidget dimensions were + * set; creation of the work_area uses them. + *****/ + CreateHTMLWidget(html); + + /* Parse the raw HTML text */ + if(html_source) + { + html->html.source = strdup(html_source); + html->html.elements = _XmHTMLparseHTML(html, NULL, html_source, NULL); + + /* check for frames */ + html->html.nframes = _XmHTMLCheckForFrames(html, html->html.elements); + + /* and create them */ + if(!_XmHTMLCreateFrames(NULL, html)) + { + html->html.frames = NULL; + html->html.nframes = 0; + } + /* Trigger link callback */ + if(CHECK_CALLBACK (html, link_callback, LINK)) + _XmHTMLLinkCallback(html); + + /* do initial document markup */ + _XmHTMLformatObjects(html, html); + + /* check for possible delayed external imagemaps */ + _XmHTMLCheckImagemaps(html); + } + else + { + html->html.source = (String)NULL; + html->html.elements = (XmHTMLObject*)NULL; + html->html.nframes = 0; + html->html.formatted = (XmHTMLObjectTable*)NULL; + } + + /* reset scrollbars (this will also resize the work_area) */ + CheckScrollBars(html); + + /* Final step: add a palette if we must dither */ + if(html->html.map_to_palette != XmDISABLED) + _XmHTMLAddPalette(html); + + _XmHTMLDebug(1, ("XmHTML.c: Initialize End.\n")); +} + + +/***** +* Name: _XmHTMLGetLineObject +* Return Type: void +* Description: get the object located at the given y position. +* In: +* html: XmHTMLWidget +* y_pos: current text y position. +* Returns: +* located element. +*****/ +static XmHTMLObjectTableElement +_XmHTMLGetLineObject(XmHTMLWidget html, int y_pos) +{ + register XmHTMLObjectTableElement tmp = NULL; + + /* + * y_pos given must fall in the bounding box of an element. + * We try to be a little bit smart here: + * If we have a paint engine end and it's y position is below the + * requested position, walk forwards until we find a match. + * If we have a paint engine start and it's y position is below the + * requested position, walk forwards. If it's above the requested position, + * walk backwards. We are always bound to find a matching element. + */ + if(html->html.paint_end || html->html.paint_start) + { + /* located above paint engine end, walk forwards */ + if(html->html.paint_end && html->html.paint_end->y < y_pos) + { + for(tmp = html->html.paint_end; tmp != NULL; tmp = tmp->next) + if(y_pos >= tmp->y && y_pos < tmp->y + tmp->height) + break; + } + /* not found or no paint engine end */ + else if(html->html.paint_start) + { + /* located above paint engine start, walk forwards */ + if(html->html.paint_start->y < y_pos) + { + for(tmp = html->html.paint_start; tmp != NULL; tmp = tmp->next) + if(y_pos >= tmp->y && y_pos < tmp->y + tmp->height) + break; + } + /* located under paint engine start, walk backwards */ + else + { + for(tmp = html->html.paint_start; tmp != NULL; tmp = tmp->prev) + if(y_pos >= tmp->y && y_pos < tmp->y + tmp->height) + break; + } + } + } + /* neither paint engine start or end */ + else + for(tmp = html->html.formatted; tmp != NULL; tmp = tmp->next) + if(y_pos >= tmp->y && y_pos < tmp->y + tmp->height) + break; + + /* top or bottom element */ + if(tmp == NULL || tmp->prev == NULL) + { + /* bottom element */ + if(tmp == NULL) + return(html->html.formatted); + /* top element otherwise */ + return(NULL); + } + return((tmp->y > y_pos ? tmp->prev : tmp)); +} + +/***** +* Name: SetCurrentLineNumber +* Return Type: void +* Description: get & set the linenumber of the line at the top of the +* working area. +* In: +* html: XmHTMLWidget +* y_pos: current text y position. +* Returns: +* nothing, but the top_line field of the htmlRec is updated. +*****/ +static void +SetCurrentLineNumber(XmHTMLWidget html, int y_pos) +{ + XmHTMLObjectTableElement tmp; + + _XmHTMLDebug(1, ("XmHTML.c: SetCurrentLineNumber, y_pos = %i\n", y_pos)); + + if((tmp = _XmHTMLGetLineObject(html, y_pos)) != NULL) + { + + _XmHTMLDebug(1, ("XmHTML.c: SetCurrentLineNumber, object found, " + "y_pos = %i, linenumber = %i\n", tmp->y, tmp->line)); + + /* set line number for the found object */ + html->html.top_line = tmp->line; + /* + * If the current element has got more than one word in it, and these + * words span accross a number of lines, adjust the linenumber. + */ + if(tmp->n_words > 1 && tmp->words[0].y != tmp->words[tmp->n_words-1].y) + { + int i; + for(i = 0 ; i < tmp->n_words && tmp->words[i].y < y_pos; i++); + if(i != tmp->n_words) + html->html.top_line = tmp->words[i].line; + } + } + else + html->html.top_line = 0; + + _XmHTMLDebug(1, ("XmHTML.c: SetCurrentLineNumber, top_line = %i\n", + html->html.top_line)); +} + + +/***** +* Name: Layout +* Return Type: void +* Description: main layout algorithm. +* computes text layout and configures the scrollbars. +* Also does handles image recreation. +* In: +* html: TWidget to layout +* Returns: +* nothing +*****/ +static void +Layout(XmHTMLWidget html) +{ + XmHTMLObjectTableElement curr_ele = NULL; + + _XmHTMLDebug(1, ("XmHTML.c: Layout Start\n")); + + /* set blocking flag */ + html->html.in_layout = True; + + /* remember current vertical position if we have been scrolled */ + if(html->html.scroll_y) + curr_ele = _XmHTMLGetLineObject(html, html->html.scroll_y); + + /* make a resize request if we have to do auto-sizing in either direction */ + if(html->html.resize_width || html->html.resize_height) + autoSizeWidget(html); + else + _XmHTMLComputeLayout(html); + + /* set new vertical scrollbar positions */ + if(curr_ele != NULL) + html->html.scroll_y = curr_ele->y; + else + html->html.scroll_y = 0; + + /* configure the scrollbars, will also resize work_area */ + CheckScrollBars(html); + + html->html.in_layout = False; + _XmHTMLDebug(1, ("XmHTML.c: Layout End\n")); + return; +} + +/***** +* Name: Resize +* Return Type: void +* Description: xmHTMLWidgetClass resize method. +* In: +* w: resized TWidget. +* Returns: +* nothing +*****/ +static void +Resize(TWidget w) +{ + Boolean do_expose; + XmHTMLWidget html = XmHTML(w); + int foo, vsb_width; + Display *dpy; + TWindow win; + + _XmHTMLDebug(1, ("XmHTML.c: Resize Start\n")); + + /* No needless resizing */ + if(!Toolkit_Widget_Is_Realized(w)) + { + _XmHTMLDebug(1, ("XmHTML.c: Resize end, TWidget not realized.\n")); + return; + } + + if(html->html.in_layout) + { + _XmHTMLDebug(1, ("XmHTML.c: Resize end, layout flag is set.\n")); + return; + } + + GetScrollDim(html, &foo, &vsb_width); + + /* No change in size, return */ + if((Toolkit_Widget_Dim (html).height == html->html.work_height) && + (Toolkit_Widget_Dim (html).width == (html->html.work_width + html->html.margin_width + + vsb_width))) + { + _XmHTMLDebug(1, ("XmHTML.c: Resize End, no change in size\n")); + return; + } + + dpy = Toolkit_Display (html->html.work_area); + win = Toolkit_Widget_Window (html->html.work_area); + + /* + * Check if we have to do layout and generate an expose event. + * When the TWidget shrinks, X does not generate an expose event. + * We want to recompute layout and generate an expose event when the + * width changes. + * When the height increases, we only want to generate a partial + * exposure (this gets handled in Redisplay). + */ + do_expose = (Toolkit_Widget_Dim (html).width != (html->html.work_width + + html->html.margin_width + vsb_width)); + + _XmHTMLDebug(1, ("XmHTML.c: Resize, new window dimensions: %ix%i.\n", + Toolkit_Widget_Dim (html).width - html->html.margin_width, html->html.work_height)); + _XmHTMLDebug(1, ("XmHTML.c: Resize, generating expose event : %s.\n", + (do_expose ? "yes" : "no"))); + + /* Clear current visible text */ + if(do_expose) + { + /* + * save new height & width of visible area. + * subtract margin_width once to minimize number of calcs in + * the paint routines: every thing rendered starts at an x position + * of margin_width. + */ + html->html.work_width = Toolkit_Widget_Dim (html).width - html->html.margin_width - + vsb_width; + html->html.work_height= Toolkit_Widget_Dim (html).height; + + /* Recompute layout */ + Layout(html); + + /* Clear current text area and generate an expose event */ + Toolkit_Widget_Repaint (html); + } + /* change in height */ + else + { + /* + * Get new start & end points for the paint engine + * We have two cases: shrink or stretch. + * When stretched, we generate an exposure event for the added + * area and let DrawRedisplay figure it out. If shrunk, adjust + * end point for the paint engine. + */ + + /* Window has been stretched */ + if(html->html.work_height < Toolkit_Widget_Dim (html).height) + { + /* + * formatted_height has some formatting offsets in it. Need + * to subtract them first. + */ + int max = html->html.formatted_height - html->html.margin_height - + html->html.default_font->xfont->descent; + /* + * If the stretch is so large that the entire text will fit + * in the new window height, remove the scrollbars by resetting + * the vertical scrollbar position. + */ + if(Toolkit_Widget_Dim (html).height > max) + html->html.scroll_y = 0; + + /* save new height */ + html->html.work_height = Toolkit_Widget_Dim (html).height; + + /* reset scrollbars (this will also resize the work_area) */ + CheckScrollBars(html); + + /* + * just clear the entire area. Will generate a double exposure + * but everything will be painted as it should. + */ + Toolkit_Widget_Repaint (html); + } + /* window has been shrunk */ + else + { + XmHTMLObjectTable *start, *end; + int y; + + /* get new y maximum */ + y = html->html.scroll_y + Toolkit_Widget_Dim (html).height; + + /* Starting point is end of previous stream */ + start = (html->html.paint_end == NULL ? html->html.formatted: + html->html.paint_end); + + /* Walk backwards until we reach the desired height */ + for(end = start; end != NULL && y >= end->y; end = end->prev); + + /* save end point */ + html->html.paint_end = end; + + /* save new height */ + html->html.work_height = Toolkit_Widget_Dim (html).height; + + /* reset scrollbars (this will also resize the work_area) */ + CheckScrollBars(html); + + /* no need to paint */ + } + } + /* resize XmHTML's frame childs */ + if(html->html.nframes) + { + _XmHTMLDebug(1, ("XmHTML.c: Resize, calling ReconfigureFrames\n")); + _XmHTMLReconfigureFrames(html); + } + + SetScrollBars(html); + + _XmHTMLDebug(1, ("XmHTML.c: Resize End\n")); + + return; +} + +/***** +* Name: PaintBackground +* Return Type: void +* Description: update background with the given region +* In: +* html: XmHTMLWidget for which to do background painting. +* x,y: origin of region to update +* width,height: dimensions of region to update. +* Returns: +* nothing. +* Note: +* A simple and beautiful routine that does it's job perfectly! +*****/ +static void +PaintBackground(XmHTMLWidget html, int x, int y, int width, int height) +{ +#ifdef WITH_MOTIF + XGCValues values; + unsigned long valuemask; +#endif + Display *dpy; + int tile_width, tile_height, x_dist, y_dist, ntiles_x, ntiles_y; + int x_offset, y_offset, tsx, tsy; + + _XmHTMLDebug(1, ("XmHTML.c: PaintBackground start, x = %i, y = %i, " + "width = %i, height = %i\n", x, y, width, height)); + + /***** + * We need to figure out a correct starting point for the first + * tile to be drawn (ts_[x,y]_origin in the GC). + * We know the region to update. First we need to get the number of tiles + * drawn so far. Since we want the *total* number of tiles drawn, we must + * add the scroll offsets to the region origin. + *****/ + tile_width = html->html.body_image->width; + tile_height = html->html.body_image->height; + + _XmHTMLDebug(1, ("XmHTML.c: PaintBackground, tile width = %i, " + "tile height = %i\n", tile_width, tile_height)); + + x_dist = html->html.scroll_x + x; + y_dist = html->html.scroll_y + y; + + ntiles_x = (int)(x_dist/tile_width); + ntiles_y = (int)(y_dist/tile_height); + + _XmHTMLDebug(1, ("XmHTML.c: PaintBackground, no of full horizontal " + "tiles: %i (x_dist = %i)\n", ntiles_x, x_dist)); + _XmHTMLDebug(1, ("XmHTML.c: PaintBackground, no of full vertical " + "tiles : %i (y_dist = %i)\n", ntiles_y, y_dist)); + /* + * Now we know how many full tiles have been drawn, we can calculate + * the horizontal and vertical shifts required to start tiling on a + * tile boundary. + */ + x_offset = x_dist - ntiles_x * tile_width; + y_offset = y_dist - ntiles_y * tile_height; + + _XmHTMLDebug(1, ("XmHTML.c: PaintBackground, computed horizontal " + "offset: %i\n", x_offset)); + _XmHTMLDebug(1, ("XmHTML.c: PaintBackground, computed vertical " + "offset : %i\n", y_offset)); + /* + * Now we can compute the x and y tile origins. Note that these can + * be negative. + */ + tsx = x - x_offset; + tsy = y - y_offset; + + _XmHTMLDebug(1, ("XmHTML.c: PaintBackground, computed horizontal tile " + "origin: %i (x = %i)\n", tsx, x)); + _XmHTMLDebug(1, ("XmHTML.c: PaintBackground, computed vertical tile " + "origin : %i (y = %i)\n", tsy, y)); + + dpy = Toolkit_Display (html->html.work_area); + +#if WITH_MOTIF + valuemask = GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin; + values.fill_style = FillTiled; + values.tile = html->html.body_image->pixmap; + values.ts_x_origin = tsx; + values.ts_y_origin = tsy; + + XChangeGC(dpy, html->html.bg_gc, valuemask, &values); +#else + gdk_gc_set_fill (html->html.bg_gc, GDK_TILED); + gdk_gc_set_tile (html->html.bg_gc, html->html.body_image->pixmap); + gdk_gc_set_ts_origin (html->html.bg_gc, tsx, tsy); +#endif + + /* a plain fillrect will redraw the background portion */ + Toolkit_Fill_Rectangle(dpy, Toolkit_Widget_Window(html->html.work_area), + html->html.bg_gc, x, y, width, height); + + _XmHTMLDebug(1, ("XmHTML.c: PaintBackground end\n")); +} + +/***** +* Name: Refresh +* Return Type: void +* Description: main screen refresher: given an exposure rectangle, this +* routine determines the proper paint engine start and end +* points and calls the painter. +* In: +* html: XmHTMLWidget id +* x,y: upper-left corner of exposure region +* width: width of exposure region +* height: height of exposure region +* Returns: +* nothing. +*****/ +static void +Refresh(XmHTMLWidget html, int x, int y, int width, int height) +{ + int x1, x2, y1, y2, dy; + XmHTMLObjectTable *start, *end; + + _XmHTMLDebug(1, ("XmHTML.c: Refresh Start\n")); + + x1 = x; + x2 = x1 + width; + + /* + * Update background with the given region. Must check if body image + * hasn't been delayed or is being loaded progressively or we will get + * some funny effects... + */ + if(html->html.body_image && !ImageDelayedCreation(html->html.body_image) && + BodyImageLoaded(html->html.body_image->html_image)) + PaintBackground(html, x, y, width, height); + + /* + * We add the fontheight to the height of the exposure region. This will + * ensure that the line right under the exposure region is also redrawn + * properly. Same for topmost position, but subtraction instead of addition. + */ + dy = html->html.default_font->lineheight; + y1 = (y - dy > 0 ? y - dy : y); + y2 = y1 + height + 1.5*dy; + + _XmHTMLDebug(1, ("XmHTML.c: Refresh, initial y1: %i, y2: %i\n", y1, y2)); + + /* add vertical scroll and core offsets */ + y1 += html->html.scroll_y - Toolkit_Widget_Dim (html).y; + y2 += html->html.scroll_y + Toolkit_Widget_Dim (html).y; + + _XmHTMLDebug(1, ("XmHTML.c: Refresh, using y1: %i, y2: %i (scroll_y = %i, " + "core.y = %i)\n", y1, y2, html->html.scroll_y, Toolkit_Widget_Dim (html).y)); + + /* + * If the offset of the top of the exposed region is higher than + * the max height of the text to display, the exposure region + * is empty, so we just return here and leave everything untouched. + */ + if(y1 > html->html.formatted_height) + { + _XmHTMLDebug(1, ("XmHTML.c: Refresh End, y1 > maximum document " + " height\n")); + html->html.top_line = html->html.nlines; + return; + } + + /* + * Get paint stream start & end for the obtained exposure region + * We have to take the height of the object into account as well. + * We try to be a little bit smart here. + * paint_start == NULL is a valid stream command, so check it. + */ + start = (html->html.paint_start ? + html->html.paint_start : html->html.formatted); + + /* below current paint engine start, scrolling down */ + if(y1 > start->y) + { + /* already in region, get first object in it */ + if(y1 < (start->y + start->height)) + { + _XmHTMLDebug(1, ("XmHTML.c: Refresh, walking bottom-up, " + "y_start = %i\n", start->y)); + while(start && y1 > start->y && y1 < (start->y + start->height)) + start = start->prev; + } + /* below region, walk forward until we hit first object */ + else + { + _XmHTMLDebug(1, ("XmHTML.c: Refresh, walking bottom-down, " + "y_start = %i\n", start->y)); + while(start) + { + if(y1 > start->y && y1 < (start->y + start->height)) + break; + start = start->next; + } + } + } + /* above current paint engine start, scrolling up */ + else + { + _XmHTMLDebug(1, ("XmHTML.c: Refresh, walking top-up, " + "y_start = %i\n", start->y)); + while(start && y1 <= start->y) + start = start->prev; + /* get first object with same y position */ + while(start && start->prev && start->y == start->prev->y) + start = start->prev; + } + + /* sanity check */ + if(start == NULL) + start = html->html.formatted; + end = start; + + /* get first point at bottom of exposed region */ + while(end && y2 > end->y) + end = end->next; + /* now walk to the last point still inside the region */ + while(end && y2 > end->y && y2 < (end->y + end->height)) + end = end->next; + + /* set proper paint engine start & end */ + html->html.paint_start = start; + html->html.paint_end = end; + + /* Set horizontal painting positions */ + html->html.paint_x = x1 + html->html.scroll_x - Toolkit_Widget_Dim (html).x; + html->html.paint_width = x2 + html->html.scroll_x + Toolkit_Widget_Dim (html).x; + + /* Set vertical painting positions */ + html->html.paint_y = y1; + html->html.paint_height = y2; + + _XmHTMLDebug(1, ("XmHTML.c: Refresh, x1 = %i, x2 = %i\n", x1, x2)); + _XmHTMLDebug(1, ("XmHTML.c: Refresh, y1 = %i, y2 = %i\n", y1, y2)); + _XmHTMLDebug(1, ("XmHTML.c: Refresh, paint_start->x = %i, paint_start->y " + "= %i\n", start->x, start->y)); +#ifdef DEBUG + if(end) + _XmHTMLDebug(1, ("XmHTML.c: Refresh, paint_end->x = %i, paint_end->y " + "= %i\n", end->x, end->y)); + else + _XmHTMLDebug(1, ("XmHTML.c: Refresh, paint_end is NULL!\n")); +#endif + + if(html->html.gc == NULL) + return; + + _XmHTMLDebug(1, ("XmHTML.c: Refresh, calling _XmHTMLPaint\n")); + _XmHTMLPaint(html, html->html.paint_start, html->html.paint_end); + +#if 0 + /* doesn't work yet */ + if(html->html.is_frame && html->html.frame_border) + _XmHTMLDrawFrameBorder(html); +#endif + + /* display scrollbars */ + SetScrollBars(html); +} + +/***** +* Name: ResetWidget +* Return Type: void +* Description: resets all non-persistent resources to their defaults +* In: +* html: XmHTMLWidget id +* free_img: true when images should be freed. This will only be True +* when the TWidget has received a new source. +* Returns: +* nothing +*****/ +static void +ResetWidget(XmHTMLWidget html, Boolean free_img) +{ + /* reset some important vars */ + html->html.anchors = (XmHTMLWord*)NULL; + html->html.anchor_words = 0; + html->html.named_anchors = (XmHTMLObjectTable*)NULL; + html->html.num_named_anchors = 0; + html->html.anchor_current_cursor_element = (XmHTMLAnchor*)NULL; + html->html.armed_anchor = (XmHTMLObjectTable*)NULL; + html->html.current_anchor = (XmHTMLObjectTable*)NULL; + html->html.selected = (XmHTMLAnchor*)NULL; + html->html.selection = (XmHTMLObjectTable*)NULL; + html->html.select_start = 0; + html->html.select_end = 0; + html->html.scroll_x = 0; + html->html.scroll_y = 0; + html->html.formatted_width = 1; + html->html.formatted_height = 1; + html->html.paint_start = (XmHTMLObjectTable*)NULL; + html->html.paint_end = (XmHTMLObjectTable*)NULL; + html->html.paint_x = 0; + html->html.paint_y = 0; + html->html.paint_width = 0; + html->html.paint_height = 0; + html->html.scroll_x = 0; + html->html.scroll_y = 0; + html->html.top_line = 0; + /* fix 02/26/97-01, kdh */ + html->html.paint_start = (XmHTMLObjectTable*)NULL; + html->html.paint_end = (XmHTMLObjectTable*)NULL; + + /* Reset all colors */ + html->html.body_fg = html->html.body_fg_save; + html->html.body_bg = html->html.body_bg_save; + html->html.anchor_fg = html->html.anchor_fg_save; + html->html.anchor_target_fg = html->html.anchor_target_fg_save; + html->html.anchor_visited_fg = html->html.anchor_visited_fg_save; + html->html.anchor_activated_fg = html->html.anchor_activated_fg_save; + html->html.anchor_activated_bg = html->html.anchor_activated_bg_save; + html->html.image_maps = (XmHTMLImageMap*)NULL; + + /* and reset image stuff if it was freed */ + if(free_img) + { + /* must reset body_image as well since it also has been freed */ + html->html.body_image = (XmHTMLImage*)NULL; + html->html.images = (XmHTMLImage*)NULL; + html->html.body_image_url = (String)NULL; + html->html.alpha_buffer = (AlphaPtr)NULL; + /* only reset when we aren't dithering */ + if(html->html.map_to_palette == XmDISABLED) + html->html.xcc = (XCC)NULL; + } +} + +/***** +* Name: FreeExpendableResources +* Return Type: void +* Description: frees all non-persistent resources of a TWidget +* In: +* html: XmHTMLWidget id +* free_img: true when images should be freed. This will only be True +* when the TWidget has received a new source. +* Returns: +* nothing +*****/ +static void +FreeExpendableResources(XmHTMLWidget html, Boolean free_img) +{ + /* Free anchor worddata */ + if(html->html.anchor_words) + free(html->html.anchors); + html->html.anchors = (XmHTMLWord*)NULL; + + /* Free named anchor data */ + if(html->html.num_named_anchors) + free(html->html.named_anchors); + html->html.named_anchors = (XmHTMLObjectTable*)NULL; + + /***** + * Always free imagemaps, anchor data becomes invalid!! + * (fix 09/17/97-02, kdh) + *****/ + _XmHTMLFreeImageMaps(html); + html->html.image_maps = (XmHTMLImageMap*)NULL; + + /* clear the images if we have to */ + if(free_img) + { + /* Free all images (also clears xcc & alpha channel stuff) */ + XmHTMLImageFreeAllImages((TWidget)html); + + /* must reset body_image as well since it also has been freed */ + html->html.body_image = (XmHTMLImage*)NULL; + html->html.images = (XmHTMLImage*)NULL; + html->html.delayed_creation = False; /* no delayed image creation */ + html->html.alpha_buffer = (AlphaPtr)NULL; + /* only reset when we aren't dithering */ + if(html->html.map_to_palette == XmDISABLED) + html->html.xcc = (XCC)NULL; + } + else + { + /***** + * We need to orphan all images: the formatter will be called shortly + * after this routine returns and as a result of that the owner + * of each image will become invalid. Not orphanizing them would + * lead to a lot of image copying. + * Info structures with the XmIMAGE_DELAYED_CREATION bit need to + * propagate this info to their parent, or chances are that alpha + * channeling will *not* be redone when required. + * Must not forget to set the global delayed_creation flag or nothing + * will happen. + *****/ + register XmHTMLImage *img; + for(img = html->html.images; img != NULL; img = img->next) + { + img->owner = NULL; /* safety */ + img->options |= IMG_ORPHANED; + if(!ImageInfoFreed(img) && + ImageInfoDelayedCreation(img->html_image)) + { + img->options |= IMG_DELAYED_CREATION; + html->html.delayed_creation = True; + } + } + } + /* Free any allocated document colors */ + _XmHTMLFreeColors(html); +} + +/***** +* Name: XmHTML_Destroy +* Return Type: void +* Description: Frontend indepentent destroy routine. +* In: +* w: TWidget to destroy +* Returns: +* nothing +*****/ +static void +XmHTML_Destroy(XmHTMLWidget html) +{ + _XmHTMLDebug(1, ("XmHTML.c: XmHTML_Destroy Start\n")); + + /* First kill any outstanding PLC's */ + _XmHTMLKillPLCCycler(html); + + /* release event database */ + _XmHTMLFreeEventDatabase(html, html); + + /* Free list of parsed HTML elements */ + html->html.elements = _XmHTMLparseHTML(html, html->html.elements, NULL, NULL); + + /* Free list of formatted HTML elements */ + _XmHTMLformatObjects(html, html); + + + /* Free list of form data */ + _XmHTMLFreeForm(html, html->html.form_data); + html->html.form_data = (XmHTMLFormData*)NULL; + + /* free all non-persitent resources and destroy the images */ + FreeExpendableResources(html, True); + + /* free the XColorContext (can be here if we are using a fixed palette) */ + XCCFree(html->html.xcc); + + /***** + * Free list of frames. It is important that the images are destroyed + * *before* the frames themselves get destroyed: frames can also have + * images, and destroying the frame before destroying the image data + * causes havoc. _XmHTMLDestroyFrames invokes XtDestroyWidget to destroy + * each of XmHTML's frame childs, which invokes this routine and so on. + *****/ + if(html->html.nframes) + _XmHTMLDestroyFrames(html, html->html.nframes); + + /* free all fonts for this TWidget's instance */ + _XmHTMLUnloadFonts(html); + + /* free cursors */ + if(html->html.anchor_cursor != None) + Toolkit_Free_Cursor (XtDisplay(w), html->html.anchor_cursor); + + /* Free GC's */ + if(html->html.gc) + Toolkit_GC_Free (XtDisplay(html), html->html.gc); + if(html->html.bg_gc) + Toolkit_GC_Free (XtDisplay(html), html->html.bg_gc); + + _XmHTMLDebug(1, ("XmHTML.c: XmHTML_Destroy End\n")); + return; +} + +/***** +* Name: GetAnchor +* Return Type: XmHTMLWord* +* Description: determines if the given x and y positions are within the +* bounding rectangle of an anchor. +* In: +* w: HTML TWidget to check +* x,y: position to validate +* Returns: +* A ptr. to the anchor data or NULL. +* Note: +* anchor_words is an array that _only_ contains anchor data. Although +* it requires a bit more memory, it's worth it since it will be a fast +* lookup. +*****/ +static XmHTMLWord* +GetAnchor(XmHTMLWidget html, int x, int y) +{ + XmHTMLWord *anchor_word = NULL; + int ys, xs; + register int i; + + xs = x + html->html.scroll_x; + ys = y + html->html.scroll_y; + + for(i = 0 ; i < html->html.anchor_words; i++) + { + anchor_word = &(html->html.anchors[i]); + if((xs >= anchor_word->x && xs<=(anchor_word->x+anchor_word->width)) && + (ys>=anchor_word->y && ys<=(anchor_word->y+anchor_word->height))) + { + _XmHTMLFullDebug(1, ("XmHTML.c: GetAnchor, anchor is: %s\n", + anchor_word->owner->anchor->href)); + + /* store line number */ + anchor_word->owner->anchor->line = anchor_word->line; + return(anchor_word); + } + } + _XmHTMLFullDebug(1, ("XmHTML.c: GetAnchor, no match found\n")); + + return(NULL); +} + +/***** +* Name: GetImageAnchor +* Return Type: XmHTMLAnchor* +* Description: determines if the given x and y positions lie upon an image +* that has an imagemap +* In: +* html: HTML TWidget to check +* x,y: position to validate +* Returns: +* A ptr. to the anchor data or NULL. +*****/ +static XmHTMLAnchor* +GetImageAnchor(XmHTMLWidget html, int x, int y) +{ + XmHTMLImage *image = html->html.images; + XmHTMLAnchor *anchor = NULL; + int ys, xs; + XmHTMLImageMap *imagemap = NULL; + + xs = x + html->html.scroll_x; + ys = y + html->html.scroll_y; + + /* don't do this if we haven't got any imagemaps */ + if(html->html.image_maps == NULL) + return(NULL); + + _XmHTMLFullDebug(1, ("XmHTML.c: GetImageAnchor, xs = %i, ys = %i\n", + xs, ys)); + + for(image = html->html.images; image != NULL; image = image->next) + { +#ifdef DEBUG + if(image->owner) + { + _XmHTMLFullDebug(1, ("XmHTML.c: GetImageAnchor, checking %s, " + "x = %i, y = %i\n", image->url, image->owner->x, + image->owner->y)); + } + else + { + _XmHTMLFullDebug(1, ("XmHTML.c: GetImageAnchor, checking %s " + "(no owner).", image->url)); + } +#endif + if(image->owner && (xs >= image->owner->x && + xs <= (image->owner->x + image->owner->width)) && + (ys >= image->owner->y && + ys <= (image->owner->y + image->owner->height))) + { + if(image->map_type != XmMAP_NONE) + { + if(image->map_type == XmMAP_SERVER) + { + _XmHTMLWarning(__WFUNC__(html, "GetImageAnchor"), + "server side imagemaps not supported yet."); + return(NULL); + } + if((imagemap = _XmHTMLGetImagemap(html, image->map_url)) != NULL) + { + if((anchor = _XmHTMLGetAnchorFromMap(html, x, y, image, + imagemap)) != NULL) + { + _XmHTMLDebug(1, ("XmHTML.c: GetImageAnchor, anchor " + "is: %s\n", anchor->href)); + return(anchor); + } + } + + } + } + } + _XmHTMLFullDebug(1, ("XmHTML.c: GetImageAnchor, no match found\n")); + + return(NULL); +} + +/***** +* Name: PaintAnchorUnselected +* Return Type: void +* Description: paints the currently active anchor in an unactivated state. +* _XmHTMLPaint will do the proper rendering. +* In: +* w: HTML TWidget of which to unset the current anchor +* Returns: +* nothing. +*****/ +static void +PaintAnchorUnSelected(XmHTMLWidget html) +{ + XmHTMLObjectTable *start, *end; + + start = html->html.current_anchor; + + /* pick up the anchor end. An anchor ends when the raw worddata changes. */ + for (end = start; end != NULL && end->object == start->object; end = end->next) + end->anchor_state = ANCHOR_UNSELECTED; + + _XmHTMLFullDebug(1, ("XmHTML.c: PaintAnchorUnselected, unselecting " + "anchor: %s\n", start->anchor->href)); + + /* paint it... */ + _XmHTMLPaint(html, start, end); + + /* ...and invalidate current selection */ + html->html.current_anchor = NULL; +} + +/***** +* Name: PaintAnchorSelected +* Return Type: void +* Description: paints the current active in an activated state. +* _XmHTMLPaint will do the proper rendering. +* In: +* html: HTML TWidget of which to set the current anchor +* Returns: +* nothing. +*****/ +static void +PaintAnchorSelected(XmHTMLWidget html, XmHTMLWord *anchor) +{ + XmHTMLObjectTable *start, *end; + + /* save as the current active anchor */ + start = html->html.current_anchor = anchor->owner; + + start = anchor->owner; + + /* pick up anchor end. */ + for(end = start; end != NULL && end->object == start->object; end = end->next) + end->anchor_state = ANCHOR_SELECTED; + + _XmHTMLFullDebug(1, ("XmHTML.c: PaintAnchorSelected, selecting anchor: " + "%s\n", start->anchor->href)); + + /* paint it */ + _XmHTMLPaint(html, start, end); +} + +/***** +* Name: LeaveAnchor +* Return Type: void +* Description: remove anchor highlighting. +* In: +* html: HTML TWidget of which to set the current anchor +* Returns: +* nothing. +*****/ +static void +LeaveAnchor(XmHTMLWidget html) +{ + XmHTMLObjectTable *start, *end; + + /* save as the current active anchor */ + start = html->html.armed_anchor; + + /* pick up the anchor end. */ + for(end = start; end != NULL && end->object == start->object; end = end->next) + end->anchor_state = ANCHOR_UNSELECTED; + + _XmHTMLFullDebug(1, ("XmHTML.c: LeaveAnchor, leaving anchor: %s\n", start->anchor->href)); + + /* paint it */ + _XmHTMLPaint(html, start, end); + + html->html.armed_anchor = NULL; +} + +/***** +* Name: EnterAnchor +* Return Type: void +* Description: paints a highlight on the given anchor. +* In: +* html: XmHTMLWidget id; +* anchor: anchor to receive highlighting. +* Returns: +* nothing. +*****/ +static void +EnterAnchor(XmHTMLWidget html, XmHTMLObjectTable *anchor) +{ + XmHTMLObjectTable *start, *end; + + /* save as the current active anchor */ + start = html->html.armed_anchor = anchor; + + /* pick up anchor end */ + for(end = start; end != NULL && end->object == start->object; end = end->next) + end->anchor_state = ANCHOR_INSELECT; + + _XmHTMLFullDebug(1, ("XmHTML.c: EnterAnchor, entering anchor: %s\n", start->anchor->href)); + + /* paint it */ + _XmHTMLPaint(html, start, end); +} + +/***** +* Name: OnImage +* Return Type: XmHTMLImage* +* Description: checks whether the given positions fall within an image +* In: +* html: XmHTMLWidget id +* x: pointer x-position +* y: pointer y-position +* Returns: +* The selected image if a match was found, NULL if not. +*****/ +static XmHTMLImage* +OnImage(XmHTMLWidget html, int x, int y) +{ + XmHTMLImage *image; + int xs, ys; + + xs = x + html->html.scroll_x; + ys = y + html->html.scroll_y; + + _XmHTMLDebug(1, ("XmHTML.c: OnImage, xs = %i, ys = %i\n", xs, ys)); + + for(image = html->html.images; image != NULL; image = image->next) + { + if(image->owner && (xs >= image->owner->x && + xs <= (image->owner->x + image->owner->width)) && + (ys >= image->owner->y && + ys <= (image->owner->y + image->owner->height))) + { + _XmHTMLDebug(1, ("XmHTML.c: OnImage, image selected: %s\n", + image->url)); + return(image); + } + } + _XmHTMLDebug(1, ("XmHTML.c: OnImage, no match found\n")); + return(NULL); +} + +/***** +* Name: CheckMaxColorSetting +* Return Type: void +* Description: checks value of the XmNmaxImageColors resource against +* maximum number of colors allowed for this display. +* In: +* html: XmHTMLWidget +* Returns: +* nothing; +*****/ +static void +CheckMaxColorSetting(XmHTMLWidget html) +{ + int max_colors; + + /* check for an XCC */ + if(html->html.xcc == NULL) + _XmHTMLCheckXCC(html); + + /* get maximum allowable colors */ + max_colors = html->html.xcc->num_colors; + + /* limit to 256 colors */ + if(max_colors > MAX_IMAGE_COLORS) + max_colors = MAX_IMAGE_COLORS; + + /* verify */ + if(html->html.max_image_colors > max_colors) + { + _XmHTMLWarning(__WFUNC__(html, "CheckMaxColorSetting"), + "Bad value for XmNmaxImageColors: %i colors selected while " + "display only\n supports %i colors. Reset to %i", + html->html.max_image_colors, max_colors, max_colors); + html->html.max_image_colors = max_colors; + } + /* plop maximum colors in */ + else if(html->html.max_image_colors == 0) + html->html.max_image_colors = max_colors; +} + +/***** +* Name: CheckPLCIntervals +* Return Type: void +* Description: validates the delays for the PLC Cycler. +* In: +* html: XmHTMLWidget id +* Returns: +* nothing, but the PLC delay values can have changed when this function +* returns. +*****/ +static void +CheckPLCIntervals(XmHTMLWidget html) +{ + int delay, min_delay, max_delay, new_delay; + Boolean delay_reset = False; + + delay = html->html.plc_delay; + min_delay = html->html.plc_min_delay; + max_delay = html->html.plc_max_delay; + + if(min_delay <= 0) + { + _XmHTMLWarning(__WFUNC__(html, "CheckPLCIntervals"), + "Invalid value for XmNprogressiveMinimumDelay (%i)\n" + " Reset to %i", min_delay, PLC_MIN_DELAY); + min_delay = PLC_MIN_DELAY; + } + + if(delay < min_delay) + { + if(min_delay < PLC_DEFAULT_DELAY) + new_delay = PLC_DEFAULT_DELAY; + else + new_delay = min_delay * 50; + + _XmHTMLWarning(__WFUNC__(html, "CheckPLCIntervals"), + "Invalid value for XmNprogressiveInitialDelay (%i).\n" + " Set to %i", delay, new_delay); + delay = new_delay; + delay_reset = True; + } + + if(max_delay <= min_delay) + { + new_delay = min_delay <= PLC_MAX_DELAY ? + PLC_MAX_DELAY : min_delay * 100; + + _XmHTMLWarning(__WFUNC__(html, "CheckPLCIntervals"), + "XmNprogressiveMaximumDelay (%i) less than " + "XmNprogressiveMinimumDelay (%i).\n Set to %i", + max_delay, min_delay, new_delay); + max_delay = new_delay; + } + + /* can't do anything with this, reset to default values */ + if(max_delay <= delay && !delay_reset) + { + _XmHTMLWarning(__WFUNC__(html, "CheckPLCIntervals"), + "XmNprogressiveMaximumDelay (%i) smaller than " + "XmNprogressiveInitialDelay (%i).\n Reset to default values", + max_delay, min_delay); + + delay = PLC_DEFAULT_DELAY; + min_delay = PLC_MIN_DELAY; + max_delay = PLC_MAX_DELAY; + } + + html->html.plc_delay = html->html.plc_def_delay = delay; + html->html.plc_min_delay = min_delay; + html->html.plc_max_delay = max_delay; +} + +/***** +* Name: _XmHTMLGetAnchorByName +* Return Type: XmHTMLObjectTableElement +* Description: returns the named anchor data. +* In: +* html: XmHTMLWidget +* anchor: anchor to locate, with a leading hash sign. +* Returns: +* anchor data upon success, NULL on failure. +*****/ +XmHTMLObjectTableElement +_XmHTMLGetAnchorByName(XmHTMLWidget html, String anchor) +{ + XmHTMLObjectTableElement anchor_data; + int i; + String chPtr = NULL; + + /* see if it is indeed a named anchor */ + if(!anchor || !*anchor || anchor[0] != '#') + return(NULL); /* fix 02/03/97-04, kdh */ + + /* we start right after the leading hash sign */ + chPtr = &anchor[1]; + + _XmHTMLDebug(1, ("XmHTML.c: _XmHTMLGetAnchorByName Start\n")); + + for(i = 0 ; i < html->html.num_named_anchors; i++) + { + anchor_data = &(html->html.named_anchors[i]); + if(anchor_data->anchor && anchor_data->anchor->name && + strstr(anchor_data->anchor->name, chPtr)) + { + _XmHTMLDebug(1, ("XmHTML.c: _XmHTMLGetAnchorByName End, " + "match found.\n")); + return(anchor_data); + } + } + _XmHTMLDebug(1, ("XmHTML.c: _XmHTMLGetAnchorByName End\n")); + return(NULL); +} + +/***** +* Name: _XmHTMLGetAnchorByValue +* Return Type: XmHTMLObjectTableElement +* Description: returns the named anchor data. +* In: +* w: XmHTMLWidget +* anchor_id: internal anchor id. +* Returns: +* anchor data upon success, NULL on failure. +*****/ +XmHTMLObjectTableElement +_XmHTMLGetAnchorByValue(XmHTMLWidget html, int anchor_id) +{ + XmHTMLObjectTableElement anchor_data; + int i; + + _XmHTMLDebug(1, ("XmHTML.c: _XmHTMLGetAnchorByValue Start\n")); + + /* this should always match */ + anchor_data = &(html->html.named_anchors[anchor_id]); + if(anchor_data->id == anchor_id) + return(anchor_data); + + /* hmm, something went wrong, search the whole list of named anchors */ + _XmHTMLWarning(__WFUNC__(html, "_XmHTMLGetAnchorByValue"), + "Misaligned anchor stack (id=%i), trying to recover.", anchor_id); + + for(i = 0 ; i < html->html.num_named_anchors; i++) + { + anchor_data = &(html->html.named_anchors[i]); + if(anchor_data->id == anchor_id) + { + _XmHTMLDebug(1, ("XmHTML.c: _XmHTMLGetAnchorByValue End, " + "match found.\n")); + return(anchor_data); + } + } + _XmHTMLDebug(1, ("XmHTML.c: _XmHTMLGetAnchorByValue End\n")); + return(NULL); +} + +/***** +* Name: VerticalPosToLine +* Return Type: int +* Description: translates a vertical position to the current line number +* in the currently displayed document. +* In: +* html: XmHTMLWidget id; +* y: absolute document y position. +* Returns: +* line number of the object found at the given position. nlines if not found. +*****/ +static int +VerticalPosToLine(XmHTMLWidget html, int y) +{ + XmHTMLObjectTableElement tmp; + + /* sanity check */ + if(!html->html.formatted) + return(0); + + if((tmp = _XmHTMLGetLineObject(html, y)) != NULL) + { + + _XmHTMLDebug(1, ("XmHTML.c: VerticalPosToLine, object found, " + "y_pos = %i, linenumber = %i\n", tmp->y, tmp->line)); + + /* + * If the current element has got more than one word in it, and these + * words span accross a number of lines, adjust the linenumber. + */ + if(tmp->n_words > 1 && tmp->words[0].y != tmp->words[tmp->n_words-1].y) + { + int i; + for(i = 0 ; i < tmp->n_words && tmp->words[i].y < y; i++); + if(i != tmp->n_words) + return(tmp->words[i].line); + else + return(tmp->line); + } + else + return(tmp->line); + } + return(0); +} + +/***** +* Name: ScrollToLine +* Return Type: void +* Description: scrolls the TWidget to the given line number. +* In: +* html: XmHTMLWidget id +* line: line number to scroll to. +* Returns: +* nothing. +*****/ +static void +ScrollToLine(XmHTMLWidget html, int line) +{ + XmHTMLObjectTableElement tmp = NULL; + + if(line > html->html.nlines) + { + int value; + + _XmHTMLDebug(1, ("XmHTML.c: ScrollToLine, " + "calling _XmHTMLMoveToPos\n")); + + html->html.top_line = html->html.nlines; + value = html->html.formatted_height; + + /* fix 01/30/97-04, kdh */ + AdjustVerticalScrollValue(html->html.vsb, value); + + _XmHTMLMoveToPos(html->html.vsb, html, value); + return; + } + if(line <= 0) + { + html->html.top_line = 0; + _XmHTMLDebug(1, ("XmHTML.c: ScrollToLine, " + "calling _XmHTMLMoveToPos\n")); + _XmHTMLMoveToPos(html->html.vsb, html, 0); + return; + } + + for(tmp = html->html.formatted; tmp != NULL && line > tmp->line; + tmp = tmp->next); + + /* get vertical position */ + if(tmp) + { + int i, value; /* position to scroll to */ + + /* we might have gone one object to far. Check and adjust */ + tmp = (line != tmp->line ? (tmp->prev ? tmp->prev : tmp) : tmp); + + value = tmp->y - tmp->height; + html->html.top_line = tmp->line; + + /* + * Not exactly the requested line. Now check the line numbers of + * the text inside this object. We need to subtract the height of this + * object if we want to have it displayed properly. + */ + if(tmp->line != line) + { + if(tmp->n_words) + { + /* fix 11/11/97-01, dbl */ + for(i = 0; i < tmp->n_words && line > tmp->words[i].line; + i++); + /* if found, we need to take y position of the previous word */ + if(i != tmp->n_words && i != 0) + { + html->html.top_line = tmp->words[i-1].line; + value = tmp->words[i-1].y - tmp->words[i-1].height; + } + } + } + _XmHTMLDebug(1, ("XmHTML.c: ScrollToLine, " + "requested line: %i, lineno found: %i, y_pos: %i\n", + line, tmp->line, value)); + + /* fix 01/30/97-04, kdh */ + AdjustVerticalScrollValue(html->html.vsb, value); + + _XmHTMLMoveToPos(html->html.vsb, html, value); + } + else + { + _XmHTMLDebug(1, ("XmHTML.c: ScrollToLine, " + "failed to detect requested line number!\n")); + } +} + +/******** +****** Public XmHTML Functions +********/ + +/***** +* Name: XmHTMLAnchorGetId +* Return Type: int +* Description: returns the internal id of an anchor +* In: +* w: XmHTMLWidget +* anchor: anchor to locate +* Returns: +* the id upon success, -1 if not found. +*****/ +int +XmHTMLAnchorGetId(TWidget w, String anchor) +{ + XmHTMLObjectTableElement anchor_data = NULL; + + /* sanity check */ + if(!w || !XmIsHTML(w)) + { + _XmHTMLBadParent(w, "XmHTMLAnchorGetId"); + return(-1); + } + + if((anchor_data = _XmHTMLGetAnchorByName(XmHTML (w), anchor)) != NULL) + return(anchor_data->id); + else /* not found */ + return(-1); +} + +/***** +* Name: XmHTMLScrollToAnchorById +* Return Type: void +* Description: moves the text with the current anchor on top. +* In: +* w: XmHTMLWidget +* anchor_id: internal anchor id to scroll to. +* Returns: +* nothing. +*****/ +void +XmHTMLAnchorScrollToId(TWidget w, int anchor_id) +{ + XmHTMLWidget html; + XmHTMLObjectTableElement anchor_data = NULL; + + /* sanity check */ + if(!w || !XmIsHTML(w) || anchor_id < 0) + { + _XmHTMLWarning(__WFUNC__(w, "XmHTMLAnchorScrollToId"), + "%s passed to XmHTMLAnchorScrollToId.", + w ? (anchor_id < 0 ? "Invalid id" : "Invalid parent") : + "NULL parent"); + return; + } + + html = XmHTML (w); + + /* only scroll when we have a vertical scrollbar */ + /* fix 10/22/97-01, kdh */ + if((anchor_data = _XmHTMLGetAnchorByValue(html, anchor_id)) != NULL && + html->html.needs_vsb) + { + int value; + + _XmHTMLDebug(1, ("XmHTML.c: XmHTMLAnchorScrollToId, " + "calling _XmHTMLMoveToPos\n")); + + value = anchor_data->y - anchor_data->height; + + /* fix 01/30/97-04, kdh */ + AdjustVerticalScrollValue(html->html.vsb, value); + + _XmHTMLMoveToPos(html->html.vsb, html, value); + } +} + +/***** +* Name: XmHTMLAnchorScrollToName +* Return Type: void +* Description: moves the text with the current anchor on top. +* In: +* w: XmHTMLWidget +* anchor: anchor to scroll to. +* Returns: +* nothing. +*****/ +void +XmHTMLAnchorScrollToName(TWidget w, String anchor) +{ + XmHTMLWidget html; + XmHTMLObjectTableElement anchor_data = NULL; + + /* sanity check */ + if(!w || !XmIsHTML(w)) + { + _XmHTMLBadParent(w, "XmHTMLAnchorScrollToName"); + return; + } + + html = XmHTML (w); + + /* only scroll when we have a vertical scrollbar */ + /* fix 10/22/97-01, kdh */ + if((anchor_data = _XmHTMLGetAnchorByName(html, anchor)) != NULL && + html->html.needs_vsb) + { + int value; + + _XmHTMLDebug(1, ("XmHTML.c: XmHTMLAnchorScrollToName, " + "calling _XmHTMLMoveToPos\n")); + + value = anchor_data->y - anchor_data->height; + + /* fix 01/30/97-04, kdh */ + AdjustVerticalScrollValue(html->html.vsb, value); + + _XmHTMLMoveToPos(html->html.vsb, html, value); + } + return; +} + +/***** +* Name: XmHTMLTextScrollToLine +* Return Type: void +* Description: scrolls the TWidget to the given line number. +* In: +* w: TWidget to scroll +* line: line number to scroll to. +* Returns: +* nothing. +*****/ +void +XmHTMLTextScrollToLine(TWidget w, int line) +{ + /* sanity check */ + if(!w || !XmIsHTML(w)) + { + _XmHTMLBadParent(w, "XmHTMLAnchorScrollToLine"); + return; + } + + if(line == (XmHTML (w))->html.top_line) + return; + + /* scroll to the requested line */ + ScrollToLine(XmHTML(w), line); +} + +/***** +* Name: XmHTMLTextGetSource +* Return Type: String +* Description: returns a copy of the original, unmodified document. +* In: +* w: XmHTMLWidget in question +* Returns: +* a *pointer* to the original text, or NULL when w isn't a subclass of XmHTML +* or there wasn't a current document. +*****/ +String +XmHTMLTextGetSource(TWidget w) +{ + if(!w || !XmIsHTML(w)) + { + _XmHTMLBadParent(w, "XmHTMLTextGetSource"); + return(NULL); + } + + return((XmHTML (w))->html.source); +} + +/***** +* Name: XmHTMLTextGetString +* Return Type: String +* Description: composes a text buffer consisting of the parser output. +* This return buffer is not necessarely equal to the original +* document as the document verification and repair routines +* are capable of modifying the original rather heavily. +* In: +* w: XmHTMLWidget in question +* Returns: +* An allocated buffer containing the composed text upon success, NULL on +* failure. +* Note: +* The return value from this function must be freed by the caller. +* Typical use of this function is to set this buffer into the TWidget when +* the parser failed to verify the document as it might well be that a next +* parser pass on the original document does produce a HTML3.2 conforming +* and verified document. +*****/ +String +XmHTMLTextGetString(TWidget w) +{ + if(!w || !XmIsHTML(w)) + { + _XmHTMLBadParent(w, "XmHTMLTextGetString"); + return(NULL); + } + + return(_XmHTMLTextGetString((XmHTML(w))->html.elements)); +} + +/***** +* Name: XmHTMLGetVersion +* Return Type: int +* Description: returns the version number of XmHTML +* In: +* nothing +* Returns: +* version number of this library. +*****/ +int +XmHTMLGetVersion(void) +{ + return(XmHTMLVersion); +} + +/***** +* Name: XmHTMLGetTitle +* Return Type: String +* Description: returns the value of the element +* In: +* w: XmHTMLWidget in question +* Returns: +* value of the title upon success, NULL on failure. +*****/ +String +XmHTMLGetTitle(TWidget w) +{ + XmHTMLWidget html; + XmHTMLObject *tmp; + static String ret_val; + String start, end; + + /* sanity check */ + if(!w || !XmIsHTML(w)) + { + _XmHTMLBadParent(w, "XmHTMLGetTitle"); + return(NULL); + } + + html = XmHTML(w); + + for(tmp = html->html.elements; + tmp != NULL && tmp->id != HT_TITLE && tmp->id != HT_BODY; + tmp = tmp->next); + + /* sanity check */ + if(!tmp || !tmp->next || tmp->id == HT_BODY) + return(NULL); + + /* ok, we have reached the title element, pick up the text */ + tmp = tmp->next; + + /* another sanity check */ + if(!tmp->element) + return(NULL); + + /* skip leading... */ + for(start = tmp->element; *start != '\0' && isspace(*start); start++); + + /* ...and trailing whitespace */ + for(end = &start[strlen(start)-1]; *end != '\0' && isspace(*end); + end--); + + /* always backs up one to many */ + end++; + + /* sanity */ + if(*start == '\0' || (end - start) <= 0) + return(NULL); + + /* duplicate the title */ + ret_val = my_strndup(start, end - start); + + /* expand escape sequences */ + _XmHTMLExpandEscapes(ret_val, html->html.bad_html_warnings); + + /* and return to caller */ + return(ret_val); +} + +/***** +* Name: XmHTMLRedisplay +* Return Type: void +* Description: forces a layout recomputation of the currently loaded document +* and triggers a redisplay. +* In: +* w: TWidget for which to redo layout computation. +* Returns: +* nothing +* Note: +* This function is mostly useful in combination with the image updating +* and/or replacing routines. +*****/ +void +XmHTMLRedisplay(TWidget w) +{ + XmHTMLWidget html; + + /* sanity check */ + if(!w || !XmIsHTML(w)) + { + _XmHTMLBadParent(w, "XmHTMLRedisplay"); + return; + } + + html = XmHTML (w); + + /* recompute screen layout */ + Layout(html); + + if(html->html.gc != NULL) + XmHTML_Frontend_Redisplay (html); +} + +/***** +* Name: XmHTMLTextSetString +* Return Type: void +* Description: sets the given text into the given HTML TWidget +* In: +* w: XmHTMLWidget in question +* value: text to set +* Returns: +* clears any previous text and sets the new text. +*****/ +void +XmHTMLTextSetString(TWidget w, String text) +{ + XmHTMLWidget html; + + /* sanity check */ + if(!w || !XmIsHTML(w)) + { + _XmHTMLBadParent(w, "XmHTMLTextSetString"); + return; + } + + _XmHTMLDebug(1, ("XmHTML.c: XmHTMLSetTextString, start\n")); + + html = XmHTML (w); + + /* almost impossible */ + if(html->html.value == text) + return; + + /* check if the new value is different from the current source */ + if(text && html->html.source && !(strcmp(html->html.source, text))) + return; + + /* First kill any outstanding PLC's */ + _XmHTMLKillPLCCycler(html); + + /* release event database */ + _XmHTMLFreeEventDatabase(html, html); + + /* now destroy any forms */ + _XmHTMLFreeForm(html, html->html.form_data); + html->html.form_data = (XmHTMLFormData*)NULL; + + /* clear the current display area. Prevents color flashing etc. */ + if(html->html.gc != NULL) + { + Toolkit_Clear_Area (XtDisplay(html->html.work_area), + Toolkit_Widget_Window(html->html.work_area), 0, 0, + Toolkit_Widget_Dim (html).width, + Toolkit_Widget_Dim (html).height, False); + } + + /* clear current source */ + if(html->html.source) + { + free(html->html.source); + html->html.source = NULL; + html->html.value = NULL; + } + + /* set new source text */ + if(text) + { + html->html.source = strdup(text); + html->html.value = html->html.source; + } + + /* destroy any existing frames */ + if(html->html.nframes) + _XmHTMLDestroyFrames(html, html->html.nframes); + + /* free all non-persistent resources and images */ + FreeExpendableResources(html, True); + + /* reset some important vars */ + ResetWidget(html, True); + + /* Parse the raw HTML text */ + html->html.elements = _XmHTMLparseHTML(html, html->html.elements, + html->html.source, html); + + /* Trigger link callback */ + if(CHECK_CALLBACK (html, link_callback, LINK)) + _XmHTMLLinkCallback(html); + + /* reset topline */ + html->html.top_line = 0; + + /* check for frames */ + html->html.nframes = _XmHTMLCheckForFrames(html, html->html.elements); + +#ifdef WITH_MOTIF + /* set appropriate background color */ + XtVaSetValues(html->html.work_area, + XmNbackground, html->html.body_bg, NULL); +#else + fprintf (stderr, "SHOULD SET THE BACKGROUND COLOR\n"); +#endif + /* get new values for top, bottom & highlight */ + _XmHTMLRecomputeColors(html); + + /* create frames */ + if(!_XmHTMLCreateFrames(NULL, html)) + { + html->html.frames = NULL; + html->html.nframes = 0; + /* keep current frame setting */ + } + + /* do initial markup */ + _XmHTMLformatObjects(html, html); + + /* check for delayed external imagemaps */ + _XmHTMLCheckImagemaps(html); + + /* compute new screen layout */ + Layout(html); + + /* and clear the display, causing an Expose event */ + if(html->html.gc != NULL) + _XmHTMLClearArea (html, 0, 0, Toolkit_Widget_Dim (html).width, Toolkit_Widget_Dim(html).height); + + /* and start up the PLC cycler */ + html->html.plc_suspended = False; +#ifdef WITH_MOTIF + _XmHTMLPLCCycler((XtPointer)html, None); +#else + _XmHTMLPLCCycler((XtPointer)html); +#endif +} + +/***** +* Name: XmHTMLXYToInfo +* Return Type: XmHTMLInfoStructure* +* Description: Retrieves the contents of an image and/or anchor at the +* given cursor position. +* In: +* w: XmHTMLWidget id; +* x: x-location of pointer, relative to left side of the workArea +* y: y-location of pointer, relative to top side of the workArea +* Returns: +* A filled XmHTMLInfoStructure when the pointer was pressed on an image +* and/or anchor. NULL if not. +* Note: +* The return value, nor one of its members may be freed by the caller. +*****/ +XmHTMLInfoPtr +XmHTMLXYToInfo(TWidget w, int x, int y) +{ + static XmHTMLInfoStructure cbs; + static XmHTMLImage *image; + static XmHTMLAnchorCallbackStruct anchor_cbs; + static XmImageInfo info; + long line = -1; + XmHTMLAnchor *anchor; + XmHTMLWord *anchor_word; + XmHTMLWidget html; + + /* sanity check */ + if(!w || !XmIsHTML(w)) + { + _XmHTMLBadParent(w, "XmHTMLXYToInfo"); + return(NULL); + } + + html = XmHTML (w); + + /* default fields */ +#ifdef WITH_MOTIF + cbs.x = x - html->core.x; + cbs.y = y - html->core.y; +#else + cbs.x = x; + cbs.y = y; +#endif + cbs.is_map = XmMAP_NONE; + cbs.image = NULL; + cbs.anchor = NULL; + line = -1; + + /* pick up a possible anchor or imagemap location */ + anchor = NULL; + + if((anchor_word = GetAnchor(html, x, y)) == NULL) + anchor = GetImageAnchor(html, x, y); + + /* no regular anchor, see if it's an imagemap */ + if(anchor == NULL && anchor_word) + anchor = anchor_word->owner->anchor; + + /* + * Final check: if this anchor is a form component it can't be followed + * as this is an internal-only anchor. + */ + if(anchor && anchor->url_type == ANCHOR_FORM_IMAGE) + anchor = NULL; + + /* check if we have an anchor */ + if(anchor != NULL) + { + /* set to zero */ + (void)memset(&anchor_cbs, 0, sizeof(XmHTMLAnchorCallbackStruct)); + + /* initialize callback fields */ + anchor_cbs.reason = XmCR_ACTIVATE; + anchor_cbs.event = NULL; + anchor_cbs.url_type = anchor->url_type; + anchor_cbs.line = anchor->line; + anchor_cbs.href = anchor->href; + anchor_cbs.target = anchor->target; + anchor_cbs.rel = anchor->rel; + anchor_cbs.rev = anchor->rev; + anchor_cbs.title = anchor->title; + anchor_cbs.doit = False; + anchor_cbs.visited = anchor->visited; + cbs.anchor = &anchor_cbs; + line = anchor->line; + } + + /* check if we have an image */ + if((image = OnImage(html, x, y)) != NULL) + { + /* set map type */ + cbs.is_map = (image->map_type != XmMAP_NONE); + + if(image->html_image != NULL) + { + /* no image info if this image is being loaded progressively */ + if(!ImageInfoProgressive(image->html_image)) + { + /* use real url but link all other members */ + info.url = image->url; + info.data = image->html_image->data; + info.clip = image->html_image->clip; + info.width = image->html_image->width; + info.height = image->html_image->height; + info.reds = image->html_image->reds; + info.greens = image->html_image->greens; + info.blues = image->html_image->blues; + info.bg = image->html_image->bg; + info.ncolors = image->html_image->ncolors; + info.options = image->html_image->options; + info.type = image->html_image->type; + info.depth = image->html_image->depth; + info.colorspace = image->html_image->colorspace; + info.transparency = image->html_image->transparency; + info.swidth = image->html_image->swidth; + info.sheight = image->html_image->sheight; + info.scolors = image->html_image->scolors; + info.alpha = image->html_image->alpha; + info.fg_gamma = image->html_image->fg_gamma; + info.x = image->html_image->x; + info.y = image->html_image->y; + info.loop_count = image->html_image->loop_count; + info.dispose = image->html_image->dispose; + info.timeout = image->html_image->timeout; + info.nframes = image->html_image->nframes; + info.frame = image->html_image->frame; + info.user_data = image->html_image->user_data; + /* set it */ + cbs.image = &info; + } + } + else + { + /* XmImageInfo has been freed, construct one */ + /* set to zero */ + memset(&info, 0, sizeof(XmImageInfo)); + /* fill in the fields we know */ + info.url = image->url; + info.type = IMAGE_UNKNOWN; + info.width = image->swidth; + info.height = image->sheight; + info.swidth = image->width; + info.sheight = image->height; + info.ncolors = image->npixels; + info.nframes = image->nframes; + /* set it */ + cbs.image = &info; + } + if(line == -1) + line = (image->owner ? image->owner->line : -1); + } + /* no line number yet, get one */ + if(line == -1) + cbs.line = VerticalPosToLine(html, y + html->html.scroll_y); + else + cbs.line = line; + return(&cbs); +} + +/***** +* Name: XmHTMLTextGetFormatted +* Return Type: String +* Description: returns a formatted copy of the current document. +* In: +* w: XmHTMLWidget id; +* papertype: type of paper to use (any of the XmHTMLTEXT_PAPERSIZE enums); +* papersize: size of paper for custom stuff, or default overrides; +* type: type of output wanted, plain, formatted or PS; +* PSoptions: options to use when creating postscript output. +* Returns: +* a string which needs to be freed by the caller. +*****/ +String +XmHTMLTextGetFormatted(TWidget w, unsigned char papertype, + XmHTMLPaperSize *paperdef, unsigned char type, unsigned char PSoptions) +{ + XmHTMLWidget html; +#if 0 + XmHTMLPaperSize *pdef, pbase; +#endif + + /* sanity check */ + if(!w || !XmIsHTML(w)) + { + _XmHTMLBadParent(w, "XmHTMLTextGetFormatted"); + return(NULL); + } + + /***** + * Check args: we only allow a papersize of XmHTML_NONE for plain and + * formatted output. PS requires a papersize. + *****/ + if(paperdef == NULL && type == XmHTMLTEXT_POSTSCRIPT) + { + _XmHTMLWarning(__WFUNC__(w, "XmHTMLTextGetFormatted"), + "Formatted text output: postscript requires a papertype."); + return(NULL); + } + /* custom papersize requires a paper definition. */ + if(papertype == XmHTMLTEXT_PAPERSIZE_CUSTOM && paperdef == NULL) + { + _XmHTMLWarning(__WFUNC__(w, "XmHTMLTextGetFormatted"), + "Formatted text output: custom papersize misses a " + "papersize definition."); + return(NULL); + } + + /* TWidget ptr */ + html = XmHTML (w); + +#if 0 + /***** + * get appropriate papersize definitions if not given. + *****/ + if(papertype != XmHTMLTEXT_PAPERSIZE_CUSTOM && paperdef == NULL) + { + /* formatting routines use point size */ + if(papertype == XmHTMLTEXT_PAPERSIZE_A4) + { + pbase.unit_type = XmHTML_POINT; + pbase.paper_type = XmHTMLTEXT_PAPERSIZE_A4; + pbase.width = 845; /* 297mm */ + pbase.height = 597; /* 210mm */ + pbase.left_margin = 57; /* 20mm */ + pbase.right_margin = 57; + pbase.top_margin = 57; + pbase.bottom_margin = 57; + } + else /* XmHTMLTEXT_PAPERSIZE_LETTER */ + { + pbase.unit_type = XmHTML_POINT; + pbase.paper_type = XmHTMLTEXT_PAPERSIZE_LETTER; + pbase.width = 795; /* 11in */ + pbase.height = 614; /* 8.5in */ + pbase.left_margin = 65; /* 0.9in */ + pbase.right_margin = 65; + pbase.top_margin = 65; + pbase.bottom_margin = 51; /* 0.7in */ + } + /* convert to correct output type */ + pdef = _XmHTMLTextCheckAndConvertPaperDef(html, &paperdef, type); + } + else /* check validity of paper definition and convert to correct type */ + if((pdef = _XmHTMLTextCheckAndConvertPaperDef(html, paperdef, + type)) == NULL) + return(NULL); + + if(type == XmHTMLTEXT_PLAIN) + return(_XmHTMLTextGetPlain(html, pdef, html->html.formatted, NULL, 0)); + else if(type == XmHTMLTEXT_FORMATTED) + return(_XmHTMLTextGetFormatted(html, pdef, html->html.formatted, NULL, + 0)); + else if(type == XmHTMLTEXT_POSTSCRIPT) + return(_XmHTMLTextGetPS(html, pdef, html->html.formatted, NULL, + PSoptions)); + else + _XmHTMLWarning(__WFUNC__(w, "XmHTMLTextGetFormatted"), + "Formatted text output: Invalid type selected."); +#endif + return(NULL); +} + +/***** +* Name: _XmHTMLMoveToPos +* Return Type: void +* Description: scroll the working area with the given value +* In: +* w: originator +* html: XmHTMLWidget +* value: position to scroll to +* Returns: +* nothing +*****/ +void +_XmHTMLMoveToPos(TWidget w, XmHTMLWidget html, int value) +{ + int inc, x, y, width, height; + Display *dpy = Toolkit_Display(html->html.work_area); + TWindow win = Toolkit_Widget_Window(html->html.work_area); + TGC gc = html->html.gc; + int vsb_width = 0, hsb_height = 0; + + /* sanity check */ + if(value < 0) + return; + + /* default exposure region */ + x = y = 0; + width = Toolkit_Widget_Dim (html).width; + height = Toolkit_Widget_Dim (html).height; + +#ifdef WITH_MOTIF + /* + * need to adjust slider position since we may not be called from + * the scrollbar callback handler. + */ + XtVaSetValues(w, XmNvalue, value, NULL); +#endif + + /* vertical scrolling */ + if(w == html->html.vsb) + { + /* + * clicking on the slider causes activation of the scrollbar + * callbacks. Since there is no real movement, just return. + * Not doing this will cause an entire redraw of the window. + */ + if(value == html->html.scroll_y) + return; /* fix 01/20/97-01 kdh */ + + /* save line number */ + SetCurrentLineNumber(html, value); + + /* moving down (text moving up) */ + if(value > html->html.scroll_y) + { + inc = value - html->html.scroll_y; + + /* save new value */ + html->html.scroll_y = value; + + /* save new paint engine start */ + html->html.paint_start = html->html.paint_end; + + /* small increment */ + if(inc < html->html.work_height) + { + /***** + * See if we have a hsb. If we have one, we need to add + * the height of the hsb to the region requiring updating. + *****/ + if(html->html.needs_hsb) +#ifdef NO_XLIB_ILLEGAL_ACCESS + GetScrollDim(html, &hsb_height, &vsb_width); +#else + hsb_height = Toolkit_Widget_Dim (html->html.hsb).height; +#endif + /* copy visible part upward */ + Toolkit_Copy_Area (dpy, win, win, gc, 0, inc, + html->html.work_width + html->html.margin_width, + html->html.work_height - inc - hsb_height, 0, 0); + + /* clear area below */ + x = 0; + y = html->html.work_height - inc - hsb_height; + width = Toolkit_Widget_Dim (html).width; + height = inc + hsb_height; + } + /* large increment, use default area */ + } + /* moving up (text moving down) */ + else + { + inc = html->html.scroll_y - value; + + /* save new value */ + html->html.scroll_y = value; + + /* small increment */ + if(inc < html->html.work_height) + { + /* copy area down */ + Toolkit_Copy_Area (dpy, win, win, gc, 0, 0, + html->html.work_width + html->html.margin_width, + html->html.work_height - inc, 0, inc); + + /* save paint engine end */ + html->html.paint_end = html->html.paint_start; + + /* clear area above */ + x = y = 0; + width = Toolkit_Widget_Dim (html).width; + height = inc; + } + /* large increment, use default area */ + } + } + /* horizontal scrolling */ + else if(w == html->html.hsb) + { + /* + * clicking on the slider causes activation of the scrollbar + * callbacks. Since there is no real movement, just return. + * Not doing this will cause an entire redraw of the window. + */ + if(value == html->html.scroll_x) + return; /* fix 01/20/97-01 kdh */ + + /* moving right (text moving left) */ + if (value > html->html.scroll_x) + { + inc = value - html->html.scroll_x; + + /* save new value */ + html->html.scroll_x = value; + + /* small increment */ + if(inc < html->html.work_width) + { + /* + * See if we have a vsb. If we have, no additional offset + * required, otherwise we also have to clear the space that + * has been reserved for it. + */ + if(!html->html.needs_vsb) +#ifdef NO_XLIB_ILLEGAL_ACCESS + GetScrollDim(html, &hsb_height, &vsb_width); +#else + vsb_width = Toolkit_Widget_Dim (html->html.vsb).width; +#endif + + /* copy area to the left */ + Toolkit_Copy_Area(dpy, win, win, gc, inc, 0, + html->html.work_width - inc, + html->html.work_height, 0, 0); + + /* clear area on right */ + x = html->html.work_width - inc; + y = 0; + width = inc + html->html.margin_width + vsb_width; + height = html->html.work_height; + } + /* large increment, use default area */ + } + /* moving left (text moving right) */ + else + { + inc = html->html.scroll_x - value; + + /* save new value */ + html->html.scroll_x = value; + + /* small increment */ + if(inc < html->html.work_width) + { + if(!html->html.needs_vsb) +#ifdef NO_XLIB_ILLEGAL_ACCESS + GetScrollDim(html, &hsb_height, &vsb_width); +#else + vsb_width = Toolkit_Widget_Dim (html->html.vsb).width; +#endif + + /* copy area to the right */ + /* fix 01/24/97-01, kdh */ + Toolkit_Copy_Area (dpy, win, win, gc, 0, 0, + html->html.work_width - inc + html->html.margin_width + + vsb_width, html->html.work_height, inc, 0); + + /* clear area on left */ + x = y = 0; + width = inc; + height = html->html.work_height; + } + /* large increment, use default area */ + } + } + else + { + _XmHTMLWarning(__WFUNC__(html, "_XmHTMLMoveToPos"), + "Internal Error: unknown scrollbar!"); + return; + } + + /* update display */ + _XmHTMLClearArea(html, x, y, width, height); +} + +/***** +* Name: _XmHTMLClearArea +* Return Type: void +* Description: XClearArea wrapper. Does form component updating as well. +* In: +* html: XmHTMLWidget id; +* x,y: upper left corner of region to be updated; +* width: width of region; +* height: height of region; +* Returns: +* +*****/ +void +_XmHTMLClearArea(XmHTMLWidget html, int x, int y, int width, int height) +{ + Display *dpy = Toolkit_Display(html->html.work_area); + TWindow win = Toolkit_Widget_Window(html->html.work_area); + + _XmHTMLDebug(1, ("XmHTML.c: _XmHTMLClearArea Start, x: %i, y: %i, width: %i " + "height: %i.\n", x, y, width, height)); + + /* first scroll form TWidgets if we have them */ + if(html->html.form_data) + { + FormScroll(html); + Toolkit_Clear_Area(dpy, win, x, y, width, height, False); + Refresh(html, x, y, width, height); + } + else + Toolkit_Clear_Area(dpy, win, x, y, width, height, True); + + _XmHTMLDebug(1, ("XmHTML.c: _XmHTMLClearArea End.\n")); +} + +static void +AnchorTrack (XmHTMLWidget html, TEvent *event, int x, int y) +{ + XmHTMLAnchor *anchor = NULL; + XmHTMLWord *anchor_word = NULL; + + /* try to get current anchor element (if any) */ + if(((anchor_word = GetAnchor(html, x, y)) == NULL) && + ((anchor = GetImageAnchor(html, x, y)) == NULL)) + { + _XmHTMLFullDebug(1, ("XmHTML.c: TrackMotion, no current anchor.\n")); + /* invalidate current selection if there is one */ + if(CHECK_CALLBACK (html, anchor_track_callback, ANCHOR_TRACK) && + html->html.anchor_current_cursor_element) + _XmHTMLTrackCallback(html, event, NULL); + + if(html->html.highlight_on_enter && html->html.armed_anchor) + LeaveAnchor(html); + + html->html.armed_anchor = NULL; + html->html.anchor_current_cursor_element = NULL; + Toolkit_Undefine_Cursor(Toolkit_Display(html), Toolkit_Widget_Window((TWidget)html)); + return; + } + + if(anchor == NULL) + anchor = anchor_word->owner->anchor; + + /* Trigger callback and set cursor if we are entering a new element */ + if(anchor != html->html.anchor_current_cursor_element) + { + _XmHTMLFullDebug(1, ("XmHTML.c: TrackMotion, new anchor.\n")); + + /* remove highlight of previous anchor */ + if(html->html.highlight_on_enter) + { + if(anchor_word) + { + /* unarm previous selection */ + if(html->html.armed_anchor && + html->html.armed_anchor != anchor_word->owner) + LeaveAnchor(html); + /* highlight new selection */ + EnterAnchor(html, anchor_word->owner); + } + else /* unarm previous selection */ + if(html->html.armed_anchor) + LeaveAnchor(html); + + } + + html->html.anchor_current_cursor_element = anchor; + _XmHTMLTrackCallback(html, event, anchor); + Toolkit_Define_Cursor (Toolkit_Display(w), Toolkit_Widget_Window((TWidget)html), + html->html.anchor_cursor); + return; + } +} + +/***** +* Name: ExtendStart +* Return Type: void +* Description: buttonPress action routine. Initializes a selection when +* not over an anchor, else paints the anchor as being selected. +* In: +* +* Returns: +* nothing. +*****/ +static void +TPROTO (ExtendStart, TWidget w, TEvent *event, String *params, Cardinal *num_params) +{ + /* need to use XtParent since we only get button events from work_area */ + XmHTMLWidget html = XmHTML (Toolkit_Widget_Parent (w)); + TButtonPressedEvent *pressed= (TButtonPressedEvent*)event; + XmHTMLAnchor *anchor = NULL; + XmHTMLWord *anchor_word = NULL; + int x,y; + +#ifdef WITH_MOTIF + /* no needless lingering in this routine */ + if(XtClass(XtParent(w)) != xmHTMLWidgetClass) + return; + +#endif + /* we don't do a thing with events generated by button3 */ + if(pressed->button == Button3 && CHECK_CALLBACK (html, arm_callback, ARM) == NULL) + return; + + _XmHTMLFullDebug(1, ("XmHTML.c: ExtendStart Start\n")); + + /* Get coordinates of button event and add core offsets */ + x = pressed->x; + y = pressed->y; + + /* try to get current anchor element */ + if(pressed->button != Button3 && + (((anchor_word = GetAnchor(html, x, y)) != NULL) || + ((anchor = GetImageAnchor(html, x, y)) != NULL))) + { + /***** + * User has selected an anchor. Get the text for this anchor. + * Note: if anchor is NULL it means the user was over a real anchor + * (regular anchor, anchored image or a form image button) and + * anchor_word is non-NULL (this object the referenced URL). If it + * is non-NULL the mouse was over an imagemap, in which case we + * may not show visual feedback to the user. + * I admit, the names of the variables is rather confusing. + ******/ + if(anchor == NULL) + { + /* store anchor & paint as selected */ + anchor = anchor_word->owner->anchor; + /***** + * uncheck currently selected anchor if it's not the same as + * the current anchor (mouse dragging) + *****/ + if(html->html.current_anchor != NULL && + html->html.current_anchor != anchor_word->owner) + PaintAnchorUnSelected(html); + + PaintAnchorSelected(html, anchor_word); + } + else if(html->html.selected != NULL && + html->html.selected != anchor) + PaintAnchorUnSelected(html); + + /* check for the onMouseDown event */ + if(anchor->events && anchor->events->onMouseDown) + _XmHTMLProcessEvent(html, event, anchor->events->onMouseDown); + + html->html.selected = anchor; + + _XmHTMLFullDebug(1, ("XmHTML.c: ExtendStart, anchor selected is %s\n", + anchor->href)); + } + else if(html->html.current_anchor != NULL) + { + /* not over an anchor, unselect current anchor and reset cursor */ + PaintAnchorUnSelected(html); + Toolkit_Undefine_Cursor(XtDisplay(w), Toolkit_Widget_Window(w)); + } + + /* remember pointer position and time */ + html->html.press_x = pressed->x; + html->html.press_y = pressed->y; + html->html.pressed_time = pressed->time; + + if(anchor_word == NULL && anchor == NULL && CHECK_CALLBACK (html, arm_callback, ARM)) + { + XmAnyCallbackStruct cbs; + + cbs.reason = XmCR_ARM; + cbs.event = event; + + Toolkit_Call_Callback((TWidget)html, html->html.arm_callback, ARM, &cbs); + } + _XmHTMLFullDebug(1, ("XmHTML.c: ExtendStart End\n")); + + return; +} + +/***** +* Name: ExtendEnd +* Return Type: void +* Description: buttonrelease tracking action routine. Terminates the selection +* initiated by ExtendStart. When over an anchor, paints the +* anchor as being deselected. XmNactivateCallback or +* XmNarmCallback callback resources are only called if the +* buttonpress and release occur within a certain time limit +* (XmHTML_MAX_BUTTON_RELEASE_TIME, defined XmHTMLfuncs.h) + +* In: +* +* Returns: +* nothing +*****/ +static void +TPROTO (ExtendEnd, TWidget w, TEvent *event, String *params, Cardinal *num_params) +{ + /* need to use XtParent since we only get button events from work_area */ + XmHTMLWidget html = XmHTML (Toolkit_Widget_Parent (w)); + TButtonReleasedEvent *release = (TButtonReleasedEvent*)event; + XmHTMLAnchor *anchor = NULL; + XmHTMLWord *anchor_word = NULL; + int x,y; + +#ifdef WITH_MOTIF + /* no needless lingering in this routine */ + if(XtClass(XtParent(w)) != xmHTMLWidgetClass) + return; +#endif + + /* we don't do a thing with events generated by button3 */ + if(release->button == Button3) + return; + + _XmHTMLFullDebug(1, ("XmHTML.c: ExtendEnd Start\n")); + + /* Get coordinates of button event */ + x = release->x; + y = release->y; + + /* try to get current anchor element */ + if(((anchor_word = GetAnchor(html, x, y)) != NULL) || + ((anchor = GetImageAnchor(html, x, y)) != NULL)) + { + /* + * OK, release took place over an anchor, see if it falls within the + * allowable time limit and we are still over the anchor selected by + * ExtendStart. + */ + if(anchor == NULL) + anchor = anchor_word->owner->anchor; + + /* + * If we already have an active anchor and it's different from the + * current anchor, deselect it. + */ + if(html->html.current_anchor && + html->html.current_anchor != anchor_word->owner) + PaintAnchorUnSelected(html); + + /* see if we need to serve the mouseUp event */ + if(anchor->events && anchor->events->onMouseUp) + _XmHTMLProcessEvent(html, event, anchor->events->onMouseUp); + + /* this anchor is still in selection */ + if(anchor_word) + EnterAnchor(html, anchor_word->owner); + + + _XmHTMLFullDebug(1, ("XmHTML.c: ExtendEnd, anchor selected is %s\n", + anchor->href)); + /* + * if we had a selected anchor and it's equal to the current anchor + * and the button was released in time, trigger the activation callback. + */ + if(html->html.selected != NULL && anchor == html->html.selected && + (release->time - html->html.pressed_time) < XmHTML_BUTTON_RELEASE_TIME) + { + /* check for the onClick event */ + if(anchor->events && anchor->events->onClick) + _XmHTMLProcessEvent(html, event, anchor->events->onClick); + + if(anchor->url_type == ANCHOR_FORM_IMAGE) + _XmHTMLFormActivate(html, event, anchor_word->form); + else { + if(CHECK_CALLBACK (html, activate_callback, ACTIVATE)) + { + /* trigger activation callback */ + _XmHTMLActivateCallback(html, event, anchor); + + _XmHTMLFullDebug(1, ("XmHTML.c: ExtendEnd End\n")); + } + } + return; + } + } + + /* unset any previously selected anchor */ + if(html->html.current_anchor != NULL) + { + /* keep current anchor selection or unset it */ + if(anchor_word) + EnterAnchor(html, anchor_word->owner); + else + PaintAnchorUnSelected(html); + + } + _XmHTMLFullDebug(1, ("XmHTML.c: ExtendEnd End\n")); + + return; +} + diff -uNr gnome-0.10/gtk-xmhtml/XmHTML.h gnome-0.11/gtk-xmhtml/XmHTML.h --- gnome-0.10/gtk-xmhtml/XmHTML.h Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/XmHTML.h Tue Jan 6 19:58:18 1998 @@ -0,0 +1,402 @@ +/***** +* XmHTML.h : XmHTML TWidget public header file +* +* This file Version $Revision: 1.4 $ +* +* Creation date: Tue Nov 19 23:18:37 GMT+0100 1996 +* Last modification: $Date: 1998/01/07 01:45:35 $ +* By: $Author: unammx $ +* Current State: $State: Exp $ +* +* Author: newt +* (C)Copyright 1995-1996 Ripley Software Development +* All Rights Reserved +* +* This file is part of the XmHTML TWidget Library. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Library General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library 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 +* Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public +* License along with this library; if not, write to the Free +* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +*****/ +/***** +* $Source: /debian/home/gnomecvs/gnome/gtk-xmhtml/XmHTML.h,v $ +*****/ +/***** +* ChangeLog +* $Log: XmHTML.h,v $ +* Revision 1.4 1998/01/07 01:45:35 unammx +* Gtk/XmHTML is ready to be used by the Gnome hackers now! +* Weeeeeee! +* +* This afternoon: +* +* - Changes to integrate gtk-xmhtml into an autoconf setup. +* +* - Changes to make gtk-xmhtml a library to be used by Gnome +* (simply include +# include +#else +# include +#endif + +#ifdef WITH_MOTIF +# include +#else +# include +#endif + +_XFUNCPROTOBEGIN + +#ifdef WITH_MOTIF +# include "XmHTML-motif.h" +#else +typedef struct _GtkXmHTML *XmHTMLWidget; +#endif + +/******** Public Function Declarations ********/ + +/***** +* Convenience/public functions +* There are four categories of them: +* - image related +* - anchor related +* - text related +* - functions that don't fit in any of the above three +*****/ + +/***** +* Image related convenience functions +*****/ +extern XmImageInfo *XmHTMLImageDefaultProc(TWidget w, String file, + unsigned char *buf, int size); + +/* Return image type */ +extern unsigned char XmHTMLImageGetType(String file, unsigned char *buf, + int size); + +/* returns True if XmHTMLImageDefaultProc supports JPEG images */ +extern Boolean XmHTMLImageJPEGSupported(void); + +/* returns True if XmHTMLImageDefaultProc supports PNG images */ +extern Boolean XmHTMLImagePNGSupported(void); + +/* returns True if XmHTMLImageDefaultProc supports GZF images */ +extern Boolean XmHTMLImageGZFSupported(void); + +/* Replace image with new_image */ +extern XmImageStatus XmHTMLImageReplace(TWidget w, XmImageInfo *image, + XmImageInfo *new_image); + +/* update image */ +extern XmImageStatus XmHTMLImageUpdate(TWidget w, XmImageInfo *image); + +/* release all memory occupied by the images */ +extern void XmHTMLImageFreeAllImages(TWidget w); + +/* add an imagemap to a HTML TWidget. */ +extern void XmHTMLImageAddImageMap(TWidget w, String image_map); + +/* free an XmImageInfo structure */ +extern void XmHTMLImageFreeImageInfo(TWidget w, XmImageInfo *info); + +/* return the total size of a given XmImageInfo structure */ +extern int XmHTMLImageGetImageInfoSize(XmImageInfo *info); + +/* suspend progressive image loading */ +extern void XmHTMLImageProgressiveSuspend(TWidget w); + +/* reactivate progressive image loading */ +extern void XmHTMLImageProgressiveContinue(TWidget w); + +/* terminate progressive image loading */ +extern void XmHTMLImageProgressiveKill(TWidget w); + +/***** +* Special image functions +*****/ +/***** +* Create and return a XmImage for use other than with XmHTML. +* When width and height are non-zero, the image read is scaled to the specified +* dimensions. +*****/ +extern XmImage *XmImageCreate(TWidget w, String file, + Dimension width, Dimension height, XmImageConfig *config); + +/***** +* Create an XmImage from the given XmImageInfo. When the image type is +* IMAGE_UNKNOWN, but the url field represents a local file, this routine +* calls XmImageCreate with the url field as the file argument. +* Only honors the ImageFrameSelect, ImageCreateGC and ImageBackground +* XmImageConfig flag and appropriate fields of that structure. +*****/ +extern XmImage *XmImageCreateFromInfo(TWidget w, XmImageInfo *info, + Dimension width, Dimension height, XmImageConfig *config); + +/* destroy a XmImage */ +extern void XmImageDestroy(XmImage *image); + +/***** +* Tiles "dest" with the given XmImage. Please note that "src" *must* have been +* created with the ImageCreateGC flag, otherwise this function does nothing and +* returns -1. Returns 0 upon success. +* Internally, this routine is more or less a combination of XSetTile, +* XSetTSOrigin and XFillRectangle in one. +* +* (UNTESTED) +*****/ +extern int XmImageSetBackgroundImage(XmImage *src, TDrawable dest, int src_x, + int src_y, int width, int height, int dest_x, int dest_y); + +/***** +* XCopyArea for an XmImage which also takes a possible clipmask into account. +* Please note that "image" *must* have been created with the ImageCreateGC +* flag, otherwise this function does nothing and returns -1. +* Returns 0 upon success. +* +* (UNTESTED) +*****/ +extern int XmImageDrawImage(XmImage *image, TDrawable dest, int src_x, + int src_y, int dest_x, int dest_y); + +/***** +* Write an image to file. Returns False upon failure. +* Saving an image in the GIF format is *not* possible due to Unisys's +* stupid LZW licensing policy. Exporting an image as PNG, JPEG or GZF is only +* possible if support for the required libraries has been compiled in. +* +* (UNIMPLEMENTED, always returns False) +*****/ +extern Boolean XmImageExport(XmImageInfo *info, String file, Dimension width, + Dimension height, unsigned char type); + +/* convert a GIF image to a GZF image */ +extern Boolean XmHTMLGIFtoGZF(String infile, unsigned char *buf, int size, + String outfile); + +/***** +* Anchor related convenience functions +* These routines can be used to jump to named anchors. +*****/ +/* return the internal id of a named anchor given it's name or -1. */ +extern int XmHTMLAnchorGetId(TWidget w, String anchor); + +/* scroll to a named anchor, given it's id */ +extern void XmHTMLAnchorScrollToId(TWidget w, int anchor_id); + +/* scroll to a named anchor, given it's name */ +extern void XmHTMLAnchorScrollToName(TWidget w, String anchor); + +/***** +* Text related convenience functions +*****/ +/* This macro sets the given text into a HTML TWidget */ +#define XmHTMLTextSet(TWidget,TEXT) XtVaSetValues((TWidget), \ + XmNvalue, (TEXT), NULL) + +/* scroll to the requested line number */ +extern void XmHTMLTextScrollToLine(TWidget w, int line); + +/* set text into a html TWidget */ +extern void XmHTMLTextSetString(TWidget w, String text); + +/* return a *pointer* to the original text */ +extern String XmHTMLTextGetSource(TWidget w); + +/* return a copy of the current parser output */ +extern String XmHTMLTextGetString(TWidget w); + + +/* text search functions */ + +/* search for the string to_find, possibly starting from curr_pos */ +extern XmHTMLPosition XmHTMLTextFindString(TWidget w, String to_find, + XmHTMLDirection dir, XmHTMLPosition curr_pos); + +/***** +* Return a formatted copy of the current TWidget contents +* (UNIMPLEMENTED, always returns NULL) +*****/ +extern String XmHTMLTextGetFormatted(TWidget w, unsigned char papertype, + XmHTMLPaperSize *paperdef, unsigned char type, unsigned char PSoptions); + +/***** +* Miscelleneous convenience functions +*****/ +/* return the library version number */ +extern int XmHTMLGetVersion(void); + +/* return the URL type of the given href */ +extern URLType XmHTMLGetURLType(String href); + +/* return the value of the element */ +extern String XmHTMLGetTitle(TWidget w); + +/* return an info structure for the specified location */ +extern XmHTMLInfoStructure *XmHTMLXYToInfo(TWidget w, int x, int y); + +/**** +* Return the contents of the document head. Returns True when a +* section is present in the current document, False if not. When mask_bits +* only contains HeadClear, the given attribute structure is wiped clean and +* this function will return False immediatly. +* The only exception concerns the tag and the HeadDocType mask bit: +* if this bit is set, the value of this tag is returned whether or not a +* head is present. +****/ +extern Boolean XmHTMLGetHeadAttributes(TWidget w, XmHTMLHeadAttributes *head, + unsigned char mask_bits); + +/* return the TWidget id of a framechild given its name */ +extern TWidget XmHTMLFrameGetChild(TWidget w, String name); + +/* force a recomputation of screen layout and trigger a redisplay */ +extern void XmHTMLRedisplay(TWidget w); + +/* return info about the font cache for display of the given TWidget */ +extern XmHTMLFontCacheInfo *XmHTMLGetFontCacheInfo(TWidget w); + +/* free the given font cache info */ +extern void XmHTMLFreeFontCacheInfo(XmHTMLFontCacheInfo *info); + +/* +* Allocate given color (symbolic name of rgb triplet) using the TWidget's +* colormap. Works with the XmNmaxImageColors resource. +*/ +extern Pixel XmHTMLAllocColor(TWidget w, String color, Pixel def_pixel); + +/* free a color allocated with XmHTMLAllocColor */ +extern void XmHTMLFreeColor(TWidget w, Pixel pixel); + +_XFUNCPROTOEND + +#endif /* _LIBRARY */ + +/* Don't add anything after this endif! */ +#endif /* _XmHTML_h_ */ diff -uNr gnome-0.10/gtk-xmhtml/XmHTMLI.h gnome-0.11/gtk-xmhtml/XmHTMLI.h --- gnome-0.10/gtk-xmhtml/XmHTMLI.h Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/XmHTMLI.h Mon Dec 29 16:37:45 1997 @@ -0,0 +1,1036 @@ +/***** +* XmHTMLI.h : XmHTML internal function proto's. +* Only required when building the XmHTML Library. +* If you whish to include this file, it *must* be included +* AFTER XmHTMLP.h as it references a number of structures defined +* in that header. +* +* This file Version $Revision: 1.5 $ +* +* Creation date: Tue Aug 19 16:03:22 GMT+0100 1997 +* Last modification: $Date: 1997/12/29 22:16:22 $ +* By: $Author: unammx $ +* Current State: $State: Exp $ +* +* Author: newt +* +* Copyright (C) 1994-1997 by Ripley Software Development +* All Rights Reserved +* +* This file is part of the XmHTML Widget Library. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU [Library] General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library 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 +* Library General Public License for more details. +* +* You should have received a copy of the GNU [Library] General Public +* License along with this library; if not, write to the Free +* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +*****/ +/***** +* $Source: /debian/home/gnomecvs/gnome/gtk-xmhtml/XmHTMLI.h,v $ +*****/ +/***** +* ChangeLog +* $Log: XmHTMLI.h,v $ +* Revision 1.5 1997/12/29 22:16:22 unammx +* This version does: +* +* - Sync with Koen to version Beta 1.1.2c of the XmHTML widget. +* Includes various table fixes. +* +* - Callbacks are now properly checked for the Gtk edition (ie, +* signals). +* +* Revision 1.4 1997/12/25 01:34:09 unammx +* Good news for the day: +* +* I have upgraded our XmHTML sources to XmHTML 1.1.1. +* +* This basically means that we got table support :-) +* +* Still left to do: +* +* - Set/Get gtk interface for all of the toys in the widget. +* - Frame support is broken, dunno why. +* - Form support (ie adding widgets to it) +* +* Miguel. +* +* Revision 1.3 1997/12/18 23:00:16 unammx +* More fixes and added PNG support. - Federico +* +* Revision 1.2 1997/12/11 21:20:21 unammx +* Step 2: more gtk/xmhtml code, still non-working - mig +* +* Revision 1.1 1997/11/28 03:38:55 gnomecvs +* Work in progress port of XmHTML; No, it does not compile, don't even try -mig +* +* Revision 1.2 1997/10/23 00:24:46 newt +* XmHTML Beta 1.1.0 release +* +* Revision 1.1 1997/08/30 00:07:31 newt +* Initial Revision +* +*****/ + +#ifndef _XmHTMLI_h_ +#define _XmHTMLI_h_ + +_XFUNCPROTOBEGIN + +/***** +* When XmHTML_ERROR_FUNCS is defined, only the error functions (at the end +* of this include file) will be visible to the outside world. +*****/ +#ifndef XmHTML_ERROR_FUNCS + +/* usefull macros */ +#define Abs(x) ((x) < 0 ? -(x) : (x)) +#define Max(x,y) (((x) > (y)) ? (x) : (y)) +#define Min(x,y) (((x) < (y)) ? (x) : (y)) +#define FONTHEIGHT(f) ((f)->max_bounds.ascent + (f)->max_bounds.descent) +#define FnHeight(f) ((f)->ascent + (f)->descent) + +/* RANGE forces a to be in the range b..c (inclusive) */ +#define RANGE(a,b,c) { if (a < b) a = b; if (a > c) a = c; } + +/********************************************************************* +* @Module: parse.c +* @Description: XmHTML HTML parser +* +* @Defines: +* struct Parser: parser object +* +* @Exports: +* _XmHTMLparseHTML : raw HTML parser. +* _XmHTMLFreeObjects : free the given parser tree. +* _XmHTMLTextGetSTring: create a HTML source document from the given +* parser tree. +* _ParserCreate : create a parser Object. +* _ParserDelete : delete a parser Object. +* _ParserIsBodyElement: check whether an element may appear inside +* the tag. +* _ParserIsElementTerminated : check if an element has a terminating +* counterpart. +* _ParserCheckElementOccurance: check whether presence of an element in +* in a certain state is allowed. +* _ParserCheckElementContent : check whether an element is allowed to +* appear in a certain state. +* _ParserCutComment : cut a HTML comment from the input stream. +* _ParserNewObject : allocate a new object. +* _ParserPushState : push a parser state on the stack. +* _ParserPopState : pop a parser state from the stack. +* _ParserOnStack : check if the given element is on the stack. +* _ParserTokenToId : convert a string to an internal element id. +* _ParserStoreElement : store a real element +* _ParserStoreTextElement: store a text element. +* _ParserStoreTextElementRtoL: store a text element and reverse it's contents. +* _ParserInsertElement: insert a new element in the list of elements. +* _ParserTerminateElement: terminate the given element. Backtracks both stack +* and element list +* _ParserCopyElement : copy an element +* _ParserVerify : verify (and correct) the presence of an element. +* _ParserVerifyVerification: verify whether the parser successfully +* verified/repaired a document. +* +**********************************************************************/ + +extern XmHTMLObject *_XmHTMLparseHTML(XmHTMLWidget html, XmHTMLObject *old_list, + char *input, XmHTMLWidget dest); + +extern void _XmHTMLFreeObjects(XmHTMLObject *objects); + +extern String _XmHTMLTextGetString(XmHTMLObject *objects); + + +typedef struct _Parser{ + String source; /* text being parsed */ + int index; /* last known position */ + int len; /* length of input text */ + int num_lines; /* current line count */ + Dimension line_len; /* maximum line length so far */ + Dimension cnt; /* current line length */ + /* running list of inserted elements */ + int num_elements; /* no of tags inserted so far */ + int num_text; /* no of text elements inserted so far */ + XmHTMLObject *head; /* head of object list */ + XmHTMLObject *current; /* lastly inserted element */ + stateStack state_base; /* stack base point */ + stateStack *state_stack; /* actual stack */ + int cstart; /* current element start position */ + int cend; /* current element end position */ + int inserted; /* no of auto-inserted chars */ + Cardinal err_count; /* no of errors so far */ + Cardinal loop_count; /* no of loops made so far */ + Boolean strict_checking; /* HTML 3.2 looseness flag */ + Boolean have_body; /* indicates presence of tag */ + Byte warn; /* warn about bad html constructs */ + Boolean bad_html; /* bad HTML document flag */ + Boolean html32; /* HTML32 conforming document flag */ + Boolean automatic; /* when in automatic mode */ + TWidget widget; /* for the warning messages */ +}Parser; + +extern Parser *_ParserCreate(TWidget w); + +extern void _ParserDelete(Parser *parser); + +extern Boolean _ParserIsBodyElement(htmlEnum id); + +extern Boolean _ParserIsElementTerminated(htmlEnum id); + +extern int _ParserCheckElementOccurance(Parser *parser, htmlEnum current, + htmlEnum state); + +extern Boolean _ParserCheckElementContent(Parser *parser, htmlEnum current, + htmlEnum state); + +extern String _ParserCutComment(Parser *parser, String start); + +extern XmHTMLObject *_ParserNewObject(Parser *parser, htmlEnum id, + char *element, char *attributes, Boolean is_end, Boolean terminated); + +extern void _ParserPushState(Parser *parser, htmlEnum id); + +extern htmlEnum _ParserPopState(Parser *parser); + +extern Boolean _ParserOnStack(Parser *parser, htmlEnum id); + +extern htmlEnum _ParserTokenToId(Parser *parser, String token, Boolean warn); + +extern String _ParserStoreElement(Parser *parser, char *start, char *end); + +extern void _ParserStoreTextElement(Parser *parser, char *start, char *end); + +extern void _ParserStoreTextElementRtoL(Parser *parser, char *start, char *end); + +extern void _ParserInsertElement(Parser *parser, String element, + htmlEnum new_id, Boolean is_end); + +extern Boolean _ParserTerminateElement(Parser *parser, String element, + htmlEnum current, htmlEnum expect); + +extern void _ParserCopyElement(Parser *parser, XmHTMLObject *src, + Boolean is_end); + +extern int _ParserVerify(Parser *parser, htmlEnum id, Boolean is_end); + +extern XmHTMLObject *_ParserVerifyVerification(XmHTMLObject *objects); + +/* set of macros used by both parse.c and Parser.c */ + +/* elements for which a closing counterpart is optional */ +#define OPTIONAL_CLOSURE(id) ((id) == HT_DD || (id) == HT_DT || \ + (id) == HT_LI || (id) == HT_P || (id) == HT_OPTION || (id) == HT_TD || \ + (id) == HT_TH || (id) == HT_TR) + +/* physical/logical markup elements */ +#define IS_MARKUP(id) ((id) == HT_TT || (id) == HT_I || (id) == HT_B || \ + (id) == HT_U || (id) == HT_STRIKE || (id) == HT_BIG || (id) == HT_SMALL || \ + (id) == HT_SUB || (id) == HT_SUP || (id) == HT_EM || (id) == HT_STRONG || \ + (id) == HT_DFN || (id) == HT_CODE || (id) == HT_SAMP || (id) == HT_KBD || \ + (id) == HT_VAR || (id) == HT_CITE || (id) == HT_FONT) + +/* text containers */ +#define IS_CONTAINER(id) ((id) == HT_BODY || (id) == HT_DIV || \ + (id) == HT_CENTER || (id) == HT_BLOCKQUOTE || (id) == HT_FORM || \ + (id) == HT_TH || (id) == HT_TD || (id) == HT_DD || (id) == HT_LI || \ + (id) == HT_NOFRAMES) + +/* all elements that may be nested */ +#define NESTED_ELEMENT(id) (IS_MARKUP(id) || (id) == HT_APPLET || \ + (id) == HT_BLOCKQUOTE || (id) == HT_DIV || (id) == HT_CENTER || \ + (id) == HT_FRAMESET) + +/* other elements */ +#define IS_MISC(id) ((id) == HT_P || (id) == HT_H1 || (id) == HT_H2 || \ + (id) == HT_H3 || (id) == HT_H4 || (id) == HT_H5 || (id) == HT_H6 || \ + (id) == HT_PRE || (id) == HT_ADDRESS || (id) == HT_APPLET || \ + (id) == HT_CAPTION || (id) == HT_A || (id) == HT_DT) + +/********************************************************************* +* @Module: callbacks.c +* @Description: XmHTML callback routines +* +* @Exports: +* _XmHTMLLinkCallback : XmNlinkCallback driver. +* _XmHTMLTrackCallback: XmNanchorTrackCallback driver. +* _XmHTMLActivateCallback: XmNactivateCallback drivers +* _XmHTMLDocumentCallback: XmNdocumentCallback drivers. +* +**********************************************************************/ + +extern void _XmHTMLLinkCallback(XmHTMLWidget html); + +extern void _XmHTMLTrackCallback(XmHTMLWidget html, TEvent *event, + XmHTMLAnchor *anchor); + +extern void _XmHTMLActivateCallback(XmHTMLWidget html, TEvent *event, + XmHTMLAnchor *anchor); + +extern Boolean _XmHTMLDocumentCallback(XmHTMLWidget html, Boolean html32, + Boolean verified, Boolean balanced, Boolean terminated, int pass_level); + +/********************************************************************* +* @Module: format.c +* @Description : XmHTML formatting routines, translate the parse output +* to a set of objects suitable for displaying a HTML page. +* +* @Exports: +* _XmHTMLformatObjects: create a list of formatted objects. +* _XmHTMLNewAnchor : allocate and fill a new anchor. +* +**********************************************************************/ + +extern void _XmHTMLformatObjects(XmHTMLWidget old, XmHTMLWidget html); + +extern XmHTMLAnchor* _XmHTMLNewAnchor(XmHTMLWidget html, XmHTMLObject *object); + +/********************************************************************* +* @Module: frames.c +* @Description: XmHTML frame support +* +* @Exports: +* _XmHTMLCreateFrames : create all required HTML frame widgets. +* _XmHTMLCheckForFrames: check for a frameset definition, destroying +* any previous frame lists. +* _XmHTMLReconfigureFrames : recompute the frame layout after a widget +* resize. +* _XmHTMLFrameCreateCallback : XmNframeCallback driver for frame creation. +* _XmHTMLFrameDestroyCallback: XmNframeCallback driver for frame +* destruction. +* +**********************************************************************/ + +extern Boolean _XmHTMLCreateFrames(XmHTMLWidget old, XmHTMLWidget html); + +extern void _XmHTMLDestroyFrames(XmHTMLWidget html, int nframes); + +extern TWidget _XmHTMLFrameCreateCallback(XmHTMLWidget html, + XmHTMLFrameWidget *frame); + +extern void _XmHTMLFrameDestroyCallback(XmHTMLWidget html, + XmHTMLFrameWidget *frame); + +extern int _XmHTMLCheckForFrames(XmHTMLWidget html, XmHTMLObject *objects); + +extern void _XmHTMLReconfigureFrames(XmHTMLWidget html); + +/********************************************************************* +* @Module: forms.c +* @Description: XmHTML HTML form support. +* +* @Exports: +* _XmHTMLStartForm : start a new form. +* _XmHTMLEndForm : terminate the form opened with _XmHTMLStartForm. +* _XmHTMLFreeForm : destroy a given form. +* _XmHTMLFormAddInput : add an input field to the current form. +* _XmHTMLFormAddSelect : add a select field to the current form. +* _XmHTMLFormSelectAddOption: add an option to select opened with +* _XmHTMLFormAddSelect. +* _XmHTMLFormSelectClose : close the select opened with +* _XmHTMLFormAddSelect. +* _XmHTMLFormAddTextArea : add a text area to the current form. +* _XmHTMLFormActivate : XmNformCallback driver. +* _XmHTMLFormReset : reset a given form to it's default values. +* _XmHTMLProcessTraversal: form widget traversal handler. +* +**********************************************************************/ + +extern void _XmHTMLStartForm(XmHTMLWidget html, String attributes); + +extern void _XmHTMLEndForm(XmHTMLWidget html); + +extern XmHTMLForm *_XmHTMLFormAddInput(XmHTMLWidget html, String attributes); + +extern XmHTMLForm *_XmHTMLFormAddSelect(XmHTMLWidget html, String attributes); + +extern XmHTMLForm *_XmHTMLFormAddTextArea(XmHTMLWidget html, + String attributes, String text); + +extern void _XmHTMLFormSelectAddOption(XmHTMLWidget html, XmHTMLForm *entry, + String attributes, String label); + +extern void _XmHTMLFormSelectClose(XmHTMLWidget html, XmHTMLForm *entry); + +extern void _XmHTMLFreeForm(XmHTMLWidget html, XmHTMLFormData *form); + +extern void _XmHTMLFormActivate(XmHTMLWidget html, TEvent *event, + XmHTMLForm *entry); + +extern void _XmHTMLFormReset(XmHTMLWidget html, XmHTMLForm *entry); + +extern void _XmHTMLProcessTraversal(TWidget w, int direction); + +extern XmHTMLObjectTableElement _XmHTMLGetAnchorByValue(XmHTMLWidget html, + int anchor_id); + +/********************************************************************* +* @Module: XmHTML.c +* @Description: XmHTML Widget definition, widget methods and public +* functions. +* +* @Exports: +* _XmHTMLGetAnchorByValue: finds the object of a named anchor by it's id. +* _XmHTMLGetAnchorByName : finds the object of a named anchor by it's name. +* _XmHTMLMoveToPos : scroll the display area by a given amount. +* Scroll direction is given by the widget id. +* _XmHTMLCheckXCC : create a XColorContext for the a HTML widget. +* _XmHTMLClearArea : XClearArea for a XmHTML widget. +* _XmHTMLCvtStringToWarning: convert a XmCHTMLWarningType to it's internal +* representation. +* +**********************************************************************/ + +extern XmHTMLObjectTableElement _XmHTMLGetAnchorByName(XmHTMLWidget html, + String anchor); + +extern void _XmHTMLMoveToPos(TWidget w, XmHTMLWidget html, int value); + +extern void _XmHTMLCheckXCC(XmHTMLWidget html); + +extern void _XmHTMLClearArea(XmHTMLWidget html, int x, int y, int width, + int height); + +extern Boolean _XmHTMLCvtStringToWarning(Display *dpy, XrmValuePtr args, + Cardinal *num_args, XrmValuePtr from_val, XrmValuePtr to_val, + XtPointer *converter_data); + +/********************************************************************* +* @Module: paint.c +* @Description: XmHTML rendering routines. +* +* @Exports: +* _XmHTMLPaint : display a list of objects. +* _XmHTMLRestartAnimations: freeze or restart all animations in a document. +* _XmHTMLDrawImage : refresh a single image. +* +**********************************************************************/ + +/* Pour given paint commands onto the display. */ +extern void _XmHTMLPaint(XmHTMLWidget html, XmHTMLObjectTable *start, + XmHTMLObjectTable *end); + +extern void _XmHTMLRestartAnimations(XmHTMLWidget html); + +extern void _XmHTMLDrawImage(XmHTMLWidget html, XmHTMLObjectTableElement data, + int y_offset, Boolean from_timerCB); + +/********************************************************************* +* @Module: layout.c +* @Description : XmHTML layout computation routines +* +* @Exports: +* _XmHTMLComputeLayout: computes the full screen layout for a XmHTML +* widget. +* +**********************************************************************/ + +extern void _XmHTMLComputeLayout(XmHTMLWidget html); + +/********************************************************************* +* @Module: StringUtil.c +* @Description: string manipulators and HTML tag analyzers. +* +* @Exports: +* __my_translation_table : lowercase translation table. +* my_upcase : make a string all uppercase. +* my_locase : make a string all lowercase. +* my_strcasestr : case insensitive strstr. +* ToAsciiLower : convert a number to all lowercase ASCII. +* ToAsciiUpper : convert a number to all uppercase ASCII. +* ToRomanLower : convert a number to all uppercase roman numerals. +* ToRomanUpper : convert a number to all lowercase roman numerals. +* _XmHTMLExpandEscapes : expand all escape sequences in the given text. +* _XmHTMLTagCheck : Check the existance of a tag. +* _XmHTMLTagGetValue : Get the value of a tag. +* _XmHTMLTagGetNumber : Get the numerical value of a tag. +* _XmHTMLTagCheckNumber : Get the absolute (positive no returned) or +* relative (negative no returned) value of a tag. +* _XmHTMLTagCheckValue : check if the given tag exists. +* _XmHTMLGetImageAlignment : Retrieve the value of the ALIGN attribute on images. +* _XmHTMLGetHorizontalAlignment: Retrieve the value of the ALIGN attribute. +* _XmHTMLGetVerticalAlignment: Retrieve the value of the VALIGN attribute. +* _XmHTMLGetFraming : Retrieve the value of the FRAME table attribute. +* _XmHTMLGetRuling : Retrieve the value of the RULE table attribute +* _XmHTMLGetMaxLineLength : Returns maximum width of a line in pixels of +* the current document or 75% of screen width, +* whatever is the smallest. +* +**********************************************************************/ + +extern void my_upcase(char *string); +extern void my_locase(char *string); +extern char *my_strcasestr(const char *s1, const char *s2); +extern char *my_strndup(const char *s1, size_t len); +extern const Byte __my_translation_table[]; +#define _FastLower(x) (__my_translation_table[(unsigned int)x]) + +#ifdef NEED_STRERROR +extern char *sys_errlist[]; +extern int errno; +#define strerror(ERRNUM) sys_errlist[ERRNUM] +#endif + +#ifdef NEED_STRCASECMP +# include +extern int my_strcasecmp(const char *s1, const char *s2); +extern int my_strncasecmp(const char *s1, const char *s2, size_t n); +#define strcasecmp(S1,S2) my_strcasecmp(S1,S2) +#define strncasecmp(S1,S2,N) my_strncasecmp(S1,S2,N) +#endif + +extern String ToAsciiLower(int val); + +extern String ToAsciiUpper(int val); + +extern String ToRomanUpper(int val); + +extern String ToRomanLower(int val); + +extern void _XmHTMLExpandEscapes(char *string, Boolean warn); + +extern Boolean _XmHTMLTagCheck(char *attributes, char *tag); + +extern char *_XmHTMLTagGetValue(char *attributes, char *tag); + +extern int _XmHTMLTagGetNumber(char *attributes, char *tag, int def); + +extern int _XmHTMLTagCheckNumber(char *attributes, char *tag, int def); + +extern Boolean _XmHTMLTagCheckValue(char *attributes, + char *tag, char *check); + +extern Alignment _XmHTMLGetImageAlignment(char *attributes); + +extern Alignment _XmHTMLGetHorizontalAlignment(char *attributes, + Alignment def_align); + +extern Alignment _XmHTMLGetVerticalAlignment(char *attributes, + Alignment def_align); + +extern TableFraming _XmHTMLGetFraming(char *attributes, TableFraming def); + +extern TableRuling _XmHTMLGetRuling(char *attributes, TableRuling def); + +extern Dimension _XmHTMLGetMaxLineLength(XmHTMLWidget html); + +/********************************************************************* +* @Module: colors.c +* @Description : XmHTML *text* color allocation routines. +* +* @Exports: +* _XmHTMLGetPixelByName : allocate and return the named pixel. +* _XmHTMLConfirmColor32 : check name of the given color. Only when +* XmNstrictHTMLChecking is True. +* _XmHTMLFreeColors : free the colors allocated for the given widget. +* _XmHTMLRecomputeColors : Recompute top shadow, bottom shadow & highlight +* colors. +* _XmHTMLRecomputeHighlightColor: Recompute the highlight color given a +* background pixel. +* _XmHTMLAddPalette : add a palette to the widget (used for dithering) +* +**********************************************************************/ + +extern Pixel _XmHTMLGetPixelByName(XmHTMLWidget html, String color, + Pixel def_pixel); + +extern Boolean _XmHTMLConfirmColor32(char *color); + +extern void _XmHTMLFreeColors(XmHTMLWidget html); + +extern void _XmHTMLRecomputeColors(XmHTMLWidget html); + +extern void _XmHTMLRecomputeHighlightColor(XmHTMLWidget html, Pixel bg_color); + +extern Boolean _XmHTMLAddPalette(XmHTMLWidget html); + +/********************************************************************* +* @Module: images.c +* @Description: XmHTML image loading/manipulation routines. +* +* @Defines: +* struct XmHTMLRawImageData: intermediate image data structure. +* +* @Exports: +* bitmap_bits[] : bit array required for creating depth 1 +* images (bitmaps). +* XmImageGifProc_plugin : external gif decoder hook. +* XmImageGifzCmd_plugin : external decompressor hook. +* _xmimage_cfg : XmImage configuration hook. +* _XmHTMLGetImageType : return type of image +* _XmHTMLImageFileToBuffer: read a file in a buffer +* _XmHTMLNewImage : create a new image +* _XmHTMLLoadBodyImage :load and set the body image. +* _XmHTMLImageUpdateChilds: update all copies of the given parent image. +* _XmHTMLImageCheckDelayedCreation: process all images that need rereading +* (alpha channel processing) +* _XmHTMLMakeAnimation : create an animation for the given image. +* _XmHTMLInfoToPixmap : create a pixmap from the given ImageInfo data. +* _XmHTMLReplaceOrUpdateImage: replace or update an image. +* _XmHTMLFreeImage : Free private image data. +* _XmHTMLFreeImageInfo : Free external image data. +* _XmHTMLReleaseImage : Free an image and adjust the internal list of +* images. +* _XmHTMLCreateXImage : create a new but empty XImage with given +* dimensions +* _XmHTMLFillXImage : fill the given XImage. +* _XmHTMLReadBitmap : read an X11 bitmap. +* _XmHTMLReadGIF : read a GIF file. +* _XmHTMLReadFLG : read a FLG file (Fast Loadable Graphic). +* _XmHTMLReadXPM : read an X11 XPM image. +* _XmHTMLReadPNG : read a PNG image. +* _XmHTMLReadJPEG : read a JPEG image. +* _XmHTMLGifReadOK : read a number of bytes from a GIF datafile. +* _XmHTMLGifGetDataBlock : read a GIF datablock from a GIF datafile. +* _XmHTMLIsGifAnimated : check whether a GIF is animated or not +* _XmHTMLGifAnimInit : Initialize gif animation reading +* _XmHTMLGifAnimNextFrame : read a frame from an animated gif file. +* _XmHTMLGifAnimTerminate : wrap up animated gif reading. +* _XmHTMLCreateXpmFromData: read an X11 XPM image from raw XPM data. +* _XmHTMLReReadPNG : process alpha channelled PNG images. +* +**********************************************************************/ +extern Byte bitmap_bits[]; +extern XmImageGifProc XmImageGifProc_plugin; +extern String XmImageGifzCmd_plugin; +extern XmImageConfig *_xmimage_cfg; + +typedef struct _XmHTMLRawImageData{ + Byte *data; /* raw image data */ + Byte *alpha; /* alpha channel data */ + int width; /* image width in pixels */ + int height; /* image height in pixels */ + int bg; /* transparent pixel index */ + TColor *cmap; /* colormap for this image */ + int cmapsize; /* actual no of colors in image colormap */ + Byte type; /* type of image */ + Byte color_class; /* color class for this image */ + Boolean delayed_creation; + float fg_gamma; /* image foreground gamma */ +}XmHTMLRawImageData; + +#define FreePixmap(DPY,PIX) if((PIX)!= None) Toolkit_Free_Pixmap((DPY),(PIX)) + +/* check whether the body image is fully loaded */ +#define BodyImageLoaded(IMAGE) \ + ((IMAGE) ? (!ImageInfoDelayed((IMAGE)) && \ + !ImageInfoProgressive((IMAGE))) : True) + +/* XmHTMLImage macros */ +#define ImageIsBackground(IMG) ((IMG)->options & IMG_ISBACKGROUND) +#define ImageIsInternal(IMG) ((IMG)->options & IMG_ISINTERNAL) +#define ImageIsCopy(IMG) ((IMG)->options & IMG_ISCOPY) +#define ImageIsAnim(IMG) ((IMG)->options & IMG_ISANIM) +#define ImageFrameRefresh(IMG) ((IMG)->options & IMG_FRAMEREFRESH) +#define ImageHasDimensions(IMG) ((IMG)->options & IMG_HASDIMENSIONS) +#define ImageHasState(IMG) ((IMG)->options & IMG_HASSTATE) +#define ImageInfoFreed(IMG) ((IMG)->options & IMG_INFOFREED) +#define ImageDelayedCreation(IMG) ((IMG)->options & IMG_DELAYED_CREATION) +#define ImageIsOrphaned(IMG) ((IMG)->options & IMG_ORPHANED) +#define ImageIsProgressive(IMG) ((IMG)->options & IMG_PROGRESSIVE) + +/* XmImageInfo macros */ +#define ImageInfoDelayed(INFO) ((INFO)->options & XmIMAGE_DELAYED) +#define ImageInfoFreeLater(INFO) ((INFO)->options & XmIMAGE_DEFERRED_FREE) +#define ImageInfoFreeNow(INFO) ((INFO)->options & XmIMAGE_IMMEDIATE_FREE) +#define ImageInfoScale(INFO) ((INFO)->options & XmIMAGE_ALLOW_SCALE) +#define ImageInfoRGBSingle(INFO) ((INFO)->options & XmIMAGE_RGB_SINGLE) +#define ImageInfoShared(INFO) ((INFO)->options & XmIMAGE_SHARED_DATA) +#define ImageInfoClipmask(INFO) ((INFO)->options & XmIMAGE_CLIPMASK) +#define ImageInfoDelayedCreation(INFO) \ + ((INFO)->options & XmIMAGE_DELAYED_CREATION) +#define ImageInfoProgressive(INFO) ((INFO)->options & XmIMAGE_PROGRESSIVE) + +/* rewind the given image buffer */ +#define RewindImageBuffer(IB) do{ \ + (IB)->next = (size_t)0; \ + (IB)->curr_pos = (IB)->buffer; \ +}while(0) + +/* free the given image buffer */ +#define FreeImageBuffer(IB) { \ + if((IB)->may_free) { \ + free((IB)->file); \ + free((IB)->buffer); \ + free((IB)); \ + (IB) = NULL; \ + } \ +} + +/* allocate and initialize a rawImageData structure */ +#define AllocRawImage(IMG, W, H) do { \ + IMG = (XmHTMLRawImageData*)malloc(sizeof(XmHTMLRawImageData)); \ + memset(IMG, 0, sizeof(XmHTMLRawImageData)); \ + IMG->cmapsize = 0; \ + IMG->bg = -1; \ + IMG->width = W; \ + IMG->height = H; \ + IMG->data = (Byte*)calloc(W*H, sizeof(Byte)); \ + IMG->delayed_creation = False; \ + IMG->color_class = XmIMAGE_COLORSPACE_INDEXED; \ +}while(0) + +#ifdef WITH_MOTIF +/* allocate a colormap for the given rawImageData */ +#define AllocRawImageCmap(IMG,SIZE) do { \ + int i; \ + IMG->cmap = (XColor*)calloc(SIZE, sizeof(XColor)); \ + for(i = 0; i < SIZE; i++) { \ + IMG->cmap[i].pixel = i; IMG->cmap[i].flags = DoRed|DoGreen|DoBlue; } \ + IMG->cmapsize = SIZE; \ +}while(0) +#else + +#define AllocRawImageCmap(IMG,SIZE) do { \ + int i; \ + IMG->cmap = (GdkColor*)calloc(SIZE, sizeof(GdkColor)); \ + for(i = 0; i < SIZE; i++) { \ + IMG->cmap[i].pixel = i; } \ + IMG->cmapsize = SIZE; \ +}while(0) +#endif + +/* allocate and initialize a rawImageData structure with a colormap */ +#define AllocRawImageWithCmap(IMG, W, H, SIZE) do { \ + IMG = (XmHTMLRawImageData*)malloc(sizeof(XmHTMLRawImageData)); \ + memset(IMG, 0, sizeof(XmHTMLRawImageData)); \ + AllocRawImageCmap(IMG,SIZE); \ + IMG->bg = -1; \ + IMG->width = W; \ + IMG->height = H; \ + IMG->data = (Byte*)calloc(W*H, sizeof(Byte)); \ + IMG->delayed_creation = False; \ +}while(0) + +/* destroy allocated image. Only to be called upon error */ +#define FreeRawImage(IMG) do{ \ + if(IMG != NULL) { \ + if(IMG->data) free(IMG->data); \ + if(IMG->cmap) free(IMG->cmap); \ + free(IMG); \ + IMG = NULL; \ + }\ +}while(0) + +/* reset a rawImageData structure */ +#define ResetRawImage(IMG) do { \ + memset(IMG, 0, sizeof(XmHTMLRawImageData)); \ + if(IMG->cmap) free(IMG->cmap); /* erase existing colormap */ \ + IMG->cmap = (TColor*)NULL; \ + IMG->cmapsize = 0; \ + IMG->bg = -1; \ + IMG->width = 0; \ + IMG->height = 0; \ + IMG->data = (Byte*)NULL; \ + IMG->delayed_creation = False; \ +}while(0) + +extern Byte _XmHTMLGetImageType(ImageBuffer *ib); + +extern ImageBuffer *_XmHTMLImageFileToBuffer(String file); + +extern XmHTMLRawImageData *_XmHTMLReadBitmap(TWidget html, ImageBuffer *ib); + +extern XmHTMLRawImageData *_XmHTMLReadGIF(TWidget html, ImageBuffer *ib); + +extern XmImageInfo *_XmHTMLReadFLG(XmHTMLWidget html, ImageBuffer *ib); + +extern size_t _XmHTMLGifReadOK(ImageBuffer *ib, unsigned char *buf, int len); + +extern size_t _XmHTMLGifGetDataBlock(ImageBuffer *ib, unsigned char *buf); + +extern int _XmHTMLIsGifAnimated(ImageBuffer *fd); + +extern int _XmHTMLGifAnimInit(TWidget html, ImageBuffer *ib, + XmHTMLRawImageData *data); + +extern Boolean _XmHTMLGifAnimNextFrame(ImageBuffer *ib, + XmHTMLRawImageData *data, int *x, int *y, int *timeout, int *dispose); + +extern void _XmHTMLGifAnimTerminate(ImageBuffer *ib); + +extern XmHTMLRawImageData *_XmHTMLReadXPM(TWidget html, ImageBuffer *ib); + +extern XmHTMLRawImageData *_XmHTMLCreateXpmFromData(TWidget html, char **data, + String src); + +extern XmHTMLRawImageData *_XmHTMLReadPNG(TWidget html, ImageBuffer *ib); + +extern XmHTMLRawImageData *_XmHTMLReReadPNG(XmHTMLWidget html, + XmHTMLRawImageData *raw_data, int x, int y, Boolean is_body_image); + +extern XmHTMLRawImageData *_XmHTMLReadJPEG(TWidget html, ImageBuffer *ib); + +extern TXImage *_XmHTMLCreateXImage(XmHTMLWidget html, XCC xcc, Dimension width, + Dimension height, String url); + +extern void _XmHTMLFillXImage(XmHTMLWidget html, TXImage *ximage, XCC xcc, + Byte *data, unsigned long *xcolors, int *start, int *end); + +extern XmHTMLImage *_XmHTMLNewImage(XmHTMLWidget html, String attributes, + Dimension *width, Dimension *height); + +extern void _XmHTMLImageUpdateChilds(XmHTMLImage *image); + +extern void _XmHTMLImageCheckDelayedCreation(XmHTMLWidget html); + +extern void _XmHTMLMakeAnimation(XmHTMLWidget html, XmHTMLImage *image, + Dimension width, Dimension height); + +extern TPixmap _XmHTMLInfoToPixmap(XmHTMLWidget html, XmHTMLImage *image, + XmImageInfo *info, Dimension width, Dimension height, + unsigned long *global_cmap, TPixmap *clip); + +extern XmImageStatus _XmHTMLReplaceOrUpdateImage(XmHTMLWidget html, + XmImageInfo *info, XmImageInfo *new_info, XmHTMLObjectTableElement *elePtr); + +extern void _XmHTMLFreeImage(XmHTMLWidget html, XmHTMLImage *image); + +extern void _XmHTMLFreeImageInfo(XmHTMLWidget html, XmImageInfo *info, + Boolean external); + +extern void _XmHTMLReleaseImage(XmHTMLWidget html, XmHTMLImage *image); + +extern void _XmHTMLLoadBodyImage(XmHTMLWidget html, String url); + +/********************************************************************* +* @Module: quantize.c +* @Description : XmHTML color quantization and dithering routines +* +* @Exports: +* _XmHTMLQuantizeImage: quantize the given image data down to max_colors. +* _XmHTMLConvert24to8 : convert a 24bit image to an 8bit paletted one, +* quantizing if required. +* _XmHTMLPixelizeRGB : convert an RGB image to a 8bit paletted image. +* _XmHTMLDitherImage : dither the given image to a fixed palette. +* +**********************************************************************/ +extern void _XmHTMLConvert24to8(Byte *data, XmHTMLRawImageData *img_data, + int max_colors, Byte mode); + +extern void _XmHTMLQuantizeImage(XmHTMLRawImageData *img_data, int max_colors); + +extern void _XmHTMLPixelizeRGB(Byte *rgb, XmHTMLRawImageData *img_data); + +extern void _XmHTMLDitherImage(XmHTMLWidget html, XmHTMLRawImageData *img_data); + +/********************************************************************* +* @Module: map.c +* @Description: XmHTML imagemap routines +* +* @Defines: +* struct _mapArea: structure identifying the shape and size of a HTML +* AREA definition. +* +* @Exports: +* _XmHTMLCreateImagemap : create an imagemap. +* _XmHTMLStoreImagemap : store an imagemap +* _XmHTMLAddAreaToMap : add an area to an imagemap. +* _XmHTMLGetImagemap : get the named imagemap +* _XmHTMLGetAnchorFromMap: return anchor data referenced by the given +* positions and imagemap. +* _XmHTMLCheckImagemaps : check for possible external imagemaps. +* _XmHTMLFreeImageMaps : free all imagemaps for a XmHTMLWidget. +* _XmHTMLDrawImagemapSelection: draw selection areas around each area +* in an imagemap. +* +**********************************************************************/ +extern XmHTMLImageMap* _XmHTMLCreateImagemap(String name); + +extern void _XmHTMLStoreImagemap(XmHTMLWidget html, XmHTMLImageMap *map); + +extern void _XmHTMLAddAreaToMap(XmHTMLWidget html, XmHTMLImageMap *map, + XmHTMLObject *object); + +extern XmHTMLImageMap *_XmHTMLGetImagemap(XmHTMLWidget html, String name); + +extern XmHTMLAnchor *_XmHTMLGetAnchorFromMap(XmHTMLWidget html, int x, int y, + XmHTMLImage *image, XmHTMLImageMap *map); + +extern void _XmHTMLCheckImagemaps(XmHTMLWidget html); + +extern void _XmHTMLFreeImageMaps(XmHTMLWidget html); + +extern void _XmHTMLDrawImagemapSelection(XmHTMLWidget html, + XmHTMLImage *image); + +/********************************************************************* +* @Module: plc.c +* Description: XmHTML Progressive Loader Context interfacing routines. +* +* @Exports: +* _XmHTMLPLCCreate: create a PLC object suitable for progressive loading. +* _XmHTMLPLCCycler: main PLC cycler with dynamic timeout recalculation. +* _XmHTMLKillPLCCycler: kill and remove any outstanding PLC's +* +**********************************************************************/ + +extern PLCPtr _XmHTMLPLCCreate(XmHTMLWidget html, TPointer priv_data, + String url, Byte type); + +#ifdef WITH_MOTIF +extern void _XmHTMLPLCCycler(TPointer call_data, TIntervalId *proc_id); +#else +gint +_XmHTMLPLCCycler(gpointer call_data); +#endif + +extern void _XmHTMLKillPLCCycler(XmHTMLWidget html); + +/********************************************************************* +* @Module: fonts.c +* @Description: XmHTML font loading & caching routines. +* +* @Exports: +* xmhtml_fn_sizes : array with scalable font sizes. +* xmhtml_basefont_sizes : array with basefont sizes. +* xmhtml_fn_fixed_sizes : array with fixed font sizes. +* _XmHTMLSelectFontCache: initialize and/or select a font cache +* (each display has a seperate one). +* _XmHTMLloadQueryFont : load or get a font from the font cache. +* _XmHTMLaddFontMapping : alias a known font to an unknown font. +* _XmHTMLLoadFont : load a font as specified by id and size. +* Properties are inherited from a given +* font. +* _XmHTMLLoadFontWithFace: load a font with a named face and size. +* Properties are inherited from a given +* font. +* _XmHTMLUnloadFonts : Release all fonts used by widget. Fonts +* are only unloaded when the last widget using +* a font cache has unloaded it's fonts. +* +**********************************************************************/ + +extern int xmhtml_fn_sizes[8]; + +extern int xmhtml_basefont_sizes[7]; + +extern int xmhtml_fn_fixed_sizes[2]; + + +extern XmHTMLfont *_XmHTMLloadQueryFont(TWidget w, String name, String family, + int ptsz, Byte style, Boolean *loaded); + +extern XmHTMLfont *_XmHTMLSelectFontCache(XmHTMLWidget html, Boolean reset); + +extern void _XmHTMLaddFontMapping(XmHTMLWidget html, String name, + String family, int ptsz, Byte style, XmHTMLfont *font); + +extern XmHTMLfont *_XmHTMLLoadFont(XmHTMLWidget html, htmlEnum font_id, + int size, XmHTMLfont *curr_font); + +extern XmHTMLfont *_XmHTMLLoadFontWithFace(XmHTMLWidget html, int size, + String face, XmHTMLfont *curr_font); + +extern void _XmHTMLUnloadFonts(XmHTMLWidget html); + +/********************************************************************* +* @Module: events.c +* @Description: HTML4.0 event routines +* +* @Exports: +* _XmHTMLCheckCoreEvents: check for the HTML 4.0 core events. +* _XmHTMLCheckBodyEvents: check for the HTML 4.0 body events as well +* as the core events. +* _XmHTMLCheckFormEvents: check for the HTML 4.0
events as well +* as the core events. +* _XmHTMLProcessEvent : XmNeventCallback driver. +* _XmHTMLFreeEventDatabase: release all storage allocated for the +* HTML 4.0 event handling. +* +**********************************************************************/ + +extern AllEvents *_XmHTMLCheckCoreEvents(XmHTMLWidget html, String attributes); + +extern AllEvents *_XmHTMLCheckBodyEvents(XmHTMLWidget html, String attributes); + +extern AllEvents *_XmHTMLCheckFormEvents(XmHTMLWidget html, String attributes); + +extern void _XmHTMLProcessEvent(XmHTMLWidget html, TEvent *event, + HTEvent *ht_event); + +extern void _XmHTMLFreeEventDatabase(XmHTMLWidget old, XmHTMLWidget html); + +#endif /* XmHTML_ERROR_FUNCS */ + +/********************************************************************* +* @Module: error.c +* @Description: XmHTML warning/error functions +* +* @Exports: +* _XmHTMLWarning : Displays a warning message and continues. +* _XmHTMLError : Displays an error message and exits. +* __XmHTMLBadParent: Display a NULL/invalid parent warning message and +* continue. +* _XmHTMLAllocError: Displays an error message due to allocation +* problems and exits. +* +* @Note: There are two separate versions of XmHTML's error & warning +* functions. The debug versions include full location information while +* the normal build versions only contain the warning/error message. +* This allows us to reduce the data size of the normal build. +* +**********************************************************************/ + +#ifdef DEBUG + +#define __WFUNC__(WIDGET_ID, FUNC) (TWidget)WIDGET_ID, __FILE__, \ + __LINE__, FUNC + +extern void __XmHTMLWarning( +#if NeedVarargsPrototypes + TWidget w, String module, int line, String routine, + String fmt, ... +#endif +); + +extern void __XmHTMLError( +#if NeedVarargsPrototypes + TWidget w, String module, int line, String routine, + String fmt, ... +#endif +); + +extern void __XmHTMLBadParent(TWidget w, String src_file, int line, String func); + +#define _XmHTMLBadParent(W,FUNC) __XmHTMLBadParent(W,__FILE__,__LINE__,FUNC) + +#else /* !DEBUG */ + +#define __WFUNC__(WIDGET_ID, FUNC) (TWidget)WIDGET_ID + +extern void __XmHTMLWarning( +#if NeedVarargsPrototypes + TWidget w, String fmt, ... +#endif +); + +extern void __XmHTMLError( +#if NeedVarargsPrototypes + TWidget w, String fmt, ... +#endif +); + +extern void __XmHTMLBadParent(TWidget w, String func); + +#define _XmHTMLBadParent(W,FUNC) __XmHTMLBadParent(W,FUNC) + +#endif /* DEBUG */ + +#define _XmHTMLWarning __XmHTMLWarning +#define _XmHTMLError __XmHTMLError + +extern void _XmHTMLAllocError(TWidget w, char *module, char *routine, + char *func, int size); + +/* Don't add anything after this endif! */ +#endif /* _XmHTMLI_h_ */ diff -uNr gnome-0.10/gtk-xmhtml/XmHTMLP.h gnome-0.11/gtk-xmhtml/XmHTMLP.h --- gnome-0.10/gtk-xmhtml/XmHTMLP.h Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/XmHTMLP.h Tue Jan 6 19:58:19 1998 @@ -0,0 +1,1089 @@ +/***** +* XmHTMLP.h : XmHTML Widget private header file +* +* This file Version $Revision: 1.8 $ +* +* Creation date: Tue Nov 19 23:18:41 GMT+0100 1996 +* Last modification: $Date: 1998/01/07 01:45:36 $ +* By: $Author: unammx $ +* Current State: $State: Exp $ +* +* Author: newt +* (C)Copyright 1995-1996 Ripley Software Development +* All Rights Reserved +* +* This file is part of the XmHTML Widget Library. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Library General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library 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 +* Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public +* License along with this library; if not, write to the Free +* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +*****/ +/***** +* $Source: /debian/home/gnomecvs/gnome/gtk-xmhtml/XmHTMLP.h,v $ +*****/ +/***** +* ChangeLog +* $Log: XmHTMLP.h,v $ +* Revision 1.8 1998/01/07 01:45:36 unammx +* Gtk/XmHTML is ready to be used by the Gnome hackers now! +* Weeeeeee! +* +* This afternoon: +* +* - Changes to integrate gtk-xmhtml into an autoconf setup. +* +* - Changes to make gtk-xmhtml a library to be used by Gnome +* (simply include /* property defines */ +/* Required includes */ + +#ifdef WITH_MOTIF +# include +# include +#else +# include +# include +#endif + + + +/***** +* NEVER define VERSION *or* _LIBRARY yourself. These are defines required +* for compiling the library. When defined, they pull in a number of other +* header files which are normally *not* installed. +*****/ +#ifdef GNOME_LIB +# ifndef VERSION +# define VERSION +# endif +#endif + +#ifdef VERSION +# ifndef _LIBRARY +# define _LIBRARY +# endif +#endif/* VERSION */ + +/***** +* prevent multiple decls when building the lib. +* zconf.h (which gets included by png.h) also typedefs Byte to unsigned char. +* The compiler warning is annoying, so just don't typedef it again. +* XCC is an opaque object defined in XCCP.h +*****/ +#ifdef _LIBRARY +# ifdef WITH_MOTIF +# include "XCC.h" /* XColorContext definitions and protos */ +# else +typedef GdkColorContext *XCC; +# endif +# ifdef _ZCONF_H +# ifndef BYTE_ALREADY_TYPEDEFED +# define BYTE_ALREADY_TYPEDEFED +# endif /* BYTE_ALREADY_TYPEDEFED */ +# endif /* _ZCONF_H */ +#else + typedef struct _XColorContext *XCC; +#endif /* _LIBRARY */ + +#ifndef BYTE_ALREADY_TYPEDEFED +#define BYTE_ALREADY_TYPEDEFED +typedef unsigned char Byte; +#endif /* BYTE_ALREADY_TYPEDEFED */ + +_XFUNCPROTOBEGIN + +/***** +* A whole slew of states for all kinds of internal objects. +*****/ + +/***** +* Line styles +*****/ +#define LINE_SOLID (1<<1) /* paint a solid line */ +#define LINE_DASHED (1<<2) /* paint a dashed line */ +#define LINE_SINGLE (1<<3) /* paint a single line */ +#define LINE_DOUBLE (1<<4) /* paint a double line */ +#define LINE_STRIKE (1<<5) /* render as strikeout */ +#define LINE_UNDER (1<<6) /* render as underline */ +#define NO_LINE 0 /* no lines at all */ + +/***** +* Spacing and anchor text data bits +*****/ +#define TEXT_SPACE_NONE (1<<0) /* no spacing at all */ +#define TEXT_SPACE_LEAD (1<<1) /* add a leading space */ +#define TEXT_SPACE_TRAIL (1<<2) /* add a trailing space */ +#define TEXT_ANCHOR (1<<3) /* a regular anchor */ +#define TEXT_ANCHOR_INTERN (1<<4) /* internal anchor flag */ +#define TEXT_IMAGE (1<<5) /* indicates an image member */ +#define TEXT_FORM (1<<6) /* indicates a form member */ +#define TEXT_BREAK (1<<7) /* indicates a linebreak */ + +/***** +* HTML list marker enumeration type +*****/ +typedef enum{ + XmMARKER_NONE = 0, + XmMARKER_ARABIC = 10, + XmMARKER_ALPHA_LOWER, + XmMARKER_ALPHA_UPPER, + XmMARKER_ROMAN_LOWER, + XmMARKER_ROMAN_UPPER, + XmMARKER_DISC = 15, + XmMARKER_SQUARE, + XmMARKER_CIRCLE +}Marker; + +/***** +* Horizontal/Vertical alignment data +*****/ +typedef enum{ + XmHALIGN_NONE = 0, /* horizontal alignment */ + XmHALIGN_LEFT, + XmHALIGN_CENTER, + XmHALIGN_RIGHT, + XmHALIGN_JUSTIFY, /* extension for fully justified text */ + XmVALIGN_NONE = 8, /* vertical alignment */ + XmVALIGN_TOP, + XmVALIGN_MIDDLE, + XmVALIGN_BOTTOM, + XmVALIGN_BASELINE +}Alignment; + +/***** +* Possible types of HTML objects. +* All text types are only used when computing the screen layout +*****/ +typedef enum{ + OBJ_NONE = 0, + OBJ_TEXT, /* text element */ + OBJ_PRE_TEXT, /* preformatted text */ + OBJ_BULLET, /* all types of markers for lists */ + OBJ_HRULE, /* horizontal rule */ + OBJ_TABLE, /* table elements */ + OBJ_TABLE_FRAME, /* table caption, row, cell elements */ + OBJ_IMG, /* image elements */ + OBJ_FORM, /* form elements */ + OBJ_APPLET, /* applet elements */ + OBJ_BLOCK /* other block level elements */ +}ObjectType; + +/***** +* linefeed types +*****/ +#define CLEAR_NONE -1 /* stay on the same line */ +#define CLEAR_SOFT 0 /* return + move single line downard */ +#define CLEAR_HARD 1 /* return + move two lines downward */ +#define CLEAR_ALL 2 /* return + move baseline fully down */ + +/***** +* Server/client side and map type values +*****/ +typedef enum{ + XmMAP_NONE = 1, + XmMAP_SERVER, + XmMAP_CLIENT +}Imagemap; + +/***** +* Image option bits. +* Each of these bits represents certain state information about an image. +*****/ +#define IMG_ISBACKGROUND (1L<<1) /* is a background image */ +#define IMG_ISINTERNAL (1L<<2) /* is an internal image */ +#define IMG_ISCOPY (1L<<3) /* is a referential copy */ +#define IMG_ISANIM (1L<<4) /* is an animation */ +#define IMG_FRAMEREFRESH (1L<<5) /* set when running an animation */ +#define IMG_HASDIMENSIONS (1L<<6) /* dimensions are given in */ +#define IMG_HASSTATE (1L<<7) /* current state pixmap present */ +#define IMG_INFOFREED (1L<<8) /* imageinfo has been freed */ +#define IMG_DELAYED_CREATION (1L<<9) /* create when needed */ +#define IMG_ORPHANED (1L<<10)/* indicates orphaned image */ +#define IMG_PROGRESSIVE (1L<<11)/* indicates image is being loaded */ + +/***** +* Possible colorclass an image can have. +*****/ +#define COLOR_CLASS_GRAYSCALE 0 +#define COLOR_CLASS_INDEXED 1 +#define COLOR_CLASS_RGB 2 + +/***** +* What type of scrolling a frame should employ. +*****/ +typedef enum{ + FRAME_SCROLL_NONE = 1, + FRAME_SCROLL_AUTO, + FRAME_SCROLL_YES +}FrameScrolling; + +/***** +* Possible types of frame sizes +*****/ +typedef enum{ + FRAME_SIZE_FIXED = 1, /* size specified in pixels */ + FRAME_SIZE_RELATIVE, /* size is relative */ + FRAME_SIZE_OPTIONAL /* size is optional */ +}FrameSize; + +/***** +* The three possible anchor selection states +*****/ +#define ANCHOR_UNSELECTED (Byte)0 /* default anchor state */ +#define ANCHOR_INSELECT (Byte)1 /* anchor is gaining selection */ +#define ANCHOR_SELECTED (Byte)2 /* anchor is selected */ + +/***** +* XmHTML font style bits +*****/ +#define FONT_BOLD (1<<1) +#define FONT_MEDIUM (1<<2) +#define FONT_ITALIC (1<<3) +#define FONT_REGULAR (1<<4) +#define FONT_FIXED (1<<5) +#define FONT_SCALABLE (1<<6) + +/***** +* A XmHTML font. XmHTML uses it's own font definition for performance +* reasons (the layout routines use a *lot* of font properties). +*****/ +typedef struct{ + Byte style; /* this font's style */ + String font_name; /* full XLFD */ + String font_family; /* fontFamily (foundry-family-sw-spacing) */ + TFontStruct *xfont; /* ptr to font definition */ + int height; /* height of largest character */ + int lineheight; /* suggested lineheight */ + Cardinal isp; /* normal interword spacing */ + Cardinal eol_sp; /* additional end-of-line spacing */ + int sup_xoffset; /* additional superscript x-offset */ + int sup_yoffset; /* additional superscript y-offset */ + int sub_xoffset; /* additional subscript x-offset */ + int sub_yoffset; /* additional subscript y-offset */ + int ul_offset; /* additional underline offset */ + Cardinal ul_thickness; /* underline thickness */ + int st_offset; /* additional strikeout offset */ + Cardinal st_thickness; /* strikeout thickness */ +}XmHTMLfont; + +/********** +****** Definition of all possible Objects +**********/ + +/***** +* HTML4.0 Events +*****/ +typedef struct _HTEvent{ + int type; /* HTML4.0 event type */ + XtPointer data; /* event user data */ +}HTEvent; + +/***** +* All possible events that HTML4.0 defines +* All fields are ptrs into XmHTML HTEvent array. +*****/ +typedef struct _AllEvents{ + /* Document/Frame specific events */ + HTEvent *onLoad; + HTEvent *onUnload; + + /* HTML Form specific events */ + HTEvent *onSubmit; + HTEvent *onReset; + HTEvent *onFocus; + HTEvent *onBlur; + HTEvent *onSelect; + HTEvent *onChange; + + /* object events */ + HTEvent *onClick; + HTEvent *onDblClick; + HTEvent *onMouseDown; + HTEvent *onMouseUp; + HTEvent *onMouseOver; + HTEvent *onMouseMove; + HTEvent *onMouseOut; + HTEvent *onKeyPress; + HTEvent *onKeyDown; + HTEvent *onKeyUp; +}AllEvents; + +/***** +* Definition of an anchor +* URLType is an enumeration type defined in HTML.h +*****/ +typedef struct _XmHTMLAnchor{ + URLType url_type; /* url type of anchor */ + String name; /* name if it's a named anchor */ + String href; /* referenced URL */ + String target; /* target spec */ + String rel; /* possible rel */ + String rev; /* possible rev */ + String title; /* possible title */ + AllEvents *events; /* events to be served */ + Cardinal line; /* location of this anchor */ + Boolean visited; /* true when anchor is visited */ + struct _XmHTMLAnchor *next; /* ptr to next anchor */ +}XmHTMLAnchor; + +/***** +* Definition of a word (a word can be plain text, an image, a form member +* or a linebreak). +*****/ +typedef struct _XmHTMLWord{ + int x; /* x-position for this word */ + int y; /* y-position for this word */ + Dimension width; /* pixel width of word */ + Dimension height; /* pixel height of word */ + Cardinal line; /* line for this word */ + ObjectType type; /* type of word, used by
,	*/
+	String 				word;		/* word to display						*/
+	int 				len;		/* string length of word				*/
+	XmHTMLfont	 		*font;		/* font to use							*/
+	Byte 				line_data;	/* line data (underline/strikeout)		*/
+	Byte				spacing;	/* leading/trailing/nospace allowed		*/
+	AllEvents			*events;	/* events to be served					*/
+	struct _XmHTMLImage *image;		/* when this is an image				*/
+	struct _XmHTMLForm	*form;		/* when this is a form element			*/
+	struct _XmHTMLWord	*base;		/* baseline word for a line				*/
+	struct _XmHTMLWord	*self; 		/* ptr to itself, for anchor adjustment	*/
+	struct _XmHTMLObjectTable *owner;	/* owner of this worddata			*/
+}XmHTMLWord;
+
+/* area definition. See map.c for the full definition */
+typedef struct _mapArea mapArea;
+
+/*****
+* Client-side imagemap information
+* mapArea is a transparent object and is defined in map.c
+*****/
+typedef struct _XmHTMLImageMap{
+	String				name;		/* name of map			*/
+	int					nareas;		/* no of areas			*/
+	mapArea				*areas;		/* list of areas		*/
+	struct _XmHTMLImageMap *next;	/* ptr to next imagemap */
+}XmHTMLImageMap;
+
+/*****
+* XmHTML's internal image format.
+* One very important thing to note is that the meaning of the (width,height)
+* and (swidth,sheight) members of this structure is exactly *OPPOSITE* to
+* the members with the same name in the public structures (XmImageInfo and
+* XmImage).
+*****/
+typedef struct _XmHTMLImage{
+	/* Normal image data */
+	Byte			magic;			/* structure identifier */
+	String			url;			/* raw src specification */
+	XmImageInfo		*html_image;	/* local image data */
+	TPixmap			pixmap;			/* actual image */
+	TPixmap			clip;			/* for transparant pixmaps */
+	unsigned long	options;		/* image option bits */
+	int				width;			/* resulting image width */
+	int				height;			/* resulting image height */
+	int				npixels;		/* no of allocated pixels */
+	XCC             xcc;			/* a lot of visual info */
+
+	/* Possible  attributes */
+	int				swidth;			/* requested image width */
+	int				sheight;		/* requested image height */
+	String			alt;			/* alternative image text */
+	Alignment		align;			/* image alignment */
+	Imagemap		map_type;		/* type of map to use */
+	String			map_url;		/* image map url/name */
+	Dimension		border;			/* image border thickness */
+	Dimension		hspace;			/* horizontal spacing */
+	Dimension		vspace;			/* vertical spacing */
+
+	struct _XmHTMLObjectTable *owner;	/* owner of this image */
+	struct _XmHTMLImage *child;		/* ptr to copies of this image */
+	struct _XmHTMLImage *next;		/* ptr to next image */
+
+	/* animation data */
+	XmImageFrame 	*frames;		/* array of animation frames */
+	int				nframes;		/* no of frames following */
+	int				current_frame;	/* current frame count */
+	int				current_loop;	/* current loop count */
+	int				loop_count;		/* maximum loop count */
+	TIntervalId	proc_id;		/* timer id for animations */
+	XmHTMLWidget	html;			/* image owner */
+	TAppContext	context;		/* Application context for animations */
+ 
+ 	/* other data */
+	AllEvents			*events;	/* events to be served */
+}XmHTMLImage;
+
+/*****
+* The following structure is used to mimic file access in memory.
+*****/
+typedef struct{
+	char *file;					/* name of file */
+	Byte *buffer;				/* memory buffer */
+	Byte *curr_pos;				/* current position in buffer */
+	size_t next;				/* current block count */
+	size_t size;				/* total size of in-memory file */
+	Boolean may_free;			/* True when we must free this block */
+	unsigned char type;			/* type of image */
+	int depth;					/* depth of this image */
+}ImageBuffer;
+
+/*****
+* Definition of HTML form components
+*****/
+typedef struct _XmHTMLForm{
+	int	 			x;				/* x-position for this widget */
+	int 			y;				/* y-position for this widget */
+	Dimension 		width;			/* width of this widget */
+	Dimension 		height;			/* height of this widget */
+	Cardinal		line;			/* starting line number of this object */
+	TWidget 			w;				/* TWidget ID */
+	TWidget			child;			/* child id for scrolled stuff */
+	String 			name;			/* name for this TWidget */
+	Byte 			type;			/* TWidget type (see HTML.h) */
+	int				size;			/* cols in text(field)/items in select */
+	int				maxlength;		/* max chars to enter/rows in textarea */
+	String 			value;			/* default text */
+	String			content;		/* entered text(field) contents */
+	Alignment		align;			/* image/file browse button position */
+	Boolean			multiple;		/* multiple select flag */
+	int				selected;		/* default state */
+	Boolean 		checked;		/* check value for option/radio buttons. */
+	Boolean 		mapped;			/* True when displayed, false otherwise */
+	struct _XmHTMLForm *options;	/* option items for select */
+	struct _XmHTMLObjectTable *data;/* owning data object */
+	struct _XmHTMLFormData *parent;	/* parent form */
+	struct _XmHTMLForm *prev;		/* ptr to previous record */
+	struct _XmHTMLForm *next;		/* ptr to next record */
+}XmHTMLForm;
+
+/*****
+* Definition of form data
+*****/
+typedef struct _XmHTMLFormData{
+	Widget html;					/* owner of this form */
+	String action;					/* destination url/cgi-bin */
+	int method;						/* XmHTML_FORM_GET,POST,PIPE */
+	String enctype;					/* form encoding */
+	int ncomponents;				/* no of items in this form */
+	Widget fileSB;					/* input == file */
+	XmHTMLForm *components;			/* list of form items */
+	struct _XmHTMLFormData *prev;	/* ptr to previous form */
+	struct _XmHTMLFormData *next;	/* ptr to next form */
+}XmHTMLFormData;
+
+/*****
+* Definition of XmHTML tables
+*
+* Dimensions:
+* positive -> absolute number;
+* negative -> relative number;
+* 0        -> no dimension specified;
+*
+* Each component in a table has a set of core properties. Properties are
+* inherited from top to bottom and can be overriden.
+*
+* Content containers render the contents of all objects between
+* start (inclusive) and end (exclusive).
+*****/
+/* possible framing types */
+typedef enum{
+	TFRAME_VOID = 0,			/* no borders		*/
+	TFRAME_ABOVE,				/* only top side	*/
+	TFRAME_BELOW,				/* only bottom side	*/
+	TFRAME_LEFT,				/* only left side	*/
+	TFRAME_RIGHT,				/* only right side	*/
+	TFRAME_HSIDES,				/* top & bottom		*/
+	TFRAME_VSIDES,				/* left & right		*/
+	TFRAME_BOX,					/* all sides		*/
+	TFRAME_BORDER				/* all sides		*/
+}TableFraming;
+
+/* possible ruling types */
+typedef enum{
+	TRULE_NONE = 0,				/* no rules			*/
+	TRULE_GROUPS,				/* only colgroups	*/
+	TRULE_ROWS,					/* only rows		*/
+	TRULE_COLS,					/* only columns		*/
+	TRULE_ALL					/* all cells		*/
+}TableRuling;
+
+/*****
+* Properties shared by all table elements. These are inherited from top to
+* bottom and can be overriden by the appropriate tag attributes.
+*****/
+typedef struct _TableProperties{
+	int				border;				/* border width, 0 = noborder	*/
+	Alignment		halign;				/* content horizontal alignment	*/
+	Alignment		valign;				/* content vertical alignment	*/
+	Pixel			bg;					/* content background color		*/
+	XmHTMLImage		*bg_image;			/* content background image		*/
+	TableFraming	framing;			/* what frame should we use?	*/
+	TableRuling		ruling;				/* what rules should we draw?	*/
+}TableProperties;
+
+/*****
+* a Cell, can be a header cell or a simple cell.
+*****/
+typedef struct _TableCell{
+	Boolean			header;				/* True if a header cell	*/
+	int				width;				/* suggested cell width		*/
+	int				height;				/* suggested cell height	*/
+	int				rowspan;			/* no of rows spanned		*/
+	int				colspan;			/* no of cells spanned		*/
+	TableProperties	*properties;		/* properties for this cell	*/
+	struct _XmHTMLObjectTable *start;	/* first object to render	*/
+	struct _XmHTMLObjectTable *end;		/* last object to render	*/
+	struct _XmHTMLObjectTable *owner;	/* owning object			*/
+	struct _TableRow *parent;			/* parent of this cell		*/
+}TableCell;
+
+/* A row. A row consists of a number of Cells */
+typedef struct _TableRow{
+	TableCell		*cells;				/* all cells in this row	*/
+	int				ncells;				/* no of cells in row		*/
+	int				lastcell;			/* last used cell			*/
+	TableProperties	*properties;		/* properties for this row	*/
+	struct _XmHTMLObjectTable *start;	/* first object to render	*/
+	struct _XmHTMLObjectTable *end;		/* last object to render	*/
+	struct _XmHTMLObjectTable *owner;	/* owning object			*/
+	struct _XmHTMLTable *parent;		/* parent of this row		*/
+}TableRow;
+
+/*****
+* A table. A table consists of a Caption and a number of Rows
+* The caption is a special row: it has only one cell that stretches
+* across the entire table: itself.
+*****/
+typedef struct _XmHTMLTable{
+	/* overall table properties */
+	int				width;				/* suggested table width	*/
+	int				hmargin;			/* horizontal cell margin	*/
+	int				vmargin;			/* vertical cell margin		*/
+	int				hpadding;			/* horizontal cell padding	*/
+	int				vpadding;			/* vertical row padding		*/
+	int				ncols;				/* no of columns			*/
+	TableProperties *properties;		/* master table properties	*/
+
+	TableRow		*caption;			/* table caption			*/
+	TableRow		*rows;				/* all table rows			*/
+	int				nrows;				/* no of rows in table		*/
+	int				lastrow;			/* last used row			*/
+
+	struct _XmHTMLTable *parent;		/* parent table (for childs)*/
+	struct _XmHTMLTable *childs;		/* table child				*/
+	int				nchilds;			/* no of child tables		*/
+	int				lastchild;			/* last used table			*/
+
+	struct _XmHTMLObjectTable *start;	/* first object in table	*/
+	struct _XmHTMLObjectTable *end;		/* last object in table		*/
+
+	struct _XmHTMLObjectTable *owner;	/* owner of this table		*/
+
+	struct _XmHTMLTable *next;			/* ptr to next table		*/
+}XmHTMLTable;
+
+/*****
+* Definition of formatted HTML elements
+*****/
+typedef struct _XmHTMLObjectTable{
+	int				x;				/* x position for this element		*/
+	int				y;				/* y position for this element		*/
+	Dimension		width;			/* width of this element			*/
+	Dimension		height;			/* height of this element			*/
+	Cardinal		line;			/* starting line number of this object */
+	Cardinal		id;				/* object identifier (anchors only)	*/
+	ObjectType		object_type;	/* element type						*/
+	String			text;			/* cleaned text						*/
+	Byte			text_data;		/* text/image/anchor data bits		*/
+	int				len;			/* length of text or width of a rule*/
+	int				y_offset;		/* offset for sub/sup, 
noshade flag */ + int x_offset; /* additional offset for sub/sup */ + XmHTMLObject *object; /* object data (raw text) */ + XmHTMLAnchor *anchor; /* ptr to anchor data */ + XmHTMLWord *words; /* words to be displayed */ + XmHTMLForm *form; /* form data */ + XmHTMLTable *table; /* table data */ + int n_words; /* number of words */ + Byte anchor_state; /* anchor selection state identifier*/ + Alignment halign; /* horizontal line alignment */ + int linefeed; /* linebreak type */ + Dimension ident; /* xoffset for list indentation */ + Marker marker; /* marker to use in lists */ + int list_level; /* current count of list element. */ + XmHTMLfont *font; /* font to be used for this object */ + Pixel fg; /* foreground color for this object */ + Pixel bg; /* background color for this object */ + struct _XmHTMLObjectTable *next; + struct _XmHTMLObjectTable *prev; +}XmHTMLObjectTable, *XmHTMLObjectTableElement; + +/***** +* +*****/ +typedef struct _XmHTMLSelection{ + XmHTMLObjectTable *start; /* selection start object */ + int start_word; /* first word index */ + int start_nwords; /* word count */ + + XmHTMLObjectTable *end; /* ending start object (inclusive) */ + int end_word; /* first word index */ + int end_nwords; /* word count */ +}XmHTMLSelection; + +/***** +* definition of frame childs +*****/ +typedef struct _XmHTMLFrameWidget{ + int x; /* computed frame x-position */ + int y; /* computed frame y-position */ + Dimension width; /* computed frame width */ + Dimension height; /* computed frame height */ + int xs; /* saved x-position */ + int ys; /* saved y-position */ + Dimension width_s; /* saved frame width */ + Dimension height_s; /* saved frame height */ + FrameSize width_type; /* horizontal frame size specification */ + FrameSize height_type; /* vertical frame size specification */ + FrameScrolling scroll_type; /* frame scrolling */ + String src; /* source document */ + String name; /* internal frame name */ + Dimension margin_width; /* frame margin width */ + Dimension margin_height; /* frame margin height */ + Boolean resize; /* may we resize this frame? */ + int border; /* add a border around this frame? */ + TWidget frame; /* XmHTMLWidget id for this frame */ +}XmHTMLFrameWidget; + +/***** +* Parser state stack object +*****/ +typedef struct _stateStack{ + htmlEnum id; /* current state id */ + struct _stateStack *next; /* ptr to next record */ +}stateStack; + +/***** +* Progressive Loading Context. This is an opaque object fully defined in +* plc.h. It's a rather complex thing for all objects than can be loaded +* progressively. It maintains the state of each object (data as well as data +* processing functions) and does a bunch of nifty things. +*****/ +typedef struct _PLC *PLCPtr; + +/***** +* This struct is required to properly perform alpha channel processing. +* It contains information about the current background setting. +* +* Alpha channel processing is done for PNG images with (obviously) an alpha +* channel. The data used for creating the pixmap is a merger of the original +* image data with the current background setting (fixed color or an image). +* When a document with such an image contains a background image, XmHTML needs +* to redo this alpha processing whenever the document layout is changed: the +* exact result of this merger depends on the position of the image. This can +* be a rather slow process (alpha channels require floating point ops), and +* by at least storing the current background info we can achieve some +* performance increase. +*****/ +typedef struct _AlphaChannelInfo{ + int fb_maxsample; /* frame buffer maximum sample value */ + int background[3]; /* solid background color: R, G, B */ + int ncolors; /* size of background image colormap */ + TColor *bg_cmap; /* background image colormap */ +}AlphaChannelInfo, *AlphaPtr; + +/***** +* XmHTMLPart definition +*****/ +typedef struct _XmHTMLPart { + /* Original document Resources */ + String value; /* raw HTML text, copied to the parser */ + String source; /* copy used by XmHTML */ + String mime_type; /* mime type of this text/image (?) */ + Byte mime_id; /* internal mime id */ + + /* Anchor resources */ + TCursor anchor_cursor; + Boolean anchor_display_cursor; + Boolean anchor_buttons; + + /* anchor colors */ + Pixel anchor_fg; + Pixel anchor_visited_fg; + Pixel anchor_target_fg; + Pixel anchor_activated_fg; + Pixel anchor_activated_bg; + Boolean highlight_on_enter; /* anchor highlighting */ + + /* anchor underlining styles */ + Byte anchor_underline_type; + Byte anchor_visited_underline_type; + Byte anchor_target_underline_type; + + /* internal underlining styles, translated from above */ + Byte anchor_line; + Byte anchor_target_line; + Byte anchor_visited_line; + + Position anchor_position_x; /* for server-side imagemaps */ + Position anchor_position_y; /* for server-side imagemaps */ + XmHTMLObjectTable *armed_anchor; /* current anchor */ + XmHTMLAnchor *anchor_current_cursor_element; + XmHTMLAnchorProc anchor_visited_proc; + + /* background image/color and text color resources */ + Boolean body_colors_enabled; + Boolean body_images_enabled; + Boolean allow_color_switching; + Boolean allow_form_coloring; /* body colors on HTML forms */ + Boolean freeze_animations; + Pixel body_bg; /* current background color */ + Pixel body_fg; /* current foreground color */ + String body_image_url; /* background image location */ + String def_body_image_url; /* default bg image location */ + XmHTMLImage *body_image; /* background image data */ + TGC bg_gc; /* background render gc */ + + /* Font resources */ + String charset; + String font_family; + String font_family_fixed; + String font_sizes; + String font_sizes_fixed; + XmHTMLfont *default_font; + Byte string_direction; + Byte alignment; + Alignment default_halign; + Boolean allow_font_switching; + + /* Image resources */ + Boolean images_enabled; /* True -> show images */ + int max_image_colors; /* 0 -> as much as possible */ + float screen_gamma; /* gamma correction for this display */ + XmImageProc image_proc; /* external image loader */ + XmImageGifProc gif_proc; /* external gif decoder */ + String zCmd; /* uncompress command for LZWStream */ + XmHTMLImage *images; /* list of images in current doc */ + Boolean delayed_creation; /* delayed image creation */ + XCC xcc; /* a lot of visual info */ + + Byte map_to_palette; /* if and how to map to palette */ + String palette; /* palette to use */ + + /* Imagemap resources */ + XmHTMLImageMap *image_maps; /* array of client-side imagemaps */ + Pixel imagemap_fg; /* bounding box color */ + Boolean imagemap_draw; /* draw imagemap bounding boxes */ + + /* Frame resources */ + Boolean is_frame; /* true when this is a frame */ + FrameScrolling scroll_type; /* frame scrolling */ + int frame_border; /* add a border to the frames? */ + int nframes; /* no of frames managed */ + XmHTMLFrameWidget **frames; /* list of frame childs */ + + /* Document resources */ + Boolean strict_checking; + Boolean enable_outlining; + Byte bad_html_warnings; + XtPointer client_data; /* client_data for functional res. */ + + /* Private Resources */ + Dimension margin_width; /* document margins */ + Dimension margin_height; + TWidget work_area; /* render area */ + Dimension work_width; /* render area dimensions */ + Dimension work_height; + + Boolean resize_height; /* True -> autosize vertically */ + Boolean resize_width; /* True -> autosize horizontally */ + + /* Progressive Loader Context buffer and interval */ + PLCPtr plc_buffer; /* PLC ringbuffer */ + int num_plcs; /* no of PLC's in ringbuffer */ + int plc_def_delay; /* default PLC timeout delay */ + int plc_delay; /* PLC timeout delay */ + int plc_min_delay; /* PLC minimum timeout delay */ + int plc_max_delay; /* PLC maximum timeout delay */ + TIntervalId plc_proc_id; /* timer id for main plc cycler */ + XmHTMLGetDataProc get_data; /* PLC data request function */ + XmHTMLEndDataProc end_data; /* PLC end signal function */ + Boolean plc_suspended; /* Global PLC suspension flag */ + TGC plc_gc; /* gc used by all plc's */ + + /* perform final dithering pass/use image colors */ + Byte perfect_colors; + + /* Internal stuff for alpha channelled PNG images */ + AlphaPtr alpha_buffer; + Byte rgb_conv_mode; /* 24 to 8bit conversion method */ + Byte alpha_processing; /* do alpha channel stuff? */ + + /* + * Fallback colors, required for proper color resetting between documents + * with and without a color spec. + */ + Pixel anchor_fg_save; + Pixel anchor_visited_fg_save; + Pixel anchor_target_fg_save; + Pixel anchor_activated_fg_save; + Pixel anchor_activated_bg_save; + Pixel body_bg_save; + Pixel body_fg_save; + + /* Scrollbar resources */ + TWidget hsb; /* vertical scrollbar TWidget id */ + TWidget vsb; /* horizontal scrollbar TWidget id */ + Byte sb_policy; /* scrollbar display policy */ + Byte sb_placement; /* scrollbar placement policy */ + int scroll_x; /* current horizontal position */ + int scroll_y; /* current vertical position */ + Boolean needs_hsb; /* True -> hsb required */ + Boolean needs_vsb; /* True -> vsb required */ + + /* Callback resources */ + TCallbackList activate_callback; + TCallbackList arm_callback; + TCallbackList anchor_track_callback; + TCallbackList frame_callback; + TCallbackList form_callback; + TCallbackList input_callback; + TCallbackList link_callback; + TCallbackList motion_track_callback; + TCallbackList imagemap_callback; + TCallbackList document_callback; + TCallbackList focus_callback; + TCallbackList losing_focus_callback; + TCallbackList event_callback; + Boolean need_tracking; /* serve mouse/focus tracking? */ + + XmHTMLEventProc event_proc; /* HTML4.0 script processing proc */ + HTEvent *events; /* HTML4.0 event data */ + int nevents; /* no of events watched */ + + /* Formatted document resources */ + int formatted_width; /* total width of document */ + int formatted_height; /* total height of document */ + int num_anchors; /* total no of anchors in doc */ + int num_named_anchors; /* total no of named anchors */ + int anchor_words; /* total no of anchor words */ + XmHTMLWord *anchors; /* for quick anchor lookup */ + XmHTMLObject *elements; /* unfiltered parser output */ + XmHTMLObjectTable *named_anchors; /* for quick named anchor lookup */ + XmHTMLAnchor *anchor_data; /* parsed anchor data */ + XmHTMLObjectTable *formatted; /* display object data */ + XmHTMLObjectTable *paint_start; /* first paint command */ + XmHTMLObjectTable *paint_end; /* last paint command */ + int paint_x; /* horizontal paint start x-pos */ + int paint_y; /* vertical paint start y-pos */ + int paint_width; /* horizontal paint end x-pos */ + int paint_height; /* vertical paint end y-pos */ + Cardinal top_line; /* current topline */ + Cardinal nlines; /* no of lines in document */ + + /* Table resources */ + XmHTMLTable *tables; /* list of all tables */ + + /* Anchor activation resources */ + int press_x; /* ptr coordinates */ + int press_y; + Time pressed_time; /* time of anchor activation */ + Time selected_time; /* unused for now */ + XmHTMLAnchor *selected; /* selected anchor */ + XmHTMLObjectTable *current_anchor;/* selected object */ + + /* Text selection resources */ + XmHTMLObjectTable *selection; /* reserved for future use */ + int select_start; /* reserved for future use */ + int select_end; /* reserved for future use */ + + /* HTML Form resources */ + XmHTMLFormData *form_data; /* all forms in the current document */ + + /* Misc. resources */ + int repeat_delay; /* keyboard and scrollbar delay */ + TGC gc; /* main rendering gc */ + Boolean in_layout; /* layout blocking flag. + * Also used as SetValues blocking + * flag by the parser. + */ + int visibility; /* visibility state of work_area */ + +#ifdef DEBUG + Boolean debug_disable_warnings; /* warning msg blocking flag */ + Boolean debug_full_output; /* allow output from FullDebug */ + Boolean debug_save_clipmasks; /* save clipmasks as bitmaps */ + Boolean debug_no_loopcount; /* ignore loop_count in anims */ + String debug_prefix; /* debug file prefix */ + String debug_levels; /* debug levels to enable */ +#endif + + unsigned char pad[64]; /* reserved for future use */ + +}XmHTMLPart; + +#ifdef WITH_MOTIF +typedef struct _XmHTMLRec +{ + CorePart core; + CompositePart composite; + ConstraintPart constraint; + XmManagerPart manager; + XmHTMLPart html; +} XmHTMLRec; + +/* Define subclassing level index to be used with ResolvePartOffset */ +#define XmHTMLIndex (XmManagerIndex+1) + +externalref XmHTMLClassRec xmHTMLClassRec; +#endif + +/***** +* Pull in internal function proto's when building the library. +*****/ +#ifdef _LIBRARY +#include "XmHTMLI.h" +#endif + +#ifndef WITH_MOTIF +# include "gtk-xmhtml-p.h" +#endif + +/* Don't add anything after this endif! */ +#endif /* _XmHTMLP_h_ */ diff -uNr gnome-0.10/gtk-xmhtml/XmHTMLfuncs.h gnome-0.11/gtk-xmhtml/XmHTMLfuncs.h --- gnome-0.10/gtk-xmhtml/XmHTMLfuncs.h Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/XmHTMLfuncs.h Mon Dec 29 16:37:45 1997 @@ -0,0 +1,325 @@ +/***** +* XmHTMLfuncs.h : widely used functions and overall configuration settings. +* +* This file Version $Revision: 1.4 $ +* +* Creation date: Tue Dec 3 15:00:14 GMT+0100 1996 +* Last modification: $Date: 1997/12/29 22:16:23 $ +* By: $Author: unammx $ +* Current State: $State: Exp $ +* +* Author: newt +* (C)Copyright 1995-1996 Ripley Software Development +* All Rights Reserved +* +* This file is part of the XmHTML Widget Library. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Library General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library 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 +* Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public +* License along with this library; if not, write to the Free +* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +*****/ +/***** +* $Source: /debian/home/gnomecvs/gnome/gtk-xmhtml/XmHTMLfuncs.h,v $ +*****/ +/***** +* ChangeLog +* $Log: XmHTMLfuncs.h,v $ +* Revision 1.4 1997/12/29 22:16:23 unammx +* This version does: +* +* - Sync with Koen to version Beta 1.1.2c of the XmHTML widget. +* Includes various table fixes. +* +* - Callbacks are now properly checked for the Gtk edition (ie, +* signals). +* +* Revision 1.3 1997/12/25 01:34:10 unammx +* Good news for the day: +* +* I have upgraded our XmHTML sources to XmHTML 1.1.1. +* +* This basically means that we got table support :-) +* +* Still left to do: +* +* - Set/Get gtk interface for all of the toys in the widget. +* - Frame support is broken, dunno why. +* - Form support (ie adding widgets to it) +* +* Miguel. +* +* Revision 1.2 1997/12/19 00:03:49 unammx +* gtk/xmhtml updates +* +* Revision 1.1 1997/11/28 03:38:56 gnomecvs +* Work in progress port of XmHTML; No, it does not compile, don't even try -mig +* +* Revision 1.16 1997/10/23 00:24:48 newt +* XmHTML Beta 1.1.0 release +* +* Revision 1.15 1997/08/30 00:43:02 newt +* HashTable stuff. Changed proto's for almost every routine in here. +* +* Revision 1.14 1997/08/01 12:56:02 newt +* Progressive image loading changes. Changes to debug memory alloc protos. +* +* Revision 1.13 1997/05/28 01:43:34 newt +* Added protos and defines for debug memory allocation functions. +* +* Revision 1.12 1997/04/29 14:23:32 newt +* Moved all XmHTML private functions to XmHTMLP.h +* +* Revision 1.11 1997/04/03 05:32:52 newt +* ImageInfoShared macro. _XmHTMLLoadBodyImage proto +* +* Revision 1.10 1997/03/28 07:06:42 newt +* Frame interface prototypes from frames.c +* +* Revision 1.9 1997/03/20 08:07:25 newt +* added external html_tokens definition, _XmHTMLReplaceOrUpdateImage +* +* Revision 1.8 1997/03/11 19:52:05 newt +* ImageBuffer; XmHTMLImage and XmImageInfo macros; new protos for animated Gifs +* +* Revision 1.7 1997/03/04 18:47:01 newt +* _XmHTMLDrawImagemapSelection proto added +* +* Revision 1.6 1997/03/04 00:57:29 newt +* Delayed Image Loading: _XmHTMLReplaceImage and _XmHTMLUpdateImage +* +* Revision 1.5 1997/03/02 23:14:13 newt +* malloc defines; function proto's for all private image/imagemap routines +* +* Revision 1.4 1997/02/11 02:02:57 newt +* Changes for NEED_STRCASECMP +* +* Revision 1.3 1997/01/09 06:55:59 newt +* expanded copyright marker +* +* Revision 1.2 1997/01/09 06:48:43 newt +* updated function definitions +* +* Revision 1.1 1996/12/19 02:17:18 newt +* Initial Revision +* +*****/ + +#ifndef _XmHTMLfuncs_h_ +#define _XmHTMLfuncs_h_ + +#include +#ifdef WITH_MOTIF +#include /* for Widget definition & fast macros */ +#endif + +#ifndef BYTE_ALREADY_TYPEDEFED +#define BYTE_ALREADY_TYPEDEFED +typedef unsigned char Byte; +#endif /* BYTE_ALREADY_TYPEDEFED */ + +/***** +* The top section of this file contains a number of default values that +* can only be set at compile-time. +* These values modify the default behaviour of the XmHTML widget, so be +* carefull when modifying these values. +*****/ + +/***** +* Time window in which button press & release trigger an anchor activation. +* (specified in milliseconds). +*****/ +#define XmHTML_BUTTON_RELEASE_TIME 500 + +/***** +* Default horizontal & vertical marginwidth. +*****/ +#define XmHTML_DEFAULT_MARGIN 20 + +/***** +* Number of pixels to scroll when the scrollbar isn't being dragged but +* moved by either keyboard actions or arrow pressing. Be warned that +* using large values will cause a jumpy scrolling as XmHTML will have to +* render increasing amounts of data. +*****/ +#define XmHTML_HORIZONTAL_SCROLL_INCREMENT 12 /* average char width */ +#define XmHTML_VERTICAL_SCROLL_INCREMENT 18 /* average line height */ + +/***** +* Absolute maximum no of colors XmHTML may use. It is the maximum value for +* the XmNmaxImageColors resource. +* Increasing this number isn't a wise thing to do since all image routines +* are optimized for using paletted images. If you want XmHTML to handle more +* than 256 colors, you will have to modify the code. +*****/ +#define MAX_IMAGE_COLORS 256 + +/***** +* Default font sizes +* Scalable size array: default,sub/superscript,h1,h2,h3,h4,h5,h6 +* Fixed size array : default,sub/superscript +*****/ +#define XmHTML_DEFAULT_FONT_SCALABLE_SIZES "14,8,24,18,14,12,10,8" +#define XmHTML_DEFAULT_FONT_FIXED_SIZES "12,8" + +/***** +* Default Table cell & row spacing. +*****/ +#define XmHTML_DEFAULT_CELLSPACING 2 +#define XmHTML_DEFAULT_ROWSPACING 2 + +/***** +* Maximum number of iterations the text-justification routines may reach. +* Decreasing the default value of 1500 will lead to an increasing amount +* of warnings. +*****/ +#define MAX_JUSTIFY_ITERATIONS 1500 + +/***** +* Maximum number of iterations the table layout computation routines may +* reach. This only occurs when the minimum suggested table width is smaller +* than the available width and the maximum suggested table width is larger +* than the available width. In this case, the layout routines have to compute +* an optimum balance between the different colum widths within the available +* width. The algorithm used should be convergent, but could be divergent for +* nested tables or tables prefixed with an extreme indentation (nested lists +* and such). Hence the safeguard. +*****/ +#define MAX_TABLE_ITERATIONS 128 + +/***** +* Default gamma correction value for your display. This is only used for +* images that support gamma correction (JPEG and PNG). +* 2.2 is a good assumption for almost every X display. +* For a Silicon Graphics displays, change this to 1.8 +* For Macintosh displays (MkLinux), change this to 1.4 (so I've been told) +* If you change this value, it *must* be a floating point value. +*****/ +#define XmHTML_DEFAULT_GAMMA 2.2 + +/***** +* Maximum size of the PLC get_data() buffer. This is the maximum amount +* of data that will be requested to a function installed on the +* XmNprogressiveReadProc. Although this define can have any value, using +* a very small value will make progressive loading very slow, while using +* a large value will make the response of XmHTML slow while any PLC's are +* active. +* The first call to the get_data() routine will request PLC_MAX_BUFFER_SIZE +* bytes, while the size requested by any following calls will depend on the +* type of image being loaded and the amount of data left in the current input +* buffer. +*****/ +#define PLC_MAX_BUFFER_SIZE 2048 + +/***** +* The default timeout value for the Progressive Loader Context. This +* timeout is the default value for the XmNprogressiveInitialDelay and +* specifies the polling interval between subsequent PLC calls. +* +* Specified in milliseconds (1 second = 1000 milliseconds) +* XmHTML dynamically adjusts the timeout value as necessary and recomputes +* it after each PLC call. +* PLC_MIN_DELAY is the minimum value XmHTML can reduce the timeout to while +* PLC_MAX_DELAY is the maximum value XmHTML can increase the timeout to. +*****/ +#define PLC_DEFAULT_DELAY 250 +#define PLC_MIN_DELAY 5 +#define PLC_MAX_DELAY 1000 + +/***************** End of User configurable section *****************/ + +/***** +* magic number for the XmHTMLImage structure. XmHTML uses this field to verify +* the return value from a user-installed primary image cache. +*****/ +#define XmHTML_IMAGE_MAGIC 0xce + +/* lint kludge */ +#ifdef lint +#undef True +#undef False +#define True ((Boolean)1) +#define False ((Boolean)0) +#endif /* lint */ + +/***** +* When X was written, noboby ever heard of C++, let alone what words +* would be reserved for this language, and as a result of this, a few +* structures in X contain words that could cause a problem when compiling +* XmHTML with a C++ compiler. +*****/ +#if defined(__cplusplus) || defined(c_plusplus) +#define MEMBER_CLASS c_class +#define MEMBER_NEW c_new +#define MEMBER_DELETE c_delete +#else +#define MEMBER_CLASS class +#define MEMBER_NEW new +#define MEMBER_DELETE delete +#endif + +/**** +* debug.c +* Must include this before anything else to prevent inconsistencies. +****/ +#include "debug.h" + +/***** +* Using #if !defined(DMALLOC) && !defined(DEBUG) seems to trigger a bug +* on SparcWorks CPP, so we use the old #ifndef combi's to work around it. +* Fix 10/27/97-01, shl. +*****/ +#ifndef DMALLOC +#ifndef DEBUG + +/* Normal builds use Xt memory functions */ + +# ifdef WITH_MOTIF +# define malloc(SZ) XtMalloc((SZ)) +# define calloc(N,SZ) XtCalloc((N),(SZ)) +# define realloc(PTR,SZ) XtRealloc((char*)(PTR),(SZ)) +# define free(PTR) XtFree((char*)(PTR)) +# define strdup(STR) XtNewString((STR)) +# else +# define malloc(SZ) g_malloc(SZ) +# define calloc(N,SZ) g_malloc0((SZ)*(N)) +# define realloc(PTR,SZ) g_realloc(PTR,SZ) +# define free(PTR) g_free(PTR) +# define strdup(STR) g_strdup(STR) +# endif +#else /* DEBUG defined */ + +/* debug builds use asserted functions unless DMALLOC is defined */ +extern char *__rsd_malloc(size_t size, char *file, int line); +extern char *__rsd_calloc(size_t nmemb, size_t size, char *file, int line); +extern char *__rsd_realloc(void *ptr, size_t size, char *file, int line); +extern char *__rsd_strdup(const char *s1, char *file, int line); +extern void __rsd_free(void *ptr, char *file, int line); + +/* every source file has a static variable called src_file */ +#define malloc(SZ) __rsd_malloc((SZ), __FILE__, __LINE__) +#define calloc(N,SZ) __rsd_calloc((N),(SZ), __FILE__, __LINE__) +#define realloc(PTR,SZ) __rsd_realloc((PTR),(SZ), __FILE__, __LINE__) +#define free(PTR) __rsd_free((PTR), __FILE__, __LINE__) +#define strdup(STR) __rsd_strdup((STR), __FILE__, __LINE__) + +#endif /* DEBUG */ +#else /* DMALLOC */ + +/* let dmalloc.h define it all */ +#include + +#endif /* DMALLOC */ + +/* Don't add anything after this endif! */ +#endif /* _XmHTMLfuncs_h_ */ diff -uNr gnome-0.10/gtk-xmhtml/bitmaps/boomerang.xpm gnome-0.11/gtk-xmhtml/bitmaps/boomerang.xpm --- gnome-0.10/gtk-xmhtml/bitmaps/boomerang.xpm Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/bitmaps/boomerang.xpm Wed Jan 7 20:30:51 1998 @@ -0,0 +1,54 @@ +/* XPM */ +static char * boomerang_xpm[] = { +/* width height ncolors chars_per_pixel */ +"32 32 16 1", +/* colors */ +" s None c None", +". c #FFCC9A", +"X c #DDDDDD", +"o c #6699FF", +"O c #FF9966", +"+ c white", +"@ c #0000EF", +"# c #9A6633", +"$ c #CB6532", +"% c #FF6666", +"& c #FE0000", +"* c #890000", +"= c #BBBBBB", +"- c #663300", +"; c #666666", +": c #000066", +/* pixels */ +" .......XXo ", +" ....OOOOOOO++@oXX ", +" ...OOO###$$##$++@@++%%% ", +" ..OO##$##$$#$#$$XX@@++&&&*", +" .O####$#$###$#$#$==@@==&&**", +" .O#$####$###------;;::;;*** ", +" .O#$#######---:::-# ", +" .O$######---:# ", +" .O#######--:# ", +" .O######--: ", +" .######--: ", +" .O#####--: ", +" .O####--: ", +" .O####-: ", +" .####--# ", +".O#$##-: ", +".O#$##-# ", +".O$##-: ", +".O$##-: ", +".O###-: ", +".O$##-- ", +".O$$$$# ", +"X++X=; ", +"X++X=; ", +"o@@@@: ", +" o@@@: ", +" X++=; ", +" X++=; ", +" %&&* ", +" %&&* ", +" %&** ", +" ** "}; diff -uNr gnome-0.10/gtk-xmhtml/bitmaps/fingers.xbm gnome-0.11/gtk-xmhtml/bitmaps/fingers.xbm --- gnome-0.10/gtk-xmhtml/bitmaps/fingers.xbm Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/bitmaps/fingers.xbm Wed Jan 7 20:30:51 1998 @@ -0,0 +1,8 @@ +#define fingers_width 16 +#define fingers_height 16 +#define fingers_x_hot 4 +#define fingers_y_hot 0 +static unsigned char fingers_bits[] = { + 0xcf, 0xff, 0xb7, 0xff, 0xb7, 0xff, 0xb7, 0xff, 0x37, 0x92, 0xb7, 0x6d, + 0xb1, 0x6d, 0xb6, 0x6d, 0xb6, 0x6d, 0xf6, 0x7f, 0xf6, 0x7f, 0xfd, 0x7f, + 0xfd, 0xbf, 0xfb, 0xbf, 0xfb, 0xbf, 0x03, 0x80}; diff -uNr gnome-0.10/gtk-xmhtml/bitmaps/fingers_m.xbm gnome-0.11/gtk-xmhtml/bitmaps/fingers_m.xbm --- gnome-0.10/gtk-xmhtml/bitmaps/fingers_m.xbm Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/bitmaps/fingers_m.xbm Wed Jan 7 20:30:51 1998 @@ -0,0 +1,6 @@ +#define fingers_m_width 16 +#define fingers_m_height 16 +static unsigned char fingers_m_bits[] = { + 0x30, 0x00, 0x78, 0x00, 0x78, 0x00, 0x78, 0x00, 0xf8, 0x6d, 0xf8, 0xff, + 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, + 0xfe, 0x7f, 0xfc, 0x7f, 0xfc, 0x7f, 0xfc, 0x7f}; diff -uNr gnome-0.10/gtk-xmhtml/bitmaps/noboomerang.xpm gnome-0.11/gtk-xmhtml/bitmaps/noboomerang.xpm --- gnome-0.10/gtk-xmhtml/bitmaps/noboomerang.xpm Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/bitmaps/noboomerang.xpm Wed Jan 7 20:30:51 1998 @@ -0,0 +1,53 @@ +/* XPM */ +static char * noboomerang_xpm[] = { +/* width height ncolors chars_per_pixel */ +"32 32 15 1", +/* colors */ +" s None c None", +". c #FE0000", +"X c #FF6666", +"o c #FFCC9A", +"O c #DDDDDD", +"+ c #6699FF", +"@ c #890000", +"# c #FF9966", +"$ c #0000EF", +"% c #9A6633", +"& c #CB6532", +"* c #BBBBBB", +"= c #653232", +"- c #666666", +"; c black", +/* pixels */ +"..X oooooooOO+ X..", +"@..X oooo####### $+OOX...", +"@@..X ooo###%%%&&%%& $$ X...@", +" @@..Xoo##%%&%%&&%&%&&OO$$X...@@", +" @@..X%%%%&%&%%%&%&%&**$X...@@@", +" @@..X%%%%&%%%======--X...@@@ ", +" o@@..X%%%%%===;;;=% X...@ ", +" o#@@..X%%===;% X...@ ", +" o#%%@@..X==;% X...@ ", +" o#%%%@@..X; X...@ ", +" o%%%%%@@..X X...@ ", +" o#%%%%%=@@..X X...@ ", +" o#%%%%==;@@..X X...@ ", +" o#%%%%=; @@..XX...@ ", +" o%%%%==% @@.....@ ", +"o#%&%%=; @@..@@ ", +"o#%&%%=% X....X ", +"o#&%%=; X..@@..X ", +"o#&%%=; X...@@@..X ", +"o#%%%=; X...@ @@..X ", +"o#&%%== X...@ @@..X ", +"o#&&&&% X...@ @@..X ", +"O O*- X...@ @@..X ", +"O O*-X...@ @@..X ", +"+$$$$X...@ @@..X ", +" +$$X...@ @@..X ", +" O X...@ @@..X ", +" OX...@ @@..X ", +" X...@ @@..X ", +"X...@@ @@..X", +"...@@@ @@@@", +"..@@@ @@@"}; diff -uNr gnome-0.10/gtk-xmhtml/callbacks.c gnome-0.11/gtk-xmhtml/callbacks.c --- gnome-0.10/gtk-xmhtml/callbacks.c Wed Dec 31 18:00:00 1969 +++ gnome-0.11/gtk-xmhtml/callbacks.c Tue Jan 6 17:57:38 1998 @@ -0,0 +1,828 @@ +#ifndef lint +static char rcsId[]="$Header: /debian/home/gnomecvs/gnome/gtk-xmhtml/callbacks.c,v 1.4 1997/12/29 22:16:23 unammx Exp $"; +#endif +/***** +* callbacks.c : XmHTML callback routines +* +* This file Version $Revision: 1.4 $ +* +* Creation date: Mon Dec 2 19:58:52 GMT+0100 1996 +* Last modification: $Date: 1997/12/29 22:16:23 $ +* By: $Author: unammx $ +* Current State: $State: Exp $ +* +* Author: newt +* (C)Copyright 1995-1996 Ripley Software Development +* All Rights Reserved +* +* This file is part of the XmHTML Widget Library. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Library General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library 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 +* Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public +* License along with this library; if not, write to the Free +* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +*****/ +/***** +* ChangeLog +* $Log: callbacks.c,v $ +* Revision 1.4 1997/12/29 22:16:23 unammx +* This version does: +* +* - Sync with Koen to version Beta 1.1.2c of the XmHTML widget. +* Includes various table fixes. +* +* - Callbacks are now properly checked for the Gtk edition (ie, +* signals). +* +* Revision 1.3 1997/12/25 01:34:10 unammx +* Good news for the day: +* +* I have upgraded our XmHTML sources to XmHTML 1.1.1. +* +* This basically means that we got table support :-) +* +* Still left to do: +* +* - Set/Get gtk interface for all of the toys in the widget. +* - Frame support is broken, dunno why. +* - Form support (ie adding widgets to it) +* +* Miguel. +* +* Revision 1.2 1997/12/24 17:53:54 unammx +* Fun stuff: +* +* The widget now handles mouse motion, mouse clicks, anchors can +* be clicked. +* +* The widget emits signals for all of the interesting events +* (the same events that were used by the Motif port, we just use +* signals instead of XtCallbacks). +* +* Boring stuff: +* +* The widget now handles focusin/focusout/enternotif/leavenotify +* +* More code sharing between the Motif frontend an the Gtk +* frontned; More portability macros; +* +* Cleaned up some more the privte widget header files. +* +* Revision 1.1 1997/12/17 04:40:28 unammx +* Your daily XmHTML code is here. It almost links. Only the +* images.c file is left to port. Once this is ported we are all +* set to start debugging this baby. +* +* btw, Dickscrape is a Motif based web browser that is entirely +* based on this widget, I just tested it today, very impressive. +* +* Miguel. +* +* Revision 1.12 1997/10/26 23:50:15 newt +* Bugfix 10/22/97-01 +* +* Revision 1.11 1997/10/23 00:24:50 newt +* XmHTML Beta 1.1.0 release +* +* Revision 1.10 1997/08/30 00:45:33 newt +* my_strdup -> strdup and _XmHTMLWarning proto changes. +* +* Revision 1.9 1997/08/01 12:57:23 newt +* my_strdup -> strdup +* +* Revision 1.8 1997/05/28 01:44:43 newt +* Extended XmHTMLGetHeadAttributes to copy the value of the