From 2d113e8792747151bf5d830f1a1485f2f951f940 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Fri, 3 Oct 2014 14:04:58 +0000 Subject: Imported Upstream version 0.50 --- Makefile.in | 56 + aclocal.m4 | 907 +++++ backend-po/README.ADD_NEW_LANGUAGE | 15 + backend-po/README.INSTALL | 9 + backend-po/README.UPDATE_LANGUAGE | 8 + backend-po/de/sane-umax.mo | Bin 0 -> 10247 bytes backend-po/make_newbackend.po.in | 3 + backend-po/newbackend.po | 544 +++ backend-po/newbackend.po.in | 546 +++ backend-po/newbackend.po.in.header | 2 + backend-po/newbackend.po.in.in | 546 +++ backend-po/po.in2po | 8 + backend-po/remake_backend.po.in | 10 + backend-po/umax.de.po | 852 +++++ backend-po/umax.de.po.in | 579 ++++ config.guess | 883 +++++ config.sub | 958 ++++++ configure | 5569 +++++++++++++++++++++++++++++++ configure.in | 301 ++ doc/Makefile.in | 78 + doc/autoenhance.jpg | Bin 0 -> 1219 bytes doc/brightness.jpg | Bin 0 -> 726 bytes doc/contrast.jpg | Bin 0 -> 922 bytes doc/default.jpg | Bin 0 -> 747 bytes doc/gamma.jpg | Bin 0 -> 808 bytes doc/negative.jpg | Bin 0 -> 1267 bytes doc/restore.jpg | Bin 0 -> 837 bytes doc/rgb-default.jpg | Bin 0 -> 1095 bytes doc/sane-backends-doc.html | 110 + doc/sane-logo.jpg | Bin 0 -> 14856 bytes doc/sane-logo2.jpg | Bin 0 -> 6908 bytes doc/sane-pnm-doc.html | 39 + doc/sane-pnm16-doc.html | 42 + doc/sane-problems-doc.html | 116 + doc/sane-scantips-doc.html | 48 + doc/sane-xsane-advanced-doc.html | 35 + doc/sane-xsane-advanced.jpg | Bin 0 -> 13091 bytes doc/sane-xsane-copy-doc.html | 40 + doc/sane-xsane-copy.jpg | Bin 0 -> 25812 bytes doc/sane-xsane-doc.html | 232 ++ doc/sane-xsane-enhancement-doc.html | 101 + doc/sane-xsane-fax-doc.html | 39 + doc/sane-xsane-fax-project.jpg | Bin 0 -> 12185 bytes doc/sane-xsane-fax.jpg | Bin 0 -> 22366 bytes doc/sane-xsane-gimp-doc.html | 60 + doc/sane-xsane-gimp.jpg | Bin 0 -> 21593 bytes doc/sane-xsane-histogram-doc.html | 55 + doc/sane-xsane-histogram.jpg | Bin 0 -> 26450 bytes doc/sane-xsane-main-doc.html | 40 + doc/sane-xsane-pipette-black.jpg | Bin 0 -> 1058 bytes doc/sane-xsane-pipette-gray.jpg | Bin 0 -> 1077 bytes doc/sane-xsane-pipette-white.jpg | Bin 0 -> 1065 bytes doc/sane-xsane-preview-doc.html | 173 + doc/sane-xsane-preview.jpg | Bin 0 -> 42499 bytes doc/sane-xsane-scan-doc.html | 92 + doc/sane-xsane-setup-copy-doc.html | 96 + doc/sane-xsane-setup-copy.jpg | Bin 0 -> 36848 bytes doc/sane-xsane-setup-display-doc.html | 99 + doc/sane-xsane-setup-display.jpg | Bin 0 -> 29270 bytes doc/sane-xsane-setup-fax-doc.html | 104 + doc/sane-xsane-setup-fax.jpg | Bin 0 -> 26701 bytes doc/sane-xsane-setup-save-doc.html | 92 + doc/sane-xsane-setup-save.jpg | Bin 0 -> 30881 bytes doc/sane-xsane-standard-doc.html | 33 + doc/sane-xsane-standard.jpg | Bin 0 -> 16093 bytes doc/sane-xsane-visible-area.jpg | Bin 0 -> 847 bytes doc/sane-xsane-zoom-in.jpg | Bin 0 -> 1094 bytes doc/sane-xsane-zoom-not.jpg | Bin 0 -> 1150 bytes doc/sane-xsane-zoom-out.jpg | Bin 0 -> 1128 bytes doc/sane-xsane-zoom-undo.jpg | Bin 0 -> 1101 bytes doc/sane-xsane.jpg | Bin 0 -> 25412 bytes doc/store.jpg | Bin 0 -> 790 bytes doc/xsane-logo.jpg | Bin 0 -> 14048 bytes doc/xsane-logo2.jpg | Bin 0 -> 6898 bytes doc/xsane.man | 199 ++ frontend/Makefile.in | 85 + frontend/cursor/cursor_pipette_black | 8 + frontend/cursor/cursor_pipette_gray | 8 + frontend/cursor/cursor_pipette_mask | 8 + frontend/cursor/cursor_pipette_white | 8 + frontend/xsane-back-gtk.c | 1426 ++++++++ frontend/xsane-back-gtk.h | 188 ++ frontend/xsane-device-preferences.c | 699 ++++ frontend/xsane-device-preferences.c.old | 761 +++++ frontend/xsane-device-preferences.h | 42 + frontend/xsane-front-gtk.c | 798 +++++ frontend/xsane-front-gtk.h | 73 + frontend/xsane-gamma.c | 1541 +++++++++ frontend/xsane-gamma.h | 48 + frontend/xsane-icons.c | 1751 ++++++++++ frontend/xsane-icons.h | 87 + frontend/xsane-logo.xpm | 372 +++ frontend/xsane-preferences.c | 292 ++ frontend/xsane-preferences.h | 122 + frontend/xsane-preview.c | 3257 ++++++++++++++++++ frontend/xsane-preview.h | 178 + frontend/xsane-rc-io.c | 903 +++++ frontend/xsane-rc-io.h | 123 + frontend/xsane-save.c | 975 ++++++ frontend/xsane-save.h | 79 + frontend/xsane-scan.c | 2369 +++++++++++++ frontend/xsane-scan.h | 35 + frontend/xsane-setup.c | 1565 +++++++++ frontend/xsane-setup.h | 33 + frontend/xsane-style.rc | 34 + frontend/xsane-text.h | 417 +++ frontend/xsane.c | 4794 ++++++++++++++++++++++++++ frontend/xsane.h | 513 +++ include/Makefile | 8 + include/Makefile.in | 7 + include/getopt.h | 129 + include/lalloca.h | 47 + include/sane/config.h.in | 342 ++ include/sane/sanei_backend.h | 116 + include/sane/sanei_config.h | 76 + include/sane/sanei_signal.h | 50 + include/sane/stamp-h | 1 + install-sh | 250 ++ intl/ChangeLog | 1086 ++++++ intl/Makefile.in | 214 ++ intl/VERSION | 1 + intl/bindtextdom.c | 203 ++ intl/cat-compat.c | 262 ++ intl/dcgettext.c | 624 ++++ intl/dgettext.c | 59 + intl/explodename.c | 188 ++ intl/finddomain.c | 216 ++ intl/gettext.c | 70 + intl/gettext.h | 105 + intl/gettextP.h | 89 + intl/hash-string.h | 59 + intl/intl-compat.c | 76 + intl/l10nflist.c | 411 +++ intl/libgettext.h | 182 + intl/linux-msg.sed | 100 + intl/loadinfo.h | 76 + intl/loadmsgcat.c | 222 ++ intl/localealias.c | 424 +++ intl/po2tbl.sed | 60 + intl/po2tbl.sed.in | 102 + intl/textdomain.c | 108 + intl/xopen-msg.sed | 104 + lib/Makefile.in | 75 + lib/alloca.c | 493 +++ lib/getopt.c | 831 +++++ lib/getopt1.c | 180 + lib/sigprocmask.c | 48 + lib/snprintf.c | 532 +++ lib/strdup.c | 38 + lib/strndup.c | 39 + lib/strsep.c | 49 + lib/usleep.c | 60 + mkinstalldirs | 36 + po/Makefile.in | 92 + po/Makefile.in.bak | 92 + po/README.ADD_NEW_LANGUAGE | 69 + po/README.UPDATE_LANGUAGE | 8 + po/add-0.37.po.in | 56 + po/add-0.38.po.in | 48 + po/add-0.40.po.in | 40 + po/add-0.44.po.in | 9 + po/add-0.47.po.in | 5 + po/cs.gmo | Bin 0 -> 24167 bytes po/cs.po | 1594 +++++++++ po/cs.po.in | 1239 +++++++ po/de.gmo | Bin 0 -> 24095 bytes po/de.po | 1596 +++++++++ po/de.po.in | 1230 +++++++ po/del-0.43.po.in | 2 + po/del-0.44.po.in | 4 + po/del-0.47.po.in | 3 + po/fr.gmo | Bin 0 -> 17131 bytes po/fr.po | 2137 ++++++++++++ po/fr.po.in | 1072 ++++++ po/make_newlanguage.po.in | 3 + po/newlanguage.po.in | 1567 +++++++++ po/newlanguage.po.in.header | 2 + po/newlanguage.po.in.in | 1211 +++++++ po/po.in2po | 8 + po/remake_language.po.in | 10 + sanei/Makefile | 0 xsane-0.50.lsm | 17 + xsane-convert-to-0.46.c | 85 + xsane-convert-to-0.49.c | 65 + xsane.AUTHOR | 2 + xsane.CHANGES | 711 ++++ xsane.COPYING | 340 ++ xsane.IMAGE | 4 + xsane.INSTALL | 48 + xsane.LANGUAGES | 14 + xsane.NEWS | 19 + xsane.OLDER_NEWS | 19 + xsane.ONLINEHELP | 13 + xsane.PROBLEMS | 64 + xsane.TODO | 62 + xsane.WIP | 4 + 196 files changed, 59323 insertions(+) create mode 100644 Makefile.in create mode 100644 aclocal.m4 create mode 100644 backend-po/README.ADD_NEW_LANGUAGE create mode 100644 backend-po/README.INSTALL create mode 100644 backend-po/README.UPDATE_LANGUAGE create mode 100644 backend-po/de/sane-umax.mo create mode 100755 backend-po/make_newbackend.po.in create mode 100644 backend-po/newbackend.po create mode 100644 backend-po/newbackend.po.in create mode 100644 backend-po/newbackend.po.in.header create mode 100644 backend-po/newbackend.po.in.in create mode 100755 backend-po/po.in2po create mode 100755 backend-po/remake_backend.po.in create mode 100644 backend-po/umax.de.po create mode 100644 backend-po/umax.de.po.in create mode 100755 config.guess create mode 100755 config.sub create mode 100755 configure create mode 100644 configure.in create mode 100644 doc/Makefile.in create mode 100644 doc/autoenhance.jpg create mode 100644 doc/brightness.jpg create mode 100644 doc/contrast.jpg create mode 100644 doc/default.jpg create mode 100644 doc/gamma.jpg create mode 100644 doc/negative.jpg create mode 100644 doc/restore.jpg create mode 100644 doc/rgb-default.jpg create mode 100644 doc/sane-backends-doc.html create mode 100644 doc/sane-logo.jpg create mode 100644 doc/sane-logo2.jpg create mode 100644 doc/sane-pnm-doc.html create mode 100644 doc/sane-pnm16-doc.html create mode 100644 doc/sane-problems-doc.html create mode 100644 doc/sane-scantips-doc.html create mode 100644 doc/sane-xsane-advanced-doc.html create mode 100644 doc/sane-xsane-advanced.jpg create mode 100644 doc/sane-xsane-copy-doc.html create mode 100644 doc/sane-xsane-copy.jpg create mode 100644 doc/sane-xsane-doc.html create mode 100644 doc/sane-xsane-enhancement-doc.html create mode 100644 doc/sane-xsane-fax-doc.html create mode 100644 doc/sane-xsane-fax-project.jpg create mode 100644 doc/sane-xsane-fax.jpg create mode 100644 doc/sane-xsane-gimp-doc.html create mode 100644 doc/sane-xsane-gimp.jpg create mode 100644 doc/sane-xsane-histogram-doc.html create mode 100644 doc/sane-xsane-histogram.jpg create mode 100644 doc/sane-xsane-main-doc.html create mode 100644 doc/sane-xsane-pipette-black.jpg create mode 100644 doc/sane-xsane-pipette-gray.jpg create mode 100644 doc/sane-xsane-pipette-white.jpg create mode 100644 doc/sane-xsane-preview-doc.html create mode 100644 doc/sane-xsane-preview.jpg create mode 100644 doc/sane-xsane-scan-doc.html create mode 100644 doc/sane-xsane-setup-copy-doc.html create mode 100644 doc/sane-xsane-setup-copy.jpg create mode 100644 doc/sane-xsane-setup-display-doc.html create mode 100644 doc/sane-xsane-setup-display.jpg create mode 100644 doc/sane-xsane-setup-fax-doc.html create mode 100644 doc/sane-xsane-setup-fax.jpg create mode 100644 doc/sane-xsane-setup-save-doc.html create mode 100644 doc/sane-xsane-setup-save.jpg create mode 100644 doc/sane-xsane-standard-doc.html create mode 100644 doc/sane-xsane-standard.jpg create mode 100644 doc/sane-xsane-visible-area.jpg create mode 100644 doc/sane-xsane-zoom-in.jpg create mode 100644 doc/sane-xsane-zoom-not.jpg create mode 100644 doc/sane-xsane-zoom-out.jpg create mode 100644 doc/sane-xsane-zoom-undo.jpg create mode 100644 doc/sane-xsane.jpg create mode 100644 doc/store.jpg create mode 100644 doc/xsane-logo.jpg create mode 100644 doc/xsane-logo2.jpg create mode 100644 doc/xsane.man create mode 100644 frontend/Makefile.in create mode 100644 frontend/cursor/cursor_pipette_black create mode 100644 frontend/cursor/cursor_pipette_gray create mode 100644 frontend/cursor/cursor_pipette_mask create mode 100644 frontend/cursor/cursor_pipette_white create mode 100644 frontend/xsane-back-gtk.c create mode 100644 frontend/xsane-back-gtk.h create mode 100644 frontend/xsane-device-preferences.c create mode 100644 frontend/xsane-device-preferences.c.old create mode 100644 frontend/xsane-device-preferences.h create mode 100644 frontend/xsane-front-gtk.c create mode 100644 frontend/xsane-front-gtk.h create mode 100644 frontend/xsane-gamma.c create mode 100644 frontend/xsane-gamma.h create mode 100644 frontend/xsane-icons.c create mode 100644 frontend/xsane-icons.h create mode 100644 frontend/xsane-logo.xpm create mode 100644 frontend/xsane-preferences.c create mode 100644 frontend/xsane-preferences.h create mode 100644 frontend/xsane-preview.c create mode 100644 frontend/xsane-preview.h create mode 100644 frontend/xsane-rc-io.c create mode 100644 frontend/xsane-rc-io.h create mode 100644 frontend/xsane-save.c create mode 100644 frontend/xsane-save.h create mode 100644 frontend/xsane-scan.c create mode 100644 frontend/xsane-scan.h create mode 100644 frontend/xsane-setup.c create mode 100644 frontend/xsane-setup.h create mode 100644 frontend/xsane-style.rc create mode 100644 frontend/xsane-text.h create mode 100644 frontend/xsane.c create mode 100644 frontend/xsane.h create mode 100644 include/Makefile create mode 100644 include/Makefile.in create mode 100644 include/getopt.h create mode 100644 include/lalloca.h create mode 100644 include/sane/config.h.in create mode 100644 include/sane/sanei_backend.h create mode 100644 include/sane/sanei_config.h create mode 100644 include/sane/sanei_signal.h create mode 100644 include/sane/stamp-h create mode 100755 install-sh create mode 100644 intl/ChangeLog create mode 100644 intl/Makefile.in create mode 100644 intl/VERSION create mode 100644 intl/bindtextdom.c create mode 100644 intl/cat-compat.c create mode 100644 intl/dcgettext.c create mode 100644 intl/dgettext.c create mode 100644 intl/explodename.c create mode 100644 intl/finddomain.c create mode 100644 intl/gettext.c create mode 100644 intl/gettext.h create mode 100644 intl/gettextP.h create mode 100644 intl/hash-string.h create mode 100644 intl/intl-compat.c create mode 100644 intl/l10nflist.c create mode 100644 intl/libgettext.h create mode 100644 intl/linux-msg.sed create mode 100644 intl/loadinfo.h create mode 100644 intl/loadmsgcat.c create mode 100644 intl/localealias.c create mode 100644 intl/po2tbl.sed create mode 100644 intl/po2tbl.sed.in create mode 100644 intl/textdomain.c create mode 100644 intl/xopen-msg.sed create mode 100644 lib/Makefile.in create mode 100644 lib/alloca.c create mode 100644 lib/getopt.c create mode 100644 lib/getopt1.c create mode 100644 lib/sigprocmask.c create mode 100644 lib/snprintf.c create mode 100644 lib/strdup.c create mode 100644 lib/strndup.c create mode 100644 lib/strsep.c create mode 100644 lib/usleep.c create mode 100755 mkinstalldirs create mode 100644 po/Makefile.in create mode 100644 po/Makefile.in.bak create mode 100644 po/README.ADD_NEW_LANGUAGE create mode 100644 po/README.UPDATE_LANGUAGE create mode 100644 po/add-0.37.po.in create mode 100644 po/add-0.38.po.in create mode 100644 po/add-0.40.po.in create mode 100644 po/add-0.44.po.in create mode 100644 po/add-0.47.po.in create mode 100644 po/cs.gmo create mode 100644 po/cs.po create mode 100644 po/cs.po.in create mode 100644 po/de.gmo create mode 100644 po/de.po create mode 100644 po/de.po.in create mode 100644 po/del-0.43.po.in create mode 100644 po/del-0.44.po.in create mode 100644 po/del-0.47.po.in create mode 100644 po/fr.gmo create mode 100644 po/fr.po create mode 100644 po/fr.po.in create mode 100755 po/make_newlanguage.po.in create mode 100644 po/newlanguage.po.in create mode 100644 po/newlanguage.po.in.header create mode 100644 po/newlanguage.po.in.in create mode 100755 po/po.in2po create mode 100755 po/remake_language.po.in create mode 100644 sanei/Makefile create mode 100644 xsane-0.50.lsm create mode 100644 xsane-convert-to-0.46.c create mode 100644 xsane-convert-to-0.49.c create mode 100644 xsane.AUTHOR create mode 100644 xsane.CHANGES create mode 100644 xsane.COPYING create mode 100644 xsane.IMAGE create mode 100644 xsane.INSTALL create mode 100644 xsane.LANGUAGES create mode 100644 xsane.NEWS create mode 100644 xsane.OLDER_NEWS create mode 100644 xsane.ONLINEHELP create mode 100644 xsane.PROBLEMS create mode 100644 xsane.TODO create mode 100644 xsane.WIP diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..309b77a --- /dev/null +++ b/Makefile.in @@ -0,0 +1,56 @@ +SHELL = /bin/sh + +VPATH = @srcdir@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = . + +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 + +MKDIR = $(top_srcdir)/mkinstalldirs +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +@SET_MAKE@ + +SUBDIRS = lib @INTLSUB@ frontend @POSUB@ doc + +all: all-recursive + + +install: install-recursive + +clean: clean-recursive + +distclean: clean distclean-recursive + rm -f *~ include/*~ include/sane/*~ *.log *.bak libtool + rm -f include/sane/config.h Makefile config.cache config.status + rm -f intl/Makefile + +depend: depend-recursive + +all-recursive install-recursive clean-recursive distclean-recursive \ +depend-recursive: + for subdir in $(SUBDIRS); do \ + target=`echo $@ | sed s/-recursive//`; \ + echo making $$target in $$subdir; \ + (cd $$subdir && $(MAKE) $$target) \ + || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" + +.PHONY: all clean depend \ + all-recursive install-recursive clean-recursive depend-recursive diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..ae0266d --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,907 @@ +# Configure paths for GTK+ +# Owen Taylor 97-11-3 + +dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS +dnl +AC_DEFUN(AM_PATH_GTK, +[dnl +dnl Get the cflags and libraries from the gtk-config script +dnl +AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], + gtk_config_prefix="$withval", gtk_config_prefix="") +AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], + gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") +AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], + , enable_gtktest=yes) + + if test x$gtk_config_exec_prefix != x ; then + gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config + fi + fi + if test x$gtk_config_prefix != x ; then + gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_prefix/bin/gtk-config + fi + fi + + AC_PATH_PROG(GTK_CONFIG, gtk-config, no) + min_gtk_version=ifelse([$1], ,0.99.7,$1) + AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) + no_gtk="" + if test "$GTK_CONFIG" = "no" ; then + no_gtk=yes + else + GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` + GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` + gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_gtktest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" +dnl +dnl Now check if the installed GTK is sufficiently new. (Also sanity +dnl checks the results of gtk-config to some extent +dnl + rm -f conf.gtktest + AC_TRY_RUN([ +#include +#include + +int +main () +{ + int major, minor, micro; + + system ("touch conf.gtktest"); + + if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + + if ((gtk_major_version != $gtk_config_major_version) || + (gtk_minor_version != $gtk_config_minor_version) || + (gtk_micro_version != $gtk_config_micro_version)) + { + printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", + $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf ("*** was found! If gtk-config was correct, then it is best\n"); + printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); + printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } + else + { + if ((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); + printf("*** correct copy of gtk-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gtk" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GTK_CONFIG" = "no" ; then + echo "*** The gtk-config script installed by GTK could not be found" + echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GTK_CONFIG environment variable to the" + echo "*** full path to gtk-config." + else + if test -f conf.gtktest ; then + : + else + echo "*** Could not run GTK test program, checking why..." + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GTK or finding the wrong" + echo "*** version of GTK. If it is not finding GTK, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" + echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" + echo "*** came with the system with the command" + echo "***" + echo "*** rpm --erase --nodeps gtk gtk-devel" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GTK was incorrectly installed" + echo "*** or that you have moved GTK since it was installed. In the latter case, you" + echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GTK_CFLAGS="" + GTK_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) + rm -f conf.gtktest +]) + + +###################################################################### + +## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- +## Copyright (C) 1996-1998 Free Software Foundation, Inc. +## Gordon Matzigkeit , 1996 +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 24 AM_PROG_LIBTOOL +AC_DEFUN(AM_PROG_LIBTOOL, +[AC_REQUIRE([AM_ENABLE_SHARED])dnl +AC_REQUIRE([AM_ENABLE_STATIC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_RANLIB])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AM_PROG_LD])dnl +AC_REQUIRE([AM_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +dnl +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Check for any special flags to pass to ltconfig. +libtool_flags= +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$silent" = yes && libtool_flags="$libtool_flags --silent" +test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case "$host" in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + CFLAGS="$CFLAGS -belf" + ;; +esac + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ +|| AC_MSG_ERROR([libtool configure failed]) +]) + +# AM_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AM_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AM_ENABLE_SHARED, +[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT] +changequote([, ])dnl +[ --enable-shared=PKGS only build shared libraries if the current package + appears as an element in the PKGS list], +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl +]) + +# AM_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN(AM_DISABLE_SHARED, +[AM_ENABLE_SHARED(no)]) + +# AM_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN(AM_DISABLE_STATIC, +[AM_ENABLE_STATIC(no)]) + +# AM_ENABLE_STATIC - implement the --enable-static flag +# Usage: AM_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AM_ENABLE_STATIC, +[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT] +changequote([, ])dnl +[ --enable-static=PKGS only build shared libraries if the current package + appears as an element in the PKGS list], +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AM_ENABLE_STATIC_DEFAULT)dnl +]) + + +# AM_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN(AM_PROG_LD, +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC]) +ac_prog=ld +if test "$ac_cv_prog_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. + /* | [A-Za-z]:\\*) + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(ac_cv_path_LD, +[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=. + if test -f "$ac_dir/$ac_prog"; then + ac_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +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) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_SUBST(LD) +AM_PROG_LD_GNU +]) + +AC_DEFUN(AM_PROG_LD_GNU, +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + ac_cv_prog_gnu_ld=yes +else + ac_cv_prog_gnu_ld=no +fi]) +]) + +# AM_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN(AM_PROG_NM, +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(ac_cv_path_NM, +[case "$NM" in +/* | [A-Za-z]:\\*) + ac_cv_path_NM="$NM" # Let the user override the test with a path. + ;; +*) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; 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 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -p" + else + ac_cv_path_NM="$ac_dir/nm" + fi + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm + ;; +esac]) +NM="$ac_cv_path_NM" +AC_MSG_RESULT([$NM]) +AC_SUBST(NM) +]) +##### end of libtool.m4 + +dnl AM_FUNC_ALLOCA +AC_DEFUN(AM_FUNC_ALLOCA, +[AC_REQUIRE([AC_FUNC_ALLOCA])dnl +test $ac_cv_func_alloca_works = no && LTALLOCA=alloca.lo +AC_SUBST(LTALLOCA)dnl +]) + +# @defmac AC_PROG_CC_STDC +# @maindex PROG_CC_STDC +# @ovindex CC +# If the C compiler in not in ANSI C mode by default, try to add an option +# to output variable @code{CC} to make it so. This macro tries various +# options that select ANSI C on some system or another. It considers the +# compiler to be in ANSI C mode if it handles function prototypes correctly. +# +# If you use this macro, you should check after calling it whether the C +# compiler has been set to accept ANSI C; if not, the shell variable +# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source +# code in ANSI C, you can make an un-ANSIfied copy of it by using the +# program @code{ansi2knr}, which comes with Ghostscript. +# @end defmac + +AC_DEFUN(AM_PROG_CC_STDC, +[AC_REQUIRE([AC_PROG_CC]) +AC_BEFORE([$0], [AC_C_INLINE]) +AC_BEFORE([$0], [AC_C_CONST]) +dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require +dnl a magic option to avoid problems with ANSI preprocessor commands +dnl like #elif. +dnl FIXME: can't do this because then AC_AIX won't work due to a +dnl circular dependency. +dnl AC_BEFORE([$0], [AC_PROG_CPP]) +AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) +AC_CACHE_VAL(am_cv_prog_cc_stdc, +[am_cv_prog_cc_stdc=no +ac_save_CC="$CC" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__ +" +do + CC="$ac_save_CC $ac_arg" + AC_TRY_COMPILE( +[#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, i +nt); +int argc; +char **argv; +], [ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; +], +[am_cv_prog_cc_stdc="$ac_arg"; break]) +done +CC="$ac_save_CC" +]) +if test -z "$am_cv_prog_cc_stdc"; then + AC_MSG_RESULT([none needed]) +else + AC_MSG_RESULT($am_cv_prog_cc_stdc) +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac +]) + + + + +dnl aclocal.m4 generated automatically by aclocal 1.2f + +dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +dnl This Makefile.in is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + + +# progtest.m4 from gettext 0.32 +# Search path for a program which passes the given test. +# Ulrich Drepper , 1996. +# +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 1 + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(AM_PATH_PROG_WITH_TEST, +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + + +# lcmessage.m4 from gettext 0.32 +# Check whether LC_MESSAGES is available in . +# Ulrich Drepper , 1995. +# +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 1 + +AC_DEFUN(AM_LC_MESSAGES, + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES) + fi + fi]) + + + +# gettext.m4 from gettext 0.32 +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995. +# +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 3 + +AC_DEFUN(AM_WITH_NLS, + [AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) + + USE_INCLUDED_LIBINTL=no + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + AC_DEFINE(ENABLE_NLS) + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If gettext or catgets are available (in this order) we + dnl use this. Else we have to fall back to GNU NLS library. + dnl catgets is only used if permitted by option --with-catgets. + nls_cv_header_intl= + nls_cv_header_libgt= + CATOBJEXT=NONE + + AC_CHECK_HEADER(libintl.h, + [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc, + [AC_TRY_LINK([#include ], [return (int) gettext ("")], + gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) + + if test "$gt_cv_func_gettext_libc" != "yes"; then + AC_CHECK_LIB(intl, bindtextdomain, + [AC_CACHE_CHECK([for gettext in libintl], + gt_cv_func_gettext_libintl, + [AC_TRY_LINK([], [return (int) gettext ("")], + gt_cv_func_gettext_libintl=yes, + gt_cv_func_gettext_libintl=no)])]) + fi + + if test "$gt_cv_func_gettext_libc" = "yes" \ + || test "$gt_cv_func_gettext_libintl" = "yes"; then + AC_DEFINE(HAVE_GETTEXT) + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl + if test "$MSGFMT" != "no"; then + AC_CHECK_FUNCS(dcgettext) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr], + [CATOBJEXT=.gmo + DATADIRNAME=share], + [CATOBJEXT=.mo + DATADIRNAME=lib]) + INSTOBJEXT=.mo + fi + fi + ]) + + if test "$CATOBJEXT" = "NONE"; then + AC_MSG_CHECKING([whether catgets can be used]) + AC_ARG_WITH(catgets, + [ --with-catgets use catgets functions if available], + nls_cv_use_catgets=$withval, nls_cv_use_catgets=no) + AC_MSG_RESULT($nls_cv_use_catgets) + + if test "$nls_cv_use_catgets" = "yes"; then + dnl No gettext in C library. Try catgets next. + AC_CHECK_LIB(i, main) + AC_CHECK_FUNC(catgets, + [AC_DEFINE(HAVE_CATGETS) + INTLOBJS="\$(CATOBJS)" + AC_PATH_PROG(GENCAT, gencat, no)dnl + if test "$GENCAT" != "no"; then + AC_PATH_PROG(GMSGFMT, gmsgfmt, no) + if test "$GMSGFMT" = "no"; then + AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) + fi + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.cat + INSTOBJEXT=.cat + DATADIRNAME=lib + INTLDEPS='$(top_builddir)/intl/libintl.a' + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi]) + fi + fi + + if test "$CATOBJEXT" = "NONE"; then + dnl Neither gettext nor catgets in included in the C library. + dnl Fall back on GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + INTLOBJS="\$(GETTOBJS)" + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_SUBST(MSGFMT) + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.gmo + INSTOBJEXT=.mo + DATADIRNAME=share + INTLDEPS='$(top_builddir)/intl/libintl.a' + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext programs is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + else + DATADIRNAME=share + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + + # If this is used in GNU gettext we have to set USE_NLS to `yes' + # because some of the sources are only built for this goal. + if test "$PACKAGE" = gettext; then + USE_NLS=yes + USE_INCLUDED_LIBINTL=yes + fi + + dnl These rules are solely for the distribution goal. While doing this + dnl we only have to keep exactly one list of the available catalogs + dnl in configure.in. + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + dnl Make all variables we use known to autoconf. + AC_SUBST(USE_INCLUDED_LIBINTL) + AC_SUBST(CATALOGS) + AC_SUBST(CATOBJEXT) + AC_SUBST(DATADIRNAME) + AC_SUBST(GMOFILES) + AC_SUBST(INSTOBJEXT) + AC_SUBST(INTLDEPS) + AC_SUBST(INTLLIBS) + AC_SUBST(INTLOBJS) + AC_SUBST(POFILES) + AC_SUBST(POSUB) + ]) + +AC_DEFUN(AM_GNU_GETTEXT, + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([AC_C_INLINE])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h values.h sys/param.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next]) + + if test "${ac_cv_func_stpcpy+set}" != "set"; then + AC_CHECK_FUNCS(stpcpy) + fi + if test "${ac_cv_func_stpcpy}" = "yes"; then + AC_DEFINE(HAVE_STPCPY) + fi + + AM_LC_MESSAGES + AM_WITH_NLS + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + dnl The reference to in the installed file + dnl must be resolved because we cannot expect the users of this + dnl to define HAVE_LOCALE_H. + if test $ac_cv_header_locale_h = yes; then + INCLUDE_LOCALE_H="#include " + else + INCLUDE_LOCALE_H="\ +/* The system does not provide the header . Take care yourself. */" + fi + AC_SUBST(INCLUDE_LOCALE_H) + + dnl Determine which catalog format we have (if any is needed) + dnl For now we know about two different formats: + dnl Linux libc-5 and the normal X/Open format + test -d intl || mkdir intl + if test "$CATOBJEXT" = ".cat"; then + AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) + + dnl Transform the SED scripts while copying because some dumb SEDs + dnl cannot handle comments. + sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed + fi + dnl po2tbl.sed is always needed. + sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ + $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed + + dnl In the intl/Makefile.in we have a special dependency which makes + dnl only sense for gettext. We comment this out for non-gettext + dnl packages. + if test "$PACKAGE" = "gettext"; then + GT_NO="#NO#" + GT_YES= + else + GT_NO= + GT_YES="#YES#" + fi + AC_SUBST(GT_NO) + AC_SUBST(GT_YES) + + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but ($top_srcdir). + dnl Try to locate is. + MKINSTALLDIRS= + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) + + dnl *** For now the libtool support in intl/Makefile is not for real. + l= + AC_SUBST(l) + ]) + diff --git a/backend-po/README.ADD_NEW_LANGUAGE b/backend-po/README.ADD_NEW_LANGUAGE new file mode 100644 index 0000000..5a016ca --- /dev/null +++ b/backend-po/README.ADD_NEW_LANGUAGE @@ -0,0 +1,15 @@ + +How to create a new backend translation: +---------------------------------------- +If you want to add a new translation, newbackend.po.in or newbackend.po could +be a good start! + +If you have translations to other languages or for other backends, +please send them to the backend author and to me + +Thanks +Oliver + +PS: The backend translation tables shall be included into the sane package, + it will be in this directory only temporary. + diff --git a/backend-po/README.INSTALL b/backend-po/README.INSTALL new file mode 100644 index 0000000..e1562de --- /dev/null +++ b/backend-po/README.INSTALL @@ -0,0 +1,9 @@ + +How to install a new backend translation: +----------------------------------------- +You must copy the sane-*.mo files to the position where the xsane.mo files are +placed. This can be e.g. /usr/local/share/locale/de/LC_MESSAGES for the german +translations + +e.g.: +cp de/sane-umax.mo /usr/local/share/locale/de/LC_MESSAGES diff --git a/backend-po/README.UPDATE_LANGUAGE b/backend-po/README.UPDATE_LANGUAGE new file mode 100644 index 0000000..1a18a6b --- /dev/null +++ b/backend-po/README.UPDATE_LANGUAGE @@ -0,0 +1,8 @@ +To update the lines +#original text: "*" +in file.po.in call remake_language.po.in file[.po.in] + +To update file.po call +po.in2po file + + diff --git a/backend-po/de/sane-umax.mo b/backend-po/de/sane-umax.mo new file mode 100644 index 0000000..9c0c8d7 Binary files /dev/null and b/backend-po/de/sane-umax.mo differ diff --git a/backend-po/make_newbackend.po.in b/backend-po/make_newbackend.po.in new file mode 100755 index 0000000..361fb97 --- /dev/null +++ b/backend-po/make_newbackend.po.in @@ -0,0 +1,3 @@ +gcc -E -P - newbackend.po.in + + diff --git a/backend-po/newbackend.po b/backend-po/newbackend.po new file mode 100644 index 0000000..23576e0 --- /dev/null +++ b/backend-po/newbackend.po @@ -0,0 +1,544 @@ + +#nls translation file for backend "BACKENDNAME" +#language: "LANGUAGE" (XYZ) + + +#original text: "Number of options" +msgid "Number of options" +msgstr "" + +#original text: "Preview" +msgid "Preview" +msgstr "" + +#original text: "Force monochrome preview" +msgid "Force monochrome preview" +msgstr "" + +#original text: "Bit depth" +msgid "Bit depth" +msgstr "" + +#original text: "Scan mode" +msgid "Scan mode" +msgstr "" + +#original text: "Scan speed" +msgid "Scan speed" +msgstr "" + +#original text: "Scan source" +msgid "Scan source" +msgstr "" + +#original text: "Force backtracking" +msgid "Force backtracking" +msgstr "" + +#original text: "Top-left x" +msgid "Top-left x" +msgstr "" + +#original text: "Top-left y" +msgid "Top-left y" +msgstr "" + +#original text: "Bottom-right x" +msgid "Bottom-right x" +msgstr "" + +#original text: "Bottom-right y" +msgid "Bottom-right y" +msgstr "" + +#original text: "Scan resolution" +msgid "Scan resolution" +msgstr "" + +#original text: "X-resolution" +msgid "X-resolution" +msgstr "" + +#original text: "Y-resolution" +msgid "Y-resolution" +msgstr "" + +#original text: "Use custom gamma table" +msgid "Use custom gamma table" +msgstr "" + +#original text: "Image intensity" +msgid "Image intensity" +msgstr "" + +#original text: "Red intensity" +msgid "Red intensity" +msgstr "" + +#original text: "Green intensity" +msgid "Green intensity" +msgstr "" + +#original text: "Blue intensity" +msgid "Blue intensity" +msgstr "" + +#original text: "Brightness" +msgid "Brightness" +msgstr "" + +#original text: "Contrast" +msgid "Contrast" +msgstr "" + +#original text: "Grain size" +msgid "Grain size" +msgstr "" + +#original text: "Halftoning" +msgid "Halftoning" +msgstr "" + +#original text: "Black level" +msgid "Black level" +msgstr "" + +#original text: "White level" +msgid "White level" +msgstr "" + +#original text: "Shadow" +msgid "Shadow" +msgstr "" + +#original text: "Shadow for red" +msgid "Shadow for red" +msgstr "" + +#original text: "Shadow for green" +msgid "Shadow for green" +msgstr "" + +#original text: "Shadow for blue" +msgid "Shadow for blue" +msgstr "" + +#original text: "Highlight" +msgid "Highlight" +msgstr "" + +#original text: "Highlight for red" +msgid "Highlight for red" +msgstr "" + +#original text: "Highlight for green" +msgid "Highlight for green" +msgstr "" + +#original text: "Highlight for blue" +msgid "Highlight for blue" +msgstr "" + +#original text: "Hue" +msgid "Hue" +msgstr "" + +#original text: "Saturation" +msgid "Saturation" +msgstr "" + +#original text: "Filename" +msgid "Filename" +msgstr "" + +#original text: "Halftone pattern size" +msgid "Halftone pattern size" +msgstr "" + +#original text: "Halftone pattern" +msgid "Halftone pattern" +msgstr "" + +#original text: "Bind X and Y resolution" +msgid "Bind X and Y resolution" +msgstr "" + +#original text: "Negative" +msgid "Negative" +msgstr "" + +#original text: "Quality calibration" +msgid "Quality calibration" +msgstr "" + +#original text: "Double Optical Resolution" +msgid "Double Optical Resolution" +msgstr "" + +#original text: "Bind RGB" +msgid "Bind RGB" +msgstr "" + +#original text: "Threshold" +msgid "Threshold" +msgstr "" + +#original text: "Analog gamma correction" +msgid "Analog gamma correction" +msgstr "" + +#original text: "Analog gamma red" +msgid "Analog gamma red" +msgstr "" + +#original text: "Analog gamma green" +msgid "Analog gamma green" +msgstr "" + +#original text: "Analog gamma blue" +msgid "Analog gamma blue" +msgstr "" + +#original text: "Bind analog gamma" +msgid "Bind analog gamma" +msgstr "" + +#original text: "Smear" +msgid "Smear" +msgstr "" + +#original text: "10 bit-mode" +msgid "10 bit-mode" +msgstr "" + +#original text: "12 bit-mode" +msgid "12 bit-mode" +msgstr "" + +#original text: "Warmup lamp" +msgid "Warmup lamp" +msgstr "" + +#original text: "Preview patch" +msgid "Preview patch" +msgstr "" + +#original text: "Start-scan patch" +msgid "Start-scan patch" +msgstr "" + +#original text: "Cal. exposure-time" +msgid "Cal. exposure-time" +msgstr "" + +#original text: "Cal. exposure-time for red" +msgid "Cal. exposure-time for red" +msgstr "" + +#original text: "Cal. exposure-time for green" +msgid "Cal. exposure-time for green" +msgstr "" + +#original text: "Cal. exposure-time for blue" +msgid "Cal. exposure-time for blue" +msgstr "" + +#original text: "Scan exposure-time" +msgid "Scan exposure-time" +msgstr "" + +#original text: "Scan exposure-time for red" +msgid "Scan exposure-time for red" +msgstr "" + +#original text: "Scan exposure-time for green" +msgid "Scan exposure-time for green" +msgstr "" + +#original text: "Scan exposure-time for blue" +msgid "Scan exposure-time for blue" +msgstr "" + +#original text: "Set exposure-time" +msgid "Set exposure-time" +msgstr "" + +#original text: "Cal. lamp density" +msgid "Cal. lamp density" +msgstr "" + +#original text: "Scan lamp density" +msgid "Scan lamp density" +msgstr "" + +#original text: "Set lamp density" +msgid "Set lamp density" +msgstr "" + +#original text: "Request a preview-quality scan." +msgid "Request a preview-quality scan." +msgstr "" + +#original text: "Request that all previews are done in monochrome mode. On a three-pass " " scanner this cuts down the number of passes to one and on a one-pass " "scanner, it reduces the memory requirements and scan-time of the preview." +msgid "Request that all previews are done in monochrome mode. On a three-pass " " scanner this cuts down the number of passes to one and on a one-pass " "scanner, it reduces the memory requirements and scan-time of the preview." +msgstr "" + +#original text: "Number of bits per sample, typical values are 1 for \"line-art\" and 8 " "for multibit scans." +msgid "Number of bits per sample, typical values are 1 for \"line-art\" and 8 " "for multibit scans." +msgstr "" + +#original text: "Selects the scan mode (e.g., lineart,monochrome, or color)." +msgid "Selects the scan mode (e.g., lineart,monochrome, or color)." +msgstr "" + +#original text: "Determines the speed at which the scan proceeds." +msgid "Determines the speed at which the scan proceeds." +msgstr "" + +#original text: "Selects the scan source (such as a document-feeder)." +msgid "Selects the scan source (such as a document-feeder)." +msgstr "" + +#original text: "Controls whether backtracking is forced." +msgid "Controls whether backtracking is forced." +msgstr "" + +#original text: "Top-left x position of scan area." +msgid "Top-left x position of scan area." +msgstr "" + +#original text: "Top-left y position of scan area." +msgid "Top-left y position of scan area." +msgstr "" + +#original text: "Bottom-right x position of scan area." +msgid "Bottom-right x position of scan area." +msgstr "" + +#original text: "Bottom-right y position of scan area." +msgid "Bottom-right y position of scan area." +msgstr "" + +#original text: "Sets the resolution of the scanned image." +msgid "Sets the resolution of the scanned image." +msgstr "" + +#original text: "Sets the horizontal resolution of the scanned image." +msgid "Sets the horizontal resolution of the scanned image." +msgstr "" + +#original text: "Sets the vertical resolution of the scanned image." +msgid "Sets the vertical resolution of the scanned image." +msgstr "" + +#original text: "Determines whether a builtin or a custom gamma-table should be used." +msgid "Determines whether a builtin or a custom gamma-table should be used." +msgstr "" + +#original text: "Gamma-correction table. In color mode this option equally affects the " "red, green, and blue channels simultaneously (i.e., it is an intensity " "gamma table)." +msgid "Gamma-correction table. In color mode this option equally affects the " "red, green, and blue channels simultaneously (i.e., it is an intensity " "gamma table)." +msgstr "" + +#original text: "Gamma-correction table for the red band." +msgid "Gamma-correction table for the red band." +msgstr "" + +#original text: "Gamma-correction table for the green band." +msgid "Gamma-correction table for the green band." +msgstr "" + +#original text: "Gamma-correction table for the blue band." +msgid "Gamma-correction table for the blue band." +msgstr "" + +#original text: "Controls the brightness of the acquired image." +msgid "Controls the brightness of the acquired image." +msgstr "" + +#original text: "Controls the contrast of the acquired image." +msgid "Controls the contrast of the acquired image." +msgstr "" + +#original text: "Selects the \"graininess\" of the acquired image. Smaller values " "result in sharper images." +msgid "Selects the \"graininess\" of the acquired image. Smaller values " "result in sharper images." +msgstr "" + +#original text: "Selects whether the acquired image should be halftoned (dithered)." +msgid "Selects whether the acquired image should be halftoned (dithered)." +msgstr "" + +#original text: "Selects what radiance level should be considered \"black\"." +msgid "Selects what radiance level should be considered \"black\"." +msgstr "" + +#original text: "Selects what radiance level should be considered \"white\"." +msgid "Selects what radiance level should be considered \"white\"." +msgstr "" + +#original text: "Selects what radiance level should be considered \"black\"." +msgid "Selects what radiance level should be considered \"black\"." +msgstr "" + +#original text: "Selects what red radiance level should be considered \"black\"." +msgid "Selects what red radiance level should be considered \"black\"." +msgstr "" + +#original text: "Selects what green radiance level should be considered \"black\"." +msgid "Selects what green radiance level should be considered \"black\"." +msgstr "" + +#original text: "Selects what blue radiance level should be considered \"black\"." +msgid "Selects what blue radiance level should be considered \"black\"." +msgstr "" + +#original text: "Selects what radiance level should be considered \"white\"." +msgid "Selects what radiance level should be considered \"white\"." +msgstr "" + +#original text: "Selects what red radiance level should be considered \"full red\"." +msgid "Selects what red radiance level should be considered \"full red\"." +msgstr "" + +#original text: "Selects what green radiance level should be considered \"full green\"." +msgid "Selects what green radiance level should be considered \"full green\"." +msgstr "" + +#original text: "Selects what blue radiance level should be considered \"full blue\"." +msgid "Selects what blue radiance level should be considered \"full blue\"." +msgstr "" + +#original text: "Controls the \"hue\" (blue-level) of the acquired image." +msgid "Controls the \"hue\" (blue-level) of the acquired image." +msgstr "" + +#original text: "The saturation level controls the amount of \"blooming\" that occurs when " "acquiring an image with a camera. Larger values cause more blooming." +msgid "The saturation level controls the amount of \"blooming\" that occurs when " "acquiring an image with a camera. Larger values cause more blooming." +msgstr "" + +#original text: "The filename of the image to be loaded." +msgid "The filename of the image to be loaded." +msgstr "" + +#original text: "Sets the size of the halftoning (dithering) pattern used when scanning " "halftoned images." +msgid "Sets the size of the halftoning (dithering) pattern used when scanning " "halftoned images." +msgstr "" + +#original text: "Defines the halftoning (dithering) pattern for scanning halftoned images." +msgid "Defines the halftoning (dithering) pattern for scanning halftoned images." +msgstr "" + +#original text: "Use same values for X and Y resolution" +msgid "Use same values for X and Y resolution" +msgstr "" + +#original text: "Swap black and white" +msgid "Swap black and white" +msgstr "" + +#original text: "Do a quality white-calibration" +msgid "Do a quality white-calibration" +msgstr "" + +#original text: "Use lens that doubles optical resolution" +msgid "Use lens that doubles optical resolution" +msgstr "" + +#original text: "In RGB-mode use same values for each color" +msgid "In RGB-mode use same values for each color" +msgstr "" + +#original text: "Select minimum-brightness to get a white point" +msgid "Select minimum-brightness to get a white point" +msgstr "" + +#original text: "Analog gamma-correction" +msgid "Analog gamma-correction" +msgstr "" + +#original text: "Analog gamma-correction for red" +msgid "Analog gamma-correction for red" +msgstr "" + +#original text: "Analog gamma-correction for green" +msgid "Analog gamma-correction for green" +msgstr "" + +#original text: "Analog gamma-correction for blue" +msgid "Analog gamma-correction for blue" +msgstr "" + +#original text: "In RGB-mode use same values for each color" +msgid "In RGB-mode use same values for each color" +msgstr "" + +#original text: "Don't care about image smearing problem" +msgid "Don't care about image smearing problem" +msgstr "" + +#original text: "Output with 10 bits instead of 8 bits" +msgid "Output with 10 bits instead of 8 bits" +msgstr "" + +#original text: "Output with 12 bits instead of 8 bits" +msgid "Output with 12 bits instead of 8 bits" +msgstr "" + +#original text: "Warmup lamp before scanning" +msgid "Warmup lamp before scanning" +msgstr "" + +#original text: "Set preview-bit in rgb-mode" +msgid "Set preview-bit in rgb-mode" +msgstr "" + +#original text: "Use special start-scan bits" +msgid "Use special start-scan bits" +msgstr "" + +#original text: "Define exposure-time for calibration" +msgid "Define exposure-time for calibration" +msgstr "" + +#original text: "Define exposure-time for red calibration" +msgid "Define exposure-time for red calibration" +msgstr "" + +#original text: "Define exposure-time for green calibration" +msgid "Define exposure-time for green calibration" +msgstr "" + +#original text: "Define exposure-time for blue calibration" +msgid "Define exposure-time for blue calibration" +msgstr "" + +#original text: "Define exposure-time for scan" +msgid "Define exposure-time for scan" +msgstr "" + +#original text: "Define exposure-time for red scan" +msgid "Define exposure-time for red scan" +msgstr "" + +#original text: "Define exposure-time for green scan" +msgid "Define exposure-time for green scan" +msgstr "" + +#original text: "Define exposure-time for blue scan" +msgid "Define exposure-time for blue scan" +msgstr "" + +#original text: "Enable selection of exposure-time" +msgid "Enable selection of exposure-time" +msgstr "" + +#original text: "Define lamp density for calibration" +msgid "Define lamp density for calibration" +msgstr "" + +#original text: "Define lamp density for scan" +msgid "Define lamp density for scan" +msgstr "" + +#original text: "Enable selection of lamp density" +msgid "Enable selection of lamp density" +msgstr "" diff --git a/backend-po/newbackend.po.in b/backend-po/newbackend.po.in new file mode 100644 index 0000000..5c01bfb --- /dev/null +++ b/backend-po/newbackend.po.in @@ -0,0 +1,546 @@ +#include "/usr/local/include/sane/saneopts.h" +#define _(x) x + +#nls translation file for backend "BACKENDNAME" +#language: "LANGUAGE" (XYZ) + + +#original text: "Number of options" +msgid SANE_TITLE_NUM_OPTIONS +msgstr "" + +#original text: "Preview" +msgid SANE_TITLE_PREVIEW +msgstr "" + +#original text: "Force monochrome preview" +msgid SANE_TITLE_GRAY_PREVIEW +msgstr "" + +#original text: "Bit depth" +msgid SANE_TITLE_BIT_DEPTH +msgstr "" + +#original text: "Scan mode" +msgid SANE_TITLE_SCAN_MODE +msgstr "" + +#original text: "Scan speed" +msgid SANE_TITLE_SCAN_SPEED +msgstr "" + +#original text: "Scan source" +msgid SANE_TITLE_SCAN_SOURCE +msgstr "" + +#original text: "Force backtracking" +msgid SANE_TITLE_BACKTRACK +msgstr "" + +#original text: "Top-left x" +msgid SANE_TITLE_SCAN_TL_X +msgstr "" + +#original text: "Top-left y" +msgid SANE_TITLE_SCAN_TL_Y +msgstr "" + +#original text: "Bottom-right x" +msgid SANE_TITLE_SCAN_BR_X +msgstr "" + +#original text: "Bottom-right y" +msgid SANE_TITLE_SCAN_BR_Y +msgstr "" + +#original text: "Scan resolution" +msgid SANE_TITLE_SCAN_RESOLUTION +msgstr "" + +#original text: "X-resolution" +msgid SANE_TITLE_SCAN_X_RESOLUTION +msgstr "" + +#original text: "Y-resolution" +msgid SANE_TITLE_SCAN_Y_RESOLUTION +msgstr "" + +#original text: "Use custom gamma table" +msgid SANE_TITLE_CUSTOM_GAMMA +msgstr "" + +#original text: "Image intensity" +msgid SANE_TITLE_GAMMA_VECTOR +msgstr "" + +#original text: "Red intensity" +msgid SANE_TITLE_GAMMA_VECTOR_R +msgstr "" + +#original text: "Green intensity" +msgid SANE_TITLE_GAMMA_VECTOR_G +msgstr "" + +#original text: "Blue intensity" +msgid SANE_TITLE_GAMMA_VECTOR_B +msgstr "" + +#original text: "Brightness" +msgid SANE_TITLE_BRIGHTNESS +msgstr "" + +#original text: "Contrast" +msgid SANE_TITLE_CONTRAST +msgstr "" + +#original text: "Grain size" +msgid SANE_TITLE_GRAIN_SIZE +msgstr "" + +#original text: "Halftoning" +msgid SANE_TITLE_HALFTONE +msgstr "" + +#original text: "Black level" +msgid SANE_TITLE_BLACK_LEVEL +msgstr "" + +#original text: "White level" +msgid SANE_TITLE_WHITE_LEVEL +msgstr "" + +#original text: "Shadow" +msgid SANE_TITLE_SHADOW +msgstr "" + +#original text: "Shadow for red" +msgid SANE_TITLE_SHADOW_R +msgstr "" + +#original text: "Shadow for green" +msgid SANE_TITLE_SHADOW_G +msgstr "" + +#original text: "Shadow for blue" +msgid SANE_TITLE_SHADOW_B +msgstr "" + +#original text: "Highlight" +msgid SANE_TITLE_HIGHLIGHT +msgstr "" + +#original text: "Highlight for red" +msgid SANE_TITLE_HIGHLIGHT_R +msgstr "" + +#original text: "Highlight for green" +msgid SANE_TITLE_HIGHLIGHT_G +msgstr "" + +#original text: "Highlight for blue" +msgid SANE_TITLE_HIGHLIGHT_B +msgstr "" + +#original text: "Hue" +msgid SANE_TITLE_HUE +msgstr "" + +#original text: "Saturation" +msgid SANE_TITLE_SATURATION +msgstr "" + +#original text: "Filename" +msgid SANE_TITLE_FILE +msgstr "" + +#original text: "Halftone pattern size" +msgid SANE_TITLE_HALFTONE_DIMENSION +msgstr "" + +#original text: "Halftone pattern" +msgid SANE_TITLE_HALFTONE_PATTERN +msgstr "" + +#original text: "Bind X and Y resolution" +msgid SANE_TITLE_RESOLUTION_BIND +msgstr "" + +#original text: "Negative" +msgid SANE_TITLE_NEGATIVE +msgstr "" + +#original text: "Quality calibration" +msgid SANE_TITLE_QUALITY_CAL +msgstr "" + +#original text: "Double Optical Resolution" +msgid SANE_TITLE_DOR +msgstr "" + +#original text: "Bind RGB" +msgid SANE_TITLE_RGB_BIND +msgstr "" + +#original text: "Threshold" +msgid SANE_TITLE_THRESHOLD +msgstr "" + +#original text: "Analog gamma correction" +msgid SANE_TITLE_ANALOG_GAMMA +msgstr "" + +#original text: "Analog gamma red" +msgid SANE_TITLE_ANALOG_GAMMA_R +msgstr "" + +#original text: "Analog gamma green" +msgid SANE_TITLE_ANALOG_GAMMA_G +msgstr "" + +#original text: "Analog gamma blue" +msgid SANE_TITLE_ANALOG_GAMMA_B +msgstr "" + +#original text: "Bind analog gamma" +msgid SANE_TITLE_ANALOG_GAMMA_BIND +msgstr "" + +#original text: "Smear" +msgid SANE_TITLE_SMEAR +msgstr "" + +#original text: "10 bit-mode" +msgid SANE_TITLE_TEN_BIT_MODE +msgstr "" + +#original text: "12 bit-mode" +msgid SANE_TITLE_TWELVE_BIT_MODE +msgstr "" + +#original text: "Warmup lamp" +msgid SANE_TITLE_WARMUP +msgstr "" + +#original text: "Preview patch" +msgid SANE_TITLE_RGB_PREVIEW_PATCH +msgstr "" + +#original text: "Start-scan patch" +msgid SANE_TITLE_START_SCAN_PATCH +msgstr "" + +#original text: "Cal. exposure-time" +msgid SANE_TITLE_CAL_EXPOS_TIME +msgstr "" + +#original text: "Cal. exposure-time for red" +msgid SANE_TITLE_CAL_EXPOS_TIME_R +msgstr "" + +#original text: "Cal. exposure-time for green" +msgid SANE_TITLE_CAL_EXPOS_TIME_G +msgstr "" + +#original text: "Cal. exposure-time for blue" +msgid SANE_TITLE_CAL_EXPOS_TIME_B +msgstr "" + +#original text: "Scan exposure-time" +msgid SANE_TITLE_SCAN_EXPOS_TIME +msgstr "" + +#original text: "Scan exposure-time for red" +msgid SANE_TITLE_SCAN_EXPOS_TIME_R +msgstr "" + +#original text: "Scan exposure-time for green" +msgid SANE_TITLE_SCAN_EXPOS_TIME_G +msgstr "" + +#original text: "Scan exposure-time for blue" +msgid SANE_TITLE_SCAN_EXPOS_TIME_B +msgstr "" + +#original text: "Set exposure-time" +msgid SANE_TITLE_SELECT_EXPOSURE_TIME +msgstr "" + +#original text: "Cal. lamp density" +msgid SANE_TITLE_CAL_LAMP_DEN +msgstr "" + +#original text: "Scan lamp density" +msgid SANE_TITLE_SCAN_LAMP_DEN +msgstr "" + +#original text: "Set lamp density" +msgid SANE_TITLE_SELECT_LAMP_DENSITY +msgstr "" + +#original text: "Request a preview-quality scan." +msgid SANE_DESC_PREVIEW +msgstr "" + +#original text: "Request that all previews are done in monochrome mode. On a three-pass " " scanner this cuts down the number of passes to one and on a one-pass " "scanner, it reduces the memory requirements and scan-time of the preview." +msgid SANE_DESC_GRAY_PREVIEW +msgstr "" + +#original text: "Number of bits per sample, typical values are 1 for \"line-art\" and 8 " "for multibit scans." +msgid SANE_DESC_BIT_DEPTH +msgstr "" + +#original text: "Selects the scan mode (e.g., lineart,monochrome, or color)." +msgid SANE_DESC_SCAN_MODE +msgstr "" + +#original text: "Determines the speed at which the scan proceeds." +msgid SANE_DESC_SCAN_SPEED +msgstr "" + +#original text: "Selects the scan source (such as a document-feeder)." +msgid SANE_DESC_SCAN_SOURCE +msgstr "" + +#original text: "Controls whether backtracking is forced." +msgid SANE_DESC_BACKTRACK +msgstr "" + +#original text: "Top-left x position of scan area." +msgid SANE_DESC_SCAN_TL_X +msgstr "" + +#original text: "Top-left y position of scan area." +msgid SANE_DESC_SCAN_TL_Y +msgstr "" + +#original text: "Bottom-right x position of scan area." +msgid SANE_DESC_SCAN_BR_X +msgstr "" + +#original text: "Bottom-right y position of scan area." +msgid SANE_DESC_SCAN_BR_Y +msgstr "" + +#original text: "Sets the resolution of the scanned image." +msgid SANE_DESC_SCAN_RESOLUTION +msgstr "" + +#original text: "Sets the horizontal resolution of the scanned image." +msgid SANE_DESC_SCAN_X_RESOLUTION +msgstr "" + +#original text: "Sets the vertical resolution of the scanned image." +msgid SANE_DESC_SCAN_Y_RESOLUTION +msgstr "" + +#original text: "Determines whether a builtin or a custom gamma-table should be used." +msgid SANE_DESC_CUSTOM_GAMMA +msgstr "" + +#original text: "Gamma-correction table. In color mode this option equally affects the " "red, green, and blue channels simultaneously (i.e., it is an intensity " "gamma table)." +msgid SANE_DESC_GAMMA_VECTOR +msgstr "" + +#original text: "Gamma-correction table for the red band." +msgid SANE_DESC_GAMMA_VECTOR_R +msgstr "" + +#original text: "Gamma-correction table for the green band." +msgid SANE_DESC_GAMMA_VECTOR_G +msgstr "" + +#original text: "Gamma-correction table for the blue band." +msgid SANE_DESC_GAMMA_VECTOR_B +msgstr "" + +#original text: "Controls the brightness of the acquired image." +msgid SANE_DESC_BRIGHTNESS +msgstr "" + +#original text: "Controls the contrast of the acquired image." +msgid SANE_DESC_CONTRAST +msgstr "" + +#original text: "Selects the \"graininess\" of the acquired image. Smaller values " "result in sharper images." +msgid SANE_DESC_GRAIN_SIZE +msgstr "" + +#original text: "Selects whether the acquired image should be halftoned (dithered)." +msgid SANE_DESC_HALFTONE +msgstr "" + +#original text: "Selects what radiance level should be considered \"black\"." +msgid SANE_DESC_BLACK_LEVEL +msgstr "" + +#original text: "Selects what radiance level should be considered \"white\"." +msgid SANE_DESC_WHITE_LEVEL +msgstr "" + +#original text: "Selects what radiance level should be considered \"black\"." +msgid SANE_DESC_SHADOW +msgstr "" + +#original text: "Selects what red radiance level should be considered \"black\"." +msgid SANE_DESC_SHADOW_R +msgstr "" + +#original text: "Selects what green radiance level should be considered \"black\"." +msgid SANE_DESC_SHADOW_G +msgstr "" + +#original text: "Selects what blue radiance level should be considered \"black\"." +msgid SANE_DESC_SHADOW_B +msgstr "" + +#original text: "Selects what radiance level should be considered \"white\"." +msgid SANE_DESC_HIGHLIGHT +msgstr "" + +#original text: "Selects what red radiance level should be considered \"full red\"." +msgid SANE_DESC_HIGHLIGHT_R +msgstr "" + +#original text: "Selects what green radiance level should be considered \"full green\"." +msgid SANE_DESC_HIGHLIGHT_G +msgstr "" + +#original text: "Selects what blue radiance level should be considered \"full blue\"." +msgid SANE_DESC_HIGHLIGHT_B +msgstr "" + +#original text: "Controls the \"hue\" (blue-level) of the acquired image." +msgid SANE_DESC_HUE +msgstr "" + +#original text: "The saturation level controls the amount of \"blooming\" that occurs when " "acquiring an image with a camera. Larger values cause more blooming." +msgid SANE_DESC_SATURATION +msgstr "" + +#original text: "The filename of the image to be loaded." +msgid SANE_DESC_FILE +msgstr "" + +#original text: "Sets the size of the halftoning (dithering) pattern used when scanning " "halftoned images." +msgid SANE_DESC_HALFTONE_DIMENSION +msgstr "" + +#original text: "Defines the halftoning (dithering) pattern for scanning halftoned images." +msgid SANE_DESC_HALFTONE_PATTERN +msgstr "" + +#original text: "Use same values for X and Y resolution" +msgid SANE_DESC_RESOLUTION_BIND +msgstr "" + +#original text: "Swap black and white" +msgid SANE_DESC_NEGATIVE +msgstr "" + +#original text: "Do a quality white-calibration" +msgid SANE_DESC_QUALITY_CAL +msgstr "" + +#original text: "Use lens that doubles optical resolution" +msgid SANE_DESC_DOR +msgstr "" + +#original text: "In RGB-mode use same values for each color" +msgid SANE_DESC_RGB_BIND +msgstr "" + +#original text: "Select minimum-brightness to get a white point" +msgid SANE_DESC_THRESHOLD +msgstr "" + +#original text: "Analog gamma-correction" +msgid SANE_DESC_ANALOG_GAMMA +msgstr "" + +#original text: "Analog gamma-correction for red" +msgid SANE_DESC_ANALOG_GAMMA_R +msgstr "" + +#original text: "Analog gamma-correction for green" +msgid SANE_DESC_ANALOG_GAMMA_G +msgstr "" + +#original text: "Analog gamma-correction for blue" +msgid SANE_DESC_ANALOG_GAMMA_B +msgstr "" + +#original text: "In RGB-mode use same values for each color" +msgid SANE_DESC_ANALOG_GAMMA_BIND +msgstr "" + +#original text: "Don't care about image smearing problem" +msgid SANE_DESC_SMEAR +msgstr "" + +#original text: "Output with 10 bits instead of 8 bits" +msgid SANE_DESC_TEN_BIT_MODE +msgstr "" + +#original text: "Output with 12 bits instead of 8 bits" +msgid SANE_DESC_TWELVE_BIT_MODE +msgstr "" + +#original text: "Warmup lamp before scanning" +msgid SANE_DESC_WARMUP +msgstr "" + +#original text: "Set preview-bit in rgb-mode" +msgid SANE_DESC_RGB_PREVIEW_PATCH +msgstr "" + +#original text: "Use special start-scan bits" +msgid SANE_DESC_START_SCAN_PATCH +msgstr "" + +#original text: "Define exposure-time for calibration" +msgid SANE_DESC_CAL_EXPOS_TIME +msgstr "" + +#original text: "Define exposure-time for red calibration" +msgid SANE_DESC_CAL_EXPOS_TIME_R +msgstr "" + +#original text: "Define exposure-time for green calibration" +msgid SANE_DESC_CAL_EXPOS_TIME_G +msgstr "" + +#original text: "Define exposure-time for blue calibration" +msgid SANE_DESC_CAL_EXPOS_TIME_B +msgstr "" + +#original text: "Define exposure-time for scan" +msgid SANE_DESC_SCAN_EXPOS_TIME +msgstr "" + +#original text: "Define exposure-time for red scan" +msgid SANE_DESC_SCAN_EXPOS_TIME_R +msgstr "" + +#original text: "Define exposure-time for green scan" +msgid SANE_DESC_SCAN_EXPOS_TIME_G +msgstr "" + +#original text: "Define exposure-time for blue scan" +msgid SANE_DESC_SCAN_EXPOS_TIME_B +msgstr "" + +#original text: "Enable selection of exposure-time" +msgid SANE_DESC_SELECT_EXPOSURE_TIME +msgstr "" + +#original text: "Define lamp density for calibration" +msgid SANE_DESC_CAL_LAMP_DEN +msgstr "" + +#original text: "Define lamp density for scan" +msgid SANE_DESC_SCAN_LAMP_DEN +msgstr "" + +#original text: "Enable selection of lamp density" +msgid SANE_DESC_SELECT_LAMP_DENSITY +msgstr "" diff --git a/backend-po/newbackend.po.in.header b/backend-po/newbackend.po.in.header new file mode 100644 index 0000000..e3a7c87 --- /dev/null +++ b/backend-po/newbackend.po.in.header @@ -0,0 +1,2 @@ +#include "/usr/local/include/sane/saneopts.h" +#define _(x) x diff --git a/backend-po/newbackend.po.in.in b/backend-po/newbackend.po.in.in new file mode 100644 index 0000000..3a09643 --- /dev/null +++ b/backend-po/newbackend.po.in.in @@ -0,0 +1,546 @@ +#include "/usr/local/include/sane/saneopts.h" +#define _(x) x + +# nls translation file for backend "BACKENDNAME" +# language: "LANGUAGE" (XYZ) + + +#original text: SANE_TITLE_NUM_OPTIONS +_SANE_TITLE_NUM_OPTIONS +msgstr "" + +#original text: SANE_TITLE_PREVIEW +_SANE_TITLE_PREVIEW +msgstr "" + +#original text: SANE_TITLE_GRAY_PREVIEW +_SANE_TITLE_GRAY_PREVIEW +msgstr "" + +#original text: SANE_TITLE_BIT_DEPTH +_SANE_TITLE_BIT_DEPTH +msgstr "" + +#original text: SANE_TITLE_SCAN_MODE +_SANE_TITLE_SCAN_MODE +msgstr "" + +#original text: SANE_TITLE_SCAN_SPEED +_SANE_TITLE_SCAN_SPEED +msgstr "" + +#original text: SANE_TITLE_SCAN_SOURCE +_SANE_TITLE_SCAN_SOURCE +msgstr "" + +#original text: SANE_TITLE_BACKTRACK +_SANE_TITLE_BACKTRACK +msgstr "" + +#original text: SANE_TITLE_SCAN_TL_X +_SANE_TITLE_SCAN_TL_X +msgstr "" + +#original text: SANE_TITLE_SCAN_TL_Y +_SANE_TITLE_SCAN_TL_Y +msgstr "" + +#original text: SANE_TITLE_SCAN_BR_X +_SANE_TITLE_SCAN_BR_X +msgstr "" + +#original text: SANE_TITLE_SCAN_BR_Y +_SANE_TITLE_SCAN_BR_Y +msgstr "" + +#original text: SANE_TITLE_SCAN_RESOLUTION +_SANE_TITLE_SCAN_RESOLUTION +msgstr "" + +#original text: SANE_TITLE_SCAN_X_RESOLUTION +_SANE_TITLE_SCAN_X_RESOLUTION +msgstr "" + +#original text: SANE_TITLE_SCAN_Y_RESOLUTION +_SANE_TITLE_SCAN_Y_RESOLUTION +msgstr "" + +#original text: SANE_TITLE_CUSTOM_GAMMA +_SANE_TITLE_CUSTOM_GAMMA +msgstr "" + +#original text: SANE_TITLE_GAMMA_VECTOR +_SANE_TITLE_GAMMA_VECTOR +msgstr "" + +#original text: SANE_TITLE_GAMMA_VECTOR_R +_SANE_TITLE_GAMMA_VECTOR_R +msgstr "" + +#original text: SANE_TITLE_GAMMA_VECTOR_G +_SANE_TITLE_GAMMA_VECTOR_G +msgstr "" + +#original text: SANE_TITLE_GAMMA_VECTOR_B +_SANE_TITLE_GAMMA_VECTOR_B +msgstr "" + +#original text: SANE_TITLE_BRIGHTNESS +_SANE_TITLE_BRIGHTNESS +msgstr "" + +#original text: SANE_TITLE_CONTRAST +_SANE_TITLE_CONTRAST +msgstr "" + +#original text: SANE_TITLE_GRAIN_SIZE +_SANE_TITLE_GRAIN_SIZE +msgstr "" + +#original text: SANE_TITLE_HALFTONE +_SANE_TITLE_HALFTONE +msgstr "" + +#original text: SANE_TITLE_BLACK_LEVEL +_SANE_TITLE_BLACK_LEVEL +msgstr "" + +#original text: SANE_TITLE_WHITE_LEVEL +_SANE_TITLE_WHITE_LEVEL +msgstr "" + +#original text: SANE_TITLE_SHADOW +_SANE_TITLE_SHADOW +msgstr "" + +#original text: SANE_TITLE_SHADOW_R +_SANE_TITLE_SHADOW_R +msgstr "" + +#original text: SANE_TITLE_SHADOW_G +_SANE_TITLE_SHADOW_G +msgstr "" + +#original text: SANE_TITLE_SHADOW_B +_SANE_TITLE_SHADOW_B +msgstr "" + +#original text: SANE_TITLE_HIGHLIGHT +_SANE_TITLE_HIGHLIGHT +msgstr "" + +#original text: SANE_TITLE_HIGHLIGHT_R +_SANE_TITLE_HIGHLIGHT_R +msgstr "" + +#original text: SANE_TITLE_HIGHLIGHT_G +_SANE_TITLE_HIGHLIGHT_G +msgstr "" + +#original text: SANE_TITLE_HIGHLIGHT_B +_SANE_TITLE_HIGHLIGHT_B +msgstr "" + +#original text: SANE_TITLE_HUE +_SANE_TITLE_HUE +msgstr "" + +#original text: SANE_TITLE_SATURATION +_SANE_TITLE_SATURATION +msgstr "" + +#original text: SANE_TITLE_FILE +_SANE_TITLE_FILE +msgstr "" + +#original text: SANE_TITLE_HALFTONE_DIMENSION +_SANE_TITLE_HALFTONE_DIMENSION +msgstr "" + +#original text: SANE_TITLE_HALFTONE_PATTERN +_SANE_TITLE_HALFTONE_PATTERN +msgstr "" + +#original text: SANE_TITLE_RESOLUTION_BIND +_SANE_TITLE_RESOLUTION_BIND +msgstr "" + +#original text: SANE_TITLE_NEGATIVE +_SANE_TITLE_NEGATIVE +msgstr "" + +#original text: SANE_TITLE_QUALITY_CAL +_SANE_TITLE_QUALITY_CAL +msgstr "" + +#original text: SANE_TITLE_DOR +_SANE_TITLE_DOR +msgstr "" + +#original text: SANE_TITLE_RGB_BIND +_SANE_TITLE_RGB_BIND +msgstr "" + +#original text: SANE_TITLE_THRESHOLD +_SANE_TITLE_THRESHOLD +msgstr "" + +#original text: SANE_TITLE_ANALOG_GAMMA +_SANE_TITLE_ANALOG_GAMMA +msgstr "" + +#original text: SANE_TITLE_ANALOG_GAMMA_R +_SANE_TITLE_ANALOG_GAMMA_R +msgstr "" + +#original text: SANE_TITLE_ANALOG_GAMMA_G +_SANE_TITLE_ANALOG_GAMMA_G +msgstr "" + +#original text: SANE_TITLE_ANALOG_GAMMA_B +_SANE_TITLE_ANALOG_GAMMA_B +msgstr "" + +#original text: SANE_TITLE_ANALOG_GAMMA_BIND +_SANE_TITLE_ANALOG_GAMMA_BIND +msgstr "" + +#original text: SANE_TITLE_SMEAR +_SANE_TITLE_SMEAR +msgstr "" + +#original text: SANE_TITLE_TEN_BIT_MODE +_SANE_TITLE_TEN_BIT_MODE +msgstr "" + +#original text: SANE_TITLE_TWELVE_BIT_MODE +_SANE_TITLE_TWELVE_BIT_MODE +msgstr "" + +#original text: SANE_TITLE_WARMUP +_SANE_TITLE_WARMUP +msgstr "" + +#original text: SANE_TITLE_RGB_PREVIEW_PATCH +_SANE_TITLE_RGB_PREVIEW_PATCH +msgstr "" + +#original text: SANE_TITLE_START_SCAN_PATCH +_SANE_TITLE_START_SCAN_PATCH +msgstr "" + +#original text: SANE_TITLE_CAL_EXPOS_TIME +_SANE_TITLE_CAL_EXPOS_TIME +msgstr "" + +#original text: SANE_TITLE_CAL_EXPOS_TIME_R +_SANE_TITLE_CAL_EXPOS_TIME_R +msgstr "" + +#original text: SANE_TITLE_CAL_EXPOS_TIME_G +_SANE_TITLE_CAL_EXPOS_TIME_G +msgstr "" + +#original text: SANE_TITLE_CAL_EXPOS_TIME_B +_SANE_TITLE_CAL_EXPOS_TIME_B +msgstr "" + +#original text: SANE_TITLE_SCAN_EXPOS_TIME +_SANE_TITLE_SCAN_EXPOS_TIME +msgstr "" + +#original text: SANE_TITLE_SCAN_EXPOS_TIME_R +_SANE_TITLE_SCAN_EXPOS_TIME_R +msgstr "" + +#original text: SANE_TITLE_SCAN_EXPOS_TIME_G +_SANE_TITLE_SCAN_EXPOS_TIME_G +msgstr "" + +#original text: SANE_TITLE_SCAN_EXPOS_TIME_B +_SANE_TITLE_SCAN_EXPOS_TIME_B +msgstr "" + +#original text: SANE_TITLE_SELECT_EXPOSURE_TIME +_SANE_TITLE_SELECT_EXPOSURE_TIME +msgstr "" + +#original text: SANE_TITLE_CAL_LAMP_DEN +_SANE_TITLE_CAL_LAMP_DEN +msgstr "" + +#original text: SANE_TITLE_SCAN_LAMP_DEN +_SANE_TITLE_SCAN_LAMP_DEN +msgstr "" + +#original text: SANE_TITLE_SELECT_LAMP_DENSITY +_SANE_TITLE_SELECT_LAMP_DENSITY +msgstr "" + +#original text: SANE_DESC_PREVIEW +_SANE_DESC_PREVIEW +msgstr "" + +#original text: SANE_DESC_GRAY_PREVIEW +_SANE_DESC_GRAY_PREVIEW +msgstr "" + +#original text: SANE_DESC_BIT_DEPTH +_SANE_DESC_BIT_DEPTH +msgstr "" + +#original text: SANE_DESC_SCAN_MODE +_SANE_DESC_SCAN_MODE +msgstr "" + +#original text: SANE_DESC_SCAN_SPEED +_SANE_DESC_SCAN_SPEED +msgstr "" + +#original text: SANE_DESC_SCAN_SOURCE +_SANE_DESC_SCAN_SOURCE +msgstr "" + +#original text: SANE_DESC_BACKTRACK +_SANE_DESC_BACKTRACK +msgstr "" + +#original text: SANE_DESC_SCAN_TL_X +_SANE_DESC_SCAN_TL_X +msgstr "" + +#original text: SANE_DESC_SCAN_TL_Y +_SANE_DESC_SCAN_TL_Y +msgstr "" + +#original text: SANE_DESC_SCAN_BR_X +_SANE_DESC_SCAN_BR_X +msgstr "" + +#original text: SANE_DESC_SCAN_BR_Y +_SANE_DESC_SCAN_BR_Y +msgstr "" + +#original text: SANE_DESC_SCAN_RESOLUTION +_SANE_DESC_SCAN_RESOLUTION +msgstr "" + +#original text: SANE_DESC_SCAN_X_RESOLUTION +_SANE_DESC_SCAN_X_RESOLUTION +msgstr "" + +#original text: SANE_DESC_SCAN_Y_RESOLUTION +_SANE_DESC_SCAN_Y_RESOLUTION +msgstr "" + +#original text: SANE_DESC_CUSTOM_GAMMA +_SANE_DESC_CUSTOM_GAMMA +msgstr "" + +#original text: SANE_DESC_GAMMA_VECTOR +_SANE_DESC_GAMMA_VECTOR +msgstr "" + +#original text: SANE_DESC_GAMMA_VECTOR_R +_SANE_DESC_GAMMA_VECTOR_R +msgstr "" + +#original text: SANE_DESC_GAMMA_VECTOR_G +_SANE_DESC_GAMMA_VECTOR_G +msgstr "" + +#original text: SANE_DESC_GAMMA_VECTOR_B +_SANE_DESC_GAMMA_VECTOR_B +msgstr "" + +#original text: SANE_DESC_BRIGHTNESS +_SANE_DESC_BRIGHTNESS +msgstr "" + +#original text: SANE_DESC_CONTRAST +_SANE_DESC_CONTRAST +msgstr "" + +#original text: SANE_DESC_GRAIN_SIZE +_SANE_DESC_GRAIN_SIZE +msgstr "" + +#original text: SANE_DESC_HALFTONE +_SANE_DESC_HALFTONE +msgstr "" + +#original text: SANE_DESC_BLACK_LEVEL +_SANE_DESC_BLACK_LEVEL +msgstr "" + +#original text: SANE_DESC_WHITE_LEVEL +_SANE_DESC_WHITE_LEVEL +msgstr "" + +#original text: SANE_DESC_SHADOW +_SANE_DESC_SHADOW +msgstr "" + +#original text: SANE_DESC_SHADOW_R +_SANE_DESC_SHADOW_R +msgstr "" + +#original text: SANE_DESC_SHADOW_G +_SANE_DESC_SHADOW_G +msgstr "" + +#original text: SANE_DESC_SHADOW_B +_SANE_DESC_SHADOW_B +msgstr "" + +#original text: SANE_DESC_HIGHLIGHT +_SANE_DESC_HIGHLIGHT +msgstr "" + +#original text: SANE_DESC_HIGHLIGHT_R +_SANE_DESC_HIGHLIGHT_R +msgstr "" + +#original text: SANE_DESC_HIGHLIGHT_G +_SANE_DESC_HIGHLIGHT_G +msgstr "" + +#original text: SANE_DESC_HIGHLIGHT_B +_SANE_DESC_HIGHLIGHT_B +msgstr "" + +#original text: SANE_DESC_HUE +_SANE_DESC_HUE +msgstr "" + +#original text: SANE_DESC_SATURATION +_SANE_DESC_SATURATION +msgstr "" + +#original text: SANE_DESC_FILE +_SANE_DESC_FILE +msgstr "" + +#original text: SANE_DESC_HALFTONE_DIMENSION +_SANE_DESC_HALFTONE_DIMENSION +msgstr "" + +#original text: SANE_DESC_HALFTONE_PATTERN +_SANE_DESC_HALFTONE_PATTERN +msgstr "" + +#original text: SANE_DESC_RESOLUTION_BIND +_SANE_DESC_RESOLUTION_BIND +msgstr "" + +#original text: SANE_DESC_NEGATIVE +_SANE_DESC_NEGATIVE +msgstr "" + +#original text: SANE_DESC_QUALITY_CAL +_SANE_DESC_QUALITY_CAL +msgstr "" + +#original text: SANE_DESC_DOR +_SANE_DESC_DOR +msgstr "" + +#original text: SANE_DESC_RGB_BIND +_SANE_DESC_RGB_BIND +msgstr "" + +#original text: SANE_DESC_THRESHOLD +_SANE_DESC_THRESHOLD +msgstr "" + +#original text: SANE_DESC_ANALOG_GAMMA +_SANE_DESC_ANALOG_GAMMA +msgstr "" + +#original text: SANE_DESC_ANALOG_GAMMA_R +_SANE_DESC_ANALOG_GAMMA_R +msgstr "" + +#original text: SANE_DESC_ANALOG_GAMMA_G +_SANE_DESC_ANALOG_GAMMA_G +msgstr "" + +#original text: SANE_DESC_ANALOG_GAMMA_B +_SANE_DESC_ANALOG_GAMMA_B +msgstr "" + +#original text: SANE_DESC_ANALOG_GAMMA_BIND +_SANE_DESC_ANALOG_GAMMA_BIND +msgstr "" + +#original text: SANE_DESC_SMEAR +_SANE_DESC_SMEAR +msgstr "" + +#original text: SANE_DESC_TEN_BIT_MODE +_SANE_DESC_TEN_BIT_MODE +msgstr "" + +#original text: SANE_DESC_TWELVE_BIT_MODE +_SANE_DESC_TWELVE_BIT_MODE +msgstr "" + +#original text: SANE_DESC_WARMUP +_SANE_DESC_WARMUP +msgstr "" + +#original text: SANE_DESC_RGB_PREVIEW_PATCH +_SANE_DESC_RGB_PREVIEW_PATCH +msgstr "" + +#original text: SANE_DESC_START_SCAN_PATCH +_SANE_DESC_START_SCAN_PATCH +msgstr "" + +#original text: SANE_DESC_CAL_EXPOS_TIME +_SANE_DESC_CAL_EXPOS_TIME +msgstr "" + +#original text: SANE_DESC_CAL_EXPOS_TIME_R +_SANE_DESC_CAL_EXPOS_TIME_R +msgstr "" + +#original text: SANE_DESC_CAL_EXPOS_TIME_G +_SANE_DESC_CAL_EXPOS_TIME_G +msgstr "" + +#original text: SANE_DESC_CAL_EXPOS_TIME_B +_SANE_DESC_CAL_EXPOS_TIME_B +msgstr "" + +#original text: SANE_DESC_SCAN_EXPOS_TIME +_SANE_DESC_SCAN_EXPOS_TIME +msgstr "" + +#original text: SANE_DESC_SCAN_EXPOS_TIME_R +_SANE_DESC_SCAN_EXPOS_TIME_R +msgstr "" + +#original text: SANE_DESC_SCAN_EXPOS_TIME_G +_SANE_DESC_SCAN_EXPOS_TIME_G +msgstr "" + +#original text: SANE_DESC_SCAN_EXPOS_TIME_B +_SANE_DESC_SCAN_EXPOS_TIME_B +msgstr "" + +#original text: SANE_DESC_SELECT_EXPOSURE_TIME +_SANE_DESC_SELECT_EXPOSURE_TIME +msgstr "" + +#original text: SANE_DESC_CAL_LAMP_DEN +_SANE_DESC_CAL_LAMP_DEN +msgstr "" + +#original text: SANE_DESC_SCAN_LAMP_DEN +_SANE_DESC_SCAN_LAMP_DEN +msgstr "" + +#original text: SANE_DESC_SELECT_LAMP_DENSITY +_SANE_DESC_SELECT_LAMP_DENSITY +msgstr "" diff --git a/backend-po/po.in2po b/backend-po/po.in2po new file mode 100755 index 0000000..f202c20 --- /dev/null +++ b/backend-po/po.in2po @@ -0,0 +1,8 @@ +if [ $# != 1 ] +then +echo "Usage: po.in2po language-abrevation" +echo "eg: po.in2po fr" +exit -1 +fi +gcc -E -P - <$1.po.in >$1.po + diff --git a/backend-po/remake_backend.po.in b/backend-po/remake_backend.po.in new file mode 100755 index 0000000..b215c7f --- /dev/null +++ b/backend-po/remake_backend.po.in @@ -0,0 +1,10 @@ +if [ $# != 1 ] +then +echo "Usage: remake_backend.po.in file[.po.in]" +exit -1 +fi +cat $1.po.in | sed -e "/#original text/D" -e "/msgid/P" -e "s/msgid /_/g" - | sed -e "s/msgid/#original text:/g" >$1.po.in.tmp +gcc -E -P - <$1.po.in.tmp | sed -e "s/^_/msgid /g" - | cat newbackend.po.in.header - >$1.po.in +rm $1.po.in.tmp + + diff --git a/backend-po/umax.de.po b/backend-po/umax.de.po new file mode 100644 index 0000000..86e9d9b --- /dev/null +++ b/backend-po/umax.de.po @@ -0,0 +1,852 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#nls translation file for backend umax +#language: german (de) + +#original text: "Number of options" +msgid "Number of options" +msgstr "Anzahl der Optionen" + +#original text: "Preview" +msgid "Preview" +msgstr "Vorschau" + +#original text: "Force monochrome preview" +msgid "Force monochrome preview" +msgstr "Vorschauscan in grau" + +#original text: "Bit depth" +msgid "Bit depth" +msgstr "Bittiefe" + +#original text: "Scan mode" +msgid "Scan mode" +msgstr "Scan Modus" + +#original text: "Scan speed" +msgid "Scan speed" +msgstr "Scangeschwindigkeit" + +#original text: "Scan source" +msgid "Scan source" +msgstr "Scanquelle" + +#original text: "Force backtracking" +msgid "Force backtracking" +msgstr "" + +#original text: "Top-left x" +msgid "Top-left x" +msgstr "links" + +#original text: "Top-left y" +msgid "Top-left y" +msgstr "oben" + +#original text: "Bottom-right x" +msgid "Bottom-right x" +msgstr "rechts" + +#original text: "Bottom-right y" +msgid "Bottom-right y" +msgstr "unten" + +#original text: "Scan resolution" +msgid "Scan resolution" +msgstr "Scanauflösung" + +#original text: "X-resolution" +msgid "X-resolution" +msgstr "X-Auflösung" + +#original text: "Y-resolution" +msgid "Y-resolution" +msgstr "Y-Auflösung" + +#original text: "Use custom gamma table" +msgid "Use custom gamma table" +msgstr "Benutze scannerinterne Gammakorrektur" + +#original text: "Image intensity" +msgid "Image intensity" +msgstr "Bildintensität" + +#original text: "Red intensity" +msgid "Red intensity" +msgstr "Intensität Rot" + +#original text: "Green intensity" +msgid "Green intensity" +msgstr "Intensität Grün" + +#original text: "Blue intensity" +msgid "Blue intensity" +msgstr "Intensität Blau" + +#original text: "Brightness" +msgid "Brightness" +msgstr "Helligkeit" + +#original text: "Contrast" +msgid "Contrast" +msgstr "Kontrast" + +#original text: "Grain size" +msgid "Grain size" +msgstr "" + +#original text: "Halftoning" +msgid "Halftoning" +msgstr "" + +#original text: "Black level" +msgid "Black level" +msgstr "Wert für Schwarz" + +#original text: "White level" +msgid "White level" +msgstr "Wert für Weiß" + +#original text: "Shadow" +msgid "Shadow" +msgstr "Schatten" + +#original text: "Shadow for red" +msgid "Shadow for red" +msgstr "Schatten Rot" + +#original text: "Shadow for green" +msgid "Shadow for green" +msgstr "Schatten Grün" + +#original text: "Shadow for blue" +msgid "Shadow for blue" +msgstr "Schatten Blau" + +#original text: "Highlight" +msgid "Highlight" +msgstr "Licht" + +#original text: "Highlight for red" +msgid "Highlight for red" +msgstr "Licht Rot" + +#original text: "Highlight for green" +msgid "Highlight for green" +msgstr "Licht Grün" + +#original text: "Highlight for blue" +msgid "Highlight for blue" +msgstr "Licht Blau" + +#original text: "Hue" +msgid "Hue" +msgstr "" + +#original text: "Saturation" +msgid "Saturation" +msgstr "Sättigung" + +#original text: "Filename" +msgid "Filename" +msgstr "Datiename" + +#original text: "Halftone pattern size" +msgid "Halftone pattern size" +msgstr "Halbton Matrix Größe" + +#original text: "Halftone pattern" +msgid "Halftone pattern" +msgstr "Halbton Matrix" + +#original text: "Bind X and Y resolution" +msgid "Bind X and Y resolution" +msgstr "verbinde X und Y Auflösung" + +#original text: "Negative" +msgid "Negative" +msgstr "Negativ" + +#original text: "Quality calibration" +msgid "Quality calibration" +msgstr "Qualitäts Weißabgleich" + +#original text: "Double Optical Resolution" +msgid "Double Optical Resolution" +msgstr "Verdoppelte optische Auflösung" + +#original text: "Bind RGB" +msgid "Bind RGB" +msgstr "Verbinde RGB" + +#original text: "Threshold" +msgid "Threshold" +msgstr "Grenzwert" + +#original text: "Analog gamma correction" +msgid "Analog gamma correction" +msgstr "Analoge Gammakorrektur" + +#original text: "Analog gamma red" +msgid "Analog gamma red" +msgstr "Analoger Gammawert Rot" + +#original text: "Analog gamma green" +msgid "Analog gamma green" +msgstr "Analoger Gammawert Grün" + +#original text: "Analog gamma blue" +msgid "Analog gamma blue" +msgstr "Analoger Gammawert Blau" + +#original text: "Bind analog gamma" +msgid "Bind analog gamma" +msgstr "Verbinde analoge Gammawerte" + +#original text: "Smear" +msgid "Smear" +msgstr "Schmieren" + +#original text: "10 bit-mode" +msgid "10 bit-mode" +msgstr "" + +#original text: "12 bit-mode" +msgid "12 bit-mode" +msgstr "" + +#original text: "Warmup lamp" +msgid "Warmup lamp" +msgstr "Lampe aufwärmen" + +#original text: "Preview patch" +msgid "Preview patch" +msgstr "" + +#original text: "Start-scan patch" +msgid "Start-scan patch" +msgstr "" + +#original text: "Cal. exposure-time" +msgid "Cal. exposure-time" +msgstr "Beleuchtungszeit zum Kalibrieren" + +#original text: "Cal. exposure-time for red" +msgid "Cal. exposure-time for red" +msgstr "Beleuchtungszeit zum Kalibrieren von Rot" + +#original text: "Cal. exposure-time for green" +msgid "Cal. exposure-time for green" +msgstr "Beleuchtungszeit zum Kalibrieren von Grün" + +#original text: "Cal. exposure-time for blue" +msgid "Cal. exposure-time for blue" +msgstr "Beleuchtungszeit zum Kalibrieren von Blau" + +#original text: "Scan exposure-time" +msgid "Scan exposure-time" +msgstr "Beleuchtungszeit zum Scannen" + +#original text: "Scan exposure-time for red" +msgid "Scan exposure-time for red" +msgstr "Beleuchtungszeit zum Scannen von Rot" + +#original text: "Scan exposure-time for green" +msgid "Scan exposure-time for green" +msgstr "Beleuchtungszeit zum Scannen von Grün" + +#original text: "Scan exposure-time for blue" +msgid "Scan exposure-time for blue" +msgstr "Beleuchtungszeit zum Scannen von Blau" + +#original text: "Set exposure-time" +msgid "Set exposure-time" +msgstr "Definiere Beleuchtungszeit" + +#original text: "Cal. lamp density" +msgid "Cal. lamp density" +msgstr "Lichtwert für Kalibrierung" + +#original text: "Scan lamp density" +msgid "Scan lamp density" +msgstr "Lichtwert beim Scannen" + +#original text: "Set lamp density" +msgid "Set lamp density" +msgstr "Definiere Lichtwert" + + + + +#original text: "Request a preview-quality scan." +msgid "Request a preview-quality scan." +msgstr "Erbitte Scan in Vorschauqualität" + +#original text: "Request that all previews are done in monochrome mode. On a three-pass " " scanner this cuts down the number of passes to one and on a one-pass " "scanner, it reduces the memory requirements and scan-time of the preview." +msgid "Request that all previews are done in monochrome mode. On a three-pass " " scanner this cuts down the number of passes to one and on a one-pass " "scanner, it reduces the memory requirements and scan-time of the preview." +msgstr "" + +#original text: "Number of bits per sample, typical values are 1 for \"line-art\" and 8 " "for multibit scans." +msgid "Number of bits per sample, typical values are 1 for \"line-art\" and 8 " "for multibit scans." +msgstr "Anzahl der Bits pro Farbwert, typische Werte seind 1 für lineart- und 8 für multibit-Scans" + +#original text: "Selects the scan mode (e.g., lineart,monochrome, or color)." +msgid "Selects the scan mode (e.g., lineart,monochrome, or color)." +msgstr "Wählt den Scanmode (z.B. Lineart, Grau oder Farbe)" + +#original text: "Determines the speed at which the scan proceeds." +msgid "Determines the speed at which the scan proceeds." +msgstr "Bestimmt die Scangeschwindigkeit" + +#original text: "Selects the scan source (such as a document-feeder)." +msgid "Selects the scan source (such as a document-feeder)." +msgstr "Bestimmt die Scanquelle (wie Dokumenteneinzug)" + +#original text: "Controls whether backtracking is forced." +msgid "Controls whether backtracking is forced." +msgstr "" + +#original text: "Top-left x position of scan area." +msgid "Top-left x position of scan area." +msgstr "linke Kante des zu scannenden Bereichs" + +#original text: "Top-left y position of scan area." +msgid "Top-left y position of scan area." +msgstr "Obere Kante des zu scannenden Bereichs" + +#original text: "Bottom-right x position of scan area." +msgid "Bottom-right x position of scan area." +msgstr "rechte Kante des zu scannenden Bereichs" + +#original text: "Bottom-right y position of scan area." +msgid "Bottom-right y position of scan area." +msgstr "untere Kante des zu scannenden Bereichs" + +#original text: "Sets the resolution of the scanned image." +msgid "Sets the resolution of the scanned image." +msgstr "Bestimmt die Auflösung des Bildes" + +#original text: "Sets the horizontal resolution of the scanned image." +msgid "Sets the horizontal resolution of the scanned image." +msgstr "Bestimmt die horizontale Auflösung des Bildes" + +#original text: "Sets the vertical resolution of the scanned image." +msgid "Sets the vertical resolution of the scanned image." +msgstr "Bestimmt die vertikale Auflösung des Bildes" + +#original text: "Determines whether a builtin or a custom gamma-table should be used." +msgid "Determines whether a builtin or a custom gamma-table should be used." +msgstr "Bestimmt ob die scannerinterne Gammakorrektur verwendet wird" + +#original text: "Gamma-correction table. In color mode this option equally affects the " "red, green, and blue channels simultaneously (i.e., it is an intensity " "gamma table)." +msgid "Gamma-correction table. In color mode this option equally affects the " "red, green, and blue channels simultaneously (i.e., it is an intensity " "gamma table)." +msgstr "Gamma Tabelle" + +#original text: "Gamma-correction table for the red band." +msgid "Gamma-correction table for the red band." +msgstr "Gamma Tabelle für rote Komponente" + +#original text: "Gamma-correction table for the green band." +msgid "Gamma-correction table for the green band." +msgstr "Gamma Tabelle für grüne Komponente" + +#original text: "Gamma-correction table for the blue band." +msgid "Gamma-correction table for the blue band." +msgstr "Gamma Tabelle für blaue Komponente" + +#original text: "Controls the brightness of the acquired image." +msgid "Controls the brightness of the acquired image." +msgstr "Kontrolliert die Helligkeit des Bildes" + +#original text: "Controls the contrast of the acquired image." +msgid "Controls the contrast of the acquired image." +msgstr "Kontrolliert den Kontrast des Bildes" + +#original text: "Selects the \"graininess\" of the acquired image. Smaller values " "result in sharper images." +msgid "Selects the \"graininess\" of the acquired image. Smaller values " "result in sharper images." +msgstr "" + +#original text: "Selects whether the acquired image should be halftoned (dithered)." +msgid "Selects whether the acquired image should be halftoned (dithered)." +msgstr "" + +#original text: "Selects what radiance level should be considered \"black\"." +msgid "Selects what radiance level should be considered \"black\"." +msgstr "Bestimmt, welcher Helligkeitswert als Schwarz angesehen werden soll" + +#original text: "Selects what radiance level should be considered \"white\"." +msgid "Selects what radiance level should be considered \"white\"." +msgstr "Bestimmt, welcher Helligkeitswert als Weiß angesehen werden soll" + +#original text: "Selects what radiance level should be considered \"black\"." +msgid "Selects what radiance level should be considered \"black\"." +msgstr "Bestimmt, welcher Helligkeitswert als Schwarz angesehen werden soll" + +#original text: "Selects what red radiance level should be considered \"black\"." +msgid "Selects what red radiance level should be considered \"black\"." +msgstr "Bestimmt, welcher Helligkeitswert der roten Komponente als Schwarz angesehen werden soll" + +#original text: "Selects what green radiance level should be considered \"black\"." +msgid "Selects what green radiance level should be considered \"black\"." +msgstr "Bestimmt, welcher Helligkeitswert der grünen Komponente als Schwarz angesehen werden soll" + +#original text: "Selects what blue radiance level should be considered \"black\"." +msgid "Selects what blue radiance level should be considered \"black\"." +msgstr "Bestimmt, welcher Helligkeitswert der blauen Komponente als Schwarz angesehen werden soll" + +#original text: "Selects what radiance level should be considered \"white\"." +msgid "Selects what radiance level should be considered \"white\"." +msgstr "Bestimmt, welcher Helligkeitswert als Weiß angesehen werden soll" + +#original text: "Selects what red radiance level should be considered \"full red\"." +msgid "Selects what red radiance level should be considered \"full red\"." +msgstr "Bestimmt, welcher Helligkeitswert der roten Komponente als Weiß angesehen werden soll" + +#original text: "Selects what green radiance level should be considered \"full green\"." +msgid "Selects what green radiance level should be considered \"full green\"." +msgstr "Bestimmt, welcher Helligkeitswert der grünen Komponente als Weiß angesehen werden soll" + +#original text: "Selects what blue radiance level should be considered \"full blue\"." +msgid "Selects what blue radiance level should be considered \"full blue\"." +msgstr "Bestimmt, welcher Helligkeitswert der blauen Komponente als Weiß angesehen werden soll" + +#original text: "Controls the \"hue\" (blue-level) of the acquired image." +msgid "Controls the \"hue\" (blue-level) of the acquired image." +msgstr "" + +#original text: "The saturation level controls the amount of \"blooming\" that occurs when " "acquiring an image with a camera. Larger values cause more blooming." +msgid "The saturation level controls the amount of \"blooming\" that occurs when " "acquiring an image with a camera. Larger values cause more blooming." +msgstr "" + +#original text: "The filename of the image to be loaded." +msgid "The filename of the image to be loaded." +msgstr "Der Dateiname des zu ladenden Bildes" + +#original text: "Sets the size of the halftoning (dithering) pattern used when scanning " "halftoned images." +msgid "Sets the size of the halftoning (dithering) pattern used when scanning " "halftoned images." +msgstr "" + +#original text: "Defines the halftoning (dithering) pattern for scanning halftoned images." +msgid "Defines the halftoning (dithering) pattern for scanning halftoned images." +msgstr "" + +#original text: "Use same values for X and Y resolution" +msgid "Use same values for X and Y resolution" +msgstr "Benutze die gleichen Auflösungen für X und Y" + +#original text: "Swap black and white" +msgid "Swap black and white" +msgstr "Invertiere die Farben, z.B. tausche Schwarz gegen Weiß" + +#original text: "Do a quality white-calibration" +msgid "Do a quality white-calibration" +msgstr "Führe einen Qualitätsweißabgleich durch" + +#original text: "Use lens that doubles optical resolution" +msgid "Use lens that doubles optical resolution" +msgstr "Benutze die Linse, mit der die optische Auflösung verdoppelt wird" + +#original text: "In RGB-mode use same values for each color" +msgid "In RGB-mode use same values for each color" +msgstr "Benutze die gleichen Wert für alle Farben im RGB Modus" + +#original text: "Select minimum-brightness to get a white point" +msgid "Select minimum-brightness to get a white point" +msgstr "Wähle die minimale Helligkeit, die als Weiß betrachtet werden soll" + +#original text: "Analog gamma-correction" +msgid "Analog gamma-correction" +msgstr "analoge Gammakorrektur" + +#original text: "Analog gamma-correction for red" +msgid "Analog gamma-correction for red" +msgstr "analoge Gammakorrektur für Rot" + +#original text: "Analog gamma-correction for green" +msgid "Analog gamma-correction for green" +msgstr "analoge Gammakorrektur für Grün" + +#original text: "Analog gamma-correction for blue" +msgid "Analog gamma-correction for blue" +msgstr "analoge Gammakorrektur für Blau" + +#original text: "In RGB-mode use same values for each color" +msgid "In RGB-mode use same values for each color" +msgstr "" + +#original text: "Don't care about image smearing problem" +msgid "Don't care about image smearing problem" +msgstr "Ignoriere das Problem des Verschmierens des Bildes" + +#original text: "Output with 10 bits instead of 8 bits" +msgid "Output with 10 bits instead of 8 bits" +msgstr "" + +#original text: "Output with 12 bits instead of 8 bits" +msgid "Output with 12 bits instead of 8 bits" +msgstr "" + +#original text: "Warmup lamp before scanning" +msgid "Warmup lamp before scanning" +msgstr "Wärme die Lampe vorm Scannen auf" + +#original text: "Set preview-bit in rgb-mode" +msgid "Set preview-bit in rgb-mode" +msgstr "Setzt das Vorschaubit im Farbmodus" + +#original text: "Use special start-scan bits" +msgid "Use special start-scan bits" +msgstr "Benutze besondere Einstellungen beim Start des Scans" + +#original text: "Define exposure-time for calibration" +msgid "Define exposure-time for calibration" +msgstr "Bestimmt die Beleuchtungszeit für die Kalibrierung" + +#original text: "Define exposure-time for red calibration" +msgid "Define exposure-time for red calibration" +msgstr "Bestimmt die Beleuchtungszeit für die Kalibrierung der roten Komponente" + +#original text: "Define exposure-time for green calibration" +msgid "Define exposure-time for green calibration" +msgstr "Bestimmt die Beleuchtungszeit für die Kalibrierung der grünen Komponente" + +#original text: "Define exposure-time for blue calibration" +msgid "Define exposure-time for blue calibration" +msgstr "Bestimmt die Beleuchtungszeit für die Kalibrierung der blauen Komponente" + +#original text: "Define exposure-time for scan" +msgid "Define exposure-time for scan" +msgstr "Bestimmt die Beleuchtungszeit für den Scan" + +#original text: "Define exposure-time for red scan" +msgid "Define exposure-time for red scan" +msgstr "Bestimmt die Beleuchtungszeit für den Scan der roten Komponente" + +#original text: "Define exposure-time for green scan" +msgid "Define exposure-time for green scan" +msgstr "Bestimmt die Beleuchtungszeit für den Scan der grünen Komponente" + +#original text: "Define exposure-time for blue scan" +msgid "Define exposure-time for blue scan" +msgstr "Bestimmt die Beleuchtungszeit für den Scan der blauen Komponente" + +#original text: "Enable selection of exposure-time" +msgid "Enable selection of exposure-time" +msgstr "Ermögliche Einstellung der Beleuchtungszeiten" + +#original text: "Define lamp density for calibration" +msgid "Define lamp density for calibration" +msgstr "Definiere die Lichtwerte beim Kalibrieren" + +#original text: "Define lamp density for scan" +msgid "Define lamp density for scan" +msgstr "Definiere die Lichtwerte beim Scannen" + +#original text: "Enable selection of lamp density" +msgid "Enable selection of lamp density" +msgstr "Ermögliche Auswahl der Lichtwerte" + +msgid "Geometry" +msgstr "Geometrie" + +msgid "Enhancement" +msgstr "Farbverbesserung" + +msgid "Scan Mode" +msgstr "Scan Modus" + +msgid "Color" +msgstr "Farbe" + +msgid "Gray" +msgstr "Graustufen" + +msgid "Halftone" +msgstr "Halbton" + +msgid "Lineart" +msgstr "Strichzeichnung" + +msgid "Flatbed" +msgstr "Flachbett" + +msgid "Transparency" +msgstr "Durchlicht" + +msgid "Automatic Document Feeder" +msgstr "Autom. Dokumenteneinzug" + diff --git a/backend-po/umax.de.po.in b/backend-po/umax.de.po.in new file mode 100644 index 0000000..940f18c --- /dev/null +++ b/backend-po/umax.de.po.in @@ -0,0 +1,579 @@ +#include "/usr/local/include/sane/saneopts.h" +#define _(x) x + +#nls translation file for backend umax +#language: german (de) + +#original text: "Number of options" +msgid SANE_TITLE_NUM_OPTIONS +msgstr "Anzahl der Optionen" + +#original text: "Preview" +msgid SANE_TITLE_PREVIEW +msgstr "Vorschau" + +#original text: "Force monochrome preview" +msgid SANE_TITLE_GRAY_PREVIEW +msgstr "Vorschauscan in grau" + +#original text: "Bit depth" +msgid SANE_TITLE_BIT_DEPTH +msgstr "Bittiefe" + +#original text: "Scan mode" +msgid SANE_TITLE_SCAN_MODE +msgstr "Scan Modus" + +#original text: "Scan speed" +msgid SANE_TITLE_SCAN_SPEED +msgstr "Scangeschwindigkeit" + +#original text: "Scan source" +msgid SANE_TITLE_SCAN_SOURCE +msgstr "Scanquelle" + +#original text: "Force backtracking" +msgid SANE_TITLE_BACKTRACK +msgstr "" + +#original text: "Top-left x" +msgid SANE_TITLE_SCAN_TL_X +msgstr "links" + +#original text: "Top-left y" +msgid SANE_TITLE_SCAN_TL_Y +msgstr "oben" + +#original text: "Bottom-right x" +msgid SANE_TITLE_SCAN_BR_X +msgstr "rechts" + +#original text: "Bottom-right y" +msgid SANE_TITLE_SCAN_BR_Y +msgstr "unten" + +#original text: "Scan resolution" +msgid SANE_TITLE_SCAN_RESOLUTION +msgstr "Scanauflösung" + +#original text: "X-resolution" +msgid SANE_TITLE_SCAN_X_RESOLUTION +msgstr "X-Auflösung" + +#original text: "Y-resolution" +msgid SANE_TITLE_SCAN_Y_RESOLUTION +msgstr "Y-Auflösung" + +#original text: "Use custom gamma table" +msgid SANE_TITLE_CUSTOM_GAMMA +msgstr "Benutze scannerinterne Gammakorrektur" + +#original text: "Image intensity" +msgid SANE_TITLE_GAMMA_VECTOR +msgstr "Bildintensität" + +#original text: "Red intensity" +msgid SANE_TITLE_GAMMA_VECTOR_R +msgstr "Intensität Rot" + +#original text: "Green intensity" +msgid SANE_TITLE_GAMMA_VECTOR_G +msgstr "Intensität Grün" + +#original text: "Blue intensity" +msgid SANE_TITLE_GAMMA_VECTOR_B +msgstr "Intensität Blau" + +#original text: "Brightness" +msgid SANE_TITLE_BRIGHTNESS +msgstr "Helligkeit" + +#original text: "Contrast" +msgid SANE_TITLE_CONTRAST +msgstr "Kontrast" + +#original text: "Grain size" +msgid SANE_TITLE_GRAIN_SIZE +msgstr "" + +#original text: "Halftoning" +msgid SANE_TITLE_HALFTONE +msgstr "" + +#original text: "Black level" +msgid SANE_TITLE_BLACK_LEVEL +msgstr "Wert für Schwarz" + +#original text: "White level" +msgid SANE_TITLE_WHITE_LEVEL +msgstr "Wert für Weiß" + +#original text: "Shadow" +msgid SANE_TITLE_SHADOW +msgstr "Schatten" + +#original text: "Shadow for red" +msgid SANE_TITLE_SHADOW_R +msgstr "Schatten Rot" + +#original text: "Shadow for green" +msgid SANE_TITLE_SHADOW_G +msgstr "Schatten Grün" + +#original text: "Shadow for blue" +msgid SANE_TITLE_SHADOW_B +msgstr "Schatten Blau" + +#original text: "Highlight" +msgid SANE_TITLE_HIGHLIGHT +msgstr "Licht" + +#original text: "Highlight for red" +msgid SANE_TITLE_HIGHLIGHT_R +msgstr "Licht Rot" + +#original text: "Highlight for green" +msgid SANE_TITLE_HIGHLIGHT_G +msgstr "Licht Grün" + +#original text: "Highlight for blue" +msgid SANE_TITLE_HIGHLIGHT_B +msgstr "Licht Blau" + +#original text: "Hue" +msgid SANE_TITLE_HUE +msgstr "" + +#original text: "Saturation" +msgid SANE_TITLE_SATURATION +msgstr "Sättigung" + +#original text: "Filename" +msgid SANE_TITLE_FILE +msgstr "Datiename" + +#original text: "Halftone pattern size" +msgid SANE_TITLE_HALFTONE_DIMENSION +msgstr "Halbton Matrix Größe" + +#original text: "Halftone pattern" +msgid SANE_TITLE_HALFTONE_PATTERN +msgstr "Halbton Matrix" + +#original text: "Bind X and Y resolution" +msgid SANE_TITLE_RESOLUTION_BIND +msgstr "verbinde X und Y Auflösung" + +#original text: "Negative" +msgid SANE_TITLE_NEGATIVE +msgstr "Negativ" + +#original text: "Quality calibration" +msgid SANE_TITLE_QUALITY_CAL +msgstr "Qualitäts Weißabgleich" + +#original text: "Double Optical Resolution" +msgid SANE_TITLE_DOR +msgstr "Verdoppelte optische Auflösung" + +#original text: "Bind RGB" +msgid SANE_TITLE_RGB_BIND +msgstr "Verbinde RGB" + +#original text: "Threshold" +msgid SANE_TITLE_THRESHOLD +msgstr "Grenzwert" + +#original text: "Analog gamma correction" +msgid SANE_TITLE_ANALOG_GAMMA +msgstr "Analoge Gammakorrektur" + +#original text: "Analog gamma red" +msgid SANE_TITLE_ANALOG_GAMMA_R +msgstr "Analoger Gammawert Rot" + +#original text: "Analog gamma green" +msgid SANE_TITLE_ANALOG_GAMMA_G +msgstr "Analoger Gammawert Grün" + +#original text: "Analog gamma blue" +msgid SANE_TITLE_ANALOG_GAMMA_B +msgstr "Analoger Gammawert Blau" + +#original text: "Bind analog gamma" +msgid SANE_TITLE_ANALOG_GAMMA_BIND +msgstr "Verbinde analoge Gammawerte" + +#original text: "Smear" +msgid SANE_TITLE_SMEAR +msgstr "Schmieren" + +#original text: "10 bit-mode" +msgid SANE_TITLE_TEN_BIT_MODE +msgstr "" + +#original text: "12 bit-mode" +msgid SANE_TITLE_TWELVE_BIT_MODE +msgstr "" + +#original text: "Warmup lamp" +msgid SANE_TITLE_WARMUP +msgstr "Lampe aufwärmen" + +#original text: "Preview patch" +msgid SANE_TITLE_RGB_PREVIEW_PATCH +msgstr "" + +#original text: "Start-scan patch" +msgid SANE_TITLE_START_SCAN_PATCH +msgstr "" + +#original text: "Cal. exposure-time" +msgid SANE_TITLE_CAL_EXPOS_TIME +msgstr "Beleuchtungszeit zum Kalibrieren" + +#original text: "Cal. exposure-time for red" +msgid SANE_TITLE_CAL_EXPOS_TIME_R +msgstr "Beleuchtungszeit zum Kalibrieren von Rot" + +#original text: "Cal. exposure-time for green" +msgid SANE_TITLE_CAL_EXPOS_TIME_G +msgstr "Beleuchtungszeit zum Kalibrieren von Grün" + +#original text: "Cal. exposure-time for blue" +msgid SANE_TITLE_CAL_EXPOS_TIME_B +msgstr "Beleuchtungszeit zum Kalibrieren von Blau" + +#original text: "Scan exposure-time" +msgid SANE_TITLE_SCAN_EXPOS_TIME +msgstr "Beleuchtungszeit zum Scannen" + +#original text: "Scan exposure-time for red" +msgid SANE_TITLE_SCAN_EXPOS_TIME_R +msgstr "Beleuchtungszeit zum Scannen von Rot" + +#original text: "Scan exposure-time for green" +msgid SANE_TITLE_SCAN_EXPOS_TIME_G +msgstr "Beleuchtungszeit zum Scannen von Grün" + +#original text: "Scan exposure-time for blue" +msgid SANE_TITLE_SCAN_EXPOS_TIME_B +msgstr "Beleuchtungszeit zum Scannen von Blau" + +#original text: "Set exposure-time" +msgid SANE_TITLE_SELECT_EXPOSURE_TIME +msgstr "Definiere Beleuchtungszeit" + +#original text: "Cal. lamp density" +msgid SANE_TITLE_CAL_LAMP_DEN +msgstr "Lichtwert für Kalibrierung" + +#original text: "Scan lamp density" +msgid SANE_TITLE_SCAN_LAMP_DEN +msgstr "Lichtwert beim Scannen" + +#original text: "Set lamp density" +msgid SANE_TITLE_SELECT_LAMP_DENSITY +msgstr "Definiere Lichtwert" + + + + +#original text: "Request a preview-quality scan." +msgid SANE_DESC_PREVIEW +msgstr "Erbitte Scan in Vorschauqualität" + +#original text: "Request that all previews are done in monochrome mode. On a three-pass " " scanner this cuts down the number of passes to one and on a one-pass " "scanner, it reduces the memory requirements and scan-time of the preview." +msgid SANE_DESC_GRAY_PREVIEW +msgstr "" + +#original text: "Number of bits per sample, typical values are 1 for \"line-art\" and 8 " "for multibit scans." +msgid SANE_DESC_BIT_DEPTH +msgstr "Anzahl der Bits pro Farbwert, typische Werte seind 1 für lineart- und 8 für multibit-Scans" + +#original text: "Selects the scan mode (e.g., lineart,monochrome, or color)." +msgid SANE_DESC_SCAN_MODE +msgstr "Wählt den Scanmode (z.B. Lineart, Grau oder Farbe)" + +#original text: "Determines the speed at which the scan proceeds." +msgid SANE_DESC_SCAN_SPEED +msgstr "Bestimmt die Scangeschwindigkeit" + +#original text: "Selects the scan source (such as a document-feeder)." +msgid SANE_DESC_SCAN_SOURCE +msgstr "Bestimmt die Scanquelle (wie Dokumenteneinzug)" + +#original text: "Controls whether backtracking is forced." +msgid SANE_DESC_BACKTRACK +msgstr "" + +#original text: "Top-left x position of scan area." +msgid SANE_DESC_SCAN_TL_X +msgstr "linke Kante des zu scannenden Bereichs" + +#original text: "Top-left y position of scan area." +msgid SANE_DESC_SCAN_TL_Y +msgstr "Obere Kante des zu scannenden Bereichs" + +#original text: "Bottom-right x position of scan area." +msgid SANE_DESC_SCAN_BR_X +msgstr "rechte Kante des zu scannenden Bereichs" + +#original text: "Bottom-right y position of scan area." +msgid SANE_DESC_SCAN_BR_Y +msgstr "untere Kante des zu scannenden Bereichs" + +#original text: "Sets the resolution of the scanned image." +msgid SANE_DESC_SCAN_RESOLUTION +msgstr "Bestimmt die Auflösung des Bildes" + +#original text: "Sets the horizontal resolution of the scanned image." +msgid SANE_DESC_SCAN_X_RESOLUTION +msgstr "Bestimmt die horizontale Auflösung des Bildes" + +#original text: "Sets the vertical resolution of the scanned image." +msgid SANE_DESC_SCAN_Y_RESOLUTION +msgstr "Bestimmt die vertikale Auflösung des Bildes" + +#original text: "Determines whether a builtin or a custom gamma-table should be used." +msgid SANE_DESC_CUSTOM_GAMMA +msgstr "Bestimmt ob die scannerinterne Gammakorrektur verwendet wird" + +#original text: "Gamma-correction table. In color mode this option equally affects the " "red, green, and blue channels simultaneously (i.e., it is an intensity " "gamma table)." +msgid SANE_DESC_GAMMA_VECTOR +msgstr "Gamma Tabelle" + +#original text: "Gamma-correction table for the red band." +msgid SANE_DESC_GAMMA_VECTOR_R +msgstr "Gamma Tabelle für rote Komponente" + +#original text: "Gamma-correction table for the green band." +msgid SANE_DESC_GAMMA_VECTOR_G +msgstr "Gamma Tabelle für grüne Komponente" + +#original text: "Gamma-correction table for the blue band." +msgid SANE_DESC_GAMMA_VECTOR_B +msgstr "Gamma Tabelle für blaue Komponente" + +#original text: "Controls the brightness of the acquired image." +msgid SANE_DESC_BRIGHTNESS +msgstr "Kontrolliert die Helligkeit des Bildes" + +#original text: "Controls the contrast of the acquired image." +msgid SANE_DESC_CONTRAST +msgstr "Kontrolliert den Kontrast des Bildes" + +#original text: "Selects the \"graininess\" of the acquired image. Smaller values " "result in sharper images." +msgid SANE_DESC_GRAIN_SIZE +msgstr "" + +#original text: "Selects whether the acquired image should be halftoned (dithered)." +msgid SANE_DESC_HALFTONE +msgstr "" + +#original text: "Selects what radiance level should be considered \"black\"." +msgid SANE_DESC_BLACK_LEVEL +msgstr "Bestimmt, welcher Helligkeitswert als Schwarz angesehen werden soll" + +#original text: "Selects what radiance level should be considered \"white\"." +msgid SANE_DESC_WHITE_LEVEL +msgstr "Bestimmt, welcher Helligkeitswert als Weiß angesehen werden soll" + +#original text: "Selects what radiance level should be considered \"black\"." +msgid SANE_DESC_SHADOW +msgstr "Bestimmt, welcher Helligkeitswert als Schwarz angesehen werden soll" + +#original text: "Selects what red radiance level should be considered \"black\"." +msgid SANE_DESC_SHADOW_R +msgstr "Bestimmt, welcher Helligkeitswert der roten Komponente als Schwarz angesehen werden soll" + +#original text: "Selects what green radiance level should be considered \"black\"." +msgid SANE_DESC_SHADOW_G +msgstr "Bestimmt, welcher Helligkeitswert der grünen Komponente als Schwarz angesehen werden soll" + +#original text: "Selects what blue radiance level should be considered \"black\"." +msgid SANE_DESC_SHADOW_B +msgstr "Bestimmt, welcher Helligkeitswert der blauen Komponente als Schwarz angesehen werden soll" + +#original text: "Selects what radiance level should be considered \"white\"." +msgid SANE_DESC_HIGHLIGHT +msgstr "Bestimmt, welcher Helligkeitswert als Weiß angesehen werden soll" + +#original text: "Selects what red radiance level should be considered \"full red\"." +msgid SANE_DESC_HIGHLIGHT_R +msgstr "Bestimmt, welcher Helligkeitswert der roten Komponente als Weiß angesehen werden soll" + +#original text: "Selects what green radiance level should be considered \"full green\"." +msgid SANE_DESC_HIGHLIGHT_G +msgstr "Bestimmt, welcher Helligkeitswert der grünen Komponente als Weiß angesehen werden soll" + +#original text: "Selects what blue radiance level should be considered \"full blue\"." +msgid SANE_DESC_HIGHLIGHT_B +msgstr "Bestimmt, welcher Helligkeitswert der blauen Komponente als Weiß angesehen werden soll" + +#original text: "Controls the \"hue\" (blue-level) of the acquired image." +msgid SANE_DESC_HUE +msgstr "" + +#original text: "The saturation level controls the amount of \"blooming\" that occurs when " "acquiring an image with a camera. Larger values cause more blooming." +msgid SANE_DESC_SATURATION +msgstr "" + +#original text: "The filename of the image to be loaded." +msgid SANE_DESC_FILE +msgstr "Der Dateiname des zu ladenden Bildes" + +#original text: "Sets the size of the halftoning (dithering) pattern used when scanning " "halftoned images." +msgid SANE_DESC_HALFTONE_DIMENSION +msgstr "" + +#original text: "Defines the halftoning (dithering) pattern for scanning halftoned images." +msgid SANE_DESC_HALFTONE_PATTERN +msgstr "" + +#original text: "Use same values for X and Y resolution" +msgid SANE_DESC_RESOLUTION_BIND +msgstr "Benutze die gleichen Auflösungen für X und Y" + +#original text: "Swap black and white" +msgid SANE_DESC_NEGATIVE +msgstr "Invertiere die Farben, z.B. tausche Schwarz gegen Weiß" + +#original text: "Do a quality white-calibration" +msgid SANE_DESC_QUALITY_CAL +msgstr "Führe einen Qualitätsweißabgleich durch" + +#original text: "Use lens that doubles optical resolution" +msgid SANE_DESC_DOR +msgstr "Benutze die Linse, mit der die optische Auflösung verdoppelt wird" + +#original text: "In RGB-mode use same values for each color" +msgid SANE_DESC_RGB_BIND +msgstr "Benutze die gleichen Wert für alle Farben im RGB Modus" + +#original text: "Select minimum-brightness to get a white point" +msgid SANE_DESC_THRESHOLD +msgstr "Wähle die minimale Helligkeit, die als Weiß betrachtet werden soll" + +#original text: "Analog gamma-correction" +msgid SANE_DESC_ANALOG_GAMMA +msgstr "analoge Gammakorrektur" + +#original text: "Analog gamma-correction for red" +msgid SANE_DESC_ANALOG_GAMMA_R +msgstr "analoge Gammakorrektur für Rot" + +#original text: "Analog gamma-correction for green" +msgid SANE_DESC_ANALOG_GAMMA_G +msgstr "analoge Gammakorrektur für Grün" + +#original text: "Analog gamma-correction for blue" +msgid SANE_DESC_ANALOG_GAMMA_B +msgstr "analoge Gammakorrektur für Blau" + +#original text: "In RGB-mode use same values for each color" +msgid SANE_DESC_ANALOG_GAMMA_BIND +msgstr "" + +#original text: "Don't care about image smearing problem" +msgid SANE_DESC_SMEAR +msgstr "Ignoriere das Problem des Verschmierens des Bildes" + +#original text: "Output with 10 bits instead of 8 bits" +msgid SANE_DESC_TEN_BIT_MODE +msgstr "" + +#original text: "Output with 12 bits instead of 8 bits" +msgid SANE_DESC_TWELVE_BIT_MODE +msgstr "" + +#original text: "Warmup lamp before scanning" +msgid SANE_DESC_WARMUP +msgstr "Wärme die Lampe vorm Scannen auf" + +#original text: "Set preview-bit in rgb-mode" +msgid SANE_DESC_RGB_PREVIEW_PATCH +msgstr "Setzt das Vorschaubit im Farbmodus" + +#original text: "Use special start-scan bits" +msgid SANE_DESC_START_SCAN_PATCH +msgstr "Benutze besondere Einstellungen beim Start des Scans" + +#original text: "Define exposure-time for calibration" +msgid SANE_DESC_CAL_EXPOS_TIME +msgstr "Bestimmt die Beleuchtungszeit für die Kalibrierung" + +#original text: "Define exposure-time for red calibration" +msgid SANE_DESC_CAL_EXPOS_TIME_R +msgstr "Bestimmt die Beleuchtungszeit für die Kalibrierung der roten Komponente" + +#original text: "Define exposure-time for green calibration" +msgid SANE_DESC_CAL_EXPOS_TIME_G +msgstr "Bestimmt die Beleuchtungszeit für die Kalibrierung der grünen Komponente" + +#original text: "Define exposure-time for blue calibration" +msgid SANE_DESC_CAL_EXPOS_TIME_B +msgstr "Bestimmt die Beleuchtungszeit für die Kalibrierung der blauen Komponente" + +#original text: "Define exposure-time for scan" +msgid SANE_DESC_SCAN_EXPOS_TIME +msgstr "Bestimmt die Beleuchtungszeit für den Scan" + +#original text: "Define exposure-time for red scan" +msgid SANE_DESC_SCAN_EXPOS_TIME_R +msgstr "Bestimmt die Beleuchtungszeit für den Scan der roten Komponente" + +#original text: "Define exposure-time for green scan" +msgid SANE_DESC_SCAN_EXPOS_TIME_G +msgstr "Bestimmt die Beleuchtungszeit für den Scan der grünen Komponente" + +#original text: "Define exposure-time for blue scan" +msgid SANE_DESC_SCAN_EXPOS_TIME_B +msgstr "Bestimmt die Beleuchtungszeit für den Scan der blauen Komponente" + +#original text: "Enable selection of exposure-time" +msgid SANE_DESC_SELECT_EXPOSURE_TIME +msgstr "Ermögliche Einstellung der Beleuchtungszeiten" + +#original text: "Define lamp density for calibration" +msgid SANE_DESC_CAL_LAMP_DEN +msgstr "Definiere die Lichtwerte beim Kalibrieren" + +#original text: "Define lamp density for scan" +msgid SANE_DESC_SCAN_LAMP_DEN +msgstr "Definiere die Lichtwerte beim Scannen" + +#original text: "Enable selection of lamp density" +msgid SANE_DESC_SELECT_LAMP_DENSITY +msgstr "Ermögliche Auswahl der Lichtwerte" + +msgid "Geometry" +msgstr "Geometrie" + +msgid "Enhancement" +msgstr "Farbverbesserung" + +msgid "Scan Mode" +msgstr "Scan Modus" + +msgid "Color" +msgstr "Farbe" + +msgid "Gray" +msgstr "Graustufen" + +msgid "Halftone" +msgstr "Halbton" + +msgid "Lineart" +msgstr "Strichzeichnung" + +msgid "Flatbed" +msgstr "Flachbett" + +msgid "Transparency" +msgstr "Durchlicht" + +msgid "Automatic Document Feeder" +msgstr "Autom. Dokumenteneinzug" + diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..413ed41 --- /dev/null +++ b/config.guess @@ -0,0 +1,883 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# The master version of this file is at the FSF in /home/gd/gnu/lib. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <dummy.s + .globl main + .ent main +main: + .frame \$30,0,\$26,0 + .prologue 0 + .long 0x47e03d80 # implver $0 + lda \$2,259 + .long 0x47e20c21 # amask $2,$1 + srl \$1,8,\$2 + sll \$2,2,\$2 + sll \$0,3,\$0 + addl \$1,\$0,\$0 + addl \$2,\$0,\$0 + ret \$31,(\$26),1 + .end main +EOF + ${CC-cc} dummy.s -o dummy 2>/dev/null + if test "$?" = 0 ; then + ./dummy + case "$?" in + 7) + UNAME_MACHINE="alpha" + ;; + 15) + UNAME_MACHINE="alphaev5" + ;; + 14) + UNAME_MACHINE="alphaev56" + ;; + 10) + UNAME_MACHINE="alphapca56" + ;; + 16) + UNAME_MACHINE="alphaev6" + ;; + esac + fi + rm -f dummy.s dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-cbm-sysv4 + exit 0;; + amiga:NetBSD:*:*) + echo m68k-cbm-netbsd${UNAME_RELEASE} + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + arm32:NetBSD:*:*) + echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + SR2?01:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:*|MIS*:OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:NetBSD:*:*) + echo m68k-atari-netbsd${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:NetBSD:*:*) + echo m68k-sun-netbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:NetBSD:*:*) + echo m68k-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >dummy.c + int main (argc, argv) int argc; char **argv; { + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + ${CC-cc} dummy.c -o dummy \ + && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ + -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:4) + if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[3478]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;; + 9000/8?? ) HP_ARCH=hppa1.0 ;; + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; + hp3[0-9][05]:NetBSD:*:*) + echo m68k-hp-netbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo i386-pc-cygwin32 + exit 0 ;; + i*:MINGW*:*) + echo i386-pc-mingw32 + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin32 + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. + ld_help_string=`ld --help 2>&1` + ld_supported_emulations=`echo $ld_help_string \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; + i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; + sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; + m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; + elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; + esac + + if test "${UNAME_MACHINE}" = "alpha" ; then + sed 's/^ //' <dummy.s + .globl main + .ent main + main: + .frame \$30,0,\$26,0 + .prologue 0 + .long 0x47e03d80 # implver $0 + lda \$2,259 + .long 0x47e20c21 # amask $2,$1 + srl \$1,8,\$2 + sll \$2,2,\$2 + sll \$0,3,\$0 + addl \$1,\$0,\$0 + addl \$2,\$0,\$0 + ret \$31,(\$26),1 + .end main +EOF + LIBC="" + ${CC-cc} dummy.s -o dummy 2>/dev/null + if test "$?" = 0 ; then + ./dummy + case "$?" in + 7) + UNAME_MACHINE="alpha" + ;; + 15) + UNAME_MACHINE="alphaev5" + ;; + 14) + UNAME_MACHINE="alphaev56" + ;; + 10) + UNAME_MACHINE="alphapca56" + ;; + 16) + UNAME_MACHINE="alphaev6" + ;; + esac + + objdump --private-headers dummy | \ + grep ld.so.1 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f dummy.s dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 + elif test "${UNAME_MACHINE}" = "mips" ; then + cat >dummy.c </dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + else + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" + test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + + case "${UNAME_MACHINE}" in + i?86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >dummy.c < +main(argc, argv) + int argc; + char *argv[]; +{ +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + fi ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + pc:*:*:*) + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:*:6*) + echo mips-sony-newsos6 + exit 0 ;; + R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 +rm -f dummy.c dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..55704e9 --- /dev/null +++ b/config.sub @@ -0,0 +1,958 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + linux-gnu*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ + | arme[lb] | pyramid | mn10200 | mn10300 \ + | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \ + | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ + | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ + | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ + | mipstx39 | mipstx39el \ + | sparc | sparclet | sparclite | sparc64 | v850) + basic_machine=$basic_machine-unknown + ;; + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i[3456]86) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ + | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \ + | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ + | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ + | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mipstx39-* | mipstx39el-* \ + | f301-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigaos | amigados) + basic_machine=m68k-cbm + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + os=-mvs + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[3456]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[3456]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[3456]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[3456]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + np1) + basic_machine=np1-gould + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5) + basic_machine=i586-intel + ;; + pentiumpro | p6) + basic_machine=i686-intel + ;; + pentium-* | p5-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + k5) + # We don't have specific support for AMD's K5 yet, so just call it a Pentium + basic_machine=i586-amd + ;; + nexen) + # We don't have specific support for Nexgen yet, so just call it a Pentium + basic_machine=i586-nexgen + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + # For sys5.3 apollo + -sys5.3) + os=-sysv3 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -xenix) + os=-xenix + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-ibm) + os=-aix + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f301-fujitsu) + os=-uxpv + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -hpux*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/configure b/configure new file mode 100755 index 0000000..f5834f8 --- /dev/null +++ b/configure @@ -0,0 +1,5569 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-intl-patch add -lintl to check for sane" +ac_help="$ac_help + --disable-gimp do not include GIMP plugin mode" +ac_help="$ac_help + --disable-jpeg do not include JPEG support" +ac_help="$ac_help + --disable-png do not include PNG support" +ac_help="$ac_help + --disable-tiff do not include TIFF support" +ac_help="$ac_help + --disable-nls do not use Native Language Support" +ac_help="$ac_help + --with-included-gettext use the GNU gettext library included here" +ac_help="$ac_help + --with-catgets use catgets functions if available" +ac_help="$ac_help + --with-x use the X Window System" +ac_help="$ac_help + --with-gtk-prefix=PFX Prefix where GTK is installed (optional)" +ac_help="$ac_help + --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)" +ac_help="$ac_help + --disable-gtktest Do not try to compile and run a test GTK program" +ac_help="$ac_help + +Used environment variables that can be set by user: + CFLAGS, CPPFLAGS, LDFLAGS, LIBS" +ac_help="$ac_help + +To add include or library paths call: + [env] CPPFLAGS=\"-I/path/to/foo/include\" LDFLAGS=\"-L/path/to/foo/libs\" ./configure" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=include/sane/config.h.in + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +# AC_PREREQ(2.10)dnl dnl Minimum Autoconf version required. +# AC_ARG_PROGRAM + +# version code: +V_MAJOR=0 +V_MINOR=50 + +PACKAGE=xsane + +BINPROGS="xsane" + +# languages +ALL_LINGUAS="de fr cs" + +SANE_V_MAJOR=1 +VERSION=${V_MAJOR}.${V_MINOR} +PACKAGE_VERSION="$PACKAGE-$VERSION" +cat >> confdefs.h <> confdefs.h <> confdefs.h <&6 +echo "configure:594: checking whether libintl patch is requested" >&5 +# Check whether --enable-intl-patch or --disable-intl-patch was given. +if test "${enable_intl_patch+set}" = set; then + enableval="$enable_intl_patch" + ADD_LIBINTL=$enableval +else + ADD_LIBINTL=no +fi + +echo "$ac_t""$ADD_LIBINTL" 1>&6 + +echo $ac_n "checking whether GIMP plugin is requested""... $ac_c" 1>&6 +echo "configure:606: checking whether GIMP plugin is requested" >&5 +# Check whether --enable-gimp or --disable-gimp was given. +if test "${enable_gimp+set}" = set; then + enableval="$enable_gimp" + USE_GIMP=$enableval +else + USE_GIMP=yes +fi + +echo "$ac_t""$USE_GIMP" 1>&6 + +echo $ac_n "checking whether JPEG support is requested""... $ac_c" 1>&6 +echo "configure:618: checking whether JPEG support is requested" >&5 +# Check whether --enable-jpeg or --disable-jpeg was given. +if test "${enable_jpeg+set}" = set; then + enableval="$enable_jpeg" + USE_JPEG=$enableval +else + USE_JPEG=yes +fi + +echo "$ac_t""$USE_JPEG" 1>&6 + +echo $ac_n "checking whether PNG support is requested""... $ac_c" 1>&6 +echo "configure:630: checking whether PNG support is requested" >&5 +# Check whether --enable-png or --disable-png was given. +if test "${enable_png+set}" = set; then + enableval="$enable_png" + USE_PNG=$enableval +else + USE_PNG=yes +fi + +echo "$ac_t""$USE_PNG" 1>&6 + +echo $ac_n "checking whether TIFF support is requested""... $ac_c" 1>&6 +echo "configure:642: checking whether TIFF support is requested" >&5 +# Check whether --enable-tiff or --disable-tiff was given. +if test "${enable_tiff+set}" = set; then + enableval="$enable_tiff" + USE_TIFF=$enableval +else + USE_TIFF=yes +fi + +echo "$ac_t""$USE_TIFF" 1>&6 + + +# 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:657: 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 + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # 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:687: 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 + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:738: 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 + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:770: 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. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 781 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { 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:812: 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:817: 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 + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:845: 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 + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:877: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # 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:898: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + 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:915: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:932: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for AIX""... $ac_c" 1>&6 +echo "configure:957: checking for AIX" >&5 +cat > conftest.$ac_ext <&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF +#define _ALL_SOURCE 1 +EOF + +else + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + + +ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 +echo "configure:982: checking for minix/config.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:992: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + MINIX=yes +else + echo "$ac_t""no" 1>&6 +MINIX= +fi + +if test "$MINIX" = yes; then + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + cat >> confdefs.h <<\EOF +#define _POSIX_1_SOURCE 2 +EOF + + cat >> confdefs.h <<\EOF +#define _MINIX 1 +EOF + +fi + +echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:1030: checking for POSIXized ISC" >&5 +if test -d /etc/conf/kconfig.d && + grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 +then + echo "$ac_t""yes" 1>&6 + ISC=yes # If later tests want to check for ISC. + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + if test "$GCC" = yes; then + CC="$CC -posix" + else + CC="$CC -Xp" + fi +else + echo "$ac_t""no" 1>&6 + ISC= +fi + + + + +echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 +echo "configure:1054: checking for ${CC-cc} option to accept ANSI C" >&5 +if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + am_cv_prog_cc_stdc=no +ac_save_CC="$CC" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__ +" +do + CC="$ac_save_CC $ac_arg" + cat > conftest.$ac_ext < +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, i +nt); +int argc; +char **argv; + +int main() { + +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + +; return 0; } +EOF +if { (eval echo configure:1107: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + am_cv_prog_cc_stdc="$ac_arg"; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done +CC="$ac_save_CC" + +fi + +if test -z "$am_cv_prog_cc_stdc"; then + echo "$ac_t""none needed" 1>&6 +else + echo "$ac_t""$am_cv_prog_cc_stdc" 1>&6 +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1161: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:1214: 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 + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1241: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # 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:1262: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + 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:1279: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1296: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 +echo "configure:1322: checking whether ${CC-cc} needs -traditional" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_pattern="Autoconf.*'x'" + cat > conftest.$ac_ext < +Autoconf TIOCGETP +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +else + rm -rf conftest* + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat > conftest.$ac_ext < +Autoconf TCGETA +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi + +echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + + +INCLUDES="${INCLUDES} -I/usr/local/include" +CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE" +if test "${ac_cv_prog_gcc}" = "yes"; then + CFLAGS="${CFLAGS} -Wall" +fi + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1375: 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 +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1388: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +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 +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +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 +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +for ac_hdr in fcntl.h unistd.h libc.h sys/dsreq.h sys/select.h \ + sys/time.h sys/scanio.h sys/socket.h sys/io.h asm/io.h gscdds.h sys/hw.h \ + bsd/dev/scsireg.h io/cam/cam.h camlib.h sys/types.h zlib.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1484: 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:1494: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:1522: 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 <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:1576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for inline""... $ac_c" 1>&6 +echo "configure:1597: 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 + rm -rf conftest* + ac_cv_c_inline=$ac_kw; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done + +fi + +echo "$ac_t""$ac_cv_c_inline" 1>&6 +case "$ac_cv_c_inline" in + inline | yes) ;; + no) cat >> confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >> confdefs.h <&6 +echo "configure:1637: checking return type of signal handlers" >&5 +if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { +int i; +; return 0; } +EOF +if { (eval echo configure:1659: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_signal=void +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_signal=int +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <&6 +echo "configure:1678: 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 +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + +echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:1711: checking for pid_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_pid_t=yes +else + rm -rf conftest* + ac_cv_type_pid_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_pid_t" 1>&6 +if test $ac_cv_type_pid_t = no; then + cat >> confdefs.h <<\EOF +#define pid_t int +EOF + +fi + +echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 +echo "configure:1744: checking for ssize_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_ssize_t=yes +else + rm -rf conftest* + ac_cv_type_ssize_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_ssize_t" 1>&6 +if test $ac_cv_type_ssize_t = no; then + cat >> confdefs.h <<\EOF +#define ssize_t long +EOF + +fi + +echo $ac_n "checking for u_char""... $ac_c" 1>&6 +echo "configure:1777: checking for u_char" >&5 +if eval "test \"`echo '$''{'ac_cv_type_u_char'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])u_char[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_u_char=yes +else + rm -rf conftest* + ac_cv_type_u_char=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_u_char" 1>&6 +if test $ac_cv_type_u_char = no; then + cat >> confdefs.h <<\EOF +#define u_char unsigned char +EOF + +fi + +echo $ac_n "checking for u_int""... $ac_c" 1>&6 +echo "configure:1810: checking for u_int" >&5 +if eval "test \"`echo '$''{'ac_cv_type_u_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])u_int[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_u_int=yes +else + rm -rf conftest* + ac_cv_type_u_int=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_u_int" 1>&6 +if test $ac_cv_type_u_int = no; then + cat >> confdefs.h <<\EOF +#define u_int unsigned int +EOF + +fi + +echo $ac_n "checking for u_long""... $ac_c" 1>&6 +echo "configure:1843: checking for u_long" >&5 +if eval "test \"`echo '$''{'ac_cv_type_u_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])u_long[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_u_long=yes +else + rm -rf conftest* + ac_cv_type_u_long=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_u_long" 1>&6 +if test $ac_cv_type_u_long = no; then + cat >> confdefs.h <<\EOF +#define u_long unsigned long +EOF + +fi + + +echo $ac_n "checking for scsireq_enter in -lscsi""... $ac_c" 1>&6 +echo "configure:1877: checking for scsireq_enter in -lscsi" >&5 +ac_lib_var=`echo scsi'_'scsireq_enter | 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="-lscsi $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + ac_tr_lib=HAVE_LIB`echo scsi | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + # FreeBSD needs this +echo $ac_n "checking for cam_open_device in -lcam""... $ac_c" 1>&6 +echo "configure:1924: checking for cam_open_device in -lcam" >&5 +ac_lib_var=`echo cam'_'cam_open_device | 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="-lcam $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + ac_tr_lib=HAVE_LIB`echo cam | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + # FreeBSD 3+ needs this + +echo $ac_n "checking for sqrt in -lm""... $ac_c" 1>&6 +echo "configure:1972: checking for sqrt in -lm" >&5 +ac_lib_var=`echo m'_'sqrt | 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="-lm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +echo $ac_n "checking for deflateInit_ in -lz""... $ac_c" 1>&6 +echo "configure:2019: checking for deflateInit_ in -lz" >&5 +ac_lib_var=`echo z'_'deflateInit_ | 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${ac_exeext}; 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 + ac_tr_lib=HAVE_LIB`echo z | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + +if test "${USE_JPEG}" = "yes"; then + echo $ac_n "checking for jpeg_start_decompress in -ljpeg""... $ac_c" 1>&6 +echo "configure:2068: checking for jpeg_start_decompress in -ljpeg" >&5 +ac_lib_var=`echo jpeg'_'jpeg_start_decompress | 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${ac_exeext}; 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 + ac_tr_lib=HAVE_LIB`echo jpeg | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +fi + +# tiff test must stand after test for zlib +if test "${USE_TIFF}" = "yes"; then + echo $ac_n "checking for TIFFOpen in -ltiff""... $ac_c" 1>&6 +echo "configure:2119: checking for TIFFOpen in -ltiff" >&5 +ac_lib_var=`echo tiff'_'TIFFOpen | 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="-ltiff $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + ac_tr_lib=HAVE_LIB`echo tiff | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +fi + +# 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:2170: 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:2182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_header_alloca_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_alloca_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 +if test $ac_cv_header_alloca_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA_H 1 +EOF + +fi + +echo $ac_n "checking for alloca""... $ac_c" 1>&6 +echo "configure:2203: 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 < +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +int main() { +char *p = (char *) alloca(1); +; return 0; } +EOF +if { (eval echo configure:2236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_alloca_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_alloca_works=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 +if test $ac_cv_func_alloca_works = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA 1 +EOF + +fi + +if test $ac_cv_func_alloca_works = no; then + # The SVR3 libPW and SVR4 libucb both contain incompatible functions + # that cause trouble. Some versions do not even contain alloca or + # contain a buggy version. If you still want to use their alloca, + # use ar to extract alloca.o from them instead of compiling alloca.c. + ALLOCA=alloca.${ac_objext} + cat >> confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + + +echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:2268: 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 <&5 | + egrep "webecray" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_os_cray=yes +else + rm -rf conftest* + ac_cv_os_cray=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_os_cray" 1>&6 +if test $ac_cv_os_cray = yes; then +for ac_func in _getb67 GETB67 getb67; do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2298: 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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <&6 +fi + +done +fi + +echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 +echo "configure:2353: 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 + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat > conftest.$ac_ext < addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +} +EOF +if { (eval echo configure:2380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_stack_direction=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_stack_direction=-1 +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 +cat >> confdefs.h <&6 +echo "configure:2407: 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:2417: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +for ac_func in getpagesize +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2446: 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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + +echo $ac_n "checking for working mmap""... $ac_c" 1>&6 +echo "configure:2499: 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 + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no +else + cat > conftest.$ac_ext < +#include +#include + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include +# endif + +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +#ifdef __cplusplus +extern "C" { void *malloc(unsigned); } +#else +char *malloc(); +#endif + +int +main() +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + data2 = malloc(2 * pagesize); + if (!data2) + exit(1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + /* + * Finally, make sure that changes to the mapped area + * do not percolate back to the file as seen by read(). + * (This is a bug on some variants of i386 svr4.0.) + */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = malloc(pagesize); + if (!data3) + exit(1); + if (read(fd, data3, pagesize) != pagesize) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit(1); + close(fd); + unlink("conftestmmap"); + exit(0); +} + +EOF +if { (eval echo configure:2647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_mmap_fixed_mapped=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_mmap_fixed_mapped=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 +if test $ac_cv_func_mmap_fixed_mapped = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MMAP 1 +EOF + +fi + +for ac_func in atexit mkdir sigprocmask strdup strndup strftime strstr strsep strtod snprintf usleep strcasecmp strncasecmp +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2672: 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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +for ac_hdr in dlfcn.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2729: 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:2739: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +echo "configure:2760: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-ldl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + for ac_func in dlopen +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2808: 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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + +else + echo "$ac_t""no" 1>&6 +fi +done + + +for ac_hdr in dl.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2870: 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:2880: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +echo "configure:2901: checking for shl_load in -ldld" >&5 +ac_lib_var=`echo dld'_'shl_load | 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="-ldld $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + ac_tr_lib=HAVE_LIB`echo dld | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + for ac_func in shl_load +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2949: 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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + +else + echo "$ac_t""no" 1>&6 +fi +done + + +# 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:3010: 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=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; 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 + +echo $ac_n "checking for off_t""... $ac_c" 1>&6 +echo "configure:3038: 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 +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_off_t=yes +else + rm -rf conftest* + ac_cv_type_off_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_off_t" 1>&6 +if test $ac_cv_type_off_t = no; then + cat >> confdefs.h <<\EOF +#define off_t long +EOF + +fi + + + for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h values.h sys/param.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3076: 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:3086: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3116: 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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + + if test "${ac_cv_func_stpcpy+set}" != "set"; then + for ac_func in stpcpy +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3173: 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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + fi + if test "${ac_cv_func_stpcpy}" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_STPCPY 1 +EOF + + fi + + if test $ac_cv_header_locale_h = yes; then + echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 +echo "configure:3235: checking for LC_MESSAGES" >&5 +if eval "test \"`echo '$''{'am_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:3247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + am_cv_val_LC_MESSAGES=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + am_cv_val_LC_MESSAGES=no +fi +rm -f conftest* +fi + +echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6 + if test $am_cv_val_LC_MESSAGES = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LC_MESSAGES 1 +EOF + + fi + fi + echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 +echo "configure:3268: 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" + USE_NLS=$enableval +else + USE_NLS=yes +fi + + echo "$ac_t""$USE_NLS" 1>&6 + + + USE_INCLUDED_LIBINTL=no + + if test "$USE_NLS" = "yes"; then + cat >> confdefs.h <<\EOF +#define ENABLE_NLS 1 +EOF + + echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 +echo "configure:3288: checking whether included gettext is requested" >&5 + # Check whether --with-included-gettext or --without-included-gettext was given. +if test "${with_included_gettext+set}" = set; then + withval="$with_included_gettext" + nls_cv_force_use_gnu_gettext=$withval +else + nls_cv_force_use_gnu_gettext=no +fi + + echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6 + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + nls_cv_header_intl= + nls_cv_header_libgt= + CATOBJEXT=NONE + + ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 +echo "configure:3307: checking for libintl.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:3317: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 +echo "configure:3334: checking for gettext in libc" >&5 +if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +return (int) gettext ("") +; return 0; } +EOF +if { (eval echo configure:3346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + gt_cv_func_gettext_libc=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gt_cv_func_gettext_libc=no +fi +rm -f conftest* +fi + +echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 + + if test "$gt_cv_func_gettext_libc" != "yes"; then + echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 +echo "configure:3362: checking for bindtextdomain in -lintl" >&5 +ac_lib_var=`echo intl'_'bindtextdomain | 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="-lintl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 +echo "configure:3397: checking for gettext in libintl" >&5 +if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+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${ac_exeext}; then + rm -rf conftest* + gt_cv_func_gettext_libintl=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gt_cv_func_gettext_libintl=no +fi +rm -f conftest* +fi + +echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + + if test "$gt_cv_func_gettext_libc" = "yes" \ + || test "$gt_cv_func_gettext_libintl" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_GETTEXT 1 +EOF + + # 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:3437: 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 + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + 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 + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test -n "$MSGFMT"; then + echo "$ac_t""$MSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + if test "$MSGFMT" != "no"; then + for ac_func in dcgettext +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3471: 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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + # 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:3526: 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 + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # 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:3562: 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 + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + 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 + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + CATOBJEXT=.gmo + DATADIRNAME=share +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CATOBJEXT=.mo + DATADIRNAME=lib +fi +rm -f conftest* + INSTOBJEXT=.mo + fi + fi + +else + echo "$ac_t""no" 1>&6 +fi + + + if test "$CATOBJEXT" = "NONE"; then + echo $ac_n "checking whether catgets can be used""... $ac_c" 1>&6 +echo "configure:3625: checking whether catgets can be used" >&5 + # Check whether --with-catgets or --without-catgets was given. +if test "${with_catgets+set}" = set; then + withval="$with_catgets" + nls_cv_use_catgets=$withval +else + nls_cv_use_catgets=no +fi + + echo "$ac_t""$nls_cv_use_catgets" 1>&6 + + if test "$nls_cv_use_catgets" = "yes"; then + echo $ac_n "checking for main in -li""... $ac_c" 1>&6 +echo "configure:3638: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-li $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + ac_tr_lib=HAVE_LIB`echo i | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + echo $ac_n "checking for catgets""... $ac_c" 1>&6 +echo "configure:3681: 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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char catgets(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_catgets) || defined (__stub___catgets) +choke me +#else +catgets(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_catgets=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_catgets=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'catgets`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_CATGETS 1 +EOF + + INTLOBJS="\$(CATOBJS)" + # 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:3731: 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 + case "$GENCAT" in + /*) + ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GENCAT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GENCAT" && ac_cv_path_GENCAT="no" + ;; +esac +fi +GENCAT="$ac_cv_path_GENCAT" +if test -n "$GENCAT"; then + echo "$ac_t""$GENCAT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + if test "$GENCAT" != "no"; then + # 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:3767: 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 + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$GMSGFMT" = "no"; then + # 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:3804: 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 + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + 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 + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + # 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:3839: 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 + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + 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 + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.cat + INSTOBJEXT=.cat + DATADIRNAME=lib + INTLDEPS='$(top_builddir)/intl/libintl.a' + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi +else + echo "$ac_t""no" 1>&6 +fi + + fi + fi + + if test "$CATOBJEXT" = "NONE"; then + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + INTLOBJS="\$(GETTOBJS)" + # 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:3897: 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 + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + 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 + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test -n "$MSGFMT"; then + echo "$ac_t""$MSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # 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:3931: 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 + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # 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:3967: 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 + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + 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 + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.gmo + INSTOBJEXT=.mo + DATADIRNAME=share + INTLDEPS='$(top_builddir)/intl/libintl.a' + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + echo "$ac_t""found xgettext programs is not GNU xgettext; ignore it" 1>&6 + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + else + DATADIRNAME=share + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + + # If this is used in GNU gettext we have to set USE_NLS to `yes' + # because some of the sources are only built for this goal. + if test "$PACKAGE" = gettext; then + USE_NLS=yes + USE_INCLUDED_LIBINTL=yes + fi + + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + + + + + + + + + + + + + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 +echo "configure:4057: checking for catalogs to be installed" >&5 + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + echo "$ac_t""$LINGUAS" 1>&6 + fi + + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + if test $ac_cv_header_locale_h = yes; then + INCLUDE_LOCALE_H="#include " + else + INCLUDE_LOCALE_H="\ +/* The system does not provide the header . Take care yourself. */" + fi + + + test -d intl || mkdir intl + 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:4085: 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:4095: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + msgformat=linux +else + echo "$ac_t""no" 1>&6 +msgformat=xopen +fi + + + sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed + fi + sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ + $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed + + if test "$PACKAGE" = "gettext"; then + GT_NO="#NO#" + GT_YES= + else + GT_NO= + GT_YES="#YES#" + fi + + + + MKINSTALLDIRS= + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + + l= + + + + +if test "$USE_NLS" = yes; then + if test "$USE_INCLUDED_LIBINTL" = yes; then + CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl" + INTLSUB=intl + fi +fi + + + +#### Choose a window system. + +# If we find X, set shell vars x_includes and x_libraries to the +# paths, otherwise set no_x=yes. +# 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:4160: checking for X" >&5 + +# Check whether --with-x or --without-x was given. +if test "${with_x+set}" = set; then + withval="$with_x" + : +fi + +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then + # Both variables are already set. + have_x=yes + else +if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=NO ac_x_libraries=NO +rm -fr conftestdir +if mkdir conftestdir; then + cd conftestdir + # Make sure to not put "make" in the Imakefile rules, since we grep it out. + cat > Imakefile <<'EOF' +acfindx: + @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +EOF + if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl; do + if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && + test -f $ac_im_libdir/libX11.$ac_extension; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case "$ac_im_incroot" in + /usr/include) ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; + esac + case "$ac_im_usrlibdir" in + /usr/lib | /lib) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; + esac + fi + cd .. + rm -fr conftestdir +fi + +if test "$ac_x_includes" = NO; then + # Guess where to find include files, by looking for this one X11 .h file. + test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h + + # 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:4227: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + # We can compile using X headers with no special include directory. +ac_x_includes= +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + # Look for the header file in a standard set of common directories. +# Check X11 before X11Rn because it is often a symlink to the current release. + for ac_dir in \ + /usr/X11/include \ + /usr/X11R6/include \ + /usr/X11R5/include \ + /usr/X11R4/include \ + \ + /usr/include/X11 \ + /usr/include/X11R6 \ + /usr/include/X11R5 \ + /usr/include/X11R4 \ + \ + /usr/local/X11/include \ + /usr/local/X11R6/include \ + /usr/local/X11R5/include \ + /usr/local/X11R4/include \ + \ + /usr/local/include/X11 \ + /usr/local/include/X11R6 \ + /usr/local/include/X11R5 \ + /usr/local/include/X11R4 \ + \ + /usr/X386/include \ + /usr/x386/include \ + /usr/XFree86/include/X11 \ + \ + /usr/include \ + /usr/local/include \ + /usr/unsupported/include \ + /usr/athena/include \ + /usr/local/x11r5/include \ + /usr/lpp/Xamples/include \ + \ + /usr/openwin/include \ + /usr/openwin/share/include \ + ; \ + do + if test -r "$ac_dir/$x_direct_test_include"; then + ac_x_includes=$ac_dir + break + fi + done +fi +rm -f conftest* +fi # $ac_x_includes = NO + +if test "$ac_x_libraries" = NO; then + # Check for the libraries. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS="$LIBS" + LIBS="-l$x_direct_test_library $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + LIBS="$ac_save_LIBS" +# We can link X programs with no special library path. +ac_x_libraries= +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + LIBS="$ac_save_LIBS" +# First see if replacing the include by lib works. +# Check X11 before X11Rn because it is often a symlink to the current release. +for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ + /usr/X11/lib \ + /usr/X11R6/lib \ + /usr/X11R5/lib \ + /usr/X11R4/lib \ + \ + /usr/lib/X11 \ + /usr/lib/X11R6 \ + /usr/lib/X11R5 \ + /usr/lib/X11R4 \ + \ + /usr/local/X11/lib \ + /usr/local/X11R6/lib \ + /usr/local/X11R5/lib \ + /usr/local/X11R4/lib \ + \ + /usr/local/lib/X11 \ + /usr/local/lib/X11R6 \ + /usr/local/lib/X11R5 \ + /usr/local/lib/X11R4 \ + \ + /usr/X386/lib \ + /usr/x386/lib \ + /usr/XFree86/lib/X11 \ + \ + /usr/lib \ + /usr/local/lib \ + /usr/unsupported/lib \ + /usr/athena/lib \ + /usr/local/x11r5/lib \ + /usr/lpp/Xamples/lib \ + /lib/usr/lib/X11 \ + \ + /usr/openwin/lib \ + /usr/openwin/share/lib \ + ; \ +do + for ac_extension in a so sl; do + if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f conftest* +fi # $ac_x_libraries = NO + +if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then + # Didn't find X anywhere. Cache the known absence of X. + ac_cv_have_x="have_x=no" +else + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" +fi +fi + fi + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + echo "$ac_t""$have_x" 1>&6 + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$x_includes ac_x_libraries=$x_libraries" + echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 +fi + +if test "$no_x" = yes; then + window_system=none +else + window_system=x11 +fi + +# Check whether --with-gtk-prefix or --without-gtk-prefix was given. +if test "${with_gtk_prefix+set}" = set; then + withval="$with_gtk_prefix" + gtk_config_prefix="$withval" +else + gtk_config_prefix="" +fi + +# Check whether --with-gtk-exec-prefix or --without-gtk-exec-prefix was given. +if test "${with_gtk_exec_prefix+set}" = set; then + withval="$with_gtk_exec_prefix" + gtk_config_exec_prefix="$withval" +else + gtk_config_exec_prefix="" +fi + +# Check whether --enable-gtktest or --disable-gtktest was given. +if test "${enable_gtktest+set}" = set; then + enableval="$enable_gtktest" + : +else + enable_gtktest=yes +fi + + + if test x$gtk_config_exec_prefix != x ; then + gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config + fi + fi + if test x$gtk_config_prefix != x ; then + gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_prefix/bin/gtk-config + fi + fi + + # Extract the first word of "gtk-config", so it can be a program name with args. +set dummy gtk-config; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4436: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GTK_CONFIG" in + /*) + ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GTK_CONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no" + ;; +esac +fi +GTK_CONFIG="$ac_cv_path_GTK_CONFIG" +if test -n "$GTK_CONFIG"; then + echo "$ac_t""$GTK_CONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + min_gtk_version=1.2.0 + echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 +echo "configure:4471: checking for GTK - version >= $min_gtk_version" >&5 + no_gtk="" + if test "$GTK_CONFIG" = "no" ; then + no_gtk=yes + else + GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` + GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` + gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_gtktest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + rm -f conf.gtktest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat > conftest.$ac_ext < +#include + +int +main () +{ + int major, minor, micro; + + system ("touch conf.gtktest"); + + if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + + if ((gtk_major_version != $gtk_config_major_version) || + (gtk_minor_version != $gtk_config_minor_version) || + (gtk_micro_version != $gtk_config_micro_version)) + { + printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", + $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf ("*** was found! If gtk-config was correct, then it is best\n"); + printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); + printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } + else + { + if ((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); + printf("*** correct copy of gtk-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} + +EOF +if { (eval echo configure:4557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + no_gtk=yes +fi +rm -fr conftest* +fi + + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gtk" = x ; then + echo "$ac_t""yes" 1>&6 + HAVE_GTK=yes + else + echo "$ac_t""no" 1>&6 + if test "$GTK_CONFIG" = "no" ; then + echo "*** The gtk-config script installed by GTK could not be found" + echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GTK_CONFIG environment variable to the" + echo "*** full path to gtk-config." + else + if test -f conf.gtktest ; then + : + else + echo "*** Could not run GTK test program, checking why..." + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + cat > conftest.$ac_ext < +#include + +int main() { + return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); +; return 0; } +EOF +if { (eval echo configure:4601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GTK or finding the wrong" + echo "*** version of GTK. If it is not finding GTK, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" + echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" + echo "*** came with the system with the command" + echo "***" + echo "*** rpm --erase --nodeps gtk gtk-devel" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GTK was incorrectly installed" + echo "*** or that you have moved GTK since it was installed. In the latter case, you" + echo "*** may want to edit the gtk-config script: $GTK_CONFIG" +fi +rm -f conftest* + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GTK_CFLAGS="" + GTK_LIBS="" + : + fi + + + rm -f conf.gtktest + + +# Change CFLAGS temporarily so that C_SWITCH_X_SITE gets used +# for the tests that follow. We set it back to REAL_CFLAGS later on. + +# According to Owen Taylor, GTK_CFLAGS is _guaranteed_ to contain +# -D and -I flags only, i.e., it really is GTK_CPPFLAGS... +saved_CPPFLAGS="${CPPFLAGS}" +saved_LIBS="${LIBS}" +CPPFLAGS="${CPPFLAGS} ${GTK_CFLAGS}" +LIBS="${LIBS} ${GTK_LIBS}" + +if test "${USE_GIMP}" = "yes"; then + for ac_hdr in libgimp/gimp.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:4655: 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:4665: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + for ac_hdr in libgimp/gimpfeatures.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:4695: 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:4705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +fi + +LIBS="${saved_LIBS}" +CPPFLAGS="${saved_CPPFLAGS}" + + +# png test must stand after test for zlib +# png test must stand behind X11-check because it is located in +# the X11 directory on some systems +# so we have to use x_includes and x_libraries to test for png +# and all following checks (=sane) +# saved_CPPFLAGS is still up to date +CPPFLAGS="${CPPFLAGS} -I${x_includes}" +if test "${USE_PNG}" = "yes"; then + for ac_hdr in png.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:4749: 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:4759: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +echo "configure:4780: checking for png_create_info_struct in -lpng" >&5 +ac_lib_var=`echo png'_'png_create_info_struct | 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 -L${x_libraries} $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + ac_tr_lib=HAVE_LIB`echo png | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +else + echo "$ac_t""no" 1>&6 +fi +done + + if test "${ac_cv_lib_png_png_create_info_struct}" = "yes"; then +# remove libpng because if we do not remove it all following +# checks could need x_libraries and x_includes + LIBS=`echo $LIBS | sed -e 's/-lpng//'` + PNG_LIB="-lpng" + fi +fi +CPPFLAGS="${saved_CPPFLAGS}" + +# check for sane must stand after check for dl +# check must stand at end of list because of the missing libintl in libsane.so +# check needs x_libraries and x_includes because they may be needed by png +if test "${ADD_LIBINTL}" = "no"; then + for ac_hdr in sane/sane.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:4848: 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:4858: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +echo "configure:4879: checking for sane_init in -lsane" >&5 +ac_lib_var=`echo sane'_'sane_init | 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="-lsane $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + ac_tr_lib=HAVE_LIB`echo sane | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +else + echo "$ac_t""no" 1>&6 +fi +done + +else + for ac_hdr in sane/sane.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:4935: 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:4945: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +echo "configure:4966: checking for sane_init in -lsane" >&5 +ac_lib_var=`echo sane'_'sane_init | 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="-lsane -lintl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + ac_tr_lib=HAVE_LIB`echo sane | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +else + echo "$ac_t""no" 1>&6 +fi +done + +fi + + +# this should be after all checks +# add libpng again +LIBS="${PNG_LIB} ${LIBS}" + + + + + + +CPPFLAGS="${CPPFLAGS} \ + -DPATH_SANE_DATA_DIR=\$(sanedatadir) \ + -DV_MAJOR=${V_MAJOR} -DV_MINOR=${V_MINOR} -DSANE_V_MAJOR=${SANE_V_MAJOR}" + +if test "${ac_cv_lib_sane_sane_init}" != "yes"; then + echo "****************************************************************" + echo "ERROR: SANE is needed for compiling xsane" + echo " - if you installed SANE as rpm make sure you also included" + echo " sane-devel" + echo " - if SANE is installed, try ./configure -enable-intl-patch" + echo "****************************************************************" + rm -f $cache_file + exit -1 +fi + +if test "${HAVE_GTK}" = "no"; then + echo "****************************************************************" + echo "ERROR: GTK-1.2.0 or newer is needed for compiling xsane" + echo " if you installed gtk as rpm make sure you also included" + echo " gtk-devel" + echo "****************************************************************" + rm -f $cache_file + exit -1 +fi + + + + + + +# Check whether --enable-foo1 or --disable-foo1 was given. +if test "${enable_foo1+set}" = set; then + enableval="$enable_foo1" + : +fi + + +# Check whether --enable-foo2 or --disable-foo2 was given. +if test "${enable_foo2+set}" = set; then + enableval="$enable_foo2" + : +fi + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile intl/Makefile po/Makefile lib/Makefile + frontend/Makefile include/Makefile doc/Makefile include/sane/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@PACKAGE_VERSION@%$PACKAGE_VERSION%g +s%@SANE_MAJOR@%$SANE_MAJOR%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@SET_MAKE@%$SET_MAKE%g +s%@ALLOCA@%$ALLOCA%g +s%@LTALLOCA@%$LTALLOCA%g +s%@RANLIB@%$RANLIB%g +s%@USE_NLS@%$USE_NLS%g +s%@MSGFMT@%$MSGFMT%g +s%@GMSGFMT@%$GMSGFMT%g +s%@XGETTEXT@%$XGETTEXT%g +s%@GENCAT@%$GENCAT%g +s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g +s%@CATALOGS@%$CATALOGS%g +s%@CATOBJEXT@%$CATOBJEXT%g +s%@DATADIRNAME@%$DATADIRNAME%g +s%@GMOFILES@%$GMOFILES%g +s%@INSTOBJEXT@%$INSTOBJEXT%g +s%@INTLDEPS@%$INTLDEPS%g +s%@INTLLIBS@%$INTLLIBS%g +s%@INTLOBJS@%$INTLOBJS%g +s%@POFILES@%$POFILES%g +s%@POSUB@%$POSUB%g +s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g +s%@GT_NO@%$GT_NO%g +s%@GT_YES@%$GT_YES%g +s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g +s%@l@%$l%g +s%@INTLSUB@%$INTLSUB%g +s%@GTK_CONFIG@%$GTK_CONFIG%g +s%@GTK_CFLAGS@%$GTK_CFLAGS%g +s%@GTK_LIBS@%$GTK_LIBS%g +s%@INCLUDES@%$INCLUDES%g +s%@BINPROGS@%$BINPROGS%g +s%@GIMP_LIBS@%$GIMP_LIBS%g +s%@V_MAJOR@%$V_MAJOR%g +s%@V_MINOR@%$V_MINOR%g +s%@DLL_PRELOAD@%$DLL_PRELOAD%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +srcdir=$ac_given_srcdir +while test -n "$ac_sources"; do + set $ac_dests; ac_dest=$1; shift; ac_dests=$* + set $ac_sources; ac_source=$1; shift; ac_sources=$* + + echo "linking $srcdir/$ac_source to $ac_dest" + + if test ! -r $srcdir/$ac_source; then + { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; } + fi + rm -f $ac_dest + + # Make relative symlinks. + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'` + if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then + # The dest file is in a subdirectory. + test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir" + ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dest_dir_suffix. + ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dest_dir_suffix= ac_dots= + fi + + case "$srcdir" in + [/$]*) ac_rel_source="$srcdir/$ac_source" ;; + *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; + esac + + # Make a symlink if possible; otherwise try a hard link. + if ln -s $ac_rel_source $ac_dest 2>/dev/null || + ln $srcdir/$ac_source $ac_dest; then : + else + { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; } + fi +done +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + +echo "****************************************************************" +echo "* *" +echo "* XSANE configure status: *" +echo "* ----------------------- *" + +if test "${USE_NLS}" = "yes"; then + if test "$USE_INCLUDED_LIBINTL" = yes; then + echo "* - NLS activated (package internal) *" + else + echo "* - NLS activated (external) *" + fi +else + echo "* - NLS deactivated *" +fi + +if test "${GIMP_LIBS}set" != "set"; then + echo "* - GIMP plugin activated *" +else + echo "* - GIMP plugin deactivated *" +fi + +if test "${ac_cv_lib_jpeg_jpeg_start_decompress}" = "yes"; then + echo "* - JPEG support activated *" +else + echo "* - JPEG support deactivated *" +fi + +if test "${ac_cv_lib_tiff_TIFFOpen}" = "yes"; then + echo "* - TIFF support activated *" +else + echo "* - TIFF support deactivated *" +fi + +if test "${ac_cv_lib_png_png_create_info_struct}" = "yes"; then + echo "* - PNG support activated *" +else + echo "* - PNG support deactivated *" +fi + +echo "* *" +echo "****************************************************************" +echo "* *" +echo "* To compile XSANE: *" +echo "* ----------------- *" +echo "* enter as normal user: *" +echo "* make *" +echo "* and as root: *" +echo "* make install *" +echo "* *" +echo "* ------------------------------------------------------------ *" +echo "* ... PLEASE READ SANE DOCUMENTATION BEFORE STARTING XSANE ... *" +echo "* ------------------------------------------------------------ *" +echo "****************************************************************" +cat xsane.NEWS diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..c06eb0a --- /dev/null +++ b/configure.in @@ -0,0 +1,301 @@ +dnl Process this file with autoconf to produce a configure script. -*-sh-*- +AC_INIT(include/sane/config.h.in) +AC_CONFIG_HEADER(include/sane/config.h) +# AC_PREREQ(2.10)dnl dnl Minimum Autoconf version required. +# AC_ARG_PROGRAM + +# version code: +V_MAJOR=0 +V_MINOR=50 + +PACKAGE=xsane + +BINPROGS="xsane" + +# languages +ALL_LINGUAS="de fr cs" + +SANE_V_MAJOR=1 +VERSION=${V_MAJOR}.${V_MINOR} +PACKAGE_VERSION="$PACKAGE-$VERSION" +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") +AC_DEFINE_UNQUOTED(VERSION, "$VERSION") +AC_DEFINE_UNQUOTED(PACKAGE_VERSION, "$PACKAGE_VERSION") +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) +AC_SUBST(PACKAGE_VERSION) +AC_SUBST(SANE_MAJOR) + +dnl Check args + +dnl Check for intl patch selection +AC_MSG_CHECKING([whether libintl patch is requested]) +dnl Default is disabled libintl patch +AC_ARG_ENABLE(intl-patch, [ --enable-intl-patch add -lintl to check for sane], ADD_LIBINTL=$enableval, ADD_LIBINTL=no) +AC_MSG_RESULT($ADD_LIBINTL) + +dnl Check for gimp plugin support +AC_MSG_CHECKING([whether GIMP plugin is requested]) +dnl Default is enabled GIMP plugin +AC_ARG_ENABLE(gimp, [ --disable-gimp do not include GIMP plugin mode], USE_GIMP=$enableval, USE_GIMP=yes) +AC_MSG_RESULT($USE_GIMP) + +dnl Check for jpeg support +AC_MSG_CHECKING([whether JPEG support is requested]) +dnl Default is enabled JPEG +AC_ARG_ENABLE(jpeg, [ --disable-jpeg do not include JPEG support], USE_JPEG=$enableval, USE_JPEG=yes) +AC_MSG_RESULT($USE_JPEG) + +dnl Check for png support +AC_MSG_CHECKING([whether PNG support is requested]) +dnl Default is enabled PNG +AC_ARG_ENABLE(png, [ --disable-png do not include PNG support], USE_PNG=$enableval, USE_PNG=yes) +AC_MSG_RESULT($USE_PNG) + +dnl Check for tiff support +AC_MSG_CHECKING([whether TIFF support is requested]) +dnl Default is enabled TIFF +AC_ARG_ENABLE(tiff, [ --disable-tiff do not include TIFF support], USE_TIFF=$enableval, USE_TIFF=yes) +AC_MSG_RESULT($USE_TIFF) + + +dnl Checks for programs. +AC_PROG_CC +AC_AIX +AC_MINIX +AC_ISC_POSIX +AM_PROG_CC_STDC +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_PROG_CPP +AC_PROG_GCC_TRADITIONAL + +INCLUDES="${INCLUDES} -I/usr/local/include" +CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE" +if test "${ac_cv_prog_gcc}" = "yes"; then + CFLAGS="${CFLAGS} -Wall" +fi + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(fcntl.h unistd.h libc.h sys/dsreq.h sys/select.h \ + sys/time.h sys/scanio.h sys/socket.h sys/io.h asm/io.h gscdds.h sys/hw.h \ + bsd/dev/scsireg.h io/cam/cam.h camlib.h sys/types.h zlib.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIGNAL +AC_TYPE_SIZE_T +AC_TYPE_PID_T +AC_CHECK_TYPE(ssize_t, long) +AC_CHECK_TYPE(u_char, unsigned char) +AC_CHECK_TYPE(u_int, unsigned int) +AC_CHECK_TYPE(u_long, unsigned long) + +dnl The following libs have to be included because they are forgotten in the sane libs +AC_CHECK_LIB(scsi, scsireq_enter) # FreeBSD needs this +AC_CHECK_LIB(cam, cam_open_device) # FreeBSD 3+ needs this +dnl AC_CHECK_LIB(intl,gettext) + +dnl Checks for libraries. +AC_CHECK_LIB(m, sqrt) +AC_CHECK_LIB(z, deflateInit_) + +if test "${USE_JPEG}" = "yes"; then + AC_CHECK_LIB(jpeg, jpeg_start_decompress) +fi + +# tiff test must stand after test for zlib +if test "${USE_TIFF}" = "yes"; then + AC_CHECK_LIB(tiff, TIFFOpen) +fi + +dnl Checks for library functions. +AM_FUNC_ALLOCA +AC_FUNC_MMAP +AC_CHECK_FUNCS(atexit mkdir sigprocmask strdup strndup strftime strstr strsep strtod snprintf usleep strcasecmp strncasecmp) + +dnl standard dll handling +AC_CHECK_HEADERS(dlfcn.h, [AC_CHECK_LIB(dl,dlopen) AC_CHECK_FUNCS(dlopen, enable_dynamic=yes,)],) + +dnl HP/UX DLL handling +AC_CHECK_HEADERS(dl.h, [AC_CHECK_LIB(dld,shl_load) AC_CHECK_FUNCS(shl_load, enable_dynamic=yes,)],) + +dnl Check for NLS/gettext +AM_GNU_GETTEXT +AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) + +if test "$USE_NLS" = yes; then + if test "$USE_INCLUDED_LIBINTL" = yes; then + CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl" + INTLSUB=intl + fi +fi + +AC_SUBST(INTLSUB) + +#### Choose a window system. + +AC_PATH_X +if test "$no_x" = yes; then + window_system=none +else + window_system=x11 +fi + +AM_PATH_GTK(1.2.0, HAVE_GTK=yes, ) + +# Change CFLAGS temporarily so that C_SWITCH_X_SITE gets used +# for the tests that follow. We set it back to REAL_CFLAGS later on. + +# According to Owen Taylor, GTK_CFLAGS is _guaranteed_ to contain +# -D and -I flags only, i.e., it really is GTK_CPPFLAGS... +saved_CPPFLAGS="${CPPFLAGS}" +saved_LIBS="${LIBS}" +CPPFLAGS="${CPPFLAGS} ${GTK_CFLAGS}" +LIBS="${LIBS} ${GTK_LIBS}" + +if test "${USE_GIMP}" = "yes"; then + AC_CHECK_HEADERS(libgimp/gimp.h, GIMP_LIBS="-lgimp") + AC_CHECK_HEADERS(libgimp/gimpfeatures.h) +fi + +LIBS="${saved_LIBS}" +CPPFLAGS="${saved_CPPFLAGS}" + + +# png test must stand after test for zlib +# png test must stand behind X11-check because it is located in +# the X11 directory on some systems +# so we have to use x_includes and x_libraries to test for png +# and all following checks (=sane) +# saved_CPPFLAGS is still up to date +CPPFLAGS="${CPPFLAGS} -I${x_includes}" +if test "${USE_PNG}" = "yes"; then + AC_CHECK_HEADERS(png.h, [AC_CHECK_LIB(png, png_create_info_struct,,, -L${x_libraries})]) + if test "${ac_cv_lib_png_png_create_info_struct}" = "yes"; then +# remove libpng because if we do not remove it all following +# checks could need x_libraries and x_includes + LIBS=`echo $LIBS | sed -e 's/-lpng//'` + PNG_LIB="-lpng" + fi +fi +CPPFLAGS="${saved_CPPFLAGS}" + +# check for sane must stand after check for dl +# check must stand at end of list because of the missing libintl in libsane.so +# check needs x_libraries and x_includes because they may be needed by png +dnl Check for sane lib +if test "${ADD_LIBINTL}" = "no"; then + AC_CHECK_HEADERS(sane/sane.h, AC_CHECK_LIB(sane,sane_init)) +else + AC_CHECK_HEADERS(sane/sane.h, AC_CHECK_LIB(sane,sane_init,,, -lintl)) +fi + + +# this should be after all checks +# add libpng again +LIBS="${PNG_LIB} ${LIBS}" + +AC_SUBST(INCLUDES) +AC_SUBST(BINPROGS) +AC_SUBST(GTK_CFLAGS) +AC_SUBST(GTK_LIBS) +AC_SUBST(GIMP_LIBS) +CPPFLAGS="${CPPFLAGS} \ + -DPATH_SANE_DATA_DIR=\$(sanedatadir) \ + -DV_MAJOR=${V_MAJOR} -DV_MINOR=${V_MINOR} -DSANE_V_MAJOR=${SANE_V_MAJOR}" + +dnl Print error message if sane or gtk is missing +if test "${ac_cv_lib_sane_sane_init}" != "yes"; then + echo "****************************************************************" + echo "ERROR: SANE is needed for compiling xsane" + echo " - if you installed SANE as rpm make sure you also included" + echo " sane-devel" + echo " - if SANE is installed, try ./configure -enable-intl-patch" + echo "****************************************************************" + rm -f $cache_file + exit -1 +fi + +if test "${HAVE_GTK}" = "no"; then + echo "****************************************************************" + echo "ERROR: GTK-1.2.0 or newer is needed for compiling xsane" + echo " if you installed gtk as rpm make sure you also included" + echo " gtk-devel" + echo "****************************************************************" + rm -f $cache_file + exit -1 +fi + + +AC_SUBST(V_MAJOR) +AC_SUBST(V_MINOR) +AC_SUBST(DLL_PRELOAD) + +AC_ARG_ENABLE(foo1, [ +Used environment variables that can be set by user: + CFLAGS, CPPFLAGS, LDFLAGS, LIBS]) + +AC_ARG_ENABLE(foo2, [ +To add include or library paths call: + [env] CPPFLAGS=\"-I/path/to/foo/include\" LDFLAGS=\"-L/path/to/foo/libs\" ./configure]) + +AC_OUTPUT([Makefile intl/Makefile po/Makefile lib/Makefile + frontend/Makefile include/Makefile doc/Makefile],) + +echo "****************************************************************" +echo "* *" +echo "* XSANE configure status: *" +echo "* ----------------------- *" + +if test "${USE_NLS}" = "yes"; then + if test "$USE_INCLUDED_LIBINTL" = yes; then + echo "* - NLS activated (package internal) *" + else + echo "* - NLS activated (external) *" + fi +else + echo "* - NLS deactivated *" +fi + +if test "${GIMP_LIBS}set" != "set"; then + echo "* - GIMP plugin activated *" +else + echo "* - GIMP plugin deactivated *" +fi + +if test "${ac_cv_lib_jpeg_jpeg_start_decompress}" = "yes"; then + echo "* - JPEG support activated *" +else + echo "* - JPEG support deactivated *" +fi + +if test "${ac_cv_lib_tiff_TIFFOpen}" = "yes"; then + echo "* - TIFF support activated *" +else + echo "* - TIFF support deactivated *" +fi + +if test "${ac_cv_lib_png_png_create_info_struct}" = "yes"; then + echo "* - PNG support activated *" +else + echo "* - PNG support deactivated *" +fi + +echo "* *" +echo "****************************************************************" +echo "* *" +echo "* To compile XSANE: *" +echo "* ----------------- *" +echo "* enter as normal user: *" +echo "* make *" +echo "* and as root: *" +echo "* make install *" +echo "* *" +echo "* ------------------------------------------------------------ *" +echo "* ... PLEASE READ SANE DOCUMENTATION BEFORE STARTING XSANE ... *" +echo "* ------------------------------------------------------------ *" +echo "****************************************************************" +cat xsane.NEWS diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000..0099667 --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,78 @@ +SHELL = /bin/sh + +VPATH = @srcdir@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = .. + +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 +configdir = ${sysconfdir}/sane.d +sanedatadir = ${datadir}/sane + +MKDIR = $(top_srcdir)/mkinstalldirs +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +@SET_MAKE@ + +SECT1 = xsane.1 +MANPAGES = $(SECT1) +LATEX = TEXINPUTS=$(srcdir):$$TEXINPUTS latex +DLH = TEXINPUTS=$(srcdir):$$TEXINPUTS dlh +MAN2HTML= nroff -man |\ + man2html -compress -title $${page} -cgiurl '$$title.$$section.html'|\ + sed 's,,

,' + +all: $(MANPAGES) + +%.1: %.man + sed -e 's|@DATADIR@|$(datadir)|g' \ + -e 's|@CONFIGDIR@|$(configdir)|g' \ + -e 's|@LIBDIR@|$(libdir)|g' \ + -e 's|@BINDIR@|$(bindir)|g' \ + -e 's|@SBINDIR@|$(sbindir)|g' $^ >$@ + +install: $(MANPAGES) + $(MKDIR) $(mandir)/man1 + @for page in $(SECT1); do \ + echo installing $${page} in $(mandir)/man1/$${page}...; \ + $(INSTALL_DATA) $${page} $(mandir)/man1/$${page} || exit 1; \ + done + $(MKDIR) $(datadir) + $(INSTALL_DATA) $(srcdir)/sane-*-doc.html $(sanedatadir)/ + $(INSTALL_DATA) $(srcdir)/*.jpg $(sanedatadir)/ + +docs: ps html + +html-man: $(MANPAGES) + @for page in $(MANPAGES); do \ + echo "translating $${page} to $${page}.html..."; \ + cat $${page} | $(MAN2HTML) > $${page}.html; \ + done + + +clean: + rm -f *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky *.blg *.idx *.cb + rm -f *.ilg + +distclean: clean + rm -f $(MANPAGES) + rm -f Makefile *~ + +depend: + +.PHONY: all install depend clean ps html htmlman sane-backends-html diff --git a/doc/autoenhance.jpg b/doc/autoenhance.jpg new file mode 100644 index 0000000..0be20e2 Binary files /dev/null and b/doc/autoenhance.jpg differ diff --git a/doc/brightness.jpg b/doc/brightness.jpg new file mode 100644 index 0000000..0a382d3 Binary files /dev/null and b/doc/brightness.jpg differ diff --git a/doc/contrast.jpg b/doc/contrast.jpg new file mode 100644 index 0000000..b8d0435 Binary files /dev/null and b/doc/contrast.jpg differ diff --git a/doc/default.jpg b/doc/default.jpg new file mode 100644 index 0000000..56602f8 Binary files /dev/null and b/doc/default.jpg differ diff --git a/doc/gamma.jpg b/doc/gamma.jpg new file mode 100644 index 0000000..bf24033 Binary files /dev/null and b/doc/gamma.jpg differ diff --git a/doc/negative.jpg b/doc/negative.jpg new file mode 100644 index 0000000..be4bec1 Binary files /dev/null and b/doc/negative.jpg differ diff --git a/doc/restore.jpg b/doc/restore.jpg new file mode 100644 index 0000000..754871b Binary files /dev/null and b/doc/restore.jpg differ diff --git a/doc/rgb-default.jpg b/doc/rgb-default.jpg new file mode 100644 index 0000000..b04a539 Binary files /dev/null and b/doc/rgb-default.jpg differ diff --git a/doc/sane-backends-doc.html b/doc/sane-backends-doc.html new file mode 100644 index 0000000..b36058d --- /dev/null +++ b/doc/sane-backends-doc.html @@ -0,0 +1,110 @@ + + + + + + + + SANE-Backends + + +  +
+
+ +
+

+Index of sane backends

+  +

  +
  +
  +
  +
  +
  +
 

+ +
+
+
+
  • +sane-abaton
  • + +
  • +sane-agfafocus
  • + +
  • +sane-apple
  • + +
  • +sane-artec
  • + +
  • +sane-canon
  • + +
  • +sane-coolscan
  • + +
  • +sane-dc210
  • + +
  • +sane-dc25
  • + +
  • +sane-dll
  • + +
  • +sane-dmc
  • + +
  • +sane-epson
  • + +
  • +sane-hp
  • + +
  • +sane-microtek
  • + +
  • +sane-microtek2
  • + +
  • +sane-mustek
  • + +
  • +sane-net
  • + +
  • +sane-pint
  • + +
  • +sane-pnm
  • + +
  • +sane-qcam
  • + +
  • +sane-s9036
  • + +
  • +sane-st400 +(backend not included into sane)
  • + +
  • +sane-sharp
  • + +
  • +sane-snapscan
  • + +
  • +sane-tamarack
  • + +
  • +sane-umax
  • +
    +
    +
    + + + diff --git a/doc/sane-logo.jpg b/doc/sane-logo.jpg new file mode 100644 index 0000000..218babf Binary files /dev/null and b/doc/sane-logo.jpg differ diff --git a/doc/sane-logo2.jpg b/doc/sane-logo2.jpg new file mode 100644 index 0000000..e0f604f Binary files /dev/null and b/doc/sane-logo2.jpg differ diff --git a/doc/sane-pnm-doc.html b/doc/sane-pnm-doc.html new file mode 100644 index 0000000..9a02d4d --- /dev/null +++ b/doc/sane-pnm-doc.html @@ -0,0 +1,39 @@ + + + + + + + SANE - XSane frontend + + + +
    +
    +

    +

    + +
    +

    +PNM BACKEND

    + +
    +

    + +

    +
    + +
    +
    The PNM backend is a backend for testing SANE frontends. +It is not planned to give the user any useful functions!
    + +
     
    + +
    + +
    +
    +
    + + + diff --git a/doc/sane-pnm16-doc.html b/doc/sane-pnm16-doc.html new file mode 100644 index 0000000..e6bc487 --- /dev/null +++ b/doc/sane-pnm16-doc.html @@ -0,0 +1,42 @@ + + + + + + + SANE - XSane frontend + + + +
    +
    +

    +

    + +
    +

    +PNM16 BACKEND

    + +
    +

    + +

    +
    + +
    +
    The PNM16 backend is a backend for testing SANE frontends. +It is not planned to give the user any useful functions!
    + +
    It reads a pnm image and converts it into a 8-16 +bits/sample image.
    + +
     
    + +
    + +
    +
    +
    + + + diff --git a/doc/sane-problems-doc.html b/doc/sane-problems-doc.html new file mode 100644 index 0000000..085118b --- /dev/null +++ b/doc/sane-problems-doc.html @@ -0,0 +1,116 @@ + + + + + + + + SANE-Backends + + +  +
    +
    + +
      +
      +
      +

    +SANE Problems

    +
    + +
      +
      +
    If you have any problems +with SANE or XSane please read this before you write any mails.
    + +
    +
    +
  • +The SANE frontend (like xsane or xscanimage) does +not start or aborts with a segmentation fault.
  • + +


    Edit /usr/local/etc/sane.d/dll.conf (or /usr/etc/sane.d/dll.conf) +and comment out all but the backend you need. To do this add a "#" at the +beginning of the relevant lines. +

    If that does not help try to find out where the +error occurs: +
            gdb +xscanimage +
            r +<enter> +
    after the frontend returned: +
            backtrace +<enter> +
      +

  • +The scanner starts the scan but it stops while +scanning
  • + +
  • +The scsi bus or the whole system freezes
  • + +
  • +The image is corrupted
  • + +


    In general there are three different reasons +that can cause such erros: +

    +
  • +In most cases it is a problem with your scsi bus. +Please check the following points:
  • + +
    +
  • +The scsi bus has to be a chain (one line) that is +terminated on both ends. If possible the scanner should be on one end of +the chain because the connectors on most scsi scanners are not specified +for the scsi-2 standard.
  • + +
  • +If you do not use any ultra-scsi-devices and your +scsi controller is a fast scsi controller you can use passive terminators. +If one or more devices are ultra-scsi-devices you have to use active terminators.
  • + +
  • +If the scsi controller is at an end of the scsi chain +the termination of the controller has to be enabled. Otherwise it has to +be disabled. If you use a fast scsi controller and you have one or more +ultra-scsi-devices connected, you must not use the built in termination +of the scsi controller (because it is a passive terminator), you have to +use an active terminator instead.
  • + +
  • +The length of the scsi chain is limitted. If you +use no ultra-scsi-devices the whole length of the chain must not exceed +3 meters. If there are one or more ultra-scsi-devices in the scsi chain +the length of the chain must not exceed 1.5 meters.  If there are +only 3 devices (2 devices + controller) the length of the chain may be +up to 3 meters, but if you have any problems you should try to reduce the +length.
  • +
    + +
  • +The driver for your scsi controller does not work +like expected. Update your scsi driver if you do not have the most recent +version.
  • + +
    If that does not help try it with an other type +of scsi card. +
      +
  • +May be your scanner/firmware does not work correct +with the backend you use. Update the backend version or contact the author +of the backend.
  • +
    + +
      +
  • +Please read the documentation of the backend you use
  • +
    +If you tested everything above and you still need +help: contact the backend/frontend author or to the sane +mailling list (you must be subscribed to the list).
    + + + diff --git a/doc/sane-scantips-doc.html b/doc/sane-scantips-doc.html new file mode 100644 index 0000000..9a4e45d --- /dev/null +++ b/doc/sane-scantips-doc.html @@ -0,0 +1,48 @@ + + + + + + + + SANE-Backends + + +  +
    +
    + +
    +

    +Scantips - links to the web

    +  +

      +
      +
      +
      +
      +
      +
     

    + +

    +If you are looking for some tips about scanning, desktoppublishing etc, +take a look at these links:

    + +
    +
    +
  • +http://www.scantips.com/
  • + +
  • +http://www.infomedia.net/scan/
  • + +
  • +http://www.hsdesign.com/scanning/
  • + +
  • +http://desktoppublishing.com/
  • +
    +
    + + + diff --git a/doc/sane-xsane-advanced-doc.html b/doc/sane-xsane-advanced-doc.html new file mode 100644 index 0000000..b294836 --- /dev/null +++ b/doc/sane-xsane-advanced-doc.html @@ -0,0 +1,35 @@ + + + + + + + + XSane - Advanced options + + +  +
    +
    + +
      +
    +

    +Advanced options window

    +  +

      +
      +
      +
      +
      +
      +
     

    + +
    + +
    +
    INDEX
    + +


    + + diff --git a/doc/sane-xsane-advanced.jpg b/doc/sane-xsane-advanced.jpg new file mode 100644 index 0000000..309aa72 Binary files /dev/null and b/doc/sane-xsane-advanced.jpg differ diff --git a/doc/sane-xsane-copy-doc.html b/doc/sane-xsane-copy-doc.html new file mode 100644 index 0000000..e0f0b07 --- /dev/null +++ b/doc/sane-xsane-copy-doc.html @@ -0,0 +1,40 @@ + + + + + + + + XSane - Copy mode + + +  +

    +
    + +
      +

    +Copy mode

    +
    + +
     In Copy mode, the scanned image is converted to postscript. +The postscript file is piped as standard input to the command listed after +the printer symbol. +
      +
      +
      +
     
    + +
    + +
      +
    The options of the printer and the printer command can be set in the +menu +Preferences/Setup
    + +
    +
    INDEX
    + +


    + + diff --git a/doc/sane-xsane-copy.jpg b/doc/sane-xsane-copy.jpg new file mode 100644 index 0000000..13c1cd9 Binary files /dev/null and b/doc/sane-xsane-copy.jpg differ diff --git a/doc/sane-xsane-doc.html b/doc/sane-xsane-doc.html new file mode 100644 index 0000000..9956e12 --- /dev/null +++ b/doc/sane-xsane-doc.html @@ -0,0 +1,232 @@ + + + + + + + + XSane - Documentation index + + +  +

    +
    + +
    +

    +
    +

    + +

    +

    + +

    +

    + +

    +
    +Index of xsane documentation

    + +
      +
      +
      +
     
    +
    + +
    +
  • +Xsane modes:
  • + +
    +
    +
  • +Scan mode
  • + +
  • +Copy mode
  • + +
  • +Fax mode
  • + +
  • +Gimp plugin
  • +
    +
    + +
  • +Scanner option windows:
  • + +
    +
    +
  • +Standard options +window
  • + +
  • +Advanced options +window
  • +
    +
    + +
  • +Preview
  • + +
    +
    +
  • +Pipette +white
  • + +
  • +Pipette +gray
  • + +
  • +Pipette +black
  • + +
  • +Unzoom
  • + +
  • +Zoom +out
  • + +
  • +Zoom +in
  • + +
  • +Undo +zoom
  • + +
  • +Select +visible area
  • + +
  • +Select +scanarea
  • + +
  • +Move +scanarea
  • + +
     
    +
    + +
  • +Enhancement +functions:
  • + +
    +
    +
  • +Gamma +correction
  • + +
  • +Brightness
  • + +
  • +Contrast
  • + +
  • +RGB +default
  • + +
  • +Negative
  • + +
  • +Autoenhancement
  • + +
  • +Enhancement +default
  • + +
  • +Restore +enhancement
  • + +
  • +Store +enhancement
  • + +
      +
  • +Pipette +white
  • + +
  • +Pipette +gray
  • + +
  • +Pipette +black
  • + +
      +
  • +Histogram +window
  • + +
  • +Highlight/White point
  • + +
  • +Shadow/Black point
  • + +
  • +Gamma/Gray point
  • +
    +
    + +
  • +Setup:
  • + +
    +
    +
  • +Copy setup
  • + +
  • +Display +setup
  • + +
  • +Saving setup
  • + +
  • +Fax setup
  • +
    +
    + +
  • +Supported functions:
  • + +
    +
    +
  • +Support for 9-16 bits/sample
  • + +
  • +Output formats
  • + +
  • +Automatic filename generation
  • + +
  • +Automatic Document Feeder
  • +
    +
    +
    + +
    +
    Author: Oliver +Rauch +

    Homepage +of xsane

    + + + diff --git a/doc/sane-xsane-enhancement-doc.html b/doc/sane-xsane-enhancement-doc.html new file mode 100644 index 0000000..32c1d05 --- /dev/null +++ b/doc/sane-xsane-enhancement-doc.html @@ -0,0 +1,101 @@ + + + + + + + + XSane - Enhancement + + +  +
    +
    + +
      +
    +

    +Enhancement

    +XSane uses a gamma table to do the following enhancement functions. If +the scanner supports a custom gamma table (and the option is enabled) XSane +uses the scanner internal gamma table with the scanner's maximum bit depth.
    + +
    + +
      +
    + Gamma correction:
    + +
    The gamma correction is a non linear correction. Black keeps +black and white keeps white +
    if the gamma value is greater than 1.0 the gray intensities +are brightned +
    if the gamma value is smaller than 1.0 the gray intensities are darkend
    +
    + +
    + Brightness:
    + +
    positive values increase the brightness of the image. All values +are increased by the same value. 100% means a shift of the half value range +(on 8 bits (256 values) this means a shift of 128).
    + +
    + Contrast:
    + +
    positive values increase the contrast of the image. Medium +gray keeps medium gray (8 bits: 128) +
    -100% means that all colors become medium gray +
    +100% means that the difference between a value and medium gray is +doubled
    +
    + +
    + RGB default:
    + +
    if RGB default is activated, all values for the color components +(red, green and blue) are set to the default values (gamma=1.0, brightness=0%, +contrast=0%). If you deactivate it, you can set different enhancement values +for each color.
    + +
    + Negative:
    + +
    This option inverts the intensities (black <-> white). +It is for scanning negatives. +

    Negatives do not only have inverted colors, it also is necessary +to do a color correction for each color component because the negatives +have very different color ranges for each color.

    + +
    + Autoenhancement:
    + +
    If you press this button XSane tries to set good values +for brightness, contrast and gamma correction independance of the selected +part in the preview window. This does work quiet well for brightness and +contrast, but the gamma correction normally has to be corrected manually. +
    If RGB default is disabled, the components for each color are set +individually.
    + + Enhancement default: +
    Sets the enhancement values to default: gamma=1.0, brightness=0%, +contrast=0%.
    + +
    + Restore enhancement:
    + +
    Restores the enhancement values from preferences.
    + +
    + Store enhancement (Memory):
    + +
    tore selected enhancement values to preferences.
    +
    + +
    +
    +
    INDEX
    + +


    + + diff --git a/doc/sane-xsane-fax-doc.html b/doc/sane-xsane-fax-doc.html new file mode 100644 index 0000000..5eaf593 --- /dev/null +++ b/doc/sane-xsane-fax-doc.html @@ -0,0 +1,39 @@ + + + + + + + + XSane - Fax mode + + + +

    +

    +

    + +
    +

    +Fax mode

    +This mode is a Frontend for SANE and for a faxprogram like hylafax or mgetty+sendfax +
      +
      +
      +
      +
     
    + +
       
    + +


    +

    You need to have a faxprogram like hylafax(1) or mgetty+sendfax(8) +installed. The faxcommand and the options must be specified in the menu +Preferences/Setup.
    + +
    +
    INDEX
    + +


    + + diff --git a/doc/sane-xsane-fax-project.jpg b/doc/sane-xsane-fax-project.jpg new file mode 100644 index 0000000..03048b8 Binary files /dev/null and b/doc/sane-xsane-fax-project.jpg differ diff --git a/doc/sane-xsane-fax.jpg b/doc/sane-xsane-fax.jpg new file mode 100644 index 0000000..60d1065 Binary files /dev/null and b/doc/sane-xsane-fax.jpg differ diff --git a/doc/sane-xsane-gimp-doc.html b/doc/sane-xsane-gimp-doc.html new file mode 100644 index 0000000..7c4a49e --- /dev/null +++ b/doc/sane-xsane-gimp-doc.html @@ -0,0 +1,60 @@ + + + + + + + + XSane - Gimp plugin + + +  +

    +
    + +
    +

    +Xsane as Gimp plugin

    +If xsane is started as Gimp plugin, the scanned image +automatically is transfered to the Gimp. +
      +
      +
      +
     
    + +
    + +
      +

    To start xsane as a gimp plugin, you have to set a symbolic link from +the xsane binary to a GIMP plug-ins directory. If xsane is located in /usr/local/bin  +and you use-gimp-1.0.x do: +

    +
    ln -s /usr/local/bin/xsane ~/.gimp/plug-ins/
    +
    +if you use gimp-1.1.x, you have to do: +
    +
    ln -s /usr/local/bin/xsane ~/.gimp-1.1/plug-ins/
    +
    +You can start xsane from the GIMP menu Xtns/Xsane if GIMP-version +< 1.1.9, since GIMP-version-1.1.9 you can start xsane from the GIMP +menu File/Acquire. It contains short-cuts to the SANE devices that +were available at the time xsane was queried.
    + +
    Note that gimp(1) caches these short-cuts in ~/.gimp/pluginrc. +Thus, when the list of  available devices changes (e.g., a new scanner +is installed or the device of the scanner has changed),  then it is +typically desirable to rebuild this cache. To do this, you can either  +touch(1) the xsane binary (e.g.,"touch  /usr/local/bin/xsane") or +delete the plugin cache (e.g.,  "rm  ~/.gimp/pluginrc"). Either +way, invoking gimp(1) afterwards will cause the pluginrc to be rebuilt. +

    If xsane is started as GIMP plugin it always sends the scanned image +to the GIMP, copy- or fax- mode can not selected when xsane runs as GIMP +plugin!

    + +
    +


    +


    INDEX
    + +


    + + diff --git a/doc/sane-xsane-gimp.jpg b/doc/sane-xsane-gimp.jpg new file mode 100644 index 0000000..f183d42 Binary files /dev/null and b/doc/sane-xsane-gimp.jpg differ diff --git a/doc/sane-xsane-histogram-doc.html b/doc/sane-xsane-histogram-doc.html new file mode 100644 index 0000000..736bde9 --- /dev/null +++ b/doc/sane-xsane-histogram-doc.html @@ -0,0 +1,55 @@ + + + + + + + + XSane - Histogram + + +  +

    +
    + +
    +

    +Histogram window

    +  +

      +
      +
      +
      +
      +
      +
      +
     

    + +
    + +


    +

    +
    The histogram shows the color density of the area that is selected +in the preview window. The top histogram represents the scanned raw image, +the bottom histogram represents the enhanced image. In grayscale mode, +there are three sliders in the gray range. The black slider defines the +black point, the white silder the white point and the gray slider the gray +point (gamma). If the rgb default button (in the xsane main window) +is not selected in color mode there are also sliders in the red, the green +and the blue range. In this case a move of a slider of the gray range also +moves the sliders of the color ranges. +

    The I, R, G and B buttons define if the +intensity, red, green and/or blue histogram +components are shown. +

    The curve-type button defines if the histogram curves are shown with +pixels or with lines. +

    The LOG button defines if the densities are displayed linear +or logarithmical.

    +
    + +
    +
    INDEX
    + +


    + + diff --git a/doc/sane-xsane-histogram.jpg b/doc/sane-xsane-histogram.jpg new file mode 100644 index 0000000..a13a912 Binary files /dev/null and b/doc/sane-xsane-histogram.jpg differ diff --git a/doc/sane-xsane-main-doc.html b/doc/sane-xsane-main-doc.html new file mode 100644 index 0000000..b3f0a42 --- /dev/null +++ b/doc/sane-xsane-main-doc.html @@ -0,0 +1,40 @@ + + + + + + + SANE - XSane frontend + + + +

     
    + +
    +
    +
    + +
    +
    + a scanner-frontend for ->SANE.
    + +
    +
    + 
    + +
    +
    + +
     
    + +
    +

    +The main window

    +  +
    + +
     
    +
    + + + diff --git a/doc/sane-xsane-pipette-black.jpg b/doc/sane-xsane-pipette-black.jpg new file mode 100644 index 0000000..8508f14 Binary files /dev/null and b/doc/sane-xsane-pipette-black.jpg differ diff --git a/doc/sane-xsane-pipette-gray.jpg b/doc/sane-xsane-pipette-gray.jpg new file mode 100644 index 0000000..72211f3 Binary files /dev/null and b/doc/sane-xsane-pipette-gray.jpg differ diff --git a/doc/sane-xsane-pipette-white.jpg b/doc/sane-xsane-pipette-white.jpg new file mode 100644 index 0000000..b8b8b0f Binary files /dev/null and b/doc/sane-xsane-pipette-white.jpg differ diff --git a/doc/sane-xsane-preview-doc.html b/doc/sane-xsane-preview-doc.html new file mode 100644 index 0000000..996d21d --- /dev/null +++ b/doc/sane-xsane-preview-doc.html @@ -0,0 +1,173 @@ + + + + + + + + XSane - Preview + + + +
    +

    +

    +  +

     

    + +
    +

    +Preview window

    +The preview window is to select an area that you want to scan. You can +resize the preview window and zoom into the scan area. +
      +
      +
      +
     
    + +
    + +


    +

      +
    With the smaller, black dashed frame in the preview you select the +area that shall be scanned. The larger, red dashed frame is only available +in COPY-mode, it shows the size of the page of the selected printer relative +to the zoom scale.
    + +
    Pipette +white: +
    Use mouse pointer and click a point that shall be white. If +you use the left mouse button only the intensity is used to calculate the +white point. If RGB default (main window) is not activated you can +use the middle mouse button to define the white point for each color component. +You can abort the selection by pressing the right mouse button.
    + +
    + Pipette +gray:
    + +
    +
    +Use mouse pointer and click a point that shall be medium gray. If you use +the left mouse button only the intensity is used to calculate the white +point. If RGB default (main window) is not activated you can use +the middle mouse button to define the white point for each color component. +You can abort the selection by pressing the right mouse button.
    +
    + +
    + Pipette +black:
    + +
    +
    +Use mouse pointer and click a point that shall be black. If you use the +left mouse button only the intensity is used to calculate the white point. +If RGB default (main window) is not activated you can use the middle +mouse button to define the white point for each color component. You can +abort the selection by pressing the right mouse button.
    +
    + +
    + Unzoom:
    + +
    +
    +Use full scan area.
    +
    + +
    + Zoom +out:
    + +
    +
    +Increase preview area by 20%.
    +
    + +
    + Zoom +in:
    + +
    +
    +Zoom into selected area.
    +
    + +
    + Undo +zoom:
    + +
    +
    +Undo last zoom.
    +
    + +
    + Select +visible area:
    + +
    +
    +Select the visible area in the preview window for scanning.
    +
    + +
    +Acquire Preview:
    + +
    +
    +Start preview scan. If you resized the preview window, the new preview +is done with updated resolution.
    +
    + +
    +Cancel Preview:
    + +
    +
    +Cancel a preview scan.
    + +
    +
    +
    + +
    +Left mouse button:
    + +
    +
    +Select scan area: Press (&hold) left mouse button to define +one edge, move the mouse so that the area you want to scan is in the frame +and release the button.
    +
    + +
    +Edit scan area: Move the pointer over an edge of the existing selection, +the mouse pointer changes. Now press (&hold)  the left mouse button, +you can move the draged edge of the scanarea, then release the left mouse +button.
    +
    + +
    +Right and middle mouse button:
    + +
    +
    +If you press (&hold) the right or the middle mouse button in the selection +frame you can move the selection frame without resizing it.
    +
    +
    + +
    +
    +
     
    +
    +
    + +
    +
    INDEX
    + +


    + + diff --git a/doc/sane-xsane-preview.jpg b/doc/sane-xsane-preview.jpg new file mode 100644 index 0000000..892e8d8 Binary files /dev/null and b/doc/sane-xsane-preview.jpg differ diff --git a/doc/sane-xsane-scan-doc.html b/doc/sane-xsane-scan-doc.html new file mode 100644 index 0000000..6995bf9 --- /dev/null +++ b/doc/sane-xsane-scan-doc.html @@ -0,0 +1,92 @@ + + + + + + + + XSane - Scan mode + + +  +

    +
    + +
      +
    +

    +Scan mode (stand alone)

    +The scan mode is to scan an image and save it to a file. +
      +
      +
     
    + +
    + +
     
    + +

    +Supported output formats:

    + +
    You can select the output format by the filename extension +(menu = "by ext") or by selecting the file format in the menu. Possible +are: pnm, png, ps, jpeg, raw and tiff.
    + +
    Pnm and ps (and raw) are always available. The +other formats are only available if necessary libraries are present (at +compilation time AND while xsane is executed). For png you need +libpng and libz, for jpeg you need jpeglib, for tiff you +need libtiff.
    + +
    The raw format is a 16 bit format comparable to 16 bit +binary pnm format that is not defined, for pnm the 16 bit +format only is defined as ascii mode which generates huge and slow files.
    + +
    The supported output formats depend on the bit depth of +the scanned image: +

    +1 bit/pixel black/white mode:

    + +
    pnm = pbm, png +
    ps, jpeg and tiff are converted to 8 bit grayscale +mode.
    + +

    +8 bits/pixel grayscale mode:

    + +
    pnm = pgm, png, ps, jpeg and tiff
    + +

    +16 bits/pixel grayscale mode (9-16 bits):

    + +
    pnm (ascii), png and raw
    + +

    +24 bits/pixel RGB-color mode (8 bits/color):

    + +
    pnm = ppm, png, ps, jpeg and tiff
    + +

    +48 bits/pixel RGB-color mode (9-16 bits/color):

    + +
    pnm (ascii), png and raw
    + +

    +32 bits/pixel RGBA-color mode (8 bits/color):

    + +
    rgba (raw) and png with alpha channel
    + +

    +64 bits/pixel RGBA-color mode (9-16 bits/color):

    + +
    rgba (raw) and png with alpha channel
    +
    + +
    +
    +
    INDEX
    + +


    +
    + + diff --git a/doc/sane-xsane-setup-copy-doc.html b/doc/sane-xsane-setup-copy-doc.html new file mode 100644 index 0000000..bbd36b6 --- /dev/null +++ b/doc/sane-xsane-setup-copy-doc.html @@ -0,0 +1,96 @@ + + + + + + + + XSane - Setup + + +  +

    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +

    +Copy setup

    +  +

      +
      +
      +
      +
      +
      +
      +
     

    + +
    + +
    +

    +NAME:

    +
    + +
    +
    Define the name for the following printer definition.
    + +

    +COMMAND:

    + +
    Enter the command with which you print files. The command has +to read the file from the standard input. If you use the bsd printing system, +this is "lpr -", if you use the old printing system, this should be "lp +-".
    +
    + +
    +

    +COPY NUMBER OPTION:

    +
    + +
    +
    Enter the option of the printer command with wich the number +of copies are specified. This option is the last option passed to the printerrcommand +so if you specify a ";#" the option is ignored.
    + +

    +RESOLUTION:

    + +
    With resolution you specify the resolution that shall +be used for printing. It is not always necessary to set this value to the +resolution of the printer. Especally in grayscale and color mode it normally +is good to set this value to the half or the quarter of the printer resolution +because the printer needs a greater resolution to do the dithering. This +value does not effect a change of the image size, the image size only depends +on the given zoom factor.
    + +

    +PRINT AREA (WIDTH, HEIGHT, LEFT OFFSET, BOTTOM OFFSET):

    + +
    Each printer has it's own area size and position where it is +able to print.
    + +

    +PRINTER GAMMA VALUES:

    + +
    Addidtional gamma value for printing. The Printer gamma +value is used for grayscale and as common value for color mode. The +red, green and blue values are for color correction.
    +
    + +
    +
    INDEX
    + +


    + + diff --git a/doc/sane-xsane-setup-copy.jpg b/doc/sane-xsane-setup-copy.jpg new file mode 100644 index 0000000..abe3d35 Binary files /dev/null and b/doc/sane-xsane-setup-copy.jpg differ diff --git a/doc/sane-xsane-setup-display-doc.html b/doc/sane-xsane-setup-display-doc.html new file mode 100644 index 0000000..948e4d1 --- /dev/null +++ b/doc/sane-xsane-setup-display-doc.html @@ -0,0 +1,99 @@ + + + + + + + + XSane - Setup + + +  +

    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +

    +Display setup

    +
    + +
      +
      +
      +
      +
      +
      +
     
    + +

    +

    + +
    +


    + +


    +

    +

    +MAIN WINDOW SIZE FIXED:

    +
    + +
    +
    Select if the main window size shall be fixed (the window size +is defined by xsane) or it shall be a resizable with scrollbars if necessary. +The change of this option will take effect at the next start of xsane. +The option can be overwritten by the command line options --Fixed/-F or +--Resizeable/-R.
    +
    + +
    +

    +PRESERVE PREVIEW IMAGE:

    +
    + +
    +
    Preserve the preview image for the next program start. The +last preview image is displayed on the next program start, you don`t need +to redo the preview scan.
    + +

    +USE PRIVATE COLORMAP:

    + +
    If enabled and if the X server runs in 8 bit mode (256 colors) +then the preview uses an own color map.
    + +

    +PREVIEW GAMMA:

    + +
    Set the gamma correction value for the preview image. This +is to get correct colors on your monitor.
    + +

    +HELPFILE VIEWER:

    + +
    Enter a program to show the helpfiles. It must be a html-viewer. +If you enter the keywrod "netscape-remote", xsane uses a already running +netscape to show the onlinehelp. If you run kde, you may want to enter +"kdehelp" here.
    +
    + +
    +
    INDEX
    + +


    + + diff --git a/doc/sane-xsane-setup-display.jpg b/doc/sane-xsane-setup-display.jpg new file mode 100644 index 0000000..e7d9d92 Binary files /dev/null and b/doc/sane-xsane-setup-display.jpg differ diff --git a/doc/sane-xsane-setup-fax-doc.html b/doc/sane-xsane-setup-fax-doc.html new file mode 100644 index 0000000..a5d3953 --- /dev/null +++ b/doc/sane-xsane-setup-fax-doc.html @@ -0,0 +1,104 @@ + + + + + + + + XSane - Setup + + +  +

    +
    + +
    +

    +Fax setup

    +  +

      +
      +
      +
      +
      +
      +
      +
      +
     

    + +
    + +


    +

    +

    +COMMAND:

    + +
    Enter command to send/spool faxfiles. +
    +hylafax: "sendfax"
    + +
    +mgetty+sendfax: "faxspool"
    +
    + +

    +RECEIVER OPTION:

    + +
    Option to set receiver phone number or address. +
    +hylafax: "-d"
    + +
    +mgetty+sendfax: leave free
    +
    + +

    +POSTSCRIPTFILE OPTION:

    + +
    If there is an option that must be set before the filenames +of the faxfile or if it is necessary to specify an option for files in +postscript format, enter this option - otherwise let this field free. +
    +hylafax: leave free
    + +
    +mgetty+sendfax: leave free
    +
    + +

    +NORMAL MODE OPTION:

    + +
    If there is an option to set normal mode (98lpi) then enter +this option - otherwise let this field free. +
    +hylafax: "-l"
    + +
    +mgetty+sendfax: "-n"
    +
    + +

    +FINE MODE OPTION:

    + +
    If there is an option to set fine mode (196lpi) then enter +this option - otherwise let this field free. +
    +hylafax: "-m"
    + +
    +mgetty+sendfax: leave free
    +
    + +

    +VIEWER:

    + +
    Enter a program to show the postscript fax files on the screen. +
    E.g. this can be "ghostscript" or "xv".
    +
    + +
    +
    INDEX
    + +


    + + diff --git a/doc/sane-xsane-setup-fax.jpg b/doc/sane-xsane-setup-fax.jpg new file mode 100644 index 0000000..f2e66de Binary files /dev/null and b/doc/sane-xsane-setup-fax.jpg differ diff --git a/doc/sane-xsane-setup-save-doc.html b/doc/sane-xsane-setup-save-doc.html new file mode 100644 index 0000000..5e8cb2d --- /dev/null +++ b/doc/sane-xsane-setup-save-doc.html @@ -0,0 +1,92 @@ + + + + + + + + XSane - Setup + + +  +

    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +

    +Saving setup

    +  +

      +
      +
      +
     

    + +
     
    + +

    +

    + +
    +


    + +


    +

    +

    +OVERWRITE WARNING:

    +
    + +
    +
    If enabled, a warning comes up before an existing file is overwritten.
    + +

    +INCREASE FILENAME COUNTER:

    + +
    If enabled, the number in the filename of the following form +is automatically increased after a scan is completed: +
    image-001.ext
    +The number of digits is free and will not be changed, in case of an overflow, +a warning is printed and the counter becomes 0.
    + +
    If an automatic document feeder is used the filename should +contain a counter and this option should be enabled.
    + +

    +SKIP EXISTING NUMBERS:

    + +
    If increase filename counter is enabled, filenames that +already exist are skipped!
    + +

    +JPEG IMAGE QUALITY:

    + +
    If the image is saved in jpeg format this value defines +the quality of the image. Low values mean low quality and low file size, +high values mean high quality and high file size.
    + +

    +PNG IMAGE COMPRESSION:

    + +
    If the image is saved in png format this value defines +the compression level. The quality of the image keeps the same, low values +mean low compression, large files and low compression time. High values +mean high compression, smaller files and high compression time.
    +
    + +
    +
    INDEX
    + +


    + + diff --git a/doc/sane-xsane-setup-save.jpg b/doc/sane-xsane-setup-save.jpg new file mode 100644 index 0000000..07b6a22 Binary files /dev/null and b/doc/sane-xsane-setup-save.jpg differ diff --git a/doc/sane-xsane-standard-doc.html b/doc/sane-xsane-standard-doc.html new file mode 100644 index 0000000..3a09d7e --- /dev/null +++ b/doc/sane-xsane-standard-doc.html @@ -0,0 +1,33 @@ + + + + + + + + XSane - Standard options + + +  +

    +
    + +
    +

    +Standard options window

    +  +

      +
      +
      +
      +
      +
     

    + +
    +
    +
    +
    INDEX
    + +


    + + diff --git a/doc/sane-xsane-standard.jpg b/doc/sane-xsane-standard.jpg new file mode 100644 index 0000000..13be214 Binary files /dev/null and b/doc/sane-xsane-standard.jpg differ diff --git a/doc/sane-xsane-visible-area.jpg b/doc/sane-xsane-visible-area.jpg new file mode 100644 index 0000000..117a5ba Binary files /dev/null and b/doc/sane-xsane-visible-area.jpg differ diff --git a/doc/sane-xsane-zoom-in.jpg b/doc/sane-xsane-zoom-in.jpg new file mode 100644 index 0000000..dc73335 Binary files /dev/null and b/doc/sane-xsane-zoom-in.jpg differ diff --git a/doc/sane-xsane-zoom-not.jpg b/doc/sane-xsane-zoom-not.jpg new file mode 100644 index 0000000..b239646 Binary files /dev/null and b/doc/sane-xsane-zoom-not.jpg differ diff --git a/doc/sane-xsane-zoom-out.jpg b/doc/sane-xsane-zoom-out.jpg new file mode 100644 index 0000000..9e20fc1 Binary files /dev/null and b/doc/sane-xsane-zoom-out.jpg differ diff --git a/doc/sane-xsane-zoom-undo.jpg b/doc/sane-xsane-zoom-undo.jpg new file mode 100644 index 0000000..11e0890 Binary files /dev/null and b/doc/sane-xsane-zoom-undo.jpg differ diff --git a/doc/sane-xsane.jpg b/doc/sane-xsane.jpg new file mode 100644 index 0000000..31c37af Binary files /dev/null and b/doc/sane-xsane.jpg differ diff --git a/doc/store.jpg b/doc/store.jpg new file mode 100644 index 0000000..e1223df Binary files /dev/null and b/doc/store.jpg differ diff --git a/doc/xsane-logo.jpg b/doc/xsane-logo.jpg new file mode 100644 index 0000000..596f3da Binary files /dev/null and b/doc/xsane-logo.jpg differ diff --git a/doc/xsane-logo2.jpg b/doc/xsane-logo2.jpg new file mode 100644 index 0000000..133c3c7 Binary files /dev/null and b/doc/xsane-logo2.jpg differ diff --git a/doc/xsane.man b/doc/xsane.man new file mode 100644 index 0000000..8e69216 --- /dev/null +++ b/doc/xsane.man @@ -0,0 +1,199 @@ +.TH xsane 1 "02 Aug 1999" +.IX xsane +.SH NAME +xsane - scanner frontend for SANE +.SH SYNOPSIS +.B xsane +.RB [ --version | -v ] +.RB [ --device-settings +.IR file +.RB | -d +.IR file ] +.RB [ --scan | -s ] +.RB [ --copy | -c ] +.RB [ --fax | -f ] +.RB [ --no-mode-selection | -n ] +.RB [ --Fixed | -F ] +.RB [ --Scrolled | -S ] +.RB [ --display +.IR d ] +.RB [ --no-xshm ] +.RB [ --sync ] +.RB [ --debug-level +.IR n ] +.RI [ devicename ] +.SH DESCRIPTION +.B xsane +provides a graphical user-interface to control an image +acquisition device such as a flatbed scanner. It allows +previewing and scanning invidual images and can be invoked either +directly from the command-line or through The GIMP image manipulation +program. In the former case, +.B xsane +acts as a stand-alone program that saves acquired images in a suitable +PNM format (PBM for black-and-white images, PGM for grayscale images, +and PPM for color images) or converts the image to JPEG, PNG, PS or TIFF. +In the latter case, the images are directly passed to The GIMP for further +processing. + +.B xsane +accesses image acquisition devices through the SANE (Scanner Access +Now Easy) interface. The list of available devices depends on +installed hardware and configuration. When invoked without an +explicit devicename argument, +.B xsane +presents a dialog listing all known and available devices. To access +an available device that is not known to the system, the devicename +must be specified explicitly. +.SH RUNNING UNDER THE GIMP +To run +.B xsane +under the +.BR gimp (1), +simply set a symbolic link from the xsane-binary to one of the +.BR gimp (1) +plug-ins directories. For example, the command +.PP +.RS +ln -s @BINDIR@/xsane ~/.gimp/plug-ins/ +.RE +.PP +adds a symlink for the +.B xsane +binary to the user's plug-ins directory. After creating this symlink, +.B xsane +will be queried by +.BR gimp (1) +the next time it's invoked. From then on, +.B xsane +can be invoked through "Xtns->XSane->Device dialog..." menu entry. + +You'll also find that the "Xtns->XSane" menu contains short-cuts +to the SANE devices that were available at the time the +.B xsane +was queried. +Note that +.BR gimp (1) +caches these short-cuts in ~/.gimp/pluginrc. Thus, when the list of +available devices changes (e.g., a new scanner is installed or the +device of the scanner has changed), then it is typically desirable +to rebuild this cache. To do this, you can either +.BR touch (1) +the +.B xsane +binary (e.g., "touch @BINDIR@/xsane") or delete the plugin cache +(e.g., "rm ~/.gimp/pluginrc"). Either way, invoking +.BR gimp (1) +afterwards will cause the pluginrc to be rebuilt. +.SH OPTIONS +.PP +If the +.B --version +or +.B -v +flag is given xsane prints a version information and exits. +.PP +The +.B --scan +or +.B -s +flag forces xsane to start in scan mode. +.PP +The +.B --fax +or +.B -f +flag forces xsane to start in fax mode. +.PP +The +.B --copy +or +.B -c +flag forces xsane to start in fax mode. +.PP +The +.B --no-mode-selection +or +.B -n +flag disables the menu for xsane mode selection (scan, copy, fax). +.PP +The +.B --device-settings +or +.B -d +flag reads the next option as default filename +for device settings. The extension ".drc" must not +be included. +.PP +If the +.B --Fixed +or +.B -F +flag is given then xsane uses a fixed, non resizable main window. +The flag overwrites the preferences value. +.PP +If the +.B --Scrolled +or +.B -S +flag is given then xsane uses a scrolled, resizable main window. +The flag overwrites the preferences value. +.PP +The +.B --display +flag selects the X11 display used to present the graphical user-interface +(see +.BR X (1) +for details). +.PP +The +.B --no-xshm +flag requests not to use shared memory images. Shared memory images +usually enhance performance but cause problems with some buggy X11 +servers. Unless your X11 server dies when running this program, there +is no need or advantage to specify this flag. +.PP +The +.B --sync +flag requests a synchronous connection with the X11 server. This is for +debugging purposes only. +.SH FILES +.TP +.I $HOME/.sane/xsane/xsane.rc +This files holds the user preferences. Normally, this file should not +be manipulated directly. Instead, the user should customize the +program through the "Preferences" menu. +.TP +.I $HOME/.sane/xsane/devicename.rc +For each device, there is one rc-file that holds the saved settings +for that particular device. Normally, this file should not be +manipulated directly. Instead, the user should use the +.B xsane +interface to select appropriate values and then save the device +settings using the "Preferences->Save Device Settings" menubar entry. +.TP +.I $HOME/.sane/preview-devicename.ppm +After acquiring a preview, +.B xsane +normally saves the preview image in this device-specific file. Thus, +next time the program is started up, the program can present the old +preview image. This feature can be turned off through the +"Preferences->Preview Options..." dialog. +.TP +.I @DATADIR@/sane-style.rc +This system-wide file controls the aspects of the user-interface such +as colors and fonts. It is a GTK style file and provides fine control +over the visual aspects of the user-interface. +.TP +.I $HOME/.sane/sane-style.rc +This file serves the same purpose as the system-wide style file. If +present, it takes precedence over the system wide style file. +.SH "SEE ALSO" +gimp(1), xscanimage(1), scanimage(1), +sane\-dll(5), sane\-net(5), sane-scsi(5), +sane\-abaton(5), sane\-agfafocus(5), sane\-apple(5), sane\-dc25(5), +sane\-dmc(5), sane\-epson(5), sane\-hp(5), sane\-microtek(5), +sane\-microtek2(5), sane\-mustek(5), sane\-pint(5), sane\-pnm(5), +sane\-qcam(5), sane\-umax(5) +.SH AUTHOR +Oliver Rauch (Oliver.Rauch@Wolfsburg.DE) diff --git a/frontend/Makefile.in b/frontend/Makefile.in new file mode 100644 index 0000000..439369d --- /dev/null +++ b/frontend/Makefile.in @@ -0,0 +1,85 @@ +SHELL = /bin/sh + +VPATH = @srcdir@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = .. + +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 +configdir = ${sysconfdir}/sane.d +sanedatadir = ${datadir}/sane + +MKINSTALLDIRS = @MKINSTALLDIRS@ +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +CC = @CC@ +INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include \ + @GTK_CFLAGS@ @INCLUDES@ \ + -DLOCALEDIR=\""$(datadir)/locale"\" +DEFS = @DEFS@ +CPPFLAGS = @CPPFLAGS@ +CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @INTLLIBS@ @LIBS@ +GTK_LIBS = @GTK_LIBS@ +GIMP_LIBS = @GIMP_LIBS@ + +COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +LINK = $(CC) $(LDFLAGS) -o $@ + +BINPROGS = @BINPROGS@ + +@SET_MAKE@ + +PROGRAMS = $(BINPROGS) +LIBLIB = ../lib/liblib.a + +XSANE_OBJS = xsane-back-gtk.o xsane-front-gtk.o xsane-gamma.o xsane-preview.o \ + xsane-rc-io.o xsane-device-preferences.o xsane-preferences.o \ + xsane-setup.o xsane-save.o xsane-scan.o xsane-icons.o xsane.o + + +.c.o: + $(COMPILE) $< + +all: $(PROGRAMS) + +install: $(PROGRAMS) + $(MKINSTALLDIRS) $(bindir) $(sbindir) $(datadir) $(sanedatadir) $(sanedatadir)/xsane + @for program in $(BINPROGS); do \ + $(INSTALL_PROGRAM) $${program} $(bindir)/$${program}; \ + done + $(INSTALL_DATA) $(srcdir)/xsane-style.rc $(sanedatadir)/xsane/xsane-style.rc + $(INSTALL_DATA) $(srcdir)/xsane-logo.xpm $(sanedatadir)/xsane-logo.xpm + +xsane: $(XSANE_OBJS) $(LIBLIB) + $(LINK) $(XSANE_OBJS) \ + $(LIBLIB) $(GIMP_LIBS) $(GTK_LIBS) $(LIBS) + + +clean: + rm -f *.o *~ .*~ *.bak + rm -rf .libs + +distclean: clean + rm -f Makefile $(PROGRAMS) + +depend: + makedepend $(INCLUDES) *.c + +.PHONY: all install depend clean distclean diff --git a/frontend/cursor/cursor_pipette_black b/frontend/cursor/cursor_pipette_black new file mode 100644 index 0000000..9fc4d56 --- /dev/null +++ b/frontend/cursor/cursor_pipette_black @@ -0,0 +1,8 @@ +#define cursor_pipette_black_width 16 +#define cursor_pipette_black_height 16 +#define cursor_pipette_black_x_hot 1 +#define cursor_pipette_black_y_hot 14 +static unsigned char cursor_pipette_black_bits[] = { + 0x00, 0x70, 0x00, 0xf8, 0x80, 0xff, 0x00, 0xfe, 0x00, 0x7d, 0x80, 0x38, + 0x40, 0x18, 0xe0, 0x17, 0xf0, 0x13, 0xf8, 0x01, 0xfc, 0x00, 0x7c, 0x00, + 0x3e, 0x00, 0x0f, 0x00, 0x04, 0x00, 0x00, 0x00}; diff --git a/frontend/cursor/cursor_pipette_gray b/frontend/cursor/cursor_pipette_gray new file mode 100644 index 0000000..7cbea80 --- /dev/null +++ b/frontend/cursor/cursor_pipette_gray @@ -0,0 +1,8 @@ +#define cursor_pipette_gray_width 16 +#define cursor_pipette_gray_height 16 +#define cursor_pipette_gray_x_hot 1 +#define cursor_pipette_gray_y_hot 14 +static unsigned char cursor_pipette_gray_bits[] = { + 0x00, 0x70, 0x00, 0xf8, 0x80, 0xff, 0x00, 0xfe, 0x00, 0x7d, 0x80, 0x38, + 0x40, 0x18, 0x20, 0x14, 0x10, 0x12, 0xf8, 0x01, 0xfc, 0x00, 0x7c, 0x00, + 0x3e, 0x00, 0x0f, 0x00, 0x04, 0x00, 0x00, 0x00}; diff --git a/frontend/cursor/cursor_pipette_mask b/frontend/cursor/cursor_pipette_mask new file mode 100644 index 0000000..36c7757 --- /dev/null +++ b/frontend/cursor/cursor_pipette_mask @@ -0,0 +1,8 @@ +#define cursor_pipette_mask_width 16 +#define cursor_pipette_mask_height 16 +#define cursor_pipette_mask_x_hot 1 +#define cursor_pipette_mask_y_hot 14 +static unsigned char cursor_pipette_mask_bits[] = { + 0x00, 0x70, 0x00, 0xf8, 0x80, 0xff, 0x00, 0xfe, 0x00, 0x7f, 0x80, 0x3f, + 0xc0, 0x1f, 0xe0, 0x17, 0xf0, 0x13, 0xf8, 0x01, 0xfc, 0x00, 0x7c, 0x00, + 0x3e, 0x00, 0x0f, 0x00, 0x04, 0x00, 0x00, 0x00}; diff --git a/frontend/cursor/cursor_pipette_white b/frontend/cursor/cursor_pipette_white new file mode 100644 index 0000000..9952441 --- /dev/null +++ b/frontend/cursor/cursor_pipette_white @@ -0,0 +1,8 @@ +#define cursor_pipette_white_width 16 +#define cursor_pipette_white_height 16 +#define cursor_pipette_white_x_hot 1 +#define cursor_pipette_white_y_hot 14 +static unsigned char cursor_pipette_white_bits[] = { + 0x00, 0x70, 0x00, 0xf8, 0x80, 0xff, 0x00, 0xfe, 0x00, 0x7d, 0x80, 0x38, + 0x40, 0x18, 0x20, 0x14, 0x10, 0x12, 0x08, 0x01, 0x84, 0x00, 0x44, 0x00, + 0x32, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00}; diff --git a/frontend/xsane-back-gtk.c b/frontend/xsane-back-gtk.c new file mode 100644 index 0000000..8bde762 --- /dev/null +++ b/frontend/xsane-back-gtk.c @@ -0,0 +1,1426 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-back-gtk.c + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ----------------------------------------------------------------------------------------------------------------- */ + +#include "xsane.h" +#include "xsane-back-gtk.h" +#include "xsane-preferences.h" +#include "xsane-text.h" + +/* ----------------------------------------------------------------------------------------------------------------- */ + +/* extern declarations */ +extern void xsane_panel_build(GSGDialog *dialog); + +/* ----------------------------------------------------------------------------------------------------------------- */ + +/* forward declarations: */ +static void xsane_back_gtk_panel_rebuild(GSGDialog *dialog); +void xsane_set_sensitivity(SANE_Int sensitivity); +void xsane_set_window_icon(GtkWidget *gtk_window, gchar **xpm_d); + +/* ----------------------------------------------------------------------------------------------------------------- */ + +const char *xsane_back_gtk_unit_string(SANE_Unit unit) +{ + double d; + + switch (unit) + { + case SANE_UNIT_NONE: return "none"; + case SANE_UNIT_PIXEL: return "pixel"; + case SANE_UNIT_BIT: return "bit"; + case SANE_UNIT_DPI: return "dpi"; + case SANE_UNIT_PERCENT: return "%"; + case SANE_UNIT_MM: + d = preferences.length_unit; + if (d > 9.9 && d < 10.1) + { + return "cm"; + } + else if (d > 25.3 && d < 25.5) + { + return "in"; + } + return "mm"; + case SANE_UNIT_MICROSECOND: return "\265s"; + } + return 0; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_set_tooltip(GtkTooltips *tooltips, GtkWidget *widget, const char *desc) +{ + if (desc && desc[0]) + { + gtk_tooltips_set_tip(tooltips, widget, desc, 0); + } +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +int xsane_back_gtk_make_path(size_t buf_size, char *buf, + const char *prog_name, + const char *dir_name, + const char *prefix, const char *dev_name, + const char *postfix, + int location) +{ + struct passwd *pw; + size_t len, extra; + int i; + + if (location == XSANE_PATH_LOCAL_SANE) /* make path to local file */ + { + pw = getpwuid(getuid()); /* get homedirectory */ + if (!pw) + { + snprintf(buf, buf_size, "%s %s", ERR_HOME_DIR, strerror(errno)); + xsane_back_gtk_error(buf, FALSE); + return -1; + } + + snprintf(buf, buf_size, "%s/.sane", pw->pw_dir); + mkdir(buf, 0777); /* ensure ~/.sane directory exists */ + } + else if (location == XSANE_PATH_SYSTEM) /* make path to system file */ + { + snprintf(buf, buf_size, "%s", STRINGIFY(PATH_SANE_DATA_DIR)); + } + else /* make path to temporary file */ + { + snprintf(buf, buf_size, "%s", PATH_SANE_TMP); + } + + len = strlen(buf); + + if (prog_name) + { + extra = strlen(prog_name); + if (len + extra + 1 >= buf_size) + { + goto filename_too_long; + } + + buf[len++] = '/'; + memcpy(buf + len, prog_name, extra); + len += extra; + buf[len] = '\0'; + mkdir(buf, 0777); /* ensure ~/.sane/PROG_NAME directory exists */ + } + if (len >= buf_size) + { + goto filename_too_long; + } + + buf[len++] = '/'; + + + if (dir_name) + { + extra = strlen(dir_name); + if (len + extra + 1 >= buf_size) + { + goto filename_too_long; + } + + buf[len++] = '/'; + memcpy(buf + len, dir_name, extra); + len += extra; + buf[len] = '\0'; + mkdir(buf, 0777); /* ensure DIR_NAME directory exists */ + } + + if (len >= buf_size) + { + goto filename_too_long; + } + + buf[len++] = '/'; + + + if (prefix) + { + extra = strlen(prefix); + if (len + extra >= buf_size) + { + goto filename_too_long; + } + + memcpy(buf + len, prefix, extra); + len += extra; + } + + if (location == XSANE_PATH_TMP) /* system tmp dir, add uid */ + { + char uid_prefix[256]; + uid_t uid; + + uid = getuid(); + snprintf(uid_prefix, sizeof(uid_prefix), "%d-", uid); + + extra = strlen(uid_prefix); + if (len + extra >= buf_size) + { + goto filename_too_long; + } + + memcpy(buf + len, uid_prefix, extra); + len += extra; + } + + if (dev_name) + { + /* Turn devicename into valid filename by replacing slashes by "_", "_" gets "__", spaces are erased */ + + for (i = 0; dev_name[i]; ++i) + { + if (len + 2 >= buf_size) + { + goto filename_too_long; + } + + switch (dev_name[i]) + { + case '/': /* "/" -> "_" */ + buf[len++] = '_'; + break; + + case ' ': /* erase " " */ + break; + + case '_': /* "_" -> "__" */ + buf[len++] = '_'; + /* fall through */ + default: + buf[len++] = dev_name[i]; + break; + } + } + } + + if (postfix) + { + extra = strlen(postfix); + if (len + extra >= buf_size) + { + goto filename_too_long; + } + memcpy(buf + len, postfix, extra); + len += extra; + } + if (len >= buf_size) + goto filename_too_long; + + buf[len++] = '\0'; + return 0; + +filename_too_long: + xsane_back_gtk_error(ERR_FILENAME_TOO_LONG, FALSE); + errno = E2BIG; + return -1; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_set_option(GSGDialog * dialog, int opt_num, void *val, SANE_Action action) +{ + SANE_Status status; + SANE_Int info; + char buf[256]; + + status = sane_control_option(dialog->dev, opt_num, action, val, &info); + if (status != SANE_STATUS_GOOD) + { + snprintf(buf, sizeof(buf), "%s %s: %s.", ERR_SET_OPTION, sane_get_option_descriptor(dialog->dev, opt_num)->name, + XSANE_STRSTATUS(status)); + xsane_back_gtk_error(buf, FALSE); + return; + } + + if ((info & SANE_INFO_RELOAD_PARAMS) && dialog->param_change_callback) + { + (*dialog->param_change_callback) (dialog, dialog->param_change_arg); + } + + if (info & SANE_INFO_RELOAD_OPTIONS) + { + xsane_back_gtk_panel_rebuild(dialog); + if (dialog->option_reload_callback) + { + (*dialog->option_reload_callback) (dialog, dialog->option_reload_arg); + } + } +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_close_dialog_callback(GtkWidget * widget, gpointer data) +{ + gtk_widget_destroy(data); + xsane_back_gtk_message_dialog_active = 0; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +static gint decision_flag; +static GtkWidget *decision_dialog; + +void xsane_back_gtk_decision_callback(GtkWidget * widget, gpointer data) +{ + gtk_widget_destroy(decision_dialog); + xsane_back_gtk_message_dialog_active = 0; + decision_flag = (long) data; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +gint xsane_back_gtk_decision(gchar *title, gchar **xpm_d, gchar *message, gchar *oktext, gchar *rejecttext, gint wait) +{ + GtkWidget *main_vbox, *hbox, *label, *button; + GdkPixmap *pixmap; + GdkBitmap *mask; + GtkWidget *pixmapwidget; + + if (xsane_back_gtk_message_dialog_active) + { + fprintf(stderr, "%s: %s\n", title, message); + return TRUE; + } + xsane_back_gtk_message_dialog_active = 1; + decision_dialog = gtk_window_new(GTK_WINDOW_DIALOG); + gtk_window_set_position(GTK_WINDOW(decision_dialog), GTK_WIN_POS_MOUSE); + gtk_window_set_title(GTK_WINDOW(decision_dialog), title); + gtk_signal_connect(GTK_OBJECT(decision_dialog), "delete_event", + GTK_SIGNAL_FUNC(xsane_back_gtk_decision_callback), (void *) -1); /* -1 = cancel */ + + xsane_set_window_icon(decision_dialog, 0); + + /* create the main vbox */ + main_vbox = gtk_vbox_new(TRUE, 5); + gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 5); + gtk_widget_show(main_vbox); + + gtk_container_add(GTK_CONTAINER(decision_dialog), main_vbox); + + hbox = gtk_hbox_new(FALSE, 2); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 4); + gtk_box_pack_start(GTK_BOX(main_vbox), hbox, FALSE, FALSE, 0); + + /* the info icon */ + if (xpm_d) + { + pixmap = gdk_pixmap_create_from_xpm_d(decision_dialog->window, &mask, xsane.bg_trans, xpm_d); + pixmapwidget = gtk_pixmap_new(pixmap, mask); + gtk_box_pack_start(GTK_BOX(hbox), pixmapwidget, FALSE, FALSE, 10); + gtk_widget_show(pixmapwidget); + gdk_pixmap_unref(pixmap); + } + + /* the message */ + label = gtk_label_new(message); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + gtk_widget_show(hbox); + + + hbox = gtk_hbox_new(FALSE, 2); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 4); + gtk_box_pack_start(GTK_BOX(main_vbox), hbox, FALSE, FALSE, 0); + + /* the confirmation button */ + button = gtk_button_new_with_label(oktext); + GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_back_gtk_decision_callback, (void *) 1 /* confirm */); + gtk_container_add(GTK_CONTAINER(hbox), button); + gtk_widget_grab_default(button); + gtk_widget_show(button); + + + if (rejecttext) /* the rejection button */ + { + button = gtk_button_new_with_label(rejecttext); + gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_back_gtk_decision_callback, (void *) -1 /* reject */); + gtk_container_add(GTK_CONTAINER(hbox), button); + gtk_widget_show(button); + } + gtk_widget_show(hbox); + + gtk_widget_show(decision_dialog); + + if (!wait) + { + return TRUE; + } + + decision_flag = 0; + + while (decision_flag == 0) + { + gtk_main_iteration(); + } + + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + + if (decision_flag == 1) + { + return TRUE; + } + + return FALSE; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_message(gchar *title, gchar **icon_xpm, gchar *message, gint wait) +{ + xsane_back_gtk_decision(title, icon_xpm, message, ERR_BUTTON_OK, 0 /* no reject text */, wait); +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_error(gchar *error, gint wait) +{ + if (wait) + { + SANE_Int old_sensitivity = xsane.sensitivity; + + xsane_set_sensitivity(FALSE); + xsane_back_gtk_message(ERR_HEADER_ERROR, (gchar**) error_xpm, error, wait); + xsane_set_sensitivity(old_sensitivity); + } + else + { + xsane_back_gtk_message(ERR_HEADER_ERROR, (gchar **) error_xpm, error, wait); + } +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_warning(gchar *warning, gint wait) +{ + if (wait) + { + SANE_Int old_sensitivity = xsane.sensitivity; + + xsane_set_sensitivity(FALSE); + xsane_back_gtk_message(ERR_HEADER_WARNING, (gchar**) warning_xpm, warning, wait); + xsane_set_sensitivity(old_sensitivity); + } + else + { + xsane_back_gtk_message(ERR_HEADER_WARNING, (gchar**) warning_xpm, warning, wait); + } +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +static void xsane_back_gtk_get_filename_button_clicked(GtkWidget *w, gpointer data) +{ + int *clicked = data; + *clicked = 1; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +int xsane_back_gtk_get_filename(const char *label, const char *default_name, size_t max_len, char *filename, int show_fileopts) +{ + int cancel = 0, ok = 0, destroy = 0; + GtkWidget *fileselection; + + fileselection = gtk_file_selection_new((char *) label); + + gtk_signal_connect(GTK_OBJECT(fileselection), + "destroy", GTK_SIGNAL_FUNC(xsane_back_gtk_get_filename_button_clicked), &destroy); + gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fileselection)->cancel_button), + "clicked", (GtkSignalFunc) xsane_back_gtk_get_filename_button_clicked, &cancel); + gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fileselection)->ok_button), + "clicked", (GtkSignalFunc) xsane_back_gtk_get_filename_button_clicked, &ok); + if (default_name) + { + gtk_file_selection_set_filename(GTK_FILE_SELECTION(fileselection), (char *) default_name); + } + + if (show_fileopts) + { + gtk_file_selection_show_fileop_buttons(GTK_FILE_SELECTION(fileselection)); + } + else + { + gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(fileselection)); + } + + gtk_widget_show(fileselection); + + while (!cancel && !ok && !destroy) + { + if (!gtk_events_pending()) + { + usleep(100000); + } + gtk_main_iteration(); + } + + if (ok) + { + size_t len, cwd_len; + char *cwd; + + strncpy(filename, gtk_file_selection_get_filename(GTK_FILE_SELECTION(fileselection)), max_len - 1); + filename[max_len - 1] = '\0'; + + len = strlen(filename); + cwd = alloca(len + 2); + getcwd(cwd, len + 1); + cwd_len = strlen(cwd); + cwd[cwd_len++] = '/'; + cwd[cwd_len] = '\0'; + if (strncmp(filename, cwd, cwd_len) == 0) + { + memcpy(filename, filename + cwd_len, len - cwd_len + 1); + } + } + + if (!destroy) + { + gtk_widget_destroy(fileselection); + } + + return ok ? 0 : -1; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +static gint xsane_back_gtk_autobutton_update(GtkWidget *widget, GSGDialogElement *elem) +{ + GSGDialog *dialog = elem->dialog; + int opt_num = elem - dialog->element; + const SANE_Option_Descriptor *opt; + SANE_Status status; + SANE_Word val; + char buf[256]; + + opt = sane_get_option_descriptor(dialog->dev, opt_num); + if (GTK_TOGGLE_BUTTON(widget)->active) + { + xsane_back_gtk_set_option(dialog, opt_num, 0, SANE_ACTION_SET_AUTO); + } + else + { + status = sane_control_option(dialog->dev, opt_num, SANE_ACTION_GET_VALUE, &val, 0); + if (status != SANE_STATUS_GOOD) + { + snprintf(buf, sizeof(buf), "%s %s: %s.", ERR_GET_OPTION, opt->name, XSANE_STRSTATUS(status)); + xsane_back_gtk_error(buf, FALSE); + } + xsane_back_gtk_set_option(dialog, opt_num, &val, SANE_ACTION_SET_VALUE); + } + return FALSE; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +static void xsane_back_gtk_autobutton_new(GtkWidget *parent, GSGDialogElement *elem, + GtkWidget *label, GtkTooltips *tooltips) +{ + GtkWidget *button, *alignment; + + button = gtk_check_button_new(); + gtk_container_set_border_width(GTK_CONTAINER(button), 0); + gtk_widget_set_usize(button, 20, 20); + gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_back_gtk_autobutton_update, elem); + xsane_back_gtk_set_tooltip(tooltips, button, "Turns on automatic mode."); + + alignment = gtk_alignment_new(0.0, 1.0, 0.5, 0.5); + gtk_container_add(GTK_CONTAINER(alignment), button); + + gtk_box_pack_end(GTK_BOX(parent), label, FALSE, FALSE, 0); + gtk_box_pack_end(GTK_BOX(parent), alignment, FALSE, FALSE, 2); + + gtk_widget_show(alignment); + gtk_widget_show(button); +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +static gint xsane_back_gtk_button_update(GtkWidget * widget, GSGDialogElement * elem) +{ + GSGDialog *dialog = elem->dialog; + int opt_num = elem - dialog->element; + const SANE_Option_Descriptor *opt; + SANE_Word val = SANE_FALSE; + + opt = sane_get_option_descriptor(dialog->dev, opt_num); + if (GTK_TOGGLE_BUTTON(widget)->active) + { + val = SANE_TRUE; + } + xsane_back_gtk_set_option(dialog, opt_num, &val, SANE_ACTION_SET_VALUE); + + return FALSE; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_button_new(GtkWidget * parent, const char *name, SANE_Word val, + GSGDialogElement * elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable) +{ + GtkWidget *button; + + button = gtk_check_button_new_with_label((char *) name); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), val); + gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_back_gtk_button_update, elem); + gtk_box_pack_start(GTK_BOX(parent), button, FALSE, TRUE, 0); + gtk_widget_show(button); + xsane_back_gtk_set_tooltip(tooltips, button, desc); + + gtk_widget_set_sensitive(button, settable); + + elem->widget = button; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +static void xsane_back_gtk_scale_update(GtkAdjustment * adj_data, GSGDialogElement * elem) +{ + const SANE_Option_Descriptor *opt; + GSGDialog *dialog = elem->dialog; + SANE_Word val, new_val; + int opt_num; + double d; + + opt_num = elem - dialog->element; + opt = sane_get_option_descriptor(dialog->dev, opt_num); + switch(opt->type) + { + case SANE_TYPE_INT: + val = adj_data->value + 0.5; + break; + + case SANE_TYPE_FIXED: + d = adj_data->value; + if (opt->unit == SANE_UNIT_MM) + { + d *= preferences.length_unit; + } + val = SANE_FIX(d); + break; + + default: + fprintf(stderr, "xsane_back_gtk_scale_update: %s %d\n", ERR_UNKNOWN_TYPE, opt->type); + return; + } + + xsane_back_gtk_set_option(dialog, opt_num, &val, SANE_ACTION_SET_VALUE); + sane_control_option(dialog->dev, opt_num, SANE_ACTION_GET_VALUE, &new_val, 0); + if (new_val != val) + { + val = new_val; + goto value_changed; + } + return; /* value didn't change */ + +value_changed: + switch(opt->type) + { + case SANE_TYPE_INT: + adj_data->value = val; + break; + + case SANE_TYPE_FIXED: + d = SANE_UNFIX(val); + if (opt->unit == SANE_UNIT_MM) + { + d /= preferences.length_unit; + } + adj_data->value = d; + break; + + default: + break; + } + /* Let widget know that value changed _again_. This must converge + quickly---otherwise things would get very slow very quickly (as + in "infinite recursion"): */ + gtk_signal_emit_by_name(GTK_OBJECT(adj_data), "value_changed"); + return; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_scale_new(GtkWidget * parent, const char *name, gfloat val, + gfloat min, gfloat max, gfloat quant, int automatic, + GSGDialogElement * elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable) +{ + GtkWidget *hbox, *label, *scale; + + hbox = gtk_hbox_new(FALSE, 2); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 0); + gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 0); + + label = gtk_label_new((char *) name); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + + elem->data = gtk_adjustment_new(val, min, max, quant, 1.0, 0.0); + scale = gtk_hscale_new(GTK_ADJUSTMENT(elem->data)); + xsane_back_gtk_set_tooltip(tooltips, scale, desc); + gtk_widget_set_usize(scale, 150, 0); + + if (automatic) + { + xsane_back_gtk_autobutton_new(hbox, elem, scale, tooltips); + } + else + { + gtk_box_pack_end(GTK_BOX(hbox), scale, FALSE, FALSE, 0); /* make scales fixed */ +/* gtk_box_pack_end(GTK_BOX(hbox), scale, TRUE, TRUE, 0); */ /* make scales sizeable */ + } + + gtk_range_set_update_policy(GTK_RANGE(scale), GTK_UPDATE_CONTINUOUS); + gtk_scale_set_value_pos(GTK_SCALE(scale), GTK_POS_TOP); + if (quant - (int) quant == 0.0) + { + gtk_scale_set_digits(GTK_SCALE(scale), 0); + } + else + { + /* one place behind decimal point */ + gtk_scale_set_digits(GTK_SCALE(scale), 1); + } + + gtk_signal_connect(elem->data, "value_changed", (GtkSignalFunc) xsane_back_gtk_scale_update, elem); + + gtk_widget_show(label); + gtk_widget_show(scale); + gtk_widget_show(hbox); + + gtk_widget_set_sensitive(scale, settable); + + elem->widget = scale; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_push_button_callback(GtkWidget * widget, gpointer data) +{ + GSGDialogElement *elem = data; + GSGDialog *dialog = elem->dialog; + int opt_num; + + opt_num = elem - dialog->element; + xsane_back_gtk_set_option(dialog, opt_num, 0, SANE_ACTION_SET_VALUE); +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +static int xsane_back_gtk_option_menu_lookup(GSGMenuItem menu_items[], const char *string) +{ + int i; + + for (i = 0; strcmp(menu_items[i].label, string) != 0; ++i); + + return i; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +static void xsane_back_gtk_option_menu_callback(GtkWidget * widget, gpointer data) +{ + GSGMenuItem *menu_item = data; + GSGDialogElement *elem = menu_item->elem; + const SANE_Option_Descriptor *opt; + GSGDialog *dialog = elem->dialog; + int opt_num; + double dval; + SANE_Word val; + void *valp = &val; + + opt_num = elem - dialog->element; + opt = sane_get_option_descriptor(dialog->dev, opt_num); + switch(opt->type) + { + case SANE_TYPE_INT: + sscanf(menu_item->label, "%d", &val); + break; + + case SANE_TYPE_FIXED: + sscanf(menu_item->label, "%lg", &dval); + val = SANE_FIX(dval); + break; + + case SANE_TYPE_STRING: + valp = menu_item->label; + break; + + default: + fprintf(stderr, "xsane_back_gtk_option_menu_callback: %s %d\n", ERR_UNKNOWN_TYPE, opt->type); + break; + } + xsane_back_gtk_set_option(dialog, opt_num, valp, SANE_ACTION_SET_VALUE); +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_option_menu_new(GtkWidget *parent, const char *name, char *str_list[], + const char *val, GSGDialogElement * elem, + GtkTooltips *tooltips, const char *desc, SANE_Int settable) +{ + GtkWidget *hbox, *label, *option_menu, *menu, *item; + GSGMenuItem *menu_items; + int i, num_items; + + hbox = gtk_hbox_new(FALSE, 2); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 0); + gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 0); + + label = gtk_label_new((char *) name); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + + for (num_items = 0; str_list[num_items]; ++num_items); + menu_items = malloc(num_items * sizeof(menu_items[0])); + + menu = gtk_menu_new(); + for (i = 0; i < num_items; ++i) + { + item = gtk_menu_item_new_with_label(_BGT(str_list[i])); + gtk_container_add(GTK_CONTAINER(menu), item); + gtk_signal_connect(GTK_OBJECT(item), "activate", (GtkSignalFunc) xsane_back_gtk_option_menu_callback, menu_items + i); + + gtk_widget_show(item); + + menu_items[i].label = str_list[i]; + menu_items[i].elem = elem; + menu_items[i].index = i; + } + + option_menu = gtk_option_menu_new(); + gtk_box_pack_end(GTK_BOX(hbox), option_menu, FALSE, FALSE, 2); + gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu); + gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), xsane_back_gtk_option_menu_lookup(menu_items, val)); + xsane_back_gtk_set_tooltip(tooltips, option_menu, desc); + + gtk_widget_show(label); + gtk_widget_show(option_menu); + gtk_widget_show(hbox); + + gtk_widget_set_sensitive(option_menu, settable); + + elem->widget = option_menu; + elem->menu_size = num_items; + elem->menu = menu_items; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +static void xsane_back_gtk_text_entry_callback(GtkWidget *w, gpointer data) +{ + GSGDialogElement *elem = data; + const SANE_Option_Descriptor *opt; + GSGDialog *dialog = elem->dialog; + gchar *text; + int opt_num; + char *buf; + + opt_num = elem - dialog->element; + opt = sane_get_option_descriptor(dialog->dev, opt_num); + + buf = alloca(opt->size); + buf[0] = '\0'; + + text = gtk_entry_get_text(GTK_ENTRY(elem->widget)); + if (text) + { + strncpy(buf, text, opt->size); + } + buf[opt->size - 1] = '\0'; + + xsane_back_gtk_set_option(dialog, opt_num, buf, SANE_ACTION_SET_VALUE); + + if (strcmp(buf, text) != 0) /* the backend modified the option value; update widget: */ + { + gtk_entry_set_text(GTK_ENTRY(elem->widget), buf); + } +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_text_entry_new(GtkWidget * parent, const char *name, const char *val, GSGDialogElement *elem, + GtkTooltips *tooltips, const char *desc, SANE_Int settable) +{ + GtkWidget *hbox, *text, *label; + + hbox = gtk_hbox_new(FALSE, 2); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 0); + gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 0); + + label = gtk_label_new((char *) name); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + + text = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(text), (char *) val); +/* gtk_box_pack_start(GTK_BOX(hbox), text, FALSE, TRUE, 0); */ /* text entry fixed */ + gtk_box_pack_start(GTK_BOX(hbox), text, TRUE, TRUE, 0); /* text entry sizeable */ + gtk_signal_connect(GTK_OBJECT(text), "changed", (GtkSignalFunc) xsane_back_gtk_text_entry_callback, elem); + xsane_back_gtk_set_tooltip(tooltips, text, desc); + + gtk_widget_show(hbox); + gtk_widget_show(label); + gtk_widget_show(text); + + gtk_widget_set_sensitive(text, settable); + + elem->widget = text; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +GtkWidget *xsane_back_gtk_group_new(GtkWidget *parent, const char * title) +{ + GtkWidget * frame, * vbox; + + frame = gtk_frame_new((char *) title); + gtk_container_set_border_width(GTK_CONTAINER(frame), 4); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); + gtk_box_pack_start(GTK_BOX(parent), frame, FALSE, FALSE, 0); + + vbox = gtk_vbox_new(FALSE, 4); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 2); + gtk_container_add(GTK_CONTAINER(frame), vbox); + gtk_widget_show(vbox); + return vbox; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ +#if 0 +static GtkWidget* xsane_back_gtk_curve_new(GSGDialog *dialog, int optnum) +{ + const SANE_Option_Descriptor * opt; + gfloat fmin, fmax, val, *vector; + SANE_Word *optval, min, max; + GtkWidget *curve, *gamma; + SANE_Status status; + SANE_Handle dev; + int i, optlen; + + gamma = gtk_gamma_curve_new(); + curve = GTK_GAMMA_CURVE(gamma)->curve; + dev = dialog->dev; + + opt = sane_get_option_descriptor(dev, optnum); + optlen = opt->size / sizeof(SANE_Word); + vector = alloca(optlen * (sizeof(vector[0]) + sizeof(optval[0]))); + optval = (SANE_Word *) (vector + optlen); + + min = max = 0; + switch(opt->constraint_type) + { + case SANE_CONSTRAINT_RANGE: + min = opt->constraint.range->min; + max = opt->constraint.range->max; + break; + + case SANE_CONSTRAINT_WORD_LIST: + if (opt->constraint.word_list[0] > 1) + { + min = max = opt->constraint.word_list[1]; + for (i = 2; i < opt->constraint.word_list[0]; ++i) + { + if (opt->constraint.word_list[i] < min) + { + min = opt->constraint.word_list[i]; + } + + if (opt->constraint.word_list[i] > max) + { + max = opt->constraint.word_list[i]; + } + } + } + break; + + default: + break; + } + if (min == max) + { + fprintf(stderr, "xsane_back_gtk_curve_new: %s: `%s'\n", WARN_NO_VALUE_CONSTRAINT, opt->name); + fmin = 0; + fmax = 255; + } + else if (opt->type == SANE_TYPE_FIXED) + { + fmin = SANE_UNFIX(min); + fmax = SANE_UNFIX(max); + } + else + { + fmin = min; + fmax = max; + } + gtk_curve_set_range(GTK_CURVE(curve), 0, optlen - 1, fmin, fmax); + + status = sane_control_option(dev, optnum, SANE_ACTION_GET_VALUE, optval, 0); + if (status == SANE_STATUS_GOOD) + { + for (i = 0; i < optlen; ++i) + { + if (opt->type == SANE_TYPE_FIXED) + { + val = SANE_UNFIX(optval[i]); + } + else + { + val = optval[i]; + } + vector[i] = val; + } + gtk_curve_set_vector(GTK_CURVE(curve), optlen, vector); + } + else + { + gtk_widget_set_sensitive(gamma, FALSE); + } + + return gamma; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +static void xsane_back_gtk_vector_new(GSGDialog * dialog, GtkWidget *vbox, int num_vopts, int *vopts) +{ + GtkWidget *notebook, *label, *curve; + const SANE_Option_Descriptor *opt; + int i; + + notebook = gtk_notebook_new(); + gtk_container_set_border_width(GTK_CONTAINER(notebook), 4); + gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); + + for (i = 0; i < num_vopts; ++i) + { + opt = sane_get_option_descriptor(dialog->dev, vopts[i]); + + label = gtk_label_new((char *) opt->title); + vbox = gtk_vbox_new(/* homogeneous */ FALSE, 0); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label); + gtk_widget_show(vbox); + gtk_widget_show(label); + + curve = xsane_back_gtk_curve_new(dialog, vopts[i]); + gtk_container_set_border_width(GTK_CONTAINER(curve), 4); + gtk_box_pack_start(GTK_BOX(vbox), curve, TRUE, TRUE, 0); + gtk_widget_show(curve); + + dialog->element[vopts[i]].widget = curve; + } + gtk_widget_show(notebook); +} +#endif +/* ----------------------------------------------------------------------------------------------------------------- */ +#if 0 +static void tooltips_destroy(GSGDialog * dialog) +{ + gtk_object_unref(GTK_OBJECT(dialog->tooltips)); + dialog->tooltips = 0; +} +#endif +/* ----------------------------------------------------------------------------------------------------------------- */ + +static void xsane_back_gtk_panel_destroy(GSGDialog * dialog) +{ + const SANE_Option_Descriptor *opt; + GSGDialogElement *elem; + int i, j; + + gtk_widget_destroy(dialog->xsane_hbox); + gtk_widget_destroy(dialog->standard_hbox); + gtk_widget_destroy(dialog->advanced_hbox); + + /* free the menu labels of integer/fix-point word-lists: */ + for (i = 0; i < dialog->num_elements; ++i) + { + if (dialog->element[i].menu) + { + opt = sane_get_option_descriptor(dialog->dev, i); + elem = dialog->element + i; + if (opt->type != SANE_TYPE_STRING) + { + for (j = 0; j < elem->menu_size; ++j) + { + if (elem->menu[j].label) + { + free(elem->menu[j].label); + elem->menu[j].label = 0; + } + } + free(elem->menu); + elem->menu = 0; + } + } + } + memset(dialog->element, 0, dialog->num_elements * sizeof(dialog->element[0])); +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +/* When an setting an option changes the dialog, everything may + change: the option titles, the activity-status of the option, its + constraints or what not. Thus, rather than trying to be clever in + detecting what exactly changed, we use a brute-force method of + rebuilding the entire dialog. */ + +static void xsane_back_gtk_panel_rebuild(GSGDialog * dialog) +{ + xsane_back_gtk_panel_destroy(dialog); + xsane_panel_build(dialog); +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_refresh_dialog(GSGDialog *dialog) +{ + xsane_back_gtk_panel_rebuild(dialog); + if (dialog->param_change_callback) + { + (*dialog->param_change_callback) (dialog, dialog->param_change_arg); + } +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_update_scan_window(GSGDialog *dialog) +{ + const SANE_Option_Descriptor *opt; + double old_val, new_val; + GSGDialogElement *elem; + SANE_Status status; + SANE_Word word; + int i, optnum; + char str[64]; + + for (i = 0; i < 4; ++i) + { + if (dialog->well_known.coord[i] > 0) + { + optnum = dialog->well_known.coord[i]; + elem = dialog->element + optnum; + opt = sane_get_option_descriptor(dialog->dev, optnum); + + status = sane_control_option(dialog->dev, optnum, SANE_ACTION_GET_VALUE, &word, 0); + if (status != SANE_STATUS_GOOD) + { + continue; /* sliently ignore errors */ + } + + switch(opt->constraint_type) + { + case SANE_CONSTRAINT_RANGE: + if (opt->type == SANE_TYPE_INT) + { + old_val = GTK_ADJUSTMENT(elem->data)->value; + new_val = word; + GTK_ADJUSTMENT(elem->data)->value = new_val; + } + else + { + old_val = GTK_ADJUSTMENT(elem->data)->value; + new_val = SANE_UNFIX(word); + if (opt->unit == SANE_UNIT_MM) + { + new_val /= preferences.length_unit; + } + GTK_ADJUSTMENT(elem->data)->value = new_val; + } + + if (old_val != new_val) + { + gtk_signal_emit_by_name(GTK_OBJECT(elem->data), "value_changed"); + } + break; + + case SANE_CONSTRAINT_WORD_LIST: + if (opt->type == SANE_TYPE_INT) + { + sprintf(str, "%d", word); + } + else + { + sprintf(str, "%g", SANE_UNFIX(word)); + } + /* XXX maybe we should call this only when the value changes... */ + gtk_option_menu_set_history(GTK_OPTION_MENU(elem->widget), xsane_back_gtk_option_menu_lookup(elem->menu, str)); + break; + + default: + break; + } + } + } +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +/* Ensure sure the device has up-to-date option values. Except for + vectors, all option values are kept current. Vectors are + downloaded into the device during this call. */ +void xsane_back_gtk_sync(GSGDialog *dialog) +{ + const SANE_Option_Descriptor *opt; + gfloat val, *vector; + SANE_Word *optval; + int i, j, optlen; + GtkWidget *curve; + + for (i = 1; i < dialog->num_elements; ++i) + { + opt = sane_get_option_descriptor(dialog->dev, i); + + if (!SANE_OPTION_IS_ACTIVE(opt->cap)) + { + continue; + } + + if (opt->type != SANE_TYPE_INT && opt->type != SANE_TYPE_FIXED) + { + continue; + } + + if (opt->size == sizeof(SANE_Word)) + { + continue; + } + + /* ok, we're dealing with an active vector */ + + optlen = opt->size / sizeof(SANE_Word); + optval = alloca(optlen * sizeof(optval[0])); + vector = alloca(optlen * sizeof(vector[0])); + + curve = GTK_GAMMA_CURVE(dialog->element[i].widget)->curve; + gtk_curve_get_vector(GTK_CURVE(curve), optlen, vector); + for (j = 0; j < optlen; ++j) + { + val = vector[j]; + if (opt->type == SANE_TYPE_FIXED) + { + optval[j] = SANE_FIX(val); + } + else + { + optval[j] = val + 0.5; + } + } + + xsane_back_gtk_set_option(dialog, i, optval, SANE_ACTION_SET_VALUE); + } +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_update_vector(GSGDialog *dialog, int opt_num, SANE_Int *vector) +{ + const SANE_Option_Descriptor *opt; + gfloat val; + SANE_Word *optval; + int j, optlen; + + if (opt_num < 1) + return; /* not defined */ + + opt = sane_get_option_descriptor(dialog->dev, opt_num); + if (!SANE_OPTION_IS_ACTIVE(opt->cap)) + { + return; /* inactive */ + } + + if (opt->type != SANE_TYPE_INT && opt->type != SANE_TYPE_FIXED) + { + return; + } + + if (opt->size == sizeof(SANE_Word)) + { + return; + } + + /* ok, we're dealing with an active vector */ + + optlen = opt->size / sizeof(SANE_Word); + optval = alloca(optlen * sizeof(optval[0])); + for (j = 0; j < optlen; ++j) + { + val = vector[j]; + if (opt->type == SANE_TYPE_FIXED) + { + optval[j] = SANE_FIX(val); + } + else + { + optval[j] = val + 0.5; + } + } + + xsane_back_gtk_set_option(dialog, opt_num, optval, SANE_ACTION_SET_VALUE); +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_set_tooltips(GSGDialog *dialog, int enable) +{ + if (!dialog->tooltips) + { + return; + } + + if (enable) + { + gtk_tooltips_enable(dialog->tooltips); + } + else + { + gtk_tooltips_disable(dialog->tooltips); + } +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_set_sensitivity(GSGDialog *dialog, int sensitive) +{ + const SANE_Option_Descriptor *opt; + int i; + + for (i = 0; i < dialog->num_elements; ++i) + { + opt = sane_get_option_descriptor(dialog->dev, i); + + if (!SANE_OPTION_IS_ACTIVE(opt->cap) || !SANE_OPTION_IS_SETTABLE(opt->cap) || + opt->type == SANE_TYPE_GROUP || !dialog->element[i].widget) + { + continue; + } + + if (!(opt->cap & SANE_CAP_ALWAYS_SETTABLE)) + { + gtk_widget_set_sensitive(dialog->element[i].widget, sensitive); + } + } + + if (dialog) + { + if (dialog->xsanemode_widget) + { + gtk_widget_set_sensitive(dialog->xsanemode_widget, sensitive); + } + } + + while (gtk_events_pending()) + { + gtk_main_iteration(); + } +} +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_set_sensitivity(SANE_Int sensitivity) +{ + if (xsane.shell) + { + gtk_widget_set_sensitive(xsane.shell, sensitivity); + gtk_widget_set_sensitive(xsane.standard_options_shell, sensitivity); + gtk_widget_set_sensitive(xsane.advanced_options_shell, sensitivity); + gtk_widget_set_sensitive(xsane.histogram_dialog, sensitivity); + } + + if (xsane.preview) + { + gtk_widget_set_sensitive(xsane.preview->button_box, sensitivity); /* button box at top of window */ +#if 0 + gtk_widget_set_sensitive(xsane.preview->viewport, sensitivity); /* Preview image selection */ +#endif + gtk_widget_set_sensitive(xsane.preview->start, sensitivity); /* Acquire preview button */ + } + + if (xsane.fax_dialog) + { + gtk_widget_set_sensitive(xsane.fax_dialog, sensitivity); + } + + if (dialog) + { + xsane_back_gtk_set_sensitivity(dialog, sensitivity); + } + + while (gtk_events_pending()) /* make sure set_sensitivity is displayed */ + { + gtk_main_iteration(); + } + + xsane.sensitivity = sensitivity; +} + +/* ----------------------------------------------------------------------------------------------------------------- */ + +void xsane_back_gtk_destroy_dialog(GSGDialog * dialog) +{ + SANE_Handle dev = dialog->dev; + + xsane_back_gtk_panel_destroy(dialog); + free((void *) dialog->dev_name); + free(dialog->element); + free(dialog); + + sane_close(dev); +} +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_set_window_icon(GtkWidget *gtk_window, gchar **xpm_d) +{ + GdkPixmap *pixmap; + GdkBitmap *mask; + + gtk_widget_realize(gtk_window); + if (xpm_d) + { + pixmap = gdk_pixmap_create_from_xpm_d(gtk_window->window, &mask, xsane.bg_trans, xpm_d); + } + else + { + if (xsane.window_icon_pixmap) + { + pixmap = xsane.window_icon_pixmap; + mask = xsane.window_icon_mask; + } + else + { + pixmap = gdk_pixmap_create_from_xpm_d(gtk_window->window, &mask, xsane.bg_trans, (gchar **) xsane_window_icon_xpm); + } + } + + gdk_window_set_icon(gtk_window->window, 0, pixmap, mask); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ diff --git a/frontend/xsane-back-gtk.h b/frontend/xsane-back-gtk.h new file mode 100644 index 0000000..af1d55a --- /dev/null +++ b/frontend/xsane-back-gtk.h @@ -0,0 +1,188 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-back-gtk.h + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#ifndef xsane_back_gtk_h +#define xsane_back_gtk_h + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#include + +#include + +#include +#include + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +enum +{ + XSANE_PATH_LOCAL_SANE = 0, + XSANE_PATH_SYSTEM, + XSANE_PATH_TMP +}; + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +struct GSGDialog; + +typedef void (*GSGCallback) (struct GSGDialog *dialog, void *arg); +typedef GtkWidget *(*XSANECallback) (void); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +typedef enum + { + xsane_back_gtk_TL_X, /* top-left x */ + xsane_back_gtk_TL_Y, /* top-left y */ + xsane_back_gtk_BR_X, /* bottom-right x */ + xsane_back_gtk_BR_Y /* bottom-right y */ + } +GSGCornerCoordinates; + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +typedef struct + { + /* The option number of the well-known options. Each of these may + be -1 in case the backend doesn't define the respective option. */ + int scanmode; + int scansource; + int preview; + int dpi; + int dpi_x; + int dpi_y; + int coord[4]; + int gamma_vector; + int gamma_vector_r; + int gamma_vector_g; + int gamma_vector_b; + int bit_depth; + } +GSGWellKnownOptions; + +typedef struct + { + gchar *label; + struct GSGDialogElement *elem; + gint index; + } +GSGMenuItem; + +typedef struct GSGDialogElement + { + struct GSGDialog *dialog; /* wasteful, but is there a better solution? */ + GtkWidget *automatic; /* auto button for options that support this */ + GtkWidget *widget; + GtkObject *data; + int menu_size; /* # of items in menu (if any) */ + GSGMenuItem *menu; + } +GSGDialogElement; + +typedef struct GSGDialog + { + GtkWidget *xsane_window; + GtkWidget *standard_window; + GtkWidget *advanced_window; + GtkWidget *xsane_hbox; + GtkWidget *standard_hbox; + GtkWidget *advanced_hbox; + GtkWidget *xsanemode_widget; + GtkTooltips *tooltips; + GdkColor tooltips_fg; + GdkColor tooltips_bg; + SANE_Handle *dev; + const char *dev_name; + GSGWellKnownOptions well_known; + int num_elements; + GSGDialogElement *element; + gint idle_id; + u_int rebuild : 1; + /* This callback gets invoked whenever the backend notifies us + that the option descriptors have changed. */ + GSGCallback option_reload_callback; + void *option_reload_arg; + /* This callback gets invoked whenever the backend notifies us + that the parameters have changed. */ + GSGCallback param_change_callback; + void *param_change_arg; + XSANECallback update_xsane_callback; + void *update_xsane_arg; + int pixelcolor; + } +GSGDialog; + +extern int xsane_back_gtk_message_dialog_active; + +/* Construct the path and return it in filename_ret (this buffer must + be at least max_len bytes long). The path is constructed as + follows: + + ~/.sane/${PROG_NAME}/${PREFIX}${DEV_NAME}${POSTFIX} + + If PROG_NAME is NULL, an empty string is used and the leading slash + is removed. On success, 0 is returned, on error a negative number and + ERRNO is set to the appropriate value. */ +extern int xsane_back_gtk_make_path(size_t max_len, char *filename_ret, + const char *prog_name, + const char *dir_name, + const char *prefix, const char *dev_name, + const char *postfix, + int local); +extern gint xsane_back_gtk_decision(gchar *title, gchar** icon_xpm, gchar *message, gchar *oktext, gchar *rejecttext, gint wait); +extern void xsane_back_gtk_message(gchar *title, gchar** icon_xpm, gchar *message, gint wait); +extern void xsane_back_gtk_error(gchar *error_message, gint wait); +extern void xsane_back_gtk_warning(gchar *warning_message, gint wait); +extern int xsane_back_gtk_get_filename(const char *label, const char *default_name, + size_t max_len, char *filename, int show_fileopts); + +extern void xsane_back_gtk_sync(GSGDialog *dialog); +extern void xsane_back_gtk_update_vector(GSGDialog *dialog, int opt_num, SANE_Int *vector); +extern void xsane_back_gtk_refresh_dialog(GSGDialog *dialog); +extern void xsane_back_gtk_update_scan_window(GSGDialog *dialog); +extern void xsane_back_gtk_set_advanced(GSGDialog *dialog, int advanced); +extern void xsane_back_gtk_set_tooltips(GSGDialog *dialog, int enable); +extern void xsane_back_gtk_set_tooltip(GtkTooltips *tooltips, GtkWidget *widget, const char *desc); +extern void xsane_back_gtk_set_sensitivity(GSGDialog *dialog, int sensitive); +extern void xsane_set_sensitivity(SANE_Int sensitivity); +extern void xsane_back_gtk_destroy_dialog(GSGDialog *dialog); +extern void xsane_back_gtk_set_option(GSGDialog * dialog, int opt_num, void *val, SANE_Action action); +extern GtkWidget *xsane_back_gtk_group_new (GtkWidget *parent, const char * title); +extern void xsane_back_gtk_button_new(GtkWidget * parent, const char *name, SANE_Word val, + GSGDialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable); +extern void xsane_back_gtk_scale_new(GtkWidget * parent, const char *name, gfloat val, + gfloat min, gfloat max, gfloat quant, int automatic, + GSGDialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable); +extern void xsane_back_gtk_option_menu_new(GtkWidget *parent, const char *name, char *str_list[], + const char *val, GSGDialogElement * elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable); +extern void xsane_back_gtk_text_entry_new(GtkWidget *parent, const char *name, const char *val, + GSGDialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable); +extern void xsane_back_gtk_push_button_callback(GtkWidget * widget, gpointer data); +extern const char *xsane_back_gtk_unit_string(SANE_Unit unit); +void xsane_set_window_icon(GtkWidget *gtk_window, gchar **xpm_d); + +#define xsane_back_gtk_dialog_get_device(dialog) ((dialog)->dev) + +#endif /* gtkglue_h */ diff --git a/frontend/xsane-device-preferences.c b/frontend/xsane-device-preferences.c new file mode 100644 index 0000000..cce2007 --- /dev/null +++ b/frontend/xsane-device-preferences.c @@ -0,0 +1,699 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-device-preferences.c + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------- */ + +#include "xsane.h" +#include "xsane-rc-io.h" +#include "xsane-front-gtk.h" +#include "xsane-gamma.h" + +/* ---------------------------------------------------------------------------------------------------------------- */ + +#define BITS_PER_LONG (8*sizeof(u_long)) + +#define SET(set, bit) ((set)[(bit)/BITS_PER_LONG] |= (1UL << (bit)%BITS_PER_LONG)) +#define IS_SET(set, bit) (((set)[(bit)/BITS_PER_LONG] & (1UL << (bit)%BITS_PER_LONG)) != 0) + +#define DPOFFSET(field) ((char *) &((Xsane *) 0)->field - (char *) 0) + +/* ---------------------------------------------------------------------------------------------------------------- */ + +static struct +{ + SANE_String name; + void (*codec) (Wire *w, void *p, long offset); + long offset; +} +desc_xsane_device[] = +{ + {"xsane-main-window-x-position", xsane_rc_pref_int, DPOFFSET(shell_posx)}, + {"xsane-main-window-y-position", xsane_rc_pref_int, DPOFFSET(shell_posy)}, + {"xsane-main-window-width", xsane_rc_pref_int, DPOFFSET(shell_width)}, + {"xsane-main-window-height", xsane_rc_pref_int, DPOFFSET(shell_height)}, + {"xsane-standard-options-window-x-position", xsane_rc_pref_int, DPOFFSET(standard_options_shell_posx)}, + {"xsane-standard-options-window-y-position", xsane_rc_pref_int, DPOFFSET(standard_options_shell_posy)}, + {"xsane-advanced-options-window-x-position", xsane_rc_pref_int, DPOFFSET(advanced_options_shell_posx)}, + {"xsane-advanced-options-window-y-position", xsane_rc_pref_int, DPOFFSET(advanced_options_shell_posy)}, + {"xsane-histogram-window-x-position", xsane_rc_pref_int, DPOFFSET(histogram_dialog_posx)}, + {"xsane-histogram-window-y-position", xsane_rc_pref_int, DPOFFSET(histogram_dialog_posy)}, + {"xsane-preview-window-x-position", xsane_rc_pref_int, DPOFFSET(preview_dialog_posx)}, + {"xsane-preview-window-y-position", xsane_rc_pref_int, DPOFFSET(preview_dialog_posy)}, + {"xsane-preview-window-width", xsane_rc_pref_int, DPOFFSET(preview_dialog_width)}, + {"xsane-preview-window-height", xsane_rc_pref_int, DPOFFSET(preview_dialog_height)}, + + {"xsane-gamma", xsane_rc_pref_double, DPOFFSET(gamma)}, + {"xsane-gamma-red", xsane_rc_pref_double, DPOFFSET(gamma_red)}, + {"xsane-gamma-green", xsane_rc_pref_double, DPOFFSET(gamma_green)}, + {"xsane-gamma-blue", xsane_rc_pref_double, DPOFFSET(gamma_blue)}, + + {"xsane-brightness", xsane_rc_pref_double, DPOFFSET(brightness)}, + {"xsane-brightness-red", xsane_rc_pref_double, DPOFFSET(brightness_red)}, + {"xsane-brightness-green", xsane_rc_pref_double, DPOFFSET(brightness_green)}, + {"xsane-brightness-blue", xsane_rc_pref_double, DPOFFSET(brightness_blue)}, + + {"xsane-contrast", xsane_rc_pref_double, DPOFFSET(contrast)}, + {"xsane-contrast-red", xsane_rc_pref_double, DPOFFSET(contrast_red)}, + {"xsane-contrast-green", xsane_rc_pref_double, DPOFFSET(contrast_green)}, + {"xsane-contrast-blue", xsane_rc_pref_double, DPOFFSET(contrast_blue)}, + + {"xsane-enhancement-rgb-default", xsane_rc_pref_int, DPOFFSET(enhancement_rgb_default)}, + {"xsane-negative", xsane_rc_pref_int, DPOFFSET(negative)}, + {"xsane-show-preview", xsane_rc_pref_int, DPOFFSET(show_preview)}, +}; + +/* ---------------------------------------------------------------------------------------------------------------- */ + +static void xsane_widget_get_uposition(GtkWidget *gtk_window, gint *x, gint *y) +{ +#ifdef XSANE_BUGGY_WINDOWMANAGER_WINDOW_POSITION + gdk_window_get_root_origin(gtk_window->window, x, y); +#else + gdk_window_get_deskrelative_origin(gtk_window->window, x, y); +#endif +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +static int xsane_device_preferences_load_values(Wire *w, SANE_Handle device) +{ + const SANE_Option_Descriptor *opt; + SANE_Word *word_array; + SANE_String name, str; + u_long *caused_reload; + SANE_Int num_options; + SANE_Status status; + int i, keep_going; + SANE_Word word; + SANE_Int info; + off_t offset; + size_t size; + char *buf; + + lseek(w->io.fd, 1, SEEK_SET); /* rewind file */ + xsane_rc_io_w_flush(w); + + offset = lseek(w->io.fd, 0, SEEK_CUR); /* remeber file position */ + + keep_going = 0; + + sane_control_option(device, 0, SANE_ACTION_GET_VALUE, &num_options, 0); + size = (num_options + BITS_PER_LONG - 1) / BITS_PER_LONG * sizeof(long); + caused_reload = alloca(size); + memset(caused_reload, 0, size); + + while (1) + { + xsane_rc_io_w_space(w, 3); + if (!w->status) + { + xsane_rc_io_w_string(w, &name); + } + + if (w->status == XSANE_EOF) /* eof */ + { + if (keep_going) /* we had a reload otpions? */ + { + lseek(w->io.fd, offset, SEEK_SET); /* rewind file to position of first run */ + xsane_rc_io_w_flush(w); + keep_going = 0; + continue; + } + return 0; + } + else if (w->status) /* error: skip line */ + { + w->status = 0; + xsane_rc_io_w_free(w, (WireCodecFunc) xsane_rc_io_w_string, &name); /* free string memory */ + xsane_rc_io_w_skip_newline(w); /* skip this line */ + continue; + } + + status = SANE_STATUS_GOOD; + info = 0; + for (i = 1; (opt = sane_get_option_descriptor(device, i)); ++i) /* search all options */ + { + if (!opt->name || strcmp(opt->name, name) != 0) /* test if option names are equal */ + { + continue; /* not equal, continue the search */ + } + + if (IS_SET(caused_reload, i)) + { + continue; /* option caused a reload, continue search ??? why? ??? */ + } + + switch (opt->type) + { + case SANE_TYPE_BOOL: + case SANE_TYPE_INT: + case SANE_TYPE_FIXED: + if (opt->size == sizeof(SANE_Word)) + { + xsane_rc_io_w_word(w, &word); + status = sane_control_option(device, i, SANE_ACTION_SET_VALUE, &word, &info); + } + else + { + SANE_Int len; + + xsane_rc_io_w_array(w, &len, (void **) &word_array, (WireCodecFunc) xsane_rc_io_w_word, sizeof(SANE_Word)); + status = sane_control_option(device, i, SANE_ACTION_SET_VALUE, word_array, &info); + w->direction = WIRE_FREE; + xsane_rc_io_w_array(w, &len, (void **) &word_array, (WireCodecFunc) xsane_rc_io_w_word, sizeof(SANE_Word)); + w->direction = WIRE_DECODE; + } + break; + + case SANE_TYPE_STRING: + xsane_rc_io_w_string(w, &str); + buf = malloc(opt->size); + if (!w->status) /* got a string ? */ + { + strncpy(buf, str, opt->size); + buf[opt->size - 1] = '\0'; + xsane_rc_io_w_free(w, (WireCodecFunc) xsane_rc_io_w_string, &str); + status = sane_control_option(device, i, SANE_ACTION_SET_VALUE, buf, &info); + } + break; + + case SANE_TYPE_BUTTON: + case SANE_TYPE_GROUP: + /* nothing to read for button and group */ + break; + } + break; /* option is set: do not continue search */ + } + xsane_rc_io_w_free(w, (WireCodecFunc) xsane_rc_io_w_string, &name); /* free string memory */ + + if (status == SANE_STATUS_GOOD && (info & SANE_INFO_RELOAD_OPTIONS)) + { + SET(caused_reload, i); + keep_going = 1; + } + } + return 0; +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +static int xsane_device_preferences_save_values(Wire *w, SANE_Handle device) +{ + const SANE_Option_Descriptor *opt; + size_t word_array_size = 0; + SANE_Word *word_array = 0; + size_t str_size = 0; + SANE_String str = 0; + SANE_Word word; + int i; + + for (i = 0; (opt = sane_get_option_descriptor(device, i)); ++i) + { + if ((opt->cap & (SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT)) != (SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT) || !opt->name) + /* if we can't query AND set the option, don't bother saving it */ + { + continue; + } + + switch (opt->type) + { + case SANE_TYPE_BOOL: + case SANE_TYPE_INT: + case SANE_TYPE_FIXED: + if (opt->size == sizeof(SANE_Word)) + { + if (sane_control_option(device, i, SANE_ACTION_GET_VALUE, &word, 0) != SANE_STATUS_GOOD) + { + continue; + } + xsane_rc_io_w_string(w, (SANE_String *) &opt->name); + xsane_rc_io_w_word(w, &word); + } + else + { + SANE_Int len = opt->size / sizeof(SANE_Word); + + if (opt->size > word_array_size) + { + word_array_size = ((opt->size + 32*sizeof(SANE_Word)) & ~(32*sizeof(SANE_Word) - 1)); + if (word_array) + { + word_array = realloc(word_array, word_array_size); + } + else + { + word_array = malloc(word_array_size); + } + + if (word_array == 0) + { + /* Malloc failed, so return an error. */ + w->status = ENOMEM; + return 1; + } + } + + if (sane_control_option(device, i, SANE_ACTION_GET_VALUE, word_array, 0) != SANE_STATUS_GOOD) + { + continue; + } + + xsane_rc_io_w_string(w, (SANE_String *) &opt->name); + xsane_rc_io_w_array(w, &len, (void **) &word_array, (WireCodecFunc) xsane_rc_io_w_word, sizeof(SANE_Word)); + } + break; + + case SANE_TYPE_STRING: + if (opt->size > str_size) + { + str_size = (opt->size + 1024) & ~1023; + + if (str) + { + str = realloc(str, str_size); + } + else + { + str = malloc(str_size); + } + + if (str == 0) + { + /* Malloc failed, so return an error. */ + w->status = ENOMEM; + return 1; + } + } + + if (sane_control_option(device, i, SANE_ACTION_GET_VALUE, str, 0) != SANE_STATUS_GOOD) + { + continue; + } + + xsane_rc_io_w_string(w, (SANE_String *) &opt->name); + xsane_rc_io_w_string(w, &str); + break; + + case SANE_TYPE_BUTTON: + case SANE_TYPE_GROUP: + break; + } + } + + if (word_array) + { + free(word_array); + } + if (str) + { + free(str); + } + + return 0; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_device_preferences_load_file(char *filename) +{ + int fd; + char buf[256]; +#if 0 + char *version = 0; +#endif + Wire w; + SANE_String name; + int i; + + /* set geometry and position to standard values */ + xsane.shell_posx = XSANE_SHELL_POS_X; + xsane.shell_posy = XSANE_SHELL_POS_Y; + xsane.shell_width = XSANE_SHELL_WIDTH; + xsane.shell_height = XSANE_SHELL_HEIGHT; + + xsane.standard_options_shell_posx = XSANE_STD_OPTIONS_POS_X; + xsane.standard_options_shell_posy = XSANE_STD_OPTIONS_POS_Y; + + xsane.advanced_options_shell_posx = XSANE_ADV_OPTIONS_POS_X; + xsane.advanced_options_shell_posy = XSANE_ADV_OPTIONS_POS_Y; + + xsane.histogram_dialog_posx = XSANE_HISTOGRAM_POS_X; + xsane.histogram_dialog_posy = XSANE_HISTOGRAM_POS_Y; + + xsane.preview_dialog_posx = XSANE_PREVIEW_POS_X; + xsane.preview_dialog_posy = XSANE_PREVIEW_POS_Y; + xsane.preview_dialog_width = XSANE_PREVIEW_WIDTH; + xsane.preview_dialog_height = XSANE_PREVIEW_HEIGHT; + + xsane.gamma = 1.0; + xsane.gamma_red = 1.0; + xsane.gamma_green = 1.0; + xsane.gamma_blue = 1.0; + + xsane.brightness = 0.0; + xsane.brightness_red = 0.0; + xsane.brightness_green = 0.0; + xsane.brightness_blue = 0.0; + + xsane.contrast = 0.0; + xsane.contrast_red = 0.0; + xsane.contrast_green = 0.0; + xsane.contrast_blue = 0.0; + + xsane.enhancement_rgb_default = 1; + xsane.negative = 0; + xsane.show_preview = 1; + + fd = open(filename, O_RDONLY); + if (fd >= 0) + { + /* prepare wire */ + w.io.fd = fd; + w.io.read = read; + w.io.write = write; + xsane_rc_io_w_init(&w); + xsane_rc_io_w_set_dir(&w, WIRE_DECODE); + + xsane_rc_io_w_space(&w, 3); + if (!w.status) + { + xsane_rc_io_w_string(&w, &name); /* get string */ + if (!w.status) + { + if (strcmp(name, "XSANE_DEVICE_RC")) /* no real *.drc file */ + { + w.status = -1; /* no *.drc file => error */ + } + } + } + + if (w.status) + { + char buf[256]; + + snprintf(buf, sizeof(buf), "%s\n%s %s", ERR_LOAD_DEVICE_SETTINGS, filename, ERR_NO_DRC_FILE); + xsane_back_gtk_error(buf, TRUE); + close(fd); + return; + } + + xsane_rc_io_w_space(&w, 3); + if (!w.status) + { + xsane_rc_io_w_string(&w, &name); /* get string */ + if (!w.status) + { + if (strcmp(name, xsane.device_set_filename)) + { + snprintf(buf, sizeof(buf), "%s \"%s\"\n" + "%s \"%s\",\n" + "%s \"%s\",\n" + "%s", + TEXT_FILE, filename, + ERR_CREATED_FOR_DEVICE, name, + ERR_USED_FOR_DEVICE, xsane.device_set_filename, + ERR_MAY_CAUSE_PROBLEMS); + if (xsane_back_gtk_decision(ERR_HEADER_WARNING, (gchar **) error_xpm, buf, ERR_BUTTON_OK, BUTTON_CANCEL, TRUE) == FALSE) + { /* cancel */ + close(fd); + return; + } + } + } + } + + if (w.status) + { + /* may be we should pop up a window here */ + close(fd); + return; + } + + +#if 0 +/* add here: read version info */ +#if 0 + while (!feof(file)) + { + fgets(option, sizeof(option), file); /* get option name */ + option[strlen(option)-1] = 0; /* remove cr */ + if (strcmp(option, "\"xsane-version\"") == 0) + { + fgets(option, sizeof(option), file); /* get version */ + option[strlen(option)-1] = 0; /* remove cr */ + len = strlen(option); + if (len) + { + if (option[len-1] == 34) + { + option[len-1] = 0; /* remove " */ + } + } + version = strdup(option+1); + } + else + { + fgets(option, sizeof(option), file); /* skip option */ + } + } +#endif + + + if (version) + { + if (strcmp(version, XSANE_VERSION)) + { + snprintf(buf, sizeof(buf), "File: \"%s\"\n" + "has been saved with xsane-%s,\n" + "this may cause problems!", filename, version); + xsane_back_gtk_warning(buf, TRUE); + } + free(version); + } + else + { + snprintf(buf, sizeof(buf), "File: \"%s\"\n" + "has been saved with xsane before version 0.40,\n" + "this may cause problems!", filename); + xsane_back_gtk_warning(buf, TRUE); + } +#endif + + + + while (1) /* read device dependant xsane options */ + { + xsane_rc_io_w_space(&w, 3); + if (w.status) + { + break; + } + + xsane_rc_io_w_string(&w, &name); + + if (!w.status && name) + { + for (i = 0; i < NELEMS (desc_xsane_device); ++i) + { + if (strcmp(name, desc_xsane_device[i].name) == 0) + { + (*desc_xsane_device[i].codec) (&w, &xsane, desc_xsane_device[i].offset); + break; /* leave for loop */ + } + } + } + w.status = 0; + } + + xsane_device_preferences_load_values(&w, dialog->dev); /* read device preferences */ + close(fd); + + if (dialog->well_known.dpi > 0) + { + const SANE_Option_Descriptor *opt; + + opt = sane_get_option_descriptor(dialog->dev, dialog->well_known.dpi); + + switch (opt->type) + { + case SANE_TYPE_INT: + { + SANE_Int dpi; + sane_control_option(dialog->dev, dialog->well_known.dpi, SANE_ACTION_GET_VALUE, &dpi, 0); + xsane.resolution = dpi; + } + break; + + case SANE_TYPE_FIXED: + { + SANE_Fixed dpi; + sane_control_option(dialog->dev, dialog->well_known.dpi, SANE_ACTION_GET_VALUE, &dpi, 0); + xsane.resolution = (int) SANE_UNFIX(dpi); + } + break; + + default: + fprintf(stderr, "xsane_pref_load_file: %s %d\n", ERR_UNKNOWN_TYPE, opt->type); + return; + } + } + } + + gtk_widget_set_uposition(xsane.shell, xsane.shell_posx, xsane.shell_posy); + gtk_window_set_default_size(GTK_WINDOW(xsane.shell), xsane.shell_width, xsane.shell_height); + gtk_widget_set_uposition(xsane.standard_options_shell, xsane.standard_options_shell_posx, xsane.standard_options_shell_posy); + gtk_widget_set_uposition(xsane.advanced_options_shell, xsane.advanced_options_shell_posx, xsane.advanced_options_shell_posy); + gtk_widget_set_uposition(xsane.histogram_dialog, xsane.histogram_dialog_posx, xsane.histogram_dialog_posy); + gtk_widget_set_uposition(xsane.preview->top, xsane.preview_dialog_posx, xsane.preview_dialog_posy); + gtk_window_set_default_size(GTK_WINDOW(xsane.preview->top), xsane.preview_dialog_width, xsane.preview_dialog_height); + + xsane_refresh_dialog(dialog); + xsane_enhancement_by_gamma(); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_device_preferences_restore(void) +{ + char filename[PATH_MAX]; + struct stat st; + + xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", 0, 0, xsane.device_set_filename, ".drc", XSANE_PATH_LOCAL_SANE); + + if (stat(filename, &st) >= 0) + { + xsane_device_preferences_load_file(filename); + } + else /* no local sane file, look for system file */ + { + xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", 0, 0, xsane.device_set_filename, ".drc", XSANE_PATH_SYSTEM); + xsane_device_preferences_load_file(filename); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_device_preferences_load(void) +{ + char filename[PATH_MAX]; + char windowname[256]; + + xsane_set_sensitivity(FALSE); + + sprintf(windowname, "%s %s %s", prog_name, WINDOW_LOAD_SETTINGS, device_text); + xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", 0, 0, xsane.device_set_filename, ".drc", XSANE_PATH_LOCAL_SANE); + xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, FALSE); + xsane_device_preferences_load_file(filename); + xsane_set_sensitivity(TRUE); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#define XSANE_RC_IO_W_STRINGCONST(wire, string) { SANE_String str=string; xsane_rc_io_w_string(wire, &str); } + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_device_preferences_save(GtkWidget *widget, gpointer data) +{ + char filename[PATH_MAX]; + char windowname[256]; + int fd; + Wire w; + int i; + + xsane_set_sensitivity(FALSE); + + sprintf(windowname, "%s %s %s", prog_name, WINDOW_SAVE_SETTINGS, device_text); + xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", 0, 0, xsane.device_set_filename, ".drc", XSANE_PATH_LOCAL_SANE); + xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, FALSE); + + umask(XSANE_DEFAULT_UMASK); /* define new file permissions */ + fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); + if (fd < 0) + { + char buf[256]; + + snprintf(buf, sizeof(buf), "%s %s.", ERR_FAILED_CREATE_FILE, strerror(errno)); + xsane_back_gtk_error(buf, TRUE); + xsane_set_sensitivity(TRUE); + return; + } + + /* prepare wire */ + w.io.fd = fd; + w.io.read = read; + w.io.write = write; + xsane_rc_io_w_init(&w); + xsane_rc_io_w_set_dir(&w, WIRE_ENCODE); + + XSANE_RC_IO_W_STRINGCONST(&w, "XSANE_DEVICE_RC"); + xsane_rc_io_w_string(&w, &xsane.device_set_filename); + + XSANE_RC_IO_W_STRINGCONST(&w, "xsane-version"); + XSANE_RC_IO_W_STRINGCONST(&w, XSANE_VERSION); + + /* make geometry and position values up to date */ + xsane_widget_get_uposition(xsane.shell, &xsane.shell_posx, &xsane.shell_posy); +#if 0 +/* other possibillities: */ + gdk_window_get_deskrelative_origin(xsane.shell->window, &xsane.shell_posx, &xsane.shell_posy); + gdk_window_get_origin(xsane.shell->window, &xsane.shell_posx, &xsane.shell_posy); + gdk_window_get_position(xsane.shell->window, &xsane.shell_posx, &xsane.shell_posy); + gdk_window_get_geometry(xsane.shell->window, ?); +#endif + gdk_window_get_size(xsane.shell->window, &xsane.shell_width, &xsane.shell_height); + gtk_widget_set_uposition(xsane.shell, xsane.shell_posx, xsane.shell_posy); /* geometry used when window closed and opened again */ + gtk_window_set_default_size(GTK_WINDOW(xsane.shell), xsane.shell_width, xsane.shell_height); + + xsane_widget_get_uposition(xsane.standard_options_shell, &xsane.standard_options_shell_posx, &xsane.standard_options_shell_posy); + gtk_widget_set_uposition(xsane.standard_options_shell, xsane.standard_options_shell_posx, xsane.standard_options_shell_posy); + + xsane_widget_get_uposition(xsane.advanced_options_shell, &xsane.advanced_options_shell_posx, &xsane.advanced_options_shell_posy); + gtk_widget_set_uposition(xsane.advanced_options_shell, xsane.advanced_options_shell_posx, xsane.advanced_options_shell_posy); + + xsane_widget_get_uposition(xsane.histogram_dialog, &xsane.histogram_dialog_posx, &xsane.histogram_dialog_posy); + gtk_widget_set_uposition(xsane.histogram_dialog, xsane.histogram_dialog_posx, xsane.histogram_dialog_posy); + + if (xsane.preview) + { + xsane_widget_get_uposition(xsane.preview->top, &xsane.preview_dialog_posx, &xsane.preview_dialog_posy); + gdk_window_get_size(xsane.preview->top->window, &xsane.preview_dialog_width, &xsane.preview_dialog_height); + gtk_widget_set_uposition(xsane.preview->top, xsane.preview_dialog_posx, xsane.preview_dialog_posy); + gtk_window_set_default_size(GTK_WINDOW(xsane.preview->top), xsane.preview_dialog_width, xsane.preview_dialog_height); + } + + xsane_device_preferences_save_values(&w, dialog->dev); + + for (i = 0; i < NELEMS(desc_xsane_device); ++i) /* save device preferences xsane values */ + { + xsane_rc_io_w_string(&w, &desc_xsane_device[i].name); + (*desc_xsane_device[i].codec) (&w, &xsane, desc_xsane_device[i].offset); + } + + xsane_rc_io_w_flush(&w); + close(fd); + + xsane_set_sensitivity(TRUE); +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + diff --git a/frontend/xsane-device-preferences.c.old b/frontend/xsane-device-preferences.c.old new file mode 100644 index 0000000..aa4d8b8 --- /dev/null +++ b/frontend/xsane-device-preferences.c.old @@ -0,0 +1,761 @@ + +/* sane - Scanner Access Now Easy. + Copyright (C) 1999 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------- */ + +#include "xsane.h" +#include "xsane-rc-io.h" +#include "xsane-front-gtk.h" +#include "xsane-gamma.h" + +/* ---------------------------------------------------------------------------------------------------------------- */ + +#define BITS_PER_LONG (8*sizeof(u_long)) + +#define SET(set, bit) ((set)[(bit)/BITS_PER_LONG] |= (1UL << (bit)%BITS_PER_LONG)) +#define IS_SET(set, bit) (((set)[(bit)/BITS_PER_LONG] & (1UL << (bit)%BITS_PER_LONG)) != 0) + +/* ---------------------------------------------------------------------------------------------------------------- */ + +int xsane_device_preferences_load_values(int fd, SANE_Handle device) +{ + const SANE_Option_Descriptor *opt; + SANE_Word *word_array; + SANE_String name, str; + u_long *caused_reload; + SANE_Int num_options; + SANE_Status status; + int i, keep_going; + SANE_Word word; + SANE_Int info; + off_t offset; + size_t size; + char *buf; + Wire w; + + offset = lseek(fd, 0, SEEK_CUR); + w.io.fd = fd; + w.io.read = read; + w.io.write = write; + xsane_rc_io_w_init(&w); + xsane_rc_io_w_set_dir(&w, WIRE_DECODE); + keep_going = 0; + + sane_control_option(device, 0, SANE_ACTION_GET_VALUE, &num_options, 0); + size = (num_options + BITS_PER_LONG - 1) / BITS_PER_LONG * sizeof(long); + caused_reload = alloca(size); + memset(caused_reload, 0, size); + + while (1) + { + xsane_rc_io_w_space(&w, 3); + + if (!w.status) + { + xsane_rc_io_w_string(&w, &name); + } + + if (w.status) + { + if (keep_going) + { + lseek(fd, offset, SEEK_SET); + xsane_rc_io_w_set_dir(&w, WIRE_DECODE); + keep_going = 0; + continue; + } + return 0; + } + + status = SANE_STATUS_GOOD; + info = 0; + for (i = 1; (opt = sane_get_option_descriptor(device, i)); ++i) + { + if (!opt->name || strcmp(opt->name, name) != 0) + { + continue; + } + + if (IS_SET(caused_reload, i)) + { + continue; + } + + switch (opt->type) + { + case SANE_TYPE_BOOL: + case SANE_TYPE_INT: + case SANE_TYPE_FIXED: + if (opt->size == sizeof(SANE_Word)) + { + xsane_rc_io_w_word(&w, &word); + status = sane_control_option(device, i, SANE_ACTION_SET_VALUE, &word, &info); + } + else + { + SANE_Int len; + + xsane_rc_io_w_array(&w, &len, (void **) &word_array, (WireCodecFunc) xsane_rc_io_w_word, sizeof(SANE_Word)); + status = sane_control_option(device, i, SANE_ACTION_SET_VALUE, word_array, &info); + w.direction = WIRE_FREE; + xsane_rc_io_w_array(&w, &len, (void **) &word_array, (WireCodecFunc) xsane_rc_io_w_word, sizeof(SANE_Word)); + w.direction = WIRE_DECODE; + } + break; + + case SANE_TYPE_STRING: + xsane_rc_io_w_string(&w, &str); + buf = malloc(opt->size); + if (!w.status) /* got a string ? */ + { + strncpy(buf, str, opt->size); + buf[opt->size - 1] = '\0'; + xsane_rc_io_w_free(&w, (WireCodecFunc) xsane_rc_io_w_string, &str); + status = sane_control_option(device, i, SANE_ACTION_SET_VALUE, buf, &info); + } + break; + + case SANE_TYPE_BUTTON: + case SANE_TYPE_GROUP: + /* nothing to read for button and group */ + break; + } + break; + } + xsane_rc_io_w_free(&w, (WireCodecFunc) xsane_rc_io_w_string, &name); + + if (status == SANE_STATUS_GOOD && (info & SANE_INFO_RELOAD_OPTIONS)) + { + SET(caused_reload, i); + keep_going = 1; + } + } + return 0; +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +int xsane_device_preferences_save_values(int fd, SANE_Handle device) +{ + const SANE_Option_Descriptor *opt; + size_t word_array_size = 0; + SANE_Word *word_array = 0; + size_t str_size = 0; + SANE_String str = 0; + SANE_Word word; + Wire w; + int i; + + w.io.fd = fd; + w.io.read = read; + w.io.write = write; + xsane_rc_io_w_init(&w); + xsane_rc_io_w_set_dir(&w, WIRE_ENCODE); + + for (i = 0; (opt = sane_get_option_descriptor(device, i)); ++i) + { + if ((opt->cap & (SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT)) != (SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT) || !opt->name) + /* if we can't query AND set the option, don't bother saving it */ + { + continue; + } + + switch (opt->type) + { + case SANE_TYPE_BOOL: + case SANE_TYPE_INT: + case SANE_TYPE_FIXED: + if (opt->size == sizeof(SANE_Word)) + { + if (sane_control_option(device, i, SANE_ACTION_GET_VALUE, &word, 0) != SANE_STATUS_GOOD) + { + continue; + } + xsane_rc_io_w_string(&w, (SANE_String *) &opt->name); + xsane_rc_io_w_word(&w, &word); + } + else + { + SANE_Int len = opt->size / sizeof(SANE_Word); + + if (opt->size > word_array_size) + { + word_array_size = ((opt->size + 32*sizeof(SANE_Word)) & ~(32*sizeof(SANE_Word) - 1)); + if (word_array) + { + word_array = realloc(word_array, word_array_size); + } + else + { + word_array = malloc(word_array_size); + } + + if (word_array == 0) + { + /* Malloc failed, so return an error. */ + w.status = ENOMEM; + return 1; + } + } + + if (sane_control_option(device, i, SANE_ACTION_GET_VALUE, word_array, 0) != SANE_STATUS_GOOD) + { + continue; + } + + xsane_rc_io_w_string(&w, (SANE_String *) &opt->name); + xsane_rc_io_w_array(&w, &len, (void **) &word_array, (WireCodecFunc) xsane_rc_io_w_word, sizeof(SANE_Word)); + } + break; + + case SANE_TYPE_STRING: + if (opt->size > str_size) + { + str_size = (opt->size + 1024) & ~1023; + + if (str) + { + str = realloc(str, str_size); + } + else + { + str = malloc(str_size); + } + + if (str == 0) + { + /* Malloc failed, so return an error. */ + w.status = ENOMEM; + return 1; + } + } + + if (sane_control_option(device, i, SANE_ACTION_GET_VALUE, str, 0) != SANE_STATUS_GOOD) + { + continue; + } + + xsane_rc_io_w_string(&w, (SANE_String *) &opt->name); + xsane_rc_io_w_string(&w, &str); + break; + + case SANE_TYPE_BUTTON: + case SANE_TYPE_GROUP: + break; + } + } + xsane_rc_io_w_set_dir(&w, WIRE_DECODE); + + if (word_array) + { + free(word_array); + } + if (str) + { + free(str); + } + + return 0; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_device_preferences_load_file(char *filename) +{ + int fd; + FILE *file; + char buf[256]; + char option[256]; + char *optionp; + char *version = 0; + int len; + + int main_posx = XSANE_DIALOG_POS_X; + int main_posy = XSANE_DIALOG_POS_Y; + int main_width = XSANE_DIALOG_WIDTH; + int main_height = XSANE_DIALOG_HEIGHT; + + int standard_options_posx = XSANE_DIALOG_POS_X; + int standard_options_posy = XSANE_DIALOG_POS_Y2; + + int advanced_options_posx = XSANE_DIALOG_POS_X2; + int advanced_options_posy = XSANE_DIALOG_POS_Y2; + + int histogram_posx = XSANE_DIALOG_POS_X2; + int histogram_posy = XSANE_DIALOG_POS_Y; + + int preview_posx = 0; + int preview_posy = 0; + int preview_width = 0; + int preview_height = 0; + + file = fopen(filename, "r"); + if (file == 0) /* error ? */ + { + return; + } + + if (!feof(file)) + { + fgets(option, sizeof(option), file); /* get first line */ + option[strlen(option)-1] = 0; /* remove cr */ + + if (strcmp(option, "\"XSANE_DEVICE_RC\"") != 0) /* wrong file format ? */ + { + char buf[256]; + + snprintf(buf, sizeof(buf), "%s\n%s %s", ERR_LOAD_DEVICE_SETTINGS, filename, ERR_NO_DRC_FILE); + xsane_back_gtk_error(buf, TRUE); + return; + } + + if (!feof(file)) + { + fgets(option, sizeof(option), file); /* get version */ + option[strlen(option)-1] = 0; /* remove cr */ + len = strlen(option); + if (len) + { + if (option[len-1] == 34) + { + option[len-1] = 0; /* remove " */ + } + } + optionp = option+1; + + if (strcmp(optionp, xsane.device_set_filename)) + { + snprintf(buf, sizeof(buf), "%s \"%s\"\n" + "%s \"%s\",\n" + "%s \"%s\",\n" + "%s", + TEXT_FILE, filename, + ERR_CREATED_FOR_DEVICE, optionp, + ERR_USED_FOR_DEVICE, xsane.device_set_filename, + ERR_MAY_CAUSE_PROBLEMS); + if (xsane_back_gtk_decision(ERR_HEADER_WARNING, buf, ERR_BUTTON_OK, BUTTON_CANCEL, TRUE) == FALSE) + { /* cancel */ + fclose(file); + return; + } + } + } + } + + while (!feof(file)) + { + fgets(option, sizeof(option), file); /* get option name */ + option[strlen(option)-1] = 0; /* remove cr */ + if (strcmp(option, "\"xsane-version\"") == 0) + { + fgets(option, sizeof(option), file); /* get version */ + option[strlen(option)-1] = 0; /* remove cr */ + len = strlen(option); + if (len) + { + if (option[len-1] == 34) + { + option[len-1] = 0; /* remove " */ + } + } + version = strdup(option+1); + } + else if (strcmp(option, "\"xsane-gamma\"") == 0) + { + fscanf(file, "%lf\n", &xsane.gamma); + } + else if (strcmp(option, "\"xsane-gamma-red\"") == 0) + { + fscanf(file, "%lf\n", &xsane.gamma_red); + } + else if (strcmp(option, "\"xsane-gamma-green\"") == 0) + { + fscanf(file, "%lf\n", &xsane.gamma_green); + } + else if (strcmp(option, "\"xsane-gamma-blue\"") == 0) + { + fscanf(file, "%lf\n", &xsane.gamma_blue); + } + else if (strcmp(option, "\"xsane-brightness\"") == 0) + { + fscanf(file, "%lf\n", &xsane.brightness); + } + else if (strcmp(option, "\"xsane-brightness-red\"") == 0) + { + fscanf(file, "%lf\n", &xsane.brightness_red); + } + else if (strcmp(option, "\"xsane-brightness-green\"") == 0) + { + fscanf(file, "%lf\n", &xsane.brightness_green); + } + else if (strcmp(option, "\"xsane-brightness-blue\"") == 0) + { + fscanf(file, "%lf\n", &xsane.brightness_blue); + } + else if (strcmp(option, "\"xsane-contrast\"") == 0) + { + fscanf(file, "%lf\n", &xsane.contrast); + } + else if (strcmp(option, "\"xsane-contrast-red\"") == 0) + { + fscanf(file, "%lf\n", &xsane.contrast_red); + } + else if (strcmp(option, "\"xsane-contrast-green\"") == 0) + { + fscanf(file, "%lf\n", &xsane.contrast_green); + } + else if (strcmp(option, "\"xsane-contrast-blue\"") == 0) + { + fscanf(file, "%lf\n", &xsane.contrast_blue); + } + else if (strcmp(option, "\"xsane-enhancement-rgb-default\"") == 0) + { + fscanf(file, "%d\n", &xsane.enhancement_rgb_default); + } + else if (strcmp(option, "\"xsane-negative\"") == 0) + { + fscanf(file, "%d\n", &xsane.negative); + } + else if (strcmp(option, "\"xsane-show-preview\"") == 0) + { + fscanf(file, "%d\n", &xsane.show_preview); + } + else if (strcmp(option, "\"xsane-main-window-x-position\"") == 0) + { + fscanf(file, "%d\n", &main_posx); + } + else if (strcmp(option, "\"xsane-main-window-y-position\"") == 0) + { + fscanf(file, "%d\n", &main_posy); + } + else if (strcmp(option, "\"xsane-main-window-width\"") == 0) + { + fscanf(file, "%d\n", &main_width); + } + else if (strcmp(option, "\"xsane-main-window-height\"") == 0) + { + fscanf(file, "%d\n", &main_height); + } + else if (strcmp(option, "\"xsane-standard-options-window-x-position\"") == 0) + { + fscanf(file, "%d\n", &standard_options_posx); + } + else if (strcmp(option, "\"xsane-standard-options-window-y-position\"") == 0) + { + fscanf(file, "%d\n", &standard_options_posy); + } + else if (strcmp(option, "\"xsane-advanced-options-window-x-position\"") == 0) + { + fscanf(file, "%d\n", &advanced_options_posx); + } + else if (strcmp(option, "\"xsane-advanced-options-window-y-position\"") == 0) + { + fscanf(file, "%d\n", &advanced_options_posy); + } + else if (strcmp(option, "\"xsane-histogram-window-x-position\"") == 0) + { + fscanf(file, "%d\n", &histogram_posx); + } + else if (strcmp(option, "\"xsane-histogram-window-y-position\"") == 0) + { + fscanf(file, "%d\n", &histogram_posy); + } + else if (strcmp(option, "\"xsane-preview-window-x-position\"") == 0) + { + fscanf(file, "%d\n", &preview_posx); + } + else if (strcmp(option, "\"xsane-preview-window-y-position\"") == 0) + { + fscanf(file, "%d\n", &preview_posy); + } + else if (strcmp(option, "\"xsane-preview-window-width\"") == 0) + { + fscanf(file, "%d\n", &preview_width); + } + else if (strcmp(option, "\"xsane-preview-window-height\"") == 0) + { + fscanf(file, "%d\n", &preview_height); + } + else + { + fgets(option, sizeof(option), file); /* skip option */ + } + } + fclose(file); + +#if 0 + if (version) + { + if (strcmp(version, XSANE_VERSION)) + { + snprintf(buf, sizeof(buf), "File: \"%s\"\n" + "has been saved with xsane-%s,\n" + "this may cause problems!", filename, version); + xsane_back_gtk_warning(buf, TRUE); + } + free(version); + } + else + { + snprintf(buf, sizeof(buf), "File: \"%s\"\n" + "has been saved with xsane before version 0.40,\n" + "this may cause problems!", filename); + xsane_back_gtk_warning(buf, TRUE); + } +#endif + + + gtk_widget_set_uposition(xsane.shell, main_posx, main_posy); + gtk_widget_set_uposition(xsane.standard_options_shell, standard_options_posx, standard_options_posy); + gtk_widget_set_uposition(xsane.advanced_options_shell, advanced_options_posx, advanced_options_posy); + gtk_widget_set_uposition(xsane.histogram_dialog, histogram_posx, histogram_posy); + + if (xsane.preview) + { + gtk_widget_set_uposition(xsane.preview->top, preview_posx, preview_posy); + } + + gtk_window_set_default_size(GTK_WINDOW(xsane.shell), main_width, main_height); + + if (xsane.preview) + { + gtk_window_set_default_size(GTK_WINDOW(xsane.preview->top), preview_width, preview_height); + } + + + fd = open(filename, O_RDONLY); + if (fd < 0) + { + return; + } + xsane_device_preferences_load_values(fd, dialog->dev); + close(fd); + + if (dialog->well_known.dpi > 0) + { + const SANE_Option_Descriptor *opt; + + opt = sane_get_option_descriptor(dialog->dev, dialog->well_known.dpi); + + switch (opt->type) + { + case SANE_TYPE_INT: + { + SANE_Int dpi; + sane_control_option(dialog->dev, dialog->well_known.dpi, SANE_ACTION_GET_VALUE, &dpi, 0); + xsane.resolution = dpi; + } + break; + + case SANE_TYPE_FIXED: + { + SANE_Fixed dpi; + sane_control_option(dialog->dev, dialog->well_known.dpi, SANE_ACTION_GET_VALUE, &dpi, 0); + xsane.resolution = (int) SANE_UNFIX(dpi); + } + break; + + default: + fprintf(stderr, "xsane_pref_load_file: %s %d\n", ERR_UNKNOWN_TYPE, opt->type); + return; + } + } + + xsane_refresh_dialog(dialog); + xsane_enhancement_by_gamma(); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_device_preferences_restore(void) +{ + char filename[PATH_MAX]; + + xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", 0, 0, xsane.device_set_filename, ".drc"); + xsane_device_preferences_load_file(filename); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_device_preferences_load(void) +{ + char filename[PATH_MAX]; + char windowname[256]; + + xsane_set_sensitivity(FALSE); + + sprintf(windowname, "%s %s %s", prog_name, WINDOW_LOAD_SETTINGS, device_text); + xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", 0, 0, xsane.device_set_filename, ".drc"); + xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename); + xsane_device_preferences_load_file(filename); + xsane_set_sensitivity(TRUE); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_device_preferences_save(GtkWidget *widget, gpointer data) +{ + char filename[PATH_MAX]; + char windowname[256]; + int fd; + FILE *file; + int posx, posy, width, height; + + xsane_set_sensitivity(FALSE); + + sprintf(windowname, "%s %s %s", prog_name, WINDOW_SAVE_SETTINGS, device_text); + xsane_back_gtk_make_path(sizeof(filename), filename, "xsane", 0, 0, xsane.device_set_filename, ".drc"); + xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename); + + file = fopen(filename, "w"); + if (file == 0) + { + char buf[256]; + + snprintf(buf, sizeof(buf), "%s %s.", ERR_FAILED_CREATE_FILE, strerror(errno)); + xsane_back_gtk_error(buf, TRUE); + xsane_set_sensitivity(TRUE); + return; + } + + fprintf(file, "\"XSANE_DEVICE_RC\"\n"); + fprintf(file, "\"%s\"\n", xsane.device_set_filename); + fclose(file); + + fd = open(filename, O_WRONLY | O_APPEND , 0666); + if (fd < 0) + { + char buf[256]; + + snprintf(buf, sizeof(buf), "%s %s.", ERR_FAILED_CREATE_FILE, strerror(errno)); + xsane_back_gtk_error(buf, TRUE); + xsane_set_sensitivity(TRUE); + return; + } + xsane_device_preferences_save_values(fd, dialog->dev); + close(fd); + + + file = fopen(filename, "a"); + if (file == 0) + { + char buf[256]; + + snprintf(buf, sizeof(buf), "%s %s.", ERR_FAILED_CREATE_FILE, strerror(errno)); + xsane_back_gtk_error(buf, TRUE); + xsane_set_sensitivity(TRUE); + return; + } + + fprintf(file, "\"xsane-version\"\n"); + fprintf(file, "\"" XSANE_VERSION "\"\n"); + fprintf(file, "\"xsane-gamma\"\n"); + fprintf(file, "%f\n", xsane.gamma); + fprintf(file, "\"xsane-gamma-red\"\n"); + fprintf(file, "%f\n", xsane.gamma_red); + fprintf(file, "\"xsane-gamma-green\"\n"); + fprintf(file, "%f\n", xsane.gamma_green); + fprintf(file, "\"xsane-gamma-blue\"\n"); + fprintf(file, "%f\n", xsane.gamma_blue); + + fprintf(file, "\"xsane-brightness\"\n"); + fprintf(file, "%f\n", xsane.brightness); + fprintf(file, "\"xsane-brightness-red\"\n"); + fprintf(file, "%f\n", xsane.brightness_red); + fprintf(file, "\"xsane-brightness-green\"\n"); + fprintf(file, "%f\n", xsane.brightness_green); + fprintf(file, "\"xsane-brightness-blue\"\n"); + fprintf(file, "%f\n", xsane.brightness_blue); + + fprintf(file, "\"xsane-contrast\"\n"); + fprintf(file, "%f\n", xsane.contrast); + fprintf(file, "\"xsane-contrast-red\"\n"); + fprintf(file, "%f\n", xsane.contrast_red); + fprintf(file, "\"xsane-contrast-green\"\n"); + fprintf(file, "%f\n", xsane.contrast_green); + fprintf(file, "\"xsane-contrast-blue\"\n"); + fprintf(file, "%f\n", xsane.contrast_blue); + + fprintf(file, "\"xsane-enhancement-rgb-default\"\n"); + fprintf(file, "%d\n", xsane.enhancement_rgb_default); + + fprintf(file, "\"xsane-negative\"\n"); + fprintf(file, "%d\n", xsane.negative); + + gdk_window_get_root_origin(xsane.shell->window, &posx, &posy); + gdk_window_get_size(xsane.shell->window, &width, &height); + fprintf(file, "\"xsane-main-window-x-position\"\n"); + fprintf(file, "%d\n", posx); + fprintf(file, "\"xsane-main-window-y-position\"\n"); + fprintf(file, "%d\n", posy); + fprintf(file, "\"xsane-main-window-width\"\n"); + fprintf(file, "%d\n", width); + fprintf(file, "\"xsane-main-window-height\"\n"); + fprintf(file, "%d\n", height); + gtk_widget_set_uposition(xsane.shell, posx, posy); /* set default geometry used when window is closed and opened again */ + gtk_window_set_default_size(GTK_WINDOW(xsane.shell), width, height); + + gdk_window_get_root_origin(xsane.standard_options_shell->window, &posx, &posy); + fprintf(file, "\"xsane-standard-options-window-x-position\"\n"); + fprintf(file, "%d\n", posx); + fprintf(file, "\"xsane-standard-options-window-y-position\"\n"); + fprintf(file, "%d\n", posy); + gtk_widget_set_uposition(xsane.standard_options_shell, posx, posy); + + gdk_window_get_root_origin(xsane.advanced_options_shell->window, &posx, &posy); + fprintf(file, "\"xsane-advanced-options-window-x-position\"\n"); + fprintf(file, "%d\n", posx); + fprintf(file, "\"xsane-advanced-options-window-y-position\"\n"); + fprintf(file, "%d\n", posy); + gtk_widget_set_uposition(xsane.advanced_options_shell, posx, posy); + + gdk_window_get_root_origin(xsane.histogram_dialog->window, &posx, &posy); + fprintf(file, "\"xsane-histogram-window-x-position\"\n"); + fprintf(file, "%d\n", posx); + fprintf(file, "\"xsane-histogram-window-y-position\"\n"); + fprintf(file, "%d\n", posy); + gtk_widget_set_uposition(xsane.histogram_dialog, posx, posy); + + fprintf(file, "\"xsane-show-preview\"\n"); + fprintf(file, "%d\n", xsane.show_preview); + + if (xsane.preview) + { + gdk_window_get_root_origin(xsane.preview->top->window, &posx, &posy); + gdk_window_get_size(xsane.preview->top->window, &width, &height); + fprintf(file, "\"xsane-preview-window-x-position\"\n"); + fprintf(file, "%d\n", posx); + fprintf(file, "\"xsane-preview-window-y-position\"\n"); + fprintf(file, "%d\n", posy); + fprintf(file, "\"xsane-preview-window-width\"\n"); + fprintf(file, "%d\n", width); + fprintf(file, "\"xsane-preview-window-height\"\n"); + fprintf(file, "%d\n", height); + gtk_widget_set_uposition(xsane.preview->top, posx, posy); + gtk_window_set_default_size(GTK_WINDOW(xsane.preview->top), width, height); + } + + fclose(file); + + xsane_set_sensitivity(TRUE); +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + diff --git a/frontend/xsane-device-preferences.h b/frontend/xsane-device-preferences.h new file mode 100644 index 0000000..a372f2e --- /dev/null +++ b/frontend/xsane-device-preferences.h @@ -0,0 +1,42 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-device-preferences.h + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#ifndef xsane_device_preferences_h +#define xsane_device_preferences_h + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#include +#include "xsane.h" + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +extern void xsane_device_preferences_save(GtkWidget *widget, gpointer data); +extern void xsane_device_preferences_restore(void); +extern void xsane_device_preferences_load(void); +extern void xsane_device_preferences_load_file(char *filename); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#endif diff --git a/frontend/xsane-front-gtk.c b/frontend/xsane-front-gtk.c new file mode 100644 index 0000000..fca864e --- /dev/null +++ b/frontend/xsane-front-gtk.c @@ -0,0 +1,798 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-front-gtk.c + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#include "xsane.h" +#include "xsane-back-gtk.h" +#include "xsane-preferences.h" +#include "xsane-preview.h" +#include "xsane-save.h" +#include "xsane-text.h" +#include "xsane-gamma.h" +#include "xsane-setup.h" + +#ifdef HAVE_LIBPNG +#ifdef HAVE_LIBZ +#include +#include +#endif +#endif + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +/* forward declarations: */ + +void xsane_get_bounds(const SANE_Option_Descriptor *opt, double *minp, double *maxp); +int xsane_set_resolution(int well_known_option, int resolution); +void xsane_set_all_resolutions(void); +void xsane_define_maximum_output_size(); +void xsane_close_dialog_callback(GtkWidget *widget, gpointer data); +void xsane_authorization_button_callback(GtkWidget *widget, gpointer data); +gint xsane_authorization_callback(SANE_String_Const resource, + SANE_Char username[SANE_MAX_USERNAME_LEN], + SANE_Char password[SANE_MAX_PASSWORD_LEN]); +void xsane_progress_cancel(GtkWidget *widget, gpointer data); +XsaneProgress_t *xsane_progress_new(char *title, char *text, GtkSignalFunc callback, gpointer callback_data); +void xsane_progress_free(XsaneProgress_t *p); +void xsane_progress_update(XsaneProgress_t *p, gfloat newval); +void xsane_toggle_button_new_with_pixmap(GtkWidget *parent, const char *xpm_d[], const char *desc, + int *state, void *xsane_toggle_button_callback); +GtkWidget *xsane_button_new_with_pixmap(GtkWidget *parent, const char *xpm_d[], const char *desc, + void *xsane_button_callback, gpointer data); +void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, int option_number, const char *desc, + void *option_menu_callback, SANE_Int settable, const gchar *widget_name); +void xsane_option_menu_new_with_pixmap(GtkBox *parent, const char *xpm_d[], const char *desc, + char *str_list[], const char *val, + GtkObject **data, int option, + void *option_menu_callback, SANE_Int settable, const gchar *widget_name); +void xsane_scale_new(GtkBox *parent, char *labeltext, const char *desc, + float min, float max, float quant, float step, float page_step, + int digits, double *val, GtkObject **data, void *xsane_scale_callback, SANE_Int settable); +void xsane_scale_new_with_pixmap(GtkBox *parent, const char *xpm_d[], const char *desc, + float min, float max, float quant, float step, float page_step, int digits, + double *val, GtkObject **data, int option, void *xsane_scale_callback, SANE_Int settable); +void xsane_separator_new(GtkWidget *xsane_parent, int dist); +GtkWidget *xsane_info_table_text_new(GtkWidget *table, gchar *text, int row, int colomn); +GtkWidget *xsane_info_text_new(GtkWidget *parent, gchar *text); +void xsane_refresh_dialog(void *nothing); +void xsane_set_sensitivity(SANE_Int sensitivity); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_get_bounds(const SANE_Option_Descriptor *opt, double *minp, double *maxp) +{ + double min, max; + int i; + + min = -INF; + max = INF; + switch (opt->constraint_type) + { + case SANE_CONSTRAINT_RANGE: + min = opt->constraint.range->min; + max = opt->constraint.range->max; + break; + + case SANE_CONSTRAINT_WORD_LIST: + min = INF; + max = -INF; + + for (i = 1; i <= opt->constraint.word_list[0]; ++i) + { + if (opt->constraint.word_list[i] < min) + { + min = opt->constraint.word_list[i]; + } + if (opt->constraint.word_list[i] > max) + { + max = opt->constraint.word_list[i]; + } + } + break; + + default: + break; + } + + if (opt->type == SANE_TYPE_FIXED) + { + if (min > -INF && min < INF) + { + min = SANE_UNFIX (min); + } + if (max > -INF && max < INF) + { + max = SANE_UNFIX (max); + } + } + *minp = min; + *maxp = max; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +int xsane_set_resolution(int well_known_option, int resolution) +{ + const SANE_Option_Descriptor *opt; + SANE_Word dpi; + SANE_Word bestdpi; + SANE_Word diff; + SANE_Word val; + int items; + int i; + + opt = sane_get_option_descriptor(dialog->dev, well_known_option); + + if (!opt) + { + return -1; /* option does not exits */ + } + + if (opt->constraint_type == SANE_CONSTRAINT_RANGE) + { + switch (opt->type) + { + case SANE_TYPE_INT: + dpi = resolution; + break; + + case SANE_TYPE_FIXED: + dpi = SANE_FIX(resolution); + break; + + default: + fprintf(stderr, "set_resolution: %s %d\n", ERR_UNKNOWN_TYPE, opt->type); + return 1; /* error */ + } + } + else if (opt->constraint_type == SANE_CONSTRAINT_WORD_LIST) + { + switch (opt->type) + { + case SANE_TYPE_INT: + dpi = resolution; + break; + + case SANE_TYPE_FIXED: + dpi = SANE_FIX(resolution); + break; + + default: + fprintf(stderr, "set_resolution: %s %d\n", ERR_UNKNOWN_TYPE, opt->type); + return 1; /* error */ + } + + items = opt->constraint.word_list[0]; + bestdpi = opt->constraint.word_list[1]; + diff = abs(bestdpi - dpi); + + for (i=1; i<=items; i++) + { + val = opt->constraint.word_list[i]; + if (abs(val - dpi) < diff) + { + diff = abs(val - dpi); + bestdpi = val; + } + } + + if (bestdpi == -1) + { + fprintf(stderr, "set_resolution: %s\n", ERR_FAILED_SET_RESOLUTION); + return -1; + } + dpi = bestdpi; + } + else + { + fprintf(stderr, "set_resolution: %s %d\n", ERR_UNKNOWN_CONSTRAINT_TYPE, opt->constraint_type); + return 1; /* error */ + } + + sane_control_option(dialog->dev, well_known_option, SANE_ACTION_SET_VALUE, &dpi, 0); + return 0; /* everything is ok */ +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_set_all_resolutions(void) +{ + xsane_set_resolution(dialog->well_known.dpi_y, xsane.resolution_y); /* set y resolution if possible */ + if (xsane_set_resolution(dialog->well_known.dpi_x, xsane.resolution_x)) /* set x resolution if possible */ + { + xsane_set_resolution(dialog->well_known.dpi, xsane.resolution); /* set common resolution if necessary */ + xsane.resolution_x = xsane.resolution; + xsane.resolution_y = xsane.resolution; + } + + xsane.zoom = xsane.resolution / preferences.printer[preferences.printernr]->resolution; + xsane.zoom_x = xsane.resolution_x / preferences.printer[preferences.printernr]->resolution; + xsane.zoom_y = xsane.resolution_y / preferences.printer[preferences.printernr]->resolution; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_define_maximum_output_size() +{ + const SANE_Option_Descriptor *opt; + + opt = sane_get_option_descriptor(dialog->dev, dialog->well_known.coord[0]); + + if ( (opt) && (opt->unit== SANE_UNIT_MM) ) + { + if (xsane.xsane_mode == XSANE_COPY) + { + if (preferences.psrotate) /* rotate: landscape */ + { + preview_set_maximum_output_size(xsane.preview, + preferences.printer[preferences.printernr]->height / xsane.zoom_y, + preferences.printer[preferences.printernr]->width / xsane.zoom_x); + } + else /* do not rotate: portrait */ + { + preview_set_maximum_output_size(xsane.preview, + preferences.printer[preferences.printernr]->width / xsane.zoom_x, + preferences.printer[preferences.printernr]->height / xsane.zoom_y); + } + } + else if (xsane.xsane_mode == XSANE_FAX) + { + preview_set_maximum_output_size(xsane.preview, preferences.fax_width, preferences.fax_height); + } + else + { + preview_set_maximum_output_size(xsane.preview, INF, INF); + } + } + else + { + preview_set_maximum_output_size(xsane.preview, INF, INF); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_close_dialog_callback(GtkWidget *widget, gpointer data) +{ + GtkWidget *dialog = data; + + gtk_widget_destroy(dialog); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +int authorization_flag; + +void xsane_authorization_button_callback(GtkWidget *widget, gpointer data) +{ + authorization_flag = (long) data; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +gint xsane_authorization_callback(SANE_String_Const resource, + SANE_Char username[SANE_MAX_USERNAME_LEN], + SANE_Char password[SANE_MAX_PASSWORD_LEN]) +{ + GtkWidget *authorize_dialog, *vbox, *hbox, *button, *label; + GtkWidget *username_widget, *password_widget; + char buf[256]; + char *input; + int len; + + authorize_dialog = gtk_window_new(GTK_WINDOW_DIALOG); + gtk_window_set_position(GTK_WINDOW(authorize_dialog), GTK_WIN_POS_CENTER); + gtk_window_set_policy(GTK_WINDOW(authorize_dialog), FALSE, FALSE, FALSE); + gtk_signal_connect(GTK_OBJECT(authorize_dialog), "delete_event", + GTK_SIGNAL_FUNC(xsane_authorization_button_callback), (void *) -1); /* -1 = cancel */ + snprintf(buf, sizeof(buf), "%s %s", prog_name, WINDOW_AUTHORIZE); + gtk_window_set_title(GTK_WINDOW(authorize_dialog), buf); + xsane_set_window_icon(authorize_dialog, 0); + + vbox = gtk_vbox_new(/* not homogeneous */ FALSE, 10); /* y-space between all box items */ + gtk_container_add(GTK_CONTAINER(authorize_dialog), vbox); + gtk_widget_show(vbox); + + snprintf(buf, sizeof(buf), "\n\n%s %s\n", TEXT_AUTHORIZATION_REQ, resource); + label = gtk_label_new(buf); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); /* y-space around authorization text */ + gtk_widget_show(label); + + /* ask for username */ + hbox = gtk_hbox_new(FALSE, 10); /* x-space between label and input filed */ + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); /* y-space around inner items */ + + label = gtk_label_new(TEXT_USERNAME); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10); /* x-space around label */ + gtk_widget_show(label); + + username_widget = gtk_entry_new_with_max_length(SANE_MAX_USERNAME_LEN-1); + gtk_widget_set_usize(username_widget, 250, 0); + gtk_entry_set_text(GTK_ENTRY(username_widget), ""); + gtk_box_pack_end(GTK_BOX(hbox), username_widget, FALSE, FALSE, 10); /* x-space around input filed */ + gtk_widget_show(username_widget); + gtk_widget_show(hbox); + + + /* ask for password */ + hbox = gtk_hbox_new(FALSE, 10); /* x-space between label and input filed */ + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); /* y-space around inner items */ + + label = gtk_label_new(TEXT_PASSWORD); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10); /* x-space around label */ + gtk_widget_show(label); + + password_widget = gtk_entry_new_with_max_length(SANE_MAX_PASSWORD_LEN-1); + gtk_entry_set_visibility(GTK_ENTRY(password_widget), FALSE); /* make entered text invisible */ + gtk_widget_set_usize(password_widget, 250, 0); + gtk_entry_set_text(GTK_ENTRY(password_widget), ""); + gtk_box_pack_end(GTK_BOX(hbox), password_widget, FALSE, FALSE, 10); /* x-space around input filed */ + gtk_widget_show(password_widget); + gtk_widget_show(hbox); + + /* buttons */ + hbox = gtk_hbox_new(TRUE, 10); /* x-space between buttons */ + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 10); /* y-space around buttons */ + + button = gtk_button_new_with_label(BUTTON_OK); + GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(xsane_authorization_button_callback), (void *) 1); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 10); /* x-space around OK-button */ + gtk_widget_grab_default(button); + gtk_widget_show(button); + + button = gtk_button_new_with_label(BUTTON_CANCEL); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(xsane_authorization_button_callback), (void *) -1); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 10); /* x-space around cancel-button */ + gtk_widget_show(button); + + gtk_widget_show(hbox); + + gtk_widget_show(authorize_dialog); + + + username[0]=0; + password[0]=0; + + authorization_flag = 0; + + /* wait for ok or cancel */ + while (authorization_flag == 0) + { + gtk_main_iteration(); + } + + if (authorization_flag == 1) /* 1=ok, -1=cancel */ + { + input = gtk_entry_get_text(GTK_ENTRY(username_widget)); + len = strlen(input); + memcpy(username, input, len); + username[len] = 0; + + input = gtk_entry_get_text(GTK_ENTRY(password_widget)); + len = strlen(input); + memcpy(password, input, len); + password[len] = 0; + } + gtk_widget_destroy(authorize_dialog); + return TRUE; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_progress_cancel(GtkWidget *widget, gpointer data) +{ + XsaneProgress_t *p = (XsaneProgress_t *) data; + + (*p->callback) (); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +XsaneProgress_t *xsane_progress_new(char *title, char *text, GtkSignalFunc callback, gpointer callback_data) +{ + GtkWidget *button, *label; + GtkBox *vbox, *hbox; + XsaneProgress_t *p; + static const int progress_x = 5; + static const int progress_y = 5; + + p = (XsaneProgress_t *) malloc(sizeof(XsaneProgress_t)); + p->callback = callback; + + p->shell = gtk_dialog_new(); + gtk_widget_set_uposition(p->shell, progress_x, progress_y); + gtk_window_set_title(GTK_WINDOW (p->shell), title); + + xsane_set_window_icon(p->shell, 0); + + vbox = GTK_BOX(GTK_DIALOG(p->shell)->vbox); + hbox = GTK_BOX(GTK_DIALOG(p->shell)->action_area); + + gtk_container_set_border_width(GTK_CONTAINER (vbox), 7); + + label = gtk_label_new(text); + gtk_misc_set_alignment(GTK_MISC (label), 0.0, 0.5); + gtk_box_pack_start(vbox, label, FALSE, TRUE, 0); + + p->pbar = gtk_progress_bar_new(); + gtk_widget_set_usize(p->pbar, 200, 20); + gtk_box_pack_start(vbox, p->pbar, TRUE, TRUE, 0); + + button = gtk_toggle_button_new_with_label(BUTTON_CANCEL); + gtk_signal_connect(GTK_OBJECT (button), "clicked", (GtkSignalFunc) xsane_progress_cancel, p); + gtk_box_pack_start(hbox, button, TRUE, TRUE, 0); + + gtk_widget_show(label); + gtk_widget_show(p->pbar); + gtk_widget_show(button); + gtk_widget_show(GTK_WIDGET (p->shell)); + return p; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_progress_free(XsaneProgress_t *p) +{ + if (p) + { + gtk_widget_destroy(p->shell); + free (p); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_progress_update(XsaneProgress_t *p, gfloat newval) +{ + if (p) + { + gtk_progress_bar_update(GTK_PROGRESS_BAR(p->pbar), newval); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_toggle_button_new_with_pixmap(GtkWidget *parent, const char *xpm_d[], const char *desc, + int *state, void *xsane_toggle_button_callback) +{ + GtkWidget *button; + GtkWidget *pixmapwidget; + GdkBitmap *mask; + GdkPixmap *pixmap; + + button = gtk_toggle_button_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, button, desc); + + pixmap = gdk_pixmap_create_from_xpm_d(xsane.histogram_dialog->window, &mask, xsane.bg_trans, (gchar **) xpm_d); + pixmapwidget = gtk_pixmap_new(pixmap, mask); + gtk_container_add(GTK_CONTAINER(button), pixmapwidget); + gtk_widget_show(pixmapwidget); + gdk_pixmap_unref(pixmap); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *state); + gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_toggle_button_callback, (GtkObject *)state); + gtk_box_pack_start(GTK_BOX(parent), button, FALSE, FALSE, 0); + gtk_widget_show(button); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +GtkWidget *xsane_button_new_with_pixmap(GtkWidget *parent, const char *xpm_d[], const char *desc, + void *xsane_button_callback, gpointer data) +{ + GtkWidget *button; + GtkWidget *pixmapwidget; + GdkBitmap *mask; + GdkPixmap *pixmap; + + button = gtk_button_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, button, desc); + + pixmap = gdk_pixmap_create_from_xpm_d(xsane.histogram_dialog->window, &mask, xsane.bg_trans, (gchar **) xpm_d); + pixmapwidget = gtk_pixmap_new(pixmap, mask); + gtk_container_add(GTK_CONTAINER(button), pixmapwidget); + gtk_widget_show(pixmapwidget); + gdk_pixmap_unref(pixmap); + + if (xsane_button_callback) + { + gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_button_callback, data); + } + gtk_box_pack_start(GTK_BOX(parent), button, FALSE, FALSE, 0); + gtk_widget_show(button); + + return(button); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static int xsane_option_menu_lookup(GSGMenuItem menu_items[], const char *string) +{ + int i; + + for (i = 0; strcmp(menu_items[i].label, string) != 0; ++i); + return i; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_option_menu_callback(GtkWidget *widget, gpointer data) +{ + GSGMenuItem *menu_item = data; + GSGDialogElement *elem = menu_item->elem; + const SANE_Option_Descriptor *opt; + GSGDialog *dialog = elem->dialog; + int opt_num; + double dval; + SANE_Word val; + void *valp = &val; + + opt_num = elem - dialog->element; + opt = sane_get_option_descriptor(dialog->dev, opt_num); + switch (opt->type) + { + case SANE_TYPE_INT: + sscanf(menu_item->label, "%d", &val); + break; + + case SANE_TYPE_FIXED: + sscanf(menu_item->label, "%lg", &dval); + val = SANE_FIX(dval); + break; + + case SANE_TYPE_STRING: + valp = menu_item->label; + break; + + default: + fprintf(stderr, "xsane_option_menu_callback: %s %d\n", ERR_UNKNOWN_TYPE, opt->type); + break; + } + xsane_back_gtk_set_option(dialog, opt_num, valp, SANE_ACTION_SET_VALUE); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, int option_number, const char *desc, + void *option_menu_callback, SANE_Int settable, const gchar *widget_name) +{ + GtkWidget *option_menu, *menu, *item; + GSGMenuItem *menu_items; + GSGDialogElement *elem; + int i, num_items; + + elem = dialog->element + option_number; + + for (num_items = 0; str_list[num_items]; ++num_items); + menu_items = malloc(num_items * sizeof(menu_items[0])); + + menu = gtk_menu_new(); + if (widget_name) + { + gtk_widget_set_name(menu, widget_name); + } + + for (i = 0; i < num_items; ++i) + { + item = gtk_menu_item_new_with_label(_BGT(str_list[i])); + gtk_container_add(GTK_CONTAINER(menu), item); + + if (option_menu_callback) + { + gtk_signal_connect(GTK_OBJECT(item), "activate", (GtkSignalFunc) option_menu_callback, menu_items + i); + } + else + { + gtk_signal_connect(GTK_OBJECT(item), "activate", (GtkSignalFunc) xsane_option_menu_callback, menu_items + i); + } + + gtk_widget_show(item); + + menu_items[i].label = str_list[i]; + menu_items[i].elem = elem; + menu_items[i].index = i; + } + + option_menu = gtk_option_menu_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, option_menu, desc); + gtk_box_pack_end(GTK_BOX(parent), option_menu, FALSE, FALSE, 2); + gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu); + gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), xsane_option_menu_lookup(menu_items, val)); + + gtk_widget_show(option_menu); + + gtk_widget_set_sensitive(option_menu, settable); + + elem->widget = option_menu; + elem->menu_size = num_items; + elem->menu = menu_items; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_option_menu_new_with_pixmap(GtkBox *parent, const char *xpm_d[], const char *desc, + char *str_list[], const char *val, + GtkObject **data, int option, + void *option_menu_callback, SANE_Int settable, const gchar *widget_name) +{ + GtkWidget *hbox; + GtkWidget *pixmapwidget; + GdkBitmap *mask; + GdkPixmap *pixmap; + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(parent, hbox, FALSE, FALSE, 0); + + pixmap = gdk_pixmap_create_from_xpm_d(xsane.histogram_dialog->window, &mask, xsane.bg_trans, (gchar **) xpm_d); + pixmapwidget = gtk_pixmap_new(pixmap, mask); + gtk_box_pack_start(GTK_BOX(hbox), pixmapwidget, FALSE, FALSE, 2); + gtk_widget_show(pixmapwidget); + + xsane_option_menu_new(hbox, str_list, val, option, desc, option_menu_callback, settable, widget_name); + gtk_widget_show(hbox); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_scale_new(GtkBox *parent, char *labeltext, const char *desc, + float min, float max, float quant, float step, float page_step, + int digits, double *val, GtkObject **data, void *xsane_scale_callback, SANE_Int settable) +{ + GtkWidget *hbox; + GtkWidget *label; + GtkWidget *scale; + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(parent, hbox, FALSE, FALSE, 0); + + label = gtk_label_new(labeltext); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + + *data = gtk_adjustment_new(*val, min, max, quant, step, page_step); + scale = gtk_hscale_new(GTK_ADJUSTMENT(*data)); + xsane_back_gtk_set_tooltip(dialog->tooltips, scale, desc); + gtk_widget_set_usize(scale, 201, 0); /* minimum scale with = 201 pixels */ + gtk_range_set_update_policy(GTK_RANGE(scale), preferences.gtk_update_policy); + /* GTK_UPDATE_CONTINUOUS, GTK_UPDATE_DISCONTINUOUS, GTK_UPDATE_DELAYED */ + gtk_scale_set_value_pos(GTK_SCALE(scale), GTK_POS_TOP); + gtk_scale_set_digits(GTK_SCALE(scale), digits); + gtk_box_pack_end(GTK_BOX(hbox), scale, FALSE, TRUE, 5); /* make scale not sizeable */ + + if (xsane_scale_callback) + { + gtk_signal_connect(*data, "value_changed", (GtkSignalFunc) xsane_scale_callback, val); + } + + gtk_widget_show(label); + gtk_widget_show(scale); + gtk_widget_show(hbox); + + gtk_widget_set_sensitive(scale, settable); + +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_scale_new_with_pixmap(GtkBox *parent, const char *xpm_d[], const char *desc, + float min, float max, float quant, float step, float page_step, int digits, + double *val, GtkObject **data, int option, void *xsane_scale_callback, SANE_Int settable) +{ + GtkWidget *hbox; + GtkWidget *scale; + GtkWidget *pixmapwidget; + GdkBitmap *mask; + GdkPixmap *pixmap; + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(parent, hbox, FALSE, FALSE, 0); + + pixmap = gdk_pixmap_create_from_xpm_d(xsane.histogram_dialog->window, &mask, xsane.bg_trans, (gchar **) xpm_d); + pixmapwidget = gtk_pixmap_new(pixmap, mask); + gtk_box_pack_start(GTK_BOX(hbox), pixmapwidget, FALSE, FALSE, 2); + + *data = gtk_adjustment_new(*val, min, max, quant, step, page_step); + scale = gtk_hscale_new(GTK_ADJUSTMENT(*data)); + xsane_back_gtk_set_tooltip(dialog->tooltips, scale, desc); + gtk_widget_set_usize(scale, 201, 0); /* minimum scale with = 201 pxiels */ + gtk_range_set_update_policy(GTK_RANGE(scale), preferences.gtk_update_policy); + /* GTK_UPDATE_CONTINUOUS, GTK_UPDATE_DISCONTINUOUS, GTK_UPDATE_DELAYED */ + gtk_scale_set_value_pos(GTK_SCALE(scale), GTK_POS_TOP); + gtk_scale_set_digits(GTK_SCALE(scale), digits); + gtk_box_pack_end(GTK_BOX(hbox), scale, TRUE, TRUE, 5); /* make scale sizeable */ + + if (xsane_scale_callback) + { + gtk_signal_connect(*data, "value_changed", (GtkSignalFunc) xsane_scale_callback, val); + } + + gtk_widget_show(pixmapwidget); + gtk_widget_show(scale); + gtk_widget_show(hbox); + + gtk_widget_set_sensitive(scale, settable); + + gdk_pixmap_unref(pixmap); + + if ( (dialog) && (option) ) + { + GSGDialogElement *elem; + + elem=dialog->element + option; + elem->data = *data; + elem->widget = scale; + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_separator_new(GtkWidget *xsane_parent, int dist) +{ + GtkWidget *xsane_separator; + + xsane_separator = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(xsane_parent), xsane_separator, FALSE, FALSE, dist); + gtk_widget_show(xsane_separator); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +GtkWidget *xsane_info_table_text_new(GtkWidget *table, gchar *text, int row, int colomn) +{ + GtkWidget *hbox, *label; + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_table_attach_defaults(GTK_TABLE(table), hbox, row, row+1, colomn, colomn+1); + gtk_widget_show(hbox); + + label = gtk_label_new(text); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10); + gtk_widget_show(label); + + return label; +} +/* ---------------------------------------------------------------------------------------------------------------------- */ +#if 0 +GtkWidget *xsane_info_text_new(GtkWidget *parent, gchar *text) +{ + GtkWidget *hbox, *label; + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(parent), hbox, TRUE, TRUE, 5); + gtk_widget_show(hbox); + + label = gtk_label_new(text); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10); + gtk_widget_show(label); + + return label; +} +#endif +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_refresh_dialog(void *nothing) +{ + xsane_back_gtk_refresh_dialog(dialog); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ diff --git a/frontend/xsane-front-gtk.h b/frontend/xsane-front-gtk.h new file mode 100644 index 0000000..600fa28 --- /dev/null +++ b/frontend/xsane-front-gtk.h @@ -0,0 +1,73 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-front-gtk.h + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#include +#include "xsane.h" + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#ifndef xsane_front_gtk_h +#define xsane_front_gtk_h + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +extern void xsane_get_bounds(const SANE_Option_Descriptor *opt, double *minp, double *maxp); +extern int xsane_set_resolution(int well_known_option, int resolution); +extern void xsane_set_all_resolutions(void); +extern void xsane_define_maximum_output_size(); +extern void xsane_close_dialog_callback(GtkWidget *widget, gpointer data); +extern void xsane_authorization_button_callback(GtkWidget *widget, gpointer data); +extern gint xsane_authorization_callback(SANE_String_Const resource, + SANE_Char username[SANE_MAX_USERNAME_LEN], + SANE_Char password[SANE_MAX_PASSWORD_LEN]); +extern void xsane_progress_cancel(GtkWidget *widget, gpointer data); +extern XsaneProgress_t *xsane_progress_new(char *title, char *text, GtkSignalFunc callback, gpointer callback_data); +extern void xsane_progress_free(XsaneProgress_t *p); +extern void xsane_progress_update(XsaneProgress_t *p, gfloat newval); +extern void xsane_toggle_button_new_with_pixmap(GtkWidget *parent, const char *xpm_d[], const char *desc, + int *state, void *xsane_toggle_button_callback); +extern GtkWidget *xsane_button_new_with_pixmap(GtkWidget *parent, const char *xpm_d[], const char *desc, + void *xsane_button_callback, gpointer data); +extern void xsane_pixmap_new(GtkWidget *parent, char *title, int width, int height, XsanePixmap *hist); +extern void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, int option_number, const char *desc, + void *option_menu_callback, SANE_Int settable, const gchar *widget_name); +extern void xsane_option_menu_new_with_pixmap(GtkBox *parent, const char *xpm_d[], const char *desc, + char *str_list[], const char *val, + GtkObject **data, int option, + void *option_menu_callback, SANE_Int settable, const gchar *widget_name); +extern void xsane_scale_new(GtkBox *parent, char *labeltext, const char *desc, + float min, float max, float quant, float step, float xxx, + int digits, double *val, GtkObject **data, void *xsane_scale_callback, SANE_Int settable); +extern void xsane_scale_new_with_pixmap(GtkBox *parent, const char *xpm_d[], const char *desc, + float min, float max, float quant, float step, float xxx, int digits, + double *val, GtkObject **data, int option, void *xsane_scale_callback, SANE_Int settable); +extern void xsane_separator_new(GtkWidget *xsane_parent, int dist); +extern GtkWidget *xsane_info_table_text_new(GtkWidget *table, gchar *text, int row, int colomn); +extern GtkWidget *xsane_info_text_new(GtkWidget *parent, gchar *text); +extern void xsane_refresh_dialog(void *nothing); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#endif + diff --git a/frontend/xsane-gamma.c b/frontend/xsane-gamma.c new file mode 100644 index 0000000..90573f5 --- /dev/null +++ b/frontend/xsane-gamma.c @@ -0,0 +1,1541 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-gamma.c + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#include "xsane.h" +#include "xsane-front-gtk.h" +#include "xsane-back-gtk.h" +#include "xsane-preferences.h" +#include "xsane-preview.h" +#include "xsane-save.h" + +#ifdef HAVE_LIBPNG +#ifdef HAVE_LIBZ +#include +#include +#endif +#endif + + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +/* forward declarations: */ + +static void xsane_bound_double(double *value, double min, double max); +void xsane_clear_histogram(XsanePixmap *hist); +static void xsane_draw_histogram_with_points(XsanePixmap *hist, int invert, + SANE_Int *count, SANE_Int *count_red, SANE_Int *count_green, SANE_Int *count_blue, + int show_red, int show_green, int show_blue, int show_inten, double scale); +static void xsane_draw_histogram_with_lines(XsanePixmap *hist, int invert, + SANE_Int *count, SANE_Int *count_red, SANE_Int *count_green, SANE_Int *count_blue, + int show_red, int show_green, int show_blue, int show_inten, double scale); +void xsane_draw_slider_level(XsaneSlider *slider); +static void xsane_set_slider(XsaneSlider *slider, double min, double mid, double max); +void xsane_update_slider(XsaneSlider *slider); +void xsane_update_sliders(void); +static gint xsane_slider_callback(GtkWidget *widget, GdkEvent *event, XsaneSlider *slider); +void xsane_create_slider(XsaneSlider *slider); +void xsane_create_histogram(GtkWidget *parent, const char *title, int width, int height, XsanePixmap *hist); +static void xsane_calculate_auto_enhancement(int negative, + SANE_Int *count_raw, SANE_Int *count_raw_red, SANE_Int *count_raw_green, SANE_Int *count_raw_blue); +void xsane_calculate_histogram(void); +void xsane_update_histogram(void); +void xsane_histogram_toggle_button_callback(GtkWidget *widget, gpointer data); +void xsane_create_gamma_curve(SANE_Int *gammadata, int negative, double gamma, + double brightness, double contrast, int numbers, int maxout); +void xsane_update_gamma(void); +static void xsane_enhancement_update(void); +static void xsane_gamma_to_histogram(double *min, double *mid, double *max, + double contrast, double brightness, double gamma); +void xsane_enhancement_by_gamma(void); +void xsane_enhancement_restore_default(void); +void xsane_enhancement_restore(void); +void xsane_enhancement_store(void); +static void xsane_histogram_to_gamma(XsaneSlider *slider, double *contrast, double *brightness, double *gamma); +void xsane_enhancement_by_histogram(void); +static gint xsane_histogram_win_delete(GtkWidget *widget, gpointer data); +void xsane_create_histogram_dialog(const char *devicetext); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_bound_double(double *value, double min, double max) +{ + if (*value < min) + { + *value = min; + } + + if (*value > max) + { + *value = max; + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_clear_histogram(XsanePixmap *hist) +{ + GdkRectangle rect; + + if(hist->pixmap) + { + rect.x=0; + rect.y=0; + rect.width = HIST_WIDTH; + rect.height = HIST_HEIGHT; + + gdk_draw_rectangle(hist->pixmap, xsane.gc_backg, TRUE, 0, 0, HIST_WIDTH, HIST_HEIGHT); + gtk_widget_draw(hist->pixmapwid, &rect); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_draw_histogram_with_points(XsanePixmap *hist, int invert, + SANE_Int *count, SANE_Int *count_red, SANE_Int *count_green, SANE_Int *count_blue, + int show_red, int show_green, int show_blue, int show_inten, double scale) +{ + GdkRectangle rect; + int i; + int inten, red, green, blue; + int colval; + +#define XD 1 +#define YD 2 + + if(hist->pixmap) + { + rect.x=0; + rect.y=0; + rect.width = HIST_WIDTH; + rect.height = HIST_HEIGHT; + + gdk_draw_rectangle(hist->pixmap, xsane.gc_backg, TRUE, 0, 0, HIST_WIDTH, HIST_HEIGHT); + + red = 0; + green = 0; + blue = 0; + + for (i=0; i < HIST_WIDTH; i++) + { + if (invert) + { + colval = 255-i; + } + else + { + colval = i; + } + + inten = show_inten * count[colval] * scale; + + if (xsane.xsane_color) + { + red = show_red * count_red[colval] * scale; + green = show_green * count_green[colval] * scale; + blue = show_blue * count_blue[colval] * scale; + } + + if (inten > HIST_HEIGHT) + inten = HIST_HEIGHT; + + if (red > HIST_HEIGHT) + red = HIST_HEIGHT; + + if (green > HIST_HEIGHT) + green = HIST_HEIGHT; + + if (blue > HIST_HEIGHT) + blue = HIST_HEIGHT; + + + gdk_draw_rectangle(hist->pixmap, xsane.gc_red, TRUE, i, HIST_HEIGHT - red, XD, YD); + gdk_draw_rectangle(hist->pixmap, xsane.gc_green, TRUE, i, HIST_HEIGHT - green, XD, YD); + gdk_draw_rectangle(hist->pixmap, xsane.gc_blue, TRUE, i, HIST_HEIGHT - blue, XD, YD); + gdk_draw_rectangle(hist->pixmap, xsane.gc_black, TRUE, i, HIST_HEIGHT - inten, XD, YD); + } + + gtk_widget_draw(hist->pixmapwid, &rect); + } +} +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_draw_histogram_with_lines(XsanePixmap *hist, int invert, + SANE_Int *count, SANE_Int *count_red, SANE_Int *count_green, SANE_Int *count_blue, + int show_red, int show_green, int show_blue, int show_inten, double scale) +{ + GdkRectangle rect; + int i, j, k; + int inten, red, green, blue; + int inten0=0, red0=0, green0=0, blue0=0; + int val[4]; + int val2[4]; + int color[4]; + int val_swap; + int color_swap; + int colval; + + if (hist->pixmap) + { + rect.x=0; + rect.y=0; + rect.width = HIST_WIDTH; + rect.height = HIST_HEIGHT; + + gdk_draw_rectangle(hist->pixmap, xsane.gc_backg, TRUE, 0, 0, HIST_WIDTH, HIST_HEIGHT); + + red = 0; + green = 0; + blue = 0; + + for (i=0; i < HIST_WIDTH; i++) + { + if (invert) + { + colval = 255-i; + } + else + { + colval = i; + } + + inten = show_inten * count[colval] * scale; + + if (xsane.xsane_color) + { + red = show_red * count_red[colval] * scale; + green = show_green * count_green[colval] * scale; + blue = show_blue * count_blue[colval] * scale; + } + + if (inten > HIST_HEIGHT) + inten = HIST_HEIGHT; + + if (red > HIST_HEIGHT) + red = HIST_HEIGHT; + + if (green > HIST_HEIGHT) + green = HIST_HEIGHT; + + if (blue > HIST_HEIGHT) + blue = HIST_HEIGHT; + + val[0] = red; color[0] = 0; + val[1] = green; color[1] = 1; + val[2] = blue; color[2] = 2; + val[3] = inten; color[3] = 3; + + for (j=0; j<3; j++) + { + for (k=j+1; k<4; k++) + { + if (val[j] < val[k]) + { + val_swap = val[j]; + color_swap = color[j]; + val[j] = val[k]; + color[j] = color[k]; + val[k] = val_swap; + color[k] = color_swap; + } + } + } + val2[0]=val[1]+1; + val2[1]=val[2]+1; + val2[2]=val[3]+1; + val2[3]=0; + + for (j=0; j<4; j++) + { + switch(color[j]) + { + case 0: red0 = val2[j]; + break; + case 1: green0 = val2[j]; + break; + case 2: blue0 = val2[j]; + break; + case 3: inten0 = val2[j]; + break; + } + } + + + gdk_draw_line(hist->pixmap, xsane.gc_red, i, HIST_HEIGHT - red, i, HIST_HEIGHT - red0); + gdk_draw_line(hist->pixmap, xsane.gc_green, i, HIST_HEIGHT - green, i, HIST_HEIGHT - green0); + gdk_draw_line(hist->pixmap, xsane.gc_blue, i, HIST_HEIGHT - blue, i, HIST_HEIGHT - blue0); + gdk_draw_line(hist->pixmap, xsane.gc_black, i, HIST_HEIGHT - inten, i, HIST_HEIGHT - inten0); + } + + gtk_widget_draw(hist->pixmapwid, &rect); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_establish_slider(XsaneSlider *slider) +{ + int x, y, pos, len; + guchar buf[XSANE_SLIDER_WIDTH*3]; + GdkRectangle rect; + + buf[0] = buf[1] = buf[2] = 0; + buf[3+0] = buf[3+1] = buf[3+2]= 0; + + for (x=0; x<256; x++) + { + buf[3*x+0+6] = x * slider->r; + buf[3*x+1+6] = x * slider->g; + buf[3*x+2+6] = x * slider->b; + } + + buf[258*3+0] = 255 * slider->r; + buf[258*3+1] = 255 * slider->g; + buf[258*3+2] = 255 * slider->b; + + buf[259*3+0] = 255 * slider->r; + buf[259*3+1] = 255 * slider->g; + buf[259*3+2] = 255 * slider->b; + + for (y=0; yposition[0]-y/2; + len = y; + if (pos<-2) + { + len = len + pos + 2; + pos = -2; + } + pos = pos * 3 + 6; + + for (x=0; x<=len; x++) + { + if ((x == 0) || (x == len) || (y == XSANE_SLIDER_HEIGHT-1)) + { + buf[pos++] = 255; + buf[pos++] = 255; + buf[pos++] = 255; + } + else + { + buf[pos++] = 0; + buf[pos++] = 0; + buf[pos++] = 0; + } + } + + + pos = slider->position[1]-y/2; + len = y; + pos = pos * 3 + 6; + + for (x=0; x<=len; x++) + { + if ((x == 0) || (x == len) || (y == XSANE_SLIDER_HEIGHT-1)) + { + buf[pos++] = 255; + buf[pos++] = 255; + buf[pos++] = 255; + } + else + { + buf[pos++] = 128; + buf[pos++] = 128; + buf[pos++] = 128; + } + } + + + pos = slider->position[2]-y/2; + len = y; + if (pos+len>257) + { + len = 257 - pos; + } + pos = pos * 3 + 6; + + for (x=0; x<=len; x++) + { + if ((x == 0) || (x == len) || (y == XSANE_SLIDER_HEIGHT-1)) + { + buf[pos++] = 0; + buf[pos++] = 0; + buf[pos++] = 0; + } + else + { + buf[pos++] = 255; + buf[pos++] = 255; + buf[pos++] = 255; + } + } + + gtk_preview_draw_row(GTK_PREVIEW(slider->preview),buf, 0, y, XSANE_SLIDER_WIDTH); + } + + rect.x=0; + rect.y=0; + rect.width = XSANE_SLIDER_WIDTH; + rect.height = XSANE_SLIDER_HEIGHT; + + gtk_widget_draw(slider->preview, &rect); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_draw_slider_level(XsaneSlider *slider) +{ + int i; + guchar buf[XSANE_SLIDER_WIDTH*3]; + GdkRectangle rect; + + buf[0] = buf[1] = buf[2] = 0; + buf[3+0] = buf[3+1] = buf[3+2]= 0; + + for (i=0; i<256; i++) + { + buf[3*i+0+6] = i * slider->r; + buf[3*i+1+6] = i * slider->g; + buf[3*i+2+6] = i * slider->b; + } + + buf[258*3+0] = 255 * slider->r; + buf[258*3+1] = 255 * slider->g; + buf[258*3+2] = 255 * slider->b; + + buf[259*3+0] = 255 * slider->r; + buf[259*3+1] = 255 * slider->g; + buf[259*3+2] = 255 * slider->b; + + for (i=0; ipreview),buf, 0, i, XSANE_SLIDER_WIDTH); + } + + rect.x=0; + rect.y=0; + rect.width = XSANE_SLIDER_WIDTH; + rect.height = XSANE_SLIDER_HEIGHT; + + gtk_widget_draw(slider->preview, &rect); +} +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_set_slider(XsaneSlider *slider, double min, double mid, double max) +{ + slider->value[0] = min; + slider->value[1] = mid; + slider->value[2] = max; + + slider->position[0] = min * 2.55; + slider->position[1] = mid * 2.55; + slider->position[2] = max * 2.55; + + xsane_establish_slider(slider); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_update_slider(XsaneSlider *slider) +{ + slider->position[0] = 2.55 * slider->value[0]; + slider->position[1] = 2.55 * slider->value[1]; + slider->position[2] = 2.55 * slider->value[2]; + + xsane_establish_slider(slider); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_update_sliders() +{ + xsane_update_slider(&xsane.slider_gray); + + if ( (xsane.xsane_color) && (!xsane.enhancement_rgb_default) ) + { + xsane_update_slider(&xsane.slider_red); + xsane_update_slider(&xsane.slider_green); + xsane_update_slider(&xsane.slider_blue); + + xsane.slider_gray.active &= ~XSANE_SLIDER_INACTIVE; /* mark slider active */ + xsane.slider_red.active &= ~XSANE_SLIDER_INACTIVE; /* mark slider active */ + xsane.slider_green.active &= ~XSANE_SLIDER_INACTIVE; /* mark slider active */ + xsane.slider_blue.active &= ~XSANE_SLIDER_INACTIVE; /* mark slider active */ + } + else + { + xsane_draw_slider_level(&xsane.slider_red); /* remove slider */ + xsane_draw_slider_level(&xsane.slider_green); /* remove slider */ + xsane_draw_slider_level(&xsane.slider_blue); /* remove slider */ + + xsane.slider_red.active = XSANE_SLIDER_INACTIVE; /* mark slider inactive */ + xsane.slider_green.active = XSANE_SLIDER_INACTIVE; /* mark slider inactive */ + xsane.slider_blue.active = XSANE_SLIDER_INACTIVE; /* mark slider inactive */ + + if (xsane.param.depth == 1) + { + xsane_draw_slider_level(&xsane.slider_gray); /* remove slider */ + xsane.slider_gray.active = XSANE_SLIDER_INACTIVE; /* mark slider inactive */ + } + else + { + xsane.slider_gray.active &= ~XSANE_SLIDER_INACTIVE; /* mark slider active */ + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static gint xsane_slider_callback(GtkWidget *widget, GdkEvent *event, XsaneSlider *slider) +{ + GdkEventButton *button_event; + GdkEventMotion *motion_event; + int distance; + int i = 0; + static int update = FALSE; + static int event_count = 0; + static int x; + + if (slider->active == XSANE_SLIDER_INACTIVE) + { + return 0; + } + + event_count++; + + switch(event->type) + { + case GDK_BUTTON_PRESS: + gtk_grab_add(widget); + button_event = (GdkEventButton *) event; + + distance = G_MAXINT; + for (i=0; i<3; i++) + { + if (fabs(button_event->x - slider->position[i]) < distance) + { + slider->active = i + 1; + distance = fabs(button_event->x - slider->position[i]); + } + } + if (distance<10) + { + x = button_event->x; + update = TRUE; + } + else + { + slider->active = XSANE_SLIDER_ACTIVE; + } + break; + + case GDK_BUTTON_RELEASE: + gtk_grab_remove(widget); + xsane_enhancement_by_histogram(); /* slider->active must be unchanged !!! */ + slider->active = XSANE_SLIDER_ACTIVE; /* ok, now we can reset it */ + break; + + case GDK_MOTION_NOTIFY: + motion_event = (GdkEventMotion *) event; + gdk_window_get_pointer(widget->window, &x, 0, 0); + update = TRUE; + break; + + default: + break; + } + + if (update) + { + update = FALSE; + switch(slider->active) + { + case 1: + slider->value[0] = (x-XSANE_SLIDER_OFFSET) / 2.55; + xsane_bound_double(&slider->value[0], 0.0, slider->value[1] - 1); + break; + + case 2: + slider->value[1] = (x-XSANE_SLIDER_OFFSET) / 2.55; + xsane_bound_double(&slider->value[1], slider->value[0] + 1, slider->value[2] - 1); + break; + + case 3: + slider->value[2] = (x-XSANE_SLIDER_OFFSET) / 2.55; + xsane_bound_double(&slider->value[2], slider->value[1] + 1, 100.0); + break; + + default: + break; + } + xsane_set_slider(slider, slider->value[0], slider->value[1], slider->value[2]); + + if ((preferences.gtk_update_policy == GTK_UPDATE_CONTINUOUS) && (event_count == 1)) + { + xsane_enhancement_by_histogram(); + } + else if ((preferences.gtk_update_policy == GTK_UPDATE_DELAYED) && (event_count == 1)) + { + xsane_enhancement_by_histogram(); + } + } + + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + + event_count--; + + return 0; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_create_slider(XsaneSlider *slider) +{ + slider->preview = gtk_preview_new(GTK_PREVIEW_COLOR); + gtk_preview_size(GTK_PREVIEW(slider->preview), XSANE_SLIDER_WIDTH, XSANE_SLIDER_HEIGHT); + gtk_widget_set_events(slider->preview, XSANE_SLIDER_EVENTS); + gtk_signal_connect(GTK_OBJECT(slider->preview), "event", GTK_SIGNAL_FUNC(xsane_slider_callback), slider); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_create_histogram(GtkWidget *parent, const char *title, int width, int height, XsanePixmap *hist) +{ + GdkBitmap *mask=NULL; + + hist->frame = gtk_frame_new(title); + hist->pixmap = gdk_pixmap_new(xsane.histogram_dialog->window, width, height, -1); + hist->pixmapwid = gtk_pixmap_new(hist->pixmap, mask); + gtk_container_add(GTK_CONTAINER(hist->frame), hist->pixmapwid); + gdk_draw_rectangle(hist->pixmap, xsane.gc_backg, TRUE, 0, 0, width, height); + + gtk_box_pack_start(GTK_BOX(parent), hist->frame, FALSE, FALSE, 2); + gtk_widget_show(hist->pixmapwid); + gtk_widget_show(hist->frame); + } + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_calculate_auto_enhancement(int negative, + SANE_Int *count_raw, SANE_Int *count_raw_red, SANE_Int *count_raw_green, SANE_Int *count_raw_blue) +{ /* calculate white, medium and black values for auto enhancement */ + int limit, limit_mid; + int points, points_mix, points_red, points_green, points_blue; + int min, mid, max; + int min_red, mid_red, max_red; + int min_green, mid_green, max_green; + int min_blue, mid_blue, max_blue; + int val; + int i; + + if (xsane.preview) + { + points = 0; + points_mix = 0; + points_red = 0; + points_green = 0; + points_blue = 0; + + for (i=0; i<256; i++) + { + points += count_raw[i]; + points_mix += 10 * log(1 + count_raw[i] + count_raw_red[i] + count_raw_green[i] + count_raw_blue[i]); + points_red += 10 * log(1 + count_raw_red[i]); + points_green += 10 * log(1 + count_raw_green[i]); + points_blue += 10 * log(1 + count_raw_blue[i]); + } + + limit = 1 + points / 5000; + + /* ----- gray ----- */ + + min = -1; + val = 0; + while ( (val/4 < limit) && (min < 254) ) + { + min++; + val += count_raw[min] + count_raw_red[min] + count_raw_green[min] + count_raw_blue[min]; + } + + max = HIST_WIDTH; + val = 0; + while ( (val/4 < limit) && (max > min + 1) ) + { + max--; + val += count_raw[max] + count_raw_red[max] + count_raw_green[max] + count_raw_blue[max]; + } + + limit_mid = points_mix / 2.0; + + mid = 0; + val = 0; + while ( (val < limit_mid) && (mid < max - 2) ) + { + mid++; + val += 10 * log(1 + count_raw[mid] + count_raw_red[mid] + count_raw_green[mid] + count_raw_blue[mid]); + } + + /* ----- red ----- */ + + min_red = -1; + val = 0; + while ( (val < limit) && (min_red < 254) ) + { + min_red++; + val += count_raw_red[min_red]; + } + + max_red = HIST_WIDTH; + val = 0; + while ( (val < limit) && (max_red > min_red + 1) ) + { + max_red--; + val += count_raw_red[max_red]; + } + + limit_mid = points_red / 2.0; + + mid_red = 0; + val = 0; + while ( (val < limit_mid) && (mid_red < max_red - 2) ) + { + mid_red++; + val += 10 * log(1 + count_raw_red[mid_red]); + } + + /* ----- green ----- */ + + min_green = -1; + val = 0; + while ( (val < limit) && (min_green < 254) ) + { + min_green++; + val += count_raw_green[min_green]; + } + + max_green = HIST_WIDTH; + val = 0; + while ( (val < limit) && (max_green > min_green + 1) ) + { + max_green--; + val += count_raw_green[max_green]; + } + + limit_mid = points_green / 2.0; + + mid_green = 0; + val = 0; + while ( (val < limit_mid) && (mid_green < max_green - 2) ) + { + mid_green++; + val += 10 * log(1 + count_raw_green[mid_green]); + } + + /* ----- blue ----- */ + + min_blue = -1; + val = 0; + while ( (val < limit) && (min_blue < 254) ) + { + min_blue++; + val += count_raw_blue[min_blue]; + } + + max_blue = HIST_WIDTH; + val = 0; + while ( (val < limit) && (max_blue > min_blue + 1) ) + { + max_blue--; + val += count_raw_blue[max_blue]; + } + + limit_mid = points_blue / 2.0; + + mid_blue = 0; + val = 0; + while ( (val < limit_mid) && (mid_blue < max_blue - 2) ) + { + mid_blue++; + val += 10 * log(1 + count_raw_blue[mid_blue]); + } + + if (negative) + { + xsane.auto_white = (255-min)/2.55; + xsane.auto_gray = (255-mid)/2.55; + xsane.auto_black = (255-max)/2.55; + + xsane.auto_white_red = (255-min_red)/2.55; + xsane.auto_gray_red = (255-mid_red)/2.55; + xsane.auto_black_red = (255-max_red)/2.55; + + xsane.auto_white_green = (255-min_green)/2.55; + xsane.auto_gray_green = (255-mid_green)/2.55; + xsane.auto_black_green = (255-max_green)/2.55; + + xsane.auto_white_blue = (255-min_blue)/2.55; + xsane.auto_gray_blue = (255-mid_blue)/2.55; + xsane.auto_black_blue = (255-max_blue)/2.55; + } + else /* positive */ + { + xsane.auto_white = max/2.55; + xsane.auto_gray = mid/2.55; + xsane.auto_black = min/2.55; + + xsane.auto_white_red = max_red/2.55; + xsane.auto_gray_red = mid_red/2.55; + xsane.auto_black_red = min_red/2.55; + + xsane.auto_white_green = max_green/2.55; + xsane.auto_gray_green = mid_green/2.55; + xsane.auto_black_green = min_green/2.55; + + xsane.auto_white_blue = max_blue/2.55; + xsane.auto_gray_blue = mid_blue/2.55; + xsane.auto_black_blue = min_blue/2.55; + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_calculate_histogram(void) +{ + SANE_Int *count_raw; + SANE_Int *count_raw_red; + SANE_Int *count_raw_green; + SANE_Int *count_raw_blue; + SANE_Int *count_enh; + SANE_Int *count_enh_red; + SANE_Int *count_enh_green; + SANE_Int *count_enh_blue; + int i; + int maxval_raw; + int maxval_enh; + int maxval; + double scale; + + /* at first reset auto enhancement values */ + + xsane.auto_black = 0.0; + xsane.auto_gray = 50.0; + xsane.auto_white = 100.0; + + xsane.auto_black_red = 0.0; + xsane.auto_gray_red = 50.0; + xsane.auto_white_red = 100.0; + + xsane.auto_black_green = 0.0; + xsane.auto_gray_green = 50.0; + xsane.auto_white_green = 100.0; + + xsane.auto_black_blue = 0.0; + xsane.auto_gray_blue = 50.0; + xsane.auto_white_blue = 100.0; + + if (xsane.preview) /* preview window exists? */ + { + count_raw = calloc(256, sizeof(SANE_Int)); + count_raw_red = calloc(256, sizeof(SANE_Int)); + count_raw_green = calloc(256, sizeof(SANE_Int)); + count_raw_blue = calloc(256, sizeof(SANE_Int)); + count_enh = calloc(256, sizeof(SANE_Int)); + count_enh_red = calloc(256, sizeof(SANE_Int)); + count_enh_green = calloc(256, sizeof(SANE_Int)); + count_enh_blue = calloc(256, sizeof(SANE_Int)); + + preview_calculate_histogram(xsane.preview, count_raw, count_raw_red, count_raw_green, count_raw_blue, + count_enh, count_enh_red, count_enh_green, count_enh_blue); + + if (xsane.param.depth > 1) + { + xsane_calculate_auto_enhancement(xsane.negative, count_raw, count_raw_red, count_raw_green, count_raw_blue); + } + + if (xsane.histogram_log) /* logarithmical display */ + { + for (i=0; i<=255; i++) + { + count_raw[i] = (int) (50*log(1.0 + count_raw[i])); + count_raw_red[i] = (int) (50*log(1.0 + count_raw_red[i])); + count_raw_green[i] = (int) (50*log(1.0 + count_raw_green[i])); + count_raw_blue[i] = (int) (50*log(1.0 + count_raw_blue[i])); + + count_enh[i] = (int) (50*log(1.0 + count_enh[i])); + count_enh_red[i] = (int) (50*log(1.0 + count_enh_red[i])); + count_enh_green[i] = (int) (50*log(1.0 + count_enh_green[i])); + count_enh_blue[i] = (int) (50*log(1.0 + count_enh_blue[i])); + } + } + + maxval_raw = 0; + maxval_enh = 0; + + /* first and last 10 values are not used for calculating maximum value */ + for (i = 10 ; i < HIST_WIDTH - 10; i++) + { + if (count_raw[i] > maxval_raw) { maxval_raw = count_raw[i]; } + if (count_raw_red[i] > maxval_raw) { maxval_raw = count_raw_red[i]; } + if (count_raw_green[i] > maxval_raw) { maxval_raw = count_raw_green[i]; } + if (count_raw_blue[i] > maxval_raw) { maxval_raw = count_raw_blue[i]; } + if (count_enh[i] > maxval_enh) { maxval_enh = count_enh[i]; } + if (count_enh_red[i] > maxval_enh) { maxval_enh = count_enh_red[i]; } + if (count_enh_green[i] > maxval_enh) { maxval_enh = count_enh_green[i]; } + if (count_enh_blue[i] > maxval_enh) { maxval_enh = count_enh_blue[i]; } + } + maxval = ((maxval_enh > maxval_raw) ? maxval_enh : maxval_raw); + scale = 100.0/maxval; + + if (xsane.histogram_lines) + { + xsane_draw_histogram_with_lines(&xsane.histogram_raw, xsane.negative, + count_raw, count_raw_red, count_raw_green, count_raw_blue, + xsane.histogram_red, xsane.histogram_green, xsane.histogram_blue, xsane.histogram_int, scale); + + xsane_draw_histogram_with_lines(&xsane.histogram_enh, 0 /* negative is done by gamma table */, + count_enh, count_enh_red, count_enh_green, count_enh_blue, + xsane.histogram_red, xsane.histogram_green, xsane.histogram_blue, xsane.histogram_int, scale); + } + else + { + xsane_draw_histogram_with_points(&xsane.histogram_raw, xsane.negative, + count_raw, count_raw_red, count_raw_green, count_raw_blue, + xsane.histogram_red, xsane.histogram_green, xsane.histogram_blue, xsane.histogram_int, scale); + + xsane_draw_histogram_with_points(&xsane.histogram_enh, 0 /*negative is done by gamma table */, + count_enh, count_enh_red, count_enh_green, count_enh_blue, + xsane.histogram_red, xsane.histogram_green, xsane.histogram_blue, xsane.histogram_int, scale); + } + + free(count_enh_blue); + free(count_enh_green); + free(count_enh_red); + free(count_enh); + free(count_raw_blue); + free(count_raw_green); + free(count_raw_red); + free(count_raw); + } + else + { + xsane_clear_histogram(&xsane.histogram_raw); + xsane_clear_histogram(&xsane.histogram_enh); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_update_histogram() +{ + if (preferences.show_histogram) + { + xsane_calculate_histogram(); + gtk_widget_show(xsane.histogram_dialog); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_histogram_toggle_button_callback(GtkWidget *widget, gpointer data) +{ + int *valuep = data; + + *valuep = (GTK_TOGGLE_BUTTON(widget)->active != 0); + xsane_update_histogram(); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_create_gamma_curve(SANE_Int *gammadata, int negative, double gamma, + double brightness, double contrast, int numbers, int maxout) +{ + int i; + double midin; + double val; + double m; + double b; + int maxin = numbers-1; + + if (contrast < -100.0) + { + contrast = -100.0; + } + + midin = (int)(numbers / 2.0); + + m = 1.0 + contrast/100.0; + b = (1.0 + brightness/100.0) * midin; + + if (negative) + { + for (i=0; i <= maxin; i++) + { + val = ((double) (maxin - i)) - midin; + val = val * m + b; + xsane_bound_double(&val, 0.0, maxin); + + gammadata[i] = 0.5 + maxout * pow( val/maxin, (1.0/gamma) ); + } + } + else /* positive */ + { + for (i=0; i <= maxin; i++) + { + val = ((double) i) - midin; + val = val * m + b; + xsane_bound_double(&val, 0.0, maxin); + + gammadata[i] = 0.5 + maxout * pow( val/maxin, (1.0/gamma) ); + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_update_gamma(void) +{ + if (xsane.preview) + { + if (!xsane.preview_gamma_data_red) + { + xsane.preview_gamma_data_red = malloc(256 * sizeof(SANE_Int)); + xsane.preview_gamma_data_green = malloc(256 * sizeof(SANE_Int)); + xsane.preview_gamma_data_blue = malloc(256 * sizeof(SANE_Int)); + + xsane.histogram_gamma_data_red = malloc(256 * sizeof(SANE_Int)); + xsane.histogram_gamma_data_green = malloc(256 * sizeof(SANE_Int)); + xsane.histogram_gamma_data_blue = malloc(256 * sizeof(SANE_Int)); + } + + xsane_create_gamma_curve(xsane.preview_gamma_data_red, xsane.negative, + xsane.gamma * xsane.gamma_red * preferences.preview_gamma * preferences.preview_gamma_red, + xsane.brightness + xsane.brightness_red, + xsane.contrast + xsane.contrast_red, 256, 255); + + xsane_create_gamma_curve(xsane.preview_gamma_data_green, xsane.negative, + xsane.gamma * xsane.gamma_green * preferences.preview_gamma * preferences.preview_gamma_green, + xsane.brightness + xsane.brightness_green, + xsane.contrast + xsane.contrast_green, 256, 255); + + xsane_create_gamma_curve(xsane.preview_gamma_data_blue, xsane.negative, + xsane.gamma * xsane.gamma_blue * preferences.preview_gamma * preferences.preview_gamma_blue, + xsane.brightness + xsane.brightness_blue, + xsane.contrast + xsane.contrast_blue , 256, 255); + + xsane_create_gamma_curve(xsane.histogram_gamma_data_red, xsane.negative, + xsane.gamma * xsane.gamma_red, + xsane.brightness + xsane.brightness_red, + xsane.contrast + xsane.contrast_red, 256, 255); + + xsane_create_gamma_curve(xsane.histogram_gamma_data_green, xsane.negative, + xsane.gamma * xsane.gamma_green, + xsane.brightness + xsane.brightness_green, + xsane.contrast + xsane.contrast_green, 256, 255); + + xsane_create_gamma_curve(xsane.histogram_gamma_data_blue, xsane.negative, + xsane.gamma * xsane.gamma_blue, + xsane.brightness + xsane.brightness_blue, + xsane.contrast + xsane.contrast_blue , 256, 255); + + preview_gamma_correction(xsane.preview, + xsane.preview_gamma_data_red, xsane.preview_gamma_data_green, xsane.preview_gamma_data_blue, + xsane.histogram_gamma_data_red, xsane.histogram_gamma_data_green, xsane.histogram_gamma_data_blue); + + } + xsane_update_histogram(); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_enhancement_update(void) +{ + guint sig_changed=0; + + if (xsane.param.depth == 1) /* lineart? no gamma */ + { + return; + } + + sig_changed = gtk_signal_lookup("changed", GTK_OBJECT_TYPE(xsane.gamma_widget)); + + GTK_ADJUSTMENT(xsane.gamma_widget)->value = xsane.gamma; + GTK_ADJUSTMENT(xsane.brightness_widget)->value = xsane.brightness; + GTK_ADJUSTMENT(xsane.contrast_widget)->value = xsane.contrast; + + if ( (xsane.xsane_color) && (!xsane.enhancement_rgb_default) ) + { + GTK_ADJUSTMENT(xsane.gamma_red_widget)->value = xsane.gamma_red; + GTK_ADJUSTMENT(xsane.gamma_green_widget)->value = xsane.gamma_green; + GTK_ADJUSTMENT(xsane.gamma_blue_widget)->value = xsane.gamma_blue; + + GTK_ADJUSTMENT(xsane.brightness_red_widget)->value = xsane.brightness_red; + GTK_ADJUSTMENT(xsane.brightness_green_widget)->value = xsane.brightness_green; + GTK_ADJUSTMENT(xsane.brightness_blue_widget)->value = xsane.brightness_blue; + + GTK_ADJUSTMENT(xsane.contrast_red_widget)->value = xsane.contrast_red; + GTK_ADJUSTMENT(xsane.contrast_green_widget)->value = xsane.contrast_green; + GTK_ADJUSTMENT(xsane.contrast_blue_widget)->value = xsane.contrast_blue; + + gtk_signal_emit(xsane.gamma_red_widget, sig_changed); + gtk_signal_emit(xsane.gamma_green_widget, sig_changed); + gtk_signal_emit(xsane.gamma_blue_widget, sig_changed); + + gtk_signal_emit(xsane.brightness_red_widget, sig_changed); + gtk_signal_emit(xsane.brightness_green_widget, sig_changed); + gtk_signal_emit(xsane.brightness_blue_widget, sig_changed); + + gtk_signal_emit(xsane.contrast_red_widget, sig_changed); + gtk_signal_emit(xsane.contrast_green_widget, sig_changed); + gtk_signal_emit(xsane.contrast_blue_widget, sig_changed); + + } + + gtk_signal_emit(xsane.gamma_widget, sig_changed); + gtk_signal_emit(xsane.brightness_widget, sig_changed); + gtk_signal_emit(xsane.contrast_widget, sig_changed); + + xsane_update_sliders(); /* update histogram slider */ + + while (gtk_events_pending()) + { + gtk_main_iteration(); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_gamma_to_histogram(double *min, double *mid, double *max, + double contrast, double brightness, double gamma) +{ + double m; + double b; + + m = 1.0 + contrast/100.0; + b = (1.0 + brightness/100.0) * 50.0; + + if (m > 0) + { + *min = 50.0 - b/m; + *mid = (100.0 * pow(0.5, gamma)-b) / m + 50.0; + *max = (100.0-b)/m + 50.0; + } + else + { + *min = 0.0; + *mid = 50.0; + *max = 100.0; + } + + xsane_bound_double(min, 0.0, 99.0); + xsane_bound_double(max, 1.0, 100.0); + xsane_bound_double(mid, *min+1, *max-1); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_enhancement_by_gamma(void) +{ + double min, mid, max; + double contrast, brightness, gamma; + + xsane_gamma_to_histogram(&min, &mid, &max, xsane.contrast, xsane.brightness, xsane.gamma); + + xsane.slider_gray.value[0] = min; + xsane.slider_gray.value[1] = mid; + xsane.slider_gray.value[2] = max; + + + /* red */ + contrast = xsane.contrast + xsane.contrast_red; + brightness = xsane.brightness + xsane.brightness_red; + gamma = xsane.gamma * xsane.gamma_red; + + if (contrast < -100.0) + { + contrast = -100.0; + } + + xsane_gamma_to_histogram(&min, &mid, &max, contrast, brightness, gamma); + + xsane.slider_red.value[0] = min; + xsane.slider_red.value[1] = mid; + xsane.slider_red.value[2] = max; + + + /* green */ + contrast = xsane.contrast + xsane.contrast_green; + brightness = xsane.brightness + xsane.brightness_green; + gamma = xsane.gamma * xsane.gamma_green; + + if (contrast < -100.0) + { + contrast = -100.0; + } + + xsane_gamma_to_histogram(&min, &mid, &max, contrast, brightness, gamma); + + xsane.slider_green.value[0] = min; + xsane.slider_green.value[1] = mid; + xsane.slider_green.value[2] = max; + + + /* blue */ + contrast = xsane.contrast + xsane.contrast_blue; + brightness = xsane.brightness + xsane.brightness_blue; + gamma = xsane.gamma * xsane.gamma_blue; + + if (contrast < -100.0) + { + contrast = -100.0; + } + + xsane_gamma_to_histogram(&min, &mid, &max, + xsane.contrast + xsane.contrast_blue, + xsane.brightness + xsane.brightness_blue, + xsane.gamma * xsane.gamma_blue); + + xsane.slider_blue.value[0] = min; + xsane.slider_blue.value[1] = mid; + xsane.slider_blue.value[2] = max; + + + xsane_enhancement_update(); + xsane_update_gamma(); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_enhancement_restore_default() +{ + xsane.gamma = 1.0; + xsane.gamma_red = 1.0; + xsane.gamma_green = 1.0; + xsane.gamma_blue = 1.0; + + xsane.brightness = 0.0; + xsane.brightness_red = 0.0; + xsane.brightness_green = 0.0; + xsane.brightness_blue = 0.0; + + xsane.contrast = 0.0; + xsane.contrast_red = 0.0; + xsane.contrast_green = 0.0; + xsane.contrast_blue = 0.0; + + xsane_enhancement_by_gamma(); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_enhancement_restore() +{ + xsane.gamma = preferences.xsane_gamma; + xsane.gamma_red = preferences.xsane_gamma_red; + xsane.gamma_green = preferences.xsane_gamma_green; + xsane.gamma_blue = preferences.xsane_gamma_blue; + + xsane.brightness = preferences.xsane_brightness; + xsane.brightness_red = preferences.xsane_brightness_red; + xsane.brightness_green = preferences.xsane_brightness_green; + xsane.brightness_blue = preferences.xsane_brightness_blue; + + xsane.contrast = preferences.xsane_contrast; + xsane.contrast_red = preferences.xsane_contrast_red; + xsane.contrast_green = preferences.xsane_contrast_green; + xsane.contrast_blue = preferences.xsane_contrast_blue; + + xsane.enhancement_rgb_default = preferences.xsane_rgb_default; + xsane.negative = preferences.xsane_negative; + + xsane_refresh_dialog(dialog); + xsane_enhancement_by_gamma(); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_enhancement_store() +{ + preferences.xsane_gamma = xsane.gamma; + preferences.xsane_gamma_red = xsane.gamma_red; + preferences.xsane_gamma_green = xsane.gamma_green; + preferences.xsane_gamma_blue = xsane.gamma_blue; + + preferences.xsane_brightness = xsane.brightness; + preferences.xsane_brightness_red = xsane.brightness_red; + preferences.xsane_brightness_green = xsane.brightness_green; + preferences.xsane_brightness_blue = xsane.brightness_blue; + + preferences.xsane_contrast = xsane.contrast; + preferences.xsane_contrast_red = xsane.contrast_red; + preferences.xsane_contrast_green = xsane.contrast_green; + preferences.xsane_contrast_blue = xsane.contrast_blue; + + preferences.xsane_rgb_default = xsane.enhancement_rgb_default; + preferences.xsane_negative = xsane.negative; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_histogram_to_gamma(XsaneSlider *slider, double *contrast, double *brightness, double *gamma) +{ + double mid; + double range; + + *contrast = (10000.0 / (slider->value[2] - slider->value[0]) - 100.0); + *brightness = - (slider->value[0] - 50.0) * (*contrast + 100.0)/50.0 - 100.0; + + mid = slider->value[1] - slider->value[0]; + range = slider->value[2] - slider->value[0]; + + *gamma = log(mid/range) / log(0.5); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_enhancement_by_histogram(void) +{ + double gray_brightness; + double gray_contrast; + double gray_gamma; + double brightness; + double contrast; + double gamma; + + xsane_histogram_to_gamma(&xsane.slider_gray, &gray_contrast, &gray_brightness, &gray_gamma); + + xsane.gamma = gray_gamma; + xsane.brightness = gray_brightness; + xsane.contrast = gray_contrast; + + if ( (xsane.xsane_color) && (!xsane.enhancement_rgb_default) ) /* rgb sliders active */ + { + if ((xsane.slider_gray.active == XSANE_SLIDER_ACTIVE) || + (xsane.slider_gray.active == XSANE_SLIDER_INACTIVE)) /* gray slider not moved */ + { + xsane_histogram_to_gamma(&xsane.slider_red, &contrast, &brightness, &gamma); + + xsane.gamma_red = gamma / gray_gamma; + xsane.brightness_red = brightness - gray_brightness; + xsane.contrast_red = contrast - gray_contrast; + + xsane_histogram_to_gamma(&xsane.slider_green, &contrast, &brightness, &gamma); + + xsane.gamma_green = gamma / gray_gamma; + xsane.brightness_green = brightness - gray_brightness; + xsane.contrast_green = contrast - gray_contrast; + + xsane_histogram_to_gamma(&xsane.slider_blue, &contrast, &brightness, &gamma); + + xsane.gamma_blue = gamma / gray_gamma; + xsane.brightness_blue = brightness - gray_brightness; + xsane.contrast_blue = contrast - gray_contrast; + + xsane_enhancement_update(); + xsane_update_gamma(); + } + else /* gray slider was moved in rgb-mode */ + { + xsane_enhancement_by_gamma(); + } + } + else /* rgb sliders not active */ + { + xsane_enhancement_update(); + xsane_update_gamma(); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static gint xsane_histogram_win_delete(GtkWidget *widget, gpointer data) +{ + gtk_widget_hide(widget); + preferences.show_histogram = FALSE; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(xsane.show_histogram_widget), preferences.show_histogram); + return TRUE; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_create_histogram_dialog(const char *devicetext) +{ + char windowname[255]; + GtkWidget *xsane_color_hbox; + GtkWidget *xsane_histogram_vbox; + GdkColor color_black; + GdkColor color_red; + GdkColor color_green; + GdkColor color_blue; + GdkColor color_backg; + GdkColormap *colormap; + GtkStyle *style; + + xsane.histogram_dialog = gtk_window_new(GTK_WINDOW_DIALOG); + gtk_window_set_policy(GTK_WINDOW(xsane.histogram_dialog), FALSE, FALSE, FALSE); + gtk_widget_set_uposition(xsane.histogram_dialog, XSANE_HISTOGRAM_POS_X, XSANE_HISTOGRAM_POS_Y); + gtk_signal_connect(GTK_OBJECT(xsane.histogram_dialog), "delete_event", GTK_SIGNAL_FUNC(xsane_histogram_win_delete), 0); + sprintf(windowname, "%s %s", WINDOW_HISTOGRAM, devicetext); + gtk_window_set_title(GTK_WINDOW(xsane.histogram_dialog), windowname); + xsane_set_window_icon(xsane.histogram_dialog, 0); + + xsane_histogram_vbox = gtk_vbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(xsane_histogram_vbox), 5); + gtk_container_add(GTK_CONTAINER(xsane.histogram_dialog), xsane_histogram_vbox); + gtk_widget_show(xsane_histogram_vbox); + + + /* set gc for histogram drawing */ + gtk_widget_realize(xsane.histogram_dialog); /* realize dialog to get colors and style */ + + style = gtk_widget_get_style(xsane.histogram_dialog); +/* + style = gtk_rc_get_style(xsane.histogram_dialog); + style = gtk_widget_get_default_style(); +*/ + + xsane.gc_trans = style->bg_gc[GTK_STATE_NORMAL]; + xsane.bg_trans = &style->bg[GTK_STATE_NORMAL]; + + colormap = gdk_window_get_colormap(xsane.histogram_dialog->window); + + xsane.gc_black = gdk_gc_new(xsane.histogram_dialog->window); + color_black.red = 0; + color_black.green = 0; + color_black.blue = 0; + gdk_color_alloc(colormap, &color_black); + gdk_gc_set_foreground(xsane.gc_black, &color_black); + + xsane.gc_red = gdk_gc_new(xsane.histogram_dialog->window); + color_red.red = 40000; + color_red.green = 10000; + color_red.blue = 10000; + gdk_color_alloc(colormap, &color_red); + gdk_gc_set_foreground(xsane.gc_red, &color_red); + + xsane.gc_green = gdk_gc_new(xsane.histogram_dialog->window); + color_green.red = 10000; + color_green.green = 40000; + color_green.blue = 10000; + gdk_color_alloc(colormap, &color_green); + gdk_gc_set_foreground(xsane.gc_green, &color_green); + + xsane.gc_blue = gdk_gc_new(xsane.histogram_dialog->window); + color_blue.red = 10000; + color_blue.green = 10000; + color_blue.blue = 40000; + gdk_color_alloc(colormap, &color_blue); + gdk_gc_set_foreground(xsane.gc_blue, &color_blue); + + xsane.gc_backg = gdk_gc_new(xsane.histogram_dialog->window); + color_backg.red = 50000; + color_backg.green = 50000; + color_backg.blue = 50000; + gdk_color_alloc(colormap, &color_backg); + gdk_gc_set_foreground(xsane.gc_backg, &color_backg); + + + /* add histogram images and sliders */ + + xsane_create_histogram(xsane_histogram_vbox, FRAME_RAW_IMAGE, 256, 100, &(xsane.histogram_raw)); + + xsane_separator_new(xsane_histogram_vbox, 0); + + xsane.slider_gray.r = 1; + xsane.slider_gray.g = 1; + xsane.slider_gray.b = 1; + xsane.slider_gray.active = XSANE_SLIDER_ACTIVE; + xsane_create_slider(&xsane.slider_gray); + gtk_box_pack_start(GTK_BOX(xsane_histogram_vbox), xsane.slider_gray.preview, FALSE, FALSE, 0); + gtk_widget_show(xsane.slider_gray.preview); + gtk_widget_realize(xsane.slider_gray.preview); + + xsane_separator_new(xsane_histogram_vbox, 0); + + xsane.slider_red.r = 1; + xsane.slider_red.g = 0; + xsane.slider_red.b = 0; + xsane.slider_red.active = XSANE_SLIDER_ACTIVE; + xsane_create_slider(&xsane.slider_red); + gtk_box_pack_start(GTK_BOX(xsane_histogram_vbox), xsane.slider_red.preview, FALSE, FALSE, 0); + gtk_widget_show(xsane.slider_red.preview); + gtk_widget_realize(xsane.slider_red.preview); + + xsane_separator_new(xsane_histogram_vbox, 0); + + xsane.slider_green.r = 0; + xsane.slider_green.g = 1; + xsane.slider_green.b = 0; + xsane.slider_green.active = XSANE_SLIDER_ACTIVE; + xsane_create_slider(&xsane.slider_green); + gtk_box_pack_start(GTK_BOX(xsane_histogram_vbox), xsane.slider_green.preview, FALSE, FALSE, 0); + gtk_widget_show(xsane.slider_green.preview); + gtk_widget_realize(xsane.slider_green.preview); + + xsane_separator_new(xsane_histogram_vbox, 0); + + xsane.slider_blue.r = 0; + xsane.slider_blue.g = 0; + xsane.slider_blue.b = 1; + xsane.slider_blue.active = XSANE_SLIDER_ACTIVE; + xsane_create_slider(&xsane.slider_blue); + gtk_box_pack_start(GTK_BOX(xsane_histogram_vbox), xsane.slider_blue.preview, FALSE, FALSE, 0); + gtk_widget_show(xsane.slider_blue.preview); + gtk_widget_realize(xsane.slider_blue.preview); + + xsane_draw_slider_level(&xsane.slider_gray); + xsane_draw_slider_level(&xsane.slider_red); + xsane_draw_slider_level(&xsane.slider_green); + xsane_draw_slider_level(&xsane.slider_blue); + + xsane_separator_new(xsane_histogram_vbox, 0); + + xsane_create_histogram(xsane_histogram_vbox, FRAME_ENHANCED_IMAGE, 256, 100, &(xsane.histogram_enh)); + + xsane_color_hbox = gtk_hbox_new(TRUE, 5); + gtk_container_set_border_width(GTK_CONTAINER(xsane_color_hbox), 5); + gtk_container_add(GTK_CONTAINER(xsane_histogram_vbox), xsane_color_hbox); + gtk_widget_show(xsane_color_hbox); + + xsane_toggle_button_new_with_pixmap(xsane_color_hbox, intensity_xpm, DESC_HIST_INTENSITY, + &xsane.histogram_int, xsane_histogram_toggle_button_callback); + xsane_toggle_button_new_with_pixmap(xsane_color_hbox, red_xpm, DESC_HIST_RED, + &xsane.histogram_red, xsane_histogram_toggle_button_callback); + xsane_toggle_button_new_with_pixmap(xsane_color_hbox, green_xpm, DESC_HIST_GREEN, + &xsane.histogram_green, xsane_histogram_toggle_button_callback); + xsane_toggle_button_new_with_pixmap(xsane_color_hbox, blue_xpm, DESC_HIST_BLUE, + &xsane.histogram_blue, xsane_histogram_toggle_button_callback); + xsane_toggle_button_new_with_pixmap(xsane_color_hbox, pixel_xpm, DESC_HIST_PIXEL, + &xsane.histogram_lines, xsane_histogram_toggle_button_callback); + xsane_toggle_button_new_with_pixmap(xsane_color_hbox, log_xpm, DESC_HIST_LOG, + &xsane.histogram_log, xsane_histogram_toggle_button_callback); + + gtk_widget_show(xsane_color_hbox); + +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + diff --git a/frontend/xsane-gamma.h b/frontend/xsane-gamma.h new file mode 100644 index 0000000..ed70175 --- /dev/null +++ b/frontend/xsane-gamma.h @@ -0,0 +1,48 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-gamma.h + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#include + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +extern void xsane_clear_histogram(XsanePixmap *hist); +extern void xsane_draw_slider_level(XsaneSlider *slider); +extern void xsane_update_slider(XsaneSlider *slider); +extern void xsane_update_sliders(void); +extern void xsane_create_slider(XsaneSlider *slider); +extern void xsane_create_histogram(GtkWidget *parent, const char *title, int width, int height, XsanePixmap *hist); +extern void xsane_calculate_histogram(void); +extern void xsane_update_histogram(void); +extern void xsane_histogram_toggle_button_callback(GtkWidget *widget, gpointer data); +extern void xsane_create_gamma_curve(SANE_Int *gammadata, int negative, double gamma, + double brightness, double contrast, int numbers, int maxout); +extern void xsane_update_gamma(void); +extern void xsane_enhancement_by_gamma(void); +extern void xsane_enhancement_restore_default(void); +extern void xsane_enhancement_restore(void); +extern void xsane_enhancement_store(void); +extern void xsane_enhancement_by_histogram(void); +extern void xsane_create_histogram_dialog(const char *devicetext); + +/* ---------------------------------------------------------------------------------------------------------------------- */ diff --git a/frontend/xsane-icons.c b/frontend/xsane-icons.c new file mode 100644 index 0000000..3165ab6 --- /dev/null +++ b/frontend/xsane-icons.c @@ -0,0 +1,1751 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-icons.c + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* --------------------------------------------------- */ + +const char *xsane_window_icon_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 14 16 6 1", +/* color */ +" none", +"b c #2020e0", +"w c #eeeeee", +"x c #fff098", +"y c #f0e890", +"z c #e8d880", +/* pixel */ +" xxyyyyy ", +" xyyyyyyyyyyz ", +"xyyyyzzyyyyyyz", +"xyxz zyyz", +"xxy yyz", +" yyyy yy ", +" zyyyyz yyy ", +" zzzz yxz", +" zbbbbz yyz", +" x zbbwwbbz yy", +"xy zbbwwbbz yy", +"xyy zbbbbz xyy", +"xyyy zzzz xyyz", +"xyyyyyyyyyyyz ", +" zyyyyyyyyz ", +" zzzzzzz " +}; + +/* --------------------------------------------------- */ + +const char *error_xpm[] = +{ +"40 40 6 1", +" c None", +". c #FE0809", +"+ c #FDFDFC", +"@ c #E5D5D6", +"# c #E1A09F", +"$ c #FE8081", +" #@@++++@@# ", +" #@++++++++++++@# ", +" #+++@#$......$$@+++# ", +" #+++#..............#+++# ", +" #++#..................@++# ", +" @++$....................$++@ ", +" @+@........................++@ ", +" #+@$.........................@+# ", +" #++...........................$++# ", +" ++$.....@+...............++....$++ ", +" #+#.....+++@.............+++@....#+# ", +" ++.....$+++++...........@++++$....++ ", +" #+#......#++++@.........+++++#.....#+# ", +" @+........#+++++.......@++++$.......+@ ", +" +@.........$++++@.....+++++#........++ ", +"#+$..........#+++++...@++++$.........$+#", +"@+$...........$+++++$@++++#..........$+@", +"@+.............#+++++++++$............+@", +"++..............$+++++++#.............++", +"++...............#+++++#..............++", +"++...............++++++@..............++", +"++..............@++++++++.............++", +"@+.............+++++@++++@............+@", +"@+$...........@++++#.#+++++..........$+@", +"#+$..........+++++$...$++++@.........$+#", +" +@.........@++++#.....#+++++........@+ ", +" @+........+++++$.......$++++@.......+@ ", +" #+#......@++++#.........#+++++.....#+# ", +" ++.....#++++#...........$++++$....++ ", +" @+#.....$++$.............#++$....#+# ", +" ++$.....#$...............$#....$++ ", +" #++............................++# ", +" #++..........................++# ", +" @++........................++@ ", +" @++$....................$++@ ", +" #++#..................#++# ", +" #+++#..............#+++# ", +" #+++@$$......$$++++# ", +" #+++++++++++++@# ", +" #@@++++@@# " +}; + +/* --------------------------------------------------- */ + +const char *warning_xpm[] = +{ +"40 40 4 1", +" c None", +". c #FFFFFF", +"+ c #FFFA00", +"@ c #000000", +" ", +" .. ", +" .. ", +" .++. ", +" .++. ", +" .++++. ", +" .++++. ", +" .++++++. ", +" .++++++. ", +" .++++++++. ", +" .++++++++. ", +" .++++++++++. ", +" .++++@@++++. ", +" .++++@@@@++++. ", +" .+++@@@@@@+++. ", +" .++++@@@@@@++++. ", +" .+++@@@@@@@@+++. ", +" .++++@@@@@@@@++++. ", +" .++++@@@@@@@@++++. ", +" .++++++@@@@@@++++++. ", +" .++++++@@@@@@++++++. ", +" .+++++++@@@@@@+++++++. ", +" .+++++++@@@@@@+++++++. ", +" .+++++++++@@@@+++++++++. ", +" .+++++++++@@@@+++++++++. ", +" .++++++++++@@@@++++++++++. ", +" .+++++++++++@@+++++++++++. ", +" .++++++++++++++++++++++++++. ", +" .++++++++++++++++++++++++++. ", +" .++++++++++++++++++++++++++++. ", +" .+++++++++++++@@+++++++++++++. ", +" .+++++++++++++@@@@+++++++++++++. ", +" .+++++++++++++@@@@+++++++++++++. ", +" .+++++++++++++++@@+++++++++++++++. ", +" .++++++++++++++++++++++++++++++++. ", +" .++++++++++++++++++++++++++++++++++. ", +" .++++++++++++++++++++++++++++++++++. ", +" ..++++++++++++++++++++++++++++++++++.. ", +" ...................................... ", +"........................................" +}; + +/* --------------------------------------------------- */ + +const char *file_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 4 1", +/* colors */ +"* c #000000", +". c #707070", +"- c #e0e0e0", +" none", +/* pixels */ +" ", +" ................ ", +" .*............*. ", +" .*............*. ", +" ................ ", +" ................ ", +" ................ ", +" ................ ", +" ................ ", +" ................ ", +" ................ ", +" ................ ", +" ....--------.... ", +" ....-...----.... ", +" ....-...----.... ", +" ....-...----.... ", +" ....-...----.... ", +" ............... ", +" ", +" " +}; + +/* --------------------------------------------------- */ + +const char *fax_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 4 1", +/* colors */ +"* c #000000", +". c #ffffff", +"- c #e0e0e0", +" none", +/* pixels */ +" ", +" ", +" ", +" .*********** ", +" ..*.........* ", +" ...*..**.*.*.* ", +" ****.........* ", +" *............* ", +" *...*...***..* ", +" *............* ", +" *.*.*.**.**..* ", +" *............* ", +" *..*....*..*.* ", +" *............* ", +" *.**..*....*.* ", +" *............* ", +" ************** ", +" ", +" ", +" " +}; + +/* --------------------------------------------------- */ + +const char *faxreceiver_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +"* c #000000", +"- c #e0e0e0", +" none", +/* pixels */ +" ", +" ********* ", +" *****-----* ", +" ****--------* ", +" ****-----***-* ", +" ****----*----* ", +" ***-------**--* ", +" ***------------* ", +" **--------------* ", +" **------------*** ", +" **-----------* ", +" **----------* ", +" *-------*---* ", +" *--------*** ", +" *----------* ", +" *----------* ", +" *----------* ", +" *---------* ", +" *------*** ", +" *----* ", +}; + +/* --------------------------------------------------- */ + +const char *colormode_xpm[] = { +/* width height num_colors chars_per_pixel */ +" 20 20 7 1", +/* colors */ +". c #000000", +"# c #0000ff", +"a c #00ff00", +"b c #7f7f7f", +"d c #ff0000", +"e c #ffffff", +" none", +/* pixels */ +" ", +" eeeee ", +" eeeee...... ", +" eeeee......ddddddd ", +" eeeee......ddddddd ", +" eeeee......ddddddd ", +" eeeee......ddddddd ", +" eeeeebbbbbbddddddd ", +" eeeeebbbbbbddddddd ", +" .....bbbbbbaaaaaaa ", +" .....bbbbbbaaaaaaa ", +" .....bbbbbbaaaaaaa ", +" .....eeeeeeaaaaaaa ", +" .....eeeeeeaaaaaaa ", +" .....eeeeee####### ", +" .....eeeeee####### ", +" .....eeeeee####### ", +" eeeeee####### ", +" ####### ", +" " +}; + +/* --------------------------------------------------- */ + +const char *Gamma_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 2 1", +/* colors */ +". c #000000", +" none", +/* pixels */ +" ", +" ", +" ............. ", +" ... .. ", +" .. .. ", +" .. . ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .... ", +" ........ ", +" " +}; + +/* --------------------------------------------------- */ + +const char *Gamma_red_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 2 1", +/* colors */ +". c #ff0000", +" none", +/* pixels */ +" ", +" ", +" ", +" ............. ", +" ... .. ", +" .. .. ", +" .. . ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .... ", +" ........ ", +}; + +/* --------------------------------------------------- */ + +const char *Gamma_green_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 2 1", +/* colors */ +". c #00ff00", +" none", +/* pixels */ +" ", +" ", +" ", +" ............. ", +" ... .. ", +" .. .. ", +" .. . ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .... ", +" ........ ", +}; + +/* --------------------------------------------------- */ + +const char *Gamma_blue_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 2 1", +/* colors */ +". c #0000ff", +" none", +/* pixels */ +" ", +" ", +" ", +" ............. ", +" ... .. ", +" .. .. ", +" .. . ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" .... ", +" ........ ", +}; + +/* --------------------------------------------------- */ + +const char *brightness_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #ffffff", +/* pixels */ +" ", +" ", +" ", +" . ", +" . ", +" . ", +" . ... . ", +" . .aaa. . ", +" .aaaaa. ", +" .aaaaaaa. ", +" .aaaaaaaaa. ", +" ....aaaaaaaaa.... ", +" .aaaaaaaaa. ", +" .aaaaaaa. ", +" .aaaaa. ", +" . .aaa. . ", +" . ... . ", +" . ", +" . ", +" . ", +}; + +/* --------------------------------------------------- */ + +const char *brightness_red_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #ff0000", +/* pixels */ +" ", +" ", +" ", +" . ", +" . ", +" . ", +" . ... . ", +" . .aaa. . ", +" .aaaaa. ", +" .aaaaaaa. ", +" .aaaaaaaaa. ", +" ....aaaaaaaaa.... ", +" .aaaaaaaaa. ", +" .aaaaaaa. ", +" .aaaaa. ", +" . .aaa. . ", +" . ... . ", +" . ", +" . ", +" . ", +}; + +/* --------------------------------------------------- */ + +const char *brightness_green_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #00ff00", +/* pixels */ +" ", +" ", +" ", +" . ", +" . ", +" . ", +" . ... . ", +" . .aaa. . ", +" .aaaaa. ", +" .aaaaaaa. ", +" .aaaaaaaaa. ", +" ....aaaaaaaaa.... ", +" .aaaaaaaaa. ", +" .aaaaaaa. ", +" .aaaaa. ", +" . .aaa. . ", +" . ... . ", +" . ", +" . ", +" . ", +}; + +const char *brightness_blue_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #0000ff", +/* pixels */ +" ", +" ", +" ", +" . ", +" . ", +" . ", +" . ... . ", +" . .aaa. . ", +" .aaaaa. ", +" .aaaaaaa. ", +" .aaaaaaaaa. ", +" ....aaaaaaaaa.... ", +" .aaaaaaaaa. ", +" .aaaaaaa. ", +" .aaaaa. ", +" . .aaa. . ", +" . ... . ", +" . ", +" . ", +" . ", +}; + +/* --------------------------------------------------- */ + +const char *contrast_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #ffffff", +/* pixels */ +" ", +" ", +" ", +" ..... ", +" .....aa.. ", +" ......aaaa.. ", +" .......aaaaa. ", +" ........aaaaaa. ", +" ........aaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" ........aaaaaa. ", +" ........aaaaaa. ", +" .......aaaaa. ", +" ......aaaa.. ", +" .....aa.. ", +" ..... ", +}; + +/* --------------------------------------------------- */ + +const char *contrast_red_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #ff0000", +/* pixels */ +" ", +" ", +" ", +" ..... ", +" .....aa.. ", +" ......aaaa.. ", +" .......aaaaa. ", +" ........aaaaaa. ", +" ........aaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" ........aaaaaa. ", +" ........aaaaaa. ", +" .......aaaaa. ", +" ......aaaa.. ", +" .....aa.. ", +" ..... ", +}; + +/* --------------------------------------------------- */ + +const char *contrast_green_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #00ff00", +/* pixels */ +" ", +" ", +" ", +" ..... ", +" .....aa.. ", +" ......aaaa.. ", +" .......aaaaa. ", +" ........aaaaaa. ", +" ........aaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" ........aaaaaa. ", +" ........aaaaaa. ", +" .......aaaaa. ", +" ......aaaa.. ", +" .....aa.. ", +" ..... ", +}; + +/* --------------------------------------------------- */ + +const char *contrast_blue_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #0000ff", +/* pixels */ +" ", +" ", +" ", +" ..... ", +" .....aa.. ", +" ......aaaa.. ", +" .......aaaaa. ", +" ........aaaaaa. ", +" ........aaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" .........aaaaaaa. ", +" ........aaaaaa. ", +" ........aaaaaa. ", +" .......aaaaa. ", +" ......aaaa.. ", +" .....aa.. ", +" ..... ", +}; + +/* --------------------------------------------------- */ + +const char *rgb_default_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 6 1", +/* colors */ +" none", +"w c #ffffff", +"k c #000000", +"r c #ff0000", +"g c #00ff00", +"b c #0000ff", +/* pixels */ +" ", +" rr gg kk bb ", +" rr gg kk bb ", +" rr gg kk bb ", +" rr gg kk bb ", +" rr gg kk bb ", +" rr gg kk bb ", +" r g k b ", +" r g k b ", +" r g k b ", +" rg k b ", +" rg k b ", +" rgkkb ", +" kk ", +" kk ", +" kk ", +" kk ", +" kk ", +" kk ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *negative_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 16 1", +/* colors */ +" none", +"W c #b0b0b0", +"r c #a01010", +"g c #20a010", +"b c #0020a0", +"c c #10a0a0", +"m c #a000a0", +"y c #a0a000", +"W c #ffffff", +"R c #ff0000", +"G c #00ff00", +"B c #0000ff", +"C c #00ffff", +"M c #ff00ff", +"Y c #ffff00", +"k c #000000", +/* pixels */ +" ", +" YYYYYYYYYYYYYYYYYk ", +" kkYYYYYYYYYkkCCbkB ", +" kkkYYYYYYkkkkCCkBB ", +" YYYYYYYYYYCCCCkRRB ", +" YYYYYkkYYYYCCkRWWW ", +" YYYYYYYYYYYYkRRBWW ", +" YYkkYYYYYYkkWBBBBB ", +" YkkYYYYYYkkWWWBBBB ", +" YYYYYYYYYkBBBBBBBB ", +" MMMMMMMMkGGGGGGGGG ", +" MMMMMMMkGGGGGGGGGG ", +" MMMGMMkGGGGGGGgGGG ", +" MMMCMkGGGGGGGGGgGG ", +" MBMMkgGGRGGGGGGGGG ", +" MMMkGGgGGGGGGGGgGG ", +" MMkGGGGGgGGGGgGGGG ", +" MkGGGGGGGgGGGGGGgG ", +" kGGGGGGGGGGGGGGGGG ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *enhance_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 16 1", +/* colors */ +" none", +"w c #b0b0b0", +"r c #a01010", +"g c #20a010", +"b c #0020a0", +"c c #10a0a0", +"m c #a000a0", +"y c #a0a000", +"W c #ffffff", +"R c #ff0000", +"G c #00ff00", +"B c #0000ff", +"C c #00ffff", +"M c #ff00ff", +"Y c #ffff00", +"k c #000000", +/* pixels */ +" ", +" bbbbbbbbbbbbbbbbbk ", +" wwbbbbbbbbbwwrrbkB ", +" wwwbbbbbbwwwwrrkBB ", +" bbbbbbbbbbrrrrkRRB ", +" bbbbbwwbbbbrrkRWWW ", +" bbbbbbbbbbbbkRRBWW ", +" bbwwbbbbbbwkBBBBBB ", +" bwwbbbbbbbkBWBBBBB ", +" bbbbbbbbbkBBBBBBBB ", +" ggggggggkGGGGGGGGG ", +" gggmgggkGGGGGGGGGG ", +" gggrggkGGGGGGGgGGG ", +" gggggkGGGGGGGGGgGG ", +" gyggkgGGRGGGGGGGGG ", +" gggkGGgGGGGGGGGgGG ", +" ggkGGGGGgGGGGgGGGG ", +" gkGGGGGGGgGGGGGGgG ", +" kGGGGGGGGGGGGGGGGG ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *store_enhancement_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 5 1", +/* colors */ +"* c #000000", +". c #606060", +"- c #e0e0e0", +"w c #ffffff", +" none", +/* pixels */ +" ", +" * * ", +" ** ** ", +" *** *** ", +" **** **** ", +" ** ** ** ** ", +" ** ** ** ** ", +" ** ***** ** ", +" ** *** ** ", +" ** * ** ", +" ** ** ", +" ** ** ", +" ** ** ", +" ** ** ", +" ** ** ", +" ** ** ", +" ** ** ", +" ** ** ", +" **** **** ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *restore_enhancement_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 5 1", +/* colors */ +"* c #000000", +". c #606060", +"- c #e0e0e0", +"w c #ffffff", +" none", +/* pixels */ +" ", +" ************** ", +" **************** ", +" ** ** ", +" ** ** ", +" ** ** ", +" ** ** ", +" ** ** ", +" ** ** ", +" *************** ", +" ************* ", +" ** *** ", +" ** ** ", +" ** ** ", +" ** *** ", +" ** ** ", +" ** *** ", +" ** ** ", +" **** **** ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *default_enhancement_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 4 1", +/* colors */ +"* c #000000", +". c #606060", +"- c #e0e0e0", +" none", +/* pixels */ +" ", +" * ", +" * ", +" * ", +" * ", +" * ", +" * * * ", +" ** * ** ", +" ** * ** ", +" ******* * ******** ", +" ** * ** ", +" ** * ** ", +" * * * ", +" * ", +" * ", +" * ", +" * ", +" * ", +" * ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *pipette_white_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #ffffff", +/* pixels */ +" ", +" ", +" .... ", +" ...... ", +" ...... ", +" ......... ", +" ...... ", +" .aaa.. ", +" .aaaa.. ", +" .aaaa. . ", +" .aaaa. . ", +" .aaaa. ", +" .aaaa. ", +" .aaaa. ", +" .aaaa. ", +" .aaaa. ", +" .aaaa. ", +" .aaaa. ", +" .aaa. ", +" ... ", +}; + +/* --------------------------------------------------- */ + +const char *pipette_gray_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 4 1", +/* colors */ +". c #000000", +" none", +"a c #ffffff", +"X c #808080", +/* pixels */ +" ", +" ", +" .... ", +" ...... ", +" ...... ", +" ......... ", +" ...... ", +" .aaa.. ", +" .aaaa.. ", +" .aaaa. . ", +" .XXXX. . ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" .XXX. ", +" ... ", +}; + + +const char *pipette_black_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #ffffff", +/* pixels */ +" ", +" ", +" .... ", +" ...... ", +" ...... ", +" ......... ", +" ...... ", +" .aaa.. ", +" .aaaa.. ", +" .aaaa. . ", +" ...... . ", +" ...... ", +" ...... ", +" ...... ", +" ...... ", +" ...... ", +" ...... ", +" ...... ", +" ..... ", +" ... ", +}; + +/* --------------------------------------------------- */ + +const char *zoom_in_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 4 1", +/* colors */ +" none", +". c #000000", +"+ c #c0c0c0", +"a c #ffffff", +/* pixels */ +" ", +" ", +" ..... ", +" .+aaaa. ", +" .++aaaaa. ", +" .+++aaaaaa. ", +" .aaaaaaaaa. ", +" .aaaaaaaaa. ", +" .aaaaaaaaa. ", +" .aaaaaaa. ", +" .aaaaa. ", +" ....... ", +" ... ", +" . ... ", +" . ... ", +" ..... ... ", +" . ... ", +" . .. ", +" ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *zoom_not_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 4 1", +/* colors */ +" none", +". c #000000", +"+ c #c0c0c0", +"a c #ffffff", +/* pixels */ +" ", +" ", +" .. ..... .. ", +" ...+aaaa. .. ", +" ..+aaaaa. .. ", +" .+..aaaaaa. .. ", +" .aa..aaaaa... ", +" .aaa..aaaa.. ", +" .aaaa..aa.. ", +" .aaaa.... ", +" .aaaa.. ", +" ....... ", +" .. ... ", +" .. ... ", +" .. ... ", +" .. ... ", +" .. ... ", +" .. .. ", +" ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *zoom_undo_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 4 1", +/* colors */ +" none", +". c #000000", +"+ c #c0c0c0", +"a c #ffffff", +/* pixels */ +" ", +" ", +" ..... ", +" .+aaaa. ", +" .++aaaaa. ", +" .+++aaaaaa. ", +" .aaaaaaaaa. ", +" .aaaaaaaaa. ", +" .aaaaaaaaa. ", +" .aaaaaaa. ", +" .aaaaa. ", +" ....... ", +" ... ", +" ", +" . . . . .. .. ", +" . . .. . . . . . ", +" . . .... . . . . ", +" . . . .. . . . . ", +" .. . . .. .. ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *zoom_out_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 4 1", +/* colors */ +" none", +". c #000000", +"+ c #c0c0c0", +"a c #ffffff", +/* pixels */ +" ", +" ", +" ..... ", +" .+aaaa. ", +" .++aaaaa. ", +" .+++aaaaaa. ", +" .aaaaaaaaa. ", +" .aaaaaaaaa. ", +" .aaaaaaaaa. ", +" .aaaaaaa. ", +" .aaaaa. ", +" ....... ", +" ... ", +" ... ", +" ... ", +" ..... ... ", +" ... ", +" .. ", +" ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *full_preview_area_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 4 1", +/* colors */ +" none", +". c #000000", +"+ c #c0c0c0", +"a c #ffffff", +/* pixels */ +" ", +" ................. ", +" . . ", +" . . . ", +" . ... . ", +" . . . . . ", +" . . . ", +" . . . ", +" . . . . . ", +" . . . . . ", +" . ............. . ", +" . . . . . ", +" . . . . . ", +" . . . ", +" . . . ", +" . . . . . ", +" . ... . ", +" . . . ", +" ................. ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *printer_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 4 1", +/* colors */ +". c #000000", +"# c #7f7f7f", +" none", +"b c #ffffff", +/* pixels */ +" ", +" ", +" ", +" ", +" ......... ", +" .bbbbbbb.. ", +" .bbbbbbb.b. ", +" .bbbbbbb.... ", +" .bbbbbbbbbb. ", +" .bbbbbbbbbb. ", +" .bbbbbbbbbb. ", +" .bbbbbbbbbb. ", +" .bbbbbbbbbb... ", +" ............. .. ", +" ..###########.. . ", +" . . . ", +" . . . ", +" .bbbbbbbbbbbbb. . ", +" .#############.. ", +" .............. ", +}; + +/* --------------------------------------------------- */ + +const char *zoom_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #ffffff", +/* pixels */ +" ", +" ", +" .............. ", +" .aaaaaaaaaaaa. ", +" .aaaaaaaaaaaa. ", +" .aaaaaaaaaaaa. ", +" .aaaaaaaaaaaa. ", +" .aaaaaaaaaaaa. ", +" .aaa....aaaaa. ", +" .aaaa...aaaaa. ", +" .aaa....aaaaa. ", +" .aa...a.aaaaa. ", +" .aaa.aaaaaaaa. ", +" .......aaaaaaaaaa. ", +" .aaaaa.aaaaaaaaaa. ", +" .aaaaa............ ", +" .aaaaa. ", +" .aaaaa. ", +" .aaaaa. ", +" ....... ", +}; + +/* --------------------------------------------------- */ + +const char *zoom_x_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 4 1", +/* colors */ +". c #000000", +" none", +"a c #ffffff", +"# c #4040ff", +/* pixels */ +" ", +" ", +" .............. ", +" .aaaaaaaaaaaa. ", +" .aaaaaaaaaaaa. ", +" .aaaaaaaaaaaa. ", +" .aaaaaaaaaaaa. ", +" .aaaaaaaaaaaa. ", +" .aaa....aaaaa. ", +" .aaaa...aaaaa. ", +" .aaa....aaaaa. ", +" .aa...a.aaaaa. ", +" .aaa ", +" .......a ## ## ", +" .aaaaa.a ## ## ", +" .aaaaa.. #### ", +" .aaaaa. ## ", +" .aaaaa. #### ", +" .aaaaa. ## ## ", +" ....... ## ## ", +}; + +/* --------------------------------------------------- */ + +const char *zoom_y_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 4 1", +/* colors */ +". c #000000", +" none", +"a c #ffffff", +"# c #4040ff", +/* pixels */ +" ", +" ", +" .............. ", +" .aaaaaaaaaaaa. ", +" .aaaaaaaaaaaa. ", +" .aaaaaaaaaaaa. ", +" .aaaaaaaaaaaa. ", +" .aaaaaaaaaaaa. ", +" .aaa....aaaaa. ", +" .aaaa...aaaaa. ", +" .aaa....aaaaa. ", +" .aa...a.aaaaa. ", +" .aaa ", +" .......a ## ## ", +" .aaaaa.a ## ## ", +" .aaaaa.. #### ", +" .aaaaa. ## ", +" .aaaaa. ## ", +" .aaaaa. ## ", +" ....... ## ", +}; + +/* --------------------------------------------------- */ + +const char *resolution_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 2 1", +/* colors */ +". c #000000", +" none", +/* pixels */ +" ", +" ", +" ", +" ... .. ", +" ..... .... . ", +" ....... ...... ... ", +" ....... .... . ", +" ....... .. ", +" ..... ", +" ... .. . ", +" .... ... ", +" .. .... . ", +" .... .. ", +" ...... ", +" .... .. . ", +" .. .... ", +" .. . ", +" .. ", +" .... .. . ", +" .. .. ", +}; + +/* --------------------------------------------------- */ + +const char *resolution_x_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +"# c #4040ff", +" none", +/* pixels */ +" ", +" ", +" ", +" ... .. ", +" ..... .... . ", +" ....... ...... ... ", +" ....... .... . ", +" ....... .. ", +" ..... ", +" ... .. . ", +" .... ... ", +" .. .... . ", +" .... ", +" ...... ## ## ", +" .... ## ## ", +" .. #### ", +" ## ", +" .. #### ", +" .... ## ## ", +" .. ## ## ", +}; + +/* --------------------------------------------------- */ + +const char *resolution_y_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +"# c #4040ff", +" none", +/* pixels */ +" ", +" ", +" ", +" ... .. ", +" ..... .... . ", +" ....... ...... ... ", +" ....... .... . ", +" ....... .. ", +" ..... ", +" ... .. . ", +" .... ... ", +" .. .... . ", +" .... ", +" ...... ## ## ", +" .... ## ## ", +" .. #### ", +" ## ", +" .. ## ", +" .... ## ", +" .. ## ", +}; + +/* --------------------------------------------------- */ + +const char *scanner_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #ffffff", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" .. ", +" .... ", +" .... ", +" .... ", +" .... ", +" ... ", +" .... ", +" ................ ", +" .aaaa.a.a.a.a.aa. ", +" .aaaaa.a.a.a.a.aa. ", +" .aaaaaaaaaaaaaaaa. ", +" .aaaaaaaaaaaaaaaa. ", +" .aaaaaaaaaaaaaaaa. ", +" ................. ", +" .................. ", +}; + +/* --------------------------------------------------- */ + +const char *intensity_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #ffffff", +/* pixels */ +" ", +" .................. ", +" .aaaaaaaaaaaaaaaa. ", +" .aaaaaaaaaaaaaaaa. ", +" .aaaa........aaaa. ", +" .aaaaaaa..aaaaaaa. ", +" .aaaaaaa..aaaaaaa. ", +" .aaaaaaa..aaaaaaa. ", +" .aaaaaaa..aaaaaaa. ", +" .aaaaaaa..aaaaaaa. ", +" .aaaaaaa..aaaaaaa. ", +" .aaaaaaa..aaaaaaa. ", +" .aaaaaaa..aaaaaaa. ", +" .aaaaaaa..aaaaaaa. ", +" .aaaaaaa..aaaaaaa. ", +" .aaaa........aaaa. ", +" .aaaaaaaaaaaaaaaa. ", +" .aaaaaaaaaaaaaaaa. ", +" .................. ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *red_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #ff2020", +/* pixels */ +" ", +" .................. ", +" .aaaaaaaaaaaaaaaa. ", +" .aaaaaaaaaaaaaaaa. ", +" .aa..........aaaa. ", +" .aa...........aaa. ", +" .aa..aaaaaaaa..aa. ", +" .aa..aaaaaaaa..aa. ", +" .aa..aaaaaaaa..aa. ", +" .aa...........aaa. ", +" .aa..........aaaa. ", +" .aa..aaaa..aaaaaa. ", +" .aa..aaaaa..aaaaa. ", +" .aa..aaaaaa..aaaa. ", +" .aa..aaaaaaa..aaa. ", +" .aa..aaaaaaa..aaa. ", +" .aaaaaaaaaaaaaaaa. ", +" .aaaaaaaaaaaaaaaa. ", +" .................. ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *green_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #20ff20", +/* pixels */ +" ", +" .................. ", +" .aaaaaaaaaaaaaaaa. ", +" .aaaaaaaaaaaaaaaa. ", +" .aaaaa.......aaaa. ", +" .aaa...........aa. ", +" .aaa..aaaaaaa..aa. ", +" .aaa..aaaaaaaaaaa. ", +" .aaa..aaaaaaaaaaa. ", +" .aaa..aaa.....aaa. ", +" .aaa..aaa......aa. ", +" .aaa..aaaaaaa..aa. ", +" .aaa..aaaaaaa..aa. ", +" .aaa..aaaaaaa..aa. ", +" .aaaa.........aaa. ", +" .aaaaa.......aaaa. ", +" .aaaaaaaaaaaaaaaa. ", +" .aaaaaaaaaaaaaaaa. ", +" .................. ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *blue_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +". c #000000", +" none", +"a c #3030ff", +/* pixels */ +" ", +" .................. ", +" .aaaaaaaaaaaaaaaa. ", +" .aaaaaaaaaaaaaaaa. ", +" .aa...........aaa. ", +" .aa............aa. ", +" .aa..aaaaaaaa..aa. ", +" .aa..aaaaaaaa..aa. ", +" .aa..aaaaaaaa..aa. ", +" .aa...........aaa. ", +" .aa...........aaa. ", +" .aa..aaaaaaaa..aa. ", +" .aa..aaaaaaaa..aa. ", +" .aa..aaaaaaaa..aa. ", +" .aa............aa. ", +" .aa...........aaa. ", +" .aaaaaaaaaaaaaaaa. ", +" .aaaaaaaaaaaaaaaa. ", +" .................. ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *pixel_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 3 1", +/* colors */ +"a c #000000", +" none", +". c #ffffff", +/* pixels */ +" ", +" ", +" ", +" a . ", +" a a . ", +" a . ", +" a a a . ", +" a . ", +" a . ", +" . ", +" . ", +" . a ", +" . aaaa ", +" . aaaa a ", +" . a aaaaaa ", +" . a aaaaaaaaa ", +" . aaaaaaaaaaaa ", +" ", +" ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *log_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 2 1", +/* colors */ +". c #000000", +" none", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" . .. ... ", +" . . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ... ", +" . . . . . ", +" . . . . . ", +" . . . . . ", +" . . . . . ", +" .... .. ... ", +" ", +" ", +" ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *move_up_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 2 1", +/* colors */ +". c #000000", +" none", +/* pixels */ +" ", +" ", +" ", +" . ", +" ... ", +" ... ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" ", +" ", +" ", +}; + +/* --------------------------------------------------- */ + +const char *move_down_xpm[] = +{ +/* width height num_colors chars_per_pixel */ +" 20 20 2 1", +/* colors */ +". c #000000", +" none", +/* pixels */ +" ", +" ", +" ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" ... ", +" ... ", +" . ", +" ", +" ", +" ", +}; + +/* --------------------------------------------------- */ + +const unsigned char cursor_pipette_white[] = +{ + 0x00, 0x70, 0x00, 0xf8, 0x80, 0xff, 0x00, 0xfe, 0x00, 0x7d, 0x80, 0x38, + 0x40, 0x18, 0x20, 0x14, 0x10, 0x12, 0x08, 0x01, 0x84, 0x00, 0x44, 0x00, + 0x32, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00 +}; + +/* --------------------------------------------------- */ + +const unsigned char cursor_pipette_black[] = +{ + 0x00, 0x70, 0x00, 0xf8, 0x80, 0xff, 0x00, 0xfe, 0x00, 0x7d, 0x80, 0x38, + 0x40, 0x18, 0xe0, 0x17, 0xf0, 0x13, 0xf8, 0x01, 0xfc, 0x00, 0x7c, 0x00, + 0x3e, 0x00, 0x0f, 0x00, 0x04, 0x00, 0x00, 0x00 +}; + +/* --------------------------------------------------- */ + +const unsigned char cursor_pipette_gray[] = +{ + 0x00, 0x70, 0x00, 0xf8, 0x80, 0xff, 0x00, 0xfe, 0x00, 0x7d, 0x80, 0x38, + 0x40, 0x18, 0x20, 0x14, 0x10, 0x12, 0xf8, 0x01, 0xfc, 0x00, 0x7c, 0x00, + 0x3e, 0x00, 0x0f, 0x00, 0x04, 0x00, 0x00, 0x00 +}; + +/* --------------------------------------------------- */ + +const unsigned char cursor_pipette_mask[] = +{ + 0x00, 0x70, 0x00, 0xf8, 0x80, 0xff, 0x00, 0xfe, 0x00, 0x7f, 0x80, 0x3f, + 0xc0, 0x1f, 0xe0, 0x17, 0xf0, 0x13, 0xf8, 0x01, 0xfc, 0x00, 0x7c, 0x00, + 0x3e, 0x00, 0x0f, 0x00, 0x04, 0x00, 0x00, 0x00 +}; + +/* --------------------------------------------------- */ + diff --git a/frontend/xsane-icons.h b/frontend/xsane-icons.h new file mode 100644 index 0000000..538f9ea --- /dev/null +++ b/frontend/xsane-icons.h @@ -0,0 +1,87 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-icons.h + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ------------------------------------------------------------------------- */ + +#ifndef XSANE_ICONS_H +#define XSANE_ICONS_H + +#define CURSOR_PIPETTE_WIDTH 16 +#define CURSOR_PIPETTE_HEIGHT 16 +#define CURSOR_PIPETTE_HOT_X 1 +#define CURSOR_PIPETTE_HOT_Y 14 + +extern const char *xsane_window_icon_xpm[]; +extern const char *error_xpm[]; +extern const char *warning_xpm[]; +extern const char *file_xpm[]; +extern const char *fax_xpm[]; +extern const char *faxreceiver_xpm[]; +extern const char *colormode_xpm[]; +extern const char *Gamma_xpm[]; +extern const char *Gamma_red_xpm[]; +extern const char *Gamma_green_xpm[]; +extern const char *Gamma_blue_xpm[]; +extern const char *brightness_xpm[]; +extern const char *brightness_red_xpm[]; +extern const char *brightness_green_xpm[]; +extern const char *brightness_blue_xpm[]; +extern const char *contrast_xpm[]; +extern const char *contrast_red_xpm[]; +extern const char *contrast_green_xpm[]; +extern const char *contrast_blue_xpm[]; +extern const char *rgb_default_xpm[]; +extern const char *negative_xpm[]; +extern const char *enhance_xpm[]; +extern const char *store_enhancement_xpm[]; +extern const char *restore_enhancement_xpm[]; +extern const char *default_enhancement_xpm[]; +extern const char *pipette_white_xpm[]; +extern const char *pipette_gray_xpm[]; +extern const char *pipette_black_xpm[]; +extern const char *zoom_not_xpm[]; +extern const char *zoom_out_xpm[]; +extern const char *zoom_in_xpm[]; +extern const char *zoom_undo_xpm[]; +extern const char *full_preview_area_xpm[]; +extern const char *printer_xpm[]; +extern const char *zoom_xpm[]; +extern const char *zoom_x_xpm[]; +extern const char *zoom_y_xpm[]; +extern const char *resolution_xpm[]; +extern const char *resolution_x_xpm[]; +extern const char *resolution_y_xpm[]; +extern const char *scanner_xpm[]; +extern const char *intensity_xpm[]; +extern const char *red_xpm[]; +extern const char *green_xpm[]; +extern const char *blue_xpm[]; +extern const char *pixel_xpm[]; +extern const char *log_xpm[]; +extern const char *move_up_xpm[]; +extern const char *move_down_xpm[]; +extern const char cursor_pipette_white[]; +extern const char cursor_pipette_gray[]; +extern const char cursor_pipette_black[]; +extern const char cursor_pipette_mask[]; + +#endif diff --git a/frontend/xsane-logo.xpm b/frontend/xsane-logo.xpm new file mode 100644 index 0000000..cfe0a03 --- /dev/null +++ b/frontend/xsane-logo.xpm @@ -0,0 +1,372 @@ +/* XPM */ +static char *xsane_64c[] = { +/* width height ncolors chars_per_pixel */ +"256 300 65 1", +/* colors */ +" c #CBDDFC", +". c #363777", +"X c #D2E6FC", +"o c #27241C", +"O c #B0A47E", +"+ c #1F1C14", +"@ c #D9EFFC", +"# c #E2D9B5", +"$ c #788DFC", +"% c #3848FC", +"& c #978C6B", +"* c #0A0B54", +"= c #C8BC94", +"- c #D6CCA5", +"; c #C0B48C", +": c #2028FB", +"> c #687CFC", +", c #242777", +"< c #5468FC", +"1 c #8097FC", +"2 c #4E4836", +"3 c #A2B9FC", +"4 c #858279", +"5 c #98ACFC", +"6 c #E9F7FC", +"7 c #3D47B3", +"8 c #B0C7FC", +"9 c #AAA27F", +"0 c #F1ECD5", +"q c #13179A", +"w c #BED7FC", +"e c #595785", +"r c #8FA6FC", +"t c #5F5842", +"y c #2F36B5", +"u c #CFC49C", +"i c #302C21", +"p c #BBCDFC", +"a c #4558FC", +"s c #867C5E", +"d c #8C9EFC", +"f c #DAD2AD", +"g c #020204", +"h c #B8AC85", +"j c #FBFBF5", +"k c #2B2EA0", +"l c #1E25B1", +"z c #AEBEFC", +"x c #7D7458", +"c c #C6C2B0", +"v c #EBE4C7", +"b none", +"n c #171CF9", +"m c #71684F", +"M c #15140F", +"N c #5E74FC", +"B c #3D3829", +"V c #131863", +"C c #6F84FC", +"Z c #474A8C", +"A c #0D0C0A", +"S c #8E8464", +"D c #2B37FB", +"F c #62669C", +"G c #A49976", +/* pixels */ +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbS&#u##-#f###v##ummbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb&&G=f#f#f---ff#f-#-##--#v#v#v-u=-==uh9hu=mbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbsS&;u-u-#f#v#vfff-###--f####---###-#fvv#ff#fu=-;OO;u;h;;===9&bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbGO-##-=-#f;==#-uff#vv####vv#fff#=vvvf#-f-f-####vff#--u==-uhOhu=;u=uf-u==;&bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbGOcvvvfff#--###uuff--uff-#fvv##f#v##-u-f#-##v#--u-###vfu-f-u-#-==uuu==uu;uu---===-=u;&Sbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;;-vvf-##vv##f--f-#--##-#u--uf#f--fv#####-==-ffv##-##u=-###f-uu;uu-u=u-uu;==hu-===u---uu=;OGh;;;Gbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=-##v#f##f##v###fv#ff-f#fu-##-u=u-#fu-f-#f-##fuu----#-u--uu-fu-u=#u=uu=u=hu--u;h=u-u==uu-u=f-u;h===;u;h;;&bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbf-vvf##v#fvvv##v#f#v#-v#f#f=##-f###u;=uuuu=u==-##-u-ufu--=u--u=-u=u-u;-u=uuhuu==u--uOh========u-#-u-=-=uu;===;h=hGSbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb9-=-vvv##0######v####ff#-#f#vv--=-##f-=uu-=uuhO=-uhhu--uu-===u==-u=uu=;u=u=--#;=9=f--u;;;u;=uhO;-u;hu#--=-u=uu==u=h==h9hhhGbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=u#fv-=##vvv#vfvvvvv-##---u--f--#--=-----==h;uu;hO;;-hG=;-u-u=;u=f--h==;hhO;;=;=-=uh=uu=u=;hh=uhh9;;-h9;=-u#uu;-=ff-==;;hhGhhhhhhbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;fffv#--f####-v-v-f#v####v-uu;u==-u-f#ff-;u=-=h;O;h;==hhO==;;huhu;;=-===--=h;O;h;===ufu-uO==u;hhO;O;;=hOO===;hu;u==u--u--#uh=h;Oh;hh;=;hbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=v---#v#fv##fu#0##f##ff#-f#-uu;;==;---ff-u-=-uuu=uh9h;u;h=;;;G;-==h==;=u;uu=;=Ohh;h=uu---u-=uuuu;=h99;=;h=;;;9;-u=;-u=u-uu-u=uhh;;h=uu=-=;=hh9bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=v#vv###fv#-vff#v###--cfuu--====-h=9;-=uu-fu==uff=h==;hhO;;h=hh;u=-=;=h==;=uh;;;=h;Ghu==u--===u-f=h=u;;;9==h;;;;u=-u;=O==h=u;;;=u;;9;-u=u--=;hh==O9mbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc00#v##0#vv#vfu-#--f#--=h-f;;c9;h;O;;h=u==;-u=hh-uu;=;;u;=u;=;9h=h;=uu;h9;uhO;GhOhOh;h=u==;uuuhO-uu;=;hu;;uh=;9O;h;;=u;;G;u;O;9;O;hh=;=u=u;-uuh9uu=hh99OGbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb#6v0#-f00##vv#f--=--c-f--Ou-;u=;OOOG;;h=u===;;h=u-=u;OOuu;;=u=;Oh9=;;;=;=9;uh==;hO9Gh;O===;=;=O==-==;O9=u;;=u=;hhO;=h;u;u9;u;==;OO99O=h=uuuuu=h=uf==;O&h;OG9hSbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbhvvv#v0v-f#vvv#vf#-u--uu-f-uu==h;=h;O99OO==h;uu;h==;;=u=hO;=uuuu=u;h;u;;uu-=u==hh;O;9G9Oh;=h===;h==;h=u=OO;;=uu===;h===;uu-====hh;h;O99hO;=;;uu=;=u===u=h9hh;;hO9OSbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-#f#f##vvv##--#0#fu=u--u==u;=f-=h;;O;u=hOhu;h=;h;hOhhOh;==h;Oh;fu=;h=uu==;u;=--;hO=O;u;;Oh=;h=h;;hOhh9h;==;;hh;--u;h=u==;;u;=-f=hh=O;==hO9==h;;;h;O;;9;;=u;;hOh==;9GGOGmbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbfvv###vvf#-vf=-#-f#-u=-u;u;u=cu-=h;;99;u;h;=;;h;;;=hhh=;hhOu;9h===-==h==;=hu;;uuuh;;OOhuhhh=;hh;;;=hhh;=hOh=;9O==;u==h=u;=h==;uuuh;=OOhu;hh=hh;;;=;;hh;=;hh==hO=u;u;h9OhGG&Sbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-0v#fvv0###uffu-f-f-uuuu===huu=-uhu;hhhhh;;h&huu;;=h9;h=;=h9h;h;=u=u=;==;=;Ouu=-uh=;hOhhO;;h&O=-;;=h9;h=;;;OO;h;=u=uu=u==;=h=u=u-hu=O9hhO;h;GOu-;;;;9hh==;;Oh;;;=-=u=;=;h9O&G9G&bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-v06#vvv#vf--f=9;u;--=;===uh;huuuu;=-;h;;Ghh9GGOh;uuh;=;;;hhh=O&9hOuu;;====h;hu-uu;;-=hh;9h;9GGOh;=u;;;;;;hO;;h&G;h=u=h;u==h;huuuu;h-=hh=9h;9GG9O==-;;=;;;;O;;;&G;hu-uh;==;hO9OOOGGxbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;f-0v00vv##-uu-;9;uGh=u=u;=;=;;-=u==hh==;=hOh;OOOGG==uu;;h;;OO=O&9=GO=u=uh;=u;;u=;==O;==;uhOO;OOOGG===u;=h;;OO;h&O;G9=u;u;;==;;=====O;==;uhOO=OOO9&;=;u=;h;;9O;;&9;99;u=u=;==;;h;hOG&&&Sbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=##fvvv0v#-##ff---9h;=-hOuuuu=G-#=huOhh;u=uu;hOGhhh9h;h-=hO;u;=;=u99h=uh9=-uu;Guf=;=hO;huu===hO9hhh9h;;u=hOhu;u;=u99h=uhO=uuu=G=#=;=;9;Ouu===;O9Ohh9h=;u=hhhu;u;=uOGh=u;O=-u-u&=f=OhhSG&GG&tbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbvf##v#fv###f##f###f;=;-u=h9uu-cu=uf=hh=h=O;h;=;=;9hOhhO;hh=;==u-#f-;;;uu=O9=uuu=uu-uhh=h;O;h;=;=;OhOhOhh;h;===uu#ff;;huu=hG=u=u=u=-uhh=h;hh;h=h;;OOOhhOh;h=;==uu#-#=;huuuh9;-uu=uu--hOh9G&&SS&bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbc0v0#0--v#uv#ufu--##-;h;uu-;---uuu=u=u-uu;h=;h9O==;;O;OG=;Ouu;====ff-;h;=uf;u-uuuu=u==-=u;h==hOO==;;O;h&=;Ouu;u=u=-#f;hhuu-=uu-u=-uuu=-=-;h=;hh9===;O;h&;;O=u;====-ff;h;=u-==--uuuuu==-=uh999&&xSsbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbb;vvv0vv0#=-v-#-u=u-uu=;u;=u=-uuu;u-==uu-u-u-uh9;hO;h=h;=;Ghu=uu=;uuuu=;===u=-=uu;=-=uuu--fu-=h9;hO;h;;;;=9Ou=uu=;=u-=u;==;u=uuuu;u-;u=u---uuu;G;hO=h;;;;=OO==uuu;=u-=u;==;u=uuuu;=f;-=u---u==OS&&sSstbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbv00ff#vv--f----u-u====u=;=;==u;;=;uu==u--f--=hh;h==9GO=;OO;;====u=u=====h;;;=u=hu;uu=;ufu#-f=hh;h;=OGO==OO;;====u=u;====;;;==u=hu;uu=;u-u#-#=;h;;;=OGO==h9;=====u=u=====;h;;=u=hu;=-=;u-uf-#;h9hGG9smmsbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbvv0ff-v#--uu-=-u--==;;u==;;===u=;;==-=;-=ff-=uu=;h=9GG;;hhh;=;uuu-==;;uu;;;;u=u==h==-==-=-f-=u-=;h=OGGh=Ohh;=;=uu-==;;uu=;;;=;uu=h==-==u=-f-==uu;h;OGGh=hOhh=;=uu-==;;uu=;=;u==u=h==-==u=-#-u=-=hOO&xss&mtbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbb;60v#v0#u=uf==u=---u;==ff=h;;=Ou--;=;=;;=uuuuu==uu;;9;=;GGO=hh=;u-uu;=;ufu;;;=9uuu==O;;=;=-uuu==u==;Oh=;G9O=hh=;u-uu;=;u-u;;;=Ouu-=;;=;=;u-uuu=====;hh=;GGO=;O=;=--u;===fu;h;;Ouuu==;;;u;=-uuu==uu=h9GOGsxmsmbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbb;vv60v###fu;=u=h==-u=u=u-u;;O;;;;uu-=h;h;=uu-;;;=;h==;Oh;;;Oh=;h==--====-u;;O;;;;-u-OsOhhuuu-;;;=;h==;hh;hhOh=;h==--u===-u=;O;;=;uu-u;;h;=uu-=;;==h=u;OO;;;OO==h;=u-u;==-uu;O;;=;u-f=;;hh=uu-=;;;=O;u;OG9&&Sxxs2bbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbcvvv0v#v#--=;;h==;h;=f-===u;OO;u;-u==u=hh=uuu=;;hO;h=hh;=h;hhhO;=hh;;-u===u;O9;u=uu=hs9hh;uuu==hhO;h=;h;=;=OhOO;=;hh;-u===u;O9h=;uu==u=;O==u=u=;hO;h;=h;=;;hhh9h=;hh=uuu==u;hGh===u==u==O;=u=u;;;9;h;=9h;h9&&Smsxtbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbc00vvv#-##f=;Oh;==O;=;==;uu=Oh;=;uu;;===;;u;u;;u;;;h;=hO;==hO&G9OOG9O9h;=uu=Oh;=;=u=hGxh;;u;==;u;;;h;=hOh==hO9h;=;hh;;=;=uu=hO;===u=;===;;u;u=hu;;;hh=hO;==;O9O;==hh;;==;uu=hO===;-=;=u=;;u===hu=h;hh=hOh=;h&&SSSSmtbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbb=0v00#vv-f-fu;9O;h;;;;hh=u-======u=;=u=;=u=h=u=;u=;=;O==h;=u=OmtmmmtmmtxG;u===;===uhuhxG;u=h=u=hu=;=;O=;;;=u=;G9h;hhh;h;;uf=;u;u;uuh==u;;u=;;u=;u=;=;O;;;h=u=;G9h;h;h;;h;=f==u;u;=u;===;;==;;u=;=u;=;O;;;h===h&&&Ssxmmbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbb;6jj0##v0#fu=;;;;;;OG;==9Ouu=u;u=h==;=u=;==;;=;=;uuu;hO=-uu=;h;OG9G&&GhOSmmh==;u=h==;;;m9==;;=;=;uu-;;9;-uu=;;;=h;;O9;==O9=uuu;u=;;=;;u=;==;h=;=;uu-;=G=-uu=h;;=h;;OGh==O9=uu=;==h==;;uu;===h=;=;uu-;=G;-uu=;hh;G9&smmxmbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbb;000j0vfvff-u=;Oh==OOG;;=OG;;u=u==h==-uu;==hhhh;;=;u-==O=====;hOh==OO9h;=9smmh=-==hu=-u;mO=hhhO;==;=-==h====u;;Oh;=OOGhhuOG;;u=u==hu=--uh==;hhO;;;;=uu=h;u==u;;Oh;uOO9OhuhGh;u=-=uh=;u-u;==;h;O;;;;=uu=;huu;u=;OOh;&&xmmxtbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbb0600600vf=uu-hOhh;h;=;OOh;;;;O-huh;uu=u=u-h;hO;hh===u-u-uh==u;OhOhO;=;OOh;;9&mhhuh;=u==Gs=;;;O;hh===u-uuuh==u;OOO;Oh=;OOO;;hhO=h=;;=u===u-=h;O;;h===u--u-O==u=OOO;O;;=hOO;;;hh=;=;h=uu==uu=h;O;hh===u--u-O====9OOh9OGGSmmmtbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbv0jjjjvvv=fuu=;=O9h;=hh=;;h9;u=;;u;;=-;u==;hOhh;h=uu--uu-;u=uu==O9O;=hh=;;hG;=s&O===;-;OS9h;OOh;h==uu-uuu;====;;OGO;=hh;;hhG;uu;h=;;;u;==;h;OOhhh=uuufuuu=u==u;=h99;=;O=;;;G;u=;hu==;u==u=;;hOh;h==uufuu-===u===hGGh;h&Gsxmttbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbb0j00000#--#ff;huu=hOh=;h;hh===-=;;Ou;h==hh;;uh;&;-===--u;=u-f;h==;;hO=;h;hh=u=u9mm&;;;;9s&h;=OhGh====--=;==-f;h==;;hO=;h;h;;u=u=;=h=;h;=;;;;=hhGhu===--u=u=-f=h=u;;hO;=h;h;;u=uu;=O;;;;u;h;;=hhGOu==u--u===-f=;;==;hOhh9G&smtttbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbj000j0v==#-u;=;;=;u;;=OOh;h;;u=;O9=uOh;GhhhOO;h;=;=;-u=OOfuu;=;huh==;=h9h;O;;u=;&tx9G99tG9h9O;h;===;uu=hO--u;=;h=;;=O=;GO;hhhuu;h&;uhO=GhOhOO;h;==;;uu=O9uu-==;h=;;=h=;GO=hh;=u;;G;u;O;GhOhhO;h;===;uuuh9uuu=;;;=;;=h=;&&&x2B2t2bbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbb00j00#f##fuu;Ohuu;;=u=hhhO=;h==;=G==h==hhO9G;;O=u====;h=u-==;OO=u;;=u=;hh9==h=u;=G9Gmm&x&99Gh;O;==;;;;O==-;;h9G==hO;=;h9OGh;Oh=h=&;=h;;hOO9GO;hh==;=;=O==-==;OG=u;;;-==hhOh=h;u;u9hu;;;;hh99O=h;==;=;=O==-==;h9===h;-=;OOSmmxmmttBbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbb-v0j0vf#fu;uu;Oh;==u=u==;h;u;;u-u====hh=O;GG9Oh==h===;h===huu=OO;==u====hh;=;;=uu;==;&tm&hGGGOO;=O;=;;O;;;O;;;GGOh;;;;h;hOh;hh;;=h;;hOOO9OGGGOO;=h;==;O===h===h9;==uu===;h===;uu-;u==;;hhhOGGOO;u;;=u;;;==;=u=h9;;uuu===;&x&&&&smt2Bbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbv0vvv#--;;h===;;Oh=fu=hh=u===;u;=--;hh;hhu=hOh=;h;h;hhOhOOO;==h;hh=f-=;h====;h=;=--;h9GtG=;hOO;hO;OOO9G9GGG9hhG9G&O;hOG&GO99GGOGO;;9GGOG9;h9GG;hOhh;hhOhhGhh==h;hO;--=;h====;;=;=--;hO=O;==;OO=;h;;;hhOhhGhh;=h;hO;u-==hOx9;hGGsxmt2bbbbbbbbbbbbbbb", +"bbbbbbbbbbbbv000vvfu=uuh;hu;9h==uu==;=uh=hu==u-=O;;9O;=hh;;h;h;;;=hhh==hhO=;9h===u=;h==h=hu=;uu=O;;&t9=OOO;O9GO9OOG&&GG&&SG&sS&&GGG&S&&S&s&GSG99S&GSSGOGGGh9GOOOhhhOO;;;Oh;;OO===u==h=u;=hu=;uu-hh=OOh=;;h=;hh;;;=hhh;=;hh==OO==;-==h9s9;Oh9Ssmt2ibbbbbbbbbbbbbb", +"bbbbbbbbbbbbjv00#ffuf==h9;;h;=u=u====;=;huu;-=hu;hOhOh;;h&;uu;==OO;h=;=hOh;h;=========;=O=u;-=h=h99&tSO99sGOhGGGSsSS&SSsmxsmxxsxxxmxxmxmmxxxssmsxxmxxxSSSxS9hG9O9GOOhh;OOO;h;;u=u=====;=h=u=u-h==hOhhO;hhG9=u=;=;Oh;;=;;OO;h;;u=uu;=hx&;h;;OGGmt2Bobbbbbbbbbbbbb", +"bbbbbbbbbbb#0jjv##-uuhhh=O&O;huu;;====h;hu-uuh=-;h;;9hhGGGOh;=uh;;;;;hhh;hSOhO=u;h==;=hhh=u==OhuhG9&tSGssxsSS&&xxxmmmttttt22t2ttt22t22222ttttttmtttmtmmtmtmsS&9&GGGOOOGhhh&Ghh===;;===h;h=uuu=;-=Oh;9h;OGG9h;=u;;;;h;;O;;;&Ghh=u=h;hGx9;O=u=9&xmtBibbbbbbbbbbbbb", +"bbbbbbbbbbb-0000v#uu;hh=O&O;GO=u;=h=;u;;u====hh==;=h9h;OO99G==uu;=h;hOh;O&9=&O=u;uh;;=h;==hhhG99OGGx2xSxmmmtmmmmttt222B2BiBBiBBBBBBBBBBBBB2B2BB22222B2t2ttt2xxsSS&S&G&&OOSGhGG;u;=;;==;;=u===hh;u;=;OO=O9O9&;=;u=;h;;OO;;&9hOO;===Gxx9;;;=;hO&xmtBiobbbbbbbbbbbb", +"bbbbbbbbbbb00vj#f=uu=;=u=GO;;uhhu-uu;G--=huOhh;u=uu;hOGhhh9h;h-;hO;u;=;;=G9;;uhO=u=u;&=uh9hG&&&G&&S2tmtttt22222BBiBBiiiio++oooo+oooio+iiioii+iiBBBBBBBBB2222ttmmmmx&S&&Gh&&O;;;O;-=u=G=f=;=;9;h=uu==;O9OhhOO=;uuhhhu;=h=uOGh===O;h4Oh&=#=;;;&Gsxm2Bibbbbbbbbbbbb", +"bbbbbbbbbb#v#0###---ufff-;;;uu;O9u=u===uf=Oh=h=O;O;;;;;9hOhhO=h;;;===uff-;;;u=;9G=;;;hhh;9SS&sxmxt2B222BBiiioiooo++++o+++++++++++++++MMM+MMMMoooioiBiBiiiBB2B222ttmxsSG9OGGGh;;9G;u=u;uu-uh;;;h;;hhuh;;OOOOhhO;h;;==uufff=;huu=h&xhuu=u=--hhh9Sst2iiMbbbbbbbbbbb", +"bbbbbbbbbb-f0v#0#u-==u##u;h;uu-;u--uuuuu=u-u=;h==hOh==;;O;GG=;Ouuh=;==f#-hhO==uh;=;hOOGGSSSxxttt2B++iBio+o+MM+MMMMMMMMMbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbMiBoBB2222ttmms&&ssSOh=h;u-==u=u==-=u;h;=hhG===hh;h&;=O=u;==u=-f#;hh=u-9shuu=u=u==u==O&Sm2io+bbbbbbbbbbb", +"bbbbbbbbbb6vfv0v#f==ufuu=;u;=u=uuuu;u-==uu-u-uuuh9=Oh;h=;;=;Ghu======-==;;;;;;hhOO9&&Gsxxmmtt2BBioMM+MMMMAMAAAAbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbB2222tttmxxsSSG9hh=;;=f=u=u---uuu;G;;O;h;;;;=O9==uu=;=u-=u;=u;uhx9uu==f=u;u-uu=hGx2Bo+bbbbbbbbbbb", +"bbbbbbbbb-##0vv#f-uu=====;;;;=uu;;uhuu=;---#-f=hhhh==OGO==OO;;;===u===;;=hOOGOOO&xSxxmt222BBii+MMMAAAAgAAbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbB22tttmmmss&O9G;O;===u-u#-#=;O;h;uhGO;=;Oh====uu=u=====;h=hOshh===u===-ufu-h&xmBioMbbbbbbbbbb", +"bbbbbbbbb#v#0v##f--u=;;u==;h=====;;u=-==u=ff-;uu=;h=GGG;;Ohh;;;uuuu=;hh;hOGGG&ssxmt222Biioo+MAAAAAgAbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb22tttmssS&GGhhu=;==-f-=u-u;;;h&GhuhOh;;==u=-==;;u==;;hhsO==;==-u===-#-=hhSm2i+Abbbbbbbbbb", +"bbbbbbbbbv0#vv###fu;u=--=h=;=O--u;=;;=;=uuuuu==uu=hO;=h9Gh=OO=;=-u=h;h;;O&SsstxttBBio++MMAAgAggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2tmtxs&S&GOO=h=-u-u==uu=;Ohu;GG9;;O=;=--u;=;=fu;h;OmG--;;;;hu;=u=u==hh&x2i+Mbbbbbbbbbb", +"bbbbbbbbb#v0#####-===u-u;;O;;;;-u-=h=O;=-u-;;;=;h==;Oh;hhOh=;h==u=;hOOOGSstm22BBio+MMAgAgggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbtmxs&&S&GG;=u-=;;==h;u;hO;;hOh;=h;=--u===-uu;hhOm9=--u;;;h=uu-=;hhOSxtB+Mbbbbbbbbbb", +"bbbbbbbb=v##0v-=u=fuu;=;99G===uu==u=hh=uu===;hO;h=h;;=h;hOO9;=hOhh;OGSSst22BBio+MAAggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbtxxSSSSOhu=u=;hO;;;=O;=;;hhhOh=;hh=uuu==u=OGhhmhu==u=;O;=-=u;;OGG&smBoMAbbbbbbbbb", +"bbbbbbbbhfvvvvuuu===;;OxmG;=====;===;;=;u=;u;;;h;=hO;==hOGO;=;9OOGG&sxmtBio+MAAgggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbtxsSS9Oh=;u=;;hh=;O;==;OOOh==hh;;====u=hOhO&m;=;====;u;==hu=h;9&StBoMAbbbbbbbbb", +"bbbbbbbb;ffv#fu==h;hOsx9h====u;===;===;===hu=;;;O;=h;=u=hGO;OhGG&sxmmtBio+MAggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbxs&&9;;;uu==;O;;;h=uu;GOh;hhh;;h;=f===GsmtmO==u;;==;;u=h==;hh&Sm2oMAbbbbbbbbb", +"bbbbbbbb#vvv#-;-=hsxsOh=;u=h=;;=u=;=u;;===;uuu=hOu-uu=;hh;hhh&S&Sx2BBi+MAggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbtSSGO;;--#=u9=-uu=;h;=h;;OOh==hG=u=hGs9&mG;;u=;==;;;==;=uu;h&SstB+Abbbbbbbbb", +"bbbbbbbb#vvv-=Oh9xmsh;==u==;==-uuh==hhhh;=;;u-=;O====u;hOh;hGSsxmtB++AAggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbs&h;=uu#-=h;uu;u=hOh;uh9GOhuhGh;Oxs9;Gm9u--;;=;h;O;;;;=u=hGSsti+Abbbbbbbbb", +"bbbbbbbb#####uxmm&O=h;h-Ouh;uuu==u-h;h9;hh===u--uuh==uhOhOhGGGxtBo+AggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbSh;----#f--O==u=OhOhO;;;hOO;;;9s9O;;Gx;u==uuuh;Ohh;=;;=-uhhmtB+ggbbbbbbbb", +"bbbbbbbbf=uu-9mGO;OO;u=;;u;==u;u==;hOh;hh=u=-fuu-;u=u=;;OGGGGxt2iMggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbu##vv#--u==u===hOOh=;h=h;;Gh=;;h-h4Gc==u=;;hOh;h;=uu-u=;9stBoAgbbbbbbbb", +"bbbbbbbbf&sssxx;;;=uuu=;;O=;;==;h=;uO;G;-=uu--===u--;h;=;OG&&m2iMgggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbG#vvv#--=-#=;;=;hhO;=h;;h;u;-c;=Ohh;h-;h;;=;h9O=u=uu-u;hG&xB+ggbbbbbbbb", +"bbbbbbbbf#ccchO==h;=u=;hG=-Oh;GhhhOhhh;===;u-=OOfu-;=;h=h;O&stiMgggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb#vvvuh---==;;==;uh==GO=h;;=u=;G;u;9;GhOhhOhhh===;=uuhGhhGm2+Agbbbbbbbb", +"bbbbbbbbv00v#-uh=;h=u;=Gu=h==hhO9G;;h=u;;==;h=u-==;Oh==;h;h&x2iAgbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbvv-v#v-u;hO=u;;;u=;hhOh=h;u;u9hu;;=;hh9O9=hhuu;=;=O;=u;9StioAgbbbbbbbb", +"bbbbbbbbvv0vv-uu-;=u-u;===hh;hhGGOOO==h===;h===hu==9O;===;O&m2+Agbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;vvv##uuu=hO;==uu=u=;h;=;;=u-;===;;O;h99GOO;=;;=u=;h==hh9&mBoggbbbbbbbb", +"bbbbbbbb00vff##uu=;u==fuhhh;hhu;h9h=;h=h;hhOhOhO==;hhOh=-;Ost2+gbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbvv###;==uuh=hO;--=;h;=u==hu==--=h9=hh;=hOO;=h;;;hhOhhGO9G&tBoAgbbbbbbbb", +"bbbbbbbbcvvvf##==;===u-=h;;9O==;h;;;hh;;;;hhh;;h;Ou;Gh;==;G&m2oAbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0vv###u;h==hO===u==h=u;=;==;uu-;h=9hh=;;h=hhh;;;=hhOh;h9G&mB+Agbbbbbbbb", +"bbbbbbbb=vvvv#-u;uu=-=hu;hOhOh;;h&;uuh==hO;h=;=hG;;h;;===h9&m2iAgbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbf#vvv#f=hh;h;;u==u=u==;=h=u;=-h=;hOhOO=hhGO=-;;=;Ohh;==hG&Sm2oAgbbbbbbbb", +"bbbbbbbbh#vv##uu;--uuh=-hO;hOhhGGGhh==uh;;;;;hh;;h&O;h=uhOO&x2BMAbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbh0vvvvf==;;GG;h=u=;;u==;;h=--u=h-u9h=9h;OGG9h==u;;;;;h;OOOGmtB+ggbbbbbbbb", +"bbbbbbbbbvf##v-uuu===;h==;=hG;;OOOGG==uu;=h;;Oh=O&O;GO==;;GGstBi+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbj00vv#u=u=&9;GO;u==;;==;;;u===h;==;uh99=O9O9Gh=;u==h;;OOhOsmmB+Agbbbbbbbb", +"bbbbbbbbbvvvf=v#===Ohh;u=uu;hOG;hhG;;h-;hO;=;;;;=GO=h=hh==hOSttBo+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb600v#0ff=uu9G;==;O;-=u=G=f=;==9hOuuu==hOOO;O9O=;uuhhO=h=;;;&mm2+ggbbbbbbbb", +"bbbbbbbbb0vv#####=h;=h=O;O==;;h9hOhhO=;;;;=uu-ff-h;;uu;OG=;h&st2Bobbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbv0vvvvvv##f#;=h=u=hO;-uu;uu-uOh;=h;hhhu;;hh9hOhOO=h;h==uu-u-9St2oggbbbbbbbb", +"bbbbbbbbb0vvvv#fu-uuu;h==h9O==;hO;GG=;Ouu;====f#-;h;=-u==u=;9&xt2iibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;00v00vv#f-#f#;;h=--==u-uuu=uu=-=u;h==h;G===hO;;&;=O;-;====---GstBoggbbbbbbbb", +"bbbbbbbbbcv#vv#f#-fu-u-=hO=Oh;h=;;=;Ghu=u==;u-u==;=====uu==OO9xm22Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb#0##000v#----uu;==;u===uu;=f=-=u---uuu;Gh;9=h;;;;uOG=u=u=;;u-;;GSmB+ggbbbbbbbb", +"bbbbbbbbb;vfvvf-f#-fff;hOhh==OGh=;h9;===u=u===u===;;;==u=huO;9Sxtt2Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb#0v#v000vvf-uu=u==;h;;=uuhu;=u=;u-uf-f=;O=h;=hGO;;;Oh;===uu==;==hOStBMggbbbbbbbb", +"bbbbbbbbbbfv#0#f#-#f-;-uu;h=GGG=;hOh;=;u=u-u=;;u=;;;==;===h=h;Gsxtt2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=v6v#vvvv##f#-==;===;;;u;u==h==-===u-#-uuuu;;;h&Ghuh9h;===u=-u==;;hGstiMggbbbbbbbb", +"bbbbbbbbbb##f#fff-f=-==uu;hO;=hGGh=hh;=u--=;=;--=;;;=O-u=;;;hO9&smm22bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-6v#f#0v-vf#ff-;=;=fu;h;;h=u-;;;;;u;=uu-=u=u==hhh=;GG9;;9=;=--u;;;=u;&xtiAggbbbbbbbb", +"bbbbbbbbbb--#-ff#f-=;==;hu=;Oh;hhO;=;h==f-==;u-u;;h;;;;-u-=hh9G9GSmt22bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-v##v##----;==-u=h;;u==;Oh;;;=-fu;;hh==--==;==h;u;hO;;hOh;=O;=--u;;=u=;Gm2iAggbbbbbbbb", +"bbbbbbbbbbu#uf###--=hhh;h=hh;=h=hOhO;=;h;;-u=;uu;OG;==uu==u=OOhh9&xt22ibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbOf#v-f#-u=;hGGOG&&G;hhhh;;OGO===u;=u=;9==u;u=hhO;;;uO;=;;;hhOh=;hh=uu==;;OSm2igggbbbbbbbb", +"bbbbbbbbbbbff##f#u=-;;;h;;;O;==hO9h;==O;=;===uu;Oh;=;=u;;;==;;;Oh&sstt2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbh9h=;;9SsxsSsxssS&G&9hOGGOh;hu;;====;=;=uh==h=hO=hO;;=;OOOh==hh;=;===u;&sm2+Aggbbbbbbbb", +"bbbbbbbbbbb-##-##-=-=;=;h;=h;=u=OGO;h;hh;h;=u-=======u;=u=;;=;hh;9S&xtt2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbxSxtttttttmmmsSGGGG9hO;=h;;=;h;=;=u=;==;;=O;;;huu=;9Oh;;hhh;h;;-=hO&mB+ggbbbbbbbbb", +"bbbbbbbbbbb-#ffff-u--==hh=-u=;;;=;h;;OG==;Ghu-==;u=;=;;==;;=u;O=hOGG&stt2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbBtt222ttttxssSS&9&9OOh=;h===h;;=;uu-;=9=-uu=;;;;O;;OOO==hG=u=h9SmBMggbbbbbbbbb", +"bbbbbbbbbbbbu-----u=--=;O===u=;hO;=;O9G;;=OG;=u=u==hu=--u;=;hhhOhh9GG&xt22bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbi22t222mmmsSSSGGO;;Oh;hhhhh;;;=-==Ohu=;u;;Oh==h99OhuOGO;=O9StBMggbbbbbbbbb", +"bbbbbbbbbbbb--=----u=-u-uuh==uhOOOhhh=;OOh;;hhhuhuh;u=u===-;h;9hhOhOGGSSmm2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2222tmtmmmsSGG9h;;Gh9Oh;;=;=-uu-O==u=OhOhh;;h;OO;h;hOOGxtogggbbbbbbbbb", +"bbbbbbbbbbbb;u--uf#-ffuuf;==u==;OOO;=h;;;;hO;-=;;u;==u;=u=;;Oh;;O;;;;hGSsmmtbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2t2tmtmxsss&&GGGGOhO;=uu--uuu;==u=;h9Oh=;h;h;;Gh=;9Sx2ogggbbbbbbbbb", +"bbbbbbbbbbbbb-h-vf#fffu==---;;==;hhh=;h=h;===u=;;O=;;=u;;;;=OhGh-==;=;9&sxxmtbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb22ttttxmxss&&&SGh;;=u-u=u;-f=h;u=hhO;=;;;;h=;=;G&mB+gggbbbbbbbbb", +"bbbbbbbbbbbbb=-#-f-##uOOffu==;;=h==h=hGh;Oh=u=;;G=uOh;GhhhOhhhh=;=huuh&SG&smm2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb22t2ttmmxsS&9OhO=u=hG=--u=;h=;;uh==GO;hh;=uOGmtBMggbbbbbbbbbb", +"bbbbbbbbbbbbbG#-fffu=u--==;Ohu=;;u==hhhO;=h=u;=G==h==hhO9G;;h;u;==;;9;;;9&xmtmmbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2t2ttxmxS&GGOhG;;-u=;h9=u;;;u=;OhO;=O;uO;smtiAggbbbbbbbbbb", +"bbbbbbbbbbbbbbu-##-=--=;=u=GO;==uu=u=;h;u;;=uu;===hh;hhGOGOO=uh;=u=O;=;9hO&mmmmtbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2tttsxxSG&G9h;h;;=O9;===u=uu;h;=;;===O&x2ogggbbbbbbbbbb", +"bbbbbbbbbbbbbbuuuuu=uh;h==;;;hh=fu=O;=====;u==fu;hh;hhu;OOh=;h;;;hhOh999OOGSsmtmmbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2mtmmxxss&GS9O==O;;O;--=;h;===;h=;;hGmBMgggbbbbbbbbbb", +"bbbbbbbbbbbbbbbu--u==u=;;hu;G;===uu=h=u;=h==;ufuh;;9O==;h;;;hh;h;;hhO;;hhGh&sxxxmmbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2tmmxxxsSGGGO;;O9;==-u=h=u==O=uOhO&tiMggbbbbbbbbbbb", +"bbbbbbbbbbbbbbb-==-ufu-;G;;h;===u=====;;h=u;-=h=h;OhOO=hh&;uu;;=hO;h=;=OGOhGG&&sxmtbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbttmmsS&&&&OOhhu===;u==;;h;u;;;Ss2igggbbbbbbbbbbb", +"bbbbbbbbbbbbbbbb=uu--=;==h&h;huu;;====;;;ufuu;=-hOh;O;h99GO;=uuh;h;;;hOhhOSG9&G&sxmtbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbtmxxmSSGs&hh;u=;;===;;h=uu;Osx2+gggbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbu-u-===uOGO;Gh=u;=;;==h======h;=u;uhGh;G9OGG;=u=;=h;hOh;h&GhSG9GSSxmmbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbmmmsSxs&&Gh==;;;==;;;==;h&stBAggbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbb&;u--uuu=GO=huhhuuuuhOu-=;=OhO;u=uuhhO9;hhG;;;-;;Ohu;;;;=GG;O;G&GGSSmtbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbmxsxm&OOhO=-uu=G=f=;;;&Sm2igggbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbb=-f###vf;;;uu;OOuuu=;uuf;;h=h=h;O==;;hOOO;hO;;;;;==u--f-h;hu=hG&9G&sxx2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbm&sssGOhGG;uuu;=u-uOOG&t2+gggbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbb&--ffvvf=;;u--;uuuuuu=u=uu=uhh==hOh==;hO;9G;;O=u;u==uf#-;hh=uuhhhO&&sxxtbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbmxs&9hOh=uuu-=-===OOxtiMgggbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbuuf##f-====u=uuuu=u-==uu--uuu=h9;hO=h=h;;;9h=uu==;uuu==;=;==;=;;hG&GssmmbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbSS&GOh=u==-=u;==;Gs2ogggbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbG---#-fu==;=uu=;uhuu==ufu#-f=hOhh==O9h=;hOh====uu====;u=;;h;==h9h&G&xxmmtbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbmSG9O9;;=-===u=;&sB+gggbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbb-uuuf-u====;u==;u=-=;-=ff-=uu=;h=GGG;=hOh==;uu=u=;;;u=;hh;=h;hOG9&&smmttt2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbSGG99;=-u===;h&tiAggbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbb&u=##-=u;uh-uu;;=;===u=-=-==uu=hO;=hGGh=OO=;u-u=;=hu-=hhh;G=hh&&Ssxmt22BBBBbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbG9GGO;;-;;=hGm2Mgggbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbb=-#f-u=u=;;---=h=O;=-fu=;==;h==hOh;hhOhu=O==--==;u-u;h9OOG&9G&xmt2BBBioo+oibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbShhOhhOu==hstiAgggbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbb&=-#=;h=-=uu=uu=hh==u=u;hhhhhuh;;=h=hhOO;;hh;;-u=h;=hGSGG&&smmt2iio+MMAAMMoobbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbSOOO9;=-OOx2+gggbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbb;-u;;u-=u-;;====;====;u;;;h;;hO;==hO9Oh;=Oh;;=;;==OGSGSsxmt2Bio+MAgggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=f##vvv00v-uSSbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbSOhO=;;hsmBMgggbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbb=u-u----=====;==;=u;;==;;;h;=h;=u=hGO;h;hh;9;h;=OGGssxmtBBo+MAgggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbhc##0v#v#v#v#fffhsbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbSO;h;;9xtiAggbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbh-=f-=-==uu;;=u;h=;=;-uu;;O=-==;;h;hO;;OG;;h&GOO&SxxtBBi+MMAggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-#v##vf#vff#f---uOSbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbGhOhhGx2+gggbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbb;-uu=f---u;==hh;;;=;;u-=;O=uu==hhO;=;OGGOhhSs&Ssmt2Bo+MAggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb9&GG;uuuufuu-GG&4bbbbbbbbbbbbbbbbbbbbbb9#f#-##v0vf#-u==h;=;Sbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb9OO9&mBAggbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbOh-;=f-f-u=-;;;G;h;==;-u-uuh;=uhOhOhOOh9G&&&smt22iiMAgggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbhhf##v###v---=uuu--uf-#-fh=u=&bbbbbbbbbbbbbbbbbbbh=-f####v#--;==h=;h;h&bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb9GGStigggbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbb;-=-u#uu-u=hOh;;O==u-f=u-;=====;9GOhhGGGSsmtt2BoMAggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb&;v#ffv###vf###f-uu--=f###vf-#-uuuu==O9&&bbbbbbbbbbbbbbbb9==u----uuuu=uuuu-u;=h&bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb&O&stiggbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbhu==--=;===O;G;u=u=--u===u-;h=;hOGGOGSsmm2Bi+AAggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;=f#v#vv#f-##f#v#fff#u-;u##f####f-u##u;uu=hhO=;9Gbbbbbbbbbbbbbb9hOh;-=u;ufff---u=;h==9sbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb&GS2oggbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbb;-h;uh=;;hh;hh===;--=O9---==hh=O;O&Gstm2BB+MAggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=-#uf#-f#vv#f=#v-u#;---uu-u-fffu#v#=;###--==u==uh=;&hhGGbbbbbbbbbbbbb&&GGh;;-ff-##-;9=uu;hOG9xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbSGx2+gbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbh==;=;h9=;h======;h==u==hOO=;OG9Gsxt2Bi+Agggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbu#0v#ff-##f#vfv=fv-##---;=u-uu#----f;--#-fu;;--u==-=;hhGh;9h;xbbbbbbbbbbbmSG&9===uuf;-u#uuhOGhh9GG9bbbbbbbbbbbbbbbbbbbbbbbbbbbbbSm2+gbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbh=;hhhhhh=u;====O;==;==;GGOhOG&SxtBB+MAggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbfvvvvv0v###v#vvvvf###-uuu=h=O=;ufuuf--=--fu---h;u-u--u-u;;;=hh;;=O9bbbbbbbbbbbSS9GO;u==u-fuuuuO9h;hhh999bbbbbbbbbbbbbbbbbbbbbbbbbbbxm2+bbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbb;hh-=;hhu=h;;;hhOhOOh;=hOOG&&&xt2ioMgggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb###ffv60vffv#vv#-###v#-u=-=;fuh;h-u;===;;h=;Oh=uu;=;hu##-===uu==O;;h=;9&bbbbbbbbbbbS&&9GOO;=O;=-u;;hOhu=OG&GGbbbbbbbbbbbbbbbbbbbbbbbbbbt2bbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbO=====u=;h=h;;hOh;;OhG;GsSsxm2BoMAggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc##vv-##vvvv#f#vf#c##cf##;=uh;uu=;;u;h;=;==;hh;=;;;u=h;=uu-uu;u-=uhuuO;=;GG9sbbbbbbbbbb&S&GGG9h==;=uuhO=;;=;hG9OG&mbbbbbbbbbbbbbbbbbbbbbbbm2bbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbsO=;;G=-u;==hh;h;;=O&9GSSxmtBiMAggggbbbbbbbbbbbbbbbbbbbbbbbbbbbbcv0f-#v###0vvv#v##--uf#=f#;u==h;O9=;;Ghuu;;=;h;h==uhOh=h;;u=uu=uu===;uu;uu9;9G&&&xbbbbbbbbbbSS&&O;=;Oh=;;=-uuu;;hO9G&&&bbbbbbbbbbbbbbbbbbbbbbmbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbOhGOO;=uuuh;hh;;GGGG&mmm22i+Aggggbbbbbbbbbbbbbbbbbbbbbbbbbbbb##v#f###=fvfvv##f#-f-==-#fu==f;Oh;h;hO9GO;=uuh;hh;=hO;h;G9;;uu===uu==;;u--u;huh&GGS&&tbbbbbbbbbs&GG9Ghh=9O;;uu=;=;;hO9&O99Gbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;GhOhOuuf=;=hhOG9GSmttBi+Mggggbbbbbbbbbbbbbbbbbbbbbbbbbbbcv0#vvf#v#=u#=u##--uu--;uuu==u;;=u;u;9O=9999G;=uu=u;;;Oh;;&9h99=u==h;=uh==uu=u;;;=hh9&sGsmbbbbbbbbbm&&&&hhG9hOO=uu=;===OOOOGG&&mbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbmhhhO===f;hOhhOG&Sm22B+Mgggggbbbbbbbbbbbbbbbbbbbbbbbbbbf0v###v#v#v#;=f-fuu-#--=Ou-==u;9h;uuuuhhh9hhOGO=;u;hOh=;=h==GG;;;;h=-=u;9u-=;u=9O;===;9G&ssSsbbbbbbbbbb&G&9h&&;=;=h=-=-=9=-;OO9sSs&sbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbGOO;;hu=;hhhhOO&smBiMAggggbbbbbbbbbbbbbbbbbbbbbbbbbb-fvv#v#v000000--uf#uhhu-u=;u-#;h;;;;h;hhu;;hOOhh;Oh=;hh;=uu-u-hhhu-;O9u-uu;=uf=h;;=h;;;O=O9&Ssxsmbbbbbbbbb9hh=hhhu-uOO=-uu;=u-=99GGSSssbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb9;GGu=h==hOGSsxtB+Mggggbbbbbbbbbbbbbbbbbbbbbbbbbhvfuvvfv0vvv#v00v-==--f==u-u--=u=uu;uOh;;hhO;;;;9;O&=;O=u=u===##f;hh=u-=;=-=uuuu=uu;uhh;;;h9hhO&ssstmbbbbbbbbbh;=OOh=ufu=u-=u-=u;==h;G&&&sstbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;;;G;u=;O&sxt2iMAggggbbbbbbbbbbbbbbbbbbbbbbbb;0vvvv-f000v#####f-=uu=u=uuuu==u==;;-u-c==;9hOO;h;hh;;99;==;;h=uu=u;===u==u-u==f=uuu---uuu=9hO9;99G&sSmmbbbbbbbbb9OGOh;uu=u--==-=uuuuuu;hOGxsxmbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb&h9h;=;OGst2B+Aggggbbbbbbbbbbbbbbbbbbbbbbbbc#-#vv#fvv#v#v#-f--uu=;;;==u=h=O==hGS;=-=-;OGOhh;9GG;hOGOh;;;==;=;=;=;hhh;=u=huh=u;;=-uf-f=;9h;;=OGG9G&xmxxbbbbbbbbb999Ghhu-u;-;u-===-u---=9&&SSSx2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb&O;;Oh&sm2oMAgggbbbbbbbbbbbbbbbbbbbbbbbb;0fu-v0#-fv#f##-#-u;;==;hhh;h;hh9;h=&x9;=u=h;;hO9OGSSG;G&GhhO;;h=;hhO;;hOhh=h;;;h=;u=;u=-f-=uu=;h;O&&O;GssSxmmbbbbbbbbbsG9O=;uu=;u=-u=uu-#-u;=h9&Sstmtbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbGGhGGSm2oAggggbbbbbbbbbbbbbbbbbbbbbbb-v##vv#--#v-u#--#-uh=O;uh9O9h&;hhG9GG&mSG9OOO9GOOG&S&G&sSSGGSOG9hhhGOGO=h99OOG;=;OhOhh=h;;uu==;uu=hOh=OGG&O&xSxmmbbbbbbbbbs9OG;u-====;u;=uu-=u;=;hG&SSxmtbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbGO&&sx2oAgggbbbbbbbbbbbbbbbbbbbbbbbc0v00###vf-u-fu;==-=hO9O;O9GS&&&SGGGSxmtmS&GGSSsSsxsSxxxsxxxsSSxS&O9&GSGO9GGSGGGGO;;O9OG9h;u=h;h;;O;=hOO;O9G99GxxmsmbbbbbbbbbsGOO=-fu==;Ouu--==;==hh;G&sSxmtbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb&&sm2oMgggbbbbbbbbbbbbbbbbbbbbbbbv###0vv#vf#u=h9hhG&G&O&&SS&smmxxxssxxmBBtmmmmmtttttttmttmtmttttmmmtmmsxsxxssmmxSS&G&GGG&SGOhO;OGGGO9h;OO;OhhOGG&&smtmtbbbbbbbbb&h;==uuu=h==-;-=hhO;hh=GGG&ssmm2bbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbSmtB+Agbbbbbbbbbbbbbbbbbbbbbbb0vvv#vv#u#--;9&&&&&sxxxsxmxxtttttttt22t2BB22222222222B22B2222B22222222tttttmtttttmmxxmxxsssSs&GSGG&GG&OG&hh;hGGG9O9sxmtt2bbbbbbbbbG;hh=uuu;u=uuh==h;hO=OGhOG&xmmttbbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbt2i+gbbbbbbbbbbbbbbbbbbbbbbcv60vvv##f=;;hGsmmxmtttt2t22t2B2BB2BBBBBBiiBiBBBiiBiiiiioiioiBBiiiBBBBBBBBBB2222222t2ttttmttmxmxxxsSsSSS&G&&O;h9&GGGGSxmtt2bbbbbbbbbbOh;==;=u==u=;=u;;;;;h;9;h9Smmmttbbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbB2Bbbbbbbbbbbbbbbbbbbbbbb=00v000#f;u=OGsmmmt222BBBBBiiBBiiiiioooooooooo++++o+ooo+o+oioioooioooooooiiiiBBiiBBBBBBBB2B22t22ttttmmxmxms&SG&SGGG&O9&SSSm222bbbbbbbbbbG;;;=-u;=u=;uu-;uG;-==hO9G&xxmttbbbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbBbbbbbbbbbbbbbbbbbbbbbb#vv0vvvvuO&&smtt2BiBiio++o++MM++++++M++++MMMMM+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb++oiooiiiBiBBBBiBBBBBB222ttttttxxxsxsxS&G&SssSst2BBbbbbbbbbbb;h;==;=;;=;;=-u;Ohu=;uhO&&&&mt22bbbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc0fv###uhO&Stt2BBioo++++++MMMM+MAAAbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbboiooiiBBBBBB22t2t2ttmmtmmxxsSSSxmm22Bbbbbbbbbbb&;==;=h;=;==;=u-uuh====9OG&Sxxmt2bbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbv#v#f==h&4xt2Biooo+MMAAAAAbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbioBBB2B2B222t222tmxxxxxmm222Bbbbbbbbbbb9;;hh=u;=uu---u-u;==u;h9&&&SxmmtBbbbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb#vv--OO9Smt2iio+MMMAAbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbboB2BB222222ttmmmmmt2BBibbbbbbbbbbO=;hh;u-u----=u;-f=h;u;O9&G&mmtt2bbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbG#v-c;9sxt2iii+AAbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbsS&SGSsx222bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbBB2222t2ttttt22iibbbbbbbbbbbOh;hu-u=u-u;O=--u=;h=;h=G9Gmmm22bbbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-f=hh9smt2BobbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbG=#v###0v#=;;G&S&msmBbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbi2B2Bt2t22BioobbbbbbbbbbS;h--u-=-;u;u-u;hO=u;;hu;O&Smxtt2bbbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-ch9SsmtbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbGfvvvv0vffvv#-u;;hGGO;OO&s2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbBt22222iiobbbbbbbbbbbhu=u-#u=;uu;===O9;=======9&Ssmtt2bbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcu;u9xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb&-ff#fu##vv#f-u-fu;9O;;===O;;hSmibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbi22BBiibbbbbbbbbbbbh==u==;=;9hh=uh;hO;--=hOhO9&stttBbbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-hObbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;fvv##f####-#f;;;;;;;h9;u;uhuu9=;hStibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbBBBiobbbbbbbbbbbS=;u-==;;==h;=;hO;;=uu;O;;9&sxm22bbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbO##0#####v#uh;=h9G9G&G&99hh;;=u;uu9hG&x2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbiiBbbbbbbbbbbbb;u==u=u-u;O9=;hhu==u;u=;hOG&smttBbbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbS#000v####-=9O&&mmxmxxmmxxs&&G9=---;;uhS&&tBbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbboBbbbbbbbbbbbb==;uuuuO;h;G9;;=u=;====hhGGGSmtBBbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;#-v000##=h9ssmm222BB22222tmmmsS9Oh=;;;=OOGsmt+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbu-fuu-;;==GGO9O;u=;h;==hhhOGsxt2Bbbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbf#f#0vvf=G&SttBBio+iiooiiBB222txmsS&SGh=uu;G&sxtobbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;;ufu-=u=G&;;;;h=-===G=u;O9&tt22Bbbbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb&#v#vv---hSmt2Bio++M+AAAMAAMMMiBBtmtmxS&GOhhh=O&sxtibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;=-f###f#=;huu=OO;-u=;=uu;GGsx22Bibbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbh0v#vf;-;SmtBo+AMMgM*,lqn:D::nql,Voo2tmsmS&9OhO;OGSmxBbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb--#ffvvv=h;u-u===-=uu=u;=;9Gxt2Bibbbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;0v0vv#c&mt2oMAgggVy%aa%:nDDD::DD%%ayqVitss&&&9OO;9GSxm2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-f-###ff==;=uu==-uu;-=u===;h&xt2iobbbbbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc0vf#v-;st2oMggg*qn:aaaC>DDa%DDa$%:Da%nnn:DD%DD::n,xh;uhGSxm2ogbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbuvv#v#u=u=u-u=;=;h;;h=;;=u;Osxm2o+Mbbbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbS06jv#GmiAggqn::DD%%DD::D::nn:C1da>r3a:<<%D:::D%DDaN>N>N<7=#-#h9xBiMbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbv0j###=;;===h=hhh;h;=;OOhhhO9&s2i+Agbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcvvv#=miggVDDDDDDD::D::DDDDa$r1$$$<5jjpjXj61X1aC51<%::D%%DaNCCC><5835311jj6j6j68@N$88$aD:%a%aN$11$CNaa%De=--#-&tB+gbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0vjv=uuh=hhOG9hu=u;;O;;;hOhOOsxt2oAgbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbjv0#hs2MggnnnnDD%%a%%DDDDD%aNdp@www56jjjjjX68r @5>a%Naa>d5rd$N186j66@Xjjjjj6j8@jXrN>1C$5zz5dCNaa%DDD::9vf#-OtBiMbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb#vv00vu;hOO;O9G=;=uhOh;;hO;;&xSx2iMgbbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbm=h&xxbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;v00#=xigglDDD::n:n:D%<3wwwX6jjjjjjjjjjjjjj6jjjjj6pd>NN<13X@6jjjjjjjjjjjjjjjjjjjjj66 z51$><>N96v0#=9sxibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00v#v--f;;;;;;;Ohh;;h;=u=u=;uuG&SstBAggbbbbbb", +"bbbbbbbbbbbbbbbbbbbbbbbbbbbbb#0vff##vfh&m2iMgbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbff-u&mBAgq:::::DDDDD%%a<>158w66jjjjjjjjjjjjjjjjjjjj@ pzrd$CC>>>NNN<<<$53p @66666jjjjjjjjjjjjjjjjjX8w8z5d$CCN>C>>>N<3855w86jjjjjjjjj@@jj@jj3<13r>D::nn::DDDDD:D400v-Omoggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbfj0v0jv-;uf--==;==;uh;=9h;;hO;u=h9OGStBMggbbbbbbb", +"bbbbbbbbbbbbbbbbbb00v0000vfc=;9m2ogggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbx--ffh&2i+VD%%%DDD::n::Da>d1N$51 jjjjjjjjjj88XjXw66z%%>$CaD::nnn::::::f00vuG2Mggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbj0000f#--fu=;O==;;;u;=hOO;;9xm9=OGOGstiAggbbbbbbb", +"bbbbbbbbbbbbbbbbb60v000vv#fOh9&tBMggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;f##-GmBiADD:D::::n:D%NCC<%>CN36 @@wj6jjjj3r1@j3rw 3%D%N>N%D:nnnnn::7v00v=xBAggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb000jvv-ffu===hG;u=;=u=uhhh;=hGmh;;hh&x2igggbbbbbbb", +"bbbbbbbbbbbbbbbb0vvvv##-##=h9Sm2ogggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=u#vf=S2iMq::nnnn::%a$53d%:D%<DaNC$<:n:%aaa%:::Z000#;xiAggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb#j000v#fuuuu;OO;;hhu==u;u===h=;u;G&G;O&xtiAggbbbbbbbb", +"bbbbbbbbbbbbbb6vvvvvvu==;;&G&xtiAgbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-#v-fc42Bo*::D%%a%%::%%::%N1a138 @8%:D:N33%Da5$DD%aa%a%%DD$aa<$1r35annnn%Cr<:D%aa<<%nn::Dy=6v0#Otigggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbv#fjv0vf==u;;O=;&S;;O=h=-===Ouu;===GOGG&x2oAgggbbbbbbbb", +"bbbbbbbbbbbb#00vv###ff-f-OhGGs2oAgbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbSu-uu;&xm2MlD::nDD::nDaN%%a<>$dda:n:n:a$1a::%%aa<%nnnnsvvvvuS2Aggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4#vv0##v#u==uuu-uf=;huu=9O=--=h=-f=O;h=9O&xB+gggbbbbbbbbb", +"bbbbbbbbbbb-00#00v#f-f#vuhOGGstB+gbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=hu-uO&tt2Ann:DD:::D%aa%D%%DD:<$1>a:::DD%%%O00#f-9togggbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbf0#vvvvfuf-uu-u;u=====;;;=uuu;u;;-;===--uu;&mBogggbbbbbbbbbb", +"bbbbbbbbbbcv0vv0vfff=;;==;OOG&xtBi+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbx=u--;h&ttt+qnn:D%a%:DDDD:::aa:DD%aaNDnnnnn:DaN + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* --------------------------------------------------------------------- */ + +#include "xsane.h" +#include "xsane-preferences.h" +#include "xsane-rc-io.h" + +/* --------------------------------------------------------------------- */ + +#define POFFSET(field) ((char *) &((Preferences *) 0)->field - (char *) 0) +#define PFIELD(p,offset,type) (*((type *)(((char *)(p)) + (offset)))) + +#define PRTOFFSET(field) ((char *) &((Preferences_printer_t *) 0)->field - (char *) 0) + +/* --------------------------------------------------------------------- */ + +Preferences preferences = + { + 0, /* no default filename */ + 0137, /* image umask (permission mask for -rw-r------) */ + 0027, /* image umask (permission mask for -rwxr-x----) */ + 0, /* no fax project */ + 0, /* no default faxcommand */ + 0, /* no default fax receiver option */ + 0, /* no default fax postscript option */ + 0, /* no default fax normal option */ + 0, /* no default fax fine option */ + 0, /* no fax viewer */ + 210.0, /* fax_width: width of fax paper in mm */ + 296.98, /* fax_height: height of fax paper in mm */ + 0.0, /* fax_leftoffset */ + 0.0, /* fax_bottomoffset */ + 0, /* no doc viewer */ + 80.0, /* jpeg_quality */ + 7.0, /* png_compression */ + 5, /* tiff_compression_nr */ + 5, /* tiff_compression_1_nr */ + 1, /* overwrite_warning */ + 1, /* increase_filename_counter */ + 1, /* skip_existing_numbers */ + 1, /* tooltips enabled */ + 0, /* (dont) show histogram */ + 0, /* (dont) show standard options */ + 0, /* (dont) show advanced options */ + 0, /* (dont) show resolution list */ + 10.0, /* length unit */ + 1, /* main window fixed (1) or scrolled (0) */ + 1, /* preserve_preview */ + 0, /* preview_own_cmap */ + 1.0, /* preview_gamma */ + 1.0, /* preview_gamma_red */ + 1.0, /* preview_gamma_green */ + 1.0, /* preview_gamma_blue */ + 1.6, /* gamma */ + 1.0, /* gamma red */ + 1.0, /* gamma green */ + 1.0, /* gamma blue */ + 0.0, /* brightness */ + 0.0, /* brightness red */ + 0.0, /* brightness green */ + 0.0, /* brightness blue */ + 0.0, /* contrast */ + 0.0, /* contrast red */ + 0.0, /* contrast green */ + 0.0, /* contrast blue */ + 1, /* rgb default */ + 0, /* negative */ + GTK_UPDATE_DISCONTINUOUS, /* update policy for gtk frontend sliders */ + 0, /* psrotate: rotate in postscript mode (landscape) */ + 0, /* printernr */ + 0 /* printerdefinitions */ + }; + +/* --------------------------------------------------------------------- */ + +static struct + { + SANE_String name; + void (*codec) (Wire *w, void *p, long offset); + long offset; + } +desc[] = + { + {"filename", xsane_rc_pref_string, POFFSET(filename)}, + {"image-umask", xsane_rc_pref_int, POFFSET(image_umask)}, + {"directory-umask", xsane_rc_pref_int, POFFSET(directory_umask)}, + {"fax-project", xsane_rc_pref_string, POFFSET(fax_project)}, + {"fax-command", xsane_rc_pref_string, POFFSET(fax_command)}, + {"fax-receiver-option", xsane_rc_pref_string, POFFSET(fax_receiver_option)}, + {"fax-postscript-option", xsane_rc_pref_string, POFFSET(fax_postscript_option)}, + {"fax-normal-option", xsane_rc_pref_string, POFFSET(fax_normal_option)}, + {"fax-fine-option", xsane_rc_pref_string, POFFSET(fax_fine_option)}, + {"fax-viewer", xsane_rc_pref_string, POFFSET(fax_viewer)}, + {"fax-left-offset", xsane_rc_pref_double, POFFSET(fax_leftoffset)}, + {"fax-bottom-offset", xsane_rc_pref_double, POFFSET(fax_bottomoffset)}, + {"fax-width", xsane_rc_pref_double, POFFSET(fax_width)}, + {"fax-height", xsane_rc_pref_double, POFFSET(fax_height)}, + {"doc-viewer", xsane_rc_pref_string, POFFSET(doc_viewer)}, + {"overwrite-warning", xsane_rc_pref_int, POFFSET(overwrite_warning)}, + {"increase-filename-counter", xsane_rc_pref_int, POFFSET(increase_filename_counter)}, + {"skip-existing-numbers", xsane_rc_pref_int, POFFSET(skip_existing_numbers)}, + {"jpeg-quality", xsane_rc_pref_double, POFFSET(jpeg_quality)}, + {"png-compression", xsane_rc_pref_double, POFFSET(png_compression)}, + {"tiff-compression_nr", xsane_rc_pref_int, POFFSET(tiff_compression_nr)}, + {"tiff-compression_1_nr", xsane_rc_pref_int, POFFSET(tiff_compression_1_nr)}, + {"tool-tips", xsane_rc_pref_int, POFFSET(tooltips_enabled)}, + {"show-histogram", xsane_rc_pref_int, POFFSET(show_histogram)}, + {"show-standard-options", xsane_rc_pref_int, POFFSET(show_standard_options)}, + {"show-advanced-options", xsane_rc_pref_int, POFFSET(show_advanced_options)}, + {"show-resolution-list", xsane_rc_pref_int, POFFSET(show_resolution_list)}, + {"length-unit", xsane_rc_pref_double, POFFSET(length_unit)}, + {"main-window-fixed", xsane_rc_pref_int, POFFSET(main_window_fixed)}, + {"preserve-preview", xsane_rc_pref_int, POFFSET(preserve_preview)}, + {"preview-own-cmap", xsane_rc_pref_int, POFFSET(preview_own_cmap)}, + {"preview-gamma", xsane_rc_pref_double, POFFSET(preview_gamma)}, + {"preview-gamma-red", xsane_rc_pref_double, POFFSET(preview_gamma_red)}, + {"preview-gamma-green", xsane_rc_pref_double, POFFSET(preview_gamma_green)}, + {"preview-gamma-blue", xsane_rc_pref_double, POFFSET(preview_gamma_blue)}, + {"gamma", xsane_rc_pref_double, POFFSET(xsane_gamma)}, + {"gamma-red", xsane_rc_pref_double, POFFSET(xsane_gamma_red)}, + {"gamma-green", xsane_rc_pref_double, POFFSET(xsane_gamma_green)}, + {"gamma-blue", xsane_rc_pref_double, POFFSET(xsane_gamma_blue)}, + {"brightness", xsane_rc_pref_double, POFFSET(xsane_brightness)}, + {"brightness-red", xsane_rc_pref_double, POFFSET(xsane_brightness_red)}, + {"brightness-green", xsane_rc_pref_double, POFFSET(xsane_brightness_green)}, + {"brightness-blue", xsane_rc_pref_double, POFFSET(xsane_brightness_blue)}, + {"contrast", xsane_rc_pref_double, POFFSET(xsane_contrast)}, + {"contrast-red", xsane_rc_pref_double, POFFSET(xsane_contrast_red)}, + {"contrast-green", xsane_rc_pref_double, POFFSET(xsane_contrast_green)}, + {"contrast-blue", xsane_rc_pref_double, POFFSET(xsane_contrast_blue)}, + {"rgb-default", xsane_rc_pref_int, POFFSET(xsane_rgb_default)}, + {"negative", xsane_rc_pref_int, POFFSET(xsane_negative)}, + {"gtk-update-policy", xsane_rc_pref_int, POFFSET(gtk_update_policy)}, + {"postscript-rotate", xsane_rc_pref_int, POFFSET(psrotate)}, + {"printernr", xsane_rc_pref_int, POFFSET(printernr)}, + {"printerdefinitions", xsane_rc_pref_int, POFFSET(printerdefinitions)} + }; + +/* --------------------------------------------------------------------- */ + +static struct + { + SANE_String name; + void (*codec) (Wire *w, void *p, long offset); + long offset; + } +desc_printer[] = + { + {"printer-name", xsane_rc_pref_string, PRTOFFSET(name)}, + {"printer-command", xsane_rc_pref_string, PRTOFFSET(command)}, + {"printer-copy-number-option", xsane_rc_pref_string, PRTOFFSET(copy_number_option)}, + {"printer-resolution", xsane_rc_pref_int, PRTOFFSET(resolution)}, + {"printer-width", xsane_rc_pref_double, PRTOFFSET(width)}, + {"printer-height", xsane_rc_pref_double, PRTOFFSET(height)}, + {"printer-left-offset", xsane_rc_pref_double, PRTOFFSET(leftoffset)}, + {"printer-bottom-offset", xsane_rc_pref_double, PRTOFFSET(bottomoffset)}, + {"printer-gamma", xsane_rc_pref_double, PRTOFFSET(gamma)}, + {"printer-gamma-red", xsane_rc_pref_double, PRTOFFSET(gamma_red)}, + {"printer-gamma-green", xsane_rc_pref_double, PRTOFFSET(gamma_green)}, + {"printer-gamma-blue", xsane_rc_pref_double, PRTOFFSET(gamma_blue)} + }; + +/* --------------------------------------------------------------------- */ + +void preferences_save(int fd) +{ + Wire w; + int i, n; + + w.io.fd = fd; + w.io.read = read; + w.io.write = write; + xsane_rc_io_w_init(&w); + xsane_rc_io_w_set_dir(&w, WIRE_ENCODE); + + for (i = 0; i < NELEMS(desc); ++i) + { + xsane_rc_io_w_string(&w, &desc[i].name); + (*desc[i].codec) (&w, &preferences, desc[i].offset); + } + + n=0; + + while (n < preferences.printerdefinitions) + { + for (i = 0; i < NELEMS(desc_printer); ++i) + { + xsane_rc_io_w_string(&w, &desc_printer[i].name); + (*desc_printer[i].codec) (&w, preferences.printer[n], desc_printer[i].offset); + } + n++; + } + + xsane_rc_io_w_set_dir(&w, WIRE_DECODE); /* flush it out */ +} + +/* --------------------------------------------------------------------- */ + +void preferences_restore(int fd) +{ + SANE_String name; + Wire w; + int i, n; + + w.io.fd = fd; + w.io.read = read; + w.io.write = write; + xsane_rc_io_w_init(&w); + xsane_rc_io_w_set_dir(&w, WIRE_DECODE); + + + while (1) + { + xsane_rc_io_w_space(&w, 3); + if (w.status) + { + return; + } + + xsane_rc_io_w_string(&w, &name); + if (w.status || !name) + { + return; + } + + for (i = 0; i < NELEMS (desc); ++i) + { + if (strcmp(name, desc[i].name) == 0) + { + (*desc[i].codec) (&w, &preferences, desc[i].offset); + break; + } + } + if (!strcmp(name, "printerdefinitions")) + { + break; + } + } + + + n=0; + while (n < preferences.printerdefinitions) + { + preferences.printer[n] = calloc(sizeof(Preferences_printer_t), 1); + for (i = 0; i < NELEMS(desc_printer); ++i) + { + xsane_rc_io_w_space (&w, 3); + if (w.status) + { + return; + } + + xsane_rc_io_w_string(&w, &name); + if (w.status || !name) + { + return; + } + + if (strcmp(name, desc_printer[i].name) == 0) + { + (*desc_printer[i].codec) (&w, preferences.printer[n], desc_printer[i].offset); + } + else + { + break; + } + } + n++; + } + +} diff --git a/frontend/xsane-preferences.h b/frontend/xsane-preferences.h new file mode 100644 index 0000000..19482fa --- /dev/null +++ b/frontend/xsane-preferences.h @@ -0,0 +1,122 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-preferences.h + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#ifndef xsane_preferences_h +#define xsane_preferences_h + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#include +#include + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +typedef struct + { + char *name; /* user defined printer name */ + char *command; /* printercommand */ + char *copy_number_option; /* option to define number of copies */ + int resolution; /* printer resolution for copy mode */ + double width; /* printer width of printable area in mm */ + double height; /* printer height of printable area in mm */ + double leftoffset; /* printer left offset in mm */ + double bottomoffset;/* printer bottom offset in mm */ + double gamma; /* printer gamma */ + double gamma_red; /* printer gamma red */ + double gamma_green; /* printer gamma green */ + double gamma_blue; /* printer gamma blue */ + } +Preferences_printer_t; + +typedef struct + { + char *filename; /* default filename */ + mode_t image_umask; /* image umask (permisson mask) */ + mode_t directory_umask; /* directory umask (permisson mask) */ + + char *fax_project; /* fax project */ + char *fax_command; /* faxcommand */ + char *fax_receiver_option; /* fax receiver option */ + char *fax_postscript_option; /* fax postscript option */ + char *fax_normal_option; /* fax normal mode option */ + char *fax_fine_option; /* fax fine mode option */ + char *fax_viewer; /* fax viewer */ + double fax_width; /* width of fax paper in mm */ + double fax_height; /* height of fax paper in mm */ + double fax_leftoffset; /* left offset of fax paper in mm */ + double fax_bottomoffset; /* bottom offset of fax paper in mm */ + + char *doc_viewer; /* doc viewer for helpfiles */ + + double jpeg_quality; /* quality when saving image as jpeg */ + double png_compression; /* compression when saving image as pnm */ + int tiff_compression_nr; /* compression type nr when saving multi bit image as tiff */ + int tiff_compression_1_nr; /* compression type nr when saving one bit image as tiff */ + int overwrite_warning; /* warn if file exists */ + int increase_filename_counter; /* automatically increase counter */ + int skip_existing_numbers; /* automatically increase counter */ + + int tooltips_enabled; /* should tooltips be disabled? */ + int show_histogram; /* show histogram ? */ + int show_standard_options; /* show standard options ? */ + int show_advanced_options; /* show advanced options ? */ + int show_resolution_list; /* show resolution list instead of slider ? */ + double length_unit; /* 1.0==mm, 10.0==cm, 25.4==inches, etc. */ + int main_window_fixed; /* fixed (1) or scrolled (0) main window */ + int preserve_preview; /* save/restore preview image(s)? */ + int preview_own_cmap; /* install colormap for preview */ + double preview_gamma; /* gamma value for previews */ + double preview_gamma_red; /* red gamma value for previews */ + double preview_gamma_green; /* green gamma value for previews */ + double preview_gamma_blue; /* blue gamma value for previews */ + double xsane_gamma; + double xsane_gamma_red; + double xsane_gamma_green; + double xsane_gamma_blue; + double xsane_brightness; + double xsane_brightness_red; + double xsane_brightness_green; + double xsane_brightness_blue; + double xsane_contrast; + double xsane_contrast_red; + double xsane_contrast_green; + double xsane_contrast_blue; + + int xsane_rgb_default; + int xsane_negative; + GtkUpdateType gtk_update_policy; + + int psrotate; /* rotate by 90 degree in postscript mode - landscape */ + int printernr; /* number of printers */ + int printerdefinitions; + Preferences_printer_t *printer[10]; + } +Preferences; + +extern Preferences preferences; + +extern void preferences_save (int fd); +extern void preferences_restore (int fd); + +#endif /* preferences_h */ diff --git a/frontend/xsane-preview.c b/frontend/xsane-preview.c new file mode 100644 index 0000000..a75b12a --- /dev/null +++ b/frontend/xsane-preview.c @@ -0,0 +1,3257 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-preview.c + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +/* + + The preview strategy is as follows: + ----------------------------------- + + 1) The preview is done on the full scan area or a part of it. + + 2) The preview is zoomable so the user can precisely pick + the selection area even for small scans on a large scan + surface. + + 3) The preview window is resizeable. + + 4) The preview scan resolution depends on preview window size + and the selected preview surface (zoom area). + + 5) We let the user/backend pick whether a preview is in color, + grayscale, lineart or what not. The only options that the + preview may (temporarily) modify are: + + - resolution (set so the preview fills the window) + - scan area options (top-left corner, bottom-right corner) + - preview option (to let the backend know we're doing a preview) + - gamma table is set to default (gamma=1.0) + + 5) The initial size of the scan surface is determined based on the constraints + of the four corner coordinates. Missing constraints are replaced + by 0/+INF as appropriate (0 for top-left, +INF for bottom-right coords). + + 6) Given the preview window size and the scan surface size, we + select the resolution so the acquired preview image just fits + in the preview window. The resulting resolution may be out + of range in which case we pick the minum/maximum if there is + a range or word-list constraint or a default value if there is + no such constraint. + + 7) Once a preview image has been acquired, we know the size of the + preview image (in pixels). An initial scale factor is chosen + so the image fits into the preview window. + +*/ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#include "xsane.h" +/* #include */ +#include "xsane-back-gtk.h" +#include "xsane-front-gtk.h" +#include "xsane-preview.h" +#include "xsane-preferences.h" +#include "xsane-gamma.h" + + +#ifndef PATH_MAX +# define PATH_MAX 1024 +#endif + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +extern const char *prog_name; +extern const char *device_text; + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +/* Cut fp conversion routines some slack: */ +#define GROSSLY_DIFFERENT(f1,f2) (fabs ((f1) - (f2)) > 1e-3) +#define GROSSLY_EQUAL(f1,f2) (fabs ((f1) - (f2)) < 1e-3) + +#ifdef __alpha__ + /* This seems to be necessary for at least some XFree86 3.1.2 + servers. It's known to be necessary for the XF86_TGA server for + Linux/Alpha. Fortunately, it's no great loss so we turn this on + by default for now. */ +# define XSERVER_WITH_BUGGY_VISUALS +#endif + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#define PRESET_AREA_ITEMS 11 +typedef struct +{ + char *name; + float width; + float height; +} Preset_area; + +static const Preset_area preset_area[] = +{ + { "full size", INF, INF }, + { "DIN A3", 296.98, 420.0 }, + { "DIN A4", 210.0, 296.98 }, + { "DIN A4H", 296.98, 210.0 }, + { "DIN A5", 148.5, 210.0 }, + { "DIN A5H", 210.0, 148.5 }, + { "9x13 cm", 90.0, 130.0 }, + { "13x9 cm", 130.0, 90.0 }, + { "legal", 215.9, 355.6 }, + { "letter", 215.9, 279.4 }, + { "custom", INF, INF } +}; + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static SANE_Int *preview_gamma_data_red = 0; +static SANE_Int *preview_gamma_data_green = 0; +static SANE_Int *preview_gamma_data_blue = 0; + +static SANE_Int *histogram_gamma_data_red = 0; +static SANE_Int *histogram_gamma_data_green = 0; +static SANE_Int *histogram_gamma_data_blue = 0; + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +/* forward declarations */ +static void preview_order_selection(Preview *p); +static void preview_bound_selection(Preview *p); +static void preview_draw_rect(Preview *p, GdkWindow *win, GdkGC *gc, float coord[4]); +static void preview_draw_selection(Preview *p); +static void preview_update_selection(Preview *p); +static void preview_establish_selection(Preview *p); +/* static void preview_update_batch_selection(Preview *p); */ +static void preview_get_scale_device_to_image(Preview *p, float *xscalep, float *yscalep); +static void preview_get_scale_device_to_preview(Preview *p, float *xscalep, float *yscalep); +static void preview_get_scale_preview_to_image(Preview *p, float *xscalep, float *yscalep); +static void preview_paint_image(Preview *p); +static void preview_display_partial_image(Preview *p); +static void preview_display_maybe(Preview *p); +static void preview_display_image(Preview *p); +static void preview_save_option(Preview *p, int option, SANE_Word *save_loc, int *valid); +static void preview_restore_option(Preview *p, int option, SANE_Word saved_value, int valid); +static void preview_set_option_float(Preview *p, int option, float value); +static void preview_set_option_bool(Preview *p, int option, SANE_Bool value); +static void preview_set_option_int(Preview *p, int option, SANE_Int value); +static int preview_increment_image_y(Preview *p); +static void preview_read_image_data(gpointer data, gint source, GdkInputCondition cond); +static void preview_scan_done(Preview *p); +static void preview_scan_start(Preview *p); +static int preview_make_image_path(Preview *p, size_t filename_size, char *filename, int level); +static void preview_restore_image(Preview *p); +static gint preview_expose_handler(GtkWidget *window, GdkEvent *event, gpointer data); +static gint preview_event_handler(GtkWidget *window, GdkEvent *event, gpointer data); +static void preview_start_button_clicked(GtkWidget *widget, gpointer data); +static void preview_cancel_button_clicked(GtkWidget *widget, gpointer data); +static void preview_area_correct(Preview *p); +static void preview_save_image(Preview *p); +static void preview_zoom_not(GtkWidget *window, gpointer data); +static void preview_zoom_out(GtkWidget *window, gpointer data); +static void preview_zoom_in(GtkWidget *window, gpointer data); +static void preview_zoom_undo(GtkWidget *window, gpointer data); +static void preview_get_color(Preview *p, int x, int y, int *red, int *green, int *blue); +static void preview_pipette_white(GtkWidget *window, gpointer data); +static void preview_pipette_gray(GtkWidget *window, gpointer data); +static void preview_pipette_black(GtkWidget *window, gpointer data); +static void preview_full_preview_area(GtkWidget *widget, gpointer call_data); +static void preview_preset_area_callback(GtkWidget *widget, gpointer call_data); + +void preview_do_gamma_correction(Preview *p); +void preview_calculate_histogram(Preview *p, + SANE_Int *count_raw, SANE_Int *count_raw_red, SANE_Int *count_raw_green, SANE_Int *count_raw_blue, + SANE_Int *count, SANE_Int *count_red, SANE_Int *count_green, SANE_Int *count_blue); +void preview_gamma_correction(Preview *p, + SANE_Int *gamma_red, SANE_Int *gamma_green, SANE_Int *gamma_blue, + SANE_Int *gamma_red_hist, SANE_Int *gamma_green_hist, SANE_Int *gamma_blue_hist); +void preview_area_resize(GtkWidget *widget); +void preview_update_maximum_output_size(Preview *p); +void preview_set_maximum_output_size(Preview *p, float width, float height); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_order_selection(Preview *p) +{ + float tmp_coordinate; + + p->selection.active = ( (p->selection.coordinate[0] != p->selection.coordinate[2]) && + (p->selection.coordinate[1] != p->selection.coordinate[3]) ); + + + if (p->selection.active) + { + if (p->selection.coordinate[0] > p->selection.coordinate[2]) + { + tmp_coordinate = p->selection.coordinate[0]; + p->selection.coordinate[0] = p->selection.coordinate[2]; + p->selection.coordinate[2] = tmp_coordinate; + + p->selection_xedge = (p->selection_xedge + 2) & 3; + } + + if (p->selection.coordinate[1] > p->selection.coordinate[3]) + { + tmp_coordinate = p->selection.coordinate[1]; + p->selection.coordinate[1] = p->selection.coordinate[3]; + p->selection.coordinate[3] = tmp_coordinate; + + p->selection_yedge = (p->selection_yedge + 2) & 3; + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_bound_selection(Preview *p) +{ + + p->selection.active = ( (p->selection.coordinate[0] != p->selection.coordinate[2]) && + (p->selection.coordinate[1] != p->selection.coordinate[3]) ); + + + if (p->selection.active) + { + if (p->selection.coordinate[0] < p->scanner_surface[0]) + { + p->selection.coordinate[0] = p->scanner_surface[0]; + } + + if (p->selection.coordinate[1] < p->scanner_surface[1]) + { + p->selection.coordinate[1] = p->scanner_surface[1]; + } + + if (p->selection.coordinate[2] > p->scanner_surface[2]) + { + p->selection.coordinate[2] = p->scanner_surface[2]; + } + + if (p->selection.coordinate[3] > p->scanner_surface[3]) + { + p->selection.coordinate[3] = p->scanner_surface[3]; + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_draw_rect(Preview *p, GdkWindow *win, GdkGC *gc, float coordinate[4]) +{ + float xscale, yscale; + float x, y, w, h; + gint xi, yi, wi, hi; + + x = coordinate[0]; + y = coordinate[1]; + w = coordinate[2] - x; + h = coordinate[3] - y; + + if (w < 0) + { + x = coordinate[2]; + w = -w; + } + + if (h < 0) + { + y = coordinate[3]; + h = -h; + } + + preview_get_scale_device_to_preview(p, &xscale, &yscale); + + x = x - p->surface[0]; + y = y - p->surface[1]; + + xi = (gint) (x * xscale + 0.5); + yi = (gint) (y * yscale + 0.5); + wi = (gint) (w * xscale + 0.5); + hi = (gint) (h * yscale + 0.5); + + gdk_draw_rectangle(win, gc, FALSE, xi, yi, wi + 1, hi + 1); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_draw_selection(Preview *p) +{ + if (!p->gc_selection) /* window isn't mapped yet */ + { + return; + } + + while (gtk_events_pending()) /* make sure all drawing actions are finished */ + { + gtk_main_iteration(); + } + + if (p->previous_selection.active) + { + preview_draw_rect(p, p->window->window, p->gc_selection, p->previous_selection.coordinate); + } + + if (p->selection.active) + { + preview_draw_rect(p, p->window->window, p->gc_selection, p->selection.coordinate); + } + + p->previous_selection = p->selection; + + + if (!p->gc_selection_maximum) /* window isn't mapped yet */ + { + return; + } + + if (p->previous_selection_maximum.active) + { + preview_draw_rect(p, p->window->window, p->gc_selection_maximum, p->previous_selection_maximum.coordinate); + } + + if (p->selection_maximum.active) + { + preview_draw_rect(p, p->window->window, p->gc_selection_maximum, p->selection_maximum.coordinate); + } + + p->previous_selection_maximum = p->selection_maximum; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_update_selection(Preview *p) +/* draw selection box as defined in backend */ +{ + const SANE_Option_Descriptor *opt; + SANE_Status status; + SANE_Word val; + int i, optnum; + + p->previous_selection = p->selection; + + for (i = 0; i < 4; ++i) + { + optnum = p->dialog->well_known.coord[i]; + if (optnum > 0) + { + opt = sane_get_option_descriptor(p->dialog->dev, optnum); + status = sane_control_option(p->dialog->dev, optnum, SANE_ACTION_GET_VALUE, &val, 0); + if (status != SANE_STATUS_GOOD) + { + continue; + } + if (opt->type == SANE_TYPE_FIXED) + { + p->selection.coordinate[i] = SANE_UNFIX(val); + } + else + { + p->selection.coordinate[i] = val; + } + } + else /* backend does not use scanarea options */ + { + switch (i) + { + case 0: + case 1: + p->selection.coordinate[i] = 0; + break; + + case 2: + p->selection.coordinate[i] = p->preview_width; + break; + + case 3: + p->selection.coordinate[i] = p->preview_height; + break; + } + } + } + + for (i = 0; i < 2; ++i) + { + if (p->selection.coordinate[i + 2] < p->selection.coordinate[i]) + { + p->selection.coordinate[i + 2] = p->selection.coordinate[i]; + } + } + + p->selection.active = ( (p->selection.coordinate[0] != p->selection.coordinate[2]) && + (p->selection.coordinate[1] != p->selection.coordinate[3]) ); + + preview_draw_selection(p); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_establish_selection(Preview *p) +{ + /* This routine only shall be called if the preview area really is changed. */ + + int i; + + preview_order_selection(p); + + xsane.block_update_param = TRUE; /* do not change parameters each time */ + + for (i = 0; i < 4; ++i) + { + preview_set_option_float(p, p->dialog->well_known.coord[i], p->selection.coordinate[i]); + } + + xsane_back_gtk_update_scan_window(p->dialog); + + xsane.block_update_param = FALSE; + + if (p->dialog->param_change_callback) + { + (*p->dialog->param_change_callback) (p->dialog, p->dialog->param_change_arg); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#if 0 +static void preview_update_batch_selection(Preview *p) +{ + Batch_selection *batch_selection; + + if (!p->gc_selection) /* window isn't mapped yet */ + { + return; + } + + batch_selection = p->batch_selection; + + while (batch_selection) + { + preview_draw_rect(p, p->window->window, p->gc_selection, batch_selection->coordinate); + + batch_selection = batch_selection->next; + } +} +#endif + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_get_scale_device_to_image(Preview *p, float *xscalep, float *yscalep) +{ + float device_width, device_height; + float xscale = 1.0; + float yscale = 1.0; + + device_width = fabs(p->image_surface[2] - p->image_surface[0]); + device_height = fabs(p->image_surface[3] - p->image_surface[1]); + + if ( (device_width >0) && (device_width < INF) ) + { + xscale = p->image_width / device_width; + } + + if ( (device_height >0) && (device_height < INF) ) + { + yscale = p->image_height / device_height; + } + + if (p->surface_unit == SANE_UNIT_PIXEL) + { + if (xscale > yscale) + { + yscale = xscale; + } + else + { + xscale = yscale; + } + } + + *xscalep = xscale; + *yscalep = yscale; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_get_scale_device_to_preview(Preview *p, float *xscalep, float *yscalep) +{ + float device_width, device_height; + float xscale = 1.0; + float yscale = 1.0; + + device_width = fabs(p->image_surface[2] - p->image_surface[0]); + device_height = fabs(p->image_surface[3] - p->image_surface[1]); + + if ( (device_width >0) && (device_width < INF) ) + { + xscale = p->preview_width / device_width; + } + + if ( (device_height >0) && (device_height < INF) ) + { + yscale = p->preview_height / device_height; + } + + if (p->surface_unit == SANE_UNIT_PIXEL) + { + if (xscale > yscale) + { + yscale = xscale; + } + else + { + xscale = yscale; + } + } + + *xscalep = xscale; + *yscalep = yscale; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_get_scale_preview_to_image(Preview *p, float *xscalep, float *yscalep) +{ + float xscale = 1.0; + float yscale = 1.0; + + if (p->image_width > 0) + { + xscale = p->image_width / (float) p->preview_width; + } + + if (p->image_height > 0) + { + yscale = p->image_height / (float) p->preview_height; + } + + if (p->surface_unit == SANE_UNIT_PIXEL) + { + if (xscale > yscale) + { + yscale = xscale; + } + else + { + xscale = yscale; + } + } + + *xscalep = xscale; + *yscalep = yscale; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_paint_image(Preview *p) +{ + float xscale, yscale, src_x, src_y; + int dst_x, dst_y, height, x, y, old_y, src_offset; + + preview_get_scale_preview_to_image(p, &xscale, &yscale); + + memset(p->preview_row, 0x80, 3*p->preview_window_width); + + /* don't draw last line unless it's complete: */ + height = p->image_y; + + if (p->image_x == 0 && height < p->image_height) + { + ++height; + } + + /* for now, use simple nearest-neighbor interpolation: */ + src_offset = 0; + src_x = src_y = 0.0; + old_y = -1; + + for (dst_y = 0; dst_y < p->preview_height; ++dst_y) + { + y = (int) (src_y + 0.5); + if (y >= height) + { + break; + } + src_offset = y * 3 * p->image_width; + + if ((p->image_data_enh) && (old_y != y)) + { + old_y = y; + for (dst_x = 0; dst_x < p->preview_width; ++dst_x) + { + x = (int) (src_x + 0.5); + if (x >= p->image_width) + { + break; + } + + p->preview_row[3*dst_x + 0] = p->image_data_enh[src_offset + 3*x + 0]; + p->preview_row[3*dst_x + 1] = p->image_data_enh[src_offset + 3*x + 1]; + p->preview_row[3*dst_x + 2] = p->image_data_enh[src_offset + 3*x + 2]; + src_x += xscale; + } + } + gtk_preview_draw_row(GTK_PREVIEW(p->window), p->preview_row, 0, dst_y, p->preview_window_width); + src_x = 0.0; + src_y += yscale; + } + + if (dst_y >= p->preview_height-5) + { + memset(p->preview_row, 0x80, 3*p->preview_window_width); + for (dst_y = p->preview_height-1; dst_y < p->preview_window_height; ++dst_y) + { + gtk_preview_draw_row(GTK_PREVIEW(p->window), p->preview_row, 0, dst_y, p->preview_window_width); + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_display_partial_image(Preview *p) +{ + preview_paint_image(p); + + if (GTK_WIDGET_DRAWABLE(p->window)) + { + GtkPreview *preview = GTK_PREVIEW(p->window); + int src_x, src_y; + + src_x = (p->window->allocation.width - preview->buffer_width)/2; + src_y = (p->window->allocation.height - preview->buffer_height)/2; + gtk_preview_put(preview, p->window->window, p->window->style->black_gc, src_x, src_y, + 0, 0, p->preview_width, p->preview_height); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_display_maybe(Preview *p) +{ + time_t now; + + time(&now); + + if (now > p->image_last_time_updated) /* wait at least one secone */ + { + p->image_last_time_updated = now; + preview_display_partial_image(p); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_display_image(Preview *p) +{ + /* if image height was unknown and got larger than expected get missing memory */ + if (p->params.lines <= 0 && p->image_y < p->image_height) + { + p->image_height = p->image_y; + p->image_data_raw = realloc(p->image_data_raw, 3 * p->image_width * p->image_height); + p->image_data_enh = realloc(p->image_data_enh, 3 * p->image_width * p->image_height); + assert(p->image_data_raw); + assert(p->image_data_enh); + } + + memcpy(p->image_data_raw, p->image_data_enh, 3 * p->image_width * p->image_height); + + preview_do_gamma_correction(p); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_save_option(Preview *p, int option, SANE_Word *save_loc, int *valid) +{ + SANE_Status status; + + if (option <= 0) + { + *valid = 0; + return; + } + + status = sane_control_option(p->dialog->dev, option, SANE_ACTION_GET_VALUE, save_loc, 0); + *valid = (status == SANE_STATUS_GOOD); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_restore_option(Preview *p, int option, SANE_Word saved_value, int valid) +{ + const SANE_Option_Descriptor *opt; + SANE_Status status; + SANE_Handle dev; + + if (!valid) + { + return; + } + + dev = p->dialog->dev; + status = sane_control_option(dev, option, SANE_ACTION_SET_VALUE, &saved_value, 0); + + if (status != SANE_STATUS_GOOD) + { + char buf[256]; + opt = sane_get_option_descriptor(dev, option); + snprintf(buf, sizeof(buf), "%s %s: %s.", ERR_SET_OPTION, opt->name, XSANE_STRSTATUS(status)); + xsane_back_gtk_error(buf, TRUE); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_set_option_float(Preview *p, int option, float value) +{ + const SANE_Option_Descriptor *opt; + SANE_Handle dev; + SANE_Word word; + + if (option <= 0 || value <= -INF || value >= INF) + { + return; + } + + dev = p->dialog->dev; + opt = sane_get_option_descriptor(dev, option); + if (opt->type == SANE_TYPE_FIXED) + { + word = SANE_FIX(value) + 0.5; + } + else + { + word = value + 0.5; + } + + sane_control_option(dev, option, SANE_ACTION_SET_VALUE, &word, 0); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_set_option_bool(Preview *p, int option, SANE_Bool value) +{ + SANE_Handle dev; + + if (option <= 0) + return; + + dev = p->dialog->dev; + sane_control_option(dev, option, SANE_ACTION_SET_VALUE, &value, 0); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_set_option_int(Preview *p, int option, SANE_Int value) +{ + SANE_Handle dev; + + if (option <= 0) + return; + + dev = p->dialog->dev; + sane_control_option(dev, option, SANE_ACTION_SET_VALUE, &value, 0); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static int preview_increment_image_y(Preview *p) +{ + size_t extra_size, offset; + char buf[256]; + + p->image_x = 0; + ++p->image_y; + if (p->params.lines <= 0 && p->image_y >= p->image_height) + { + offset = 3 * p->image_width*p->image_height; + extra_size = 3 * 32 * p->image_width; + p->image_height += 32; + p->image_data_raw = realloc(p->image_data_raw, offset + extra_size); + p->image_data_enh = realloc(p->image_data_enh, offset + extra_size); + if ( (!p->image_data_enh) || (!p->image_data_raw) ) + { + snprintf(buf, sizeof(buf), "%s %s.", ERR_FAILED_ALLOCATE_IMAGE, strerror(errno)); + xsane_back_gtk_error(buf, TRUE); + preview_scan_done(p); + return -1; + } + memset(p->image_data_enh + offset, 0xff, extra_size); + } + return 0; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_read_image_data(gpointer data, gint source, GdkInputCondition cond) +{ + SANE_Status status; + Preview *p = data; + u_char buf[8192]; + SANE_Handle dev; + SANE_Int len; + int i, j; + + dev = p->dialog->dev; + while (1) + { + status = sane_read(dev, buf, sizeof(buf), &len); + if (status != SANE_STATUS_GOOD) + { + if (status == SANE_STATUS_EOF) + { + if (p->params.last_frame) /* got all preview image data */ + { + preview_display_image(p); /* display preview image */ + preview_save_image(p); /* save preview image */ + preview_scan_done(p); /* scan is done */ + return; /* ok, all finished */ + } + else + { + preview_scan_start(p); + break; + } + } + else + { + snprintf(buf, sizeof(buf), "%s %s.", ERR_DURING_READ, XSANE_STRSTATUS(status)); + xsane_back_gtk_error(buf, TRUE); + } + preview_scan_done(p); + return; + } + + if (!len) + { + break; /* out of data for now */ + } + + switch (p->params.format) + { + case SANE_FRAME_RGB: + if (p->params.depth != 8) + { + goto bad_depth; + } + + for (i = 0; i < len; ++i) + { + p->image_data_enh[p->image_offset++] = buf[i]; + if (p->image_offset%3 == 0) + { + if (++p->image_x >= p->image_width && preview_increment_image_y(p) < 0) + { + return; + } + } + } + break; + + case SANE_FRAME_GRAY: + switch (p->params.depth) + { + case 1: + for (i = 0; i < len; ++i) + { + u_char mask = buf[i]; + + for (j = 7; j >= 0; --j) + { + u_char gl = (mask & (1 << j)) ? 0x00 : 0xff; + p->image_data_enh[p->image_offset++] = gl; + p->image_data_enh[p->image_offset++] = gl; + p->image_data_enh[p->image_offset++] = gl; + if (++p->image_x >= p->image_width) + { + if (preview_increment_image_y(p) < 0) + { + return; + } + break; /* skip padding bits */ + } + } + } + break; + + case 8: + for (i = 0; i < len; ++i) + { + u_char gl = buf[i]; + p->image_data_enh[p->image_offset++] = gl; + p->image_data_enh[p->image_offset++] = gl; + p->image_data_enh[p->image_offset++] = gl; + if (++p->image_x >= p->image_width && preview_increment_image_y(p) < 0) + { + return; + } + } + break; + + default: + goto bad_depth; + } + break; + + case SANE_FRAME_RED: + case SANE_FRAME_GREEN: + case SANE_FRAME_BLUE: + switch (p->params.depth) + { + case 1: + for (i = 0; i < len; ++i) + { + u_char mask = buf[i]; + + for (j = 0; j < 8; ++j) + { + u_char gl = (mask & 1) ? 0xff : 0x00; + mask >>= 1; + p->image_data_enh[p->image_offset++] = gl; + p->image_offset += 3; + if (++p->image_x >= p->image_width && preview_increment_image_y(p) < 0) + { + return; + } + } + } + break; + + case 8: + for (i = 0; i < len; ++i) + { + p->image_data_enh[p->image_offset] = buf[i]; + p->image_offset += 3; + if (++p->image_x >= p->image_width && preview_increment_image_y(p) < 0) + { + return; + } + } + break; + + default: + goto bad_depth; + } + break; + + default: + fprintf(stderr, "preview_read_image_data: %s %d\n", ERR_BAD_FRAME_FORMAT, p->params.format); + preview_scan_done(p); + return; + } + + if (p->input_tag < 0) + { + preview_display_maybe(p); + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + } + } + preview_display_maybe(p); + return; + +bad_depth: + snprintf(buf, sizeof(buf), "%s %d.", ERR_PREVIEW_BAD_DEPTH, p->params.depth); + xsane_back_gtk_error(buf, TRUE); + preview_scan_done(p); + return; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_scan_done(Preview *p) +{ + int i; + + p->scanning = FALSE; + + if (p->input_tag >= 0) + { + gdk_input_remove(p->input_tag); + p->input_tag = -1; + } + + sane_cancel(p->dialog->dev); + + xsane.block_update_param = TRUE; /* do not change parameters each time */ + + preview_restore_option(p, p->dialog->well_known.dpi, p->saved_dpi, p->saved_dpi_valid); + preview_restore_option(p, p->dialog->well_known.dpi_x, p->saved_dpi_x, p->saved_dpi_x_valid); + preview_restore_option(p, p->dialog->well_known.dpi_y, p->saved_dpi_y, p->saved_dpi_y_valid); + + for (i = 0; i < 4; ++i) + { + preview_restore_option(p, p->dialog->well_known.coord[i], p->saved_coord[i], p->saved_coord_valid[i]); + } + + preview_restore_option(p, p->dialog->well_known.bit_depth, p->saved_bit_depth, p->saved_bit_depth_valid); + + preview_set_option_bool(p, p->dialog->well_known.preview, SANE_FALSE); + + gtk_widget_set_sensitive(p->cancel, FALSE); + xsane_set_sensitivity(TRUE); + + xsane.block_update_param = FALSE; + + preview_update_surface(p, 0); /* if surface was not defined it's necessary to redefine it now */ + + preview_update_selection(p); + xsane_update_histogram(); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static int preview_get_memory(Preview *p) +{ + char buf[256]; + + if (p->image_data_enh) + { + free(p->image_data_enh); + p->image_data_enh = 0; + } + + if (p->image_data_raw) + { + free(p->image_data_raw); + p->image_data_raw = 0; + } + + if (p->preview_row) + { + free(p->preview_row); + p->preview_row = 0; + } + + p->image_data_enh = malloc(3 * p->image_width * (p->image_height)); + p->image_data_raw = malloc(3 * p->image_width * (p->image_height)); + p->preview_row = malloc(3 * p->preview_window_width); + + if ( (!p->image_data_raw) || (!p->image_data_enh) || (!p->preview_row) ) + { + if (p->image_data_enh) + { + free(p->image_data_enh); + p->image_data_enh = 0; + } + + if (p->image_data_raw) + { + free(p->image_data_raw); + p->image_data_raw = 0; + } + + if (p->preview_row) + { + free(p->preview_row); + p->preview_row = 0; + } + + snprintf(buf, sizeof(buf), "%s %s.", ERR_FAILED_ALLOCATE_IMAGE, strerror(errno)); + xsane_back_gtk_error(buf, TRUE); + + return -1; /* error */ + } + + memset(p->image_data_enh, 0xff, 3*p->image_width*p->image_height); /* clean memory */ + + return 0; /* ok */ +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_scan_start(Preview *p) +{ + SANE_Handle dev = p->dialog->dev; + SANE_Status status; + char buf[256]; + int fd, y, i; + int gamma_gray_size = 256; /* set this values to image depth for more than 8bpp input support!!! */ + int gamma_red_size = 256; + int gamma_green_size = 256; + int gamma_blue_size = 256; + int gamma_gray_max = 255; /* set this to to image depth for more than 8bpp output support */ + int gamma_red_max = 255; + int gamma_green_max = 255; + int gamma_blue_max = 255; + + for (i=0; i<4; i++) + { + p->image_surface[i] = p->surface[i]; + } + + xsane_clear_histogram(&xsane.histogram_raw); + xsane_clear_histogram(&xsane.histogram_enh); + gtk_widget_set_sensitive(p->cancel, TRUE); + xsane_set_sensitivity(FALSE); + + /* clear old preview: */ + memset(p->preview_row, 0xff, 3*p->preview_width); + for (y = 0; y < p->preview_height; ++y) + { + gtk_preview_draw_row(GTK_PREVIEW(p->window), p->preview_row, 0, y, p->preview_width); + } + + if (p->input_tag >= 0) + { + gdk_input_remove(p->input_tag); + p->input_tag = -1; + } + + if (p->dialog->well_known.gamma_vector >0) + { + const SANE_Option_Descriptor *opt; + + opt = sane_get_option_descriptor(p->dialog->dev, p->dialog->well_known.gamma_vector); + if (SANE_OPTION_IS_ACTIVE(opt->cap)) + { + SANE_Int *gamma_data; + + opt = sane_get_option_descriptor(p->dialog->dev, p->dialog->well_known.gamma_vector); + gamma_gray_size = opt->size / sizeof(opt->type); + gamma_gray_max = opt->constraint.range->max; + + gamma_data = malloc(gamma_gray_size * sizeof(SANE_Int)); + xsane_create_gamma_curve(gamma_data, 0, 1.0, 0.0, 0.0, gamma_gray_size, gamma_gray_max); + xsane_back_gtk_update_vector(p->dialog, p->dialog->well_known.gamma_vector, gamma_data); + free(gamma_data); + } + } + + if (p->dialog->well_known.gamma_vector_r >0) + { + const SANE_Option_Descriptor *opt; + + opt = sane_get_option_descriptor(p->dialog->dev, p->dialog->well_known.gamma_vector_r); + if (SANE_OPTION_IS_ACTIVE(opt->cap)) + { + SANE_Int *gamma_data_red, *gamma_data_green, *gamma_data_blue; + + opt = sane_get_option_descriptor(p->dialog->dev, p->dialog->well_known.gamma_vector_r); + gamma_red_size = opt->size / sizeof(opt->type); + gamma_red_max = opt->constraint.range->max; + + opt = sane_get_option_descriptor(p->dialog->dev, p->dialog->well_known.gamma_vector_g); + gamma_green_size = opt->size / sizeof(opt->type); + gamma_green_max = opt->constraint.range->max; + + opt = sane_get_option_descriptor(p->dialog->dev, p->dialog->well_known.gamma_vector_b); + gamma_blue_size = opt->size / sizeof(opt->type); + gamma_blue_max = opt->constraint.range->max; + + gamma_data_red = malloc(gamma_red_size * sizeof(SANE_Int)); + gamma_data_green = malloc(gamma_green_size * sizeof(SANE_Int)); + gamma_data_blue = malloc(gamma_blue_size * sizeof(SANE_Int)); + + xsane_create_gamma_curve(gamma_data_red, 0, 1.0, 0.0, 0.0, gamma_red_size, gamma_red_max); + xsane_create_gamma_curve(gamma_data_green, 0, 1.0, 0.0, 0.0, gamma_green_size, gamma_green_max); + xsane_create_gamma_curve(gamma_data_blue, 0, 1.0, 0.0, 0.0, gamma_blue_size, gamma_blue_max); + + xsane_back_gtk_update_vector(p->dialog, p->dialog->well_known.gamma_vector_r, gamma_data_red); + xsane_back_gtk_update_vector(p->dialog, p->dialog->well_known.gamma_vector_g, gamma_data_green); + xsane_back_gtk_update_vector(p->dialog, p->dialog->well_known.gamma_vector_b, gamma_data_blue); + + free(gamma_data_red); + free(gamma_data_green); + free(gamma_data_blue); + } + } + + status = sane_start(dev); + if (status != SANE_STATUS_GOOD) + { + snprintf(buf, sizeof(buf), "%s %s.", ERR_FAILED_START_SCANNER, XSANE_STRSTATUS(status)); + xsane_back_gtk_error(buf, TRUE); + preview_scan_done(p); + return; + } + + status = sane_get_parameters(dev, &p->params); + if (status != SANE_STATUS_GOOD) + { + snprintf(buf, sizeof(buf), "%s %s.", ERR_FAILED_GET_PARAMS, XSANE_STRSTATUS(status)); + xsane_back_gtk_error(buf, TRUE); + preview_scan_done(p); + return; + } + + p->image_offset = p->image_x = p->image_y = 0; + + if (p->params.format >= SANE_FRAME_RED && p->params.format <= SANE_FRAME_BLUE) + { + p->image_offset = p->params.format - SANE_FRAME_RED; + } + + if ( (!p->image_data_enh) || (p->params.pixels_per_line != p->image_width) + || ( (p->params.lines >= 0) && (p->params.lines != p->image_height) ) ) + { + p->image_width = p->params.pixels_per_line; + p->image_height = p->params.lines; + + if (p->image_height < 0) + { + p->image_height = 32; /* may have to adjust as we go... */ + } + + if (preview_get_memory(p)) + { + preview_scan_done(p); /* error */ + return; + } + } + +/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +/* THIS IS A BIT STRANGE HERE */ + p->selection.active = FALSE; + p->previous_selection_maximum.active = FALSE; +/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + + p->scanning = TRUE; + + if (sane_set_io_mode(dev, SANE_TRUE) == SANE_STATUS_GOOD && sane_get_select_fd(dev, &fd) == SANE_STATUS_GOOD) + { + p->input_tag = gdk_input_add(fd, GDK_INPUT_READ, preview_read_image_data, p); + } + else + { + preview_read_image_data(p, -1, GDK_INPUT_READ); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static int preview_make_image_path(Preview *p, size_t filename_size, char *filename, int level) +{ + char buf[256]; + + snprintf(buf, sizeof(buf), "preview-level-%d-", level); + return xsane_back_gtk_make_path(filename_size, filename, 0, 0, buf, p->dialog->dev_name, ".ppm", XSANE_PATH_TMP); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static int preview_restore_image_from_file(Preview *p, FILE *in, int min_quality) +{ + u_int psurface_type, psurface_unit; + int image_width, image_height; + int xoffset, yoffset, width, height; + int quality; + int y; + float psurface[4]; + size_t nread; + char *imagep; + + if (!in) + { + return min_quality; + } + + /* See whether there is a saved preview and load it if present: */ + + if (fscanf(in, "P6\n# surface: %g %g %g %g %u %u\n%d %d\n255\n", + psurface + 0, psurface + 1, psurface + 2, psurface + 3, + &psurface_type, &psurface_unit, + &image_width, &image_height) != 8) + { + return min_quality; + } + + if ((psurface_type != p->surface_type) || (psurface_unit != p->surface_unit)) + { + return min_quality; + } + + xoffset = (p->surface[0] - psurface[0])/(psurface[2] - psurface[0]) * image_width; + yoffset = (p->surface[1] - psurface[1])/(psurface[3] - psurface[1]) * image_height; + width = (p->surface[2] - p->surface[0])/(psurface[2] - psurface[0]) * image_width; + height = (p->surface[3] - p->surface[1])/(psurface[3] - psurface[1]) * image_height; + quality = width; + + if ((xoffset < 0) || (yoffset < 0) || + (xoffset+width > image_width) || (yoffset+height > image_height) || + (width == 0) || (height == 0)) + { + return min_quality; + } + + if (quality < min_quality) + { + return min_quality; + } + + p->params.depth = 8; + p->image_width = width; + p->image_height = height; + + if (preview_get_memory(p)) + { + return min_quality; /* error allocating memory */ + } + + fseek(in, yoffset * 3 * image_width, SEEK_CUR); /* skip unused lines */ + + imagep = p->image_data_enh; + + for (y = yoffset; y < yoffset + height; y++) + { + fseek(in, xoffset * 3, SEEK_CUR); /* skip unused pixel left of area */ + + nread = fread(imagep, 3, width, in); + imagep += width * 3; + + fseek(in, (image_width - width - xoffset) * 3, SEEK_CUR); /* skip unused pixel right of area */ + } + + p->image_y = height; + p->image_x = width; + + p->image_surface[0] = p->surface[0]; + p->image_surface[1] = p->surface[1]; + p->image_surface[2] = p->surface[2]; + p->image_surface[3] = p->surface[3]; + + return quality; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_restore_image(Preview *p) +{ + char filename[PATH_MAX]; + FILE *in; + int status; + int quality = 0; + int level; + + /* See whether there is a saved preview and load it if present: */ + + for(level = 2; level >= 0; level--) + { + status = preview_make_image_path(p, sizeof(filename), filename, level); + if (status >= 0) + { + in = fopen(filename, "r"); + if (in) + { + quality = preview_restore_image_from_file(p, in, quality); + } + } + } + memcpy(p->image_data_raw, p->image_data_enh, 3 * p->image_width * p->image_height); + +/* the following commands may be removed because they are done because a event is emmited */ + preview_do_gamma_correction(p); + xsane_update_histogram(); + preview_draw_selection(p); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +/* This is executed _after_ the gtkpreview's expose routine. */ +static gint preview_expose_handler(GtkWidget *window, GdkEvent *event, gpointer data) +{ + Preview *p = data; + + p->previous_selection.active = FALSE; /* ok, old selections are overpainted */ + p->previous_selection_maximum.active = FALSE; + p->selection.active = TRUE; /* ok, old selections are overpainted */ + p->selection_maximum.active = TRUE; + preview_draw_selection(p); /* draw selections again */ + + return FALSE; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static gint preview_event_handler(GtkWidget *window, GdkEvent *event, gpointer data) +{ + Preview *p = data; + GdkCursor *cursor; + GdkColor color; + GdkColormap *colormap; + float preview_selection[4]; + float xscale, yscale; + static int event_count = 0; + int cursornr; + + event_count++; + + preview_get_scale_device_to_preview(p, &xscale, &yscale); + + preview_selection[0] = xscale * (p->selection.coordinate[0] - p->surface[0]); + preview_selection[1] = yscale * (p->selection.coordinate[1] - p->surface[1]); + preview_selection[2] = xscale * (p->selection.coordinate[2] - p->surface[0]); + preview_selection[3] = yscale * (p->selection.coordinate[3] - p->surface[1]); + + if (event->type == GDK_EXPOSE) + { + if (!p->gc_selection) + { + colormap = gdk_window_get_colormap(p->window->window); + + p->gc_selection = gdk_gc_new(p->window->window); + gdk_gc_set_function(p->gc_selection, GDK_INVERT); + gdk_gc_set_line_attributes(p->gc_selection, 1, GDK_LINE_ON_OFF_DASH, GDK_CAP_BUTT, GDK_JOIN_MITER); + + p->gc_selection_maximum = gdk_gc_new(p->window->window); + gdk_gc_set_function(p->gc_selection_maximum, GDK_XOR); + gdk_gc_set_line_attributes(p->gc_selection_maximum, 1, GDK_LINE_ON_OFF_DASH, GDK_CAP_BUTT, GDK_JOIN_MITER); + color.red = 0; + color.green = 65535; + color.blue = 30000; + gdk_color_alloc(colormap, &color); + gdk_gc_set_foreground(p->gc_selection_maximum, &color); + + preview_paint_image(p); + } + else + { + while (gtk_events_pending()) /* make sure image is updated */ + { + gtk_main_iteration(); + } + + p->previous_selection.active = FALSE; /* ok, old selections are overpainted */ + p->previous_selection_maximum.active = FALSE; + preview_draw_selection(p); /* draw selections again */ + } + } + else if (!p->scanning) + { + switch (event->type) + { + case GDK_UNMAP: + case GDK_MAP: + break; + + case GDK_BUTTON_PRESS: + switch (p->mode) + { + case MODE_PIPETTE_WHITE: + { + if ( ( (((GdkEventButton *)event)->button == 1) || (((GdkEventButton *)event)->button == 2) ) && + (p->image_data_raw) ) /* left or middle button */ + { + int r,g,b; + + preview_get_color(p, event->button.x, event->button.y, &r, &g, &b); + + xsane.slider_gray.value[2] = sqrt( (r*r+g*g+b*b) / 3)/2.55; + + if ( (!xsane.enhancement_rgb_default) && (((GdkEventButton *)event)->button == 2) ) /* middle button */ + { + xsane.slider_red.value[2] = r/2.55; + xsane.slider_green.value[2] = g/2.55; + xsane.slider_blue.value[2] = b/2.55; + } + else + { + xsane.slider_red.value[2] = xsane.slider_gray.value[2]; + xsane.slider_green.value[2] = xsane.slider_gray.value[2]; + xsane.slider_blue.value[2] = xsane.slider_gray.value[2]; + } + + if (xsane.slider_gray.value[2] < 2) + { + xsane.slider_gray.value[2] = 2; + } + if (xsane.slider_gray.value[1] >= xsane.slider_gray.value[2]) + { + xsane.slider_gray.value[1] = xsane.slider_gray.value[2]-1; + if (xsane.slider_gray.value[0] >= xsane.slider_gray.value[1]) + { + xsane.slider_gray.value[0] = xsane.slider_gray.value[1]-1; + } + } + + if (xsane.slider_red.value[2] < 2) + { + xsane.slider_red.value[2] = 2; + } + if (xsane.slider_red.value[1] >= xsane.slider_red.value[2]) + { + xsane.slider_red.value[1] = xsane.slider_red.value[2]-1; + if (xsane.slider_red.value[0] >= xsane.slider_red.value[1]) + { + xsane.slider_red.value[0] = xsane.slider_red.value[1]-1; + } + } + + if (xsane.slider_green.value[2] < 2) + { + xsane.slider_green.value[2] = 2; + } + if (xsane.slider_green.value[1] >= xsane.slider_green.value[2]) + { + xsane.slider_green.value[1] = xsane.slider_green.value[2]-1; + if (xsane.slider_green.value[0] >= xsane.slider_green.value[1]) + { + xsane.slider_green.value[0] = xsane.slider_green.value[1]-1; + } + } + + if (xsane.slider_blue.value[2] < 2) + { + xsane.slider_blue.value[2] = 2; + } + if (xsane.slider_blue.value[1] >= xsane.slider_blue.value[2]) + { + xsane.slider_blue.value[1] = xsane.slider_blue.value[2]-1; + if (xsane.slider_blue.value[0] >= xsane.slider_blue.value[1]) + { + xsane.slider_blue.value[0] = xsane.slider_blue.value[1]-1; + } + } + + xsane_enhancement_by_histogram(); + } + + p->mode = MODE_NORMAL; + + cursor = gdk_cursor_new(XSANE_CURSOR_PREVIEW); + gdk_window_set_cursor(p->window->window, cursor); + gdk_cursor_destroy(cursor); + p->cursornr = XSANE_CURSOR_PREVIEW; + } + break; + + case MODE_PIPETTE_GRAY: + { + if ( ( (((GdkEventButton *)event)->button == 1) || (((GdkEventButton *)event)->button == 2) ) && + (p->image_data_raw) ) /* left or middle button */ + { + int r,g,b; + + preview_get_color(p, event->button.x, event->button.y, &r, &g, &b); + + xsane.slider_gray.value[1] = sqrt( (r*r+g*g+b*b) / 3)/2.55; + + if ( (!xsane.enhancement_rgb_default) && (((GdkEventButton *)event)->button == 2) ) /* middle button */ + { + xsane.slider_red.value[1] = r/2.55; + xsane.slider_green.value[1] = g/2.55; + xsane.slider_blue.value[1] = b/2.55; + } + else + { + xsane.slider_red.value[1] = xsane.slider_gray.value[1]; + xsane.slider_green.value[1] = xsane.slider_gray.value[1]; + xsane.slider_blue.value[1] = xsane.slider_gray.value[1]; + } + + if (xsane.slider_gray.value[1] == 0) + { + xsane.slider_gray.value[1] += 1; + } + if (xsane.slider_gray.value[1] == 100) + { + xsane.slider_gray.value[1] -= 1; + } + if (xsane.slider_gray.value[1] >= xsane.slider_gray.value[2]) + { + xsane.slider_gray.value[2] = xsane.slider_gray.value[1]+1; + } + if (xsane.slider_gray.value[1] <= xsane.slider_gray.value[0]) + { + xsane.slider_gray.value[0] = xsane.slider_gray.value[1]-1; + } + + if (xsane.slider_red.value[1] == 0) + { + xsane.slider_red.value[1] += 1; + } + if (xsane.slider_red.value[1] == 100) + { + xsane.slider_red.value[1] -= 1; + } + if (xsane.slider_red.value[1] >= xsane.slider_red.value[2]) + { + xsane.slider_red.value[2] = xsane.slider_red.value[1]+1; + } + if (xsane.slider_red.value[1] <= xsane.slider_red.value[0]) + { + xsane.slider_red.value[0] = xsane.slider_red.value[1]-1; + } + + if (xsane.slider_green.value[1] == 0) + { + xsane.slider_green.value[1] += 1; + } + if (xsane.slider_green.value[1] == 100) + { + xsane.slider_green.value[1] -= 1; + } + if (xsane.slider_green.value[1] >= xsane.slider_green.value[2]) + { + xsane.slider_green.value[2] = xsane.slider_green.value[1]+1; + } + if (xsane.slider_green.value[1] <= xsane.slider_green.value[0]) + { + xsane.slider_green.value[0] = xsane.slider_green.value[1]-1; + } + + if (xsane.slider_blue.value[1] == 0) + { + xsane.slider_blue.value[1] += 1; + } + if (xsane.slider_blue.value[1] == 100) + { + xsane.slider_blue.value[1] -= 1; + } + if (xsane.slider_blue.value[1] >= xsane.slider_blue.value[2]) + { + xsane.slider_blue.value[2] = xsane.slider_blue.value[1]+1; + } + if (xsane.slider_blue.value[1] <= xsane.slider_blue.value[0]) + { + xsane.slider_blue.value[0] = xsane.slider_blue.value[1]-1; + } + + xsane_enhancement_by_histogram(); + } + + p->mode = MODE_NORMAL; + + cursor = gdk_cursor_new(XSANE_CURSOR_PREVIEW); + gdk_window_set_cursor(p->window->window, cursor); + gdk_cursor_destroy(cursor); + p->cursornr = XSANE_CURSOR_PREVIEW; + } + break; + + case MODE_PIPETTE_BLACK: + { + if ( ( (((GdkEventButton *)event)->button == 1) || (((GdkEventButton *)event)->button == 2) ) && + (p->image_data_raw) ) /* left or middle button */ + { + int r,g,b; + + preview_get_color(p, event->button.x, event->button.y, &r, &g, &b); + + xsane.slider_gray.value[0] = sqrt( (r*r+g*g+b*b) / 3)/2.55; + + if ( (!xsane.enhancement_rgb_default) && (((GdkEventButton *)event)->button == 2) ) /* middle button */ + { + xsane.slider_red.value[0] = r/2.55; + xsane.slider_green.value[0] = g/2.55; + xsane.slider_blue.value[0] = b/2.55; + } + else + { + xsane.slider_red.value[0] = xsane.slider_gray.value[0]; + xsane.slider_green.value[0] = xsane.slider_gray.value[0]; + xsane.slider_blue.value[0] = xsane.slider_gray.value[0]; + } + + if (xsane.slider_gray.value[0] > 98) + { + xsane.slider_gray.value[0] = 98; + } + if (xsane.slider_gray.value[1] <= xsane.slider_gray.value[0]) + { + xsane.slider_gray.value[1] = xsane.slider_gray.value[0]+1; + if (xsane.slider_gray.value[2] <= xsane.slider_gray.value[1]) + { + xsane.slider_gray.value[2] = xsane.slider_gray.value[1]+1; + } + } + + if (xsane.slider_red.value[0] > 98) + { + xsane.slider_red.value[0] = 98; + } + if (xsane.slider_red.value[1] <= xsane.slider_red.value[0]) + { + xsane.slider_red.value[1] = xsane.slider_red.value[0]+1; + if (xsane.slider_red.value[2] <= xsane.slider_red.value[1]) + { + xsane.slider_red.value[2] = xsane.slider_red.value[1]+1; + } + } + + if (xsane.slider_green.value[0] > 98) + { + xsane.slider_green.value[0] = 98; + } + if (xsane.slider_green.value[1] <= xsane.slider_green.value[0]) + { + xsane.slider_green.value[1] = xsane.slider_green.value[0]+1; + if (xsane.slider_green.value[2] <= xsane.slider_green.value[1]) + { + xsane.slider_green.value[2] = xsane.slider_green.value[1]+1; + } + } + + if (xsane.slider_blue.value[0] > 98) + { + xsane.slider_blue.value[0] = 98; + } + if (xsane.slider_blue.value[1] <= xsane.slider_blue.value[0]) + { + xsane.slider_blue.value[1] = xsane.slider_blue.value[0]+1; + if (xsane.slider_blue.value[2] <= xsane.slider_blue.value[1]) + { + xsane.slider_blue.value[2] = xsane.slider_blue.value[1]+1; + } + } + + xsane_enhancement_by_histogram(); + } + + p->mode = MODE_NORMAL; + + cursor = gdk_cursor_new(XSANE_CURSOR_PREVIEW); + gdk_window_set_cursor(p->window->window, cursor); + gdk_cursor_destroy(cursor); + p->cursornr = XSANE_CURSOR_PREVIEW; + } + break; + + case MODE_NORMAL: + { + switch (((GdkEventButton *)event)->button) + { + case 1: /* left button */ + p->selection_xedge = -1; + if ( (preview_selection[0] - SELECTION_RANGE_OUT < event->button.x) && (event->button.x < preview_selection[0] + SELECTION_RANGE_IN) ) /* left */ + { + p->selection_xedge = 0; + } + else if ( (preview_selection[2] - SELECTION_RANGE_IN < event->button.x) && (event->button.x < preview_selection[2] + SELECTION_RANGE_OUT) ) /* right */ + { + p->selection_xedge = 2; + } + + p->selection_yedge = -1; + if ( (preview_selection[1] - SELECTION_RANGE_OUT < event->button.y) && (event->button.y < preview_selection[1] + SELECTION_RANGE_IN) ) /* top */ + { + p->selection_yedge = 1; + } + else if ( (preview_selection[3] - SELECTION_RANGE_IN < event->button.y) && (event->button.y < preview_selection[3] + SELECTION_RANGE_OUT) ) /* bottom */ + { + p->selection_yedge = 3; + } + + if ( (p->selection_xedge != -1) && (p->selection_yedge != -1) ) /* move edge */ + { + p->selection_drag_edge = TRUE; + p->selection.coordinate[p->selection_xedge] = p->surface[0] + event->button.x / xscale; + p->selection.coordinate[p->selection_yedge] = p->surface[1] + event->button.y / yscale; + preview_draw_selection(p); + } + else /* select new area */ + { + p->selection_xedge = 2; + p->selection_yedge = 3; + p->selection.coordinate[0] = p->surface[0] + event->button.x / xscale; + p->selection.coordinate[1] = p->surface[1] + event->button.y / yscale; + p->selection_drag = TRUE; + + cursornr = GDK_CROSS; + cursor = gdk_cursor_new(cursornr); /* set curosr */ + gdk_window_set_cursor(p->window->window, cursor); + gdk_cursor_destroy(cursor); + p->cursornr = cursornr; + } + break; + + case 2: /* middle button */ + case 3: /* right button */ + if ( (preview_selection[0]-SELECTION_RANGE_OUT < event->button.x) && + (preview_selection[2]+SELECTION_RANGE_OUT > event->button.x) && + (preview_selection[1]-SELECTION_RANGE_OUT < event->button.y) && + (preview_selection[3]+SELECTION_RANGE_OUT > event->button.y) ) + { + p->selection_drag = TRUE; + p->selection_xpos = event->button.x; + p->selection_ypos = event->button.y; + + cursornr = GDK_HAND2; + cursor = gdk_cursor_new(cursornr); /* set curosr */ + gdk_window_set_cursor(p->window->window, cursor); + gdk_cursor_destroy(cursor); + p->cursornr = cursornr; + } + break; + + default: + break; + } + } + } + break; + + case GDK_BUTTON_RELEASE: + switch (((GdkEventButton *)event)->button) + { + case 1: /* left button */ + case 2: /* middle button */ + case 3: /* right button */ + if (p->selection_drag) + { + cursornr = XSANE_CURSOR_PREVIEW; + cursor = gdk_cursor_new(cursornr); /* set curosr */ + gdk_window_set_cursor(p->window->window, cursor); + gdk_cursor_destroy(cursor); + p->cursornr = cursornr; + } + + if ( (p->selection_drag) || (p->selection_drag_edge) ) + { + + if (((GdkEventButton *)event)->button == 1) /* left button */ + { + p->selection.coordinate[p->selection_xedge] = p->surface[0] + event->button.x / xscale; + p->selection.coordinate[p->selection_yedge] = p->surface[1] + event->button.y / yscale; + } + + p->selection_drag_edge = FALSE; + p->selection_drag = FALSE; + + preview_order_selection(p); + preview_bound_selection(p); + preview_update_maximum_output_size(p); + preview_draw_selection(p); + preview_establish_selection(p); + } + default: + break; + } + break; + + case GDK_MOTION_NOTIFY: + switch (((GdkEventMotion *)event)->state) + { + case 256: /* left button */ + if (p->selection_drag_edge) + { + p->selection.active = TRUE; + p->selection.coordinate[p->selection_xedge] = p->surface[0] + event->button.x / xscale; + p->selection.coordinate[p->selection_yedge] = p->surface[1] + event->button.y / yscale; + + preview_order_selection(p); + preview_bound_selection(p); + preview_update_maximum_output_size(p); + preview_draw_selection(p); + + if ((preferences.gtk_update_policy == GTK_UPDATE_CONTINUOUS) && (event_count == 1)) + { + preview_establish_selection(p); + } + else if ((preferences.gtk_update_policy == GTK_UPDATE_DELAYED) && (event_count == 1)) + { + preview_establish_selection(p); + } + } + + if (p->selection_drag) + { + p->selection.active = TRUE; + p->selection.coordinate[p->selection_xedge] = p->surface[0] + event->motion.x / xscale; + p->selection.coordinate[p->selection_yedge] = p->surface[1] + event->motion.y / yscale; + + preview_order_selection(p); + preview_bound_selection(p); + preview_update_maximum_output_size(p); + preview_draw_selection(p); + + if ((preferences.gtk_update_policy == GTK_UPDATE_CONTINUOUS) && (event_count == 1)) + { + preview_establish_selection(p); + } + else if ((preferences.gtk_update_policy == GTK_UPDATE_DELAYED) && (event_count == 1)) + { + preview_establish_selection(p); + } + } + + cursornr = p->cursornr; + + if ( ( (preview_selection[0] - SELECTION_RANGE_OUT < event->button.x) && (event->button.x < preview_selection[0] + SELECTION_RANGE_IN) ) && /* left */ + ( (preview_selection[1] - SELECTION_RANGE_OUT < event->button.y) && (event->button.y < preview_selection[1] + SELECTION_RANGE_IN) ) ) /* top */ + { + cursornr = GDK_TOP_LEFT_CORNER; + } + else if ( ( (preview_selection[2] - SELECTION_RANGE_IN < event->button.x) && (event->button.x < preview_selection[2] + SELECTION_RANGE_OUT) ) && /* right */ + ( (preview_selection[1] - SELECTION_RANGE_OUT < event->button.y) && (event->button.y < preview_selection[1] + SELECTION_RANGE_IN) ) ) /* top */ + { + cursornr = GDK_TOP_RIGHT_CORNER; + } + else if ( ( (preview_selection[0] - SELECTION_RANGE_OUT < event->button.x) && (event->button.x < preview_selection[0] + SELECTION_RANGE_IN) ) && /* left */ + ( (preview_selection[3] - SELECTION_RANGE_IN < event->button.y) && (event->button.y < preview_selection[3] + SELECTION_RANGE_OUT) ) ) /* bottom */ + { + cursornr = GDK_BOTTOM_LEFT_CORNER; + } + else if ( ( (preview_selection[2] - SELECTION_RANGE_IN < event->button.x) && (event->button.x < preview_selection[2] + SELECTION_RANGE_OUT) ) && /* right */ + ( (preview_selection[3] - SELECTION_RANGE_IN < event->button.y) && (event->button.y < preview_selection[3] + SELECTION_RANGE_OUT) ) ) /* bottom */ + { + cursornr = GDK_BOTTOM_RIGHT_CORNER; + } + + if (cursornr != p->cursornr) + { + cursor = gdk_cursor_new(cursornr); /* set curosr */ + gdk_window_set_cursor(p->window->window, cursor); + gdk_cursor_destroy(cursor); + p->cursornr = cursornr; + } + break; + + case 512: /* middle button */ + case 1024: /* right button */ + if (p->selection_drag) + { + int dx, dy; + + dx = p->selection_xpos - event->motion.x; + dy = p->selection_ypos - event->motion.y; + + p->selection_xpos = event->motion.x; + p->selection_ypos = event->motion.y; + + p->selection.active = TRUE; + p->selection.coordinate[0] -= dx / xscale; + p->selection.coordinate[1] -= dy / yscale; + p->selection.coordinate[2] -= dx / xscale; + p->selection.coordinate[3] -= dy / yscale; + + preview_bound_selection(p); + preview_update_maximum_output_size(p); + preview_draw_selection(p); + + if ((preferences.gtk_update_policy == GTK_UPDATE_CONTINUOUS) && (event_count == 1)) + { + preview_establish_selection(p); + } + else if ((preferences.gtk_update_policy == GTK_UPDATE_DELAYED) && (event_count == 1)) + { + preview_establish_selection(p); + } + } + break; + + default: + if ( ( (preview_selection[0] - SELECTION_RANGE_OUT < event->button.x) && (event->button.x < preview_selection[0] + SELECTION_RANGE_IN) ) && /* left */ + ( (preview_selection[1] - SELECTION_RANGE_OUT < event->button.y) && (event->button.y < preview_selection[1] + SELECTION_RANGE_IN) ) ) /* top */ + { + cursornr = GDK_TOP_LEFT_CORNER; + } + else if ( ( (preview_selection[2] - SELECTION_RANGE_IN < event->button.x) && (event->button.x < preview_selection[2] + SELECTION_RANGE_OUT) ) && /* right */ + ( (preview_selection[1] - SELECTION_RANGE_OUT < event->button.y) && (event->button.y < preview_selection[1] + SELECTION_RANGE_IN) ) ) /* top */ + { + cursornr = GDK_TOP_RIGHT_CORNER; + } + else if ( ( (preview_selection[0] - SELECTION_RANGE_OUT < event->button.x) && (event->button.x < preview_selection[0] + SELECTION_RANGE_IN) ) && /* left */ + ( (preview_selection[3] - SELECTION_RANGE_IN < event->button.y) && (event->button.y < preview_selection[3] + SELECTION_RANGE_OUT) ) ) /* bottom */ + { + cursornr = GDK_BOTTOM_LEFT_CORNER; + } + else if ( ( (preview_selection[2] - SELECTION_RANGE_IN < event->button.x) && (event->button.x < preview_selection[2] + SELECTION_RANGE_OUT) ) && /* right */ + ( (preview_selection[3] - SELECTION_RANGE_IN < event->button.y) && (event->button.y < preview_selection[3] + SELECTION_RANGE_OUT) ) ) /* bottom */ + { + cursornr = GDK_BOTTOM_RIGHT_CORNER; + } + else + { + cursornr = XSANE_CURSOR_PREVIEW; + } + + if ((cursornr != p->cursornr) && (p->cursornr != -1)) + { + cursor = gdk_cursor_new(cursornr); /* set curosr */ + gdk_window_set_cursor(p->window->window, cursor); + gdk_cursor_destroy(cursor); + p->cursornr = cursornr; + } + break; + } + break; + + default: +#if 0 + fprintf(stderr, "preview_event_handler: unhandled event type %d\n", event->type); +#endif + break; + } + } + + while (gtk_events_pending()) /* make sure all selection draw is done now */ + { + gtk_main_iteration(); + } + + event_count--; + + return FALSE; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_start_button_clicked(GtkWidget *widget, gpointer data) +{ + preview_scan(data); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_cancel_button_clicked(GtkWidget *widget, gpointer data) +{ + preview_scan_done(data); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +Preview *preview_new(GSGDialog *dialog) +{ + static int first_time = 1; + GtkWidget *table, *frame; + GtkSignalFunc signal_func; + GtkWidgetClass *class; + GtkBox *vbox, *hbox; + GdkCursor *cursor; + GtkWidget *preset_area_option_menu, *preset_area_menu, *preset_area_item; + Preview *p; + int i; + char buf[256]; + + p = malloc(sizeof(*p)); + if (!p) + { + return 0; + } + memset(p, 0, sizeof(*p)); + + p->mode = MODE_NORMAL; /* no pipette functions etc */ + p->dialog = dialog; + p->input_tag = -1; + + if (first_time) + { + first_time = 0; + gtk_preview_set_gamma(1.0); + gtk_preview_set_install_cmap(preferences.preview_own_cmap); + } + + p->preset_width = INF; /* use full scanarea */ + p->preset_height = INF; /* use full scanarea */ + + p->maximum_output_width = INF; /* full output with */ + p->maximum_output_height = INF; /* full output height */ + +#ifndef XSERVER_WITH_BUGGY_VISUALS + gtk_widget_push_visual(gtk_preview_get_visual()); +#endif + gtk_widget_push_colormap(gtk_preview_get_cmap()); + + snprintf(buf, sizeof(buf), "%s %s", WINDOW_PREVIEW, device_text); + p->top = gtk_dialog_new(); + gtk_window_set_title(GTK_WINDOW(p->top), buf); + vbox = GTK_BOX(GTK_DIALOG(p->top)->vbox); + hbox = GTK_BOX(GTK_DIALOG(p->top)->action_area); + + xsane_set_window_icon(p->top, 0); + + /* top hbox for pipette buttons */ + p->button_box = gtk_hbox_new(FALSE, 5); + gtk_container_set_border_width(GTK_CONTAINER(p->button_box), 4); + gtk_box_pack_start(GTK_BOX(vbox), p->button_box, FALSE, FALSE, 0); + + /* White, gray and black pipette button */ + p->pipette_white = xsane_button_new_with_pixmap(p->button_box, pipette_white_xpm, DESC_PIPETTE_WHITE, (GtkSignalFunc) preview_pipette_white, p); + p->pipette_gray = xsane_button_new_with_pixmap(p->button_box, pipette_gray_xpm, DESC_PIPETTE_GRAY, (GtkSignalFunc) preview_pipette_gray, p); + p->pipette_black = xsane_button_new_with_pixmap(p->button_box, pipette_black_xpm, DESC_PIPETTE_BLACK, (GtkSignalFunc) preview_pipette_black, p); + + /* Zoom not, zoom out and zoom in button */ + p->zoom_not = xsane_button_new_with_pixmap(p->button_box, zoom_not_xpm, DESC_ZOOM_FULL, (GtkSignalFunc) preview_zoom_not, p); + p->zoom_out = xsane_button_new_with_pixmap(p->button_box, zoom_out_xpm, DESC_ZOOM_OUT, (GtkSignalFunc) preview_zoom_out, p); + p->zoom_in = xsane_button_new_with_pixmap(p->button_box, zoom_in_xpm, DESC_ZOOM_IN, (GtkSignalFunc) preview_zoom_in, p); + p->zoom_undo = xsane_button_new_with_pixmap(p->button_box, zoom_undo_xpm, DESC_ZOOM_UNDO, (GtkSignalFunc) preview_zoom_undo, p); + + gtk_widget_set_sensitive(p->zoom_not, FALSE); /* no zoom at this point, so no zoom not */ + gtk_widget_set_sensitive(p->zoom_out, FALSE); /* no zoom at this point, so no zoom out */ + gtk_widget_set_sensitive(p->zoom_undo, FALSE); /* no zoom at this point, so no zoom undo */ + + + + xsane_button_new_with_pixmap(p->button_box, full_preview_area_xpm, DESC_FULL_PREVIEW_AREA, + (GtkSignalFunc) preview_full_preview_area, p); + + /* select maximum scanarea */ + preset_area_menu = gtk_menu_new(); + + for (i = 0; i < PRESET_AREA_ITEMS; ++i) + { + preset_area_item = gtk_menu_item_new_with_label(preset_area[i].name); + gtk_container_add(GTK_CONTAINER(preset_area_menu), preset_area_item); + gtk_signal_connect(GTK_OBJECT(preset_area_item), "activate", (GtkSignalFunc) preview_preset_area_callback, p); + gtk_object_set_data(GTK_OBJECT(preset_area_item), "Selection", (void *) i); + + gtk_widget_show(preset_area_item); + } + + preset_area_option_menu = gtk_option_menu_new(); + gtk_box_pack_start(GTK_BOX(p->button_box), preset_area_option_menu, FALSE, FALSE, 2); + gtk_option_menu_set_menu(GTK_OPTION_MENU(preset_area_option_menu), preset_area_menu); + gtk_option_menu_set_history(GTK_OPTION_MENU(preset_area_option_menu), 0); /* full area */ +/* xsane_back_gtk_set_tooltip(tooltips, preset_area_option_menu, desc); */ + + gtk_widget_show(preset_area_option_menu); + p->preset_area_option_menu = preset_area_option_menu; + + gtk_widget_show(p->button_box); + + + + /* construct the preview area (table with sliders & preview window) */ + table = gtk_table_new(2, 2, /* homogeneous */ FALSE); + gtk_table_set_col_spacing(GTK_TABLE(table), 0, 1); + gtk_table_set_row_spacing(GTK_TABLE(table), 0, 1); + gtk_container_set_border_width(GTK_CONTAINER(table), 2); + gtk_box_pack_start(vbox, table, /* expand */ TRUE, /* fill */ TRUE, /* padding */ 0); + + /* the empty box in the top-left corner */ + frame = gtk_frame_new(/* label */ 0); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT); + gtk_table_attach(GTK_TABLE(table), frame, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); + + /* the horizontal ruler */ + p->hruler = gtk_hruler_new(); + gtk_table_attach(GTK_TABLE(table), p->hruler, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); + + /* the vertical ruler */ + p->vruler = gtk_vruler_new(); + gtk_table_attach(GTK_TABLE(table), p->vruler, 0, 1, 1, 2, 0, GTK_FILL, 0, 0); + + /* the preview area */ + + p->window = gtk_preview_new(GTK_PREVIEW_COLOR); + gtk_preview_set_expand(GTK_PREVIEW(p->window), TRUE); + gtk_widget_set_events(p->window, + GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | + GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); + gtk_signal_connect(GTK_OBJECT(p->window), "event", (GtkSignalFunc) preview_event_handler, p); + gtk_signal_connect_after(GTK_OBJECT(p->window), "expose_event", (GtkSignalFunc) preview_expose_handler, p); + gtk_signal_connect_after(GTK_OBJECT(p->window), "size_allocate", (GtkSignalFunc) preview_area_resize, 0); + gtk_object_set_data(GTK_OBJECT(p->window), "PreviewPointer", p); + + /* Connect the motion-notify events of the preview area with the rulers. Nifty stuff! */ + + class = GTK_WIDGET_CLASS(GTK_OBJECT(p->hruler)->klass); + signal_func = (GtkSignalFunc) class->motion_notify_event; + gtk_signal_connect_object(GTK_OBJECT(p->window), "motion_notify_event", signal_func, GTK_OBJECT(p->hruler)); + + class = GTK_WIDGET_CLASS(GTK_OBJECT(p->vruler)->klass); + signal_func = (GtkSignalFunc) class->motion_notify_event; + gtk_signal_connect_object(GTK_OBJECT(p->window), "motion_notify_event", signal_func, GTK_OBJECT(p->vruler)); + + p->viewport = gtk_frame_new(/* label */ 0); + gtk_frame_set_shadow_type(GTK_FRAME(p->viewport), GTK_SHADOW_IN); + gtk_container_add(GTK_CONTAINER(p->viewport), p->window); + + gtk_table_attach(GTK_TABLE(table), p->viewport, 1, 2, 1, 2, + GTK_FILL | GTK_EXPAND | GTK_SHRINK, + GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0); + + preview_update_surface(p, 0); + + /* fill in action area: */ + + /* Start button */ + p->start = gtk_button_new_with_label(BUTTON_PREVIEW_ACQUIRE); + gtk_signal_connect(GTK_OBJECT(p->start), "clicked", (GtkSignalFunc) preview_start_button_clicked, p); + gtk_box_pack_start(GTK_BOX(hbox), p->start, TRUE, TRUE, 0); + + /* Cancel button */ + p->cancel = gtk_button_new_with_label(BUTTON_PREVIEW_CANCEL); + gtk_signal_connect(GTK_OBJECT(p->cancel), "clicked", (GtkSignalFunc) preview_cancel_button_clicked, p); + gtk_box_pack_start(GTK_BOX(hbox), p->cancel, TRUE, TRUE, 0); + gtk_widget_set_sensitive(p->cancel, FALSE); + + gtk_widget_show(p->cancel); + gtk_widget_show(p->start); + gtk_widget_show(p->viewport); + gtk_widget_show(p->window); + gtk_widget_show(p->hruler); + gtk_widget_show(p->vruler); + gtk_widget_show(frame); + gtk_widget_show(table); + gtk_widget_show(p->top); + + cursor = gdk_cursor_new(XSANE_CURSOR_PREVIEW); /* set default curosr */ + gdk_window_set_cursor(p->window->window, cursor); + gdk_cursor_destroy(cursor); + p->cursornr = XSANE_CURSOR_PREVIEW; + + gtk_widget_pop_colormap(); +#ifndef XSERVER_WITH_BUGGY_VISUALS + gtk_widget_pop_visual(); +#endif + return p; +} + + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_area_correct(Preview *p) +{ + float width, height, max_width, max_height; + + width = p->preview_width; + height = p->preview_height; + max_width = p->preview_window_width; + max_height = p->preview_window_height; + + width = max_width; + height = width / p->aspect; + + if (height > max_height) + { + height = max_height; + width = height * p->aspect; + } + + p->preview_width = width + 0.5; + p->preview_height = height + 0.5; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void preview_update_surface(Preview *p, int surface_changed) +{ + float val; + float width, height; + float max_width, max_height; + float preset_width, preset_height; + const SANE_Option_Descriptor *opt; + int i; + SANE_Value_Type type; + SANE_Unit unit; + double min, max; + + unit = SANE_UNIT_PIXEL; + type = SANE_TYPE_INT; + + for (i = 0; i < 4; ++i) /* test if surface (max vals of scanarea) has changed */ + { +/* val = (i & 2) ? INF : -INF; */ + val = (i & 2) ? INF : 0; + + if (p->dialog->well_known.coord[i] > 0) + { + opt = sane_get_option_descriptor(p->dialog->dev, p->dialog->well_known.coord[i]); + assert(opt->unit == SANE_UNIT_PIXEL || opt->unit == SANE_UNIT_MM); + unit = opt->unit; + type = opt->type; + + xsane_get_bounds(opt, &min, &max); + + if (i & 2) + { + val = max; + } + else + { + val = min; + } + } + + if (p->max_scanner_surface[i] != val) + { + surface_changed = 2; + p->max_scanner_surface[i] = val; + } + } + + if (surface_changed == 2) /* redefine all surface subparts */ + { + for (i = 0; i < 4; i++) + { + val = p->max_scanner_surface[i]; + p->scanner_surface[i] = val; + p->surface[i] = val; + p->image_surface[i] = val; + } + } + + max_width = p->max_scanner_surface[xsane_back_gtk_BR_X] - p->max_scanner_surface[xsane_back_gtk_TL_X]; + max_height = p->max_scanner_surface[xsane_back_gtk_BR_Y] - p->max_scanner_surface[xsane_back_gtk_TL_Y]; + + width = p->scanner_surface[xsane_back_gtk_BR_X] - p->scanner_surface[xsane_back_gtk_TL_X]; + height = p->scanner_surface[xsane_back_gtk_BR_Y] - p->scanner_surface[xsane_back_gtk_TL_Y]; + + preset_width = p->preset_width; + preset_height = p->preset_height; + + if (preset_width > max_width) + { + preset_width = max_width; + } + + if (preset_height > max_height) + { + preset_height = max_height; + } + + if ( (width != preset_width) || (height != preset_height) ) + { + p->scanner_surface[xsane_back_gtk_TL_X] = p->scanner_surface[xsane_back_gtk_TL_X]; + p->surface[xsane_back_gtk_TL_X] = p->scanner_surface[xsane_back_gtk_TL_X]; + p->image_surface[xsane_back_gtk_TL_X] = p->scanner_surface[xsane_back_gtk_TL_X]; + + p->scanner_surface[xsane_back_gtk_BR_X] = p->scanner_surface[xsane_back_gtk_TL_X] + preset_width; + p->surface[xsane_back_gtk_BR_X] = p->scanner_surface[xsane_back_gtk_TL_X] + preset_width; + p->image_surface[xsane_back_gtk_BR_X] = p->scanner_surface[xsane_back_gtk_TL_X] + preset_width; + + p->scanner_surface[xsane_back_gtk_TL_Y] = p->scanner_surface[xsane_back_gtk_TL_Y]; + p->surface[xsane_back_gtk_TL_Y] = p->scanner_surface[xsane_back_gtk_TL_Y]; + p->image_surface[xsane_back_gtk_TL_Y] = p->scanner_surface[xsane_back_gtk_TL_Y]; + + p->scanner_surface[xsane_back_gtk_BR_Y] = p->scanner_surface[xsane_back_gtk_TL_Y] + preset_height; + p->surface[xsane_back_gtk_BR_Y] = p->scanner_surface[xsane_back_gtk_TL_Y] + preset_height; + p->image_surface[xsane_back_gtk_BR_Y] = p->scanner_surface[xsane_back_gtk_TL_Y] + preset_height; + + surface_changed = 1; + } + + if (p->surface_unit != unit) + { + surface_changed = 1; + p->surface_unit = unit; + } + + if (p->surface_unit == SANE_UNIT_MM) + { + gtk_widget_set_sensitive(p->preset_area_option_menu, TRUE); /* enable preset area */ + } + else + { + gtk_widget_set_sensitive(p->preset_area_option_menu, FALSE); /* disable preset area */ + } + + if (p->surface_type != type) + { + surface_changed = 1; + p->surface_type = type; + } + + if (surface_changed) + { + /* guess the initial preview window size: */ + + width = p->surface[xsane_back_gtk_BR_X] - p->surface[xsane_back_gtk_TL_X]; + height = p->surface[xsane_back_gtk_BR_Y] - p->surface[xsane_back_gtk_TL_Y]; + + if (p->surface_type == SANE_TYPE_INT) + { + width += 1.0; + height += 1.0; + } + else + { + width += SANE_UNFIX(1.0); + height += SANE_UNFIX(1.0); + } + + assert(width > 0.0 && height > 0.0); + + if (width >= INF || height >= INF) + { + p->aspect = 1.0; + } + else + { + p->aspect = width/height; + } + } + else if ( (p->image_height) && (p->image_width) ) + { + p->aspect = p->image_width/(float) p->image_height; + } + + if ( (surface_changed) && (p->preview_window_width == 0) ) + { + p->preview_window_width = 0.5 * gdk_screen_width(); + p->preview_window_height = 0.5 * gdk_screen_height(); + } + + preview_area_correct(p); + + if (surface_changed) + { + gtk_widget_set_usize(GTK_WIDGET(p->window), p->preview_width, p->preview_height); + /* preview_area_resize is automatically called by signal handler */ + + preview_bound_selection(p); /* make sure selection is not larger than surface */ + preview_restore_image(p); /* draw selected surface of the image */ + } + else + { + preview_update_selection(p); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void preview_scan(Preview *p) +{ + double min, max, swidth, sheight, width, height, dpi = 0; + const SANE_Option_Descriptor *opt; + gint gwidth, gheight; + int i; + + xsane.block_update_param = TRUE; /* do not change parameters each time */ + + preview_save_option(p, p->dialog->well_known.dpi, &p->saved_dpi, &p->saved_dpi_valid); + preview_save_option(p, p->dialog->well_known.dpi_x, &p->saved_dpi_x, &p->saved_dpi_x_valid); + preview_save_option(p, p->dialog->well_known.dpi_y, &p->saved_dpi_y, &p->saved_dpi_y_valid); + + for (i = 0; i < 4; ++i) + { + preview_save_option(p, p->dialog->well_known.coord[i], &p->saved_coord[i], p->saved_coord_valid + i); + } + preview_save_option(p, p->dialog->well_known.bit_depth, &p->saved_bit_depth, &p->saved_bit_depth_valid); + + /* determine dpi, if necessary: */ + + if (p->dialog->well_known.dpi > 0) + { + opt = sane_get_option_descriptor(p->dialog->dev, p->dialog->well_known.dpi); + + gwidth = p->preview_width; + gheight = p->preview_height; + + height = gheight; + width = height * p->aspect; + + if (width > gwidth) + { + width = gwidth; + height = width / p->aspect; + } + + swidth = (p->surface[xsane_back_gtk_BR_X] - p->surface[xsane_back_gtk_TL_X]); + + if (swidth < INF) + { + dpi = MM_PER_INCH * width/swidth; + } + else + { + sheight = (p->surface[xsane_back_gtk_BR_Y] - p->surface[xsane_back_gtk_TL_Y]); + if (sheight < INF) + { + dpi = MM_PER_INCH * height/sheight; + } + else + { + dpi = 18.0; + } + } + + xsane_get_bounds(opt, &min, &max); + + if (dpi < min) + { + dpi = min; + } + + if (dpi > max) + { + dpi = max; + } + + xsane_set_resolution(p->dialog->well_known.dpi, dpi); /* set resolution to dpi or next higher value that is available */ + xsane_set_resolution(p->dialog->well_known.dpi_x, dpi); /* set resolution to dpi or next higher value that is available */ + xsane_set_resolution(p->dialog->well_known.dpi_y, dpi); /* set resolution to dpi or next higher value that is available */ + } + + /* set the scan window (necessary since backends may default to non-maximum size): */ + + for (i = 0; i < 4; ++i) + { + preview_set_option_float(p, p->dialog->well_known.coord[i], p->surface[i]); + } + + preview_set_option_bool(p, p->dialog->well_known.preview, SANE_TRUE); + + if ( (p->saved_bit_depth > 8) && (p->saved_bit_depth_valid) ) /* don't scan with more than 8bpp */ + { + preview_set_option_int(p, p->dialog->well_known.bit_depth, 8); + } + + xsane.block_update_param = FALSE; + + /* OK, all set to go */ + preview_scan_start(p); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_save_image_file(Preview *p, FILE *out) +{ + if (out) + { + /* always save it as a PPM image: */ + fprintf(out, "P6\n# surface: %g %g %g %g %u %u\n%d %d\n255\n", + p->surface[0], p->surface[1], p->surface[2], p->surface[3], + p->surface_type, p->surface_unit, p->image_width, p->image_height); + + fwrite(p->image_data_raw, 3, p->image_width*p->image_height, out); + fclose(out); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_save_image(Preview *p) +{ + char filename[PATH_MAX]; + FILE *out; + int status; + + if (!p->image_data_enh) + { + return; + } + + if ( GROSSLY_EQUAL(p->max_scanner_surface[0], p->surface[0]) && /* full device surface */ + GROSSLY_EQUAL(p->max_scanner_surface[1], p->surface[1]) && + GROSSLY_EQUAL(p->max_scanner_surface[2], p->surface[2]) && + GROSSLY_EQUAL(p->max_scanner_surface[3], p->surface[3]) ) + { + status = preview_make_image_path(p, sizeof(filename), filename, 0); + } + else if ( GROSSLY_EQUAL(p->scanner_surface[0], p->surface[0]) && /* user defined surface */ + GROSSLY_EQUAL(p->scanner_surface[1], p->surface[1]) && + GROSSLY_EQUAL(p->scanner_surface[2], p->surface[2]) && + GROSSLY_EQUAL(p->scanner_surface[3], p->surface[3]) ) + { + status = preview_make_image_path(p, sizeof(filename), filename, 1); + } + else /* zoom area */ + { + status = preview_make_image_path(p, sizeof(filename), filename, 2); + } + + if (status >= 0) + { + /* save preview image */ + remove(filename); /* remove existing preview */ + umask(0177); /* creare temporary file with "-rw-------" permissions */ + out = fopen(filename, "w"); + umask(XSANE_DEFAULT_UMASK); /* define new file permissions */ + + preview_save_image_file(p, out); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void preview_destroy(Preview *p) +{ + int level; + int status; + char filename[PATH_MAX]; + + if (p->scanning) + { + preview_scan_done(p); /* don't save partial window */ + } + else + { + preview_save_image(p); + } + + if (!preferences.preserve_preview) + { + for(level = 0; level <= 2; level++) + { + status = preview_make_image_path(p, sizeof(filename), filename, level); + if (status >= 0) + { + remove(filename); /* remove existing preview */ + } + } + } + + if (p->image_data_enh) + { + free(p->image_data_enh); + p->image_data_enh = 0; + } + + if (p->image_data_raw) + { + free(p->image_data_raw); + p->image_data_raw = 0; + } + + if (p->preview_row) + { + free(p->preview_row); + p->preview_row = 0; + } + + if (p->gc_selection) + { + gdk_gc_destroy(p->gc_selection); + } + + if (p->gc_selection_maximum) + { + gdk_gc_destroy(p->gc_selection_maximum); + } + + if (p->top) + { + gtk_widget_destroy(p->top); + } + free(p); + + p = 0; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_zoom_not(GtkWidget *window, gpointer data) +{ + Preview *p=data; + int i; + + for (i=0; i<4; i++) + { + p->surface[i] = p->scanner_surface[i]; + } + + preview_update_surface(p, 1); + gtk_widget_set_sensitive(p->zoom_not, FALSE); /* forbid unzoom */ + gtk_widget_set_sensitive(p->zoom_out, FALSE); /* forbid zoom out */ + gtk_widget_set_sensitive(p->zoom_undo,TRUE); /* allow zoom undo */ + + while (gtk_events_pending()) /* make sure all selection draw is done now */ + { + gtk_main_iteration(); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_zoom_out(GtkWidget *window, gpointer data) +{ + Preview *p=data; + int i; + float delta_width = (p->surface[2] - p->surface[0]) * 0.2; + float delta_height = (p->surface[3] - p->surface[1]) * 0.2; + + for (i=0; i<4; i++) + { + p->old_surface[i] = p->surface[i]; + } + + p->surface[0] -= delta_width; + p->surface[1] -= delta_height; + p->surface[2] += delta_width; + p->surface[3] += delta_height; + + if (p->surface[0] < p->scanner_surface[0]) + { + p->surface[0] = p->scanner_surface[0]; + } + + if (p->surface[1] < p->scanner_surface[1]) + { + p->surface[1] = p->scanner_surface[1]; + } + + if (p->surface[2] > p->scanner_surface[2]) + { + p->surface[2] = p->scanner_surface[2]; + } + + if (p->surface[3] > p->scanner_surface[3]) + { + p->surface[3] = p->scanner_surface[3]; + } + + preview_update_surface(p, 1); + gtk_widget_set_sensitive(p->zoom_not, TRUE); /* allow unzoom */ + gtk_widget_set_sensitive(p->zoom_undo,TRUE); /* allow zoom undo */ + + while (gtk_events_pending()) /* make sure all selection draw is done now */ + { + gtk_main_iteration(); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_zoom_in(GtkWidget *window, gpointer data) +{ + Preview *p=data; + const SANE_Option_Descriptor *opt; + SANE_Status status; + SANE_Word val; + int i, optnum; + + for (i=0; i<4; i++) + { + p->old_surface[i] = p->surface[i]; + + optnum = p->dialog->well_known.coord[i]; + if (optnum > 0) + { + opt = sane_get_option_descriptor(p->dialog->dev, optnum); + status = sane_control_option(p->dialog->dev, optnum, SANE_ACTION_GET_VALUE, &val, 0); + if (status != SANE_STATUS_GOOD) + { + continue; + } + + if (opt->type == SANE_TYPE_FIXED) + { + p->surface[i] = SANE_UNFIX(val); + } + else + { + p->surface[i] = val; + } + } + } + + preview_update_surface(p, 1); + gtk_widget_set_sensitive(p->zoom_not, TRUE); /* allow unzoom */ + gtk_widget_set_sensitive(p->zoom_out, TRUE); /* allow zoom out */ + gtk_widget_set_sensitive(p->zoom_undo,TRUE); /* allow zoom undo */ + + while (gtk_events_pending()) /* make sure all selection draw is done now */ + { + gtk_main_iteration(); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_zoom_undo(GtkWidget *window, gpointer data) +{ + Preview *p=data; + int i; + + for (i=0; i<4; i++) + { + p->surface[i] = p->old_surface[i]; + } + + preview_update_surface(p, 1); + gtk_widget_set_sensitive(p->zoom_not, TRUE); /* allow unzoom */ + gtk_widget_set_sensitive(p->zoom_out, TRUE); /* allow zoom out */ + gtk_widget_set_sensitive(p->zoom_undo, FALSE); /* forbid zoom undo */ + + while (gtk_events_pending()) /* make sure all selection draw is done now */ + { + gtk_main_iteration(); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_get_color(Preview *p, int x, int y, int *red, int *green, int *blue) +{ + int image_x, image_y; + float xscale_p2i, yscale_p2i; + int offset; + + if (p->image_data_raw) + { + preview_get_scale_preview_to_image(p, &xscale_p2i, &yscale_p2i); + + image_x = x * xscale_p2i; + image_y = y * yscale_p2i; + + offset = 3 * (image_y * p->image_width + image_x); + + if (!xsane.negative) /* positive */ + { + *red = p->image_data_raw[offset ]; + *green = p->image_data_raw[offset + 1]; + *blue = p->image_data_raw[offset + 2]; + } + else /* negative */ + { + *red = 255 - p->image_data_raw[offset ]; + *green = 255 - p->image_data_raw[offset + 1]; + *blue = 255 - p->image_data_raw[offset + 2]; + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_pipette_white(GtkWidget *window, gpointer data) +{ + Preview *p=data; + GdkCursor *cursor; + GdkColor fg; + GdkColor bg; + GdkPixmap *pixmap; + GdkPixmap *mask; + + p->mode = MODE_PIPETTE_WHITE; + + pixmap = gdk_bitmap_create_from_data(p->top->window, cursor_pipette_white, CURSOR_PIPETTE_WIDTH, CURSOR_PIPETTE_HEIGHT); + mask = gdk_bitmap_create_from_data(p->top->window, cursor_pipette_mask, CURSOR_PIPETTE_WIDTH, CURSOR_PIPETTE_HEIGHT); + + fg.red = 0; + fg.green = 0; + fg.blue = 0; + + bg.red = 65535; + bg.green = 65535; + bg.blue = 65535; + + cursor = gdk_cursor_new_from_pixmap(pixmap, mask, &fg, &bg, CURSOR_PIPETTE_HOT_X, CURSOR_PIPETTE_HOT_Y); + + gdk_window_set_cursor(p->window->window, cursor); + gdk_cursor_destroy(cursor); + p->cursornr = -1; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_pipette_gray(GtkWidget *window, gpointer data) +{ + Preview *p=data; + GdkCursor *cursor; + GdkColor fg; + GdkColor bg; + GdkPixmap *pixmap; + GdkPixmap *mask; + + p->mode = MODE_PIPETTE_GRAY; + + pixmap = gdk_bitmap_create_from_data(p->top->window, cursor_pipette_gray, CURSOR_PIPETTE_WIDTH, CURSOR_PIPETTE_HEIGHT); + mask = gdk_bitmap_create_from_data(p->top->window, cursor_pipette_mask, CURSOR_PIPETTE_WIDTH, CURSOR_PIPETTE_HEIGHT); + + fg.red = 0; + fg.green = 0; + fg.blue = 0; + + bg.red = 65535; + bg.green = 65535; + bg.blue = 65535; + + cursor = gdk_cursor_new_from_pixmap(pixmap, mask, &fg, &bg, CURSOR_PIPETTE_HOT_X, CURSOR_PIPETTE_HOT_Y); + + gdk_window_set_cursor(p->window->window, cursor); + gdk_cursor_destroy(cursor); + p->cursornr = -1; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_pipette_black(GtkWidget *window, gpointer data) +{ + Preview *p=data; + GdkCursor *cursor; + GdkColor fg; + GdkColor bg; + GdkPixmap *pixmap; + GdkPixmap *mask; + + p->mode = MODE_PIPETTE_BLACK; + + pixmap = gdk_bitmap_create_from_data(p->top->window, cursor_pipette_black, CURSOR_PIPETTE_WIDTH, CURSOR_PIPETTE_HEIGHT); + mask = gdk_bitmap_create_from_data(p->top->window, cursor_pipette_mask , CURSOR_PIPETTE_WIDTH, CURSOR_PIPETTE_HEIGHT); + + fg.red = 0; + fg.green = 0; + fg.blue = 0; + + bg.red = 65535; + bg.green = 65535; + bg.blue = 65535; + + cursor = gdk_cursor_new_from_pixmap(pixmap, mask, &fg, &bg, CURSOR_PIPETTE_HOT_X, CURSOR_PIPETTE_HOT_Y); + + gdk_window_set_cursor(p->window->window, cursor); + gdk_cursor_destroy(cursor); + p->cursornr = -1; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_full_preview_area(GtkWidget *widget, gpointer call_data) +{ + Preview *p = call_data; + int i; + + p->selection.active = TRUE; + + for (i=0; i<4; i++) + { + p->selection.coordinate[i] = p->surface[i]; + } + + preview_update_maximum_output_size(p); + preview_draw_selection(p); + preview_establish_selection(p); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void preview_preset_area_callback(GtkWidget *widget, gpointer call_data) +{ + Preview *p = call_data; + int selection; + + selection = (int) gtk_object_get_data(GTK_OBJECT(widget), "Selection"); + + p->preset_width = preset_area[selection].width; + p->preset_height = preset_area[selection].height; + + preview_update_surface(p, 0); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void preview_do_gamma_correction(Preview *p) +{ + int x,y; + int offset; + + if (p->image_data_raw) + { + if ((p->image_data_raw) && (p->params.depth > 1) && (preview_gamma_data_red)) + { + for (y=0; y < p->image_height; y++) + { + for (x=0; x < p->image_width; x++) + { + offset = 3 * (y * p->image_width + x); + p->image_data_enh[offset ] = preview_gamma_data_red [p->image_data_raw[offset ]]; + p->image_data_enh[offset + 1] = preview_gamma_data_green[p->image_data_raw[offset + 1]]; + p->image_data_enh[offset + 2] = preview_gamma_data_blue [p->image_data_raw[offset + 2]]; + } + } + } + + preview_display_partial_image(p); + + p->previous_selection.active = FALSE; /* previous selection is not drawn */ + p->previous_selection_maximum.active = FALSE; + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void preview_calculate_histogram(Preview *p, + SANE_Int *count_raw, SANE_Int *count_raw_red, SANE_Int *count_raw_green, SANE_Int *count_raw_blue, + SANE_Int *count, SANE_Int *count_red, SANE_Int *count_green, SANE_Int *count_blue) +{ + int x, y; + int offset; + SANE_Int red_raw, green_raw, blue_raw; + SANE_Int red, green, blue; + SANE_Int min_x, max_x, min_y, max_y; + float xscale, yscale; + + preview_get_scale_device_to_image(p, &xscale, &yscale); + + min_x = (p->selection.coordinate[0] - p->surface[0]) * xscale; + min_y = (p->selection.coordinate[1] - p->surface[1]) * yscale; + max_x = (p->selection.coordinate[2] - p->surface[0]) * xscale; + max_y = (p->selection.coordinate[3] - p->surface[1]) * yscale; + + if (min_x < 0) + { + min_x = 0; + } + + if (max_x >= p->image_width) + { + max_x = p->image_width-1; + } + + if (min_y < 0) + { + min_y = 0; + } + + if (max_y >= p->image_height) + { + max_y = p->image_height-1; + } + + if ((p->image_data_raw) && (p->params.depth > 1) && (preview_gamma_data_red)) + { + for (y = min_y; y <= max_y; y++) + { + for (x = min_x; x <= max_x; x++) + { + offset = 3 * (y * p->image_width + x); + red_raw = p->image_data_raw[offset ]; + green_raw = p->image_data_raw[offset + 1]; + blue_raw = p->image_data_raw[offset + 2]; + + red = histogram_gamma_data_red [red_raw]; + green = histogram_gamma_data_green[green_raw]; + blue = histogram_gamma_data_blue [blue_raw]; + +/* count_raw [(int) sqrt((red_raw*red_raw + green_raw*green_raw + blue_raw*blue_raw)/3.0)]++; */ + count_raw [(int) ((red_raw + green_raw + blue_raw)/3)]++; + count_raw_red [red_raw]++; + count_raw_green[green_raw]++; + count_raw_blue [blue_raw]++; + +/* count [(int) sqrt((red*red + green*green + blue*blue)/3.0)]++; */ + count [(int) ((red + green + blue)/3)]++; + count_red [red]++; + count_green[green]++; + count_blue [blue]++; + } + } + } + else /* no preview image => all colors = 1 */ + { + int i; + + for (i = 1; i <= 254; i++) + { + count_raw [i] = 0; + count_raw_red [i] = 0; + count_raw_green[i] = 0; + count_raw_blue [i] = 0; + + count [i] = 0; + count_red [i] = 0; + count_green[i] = 0; + count_blue [i] = 0; + } + + count_raw [0] = 10; + count_raw_red [0] = 10; + count_raw_green[0] = 10; + count_raw_blue [0] = 10; + + count [0] = 10; + count_red [0] = 10; + count_green[0] = 10; + count_blue [0] = 10; + + count_raw [255] = 10; + count_raw_red [255] = 10; + count_raw_green[255] = 10; + count_raw_blue [255] = 10; + + count [255] = 10; + count_red [255] = 10; + count_green[255] = 10; + count_blue [255] = 10; + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void preview_gamma_correction(Preview *p, + SANE_Int *gamma_red, SANE_Int *gamma_green, SANE_Int *gamma_blue, + SANE_Int *gamma_red_hist, SANE_Int *gamma_green_hist, SANE_Int *gamma_blue_hist) +{ + preview_gamma_data_red = gamma_red; + preview_gamma_data_green = gamma_green; + preview_gamma_data_blue = gamma_blue; + + histogram_gamma_data_red = gamma_red_hist; + histogram_gamma_data_green = gamma_green_hist; + histogram_gamma_data_blue = gamma_blue_hist; + + preview_do_gamma_correction(p); + preview_draw_selection(p); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void preview_area_resize(GtkWidget *widget) +{ + float min_x, max_x, delta_x; + float min_y, max_y, delta_y; + float xscale, yscale, f; + Preview *p; + + p = gtk_object_get_data(GTK_OBJECT(widget), "PreviewPointer"); + + p->preview_window_width = widget->allocation.width; + p->preview_window_height = widget->allocation.height; + + p->preview_width = widget->allocation.width; + p->preview_height = widget->allocation.height; + + preview_area_correct(p); /* set preview dimensions (with right aspect) that they fit into the window */ + + if (p->preview_row) /* make sure preview_row is large enough for one line of the new size */ + { + p->preview_row = realloc(p->preview_row, 3 * p->preview_window_width); + } + else + { + p->preview_row = malloc(3 * p->preview_window_width); + } + + /* set the ruler ranges: */ + + min_x = p->surface[xsane_back_gtk_TL_X]; + if (min_x <= -INF) + { + min_x = 0.0; + } + + max_x = p->surface[xsane_back_gtk_BR_X]; + if (max_x >= INF) + { + max_x = p->image_width - 1; + } + + min_y = p->surface[xsane_back_gtk_TL_Y]; + if (min_y <= -INF) + { + min_y = 0.0; + } + + max_y = p->surface[xsane_back_gtk_BR_Y]; + if (max_y >= INF) + { + max_y = p->image_height - 1; + } + + /* convert mm to inches if that's what the user wants: */ + + if (p->surface_unit == SANE_UNIT_MM) + { + double factor = 1.0/preferences.length_unit; + + min_x *= factor; + max_x *= factor; + min_y *= factor; + max_y *= factor; + } + + preview_get_scale_preview_to_image(p, &xscale, &yscale); + + if (p->image_width > 0) + { + f = xscale * p->preview_width / p->image_width; + } + else + { + f = 1.0; + } + + min_x *= f; + max_x *= f; + delta_x = max_x - min_x; + + gtk_ruler_set_range(GTK_RULER(p->hruler), min_x, min_x + delta_x*p->preview_window_width/p->preview_width, + min_x, /* max_size */ 20); + + if (p->image_height > 0) + { + f = yscale * p->preview_height / p->image_height; + } + else + { + f = 1.0; + } + + min_y *= f; + max_y *= f; + delta_y = max_y - min_y; + + gtk_ruler_set_range(GTK_RULER(p->vruler), min_y, min_y + delta_y*p->preview_window_height/p->preview_height, + min_y, /* max_size */ 20); + + preview_paint_image(p); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void preview_update_maximum_output_size(Preview *p) +{ + if ( (p->maximum_output_width >= INF) || (p->maximum_output_height >= INF) ) + { + if (p->selection_maximum.active) + { + p->selection_maximum.active = FALSE; + } + } + else + { + p->previous_selection_maximum = p->selection_maximum; + + p->selection_maximum.active = TRUE; + p->selection_maximum.coordinate[0] = p->selection.coordinate[0]; + p->selection_maximum.coordinate[1] = p->selection.coordinate[1]; + p->selection_maximum.coordinate[2] = p->selection.coordinate[0] + p->maximum_output_width; + p->selection_maximum.coordinate[3] = p->selection.coordinate[1] + p->maximum_output_height; + + if (p->selection_maximum.coordinate[2] > p->max_scanner_surface[2]) + { + p->selection_maximum.coordinate[2] = p->max_scanner_surface[2]; + } + + if (p->selection_maximum.coordinate[3] > p->max_scanner_surface[3]) + { + p->selection_maximum.coordinate[3] = p->max_scanner_surface[3]; + } + + if ( (p->selection.coordinate[0] < p->selection_maximum.coordinate[0]) || + (p->selection.coordinate[1] < p->selection_maximum.coordinate[1]) || + (p->selection.coordinate[2] > p->selection_maximum.coordinate[2]) || + (p->selection.coordinate[3] > p->selection_maximum.coordinate[3]) ) + { + if (p->selection.coordinate[2] > p->selection_maximum.coordinate[2]) + { + p->selection.coordinate[2] = p->selection_maximum.coordinate[2]; + } + + if (p->selection.coordinate[3] > p->selection_maximum.coordinate[3]) + { + p->selection.coordinate[3] = p->selection_maximum.coordinate[3]; + } + preview_draw_selection(p); + preview_establish_selection(p); + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void preview_set_maximum_output_size(Preview *p, float width, float height) +{ + /* witdh and height in device units */ + + p->maximum_output_width = width; + p->maximum_output_height = height; + + preview_update_maximum_output_size(p); + preview_draw_selection(p); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ diff --git a/frontend/xsane-preview.h b/frontend/xsane-preview.h new file mode 100644 index 0000000..fd452ee --- /dev/null +++ b/frontend/xsane-preview.h @@ -0,0 +1,178 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-preview.h + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ------------------------------------------------------------------------------------------------------ */ + +#ifndef xsanepreview_h +#define xsanepreview_h + +/* ------------------------------------------------------------------------------------------------------ */ + +#include + +#include +#include + +#define SELECTION_RANGE_IN 4 +#define SELECTION_RANGE_OUT 8 +#define XSANE_CURSOR_PREVIEW GDK_LEFT_PTR + +/* ------------------------------------------------------------------------------------------------------ */ + +enum +{ + MODE_NORMAL, + MODE_PIPETTE_WHITE, + MODE_PIPETTE_GRAY, + MODE_PIPETTE_BLACK +}; + +/* ------------------------------------------------------------------------------------------------------ */ + +typedef struct Batch_selection +{ + float coordinate[4]; /* batch selection coordinate (device coord) */ + struct Batch_selection *next; +} Batch_selection; + +typedef struct +{ + int active; + float coordinate[4]; /* selection coordinate (device coord) */ +} Tselection; + +/* ------------------------------------------------------------------------------------------------------ */ + +typedef struct +{ + int mode; + GSGDialog *dialog; /* the dialog for this preview */ + + int cursornr; + + SANE_Value_Type surface_type; + SANE_Unit surface_unit; + float surface[4]; /* the corners of the selected surface (device coords) */ + float old_surface[4]; /* the corners of the old selected surface (device coords) */ + float max_scanner_surface[4]; /* the scanner defined corners of the scanner surface (device coords) */ + float scanner_surface[4]; /* the user defined corners of the scanner surface (device coords) */ + float image_surface[4]; /* the corners of the surface (device coords) of the scanned image */ + float aspect; /* the aspect ratio of the scan surface */ + + float preset_width; /* user selected maximum scan width */ + float preset_height; /* user selected maximum scan height */ + + float maximum_output_width; /* maximum output width (photocopy) */ + float maximum_output_height; /* maximum output height (photocopy) */ + + int saved_dpi_valid; + int saved_dpi_x_valid; + int saved_dpi_y_valid; + SANE_Word saved_dpi; + SANE_Word saved_dpi_x; + SANE_Word saved_dpi_y; + int saved_coord_valid[4]; + SANE_Word saved_coord[4]; + int saved_custom_gamma_valid; + SANE_Word saved_custom_gamma; + int saved_bit_depth_valid; + SANE_Word saved_bit_depth; + + /* desired/user-selected preview-window size: */ + int preview_width; /* used with for displaying the preview image */ + int preview_height; /* used height for displaying the preview image */ + int preview_window_width; /* width of the preview window */ + int preview_window_height; /* height of the preview window */ + u_char *preview_row; + + int scanning; + time_t image_last_time_updated; + gint input_tag; + SANE_Parameters params; + int image_offset; + int image_x; + int image_y; + int image_width; /* width of preview image in pixels */ + int image_height; /* height of preview image in pixel lines */ + u_char *image_data_raw; /* 3 * image_width * image_height bytes */ + u_char *image_data_enh; /* 3 * image_width * image_height bytes */ + + GdkGC *gc_selection; + GdkGC *gc_selection_maximum; + int selection_drag; + int selection_drag_edge; + int selection_xpos; + int selection_ypos; + int selection_xedge; + int selection_yedge; + + Tselection selection; /* selected area to scan */ + Tselection previous_selection; /* previous ... */ + Tselection selection_maximum; /* maximum selection size (photocopy) */ + Tselection previous_selection_maximum; /* previous ... */ + + Batch_selection *batch_selection; + + GtkWidget *top; /* top-level widget */ + GtkWidget *hruler; + GtkWidget *vruler; + GtkWidget *viewport; + GtkWidget *window; /* the preview window */ + GtkWidget *start; /* the start button */ + GtkWidget *cancel; /* the cancel button */ + + GtkWidget *button_box; /* hbox for the following buttons */ + GtkWidget *pipette_white; /* pipette white button */ + GtkWidget *pipette_gray; /* pipette gray button */ + GtkWidget *pipette_black; /* pipette black button */ + GtkWidget *zoom_not; /* zoom not button */ + GtkWidget *zoom_out; /* zoom out button */ + GtkWidget *zoom_in; /* zoom in button */ + GtkWidget *zoom_undo; /* zoom undo button */ + GtkWidget *preset_area_option_menu; /* menu for selection of preview area */ +} +Preview; + +/* ------------------------------------------------------------------------------------------------------ */ + +extern Preview *preview_new (GSGDialog *dialog); /* Create a new preview based on the info in DIALOG. */ + +extern void preview_gamma_correction(Preview *p, /* Do gamma correction on preview data */ + int gamma_red[], int gamma_green[], int gamma_blue[], + int gamma_red_hist[], int gamma_green_hist[], int gamma_blue_hist[]); + +extern void preview_update_surface(Preview *p, int surface_changed); /* params changed: update preview */ + +extern void preview_scan(Preview *p); /* Acquire a preview image and display it. */ + +extern void preview_destroy(Preview *p); /* Destroy a preview. */ + +extern void preview_calculate_histogram(Preview *p, /* calculate histogram */ + SANE_Int *count_raw, SANE_Int *count_raw_red, SANE_Int *count_raw_green, SANE_Int *count_raw_blue, + SANE_Int *count, SANE_Int *count_red, SANE_Int *count_green, SANE_Int *count_blue); + +extern void preview_area_resize(GtkWidget *widget); /* redraw preview rulers */ +void preview_set_maximum_output_size(Preview *p, float width, float height); /* set maximum outut size */ + +/* ------------------------------------------------------------------------------------------------------ */ + +#endif /* preview_h */ diff --git a/frontend/xsane-rc-io.c b/frontend/xsane-rc-io.c new file mode 100644 index 0000000..520e97e --- /dev/null +++ b/frontend/xsane-rc-io.c @@ -0,0 +1,903 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-rc-io.c + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------- */ + +#ifdef _AIX +# include /* MUST come first for AIX! */ +#endif +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_LIBC_H +# include /* NeXTStep/OpenStep */ +#endif + +#include +#include "xsane-rc-io.h" + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_space(Wire *w, size_t howmuch) +{ + size_t nbytes, left_over; + int fd = w->io.fd; + ssize_t nread, nwritten; + + if (w->buffer.curr + howmuch > w->buffer.end) + { + switch (w->direction) + { + case WIRE_ENCODE: + nbytes = w->buffer.curr - w->buffer.start; + w->buffer.curr = w->buffer.start; + while (nbytes > 0) + { + nwritten = (*w->io.write) (fd, w->buffer.curr, nbytes); + if (nwritten < 0) + { + w->status = errno; + return; + } + w->buffer.curr += nwritten; + nbytes -= nwritten; + } + + w->buffer.curr = w->buffer.start; + w->buffer.end = w->buffer.start + w->buffer.size; + break; + + case WIRE_DECODE: + left_over = w->buffer.end - w->buffer.curr; + if (left_over) + { + memcpy(w->buffer.start, w->buffer.curr, left_over); + } + w->buffer.curr = w->buffer.start; + w->buffer.end = w->buffer.start + left_over; + + do + { + nread = (*w->io.read) (fd, w->buffer.end, w->buffer.size - left_over); + if (nread <= 0) + { + if (nread == 0) + { +/* errno = EINVAL; */ + errno = XSANE_EOF; + } + w->status = errno; + return; + } + left_over += nread; + w->buffer.end += nread; + } while (left_over < howmuch); + break; + + case WIRE_FREE: + break; + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_void(Wire *w) +{ +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_array(Wire *w, SANE_Word *len_ptr, void **v, WireCodecFunc w_element, size_t element_size) +{ + SANE_Word len; + char *val; + int i; + + if (w->direction == WIRE_FREE) + { + free(*v); + return; + } + + if (w->direction == WIRE_ENCODE) + { + len = *len_ptr; + } + + xsane_rc_io_w_word(w, &len); + + if (w->direction == WIRE_DECODE) + { + *len_ptr = len; + if (len) + { + *v = malloc(len * element_size); + + if (*v == 0) + { + /* Malloc failed, so return an error. */ + w->status = ENOMEM; + return; + } + } + else + { + *v = 0; + } + } + + val = *v; + + for (i = 0; i < len; ++i) + { + (*w_element) (w, val); + val += element_size; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_ptr(Wire *w, void **v, WireCodecFunc w_value, size_t value_size) +{ + SANE_Word is_null; + + if (w->direction == WIRE_FREE) + { + if (*v) + { + free(*v); + } + return; + } + + if (w->direction == WIRE_ENCODE) + { + is_null = (*v == 0); + } + + xsane_rc_io_w_word(w, &is_null); + + if (!is_null) + { + if (w->direction == WIRE_DECODE) + { + *v = malloc(value_size); + + if (*v == 0) + { + /* Malloc failed, so return an error. */ + w->status = ENOMEM; + return; + } + } + (*w_value) (w, *v); + } + else if (w->direction == WIRE_DECODE) + { + *v = 0; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_status(Wire *w, SANE_Status *v) +{ + SANE_Word word = *v; + + xsane_rc_io_w_word(w, &word); + if (w->direction == WIRE_DECODE) + { + *v = word; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_bool(Wire *w, SANE_Bool *v) +{ + SANE_Word word = *v; + + xsane_rc_io_w_word(w, &word); + if (w->direction == WIRE_DECODE) + { + *v = word; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_constraint_type(Wire *w, SANE_Constraint_Type *v) +{ + SANE_Word word = *v; + + xsane_rc_io_w_word(w, &word); + if (w->direction == WIRE_DECODE) + *v = word; +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_value_type(Wire *w, SANE_Value_Type *v) +{ + SANE_Word word = *v; + + xsane_rc_io_w_word(w, &word); + if (w->direction == WIRE_DECODE) + *v = word; +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_unit(Wire *w, SANE_Unit *v) +{ + SANE_Word word = *v; + + xsane_rc_io_w_word(w, &word); + if (w->direction == WIRE_DECODE) + { + *v = word; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_action(Wire *w, SANE_Action *v) +{ + SANE_Word word = *v; + + xsane_rc_io_w_word(w, &word); + if (w->direction == WIRE_DECODE) + { + *v = word; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_frame(Wire *w, SANE_Frame *v) +{ + SANE_Word word = *v; + + xsane_rc_io_w_word(w, &word); + if (w->direction == WIRE_DECODE) + { + *v = word; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_range(Wire *w, SANE_Range *v) +{ + xsane_rc_io_w_word(w, &v->min); + xsane_rc_io_w_word(w, &v->max); + xsane_rc_io_w_word(w, &v->quant); +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_device(Wire *w, SANE_Device *v) +{ + xsane_rc_io_w_string(w, (SANE_String *) &v->name); + xsane_rc_io_w_string(w, (SANE_String *) &v->vendor); + xsane_rc_io_w_string(w, (SANE_String *) &v->model); + xsane_rc_io_w_string(w, (SANE_String *) &v->type); +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_device_ptr(Wire *w, SANE_Device **v) +{ + xsane_rc_io_w_ptr(w, (void **) v, (WireCodecFunc) xsane_rc_io_w_device, sizeof (**v)); +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_option_descriptor(Wire *w, SANE_Option_Descriptor *v) +{ + SANE_Word len; + + xsane_rc_io_w_string(w, (SANE_String *) &v->name); + xsane_rc_io_w_string(w, (SANE_String *) &v->title); + xsane_rc_io_w_string(w, (SANE_String *) &v->desc); + xsane_rc_io_w_value_type(w, &v->type); + xsane_rc_io_w_unit(w, &v->unit); + xsane_rc_io_w_word(w, &v->size); + xsane_rc_io_w_word(w, &v->cap); + xsane_rc_io_w_constraint_type(w, &v->constraint_type); + + switch (v->constraint_type) + { + case SANE_CONSTRAINT_NONE: + break; + + case SANE_CONSTRAINT_RANGE: + xsane_rc_io_w_ptr(w, (void **) &v->constraint.range, (WireCodecFunc) xsane_rc_io_w_range, sizeof (SANE_Range)); + break; + + case SANE_CONSTRAINT_WORD_LIST: + if (w->direction == WIRE_ENCODE) + len = v->constraint.word_list[0] + 1; + xsane_rc_io_w_array(w, &len, (void **) &v->constraint.word_list, w->codec.w_word, sizeof(SANE_Word)); + break; + + case SANE_CONSTRAINT_STRING_LIST: + if (w->direction == WIRE_ENCODE) + { + for (len = 0; v->constraint.string_list[len]; ++len); + ++len; /* send NULL string, too */ + } + xsane_rc_io_w_array(w, &len, (void **) &v->constraint.string_list, w->codec.w_string, sizeof(SANE_String)); + break; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_option_descriptor_ptr(Wire *w, SANE_Option_Descriptor **v) +{ + xsane_rc_io_w_ptr(w, (void **) v, (WireCodecFunc) xsane_rc_io_w_option_descriptor, sizeof (**v)); +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_parameters(Wire *w, SANE_Parameters *v) +{ + xsane_rc_io_w_frame(w, &v->format); + xsane_rc_io_w_bool(w, &v->last_frame); + xsane_rc_io_w_word(w, &v->bytes_per_line); + xsane_rc_io_w_word(w, &v->pixels_per_line); + xsane_rc_io_w_word(w, &v->lines); + xsane_rc_io_w_word(w, &v->depth); +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_flush(Wire *w) +{ + w->status = 0; + + if (w->direction == WIRE_ENCODE) + { + xsane_rc_io_w_space(w, w->buffer.size + 1); + } + else if (w->direction == WIRE_DECODE) + { + w->buffer.curr = w->buffer.end = w->buffer.start; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_set_dir(Wire *w, WireDirection dir) +{ + xsane_rc_io_w_flush(w); + w->direction = dir; + xsane_rc_io_w_flush(w); +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_call(Wire *w, SANE_Word procnum, WireCodecFunc w_arg, void *arg, WireCodecFunc w_reply, void *reply) +{ + w->status = 0; + xsane_rc_io_w_set_dir(w, WIRE_ENCODE); + + xsane_rc_io_w_word(w, &procnum); + (*w_arg) (w, arg); + + if (w->status == 0) + { + xsane_rc_io_w_set_dir(w, WIRE_DECODE); + (*w_reply) (w, reply); + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_reply(Wire *w, WireCodecFunc w_reply, void *reply) +{ + w->status = 0; + xsane_rc_io_w_set_dir(w, WIRE_ENCODE); + (*w_reply) (w, reply); + xsane_rc_io_w_flush(w); +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_free(Wire *w, WireCodecFunc w_reply, void *reply) +{ + WireDirection saved_dir = w->direction; + + w->direction = WIRE_FREE; + (*w_reply) (w, reply); + w->direction = saved_dir; +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_init(Wire *w) +{ + w->status = 0; + w->direction = WIRE_ENCODE; + w->buffer.size = 8192; + w->buffer.start = malloc(w->buffer.size); + + if (w->buffer.start == 0) /* Malloc failed, so return an error. */ + { + w->status = ENOMEM; + } + + w->buffer.curr = w->buffer.start; + w->buffer.end = w->buffer.start + w->buffer.size; +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +static const char *hexdigit = "0123456789abcdef"; + +/* ---------------------------------------------------------------------------------------------------------------- */ + +static void xsane_rc_io_skip_ws(Wire *w) +{ + while (1) + { + xsane_rc_io_w_space(w, 1); + + if (w->status != 0) + { + return; + } + + if (!isspace(*w->buffer.curr)) + { + return; + } + + ++w->buffer.curr; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_skip_newline(Wire *w) +{ + while (*w->buffer.curr != 10) + { + xsane_rc_io_w_space(w, 1); + + if (w->status != 0) + { + return; + } + ++w->buffer.curr; + } + ++w->buffer.curr; +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +static unsigned xsane_rc_io_get_digit(Wire *w) +{ + unsigned digit; + + xsane_rc_io_w_space(w, 1); + digit = tolower(*w->buffer.curr++) - '0'; + + if (digit > 9) + { + digit -= 'a' - ('9' + 1); + } + + if (digit > 0xf) + { + w->status = EINVAL; + return 0; + } + return digit; +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +static SANE_Byte xsane_rc_io_get_byte(Wire *w) +{ + return xsane_rc_io_get_digit(w) << 4 | xsane_rc_io_get_digit(w); +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_byte(Wire *w, SANE_Byte *v) +{ + SANE_Byte *b = v; + + switch (w->direction) + { + case WIRE_ENCODE: + xsane_rc_io_w_space(w, 3); + *w->buffer.curr++ = hexdigit[(*b >> 4) & 0x0f]; + *w->buffer.curr++ = hexdigit[(*b >> 0) & 0x0f]; + *w->buffer.curr++ = '\n'; + break; + + case WIRE_DECODE: + xsane_rc_io_skip_ws(w); + *b = xsane_rc_io_get_byte(w); + break; + + case WIRE_FREE: + break; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_char(Wire *w, SANE_Char *v) +{ + SANE_Char *c = v; + + switch (w->direction) + { + case WIRE_ENCODE: + xsane_rc_io_w_space(w, 5); + *w->buffer.curr++ = '\''; + + if (*c == '\'' || *c == '\\') + { + *w->buffer.curr++ = '\\'; + } + + *w->buffer.curr++ = *c; + *w->buffer.curr++ = '\''; + *w->buffer.curr++ = '\n'; + break; + + case WIRE_DECODE: + xsane_rc_io_w_space(w, 4); + if (*w->buffer.curr++ != '\'') + { + w->status = EINVAL; + return; + } + *c = *w->buffer.curr++; + + if (*c == '\\') + { + xsane_rc_io_w_space(w, 2); + *c = *w->buffer.curr++; + } + + if (*w->buffer.curr++ != '\'') + { + w->status = EINVAL; + return; + } + break; + + case WIRE_FREE: + break; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_string(Wire *w, SANE_String *s) +{ + size_t len, alloced_len; + char * str, ch; + int done; + + switch (w->direction) + { + case WIRE_ENCODE: + if (*s) + { + xsane_rc_io_w_space(w, 1); + *w->buffer.curr++ = '"'; + str = *s; + while ((ch = *str++)) + { + xsane_rc_io_w_space(w, 2); + if (ch == '"' || ch == '\\') + { + *w->buffer.curr++ = '\\'; + } + *w->buffer.curr++ = ch; + } + *w->buffer.curr++ = '"'; + } + else + { + xsane_rc_io_w_space(w, 5); + *w->buffer.curr++ = '('; + *w->buffer.curr++ = 'n'; + *w->buffer.curr++ = 'i'; + *w->buffer.curr++ = 'l'; + *w->buffer.curr++ = ')'; + } + + xsane_rc_io_w_space(w, 1); + *w->buffer.curr++ = '\n'; + break; + + case WIRE_DECODE: + xsane_rc_io_skip_ws(w); + xsane_rc_io_w_space(w, 1); + + if (w->status != 0) + { + *s = 0; /* make sure pointer does not point to an invalid address */ + return; + } + + ch = *w->buffer.curr++; + if (ch == '"') + { + alloced_len = len = 0; + str = 0; + done = 0; + + do + { + xsane_rc_io_w_space(w, 1); + + if (w->status != 0) + { + return; + } + + ch = *w->buffer.curr++; + if (ch == '"') + { + done = 1; + } + + if (ch == '\\') + { + xsane_rc_io_w_space(w, 1); + ch = *w->buffer.curr++; + } + + if (len >= alloced_len) + { + alloced_len += 1024; + if (!str) + { + str = malloc(alloced_len); + } + else + { + str = realloc(str, alloced_len); + } + + if (str == 0) + { + /* Malloc failed, so return an error. */ + w->status = ENOMEM; + return; + } + } + str[len++] = ch; + } + while(!done); + + str[len - 1] = '\0'; + *s = realloc(str, len); + + if (*s == 0) + { + /* Malloc failed, so return an error. */ + w->status = ENOMEM; + return; + } + } + else if (ch == '(') + { + *s = 0; /* make sure pointer does not point to an invalid address */ + xsane_rc_io_w_space(w, 4); + if ( *w->buffer.curr++ != 'n' + || *w->buffer.curr++ != 'i' + || *w->buffer.curr++ != 'l' + || *w->buffer.curr++ != ')') + { + w->status = EINVAL; + return; + } + } + else + { + w->status = EINVAL; + *s = 0; /* make sure pointer does not point to an invalid address */ + return; + } + break; + + case WIRE_FREE: + if (*s) + { + free(*s); + } + break; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_io_w_word(Wire *w, SANE_Word *v) +{ + SANE_Word val, *word = v; + int i, is_negative = 0; + char buf[16]; + + switch (w->direction) + { + case WIRE_ENCODE: + val = *word; + i = sizeof(buf) - 1; + + if (val < 0) + { + is_negative = 1; + val = -val; + } + + do + { + buf[i--] = '0' + (val % 10); + val /= 10; + } + while (val); + + if (is_negative) + { + buf[i--] = '-'; + } + + xsane_rc_io_w_space(w, sizeof(buf) - i); + memcpy(w->buffer.curr, buf + i + 1, sizeof(buf) - i - 1); + w->buffer.curr += sizeof(buf) - i - 1; + *w->buffer.curr++ = '\n'; + break; + + case WIRE_DECODE: + xsane_rc_io_skip_ws(w); + val = 0; + xsane_rc_io_w_space(w, 1); + if (*w->buffer.curr == '-') + { + is_negative = 1; + ++w->buffer.curr; + } + + while (1) + { + xsane_rc_io_w_space(w, 1); + + if (w->status != 0) + { + return; + } + + if (!isdigit (*w->buffer.curr)) + { + break; + } + + val = 10*val + (*w->buffer.curr++ - '0'); + } + *word = is_negative ? -val : val; + break; + + case WIRE_FREE: + break; + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +#define PFIELD(p,offset,type) (*((type *)(((char *)(p)) + (offset)))) + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_pref_string(Wire *w, void *p, long offset) +{ + SANE_String string; + + if (w->direction == WIRE_ENCODE) + { + string = PFIELD(p, offset, char *); + } + + xsane_rc_io_w_string(w, &string); + + if (w->direction == WIRE_DECODE) + { + if (w->status == 0) + { + const char **field; + + field = &PFIELD(p, offset, const char *); + if (*field) + { + free((char *) *field); + } + *field = string ? strdup (string) : 0; + } + xsane_rc_io_w_free(w, (WireCodecFunc) xsane_rc_io_w_string, &string); + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_pref_double(Wire *w, void *p, long offset) +{ + SANE_Word word; + + if (w->direction == WIRE_ENCODE) + { + word = SANE_FIX(PFIELD (p, offset, double)); + } + + xsane_rc_io_w_word (w, &word); + + if (w->direction == WIRE_DECODE) + { + if (w->status == 0) + { + PFIELD(p, offset, double) = SANE_UNFIX (word); + } + xsane_rc_io_w_free(w, (WireCodecFunc) xsane_rc_io_w_word, &word); + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ + +void xsane_rc_pref_int(Wire *w, void *p, long offset) +{ + SANE_Word word; + + if (w->direction == WIRE_ENCODE) + { + word = PFIELD(p, offset, int); + } + + xsane_rc_io_w_word (w, &word); + + if (w->direction == WIRE_DECODE) + { + if (w->status == 0) + { + PFIELD(p, offset, int) = word; + } + xsane_rc_io_w_free(w, (WireCodecFunc) xsane_rc_io_w_word, &word); + } +} + +/* ---------------------------------------------------------------------------------------------------------------- */ diff --git a/frontend/xsane-rc-io.h b/frontend/xsane-rc-io.h new file mode 100644 index 0000000..6fd5680 --- /dev/null +++ b/frontend/xsane-rc-io.h @@ -0,0 +1,123 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-rc-io.h + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------- */ + +#ifndef xsane_rc_io_h +#define xsane_rc_io_h + +#include + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#define XSANE_EOF -1 + +/* ---------------------------------------------------------------------------------------------------------------- */ + +typedef enum + { + WIRE_ENCODE = 0, + WIRE_DECODE, + WIRE_FREE + } +WireDirection; + +/* ---------------------------------------------------------------------------------------------------------------- */ + +struct Wire; + +/* ---------------------------------------------------------------------------------------------------------------- */ + +typedef void (*WireCodecFunc) (struct Wire *w, void *val_ptr); +typedef ssize_t (*WireReadFunc) (int fd, void * buf, size_t len); +typedef ssize_t (*WireWriteFunc) (int fd, const void * buf, size_t len); + +/* ---------------------------------------------------------------------------------------------------------------- */ + +typedef struct Wire + { + int version; /* protocol version in use */ + WireDirection direction; + int status; + struct + { + WireCodecFunc w_byte; + WireCodecFunc w_char; + WireCodecFunc w_word; + WireCodecFunc w_string; + } + codec; + struct + { + size_t size; + char *curr; + char *start; + char *end; + } + buffer; + struct + { + int fd; + WireReadFunc read; + WireWriteFunc write; + } + io; + } +Wire; + +/* ---------------------------------------------------------------------------------------------------------------- */ + +extern void xsane_rc_io_w_init(Wire *w); +extern void xsane_rc_io_w_space(Wire *w, size_t howmuch); +extern void xsane_rc_io_w_skip_newline(Wire *w); +extern void xsane_rc_io_w_void(Wire *w); +extern void xsane_rc_io_w_byte(Wire *w, SANE_Byte *v); +extern void xsane_rc_io_w_char(Wire *w, SANE_Char *v); +extern void xsane_rc_io_w_word(Wire *w, SANE_Word *v); +extern void xsane_rc_io_w_string(Wire *w, SANE_String *v); +extern void xsane_rc_io_w_status(Wire *w, SANE_Status *v); +extern void xsane_rc_io_w_constraint_type(Wire *w, SANE_Constraint_Type *v); +extern void xsane_rc_io_w_value_type(Wire *w, SANE_Value_Type *v); +extern void xsane_rc_io_w_unit(Wire *w, SANE_Unit *v); +extern void xsane_rc_io_w_action(Wire *w, SANE_Action *v); +extern void xsane_rc_io_w_frame(Wire *w, SANE_Frame *v); +extern void xsane_rc_io_w_range(Wire *w, SANE_Range *v); +extern void xsane_rc_io_w_range_ptr(Wire *w, SANE_Range **v); +extern void xsane_rc_io_w_device(Wire *w, SANE_Device *v); +extern void xsane_rc_io_w_device_ptr(Wire *w, SANE_Device **v); +extern void xsane_rc_io_w_option_descriptor(Wire *w, SANE_Option_Descriptor *v); +extern void xsane_rc_io_w_option_descriptor_ptr(Wire *w, SANE_Option_Descriptor **v); +extern void xsane_rc_io_w_parameters(Wire *w, SANE_Parameters *v); +extern void xsane_rc_io_w_array(Wire *w, SANE_Word *len, void **v, WireCodecFunc w_element, size_t element_size); +extern void xsane_rc_io_w_flush(Wire *w); +extern void xsane_rc_io_w_set_dir(Wire *w, WireDirection dir); +extern void xsane_rc_io_w_call(Wire *w, SANE_Word proc_num, WireCodecFunc w_arg, void *arg, WireCodecFunc w_reply, void *reply); +extern void xsane_rc_io_w_reply(Wire *w, WireCodecFunc w_reply, void *reply); +extern void xsane_rc_io_w_free(Wire *w, WireCodecFunc w_reply, void *reply); + +extern void xsane_rc_pref_string(Wire *w, void *p, long offset); +extern void xsane_rc_pref_double(Wire *w, void *p, long offset); +extern void xsane_rc_pref_int(Wire *w, void *p, long offset); + +/* ---------------------------------------------------------------------------------------------------------------- */ + +#endif /* xsane_rc_io_wire_h */ diff --git a/frontend/xsane-save.c b/frontend/xsane-save.c new file mode 100644 index 0000000..d9ac69a --- /dev/null +++ b/frontend/xsane-save.c @@ -0,0 +1,975 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-save.c + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#include "xsane.h" +#include "xsane-preview.h" +#include "xsane-back-gtk.h" +#include "xsane-front-gtk.h" +#include "xsane-text.h" + +#ifdef HAVE_LIBJPEG +#include +#endif + +#ifdef HAVE_LIBPNG +#ifdef HAVE_LIBZ +#include +#include +#endif +#endif + +#ifdef HAVE_LIBTIFF +#include +#endif + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static int cancel_save; + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_cancel_save() +{ + cancel_save = 1; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_convert_text_to_filename(char **text) +{ + if (text) + { + char *filename = *text; + char buf[256]; + int buflen=0; + int txtlen=0; + + while((filename[txtlen] != 0) && (buflen<253)) + { + switch (filename[txtlen]) + { + case ' ': + buf[buflen++] = ':'; + buf[buflen++] = '_'; + txtlen++; + break; + + case '/': + buf[buflen++] = ':'; + buf[buflen++] = '%'; + txtlen++; + break; + + case '*': + buf[buflen++] = ':'; + buf[buflen++] = '#'; + txtlen++; + break; + + case '?': + buf[buflen++] = ':'; + buf[buflen++] = 'q'; + txtlen++; + break; + + case '\\': + buf[buflen++] = ':'; + buf[buflen++] = '='; + txtlen++; + break; + + case ';': + buf[buflen++] = ':'; + buf[buflen++] = '!'; + txtlen++; + break; + + case '&': + buf[buflen++] = ':'; + buf[buflen++] = '+'; + txtlen++; + break; + + case '<': + buf[buflen++] = ':'; + buf[buflen++] = 's'; + txtlen++; + break; + + case '>': + buf[buflen++] = ':'; + buf[buflen++] = 'g'; + txtlen++; + break; + + case '|': + buf[buflen++] = ':'; + buf[buflen++] = 'p'; + txtlen++; + break; + + case ':': + buf[buflen++] = ':'; + buf[buflen++] = ':'; + txtlen++; + break; + + default: + buf[buflen++] = filename[txtlen++]; + break; + } + } + buf[buflen] = 0; + free(filename); + *text = strdup(buf); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_increase_counter_in_filename(char *filename, int skip) +{ + char *position_point; + char *position_counter; + char counter; + FILE *testfile; + + while (1) + { + position_point = strrchr(filename, '.'); + if (position_point) + { + position_counter = position_point-1; + } + else + { + position_counter = filename + strlen(filename) - 1; + } + + if (!( (*position_counter >= '0') && (*position_counter <='9') )) + { + break; /* no counter found */ + } + + while ( (position_counter > filename) && (*position_counter >= '0') && (*position_counter <='9') ) + { + counter = ++(*position_counter); + if (counter != ':') + { + break; + } + *position_counter = '0'; + position_counter--; + } + + if (!( (*position_counter >= '0') && (*position_counter <='9') )) /* overflow */ + { + xsane_back_gtk_warning(WARN_COUNTER_OVERFLOW, FALSE); + break; /* last available number ("999") */ + } + + if (skip) /* test if filename already used */ + { + testfile = fopen(filename, "r"); + if (testfile) /* filename used: skip */ + { + fclose(testfile); + } + else + { + break; /* filename not used, ok */ + } + } + else /* do not test if filename already used */ + { + break; /* filename ok */ + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_save_ps_create_header(FILE *outfile, int color, int bits, int pixel_width, int pixel_height, + int left, int bottom, float width, float height, + int paperwidth, int paperheight, int rotate) +{ + int degree, position_left, position_bottom, box_left, box_bottom, box_right, box_top; + + if (rotate) /* roatet with 90 degrees - eg for landscape mode */ + { + degree = 90; + position_left = left; + position_bottom = bottom - paperwidth; + box_left = paperwidth - bottom - height * 72.0; + box_bottom = left; + box_right = (int) (box_left + height * 72.0); + box_top = (int) (box_bottom + width * 72.0); + } + else /* do not rotate, eg for portrait mode */ + { + degree = 0; + position_left = left; + position_bottom = bottom; + box_left = left; + box_bottom = bottom; + box_right = (int) (box_left + width * 72.0); + box_top = (int) (box_bottom + height * 72.0); + } + + fprintf(outfile, "%%!PS-Adobe-2.0 EPSF-2.0\n"); + fprintf(outfile, "%%%%Creator: xsane version %s (sane %d.%d)\n", VERSION, + SANE_VERSION_MAJOR(xsane.sane_backend_versioncode), + SANE_VERSION_MINOR(xsane.sane_backend_versioncode)); + fprintf(outfile, "%%%%BoundingBox: %d %d %d %d\n", box_left, box_bottom, box_right, box_top); + fprintf(outfile, "%%\n"); + fprintf(outfile, "/origstate save def\n"); + fprintf(outfile, "20 dict begin\n"); + + if (bits == 1) + { + fprintf(outfile, "/pix %d string def\n", (pixel_width+7)/8); + fprintf(outfile, "/grays %d string def\n", pixel_width); + fprintf(outfile, "/npixels 0 def\n"); + fprintf(outfile, "/rgbindx 0 def\n"); + } + else + { + fprintf(outfile, "/pix %d string def\n", pixel_width); + } + + + fprintf(outfile, "%d rotate\n", degree); + fprintf(outfile, "%d %d translate\n", position_left, position_bottom); + fprintf(outfile, "%f %f scale\n", width * 72.0, height * 72.0); + fprintf(outfile, "%d %d %d\n", pixel_width, pixel_height, bits); + fprintf(outfile, "[%d %d %d %d %d %d]\n", pixel_width, 0, 0, -pixel_height, 0 , pixel_height); + fprintf(outfile, "{currentfile pix readhexstring pop}\n"); + + if (color) + { + fprintf(outfile, "false 3 colorimage\n"); + fprintf(outfile, "\n"); + } + else + { + fprintf(outfile, "image\n"); + fprintf(outfile, "\n"); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_save_ps_bw(FILE *outfile, FILE *imagefile, int pixel_width, int pixel_height) +{ + int x, y, count; + int bytes_per_line = (pixel_width+7)/8; + + cancel_save = 0; + + count = 0; + for (y = 0; y < pixel_height; y++) + { + for (x = 0; x < bytes_per_line; x++) + { + fprintf(outfile, "%02x", (fgetc(imagefile) ^ 255)); + if (++count >= 40) + { + fprintf(outfile, "\n"); + count = 0; + } + } + fprintf(outfile, "\n"); + count = 0; + xsane_progress_update(xsane.progress, (float)y/pixel_height); + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + if (cancel_save) + { + break; + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_save_ps_gray(FILE *outfile, FILE *imagefile, int pixel_width, int pixel_height) +{ + int x, y, count; + + cancel_save = 0; + + count = 0; + for (y=0; y=40) + { + fprintf(outfile, "\n"); + count = 0; + } + } + fprintf(outfile, "\n"); + count = 0; + xsane_progress_update(xsane.progress, (float)y/pixel_height); + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + if (cancel_save) + { + break; + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_save_ps_color(FILE *outfile, FILE *imagefile, int pixel_width, int pixel_height) +{ + int x, y, count; + + cancel_save = 0; + + count = 0; + for (y=0; y=10) + { + fprintf(outfile, "\n"); + count = 0; + } + } + fprintf(outfile, "\n"); + count = 0; + + xsane_progress_update(xsane.progress, (float)y/pixel_height); + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + if (cancel_save) + { + break; + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_save_ps(FILE *outfile, FILE *imagefile, + int color, int bits, + int pixel_width, int pixel_height, + int left, int bottom, + float width, float height, + int paperheight, int paperwidth, int rotate) +{ + xsane_save_ps_create_header(outfile, color, bits, pixel_width, pixel_height, + left, bottom, width, height, paperheight, paperwidth, rotate); + + if (color == 0) /* lineart, halftone, grayscale */ + { + if (bits == 1) /* lineart, halftone */ + { + xsane_save_ps_bw(outfile, imagefile, pixel_width, pixel_height); + } + else /* grayscale */ + { + xsane_save_ps_gray(outfile, imagefile, pixel_width, pixel_height); + } + } + else /* color */ + { + xsane_save_ps_color(outfile, imagefile, pixel_width, pixel_height); + } + + fprintf(outfile, "\n"); + fprintf(outfile, "showpage\n"); + fprintf(outfile, "end\n"); + fprintf(outfile, "origstate restore\n"); + fprintf(outfile, "\n"); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#ifdef HAVE_LIBJPEG +void xsane_save_jpeg(FILE *outfile, FILE *imagefile, + int color, int bits, + int pixel_width, int pixel_height, + int quality) +{ + char *data; + char buf[256]; + int x,y; + int components = 1; + struct jpeg_compress_struct cinfo; + struct jpeg_error_mgr jerr; + JSAMPROW row_pointer[1]; + + cancel_save = 0; + + if (color) + { + components = 3; + } + + data = malloc(pixel_width * components); + + if (!data) + { + snprintf(buf, sizeof(buf), "%s %s", ERR_DURING_SAVE, ERR_NO_MEM); + xsane_back_gtk_error(buf, TRUE); + return; + } + + cinfo.err = jpeg_std_error(&jerr); + jpeg_create_compress(&cinfo); + jpeg_stdio_dest(&cinfo, outfile); + cinfo.image_width = pixel_width; + cinfo.image_height = pixel_height; + cinfo.input_components = components; + if (color) + { + cinfo.in_color_space = JCS_RGB; + } + else + { + cinfo.in_color_space = JCS_GRAYSCALE; + } + jpeg_set_defaults(&cinfo); + jpeg_set_quality(&cinfo, quality, TRUE); + jpeg_start_compress(&cinfo, TRUE); + + for (y=0; y>= 1; + } + } + else + { + fread(data, components, pixel_width, imagefile); + } + row_pointer[0] = data; + jpeg_write_scanlines(&cinfo, row_pointer, 1); + if (cancel_save) + { + break; + } + } + + jpeg_finish_compress(&cinfo); + free(data); +} +#endif + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#ifdef HAVE_LIBTIFF +void xsane_save_tiff(const char *outfilename, FILE *imagefile, + int color, int bits, + int pixel_width, int pixel_height, + int compression, int quality) +{ + TIFF *tiffile; + char *data; + char buf[256]; + int y, w; + int components; + + cancel_save = 0; + + if (color) + { + components = 3; + } + else + { + components = 1; + } + + tiffile = TIFFOpen(outfilename, "w"); + if (!tiffile) + { + snprintf(buf, sizeof(buf), "%s %s %s\n",ERR_DURING_SAVE, ERR_OPEN_FAILED, outfilename); + xsane_back_gtk_error(buf, TRUE); + return; + } + + data = malloc(pixel_width * components); + + if (!data) + { + snprintf(buf, sizeof(buf), "%s %s", ERR_DURING_SAVE, ERR_NO_MEM); + xsane_back_gtk_error(buf, TRUE); + return; + } + + TIFFSetField(tiffile, TIFFTAG_IMAGEWIDTH, pixel_width); + TIFFSetField(tiffile, TIFFTAG_IMAGELENGTH, pixel_height); + TIFFSetField(tiffile, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); + TIFFSetField(tiffile, TIFFTAG_BITSPERSAMPLE, bits); + TIFFSetField(tiffile, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + TIFFSetField(tiffile, TIFFTAG_COMPRESSION, compression); + TIFFSetField(tiffile, TIFFTAG_SAMPLESPERPIXEL, components); + TIFFSetField(tiffile, TIFFTAG_SOFTWARE, "xsane"); +#if 0 + TIFFSetField(tiffile, TIFFTAG_DATATIME, "0.0.1900,0:0:00"); + TIFFSetField(tiffile, TIFFTAG_XRESOLUTION, 100); + TIFFSetField(tiffile, TIFFTAG_YRESOLUTION, 100); +#endif + + if (compression == COMPRESSION_JPEG) + { + TIFFSetField(tiffile, TIFFTAG_JPEGQUALITY, quality); + } + + if (color) + { + TIFFSetField(tiffile, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB); + } + else + { + if (bits == 1) /* lineart */ + { + TIFFSetField(tiffile, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE); + } + else /* grayscale */ + { + TIFFSetField(tiffile, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK); + } + } + + TIFFSetField(tiffile, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(tiffile, -1)); + + w = TIFFScanlineSize(tiffile); + + for (y = 0; y < pixel_height; y++) + { + xsane_progress_update(xsane.progress, (float) y / pixel_height); + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + + fread(data, 1, w, imagefile); + + TIFFWriteScanline(tiffile, data, y, 0); + + if (cancel_save) + { + break; + } + } + + TIFFClose(tiffile); + free(data); +} +#endif + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#ifdef HAVE_LIBPNG +#ifdef HAVE_LIBZ +void xsane_save_png(FILE *outfile, FILE *imagefile, + int color, int bits, + int pixel_width, int pixel_height, + int compression) +{ + png_structp png_ptr; + png_infop png_info_ptr; + png_bytep row_ptr; + png_color_8 sig_bit; + char *data; + char buf[256]; + int colortype, components, byte_width; + int y; + + cancel_save = 0; + + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); + if (!png_ptr) + { + snprintf(buf, sizeof(buf), "%s %s", ERR_DURING_SAVE, ERR_LIBTIFF); + xsane_back_gtk_error(buf, TRUE); + return; + } + + png_info_ptr = png_create_info_struct(png_ptr); + if (!png_info_ptr) + { + snprintf(buf, sizeof(buf), "%s %s", ERR_DURING_SAVE, ERR_LIBTIFF); + xsane_back_gtk_error(buf, TRUE); + return; + } + + if (setjmp(png_ptr->jmpbuf)) + { + snprintf(buf, sizeof(buf), "%s %s", ERR_DURING_SAVE, ERR_LIBPNG); + xsane_back_gtk_error(buf, TRUE); + png_destroy_write_struct(&png_ptr, (png_infopp) 0); + return; + } + + byte_width = pixel_width; + + if (color == 4) /* RGBA */ + { + components = 4; + colortype = PNG_COLOR_TYPE_RGB_ALPHA; + } + else if (color) /* RGB */ + { + components = 3; + colortype = PNG_COLOR_TYPE_RGB; + } + else /* gray or black/white */ + { + components = 1; + colortype = PNG_COLOR_TYPE_GRAY; + } + + png_init_io(png_ptr, outfile); + png_set_compression_level(png_ptr, compression); + png_set_IHDR(png_ptr, png_info_ptr, pixel_width, pixel_height, bits, + colortype, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + if (color >=3) + { + sig_bit.red = bits; + sig_bit.green = bits; + sig_bit.blue = bits; + + if (color ==4) + { + sig_bit.alpha = bits; + } + + } + else + { + sig_bit.gray = bits; + + if (bits == 1) + { + byte_width = pixel_width/8; + png_set_invert_mono(png_ptr); + } + } + + png_set_sBIT(png_ptr, png_info_ptr, &sig_bit); + png_write_info(png_ptr, png_info_ptr); + png_set_shift(png_ptr, &sig_bit); + + data = malloc(pixel_width * components); + + if (!data) + { + snprintf(buf, sizeof(buf), "%s %s", ERR_DURING_SAVE, ERR_NO_MEM); + xsane_back_gtk_error(buf, TRUE); + png_destroy_write_struct(&png_ptr, (png_infopp) 0); + return; + } + + for (y = 0; y < pixel_height; y++) + { + xsane_progress_update(xsane.progress, (float) y / pixel_height); + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + + fread(data, components, byte_width, imagefile); + + row_ptr = data; + png_write_rows(png_ptr, &row_ptr, 1); + if (cancel_save) + { + break; + } + } + + free(data); + png_write_end(png_ptr, png_info_ptr); + png_destroy_write_struct(&png_ptr, (png_infopp) 0); + +} +#endif +#endif + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#ifdef HAVE_LIBPNG +#ifdef HAVE_LIBZ +void xsane_save_png_16(FILE *outfile, FILE *imagefile, + int color, int bits, + int pixel_width, int pixel_height, + int compression) +{ + png_structp png_ptr; + png_infop png_info_ptr; + png_bytep row_ptr; + png_color_8 sig_bit; /* should be 16, but then I get a warning about wrong type */ + char *data; + char buf[256]; + int colortype, components; + int x,y; + guint16 val; + + cancel_save = 0; + + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); + if (!png_ptr) + { + snprintf(buf, sizeof(buf), "%s %s", ERR_DURING_SAVE, ERR_LIBPNG); + xsane_back_gtk_error(buf, TRUE); + return; + } + + png_info_ptr = png_create_info_struct(png_ptr); + if (!png_info_ptr) + { + snprintf(buf, sizeof(buf), "%s %s", ERR_DURING_SAVE, ERR_LIBPNG); + xsane_back_gtk_error(buf, TRUE); + return; + } + + if (setjmp(png_ptr->jmpbuf)) + { + snprintf(buf, sizeof(buf), "%s %s", ERR_DURING_SAVE, ERR_LIBPNG); + xsane_back_gtk_error(buf, TRUE); + png_destroy_write_struct(&png_ptr, (png_infopp) 0); + return; + } + + if (color == 4) /* RGBA */ + { + components = 4; + colortype = PNG_COLOR_TYPE_RGB_ALPHA; + } + else if (color) /* RGB */ + { + components = 3; + colortype = PNG_COLOR_TYPE_RGB; + } + else /* gray or black/white */ + { + components = 1; + colortype = PNG_COLOR_TYPE_GRAY; + } + + png_init_io(png_ptr, outfile); + png_set_compression_level(png_ptr, compression); + png_set_IHDR(png_ptr, png_info_ptr, pixel_width, pixel_height, 16, + colortype, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + sig_bit.red = bits; + sig_bit.green = bits; + sig_bit.blue = bits; + sig_bit.alpha = bits; + sig_bit.gray = bits; + + png_set_sBIT(png_ptr, png_info_ptr, &sig_bit); + png_write_info(png_ptr, png_info_ptr); + png_set_shift(png_ptr, &sig_bit); + png_set_packing(png_ptr); + + data = malloc(pixel_width * components * 2); + + if (!data) + { + snprintf(buf, sizeof(buf), "%s %s", ERR_DURING_SAVE, ERR_NO_MEM); + xsane_back_gtk_error(buf, TRUE); + png_destroy_write_struct(&png_ptr, (png_infopp) 0); + return; + } + + for (y = 0; y < pixel_height; y++) + { + xsane_progress_update(xsane.progress, (float)y/pixel_height); + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + + for (x = 0; x < pixel_width * components; x++) /* this must be changed in dependance of endianess */ + { + fread(&val, 2, 1, imagefile); /* get data in machine order */ + data[x*2+0] = val/256; /* write data in network order (MSB first) */ + data[x*2+1] = val & 255; + } + + row_ptr = data; + png_write_rows(png_ptr, &row_ptr, 1); + if (cancel_save) + { + break; + } + } + + free(data); + png_write_end(png_ptr, png_info_ptr); + png_destroy_write_struct(&png_ptr, (png_infopp) 0); +} +#endif +#endif + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_save_pnm_16_gray(FILE *outfile, FILE *imagefile, int bits, int pixel_width, int pixel_height) +{ + int x,y; + guint16 val; + int count = 0; + + cancel_save = 0; + + /* write pgm ascii > 8 bpp */ + fprintf(outfile, "P2\n# SANE data follows\n%d %d\n65535\n", pixel_width, pixel_height); + + for (y=0; y= 10) + { + fprintf(outfile, "\n"); + count = 0; + } + } + fprintf(outfile, "\n"); + count = 0; + + xsane_progress_update(xsane.progress, (float)y/pixel_height); + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + if (cancel_save) + { + break; + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_save_pnm_16_color(FILE *outfile, FILE *imagefile, int bits, int pixel_width, int pixel_height) +{ + int x,y; + guint16 val; + int count = 0; + + cancel_save = 0; + + /* write ppm ascii > 8 bpp */ + fprintf(outfile, "P3\n# SANE data follows\n%d %d\n65535\n", pixel_width, pixel_height); + + for (y=0; y= 3) + { + fprintf(outfile, "\n"); + count = 0; + } + } + fprintf(outfile, "\n"); + count = 0; + + xsane_progress_update(xsane.progress, (float)y/pixel_height); + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + if (cancel_save) + { + break; + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_save_pnm_16(FILE *outfile, FILE *imagefile, int color, int bits, int pixel_width, int pixel_height) +{ + if (color) + { + xsane_save_pnm_16_color(outfile, imagefile, bits, pixel_width, pixel_height); + } + else + { + xsane_save_pnm_16_gray(outfile, imagefile, bits, pixel_width, pixel_height); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ diff --git a/frontend/xsane-save.h b/frontend/xsane-save.h new file mode 100644 index 0000000..7ac856c --- /dev/null +++ b/frontend/xsane-save.h @@ -0,0 +1,79 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-save.h + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_cancel_save(); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_convert_text_to_filename(char **filename); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + + +void xsane_increase_counter_in_filename(char *filename, int skip); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_save_ps(FILE *outfile, FILE *imagefile, + int color, int bits, + int pixel_width, int pixel_height, + int left, int bottom, + float width, float height, + int paperwidth, int paperheight, int landscape); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_save_jpeg(FILE *outfile, FILE *imagefile, + int color, int bits, + int pixel_width, int pixel_height, + int quality); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_save_tiff(const char *outfilename, FILE *imagefile, + int color, int bits, + int pixel_width, int pixel_height, + int compression, int quality); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_save_png(FILE *outfile, FILE *imagefile, + int color, int bits, + int pixel_width, int pixel_height, + int compression); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_save_png_16(FILE *outfile, FILE *imagefile, + int color, int bits, + int pixel_width, int pixel_height, + int compression); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_save_pnm_16(FILE *outfile, FILE *imagefile, + int color, int bits, + int pixel_width, int pixel_height); + +/* ---------------------------------------------------------------------------------------------------------------------- */ diff --git a/frontend/xsane-scan.c b/frontend/xsane-scan.c new file mode 100644 index 0000000..d66ab28 --- /dev/null +++ b/frontend/xsane-scan.c @@ -0,0 +1,2369 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-scan.c + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#include "xsane.h" +#include "xsane-back-gtk.h" +#include "xsane-front-gtk.h" +#include "xsane-preferences.h" +#include "xsane-preview.h" +#include "xsane-save.h" +#include "xsane-text.h" +#include "xsane-gamma.h" +#include "xsane-setup.h" + +#ifdef HAVE_LIBPNG +#ifdef HAVE_LIBZ +#include +#include +#endif +#endif + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#ifdef HAVE_LIBGIMP_GIMP_H + +#include + +static void xsane_gimp_query(void); +static void xsane_gimp_run(char *name, int nparams, GParam * param, int *nreturn_vals, GParam ** return_vals); + +GPlugInInfo PLUG_IN_INFO = +{ + NULL, /* init_proc */ + NULL, /* quit_proc */ + xsane_gimp_query, /* query_proc */ + xsane_gimp_run, /* run_proc */ +}; + +#endif /* HAVE_LIBGIMP_GIMP_H */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +/* forward declarations: */ + +static int xsane_generate_dummy_filename(); +#ifdef HAVE_LIBGIMP_GIMP_H +static int xsane_decode_devname(const char *encoded_devname, int n, char *buf); +static int xsane_encode_devname(const char *devname, int n, char *buf); +void null_print_func(gchar *msg); +static void xsane_gimp_advance(void); +#endif +static void xsane_read_image_data(gpointer data, gint source, GdkInputCondition cond); +static RETSIGTYPE xsane_sigpipe_handler(int signal); +static int xsane_test_multi_scan(void); +void xsane_scan_done(SANE_Status status); +void xsane_cancel(void); +static void xsane_start_scan(void); +void xsane_scan_dialog(GtkWidget * widget, gpointer call_data); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static int xsane_generate_dummy_filename() +{ + /* returns TRUE if file is a temporary file */ + + if (xsane.dummy_filename) + { + free(xsane.dummy_filename); + } + + if ( (xsane.xsane_mode == XSANE_COPY) || (xsane.xsane_mode == XSANE_FAX) || /* we have to do a conversion */ + ( (xsane.xsane_mode == XSANE_SCAN) && (xsane.xsane_output_format != XSANE_PNM) && + (xsane.xsane_output_format != XSANE_RAW16) && (xsane.xsane_output_format != XSANE_RGBA) ) ) + { + char filename[PATH_MAX]; + + xsane_back_gtk_make_path(sizeof(filename), filename, 0, 0, "conversion-", dialog->dev_name, ".ppm", XSANE_PATH_TMP); + xsane.dummy_filename = strdup(filename); + return TRUE; + } + else /* no conversion following, save directly to the selected filename */ + { + xsane.dummy_filename = strdup(xsane.output_filename); + return FALSE; + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#ifdef HAVE_LIBGIMP_GIMP_H +static int xsane_decode_devname(const char *encoded_devname, int n, char *buf) +{ + char *dst, *limit; + const char *src; + char ch, val; + + limit = buf + n; + for (src = encoded_devname, dst = buf; *src; ++dst) + { + if (dst >= limit) + { + return -1; + } + + ch = *src++; + /* don't use the ctype.h macros here since we don't want to allow anything non-ASCII here... */ + if (ch != '-') + { + *dst = ch; + } + else /* decode */ + { + ch = *src++; + if (ch == '-') + { + *dst = ch; + } + else + { + if (ch >= 'a' && ch <= 'f') + { + val = (ch - 'a') + 10; + } + else + { + val = (ch - '0'); + } + val <<= 4; + + ch = *src++; + if (ch >= 'a' && ch <= 'f') + { + val |= (ch - 'a') + 10; + } + else + { + val |= (ch - '0'); + } + + *dst = val; + + ++src; /* simply skip terminating '-' for now... */ + } + } + } + + if (dst >= limit) + { + return -1; + } + + *dst = '\0'; + return 0; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static int xsane_encode_devname(const char *devname, int n, char *buf) +{ + static const char hexdigit[] = "0123456789abcdef"; + char *dst, *limit; + const char *src; + char ch; + + limit = buf + n; + for (src = devname, dst = buf; *src; ++src) + { + if (dst >= limit) + { + return -1; + } + + ch = *src; + /* don't use the ctype.h macros here since we don't want to allow anything non-ASCII here... */ + if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) + { + *dst++ = ch; + } + else /* encode */ + { + if (dst + 4 >= limit) + { + return -1; + } + + *dst++ = '-'; + if (ch == '-') + { + *dst++ = '-'; + } + else + { + *dst++ = hexdigit[(ch >> 4) & 0x0f]; + *dst++ = hexdigit[(ch >> 0) & 0x0f]; + *dst++ = '-'; + } + } + } + + if (dst >= limit) + { + return -1; + } + + *dst = '\0'; + return 0; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_gimp_query(void) +{ + static GParamDef args[] = + { + {PARAM_INT32, "run_mode", "Interactive, non-interactive"}, + }; + static GParamDef *return_vals = NULL; + static int nargs = sizeof(args) / sizeof(args[0]); + static int nreturn_vals = 0; + char mpath[1024]; + char name[1024]; + size_t len; + int i, j; + + snprintf(name, sizeof(name), "%s", prog_name); +#ifdef GIMP_CHECK_VERSION +# if GIMP_CHECK_VERSION(1,1,9) + snprintf(mpath, sizeof(mpath), "%s", XSANE_GIMP_MENU_DIALOG); +# else + snprintf(mpath, sizeof(mpath), "%s", XSANE_GIMP_MENU_DIALOG_OLD); +# endif +#else + snprintf(mpath, sizeof(mpath), "%s", XSANE_GIMP_MENU_DIALOG_OLD); +#endif + gimp_install_procedure(name, + XSANE_GIMP_INSTALL_BLURB, + XSANE_GIMP_INSTALL_HELP, + XSANE_AUTHOR, + XSANE_COPYRIGHT, + XSANE_DATE, + mpath, + 0, /* "RGB, GRAY", */ + PROC_EXTENSION, + nargs, nreturn_vals, + args, return_vals); + + sane_init(&xsane.sane_backend_versioncode, (void *) xsane_authorization_callback); + if (SANE_VERSION_MAJOR(xsane.sane_backend_versioncode) != SANE_V_MAJOR) + { + fprintf(stderr, "\n\n" + "%s %s:\n" + " %s\n" + " %s %d\n" + " %s %d\n" + "%s\n\n", + prog_name, ERR_ERROR, + ERR_MAJOR_VERSION_NR_CONFLICT, + ERR_XSANE_MAJOR_VERSION, SANE_V_MAJOR, + ERR_BACKEND_MAJOR_VERSION, SANE_VERSION_MAJOR(xsane.sane_backend_versioncode), + ERR_PROGRAM_ABORTED); + return; + } + + sane_get_devices(&devlist, SANE_FALSE); + + for (i = 0; devlist[i]; ++i) + { + snprintf(name, sizeof(name), "%s-", prog_name); + if (xsane_encode_devname(devlist[i]->name, sizeof(name) - 6, name + 6) < 0) + { + continue; /* name too long... */ + } + +#ifdef GIMP_CHECK_VERSION +# if GIMP_CHECK_VERSION(1,1,9) + snprintf(mpath, sizeof(mpath), "%s", XSANE_GIMP_MENU); +# else + snprintf(mpath, sizeof(mpath), "%s", XSANE_GIMP_MENU_OLD); +# endif +#else + snprintf(mpath, sizeof(mpath), "%s", XSANE_GIMP_MENU_OLD); +#endif + len = strlen(mpath); + for (j = 0; devlist[i]->name[j]; ++j) + { + if (devlist[i]->name[j] == '/') + mpath[len++] = '\''; + else + mpath[len++] = devlist[i]->name[j]; + } + mpath[len++] = '\0'; + + gimp_install_procedure(name, + XSANE_GIMP_INSTALL_BLURB, + XSANE_GIMP_INSTALL_HELP, + XSANE_AUTHOR, + XSANE_COPYRIGHT, + XSANE_DATE, + mpath, + "RGB, GRAY", + PROC_EXTENSION, + nargs, nreturn_vals, + args, return_vals); + } + sane_exit(); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_gimp_run(char *name, int nparams, GParam * param, int *nreturn_vals, GParam ** return_vals) +{ + static GParam values[2]; + GRunModeType run_mode; + char devname[1024]; + char *args[2]; + int nargs; + + run_mode = param[0].data.d_int32; + xsane.mode = XSANE_GIMP_EXTENSION; + + *nreturn_vals = 1; + *return_vals = values; + + values[0].type = PARAM_STATUS; + values[0].data.d_status = STATUS_CALLING_ERROR; + + nargs = 0; + args[nargs++] = "xsane"; + + seldev = -1; + if (strncmp(name, "xsane-", 6) == 0) + { + if (xsane_decode_devname(name + 6, sizeof(devname), devname) < 0) + { + return; /* name too long */ + } + args[nargs++] = devname; + } + + switch (run_mode) + { + case RUN_INTERACTIVE: + xsane_interface(nargs, args); + values[0].data.d_status = STATUS_SUCCESS; + break; + + case RUN_NONINTERACTIVE: + /* Make sure all the arguments are there! */ + break; + + case RUN_WITH_LAST_VALS: + /* Possibly retrieve data */ + break; + + default: + break; + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void null_print_func(gchar *msg) +{ +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_gimp_advance(void) +{ + if (++xsane.x >= xsane.param.pixels_per_line) + { + int tile_height = gimp_tile_height(); + + xsane.x = 0; + ++xsane.y; + if (xsane.y % tile_height == 0) + { + gimp_pixel_rgn_set_rect(&xsane.region, xsane.tile, 0, xsane.y - tile_height, xsane.param.pixels_per_line, tile_height); + if (xsane.param.format >= SANE_FRAME_RED && xsane.param.format <= SANE_FRAME_BLUE) + { + int height; + + xsane.tile_offset %= 3; + + if (!xsane.first_frame) /* get the data for the existing tile: */ + { + height = tile_height; + + if (xsane.y + height >= xsane.param.lines) + { + height = xsane.param.lines - xsane.y; + } + + gimp_pixel_rgn_get_rect(&xsane.region, xsane.tile, 0, xsane.y, xsane.param.pixels_per_line, height); + } + } + else + { + xsane.tile_offset = 0; + } + } + } +} + +#endif /* HAVE_LIBGIMP_GIMP_H */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_read_image_data(gpointer data, gint source, GdkInputCondition cond) +{ + SANE_Handle dev = xsane_back_gtk_dialog_get_device (dialog); + SANE_Status status; + SANE_Int len; + int i; + char buf[255]; + + if ( (xsane.param.depth == 1) || (xsane.param.depth == 8) ) + { + static unsigned char buf8[32768]; + + while (1) + { + status = sane_read(dev, (SANE_Byte *) buf8, sizeof(buf8), &len); + if (status == SANE_STATUS_EOF) + { + if (!xsane.param.last_frame) + { + xsane_start_scan(); + break; /* leave while loop */ + } + + xsane_scan_done(SANE_STATUS_EOF); /* image complete, stop scanning */ + return; + } + + if (status != SANE_STATUS_GOOD) + { + xsane_scan_done(status); /* status = return of sane_read */ + snprintf(buf, sizeof(buf), "%s %s.", ERR_DURING_READ, XSANE_STRSTATUS(status)); + xsane_back_gtk_error(buf, TRUE); + return; + } + + if (!len) + { + break; /* out of data for now, leave while loop */ + } + + xsane.bytes_read += len; + xsane_progress_update(xsane.progress, xsane.bytes_read / (gfloat) xsane.num_bytes); + + if (xsane.input_tag < 0) + { + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + } + + switch (xsane.param.format) + { + case SANE_FRAME_GRAY: + if (xsane.mode == XSANE_STANDALONE) + { + int i; + char val; + + if ((!xsane.scanner_gamma_gray) && (xsane.param.depth > 1)) + { + for (i=0; i < len; ++i) + { + val = xsane.gamma_data[(int) buf8[i]]; + fwrite(&val, 1, 1, xsane.out); + } + } + else + { + fwrite(buf8, 1, len, xsane.out); + } + } +#ifdef HAVE_LIBGIMP_GIMP_H + else /* GIMP MODE GRAY 8 bit */ + { + switch (xsane.param.depth) + { + case 1: + for (i = 0; i < len; ++i) + { + u_char mask; + int j; + + mask = buf8[i]; + for (j = 7; j >= 0; --j) + { + u_char gl = (mask & (1 << j)) ? 0x00 : 0xff; + xsane.tile[xsane.tile_offset++] = gl; + xsane_gimp_advance(); + if (xsane.x == 0) + { + break; + } + } + } + break; + + case 8: + if (!xsane.scanner_gamma_gray) + { + for (i = 0; i < len; ++i) + { + xsane.tile[xsane.tile_offset++] = xsane.gamma_data[(int) buf8[i]]; + xsane_gimp_advance(); + } + } + else + { + for (i = 0; i < len; ++i) + { + xsane.tile[xsane.tile_offset++] = buf8[i]; + xsane_gimp_advance(); + } + } + break; + } + } +#endif /* HAVE_LIBGIMP_GIMP_H */ + break; + + case SANE_FRAME_RGB: + if (xsane.mode == XSANE_STANDALONE) + { + int i; + char val; + + if (!xsane.scanner_gamma_color) /* gamma correction by xsane */ + { + for (i=0; i < len; ++i) + { + if (dialog->pixelcolor == 0) + { + val = xsane.gamma_data_red[(int) buf8[i]]; + dialog->pixelcolor++; + } + else if (dialog->pixelcolor == 1) + { + val = xsane.gamma_data_green[(int) buf8[i]]; + dialog->pixelcolor++; + } + else + { + val = xsane.gamma_data_blue[(int) buf8[i]]; + dialog->pixelcolor = 0; + } + fwrite(&val, 1, 1, xsane.out); + } + } + else /* gamma correction has been done by scanner */ + { + fwrite(buf8, 1, len, xsane.out); + } + } +#ifdef HAVE_LIBGIMP_GIMP_H + else /* GIMP MODE RGB 8 bit */ + { + switch (xsane.param.depth) + { + case 1: + if (xsane.param.format == SANE_FRAME_RGB) + { + goto bad_depth; + } + for (i = 0; i < len; ++i) + { + u_char mask; + int j; + + mask = buf8[i]; + for (j = 0; j < 8; ++j) + { + u_char gl = (mask & 1) ? 0xff : 0x00; + mask >>= 1; + xsane.tile[xsane.tile_offset++] = gl; + xsane_gimp_advance(); + if (xsane.x == 0) + break; + } + } + break; + + case 8: + if (!xsane.scanner_gamma_color) /* gamma correction by xsane */ + { + for (i = 0; i < len; ++i) + { + if (xsane.tile_offset % 3 == 0) + { + xsane.tile[xsane.tile_offset++] = xsane.gamma_data_red[(int) buf8[i]]; + } + else if (xsane.tile_offset % 3 == 1) + { + xsane.tile[xsane.tile_offset++] = xsane.gamma_data_green[(int) buf8[i]]; + } + else + { + xsane.tile[xsane.tile_offset++] = xsane.gamma_data_blue[(int) buf8[i]]; + } + + if (xsane.tile_offset % 3 == 0) + { + xsane_gimp_advance(); + } + } + } + else /* gamma correction by scanner */ + { + for (i = 0; i < len; ++i) + { + xsane.tile[xsane.tile_offset++] = buf8[i]; + if (xsane.tile_offset % 3 == 0) + { + xsane_gimp_advance(); + } + } + } + break; + + default: + goto bad_depth; + break; + } + } +#endif /* HAVE_LIBGIMP_GIMP_H */ + break; + + case SANE_FRAME_RED: + case SANE_FRAME_GREEN: + case SANE_FRAME_BLUE: + if (xsane.mode == XSANE_STANDALONE) + { + if (!xsane.scanner_gamma_color) /* gamma correction by xsane */ + { + char val; + SANE_Int *gamma; + + if (xsane.param.format == SANE_FRAME_RED) + { + gamma = xsane.gamma_data_red; + } + else if (xsane.param.format == SANE_FRAME_GREEN) + { + gamma = xsane.gamma_data_green; + } + else + { + gamma = xsane.gamma_data_blue; + } + + for (i = 0; i < len; ++i) + { + val = gamma[(int) buf8[i]]; + fwrite(&val, 1, 1, xsane.out); + fseek(xsane.out, 2, SEEK_CUR); + } + } + else /* gamma correction by scanner */ + { + for (i = 0; i < len; ++i) + { + fwrite(&buf8[i], 1, 1, xsane.out); + fseek(xsane.out, 2, SEEK_CUR); + } + } + } +#ifdef HAVE_LIBGIMP_GIMP_H + else /* GIMP MODE RED, GREEN, BLUE (3PASS) 8 bit */ + { + switch (xsane.param.depth) + { + case 1: + for (i = 0; i < len; ++i) + { + u_char mask; + int j; + + mask = buf8[i]; + for (j = 0; j < 8; ++j) + { + u_char gl = (mask & 1) ? 0xff : 0x00; + mask >>= 1; + xsane.tile[xsane.tile_offset] = gl; + xsane.tile_offset += 3; + xsane_gimp_advance(); + if (xsane.x == 0) + { + break; + } + } + } + break; + + case 8: + if (!xsane.scanner_gamma_color) /* gamma correction by xsane */ + { + SANE_Int *gamma; + + if (xsane.param.format == SANE_FRAME_RED) + { + gamma = xsane.gamma_data_red; + } + else if (xsane.param.format == SANE_FRAME_GREEN) + { + gamma = xsane.gamma_data_green; + } + else + { + gamma = xsane.gamma_data_blue; + } + + for (i = 0; i < len; ++i) + { + xsane.tile[xsane.tile_offset] = gamma[(int) buf8[i]]; + xsane.tile_offset += 3; + xsane_gimp_advance(); + } + } + else /* gamma correction by scanner */ + { + for (i = 0; i < len; ++i) + { + xsane.tile[xsane.tile_offset] = buf8[i]; + xsane.tile_offset += 3; + xsane_gimp_advance(); + } + } + break; + + default: + goto bad_depth; + break; + } + } +#endif /* HAVE_LIBGIMP_GIMP_H */ + break; + +#ifdef SUPPORT_RGBA + case SANE_FRAME_RGBA: /* Scanning including Infrared channel */ + if (xsane.mode == XSANE_STANDALONE) + { + int i; + char val; + + if (!xsane.scanner_gamma_color) /* gamma correction by xsane */ + { + for (i=0; i < len; ++i) + { + if (dialog->pixelcolor == 0) + { + val = xsane.gamma_data_red[(int) buf8[i]]; + dialog->pixelcolor++; + } + else if (dialog->pixelcolor == 1) + { + val = xsane.gamma_data_green[(int) buf8[i]]; + dialog->pixelcolor++; + } + else if (dialog->pixelcolor == 2) + { + val = xsane.gamma_data_blue[(int) buf8[i]]; + dialog->pixelcolor++; + } + else + { + val = buf8[i]; /* no gamma table for infrared channel */ + dialog->pixelcolor = 0; + } + fwrite(&val, 1, 1, xsane.out); + } + } + else /* gamma correction has been done by scanner */ + { + fwrite(buf8, 1, len, xsane.out); + } + } +#ifdef HAVE_LIBGIMP_GIMP_H + else /* GIMP MODE RGBA 8 bit */ + { + int i; + + + switch (xsane.param.depth) + { + case 8: + if (!xsane.scanner_gamma_color) /* gamma correction by xsane */ + { + for (i=0; i < len; ++i) + { + if (xsane.tile_offset % 4 == 0) + { + xsane.tile[xsane.tile_offset++] = xsane.gamma_data_red[(int) buf8[i]]; + } + else if (xsane.tile_offset % 4 == 1) + { + xsane.tile[xsane.tile_offset++] = xsane.gamma_data_green[(int) buf8[i]]; + } + else if (xsane.tile_offset % 4 == 2) + { + xsane.tile[xsane.tile_offset++] = xsane.gamma_data_blue[(int) buf8[i]]; + } + else + { + xsane.tile[xsane.tile_offset++] = buf8[i]; /* no gamma table for infrared channel */ + } + + if (xsane.tile_offset % 4 == 0) + { + xsane_gimp_advance(); + } + } + } + else /* gamma correction has been done by scanner */ + { + for (i = 0; i < len; ++i) + { + xsane.tile[xsane.tile_offset++] = buf8[i]; + if (xsane.tile_offset % 4 == 0) + { + xsane_gimp_advance(); + } + } + } + break; + + default: + goto bad_depth; + break; + } + } +#endif /* HAVE_LIBGIMP_GIMP_H */ + break; +#endif + + default: + xsane_scan_done(-1); /* -1 = error */ + fprintf(stderr, "xsane_read_image_data: %s %d\n", ERR_BAD_FRAME_FORMAT, xsane.param.format); + return; + break; + } + } + } + else if ( xsane.param.depth == 16 ) + { + static guint16 buf16[32768]; + char buf[255]; + char last = 0; + int offset = 0; + + while (1) + { + if (offset) /* if we have had an odd number of bytes */ + { + buf16[0] = last; + status = sane_read(dev, (SANE_Byte *) (buf16 + 1), sizeof(buf16) - 1, &len); + if (len) + { + len++; + } + } + else /* last read we had an even number of bytes */ + { + status = sane_read(dev, (SANE_Byte *) buf16, sizeof(buf16), &len); + } + + if (len % 2) /* odd number of bytes */ + { + len--; + last = buf16[len]; + offset = 1; + } + else /* even number of bytes */ + { + offset = 0; + } + + if (status == SANE_STATUS_EOF) + { + if (!xsane.param.last_frame) + { + xsane_start_scan(); + break; /* leave while loop */ + } + + xsane_scan_done(SANE_STATUS_EOF); /* image complete, stop scanning */ + return; + } + + if (status != SANE_STATUS_GOOD) + { + xsane_scan_done(status); /* status = return of sane_read */ + snprintf(buf, sizeof(buf), "%s %s.", ERR_DURING_READ, XSANE_STRSTATUS(status)); + xsane_back_gtk_error(buf, TRUE); + return; + } + + if (!len) /* nothing read */ + { + break; /* out of data for now, leave while loop */ + } + + xsane.bytes_read += len; + xsane_progress_update(xsane.progress, xsane.bytes_read / (gfloat) xsane.num_bytes); + + if (xsane.input_tag < 0) + { + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + } + + switch (xsane.param.format) + { + case SANE_FRAME_GRAY: + if (xsane.mode == XSANE_STANDALONE) + { + int i; + guint16 val; + + if (!xsane.scanner_gamma_gray) /* gamma correction by xsane */ + { + for (i=0; i < len/2; ++i) + { + val = xsane.gamma_data[buf16[i]]; + fwrite(&val, 2, 1, xsane.out); + } + } + else /* gamma correction by scanner */ + { + fwrite(buf16, 2, len/2, xsane.out); + } + } + break; + + case SANE_FRAME_RGB: + if (xsane.mode == XSANE_STANDALONE) + { + int i; + guint16 val; + + if (!xsane.scanner_gamma_color) /* gamma correction by xsane */ + { + for (i=0; i < len/2; ++i) + { + if (dialog->pixelcolor == 0) + { + val = xsane.gamma_data_red[buf16[i]]; + dialog->pixelcolor++; + } + else if (dialog->pixelcolor == 1) + { + val = xsane.gamma_data_green[buf16[i]]; + dialog->pixelcolor++; + } + else + { + val = xsane.gamma_data_blue[buf16[i]]; + dialog->pixelcolor = 0; + } + fwrite(&val, 2, 1, xsane.out); + } + } + else /* gamma correction by scanner */ + { + fwrite(buf16, 2, len/2, xsane.out); + } + } + break; + + case SANE_FRAME_RED: + case SANE_FRAME_GREEN: + case SANE_FRAME_BLUE: + if (xsane.mode == XSANE_STANDALONE) + { + for (i = 0; i < len/2; ++i) + { + fwrite(buf16 + i*2, 2, 1, xsane.out); + fseek(xsane.out, 4, SEEK_CUR); + } + } + break; + +#ifdef SUPPORT_RGBA + case SANE_FRAME_RGBA: + if (xsane.mode == XSANE_STANDALONE) + { + int i; + guint16 val; + + if (!xsane.scanner_gamma_color) + { + for (i=0; i < len/2; ++i) + { + if (dialog->pixelcolor == 0) + { + val = xsane.gamma_data_red[buf16[i]]; + dialog->pixelcolor++; + } + else if (dialog->pixelcolor == 1) + { + val = xsane.gamma_data_green[buf16[i]]; + dialog->pixelcolor++; + } + else if (dialog->pixelcolor == 2) + { + val = xsane.gamma_data_blue[buf16[i]]; + dialog->pixelcolor++; + } + else + { + val = buf16[i]; /* no gamma table for infrared channel */ + dialog->pixelcolor = 0; + } + fwrite(&val, 2, 1, xsane.out); + } + } + else + { + fwrite(buf16, 2, len/2, xsane.out); + } + } + break; +#endif + + default: + xsane_scan_done(-1); /* -1 = error */ + fprintf(stderr, "xsane_read_image_data: %s %d\n", ERR_BAD_FRAME_FORMAT, xsane.param.format); + return; + break; + } + } + } + else + { + xsane_scan_done(-1); /* -1 = error */ + snprintf(buf, sizeof(buf), "%s %d.", ERR_BAD_DEPTH, xsane.param.depth); + xsane_back_gtk_error(buf, TRUE); + return; + } + + return; + + /* ---------------------- */ + +#ifdef HAVE_LIBGIMP_GIMP_H +bad_depth: + + xsane_scan_done(-1); /* -1 = error */ + snprintf(buf, sizeof(buf), "%s %d.", ERR_BAD_DEPTH, xsane.param.depth); + xsane_back_gtk_error(buf, TRUE); + return; +#endif +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static RETSIGTYPE xsane_sigpipe_handler(int signal) +/* this is to catch a broken pipe while writing to printercommand */ +{ + xsane_cancel_save(0); + xsane.broken_pipe = 1; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static int xsane_test_multi_scan(void) +{ + char *set; + SANE_Status status; + const SANE_Option_Descriptor *opt; + + opt = sane_get_option_descriptor(dialog->dev, dialog->well_known.scansource); + if (opt) + { + if (SANE_OPTION_IS_ACTIVE(opt->cap)) + { + if (opt->constraint_type == SANE_CONSTRAINT_STRING_LIST) + { + set = malloc(opt->size); + status = sane_control_option(dialog->dev, dialog->well_known.scansource, SANE_ACTION_GET_VALUE, set, 0); + + if (status == SANE_STATUS_GOOD) + { + if (!strcmp(set, SANE_NAME_DOCUMENT_FEEDER)) + { + return TRUE; + } + } + free(set); + } + } + } + +#if 0 /* this is planned for the next sane-standard */ + if (xsane.param.bitfield & XSANE_PARAM_STATUS_MORE_IMAGES) + { + return TRUE; + } +#endif + + return FALSE; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_scan_done(SANE_Status status) +{ + if (xsane.input_tag >= 0) + { + gdk_input_remove(xsane.input_tag); + xsane.input_tag = -1; + } + + if (xsane.progress) /* remove progressbar */ + { + xsane_progress_free(xsane.progress); + xsane.progress = 0; + } + + while(gtk_events_pending()) /* let gtk remove the progress bar and update everything that needs it */ + { + gtk_main_iteration(); + } + + + /* we have to free the gamma tables if we used software gamma correction */ + + if (xsane.gamma_data) + { + free(xsane.gamma_data); + xsane.gamma_data = 0; + } + + if (xsane.gamma_data_red) + { + free(xsane.gamma_data_red); + free(xsane.gamma_data_green); + free(xsane.gamma_data_blue); + + xsane.gamma_data_red = 0; + xsane.gamma_data_green = 0; + xsane.gamma_data_blue = 0; + } + + if (xsane.out) /* close file - this is dummy_file but if there is no conversion it is the wanted file */ + { + fclose(xsane.out); + xsane.out = 0; + } + + if ( (status == SANE_STATUS_GOOD) || (status == SANE_STATUS_EOF) ) /* no error, do conversion etc. */ + { + if (xsane.mode == XSANE_STANDALONE) + { + if ( (xsane.xsane_mode == XSANE_SCAN) && (xsane.xsane_output_format != XSANE_PNM) && + (xsane.xsane_output_format != XSANE_RAW16) && (xsane.xsane_output_format != XSANE_RGBA) ) + { + FILE *outfile; + FILE *infile; + char buf[256]; + + /* open progressbar */ + snprintf(buf, sizeof(buf), PROGRESS_SAVING); + xsane.progress = xsane_progress_new(PROGRESS_CONVERTING_DATA, buf, (GtkSignalFunc) xsane_cancel_save, 0); + xsane_progress_update(xsane.progress, 0); + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + + infile = fopen(xsane.dummy_filename, "r"); + if (infile != 0) + { + fseek(infile, xsane.header_size, SEEK_SET); + +#ifdef HAVE_LIBTIFF + if (xsane.xsane_output_format == XSANE_TIFF) /* routines that want to have filename for saving */ + { + if (xsane.param.depth != 1) + { + remove(xsane.output_filename); + umask(preferences.image_umask); /* define image file permissions */ + xsane_save_tiff(xsane.output_filename, infile, xsane.xsane_color, xsane.param.depth, xsane.param.pixels_per_line, + xsane.param.lines, preferences.tiff_compression_nr, preferences.jpeg_quality); + umask(XSANE_DEFAULT_UMASK); /* define new file permissions */ + } + else + { + remove(xsane.output_filename); + umask(preferences.image_umask); /* define image file permissions */ + xsane_save_tiff(xsane.output_filename, infile, xsane.xsane_color, xsane.param.depth, xsane.param.pixels_per_line, + xsane.param.lines, preferences.tiff_compression_1_nr, preferences.jpeg_quality); + umask(XSANE_DEFAULT_UMASK); /* define new file permissions */ + } + } + else /* routines that want to have filedescriptor for saving */ +#endif + { + remove(xsane.output_filename); + umask(preferences.image_umask); /* define image file permissions */ + outfile = fopen(xsane.output_filename, "w"); + umask(XSANE_DEFAULT_UMASK); /* define new file permissions */ + + if (outfile != 0) + { + switch(xsane.xsane_output_format) + { +#ifdef HAVE_LIBJPEG + case XSANE_JPEG: + xsane_save_jpeg(outfile, infile, xsane.xsane_color, xsane.param.depth, xsane.param.pixels_per_line, + xsane.param.lines, preferences.jpeg_quality); + break; +#endif + +#ifdef HAVE_LIBPNG +#ifdef HAVE_LIBZ + case XSANE_PNG: + if (xsane.param.depth <= 8) + { + xsane_save_png(outfile, infile, xsane.xsane_color, xsane.param.depth, xsane.param.pixels_per_line, + xsane.param.lines, preferences.png_compression); + } + else + { + xsane_save_png_16(outfile, infile, xsane.xsane_color, xsane.param.depth, xsane.param.pixels_per_line, + xsane.param.lines, preferences.png_compression); + } + break; +#endif +#endif + + case XSANE_PNM16: + xsane_save_pnm_16(outfile, infile, xsane.xsane_color, xsane.param.depth, xsane.param.pixels_per_line, + xsane.param.lines); + break; + + case XSANE_PS: /* save postscript, use original size */ + { + float imagewidth = xsane.param.pixels_per_line/xsane.resolution_x; /* width in inch */ + float imageheight = xsane.param.lines/xsane.resolution_y; /* height in inch */ + + if (preferences.psrotate) /* rotate: landscape */ + { + xsane_save_ps(outfile, infile, + xsane.xsane_color /* gray, color */, + xsane.param.depth /* bits */, + xsane.param.pixels_per_line, xsane.param.lines, /* pixel_width, pixel_height */ + (preferences.printer[preferences.printernr]->bottomoffset + + preferences.printer[preferences.printernr]->height) * 36.0/MM_PER_INCH - imagewidth * 36.0, /* left edge */ + (preferences.printer[preferences.printernr]->leftoffset + + preferences.printer[preferences.printernr]->width) * 36.0/MM_PER_INCH - imageheight * 36.0, /* bottom edge */ + imagewidth, imageheight, + (preferences.printer[preferences.printernr]->leftoffset + + preferences.printer[preferences.printernr]->width ) * 72.0/MM_PER_INCH, /* paperwidth */ + (preferences.printer[preferences.printernr]->bottomoffset + + preferences.printer[preferences.printernr]->height) * 72.0/MM_PER_INCH, /* paperheight */ + 1 /* landscape */); + } + else /* do not rotate: portrait */ + { + xsane_save_ps(outfile, infile, + xsane.xsane_color /* gray, color */, + xsane.param.depth /* bits */, + xsane.param.pixels_per_line, xsane.param.lines, /* pixel_width, pixel_height */ + (preferences.printer[preferences.printernr]->leftoffset + + preferences.printer[preferences.printernr]->width) * 36.0/MM_PER_INCH - imagewidth * 36.0, + (preferences.printer[preferences.printernr]->bottomoffset + + preferences.printer[preferences.printernr]->height) * 36.0/MM_PER_INCH - imageheight * 36.0, + imagewidth, imageheight, + (preferences.printer[preferences.printernr]->leftoffset + + preferences.printer[preferences.printernr]->width ) * 72.0/MM_PER_INCH, /* paperwidth */ + (preferences.printer[preferences.printernr]->bottomoffset + + preferences.printer[preferences.printernr]->height) * 72.0/MM_PER_INCH, /* paperheight */ + 0 /* portrait */); + } + } + break; + + + default: + snprintf(buf, sizeof(buf),"%s", ERR_UNKNOWN_SAVING_FORMAT); + xsane_back_gtk_error(buf, TRUE); + break; + } + fclose(outfile); + } + else + { + char buf[256]; + + snprintf(buf, sizeof(buf), "%s `%s': %s", ERR_OPEN_FAILED, xsane.output_filename, strerror(errno)); + xsane_back_gtk_error(buf, TRUE); + } + } + fclose(infile); + remove(xsane.dummy_filename); + } + else + { + char buf[256]; + snprintf(buf, sizeof(buf), "%s `%s': %s", ERR_OPEN_FAILED, xsane.output_filename, strerror(errno)); + xsane_back_gtk_error(buf, TRUE); + } + xsane_progress_free(xsane.progress); + xsane.progress = 0; + + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + } + else if (xsane.xsane_mode == XSANE_COPY) + { + FILE *outfile; + FILE *infile; + char buf[256]; + + xsane_update_int(xsane.copy_number_entry, &xsane.copy_number); /* get number of copies */ + if (xsane.copy_number < 1) + { + xsane.copy_number = 1; + } + + /* open progressbar */ + snprintf(buf, sizeof(buf), PROGRESS_CONVERTING_PS); + xsane.progress = xsane_progress_new(PROGRESS_CONVERTING_DATA, buf, (GtkSignalFunc) xsane_cancel_save, 0); + xsane_progress_update(xsane.progress, 0); + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + + xsane.broken_pipe = 0; + infile = fopen(xsane.dummy_filename, "r"); + + snprintf(buf, sizeof(buf), "%s %s%d", preferences.printer[preferences.printernr]->command, + preferences.printer[preferences.printernr]->copy_number_option, + xsane.copy_number); + outfile = popen(buf, "w"); +/* outfile = popen(preferences.printer[preferences.printernr]->command, "w"); */ + if ((outfile != 0) && (infile != 0)) /* copy mode, use zoom size */ + { + struct SIGACTION act; + float imagewidth = xsane.param.pixels_per_line/(float)preferences.printer[preferences.printernr]->resolution; /* width in inch */ + float imageheight = xsane.param.lines/(float)preferences.printer[preferences.printernr]->resolution; /* height in inch */ + + memset (&act, 0, sizeof (act)); /* define broken pipe handler */ + act.sa_handler = xsane_sigpipe_handler; + sigaction (SIGPIPE, &act, 0); + + + fseek(infile, xsane.header_size, SEEK_SET); + + if (preferences.psrotate) /* rotate: landscape */ + { + xsane_save_ps(outfile, infile, + xsane.xsane_color /* gray, color */, + xsane.param.depth /* bits */, + xsane.param.pixels_per_line, xsane.param.lines, /* pixel_width, pixel_height */ + (preferences.printer[preferences.printernr]->bottomoffset + + preferences.printer[preferences.printernr]->height) * 36.0/MM_PER_INCH - imagewidth * 36.0, /* left edge */ + (preferences.printer[preferences.printernr]->leftoffset + + preferences.printer[preferences.printernr]->width) * 36.0/MM_PER_INCH - imageheight * 36.0, /* bottom edge */ + imagewidth, imageheight, + (preferences.printer[preferences.printernr]->leftoffset + + preferences.printer[preferences.printernr]->width ) * 72.0/MM_PER_INCH, /* paperwidth */ + (preferences.printer[preferences.printernr]->bottomoffset + + preferences.printer[preferences.printernr]->height) * 72.0/MM_PER_INCH, /* paperheight */ + 1 /* landscape */); + } + else /* do not rotate: portrait */ + { + xsane_save_ps(outfile, infile, + xsane.xsane_color /* gray, color */, + xsane.param.depth /* bits */, + xsane.param.pixels_per_line, xsane.param.lines, /* pixel_width, pixel_height */ + (preferences.printer[preferences.printernr]->leftoffset + + preferences.printer[preferences.printernr]->width) * 36.0/MM_PER_INCH - imagewidth * 36.0, /* left edge */ + (preferences.printer[preferences.printernr]->bottomoffset + + preferences.printer[preferences.printernr]->height) * 36.0/MM_PER_INCH - imageheight * 36.0, /* bottom edge */ + imagewidth, imageheight, + (preferences.printer[preferences.printernr]->leftoffset + + preferences.printer[preferences.printernr]->width ) * 72.0/MM_PER_INCH, /* paperwidth */ + (preferences.printer[preferences.printernr]->bottomoffset + + preferences.printer[preferences.printernr]->height) * 72.0/MM_PER_INCH, /* paperheight */ + 0 /* portrait */); + } + } + else + { + char buf[256]; + + if (!infile) + { + snprintf(buf, sizeof(buf), "%s `%s': %s", ERR_OPEN_FAILED, xsane.output_filename, strerror(errno)); + xsane_back_gtk_error(buf, TRUE); + } + else if (!outfile) + { + xsane_back_gtk_error(ERR_FAILED_PRINTER_PIPE, TRUE); + } + } + + if (xsane.broken_pipe) + { + snprintf(buf, sizeof(buf), "%s \"%s\"", ERR_FAILED_EXEC_PRINTER_CMD, preferences.printer[preferences.printernr]->command); + xsane_back_gtk_error(buf, TRUE); + } + + xsane_progress_free(xsane.progress); + xsane.progress = 0; + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + + if (infile) + { + fclose(infile); + remove(xsane.dummy_filename); + } + + if (outfile) + { + pclose(outfile); + } + } + else if (xsane.xsane_mode == XSANE_FAX) + { + FILE *outfile; + FILE *infile; + char buf[256]; + + /* open progressbar */ + snprintf(buf, sizeof(buf), PROGRESS_SAVING_FAX); + xsane.progress = xsane_progress_new(PROGRESS_CONVERTING_DATA, buf, (GtkSignalFunc) xsane_cancel_save, 0); + xsane_progress_update(xsane.progress, 0); + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + + infile = fopen(xsane.dummy_filename, "r"); + if (infile != 0) + { + fseek(infile, xsane.header_size, SEEK_SET); + + umask(preferences.image_umask); /* define image file permissions */ + outfile = fopen(xsane.fax_filename, "w"); + umask(XSANE_DEFAULT_UMASK); /* define new file permissions */ + if (outfile != 0) + { + float imagewidth, imageheight; + + imagewidth = xsane.param.pixels_per_line/xsane.resolution_x; /* width in inch */ + imageheight = xsane.param.lines/xsane.resolution_y; /* height in inch */ + +/* disabled ( 0 * ...) in the moment */ + if (0 * preferences.psrotate) /* rotate: landscape */ + { + xsane_save_ps(outfile, infile, + xsane.xsane_color /* gray, color */, + xsane.param.depth /* bits */, + xsane.param.pixels_per_line, xsane.param.lines, /* pixel_width, pixel_height */ + (preferences.fax_bottomoffset + preferences.fax_height) * 36.0/MM_PER_INCH - imagewidth * 36.0, /* left edge */ + (preferences.fax_leftoffset + preferences.fax_width) * 36.0/MM_PER_INCH - imageheight * 36.0, /* bottom edge */ + imagewidth, imageheight, + (preferences.fax_leftoffset + preferences.fax_width ) * 72.0/MM_PER_INCH, /* paperwidth */ + (preferences.fax_bottomoffset + preferences.fax_height) * 72.0/MM_PER_INCH, /* paperheight */ + 1 /* landscape */); + } + else /* do not rotate: portrait */ + { + xsane_save_ps(outfile, infile, + xsane.xsane_color /* gray, color */, + xsane.param.depth /* bits */, + xsane.param.pixels_per_line, xsane.param.lines, /* pixel_width, pixel_height */ + (preferences.fax_leftoffset + preferences.fax_width) * 36.0/MM_PER_INCH - imagewidth * 36.0, + (preferences.fax_bottomoffset + preferences.fax_height) * 36.0/MM_PER_INCH - imageheight * 36.0, + imagewidth, imageheight, + (preferences.fax_leftoffset + preferences.fax_width ) * 72.0/MM_PER_INCH, /* paperwidth */ + (preferences.fax_bottomoffset + preferences.fax_height) * 72.0/MM_PER_INCH, /* paperheight */ + 0 /* portrait */); + } + fclose(outfile); + } + else + { + char buf[256]; + + snprintf(buf, sizeof(buf), "%s `%s': %s", ERR_OPEN_FAILED, xsane.fax_filename, strerror(errno)); + xsane_back_gtk_error(buf, TRUE); + } + + fclose(infile); + remove(xsane.dummy_filename); + } + else + { + char buf[256]; + snprintf(buf, sizeof(buf), "%s `%s': %s", ERR_OPEN_FAILED, xsane.fax_filename, strerror(errno)); + xsane_back_gtk_error(buf, TRUE); + } + xsane_progress_free(xsane.progress); + xsane.progress = 0; + + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + } + } +#ifdef HAVE_LIBGIMP_GIMP_H + else + { + int remaining; + + /* GIMP mode */ + if (xsane.y > xsane.param.lines) + { + xsane.y = xsane.param.lines; + } + + remaining = xsane.y % gimp_tile_height(); + if (remaining) + { + gimp_pixel_rgn_set_rect(&xsane.region, xsane.tile, 0, xsane.y - remaining, xsane.param.pixels_per_line, remaining); + } + gimp_drawable_flush(xsane.drawable); + gimp_display_new(xsane.image_ID); + gimp_drawable_detach(xsane.drawable); + free(xsane.tile); + xsane.tile = 0; + } +#endif /* HAVE_LIBGIMP_GIMP_H */ + + xsane.header_size = 0; + + if ( (preferences.increase_filename_counter) && (xsane.xsane_mode == XSANE_SCAN) && (xsane.mode == XSANE_STANDALONE) ) + { + xsane_increase_counter_in_filename(preferences.filename, preferences.skip_existing_numbers); + gtk_entry_set_text(GTK_ENTRY(xsane.outputfilename_entry), (char *) preferences.filename); + } + else if (xsane.xsane_mode == XSANE_FAX) + { + GtkWidget *list_item; + char *page; + char *extension; + + page = strdup(strrchr(xsane.fax_filename,'/')+1); + extension = strrchr(page, '.'); + if (extension) + { + *extension = 0; + } + list_item = gtk_list_item_new_with_label(page); + gtk_object_set_data(GTK_OBJECT(list_item), "list_item_data", strdup(page)); + gtk_container_add(GTK_CONTAINER(xsane.fax_list), list_item); + gtk_widget_show(list_item); + + xsane_increase_counter_in_filename(xsane.fax_filename, preferences.skip_existing_numbers); + xsane_fax_project_save(); + free(page); + } + } + else /* an error occured, remove the dummy_file */ + { + if (xsane.dummy_filename) /* remove corrupt file */ + { + remove(xsane.dummy_filename); + } + } + + free(xsane.dummy_filename); /* no dummy_filename, needed if an error occurs */ + xsane.dummy_filename = 0; + + if (xsane.output_filename) + { + free(xsane.output_filename); + xsane.output_filename = 0; + } + + if ( ( (status == SANE_STATUS_GOOD) || (status == SANE_STATUS_EOF) ) && (xsane_test_multi_scan()) ) + { + /* multi scan (eg ADF): scan again */ + /* stopped when: */ + /* a) xsane_test_multi_scan returns false */ + /* b) sane_start returns SANE_STATUS_NO_DOCS */ + /* c) an error occurs */ + + gtk_signal_emit_by_name(xsane.start_button, "clicked"); /* press START button */ + } + else /* last scan: update histogram */ + { + xsane_set_sensitivity(TRUE); /* reactivate buttons etc */ + sane_cancel(xsane_back_gtk_dialog_get_device(dialog)); /* stop scanning */ + xsane_update_histogram(); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_cancel(void) +{ + sane_cancel(xsane_back_gtk_dialog_get_device(dialog)); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_start_scan(void) +{ + SANE_Status status; + SANE_Handle dev = xsane_back_gtk_dialog_get_device(dialog); + const char *frame_type = 0; + char buf[256]; + int fd; + + xsane_clear_histogram(&xsane.histogram_raw); + xsane_clear_histogram(&xsane.histogram_enh); + xsane_set_sensitivity(FALSE); + +#ifdef HAVE_LIBGIMP_GIMP_H + if (xsane.mode == XSANE_GIMP_EXTENSION && xsane.tile) + { + int height, remaining; + + /* write the last tile of the frame to the GIMP region: */ + + if (xsane.y > xsane.param.lines) /* sanity check */ + { + xsane.y = xsane.param.lines; + } + + remaining = xsane.y % gimp_tile_height(); + if (remaining) + { + gimp_pixel_rgn_set_rect(&xsane.region, xsane.tile, 0, xsane.y - remaining, xsane.param.pixels_per_line, remaining); + } + + /* initialize the tile with the first tile of the GIMP region: */ + + height = gimp_tile_height(); + if (height >= xsane.param.lines) + { + height = xsane.param.lines; + } + gimp_pixel_rgn_get_rect(&xsane.region, xsane.tile, 0, 0, xsane.param.pixels_per_line, height); + } +#endif /* HAVE_LIBGIMP_GIMP_H */ + + xsane.x = xsane.y = 0; + + status = sane_start(dev); + + if (status == SANE_STATUS_NO_DOCS) /* ADF out of docs */ + { + xsane_scan_done(status); /* ok, stop multi image scan */ + return; + } + else if (status != SANE_STATUS_GOOD) /* error */ + { + xsane_scan_done(status); + snprintf(buf, sizeof(buf), "%s %s", ERR_FAILED_START_SCANNER, XSANE_STRSTATUS(status)); + xsane_back_gtk_error(buf, TRUE); + return; + } + + status = sane_get_parameters(dev, &xsane.param); + if (status != SANE_STATUS_GOOD) + { + xsane_scan_done(status); + snprintf(buf, sizeof(buf), "%s %s", ERR_FAILED_GET_PARAMS, XSANE_STRSTATUS(status)); + xsane_back_gtk_error(buf, TRUE); + return; + } + + xsane.num_bytes = xsane.param.lines * xsane.param.bytes_per_line; + xsane.bytes_read = 0; + + switch (xsane.param.format) + { + case SANE_FRAME_RGB: frame_type = "RGB"; break; + case SANE_FRAME_RED: frame_type = "red"; break; + case SANE_FRAME_GREEN: frame_type = "green"; break; + case SANE_FRAME_BLUE: frame_type = "blue"; break; + case SANE_FRAME_GRAY: frame_type = "gray"; break; +#ifdef SUPPORT_RGBA + case SANE_FRAME_RGBA: frame_type = "RGBA"; break; +#endif + default: frame_type = "unknown"; break; + } + + if (xsane.mode == XSANE_STANDALONE) + { /* We are running in standalone mode */ + if (xsane_generate_dummy_filename()) /* create filename the scanned data is saved to */ + { + /* temporary file */ + umask(0177); /* creare temporary file with "-rw-------" permissions */ + } + else + { + /* no temporary file */ + umask(preferences.image_umask); /* define image file permissions */ + } + + if (!xsane.header_size) /* first pass of multi pass scan */ + { + remove(xsane.dummy_filename); /* remove existing file */ + xsane.out = fopen(xsane.dummy_filename, "w"); + umask(XSANE_DEFAULT_UMASK); /* define new file permissions */ + + if (!xsane.out) /* error while opening the dummy_file for writing */ + { + xsane_scan_done(-1); /* -1 = error */ + snprintf(buf, sizeof(buf), "%s `%s': %s", ERR_OPEN_FAILED, xsane.output_filename, strerror(errno)); + xsane_back_gtk_error(buf, TRUE); + return; + } + + switch (xsane.param.format) + { + case SANE_FRAME_RGB: + case SANE_FRAME_RED: + case SANE_FRAME_GREEN: + case SANE_FRAME_BLUE: + switch (xsane.param.depth) + { + case 8: /* color 8 bit mode, write ppm header */ + fprintf(xsane.out, "P6\n# SANE data follows\n%d %d\n255\n", xsane.param.pixels_per_line, xsane.param.lines); + break; + + default: /* color, but not 8 bit mode, write as raw data because this is not defined in pnm */ + fprintf(xsane.out, "SANE_RGB_RAW\n%d %d\n65535\n", xsane.param.pixels_per_line, xsane.param.lines); + break; + } + break; + + case SANE_FRAME_GRAY: + switch (xsane.param.depth) + { + case 1: /* 1 bit lineart mode, write pbm header */ + fprintf(xsane.out, "P4\n# SANE data follows\n%d %d\n", xsane.param.pixels_per_line, xsane.param.lines); + break; + + case 8: /* 8 bit grayscale mode, write pgm header */ + fprintf(xsane.out, "P5\n# SANE data follows\n%d %d\n255\n", xsane.param.pixels_per_line, xsane.param.lines); + break; + + default: /* grayscale mode but not 1 or 8 bit, write as raw data because this is not defined in pnm */ + fprintf(xsane.out, "SANE_GRAYSCALE_RAW\n%d %d\n65535\n", xsane.param.pixels_per_line, xsane.param.lines); + break; + } + break; + +#ifdef SUPPORT_RGBA + case SANE_FRAME_RGBA: + switch (xsane.param.depth) + { + case 8: /* 8 bit RGBA mode */ + fprintf(xsane.out, "SANE_RGBA\n%d %d\n255\n", xsane.param.pixels_per_line, xsane.param.lines); + break; + + default: /* 16 bit RGBA mode */ + fprintf(xsane.out, "SANE_RGBA\n%d %d\n65535\n", xsane.param.pixels_per_line, xsane.param.lines); + break; + } + break; +#endif + + default: + /* unknown file format, do not write header */ + break; + } + fflush(xsane.out); + xsane.header_size = ftell(xsane.out); + } + + if (xsane.param.format >= SANE_FRAME_RED && xsane.param.format <= SANE_FRAME_BLUE) + { + fseek(xsane.out, xsane.header_size + xsane.param.format - SANE_FRAME_RED, SEEK_SET); + } + + if (xsane.xsane_mode == XSANE_SCAN) + { + snprintf(buf, sizeof(buf), PROGRESS_RECEIVING_SCAN, _(frame_type), xsane.output_filename); + } + else if (xsane.xsane_mode == XSANE_COPY) + { + snprintf(buf, sizeof(buf), PROGRESS_RECEIVING_COPY, _(frame_type)); + } + else if (xsane.xsane_mode == XSANE_FAX) + { + snprintf(buf, sizeof(buf), PROGRESS_RECEIVING_FAX, _(frame_type)); + } + } +#ifdef HAVE_LIBGIMP_GIMP_H + else + { + size_t tile_size; + + /* We are running under the GIMP */ + + xsane.tile_offset = 0; + tile_size = xsane.param.pixels_per_line * gimp_tile_height(); + + switch(xsane.param.format) + { + case SANE_FRAME_RGB: + case SANE_FRAME_RED: + case SANE_FRAME_BLUE: + case SANE_FRAME_GREEN: + tile_size *= 3; /* 24 bits/pixel RGB */ + break; +#ifdef SUPPORT_RGBA + case SANE_FRAME_RGBA: + tile_size *= 4; /* 32 bits/pixel RGBA */ + break; +#endif + default: + break; + } + + if (xsane.tile) + { + xsane.first_frame = 0; + } + else + { + GImageType image_type = RGB; + GDrawableType drawable_type = RGB_IMAGE; + gint32 layer_ID; + + if (xsane.param.format == SANE_FRAME_GRAY) + { + image_type = GRAY; + drawable_type = GRAY_IMAGE; + } +#ifdef SUPPORT_RGBA + else if (xsane.param.format == SANE_FRAME_RGBA) + { + image_type = RGB; + drawable_type = RGBA_IMAGE; /* interpret infrared as alpha */ + } +#endif + + + xsane.image_ID = gimp_image_new(xsane.param.pixels_per_line, xsane.param.lines, image_type); + +/* the following is supported since gimp-1.1.? */ +#ifdef GIMP_HAVE_RESOLUTION_INFO + if (xsane.resolution_x > 0) + { + gimp_image_set_resolution(xsane.image_ID, xsane.resolution_x ,xsane.resolution_y); + } +/* gimp_image_set_unit(xsane.image_ID, unit?); */ +#endif + + layer_ID = gimp_layer_new(xsane.image_ID, "Background", + xsane.param.pixels_per_line, + xsane.param.lines, + drawable_type, 100, NORMAL_MODE); + gimp_image_add_layer(xsane.image_ID, layer_ID, 0); + + xsane.drawable = gimp_drawable_get(layer_ID); + gimp_pixel_rgn_init(&xsane.region, xsane.drawable, 0, 0, + xsane.drawable->width, + xsane.drawable->height, TRUE, FALSE); + xsane.tile = g_new(guchar, tile_size); + xsane.first_frame = 1; + } + + if (xsane.param.format >= SANE_FRAME_RED && xsane.param.format <= SANE_FRAME_BLUE) + { + xsane.tile_offset = xsane.param.format - SANE_FRAME_RED; + } + + snprintf(buf, sizeof(buf), PROGRESS_RECEIVING_GIMP, _(frame_type)); + } +#endif /* HAVE_LIBGIMP_GIMP_H */ + + dialog->pixelcolor = 0; + + if (xsane.progress) + { + xsane_progress_free(xsane.progress); + } + xsane.progress = xsane_progress_new(PROGRESS_SCANNING, buf, (GtkSignalFunc) xsane_cancel, 0); + + xsane.input_tag = -1; + + if (sane_set_io_mode(dev, SANE_TRUE) == SANE_STATUS_GOOD && sane_get_select_fd(dev, &fd) == SANE_STATUS_GOOD) + { + xsane.input_tag = gdk_input_add(fd, GDK_INPUT_READ, xsane_read_image_data, 0); + } + else + { + xsane_read_image_data(0, -1, GDK_INPUT_READ); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +/* Invoked when the scan button is pressed */ +/* or by scan_done if automatic document feeder is selected */ +void xsane_scan_dialog(GtkWidget * widget, gpointer call_data) +{ + char buf[256]; + + sane_get_parameters(dialog->dev, &xsane.param); /* update xsane.param */ + + if (xsane.output_filename) + { + free(xsane.output_filename); + xsane.output_filename = 0; + } + + if (xsane.filetype) + { + char buffer[256]; + + snprintf(buffer, sizeof(buffer), "%s%s", preferences.filename, xsane.filetype); + xsane.output_filename = strdup(buffer); + } + else + { + xsane.output_filename = strdup(preferences.filename); + } + + if (xsane.mode == XSANE_STANDALONE) /* We are running in standalone mode */ + { + char *extension; + + if ( (xsane.xsane_mode == XSANE_SCAN) && (preferences.overwrite_warning) ) /* test if filename already used */ + { + FILE *testfile; + + testfile = fopen(xsane.output_filename, "r"); + if (testfile) /* filename used: skip */ + { + char buf[256]; + + fclose(testfile); + snprintf(buf, sizeof(buf), "File %s already exists\n", xsane.output_filename); + if (xsane_back_gtk_decision(ERR_HEADER_WARNING, (gchar **) warning_xpm, buf, BUTTON_OVERWRITE, BUTTON_CANCEL, TRUE /* wait */) == FALSE) + { + return; + } + } + } + + + extension = strrchr(xsane.output_filename, '.'); + if (extension) + { + extension++; /* skip "." */ + } + + xsane.xsane_output_format = XSANE_UNKNOWN; + + if (xsane.param.depth <= 8) + { + if (extension) + { + if ( (!strcasecmp(extension, "pnm")) || (!strcasecmp(extension, "ppm")) || + (!strcasecmp(extension, "pgm")) || (!strcasecmp(extension, "pbm")) ) + { + xsane.xsane_output_format = XSANE_PNM; + } +#ifdef HAVE_LIBPNG +#ifdef HAVE_LIBZ + else if (!strcasecmp(extension, "png")) + { + xsane.xsane_output_format = XSANE_PNG; + } +#endif +#endif +#ifdef HAVE_LIBJPEG + else if ( (!strcasecmp(extension, "jpg")) || (!strcasecmp(extension, "jpeg")) ) + { + xsane.xsane_output_format = XSANE_JPEG; + } +#endif + else if (!strcasecmp(extension, "ps")) + { + xsane.xsane_output_format = XSANE_PS; + } +#ifdef HAVE_LIBTIFF + else if ( (!strcasecmp(extension, "tif")) || (!strcasecmp(extension, "tiff")) ) + { + xsane.xsane_output_format = XSANE_TIFF; + } +#endif +#ifdef SUPPORT_RGBA + else if (!strcasecmp(extension, "rgba")) + { + xsane.xsane_output_format = XSANE_RGBA; + } +#endif + } + } + else /* depth >8 bpp */ + { + if (extension) + { + if (!strcasecmp(extension, "raw")) + { + xsane.xsane_output_format = XSANE_RAW16; + } + else if ( (!strcasecmp(extension, "pnm")) || (!strcasecmp(extension, "ppm")) || + (!strcasecmp(extension, "pgm")) || (!strcasecmp(extension, "pbm")) ) + { + xsane.xsane_output_format = XSANE_PNM16; + } +#ifdef HAVE_LIBPNG +#ifdef HAVE_LIBZ + else if (!strcasecmp(extension, "png")) + { + xsane.xsane_output_format = XSANE_PNG; + } +#endif +#endif +#ifdef SUPPORT_RGBA + else if (!strcasecmp(extension, "rgba")) + { + xsane.xsane_output_format = XSANE_RGBA; + } +#endif + } + } + + if (xsane.xsane_mode == XSANE_SCAN) + { + if (xsane.xsane_output_format == XSANE_UNKNOWN) + { + if (extension) + { + snprintf(buf, sizeof(buf), "Unsupported %d-bit output format: %s", xsane.param.depth, extension); + } + else + { + snprintf(buf, sizeof(buf), "%s", ERR_NO_OUTPUT_FORMAT); + } + xsane_back_gtk_error(buf, TRUE); + return; + } +#ifdef SUPPORT_RGBA + else if ((xsane.xsane_output_format == XSANE_RGBA) && (xsane.param.format != SANE_FRAME_RGBA)) + { + snprintf(buf, sizeof(buf), "No RGBA data format !!!"); /* user selected output format RGBA, scanner uses other format */ + xsane_back_gtk_error(buf, TRUE); + return; + } +#endif + } +#ifdef SUPPORT_RGBA + else if (xsane.param.format == SANE_FRAME_RGBA) /* no scanmode but format=rgba */ + { + snprintf(buf, sizeof(buf), "Special format RGBA only supported in scan mode !!!"); + xsane_back_gtk_error(buf, TRUE); + return; + } +#endif + +#ifdef SUPPORT_RGBA + if (xsane.param.format == SANE_FRAME_RGBA) + { + if ( (xsane.xsane_output_format != XSANE_RGBA) && (xsane.xsane_output_format != XSANE_PNG) ) + { + snprintf(buf, sizeof(buf), "Image data of type SANE_FRAME_RGBA\ncan only be saved in rgba or png format"); + xsane_back_gtk_error(buf, TRUE); + return; + } + } +#endif + + if (xsane.xsane_mode == XSANE_FAX) + { + mkdir(preferences.fax_project, 7*64 + 0*8 + 0); + } + } +#ifdef HAVE_LIBGIMP_GIMP_H + else /* We are running in gimp mode */ + { + if ((xsane.param.depth != 1) && (xsane.param.depth != 8)) /* not support bit depth ? */ + { + snprintf(buf, sizeof(buf), "%s %d.", ERR_GIMP_BAD_DEPTH, xsane.param.depth); + xsane_back_gtk_error(buf, TRUE); + return; + } + } +#endif + + if (xsane.dummy_filename) /* no dummy filename defined - necessary if an error occurs */ + { + free(xsane.dummy_filename); + xsane.dummy_filename = 0; + } + + if (xsane.param.depth > 1) /* if depth > 1 use gamma correction */ + { + int size; + int gamma_gray_size, gamma_red_size, gamma_green_size, gamma_blue_size; + int gamma_gray_max, gamma_red_max, gamma_green_max, gamma_blue_max; + const SANE_Option_Descriptor *opt; + + size = (int) pow(2, xsane.param.depth); + gamma_gray_size = size; + gamma_red_size = size; + gamma_green_size = size; + gamma_blue_size = size; + + size--; + gamma_gray_max = size; + gamma_red_max = size; + gamma_green_max = size; + gamma_blue_max = size; + + if (xsane.scanner_gamma_gray) /* gamma table for gray available */ + { + opt = sane_get_option_descriptor(dialog->dev, dialog->well_known.gamma_vector); + gamma_gray_size = opt->size / sizeof(opt->type); + gamma_gray_max = opt->constraint.range->max; + } + + if (xsane.scanner_gamma_color) /* gamma table for red, green and blue available */ + { + double gamma_red, gamma_green, gamma_blue; + + /* ok, scanner color gamma function is supported, so we do all conversions about that */ + /* we do not need any gamma tables while scanning, so we can free them after sending */ + /* the data to the scanner */ + + /* if also gray gamma function is supported, set this to 1.0 to get the right colors */ + if (xsane.scanner_gamma_gray) + { + xsane.gamma_data = malloc(gamma_gray_size * sizeof(SANE_Int)); + xsane_create_gamma_curve(xsane.gamma_data, 0, 1.0, 0.0, 0.0, gamma_gray_size, gamma_gray_max); + xsane_back_gtk_update_vector(dialog, dialog->well_known.gamma_vector, xsane.gamma_data); + free(xsane.gamma_data); + xsane.gamma_data = 0; + } + + opt = sane_get_option_descriptor(dialog->dev, dialog->well_known.gamma_vector_r); + gamma_red_size = opt->size / sizeof(opt->type); + gamma_red_max = opt->constraint.range->max; + + opt = sane_get_option_descriptor(dialog->dev, dialog->well_known.gamma_vector_g); + gamma_green_size = opt->size / sizeof(opt->type); + gamma_green_max = opt->constraint.range->max; + + opt = sane_get_option_descriptor(dialog->dev, dialog->well_known.gamma_vector_b); + gamma_blue_size = opt->size / sizeof(opt->type); + gamma_blue_max = opt->constraint.range->max; + + xsane.gamma_data_red = malloc(gamma_red_size * sizeof(SANE_Int)); + xsane.gamma_data_green = malloc(gamma_green_size * sizeof(SANE_Int)); + xsane.gamma_data_blue = malloc(gamma_blue_size * sizeof(SANE_Int)); + + if (xsane.xsane_mode == XSANE_COPY) + { + gamma_red = xsane.gamma * xsane.gamma_red * preferences.printer[preferences.printernr]->gamma * preferences.printer[preferences.printernr]->gamma_red; + gamma_green = xsane.gamma * xsane.gamma_green * preferences.printer[preferences.printernr]->gamma * preferences.printer[preferences.printernr]->gamma_green; + gamma_blue = xsane.gamma * xsane.gamma_blue * preferences.printer[preferences.printernr]->gamma * preferences.printer[preferences.printernr]->gamma_blue; + } + else + { + gamma_red = xsane.gamma * xsane.gamma_red; + gamma_green = xsane.gamma * xsane.gamma_green; + gamma_blue = xsane.gamma * xsane.gamma_blue; + } + + xsane_create_gamma_curve(xsane.gamma_data_red, xsane.negative, + gamma_red, + xsane.brightness + xsane.brightness_red, + xsane.contrast + xsane.contrast_red, gamma_red_size, gamma_red_max); + + xsane_create_gamma_curve(xsane.gamma_data_green, xsane.negative, + gamma_green, + xsane.brightness + xsane.brightness_green, + xsane.contrast + xsane.contrast_green, gamma_green_size, gamma_green_max); + + xsane_create_gamma_curve(xsane.gamma_data_blue, xsane.negative, + gamma_blue, + xsane.brightness + xsane.brightness_blue, + xsane.contrast + xsane.contrast_blue , gamma_blue_size, gamma_blue_max); + + xsane_back_gtk_update_vector(dialog, dialog->well_known.gamma_vector_r, xsane.gamma_data_red); + xsane_back_gtk_update_vector(dialog, dialog->well_known.gamma_vector_g, xsane.gamma_data_green); + xsane_back_gtk_update_vector(dialog, dialog->well_known.gamma_vector_b, xsane.gamma_data_blue); + + free(xsane.gamma_data_red); + free(xsane.gamma_data_green); + free(xsane.gamma_data_blue); + + xsane.gamma_data_red = 0; + xsane.gamma_data_green = 0; + xsane.gamma_data_blue = 0; + } + else if (xsane.scanner_gamma_gray) /* only scanner gray gamma function available */ + { + double gamma; + /* ok, the scanner only supports gray gamma function */ + /* if we are doing a grayscale scan everyting is ok, */ + /* for a color scan the software has to do the gamma correction set by the component slider */ + + if (xsane.xsane_mode == XSANE_COPY) + { + gamma = xsane.gamma * preferences.printer[preferences.printernr]->gamma; + } + else + { + gamma = xsane.gamma; + } + + xsane.gamma_data = malloc(gamma_gray_size * sizeof(SANE_Int)); + xsane_create_gamma_curve(xsane.gamma_data, xsane.negative, + gamma, xsane.brightness, xsane.contrast, + gamma_gray_size, gamma_gray_max); + + xsane_back_gtk_update_vector(dialog, dialog->well_known.gamma_vector, xsane.gamma_data); + free(xsane.gamma_data); + xsane.gamma_data = 0; + + if (xsane.xsane_color) /* ok, we are doing a colorscan */ + { + /* we have to create color gamma table for software conversion */ + /* but we only have to use color slider values, because gray slider value */ + /* is used by scanner gray gamma */ + + double gamma_red, gamma_green, gamma_blue; + + xsane.gamma_data_red = malloc(gamma_red_size * sizeof(SANE_Int)); + xsane.gamma_data_green = malloc(gamma_green_size * sizeof(SANE_Int)); + xsane.gamma_data_blue = malloc(gamma_blue_size * sizeof(SANE_Int)); + + if (xsane.xsane_mode == XSANE_COPY) + { + gamma_red = xsane.gamma_red * preferences.printer[preferences.printernr]->gamma_red; + gamma_green = xsane.gamma_green * preferences.printer[preferences.printernr]->gamma_green; + gamma_blue = xsane.gamma_blue * preferences.printer[preferences.printernr]->gamma_blue; + } + else + { + gamma_red = xsane.gamma_red; + gamma_green = xsane.gamma_green; + gamma_blue = xsane.gamma_blue; + } + + xsane_create_gamma_curve(xsane.gamma_data_red, 0, + gamma_red, xsane.brightness_red, xsane.contrast_red, + gamma_red_size, gamma_red_max); + + xsane_create_gamma_curve(xsane.gamma_data_green, 0, + gamma_green, xsane.brightness_green, xsane.contrast_green, + gamma_green_size, gamma_green_max); + + xsane_create_gamma_curve(xsane.gamma_data_blue, 0, + gamma_blue, xsane.brightness_blue, xsane.contrast_blue, + gamma_blue_size, gamma_blue_max); + + /* gamma tables are freed after scan */ + } + + } + else /* scanner does not support any gamma correction */ + { + /* ok, we have to do it on our own */ + + if (xsane.xsane_color == 0) /* no color scan */ + { + double gamma; + + if (xsane.xsane_mode == XSANE_COPY) + { + gamma = xsane.gamma * preferences.printer[preferences.printernr]->gamma; + } + else + { + gamma = xsane.gamma; + } + + xsane.gamma_data = malloc(gamma_gray_size * sizeof(SANE_Int)); + xsane_create_gamma_curve(xsane.gamma_data, xsane.negative, + gamma, xsane.brightness, xsane.contrast, + gamma_gray_size, gamma_gray_max); + + /* gamma table is freed after scan */ + } + else /* color scan */ + { + double gamma_red, gamma_green, gamma_blue; + /* ok, we have to combin gray and color slider values */ + + xsane.gamma_data_red = malloc(gamma_red_size * sizeof(SANE_Int)); + xsane.gamma_data_green = malloc(gamma_green_size * sizeof(SANE_Int)); + xsane.gamma_data_blue = malloc(gamma_blue_size * sizeof(SANE_Int)); + + if (xsane.xsane_mode == XSANE_COPY) + { + gamma_red = xsane.gamma * xsane.gamma_red * preferences.printer[preferences.printernr]->gamma * preferences.printer[preferences.printernr]->gamma_red; + gamma_green = xsane.gamma * xsane.gamma_green * preferences.printer[preferences.printernr]->gamma * preferences.printer[preferences.printernr]->gamma_green; + gamma_blue = xsane.gamma * xsane.gamma_blue * preferences.printer[preferences.printernr]->gamma * preferences.printer[preferences.printernr]->gamma_blue; + } + else + { + gamma_red = xsane.gamma * xsane.gamma_red; + gamma_green = xsane.gamma * xsane.gamma_green; + gamma_blue = xsane.gamma * xsane.gamma_blue; + } + + xsane_create_gamma_curve(xsane.gamma_data_red, xsane.negative, + gamma_red, + xsane.brightness + xsane.brightness_red, + xsane.contrast + xsane.contrast_red, gamma_red_size, gamma_red_max); + + xsane_create_gamma_curve(xsane.gamma_data_green, xsane.negative, + gamma_green, + xsane.brightness + xsane.brightness_green, + xsane.contrast + xsane.contrast_green, gamma_green_size, gamma_green_max); + + xsane_create_gamma_curve(xsane.gamma_data_blue, xsane.negative, + gamma_blue, + xsane.brightness + xsane.brightness_blue, + xsane.contrast + xsane.contrast_blue , gamma_blue_size, gamma_blue_max); + + /* gamma tables are freed after scan */ + } + + } + } + + while (gtk_events_pending()) + { + gtk_main_iteration(); + } + + xsane_start_scan(); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + diff --git a/frontend/xsane-scan.h b/frontend/xsane-scan.h new file mode 100644 index 0000000..75c5ff8 --- /dev/null +++ b/frontend/xsane-scan.h @@ -0,0 +1,35 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-scan.h + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#include "sane/config.h" +#include + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +extern void null_print_func(gchar *msg); +extern void xsane_scan_done(SANE_Status status); +extern void xsane_cancel(void); +extern void xsane_scan_dialog(GtkWidget * widget, gpointer call_data); + +/* ---------------------------------------------------------------------------------------------------------------------- */ diff --git a/frontend/xsane-setup.c b/frontend/xsane-setup.c new file mode 100644 index 0000000..637ea91 --- /dev/null +++ b/frontend/xsane-setup.c @@ -0,0 +1,1565 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-setup.c + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#include "xsane.h" +#include "xsane-back-gtk.h" +#include "xsane-front-gtk.h" +#include "xsane-preferences.h" +#include "xsane-preview.h" +#include "xsane-save.h" +#include "xsane-text.h" +#include "xsane-gamma.h" + +#ifdef HAVE_LIBPNG +#ifdef HAVE_LIBZ +#include +#include +#endif +#endif + +#ifdef HAVE_LIBTIFF +#include +#endif + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#define XSANE_GTK_NAME_IMAGE_PERMISSIONS "gtk_toggle_button_image_permissions" +#define XSANE_GTK_NAME_DIRECTORY_PERMISSIONS "gtk_toggle_button_directory_permissions" + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +struct XsaneSetup xsane_setup; + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +/* forward declarations: */ + +void xsane_new_printer(void); +void xsane_update_int(GtkWidget *widget, int *val); + +static void xsane_update_bool(GtkWidget *widget, int *val); +static void xsane_update_scale(GtkWidget *widget, double *val); +static void xsane_update_double(GtkWidget *widget, double *val); +static void xsane_setup_printer_update(void); +static void xsane_setup_printer_callback(GtkWidget *widget, gpointer data); +static void xsane_setup_printer_menu_build(GtkWidget *option_menu); +static void xsane_setup_printer_apply_changes(GtkWidget *widget, gpointer data); +static void xsane_setup_printer_new(GtkWidget *widget, gpointer data); +static void xsane_setup_printer_delete(GtkWidget *widget, gpointer data); +static void xsane_setup_display_apply_changes(GtkWidget *widget, gpointer data); +static void xsane_setup_saving_apply_changes(GtkWidget *widget, gpointer data); +static void xsane_setup_fax_apply_changes(GtkWidget *widget, gpointer data); +static void xsane_setup_options_ok_callback(GtkWidget *widget, gpointer data); + +void xsane_setup_dialog(GtkWidget *widget, gpointer data); + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_new_printer(void) +{ + preferences.printernr = preferences.printerdefinitions++; + + preferences.printer[preferences.printernr] = calloc(sizeof(Preferences_printer_t), 1); + + preferences.printer[preferences.printernr]->name = strdup(PRINTERNAME); + preferences.printer[preferences.printernr]->command = strdup(PRINTERCOMMAND); + preferences.printer[preferences.printernr]->copy_number_option = strdup(PRINTERCOPYNUMBEROPTION); + preferences.printer[preferences.printernr]->resolution = 300; + preferences.printer[preferences.printernr]->width = 203.2; + preferences.printer[preferences.printernr]->height = 294.6; + preferences.printer[preferences.printernr]->leftoffset = 3.5; + preferences.printer[preferences.printernr]->bottomoffset = 3.5; + preferences.printer[preferences.printernr]->gamma = 1.0; + preferences.printer[preferences.printernr]->gamma_red = 1.0; + preferences.printer[preferences.printernr]->gamma_green = 1.0; + preferences.printer[preferences.printernr]->gamma_blue = 1.0; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_update_int(GtkWidget *widget, int *val) +{ + char *start, *end; + int v; + + start = gtk_entry_get_text(GTK_ENTRY(widget)); + if (!start) + return; + + v = (int) strtol(start, &end, 10); + if (end > start && v > 0) + { + *val = v; + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_update_bool(GtkWidget *widget, int *val) +{ + *val = (GTK_TOGGLE_BUTTON(widget)->active != 0); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_update_scale(GtkWidget *widget, double *val) +{ + *val = GTK_ADJUSTMENT(widget)->value; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_update_double(GtkWidget *widget, double *val) +{ + char *start, *end; + double v; + + start = gtk_entry_get_text(GTK_ENTRY(widget)); + if (!start) + return; + + v = strtod(start, &end); + if (end > start && v > 0.0) + { + *val = v; + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_setup_printer_update() +{ + char buf[256]; + gtk_entry_set_text(GTK_ENTRY(xsane_setup.printer_name_entry), + (char *) preferences.printer[preferences.printernr]->name); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.printer_command_entry), + (char *) preferences.printer[preferences.printernr]->command); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.printer_copy_number_option_entry), + (char *) preferences.printer[preferences.printernr]->copy_number_option); + + snprintf(buf, sizeof(buf), "%d", preferences.printer[preferences.printernr]->resolution); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.printer_resolution_entry), buf); + snprintf(buf, sizeof(buf), "%3.2f", preferences.printer[preferences.printernr]->width); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.printer_width_entry), buf); + snprintf(buf, sizeof(buf), "%3.2f", preferences.printer[preferences.printernr]->height); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.printer_height_entry), buf); + snprintf(buf, sizeof(buf), "%3.2f", preferences.printer[preferences.printernr]->leftoffset); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.printer_leftoffset_entry), buf); + snprintf(buf, sizeof(buf), "%3.2f", preferences.printer[preferences.printernr]->bottomoffset); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.printer_bottomoffset_entry), buf); + snprintf(buf, sizeof(buf), "%1.2f", preferences.printer[preferences.printernr]->gamma); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.printer_gamma_entry), buf); + snprintf(buf, sizeof(buf), "%1.2f", preferences.printer[preferences.printernr]->gamma_red); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.printer_gamma_red_entry), buf); + snprintf(buf, sizeof(buf), "%1.2f", preferences.printer[preferences.printernr]->gamma_green); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.printer_gamma_green_entry), buf); + snprintf(buf, sizeof(buf), "%1.2f", preferences.printer[preferences.printernr]->gamma_blue); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.printer_gamma_blue_entry), buf); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_setup_printer_callback(GtkWidget *widget, gpointer data) +{ + preferences.printernr = (int) data; + xsane_setup_printer_update(); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_setup_printer_menu_build(GtkWidget *option_menu) +{ + GtkWidget *printer_menu, *printer_item; + int i; + + printer_menu = gtk_menu_new(); + + for (i=0; i < preferences.printerdefinitions; i++) + { + printer_item = gtk_menu_item_new_with_label(preferences.printer[i]->name); + gtk_container_add(GTK_CONTAINER(printer_menu), printer_item); + gtk_signal_connect(GTK_OBJECT(printer_item), "activate", (GtkSignalFunc) xsane_setup_printer_callback, (void *) i); + gtk_widget_show(printer_item); + } + + gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), printer_menu); + gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), preferences.printernr); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_setup_printer_apply_changes(GtkWidget *widget, gpointer data) +{ + GtkWidget *option_menu = (GtkWidget *) data; + + if (preferences.printer[preferences.printernr]->name) + { + free((void *) preferences.printer[preferences.printernr]->name); + } + preferences.printer[preferences.printernr]->name = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.printer_name_entry))); + + if (preferences.printer[preferences.printernr]->command) + { + free((void *) preferences.printer[preferences.printernr]->command); + } + preferences.printer[preferences.printernr]->command = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.printer_command_entry))); + + if (preferences.printer[preferences.printernr]->copy_number_option) + { + free((void *) preferences.printer[preferences.printernr]->copy_number_option); + } + preferences.printer[preferences.printernr]->copy_number_option = + strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.printer_copy_number_option_entry))); + + xsane_update_int(xsane_setup.printer_resolution_entry, &preferences.printer[preferences.printernr]->resolution); + + xsane_update_double(xsane_setup.printer_width_entry, &preferences.printer[preferences.printernr]->width); + xsane_update_double(xsane_setup.printer_height_entry, &preferences.printer[preferences.printernr]->height); + xsane_update_double(xsane_setup.printer_leftoffset_entry, &preferences.printer[preferences.printernr]->leftoffset); + xsane_update_double(xsane_setup.printer_bottomoffset_entry, &preferences.printer[preferences.printernr]->bottomoffset); + + xsane_update_double(xsane_setup.printer_gamma_entry, &preferences.printer[preferences.printernr]->gamma); + xsane_update_double(xsane_setup.printer_gamma_red_entry, &preferences.printer[preferences.printernr]->gamma_red); + xsane_update_double(xsane_setup.printer_gamma_green_entry, &preferences.printer[preferences.printernr]->gamma_green); + xsane_update_double(xsane_setup.printer_gamma_blue_entry, &preferences.printer[preferences.printernr]->gamma_blue); + + if (option_menu) + { + xsane_setup_printer_menu_build(option_menu); + } + + xsane_define_maximum_output_size(); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_setup_printer_new(GtkWidget *widget, gpointer data) +{ + GtkWidget *option_menu = (GtkWidget *) data; + + xsane_new_printer(); + xsane_setup_printer_update(); + + xsane_setup_printer_menu_build(option_menu); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_setup_printer_delete(GtkWidget *widget, gpointer data) +{ + GtkWidget *option_menu = (GtkWidget *) data; + int i; + + preferences.printerdefinitions--; + + i = preferences.printernr; + while (i < preferences.printerdefinitions) + { + memcpy(preferences.printer[i], preferences.printer[i+1], sizeof(Preferences_printer_t)); + i++; + } + + if (preferences.printernr >= preferences.printerdefinitions) + { + preferences.printernr--; + } + + if (preferences.printerdefinitions == 0) + { + xsane_new_printer(); + preferences.printernr = 0; + } + + xsane_setup_printer_update(); + + xsane_setup_printer_menu_build(option_menu); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#ifdef HAVE_LIBTIFF +static void xsane_setup_tiff_compression_callback(GtkWidget *widget, gpointer data) +{ + xsane_setup.tiff_compression_nr = (int) data; +} + +/* -------------------------------------- */ + +static void xsane_setup_tiff_compression_1_callback(GtkWidget *widget, gpointer data) +{ + xsane_setup.tiff_compression_1_nr = (int) data; +} +#endif + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_setup_display_apply_changes(GtkWidget *widget, gpointer data) +{ + xsane_update_bool(xsane_setup.main_window_fixed_button, &preferences.main_window_fixed); + xsane_update_bool(xsane_setup.preview_preserve_button, &preferences.preserve_preview); + xsane_update_bool(xsane_setup.preview_own_cmap_button, &preferences.preview_own_cmap); + + xsane_update_double(xsane_setup.preview_gamma_entry, &preferences.preview_gamma); + xsane_update_double(xsane_setup.preview_gamma_red_entry, &preferences.preview_gamma_red); + xsane_update_double(xsane_setup.preview_gamma_green_entry, &preferences.preview_gamma_green); + xsane_update_double(xsane_setup.preview_gamma_blue_entry, &preferences.preview_gamma_blue); + + preferences.doc_viewer = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.doc_viewer_entry))); + + xsane_update_gamma(); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_setup_saving_apply_changes(GtkWidget *widget, gpointer data) +{ +#ifdef HAVE_LIBJPEG + xsane_update_scale(xsane_setup.jpeg_image_quality_scale, &preferences.jpeg_quality); +#else +#ifdef HAVE_LIBTIFF + xsane_update_scale(xsane_setup.jpeg_image_quality_scale, &preferences.jpeg_quality); +#endif +#endif + +#ifdef HAVE_LIBPNG +#ifdef HAVE_LIBZ + xsane_update_scale(xsane_setup.pnm_image_compression_scale, &preferences.png_compression); +#endif +#endif + +#ifdef HAVE_LIBTIFF + preferences.tiff_compression_nr = xsane_setup.tiff_compression_nr; + preferences.tiff_compression_1_nr = xsane_setup.tiff_compression_1_nr; +#endif + + xsane_update_bool(xsane_setup.overwrite_warning_button, &preferences.overwrite_warning); + xsane_update_bool(xsane_setup.increase_filename_counter_button, &preferences.increase_filename_counter); + xsane_update_bool(xsane_setup.skip_existing_numbers_button, &preferences.skip_existing_numbers); + preferences.image_umask = 0777 - xsane_setup.image_permissions; + preferences.directory_umask = 0777 - xsane_setup.directory_permissions; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_setup_fax_apply_changes(GtkWidget *widget, gpointer data) +{ + if (preferences.fax_command) + { + free((void *) preferences.fax_command); + } + preferences.fax_command = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.fax_command_entry))); + preferences.fax_receiver_option = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.fax_receiver_option_entry))); + preferences.fax_postscript_option = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.fax_postscript_option_entry))); + preferences.fax_normal_option = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.fax_normal_option_entry))); + preferences.fax_fine_option = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.fax_fine_option_entry))); + preferences.fax_viewer = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.fax_viewer_entry))); + + xsane_update_double(xsane_setup.fax_leftoffset_entry, &preferences.fax_leftoffset); + xsane_update_double(xsane_setup.fax_bottomoffset_entry, &preferences.fax_bottomoffset); + xsane_update_double(xsane_setup.fax_width_entry, &preferences.fax_width); + xsane_update_double(xsane_setup.fax_height_entry, &preferences.fax_height); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_setup_options_ok_callback(GtkWidget *widget, gpointer data) +{ + xsane_setup_printer_apply_changes(0, 0); + xsane_setup_display_apply_changes(0, 0); + xsane_setup_saving_apply_changes(0, 0); + xsane_setup_fax_apply_changes(0, 0); + + xsane_pref_save(); + + gtk_widget_destroy((GtkWidget *)data); /* => xsane_destroy_setup_dialog_callback */ +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_destroy_setup_dialog_callback(GtkWidget *widget, gpointer data) +{ + xsane_set_sensitivity(TRUE); + xsane_back_gtk_refresh_dialog(dialog); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_close_setup_dialog_callback(GtkWidget *widget, gpointer data) +{ + gtk_widget_destroy((GtkWidget *)data); /* => xsane_destroy_setup_dialog_callback */ +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_permission_toggled(GtkWidget *widget, gpointer data) +{ + int mask = (int) data; + int *permission = 0; + gchar *name = gtk_widget_get_name(widget); + + if (!strcmp(name, XSANE_GTK_NAME_IMAGE_PERMISSIONS)) + { + permission = &xsane_setup.image_permissions; + } + else if (!strcmp(name, XSANE_GTK_NAME_DIRECTORY_PERMISSIONS)) + { + permission = &xsane_setup.directory_permissions; + } + + if (permission) + { + if (GTK_TOGGLE_BUTTON(widget)->active) /* set bit */ + { + *permission = *permission | mask; + } + else /* erase bit */ + { + *permission = *permission & (0777-mask); + } + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *description, int *permission, + int header, int x_sensitivity, int user_sensitivity) +{ + GtkWidget *hbox, *button, *label, *hspace; + + + if (header) + { + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 2); + + label = gtk_label_new("user"); + gtk_widget_set_usize(label, 75, 0); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + label = gtk_label_new("group"); + gtk_widget_set_usize(label, 75, 0); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + label = gtk_label_new("all"); + gtk_widget_set_usize(label, 75, 0); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + gtk_widget_show(hbox); + } + + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 2); + + button = gtk_toggle_button_new_with_label("r"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 256 ); + gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_name(button, name); + gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 256); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); + gtk_widget_show(button); + gtk_widget_set_sensitive(button, user_sensitivity); + + button = gtk_toggle_button_new_with_label("w"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 128 ); + gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_name(button, name); + gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 128); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); + gtk_widget_show(button); + gtk_widget_set_sensitive(button, user_sensitivity); + + button = gtk_toggle_button_new_with_label("x"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 64 ); + gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_name(button, name); + gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 64); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); + gtk_widget_show(button); + gtk_widget_set_sensitive(button, x_sensitivity & user_sensitivity); + + + + hspace = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), hspace, FALSE, FALSE, 6); + gtk_widget_show(hspace); + + + + button = gtk_toggle_button_new_with_label("r"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 32 ); + gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_name(button, name); + gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 32); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); + gtk_widget_show(button); + + button = gtk_toggle_button_new_with_label("w"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 16 ); + gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_name(button, name); + gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 16); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); + gtk_widget_show(button); + + button = gtk_toggle_button_new_with_label("x"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 8 ); + gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_name(button, name); + gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 8); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); + gtk_widget_show(button); + gtk_widget_set_sensitive(button, x_sensitivity); + + + + hspace = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), hspace, FALSE, FALSE, 6); + gtk_widget_show(hspace); + + + + button = gtk_toggle_button_new_with_label("r"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 4 ); + gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_name(button, name); + gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 4); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); + gtk_widget_show(button); + + button = gtk_toggle_button_new_with_label("w"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 2 ); + gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_name(button, name); + gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 2); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); + gtk_widget_show(button); + + button = gtk_toggle_button_new_with_label("x"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 1 ); + gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_name(button, name); + gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 1); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); + gtk_widget_show(button); + gtk_widget_set_sensitive(button, x_sensitivity); + + + + hspace = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), hspace, FALSE, FALSE, 5); + gtk_widget_show(hspace); + + + + label = gtk_label_new(description); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + gtk_widget_show(hbox); + + while (gtk_events_pending()) + { + gtk_main_iteration(); + } +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +void xsane_setup_dialog(GtkWidget *widget, gpointer data) +{ + GtkWidget *setup_dialog, *setup_vbox, *vbox, *hbox, *button, *label, *text, *frame, *notebook; + GtkWidget *printer_option_menu; + char buf[64]; + +#ifdef HAVE_LIBTIFF + GtkWidget *tiff_compression_option_menu, *tiff_compression_menu, *tiff_compression_item; + int i, select = 1; + + typedef struct tiff_compression_t + { + char *name; + int number; + } tiff_compression; + +#define TIFF_COMPRESSION_NUMBER 3 +#define TIFF_COMPRESSION1_NUMBER 6 + + tiff_compression tiff_compression_strings[TIFF_COMPRESSION_NUMBER]; + tiff_compression tiff_compression1_strings[TIFF_COMPRESSION1_NUMBER]; + + tiff_compression_strings[0].name = MENU_ITEM_TIFF_COMP_NONE; + tiff_compression_strings[0].number = COMPRESSION_NONE; + tiff_compression_strings[1].name = MENU_ITEM_TIFF_COMP_JPEG; + tiff_compression_strings[1].number = COMPRESSION_JPEG; + tiff_compression_strings[2].name = MENU_ITEM_TIFF_COMP_PACKBITS; + tiff_compression_strings[2].number = COMPRESSION_PACKBITS; + + tiff_compression1_strings[0].name = MENU_ITEM_TIFF_COMP_NONE; + tiff_compression1_strings[0].number = COMPRESSION_NONE; + tiff_compression1_strings[1].name = MENU_ITEM_TIFF_COMP_CCITTRLE; + tiff_compression1_strings[1].number = COMPRESSION_CCITTRLE; + tiff_compression1_strings[2].name = MENU_ITEM_TIFF_COMP_CCITFAX3; + tiff_compression1_strings[2].number = COMPRESSION_CCITTFAX3; + tiff_compression1_strings[3].name = MENU_ITEM_TIFF_COMP_CCITFAX4; + tiff_compression1_strings[3].number = COMPRESSION_CCITTFAX4; + tiff_compression1_strings[4].name = MENU_ITEM_TIFF_COMP_JPEG; + tiff_compression1_strings[4].number = COMPRESSION_JPEG; + tiff_compression1_strings[5].name = MENU_ITEM_TIFF_COMP_PACKBITS; + tiff_compression1_strings[5].number = COMPRESSION_PACKBITS; + +#endif /* HAVE_LIBTIFF */ + + xsane_set_sensitivity(FALSE); + + setup_dialog = gtk_dialog_new(); + snprintf(buf, sizeof(buf), "%s %s", prog_name, WINDOW_SETUP); + gtk_window_set_title(GTK_WINDOW(setup_dialog), buf); + gtk_signal_connect(GTK_OBJECT(setup_dialog), "destroy", (GtkSignalFunc) xsane_destroy_setup_dialog_callback, setup_dialog); + xsane_set_window_icon(setup_dialog, 0); + + setup_vbox = GTK_DIALOG(setup_dialog)->vbox; + + notebook = gtk_notebook_new(); + gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP); + gtk_box_pack_start(GTK_BOX(setup_vbox), notebook, FALSE, FALSE, 0); + gtk_widget_show(notebook); + + + + + /* Printer options notebook page */ + + setup_vbox = gtk_vbox_new(FALSE, 5); + + label = gtk_label_new(NOTEBOOK_COPY_OPTIONS); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), setup_vbox, label); + gtk_widget_show(setup_vbox); + + frame = gtk_frame_new(0); + gtk_container_set_border_width(GTK_CONTAINER(frame), 4); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); + gtk_box_pack_start(GTK_BOX(setup_vbox), frame, TRUE, TRUE, 0); /* sizeable framehight */ + gtk_widget_show(frame); + + vbox = gtk_vbox_new(FALSE, 1); + gtk_container_add(GTK_CONTAINER(frame), vbox); + gtk_widget_show(vbox); + + + + hbox = gtk_hbox_new(FALSE, 2); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 2); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + label = gtk_label_new(TEXT_SETUP_PRINTER_SEL); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + printer_option_menu = gtk_option_menu_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, printer_option_menu, DESC_PRINTER_SETUP); + gtk_box_pack_end(GTK_BOX(hbox), printer_option_menu, FALSE, FALSE, 2); + gtk_widget_show(printer_option_menu); + gtk_widget_show(hbox); + + xsane_setup_printer_menu_build(printer_option_menu); + + /* printername : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_PRINTER_NAME); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PRINTER_NAME); + gtk_widget_set_usize(text, 250, 0); + gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.printer[preferences.printernr]->name); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.printer_name_entry = text; + + /* printcommand : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_PRINTER_CMD); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PRINTER_COMMAND); + gtk_widget_set_usize(text, 250, 0); + gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.printer[preferences.printernr]->command); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.printer_command_entry = text; + + /* copy number option : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_COPY_NR_OPT); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_COPY_NUMBER_OPTION); + gtk_widget_set_usize(text, 250, 0); + gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.printer[preferences.printernr]->copy_number_option); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.printer_copy_number_option_entry = text; + + /* printerresolution : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_PRINTER_RES); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PRINTER_RESOLUTION); + gtk_widget_set_usize(text, 50, 0); + snprintf(buf, sizeof(buf), "%d", preferences.printer[preferences.printernr]->resolution); + gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.printer_resolution_entry = text; + + + xsane_separator_new(vbox, 2); + + + /* printer width: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_PRINTER_WIDTH); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PRINTER_WIDTH); + gtk_widget_set_usize(text, 50, 0); + snprintf(buf, sizeof(buf), "%3.2f", preferences.printer[preferences.printernr]->width); + gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.printer_width_entry = text; + + /* printer height: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_PRINTER_HEIGHT); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PRINTER_HEIGHT); + gtk_widget_set_usize(text, 50, 0); + snprintf(buf, sizeof(buf), "%3.2f", preferences.printer[preferences.printernr]->height); + gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.printer_height_entry = text; + + /* printer left offset : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_PRINTER_LEFT); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PRINTER_LEFTOFFSET); + gtk_widget_set_usize(text, 50, 0); + snprintf(buf, sizeof(buf), "%3.2f", preferences.printer[preferences.printernr]->leftoffset); + gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.printer_leftoffset_entry = text; + + /* printer bottom offset : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_PRINTER_BOTTOM); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PRINTER_BOTTOMOFFSET); + gtk_widget_set_usize(text, 50, 0); + snprintf(buf, sizeof(buf), "%3.2f", preferences.printer[preferences.printernr]->bottomoffset); + gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.printer_bottomoffset_entry = text; + + + xsane_separator_new(vbox, 2); + + + /* printer gamma: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_PRINTER_GAMMA); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PRINTER_GAMMA); + gtk_widget_set_usize(text, 50, 0); + snprintf(buf, sizeof(buf), "%1.2f", preferences.printer[preferences.printernr]->gamma); + gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.printer_gamma_entry = text; + + /* printer gamma red: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_PRINTER_GAMMA_RED); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PRINTER_GAMMA_RED); + gtk_widget_set_usize(text, 50, 0); + snprintf(buf, sizeof(buf), "%1.2f", preferences.printer[preferences.printernr]->gamma_red); + gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.printer_gamma_red_entry = text; + + /* printer gamma green: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_PRINTER_GAMMA_GREEN); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PRINTER_GAMMA_GREEN); + gtk_widget_set_usize(text, 50, 0); + snprintf(buf, sizeof(buf), "%1.2f", preferences.printer[preferences.printernr]->gamma_green); + gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.printer_gamma_green_entry = text; + + /* printer gamma blue: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_PRINTER_GAMMA_BLUE); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PRINTER_GAMMA_BLUE); + gtk_widget_set_usize(text, 50, 0); + snprintf(buf, sizeof(buf), "%1.2f", preferences.printer[preferences.printernr]->gamma_blue); + gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.printer_gamma_blue_entry = text; + + + xsane_separator_new(vbox, 4); + + /* "apply" "add printer" "delete printer" */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + button = gtk_button_new_with_label(BUTTON_APPLY); + gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_printer_apply_changes, printer_option_menu); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + button = gtk_button_new_with_label(BUTTON_ADD_PRINTER); + gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_printer_new, printer_option_menu); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + button = gtk_button_new_with_label(BUTTON_DELETE_PRINTER); + gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_printer_delete, printer_option_menu); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + gtk_widget_show(hbox); + + + + + /* Saving options notebook page */ + + setup_vbox = gtk_vbox_new(FALSE, 5); + + label = gtk_label_new(NOTEBOOK_SAVING_OPTIONS); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), setup_vbox, label); + gtk_widget_show(setup_vbox); + + frame = gtk_frame_new(0); + gtk_container_set_border_width(GTK_CONTAINER(frame), 4); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); + gtk_box_pack_start(GTK_BOX(setup_vbox), frame, TRUE, TRUE, 0); /* sizeable framehight */ + gtk_widget_show(frame); + + vbox = gtk_vbox_new(FALSE, 1); + gtk_container_add(GTK_CONTAINER(frame), vbox); + gtk_widget_show(vbox); + + xsane_setup.image_permissions = 0777-preferences.image_umask; + xsane_permission_box(vbox, XSANE_GTK_NAME_IMAGE_PERMISSIONS, "Image-file permissions", &xsane_setup.image_permissions, + TRUE /* header */, FALSE /* x sens */, FALSE /* user sens */); + + xsane_setup.directory_permissions = 0777-preferences.directory_umask; + xsane_permission_box(vbox, XSANE_GTK_NAME_DIRECTORY_PERMISSIONS, "Directory permissions", &xsane_setup.directory_permissions, + FALSE /* header */, TRUE /* x sens */, FALSE /* user sens */); + + xsane_separator_new(vbox, 4); + + + /* overwrite warning */ + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + button = gtk_check_button_new_with_label(RADIO_BUTTON_OVERWRITE_WARNING); + xsane_back_gtk_set_tooltip(dialog->tooltips, button, DESC_OVERWRITE_WARNING); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), preferences.overwrite_warning); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 2); + gtk_widget_show(button); + gtk_widget_show(hbox); + xsane_setup.overwrite_warning_button = button; + + /* increase filename counter */ + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + button = gtk_check_button_new_with_label(RADIO_BUTTON_INCREASE_COUNTER); + xsane_back_gtk_set_tooltip(dialog->tooltips, button, DESC_INCREASE_COUNTER); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), preferences.increase_filename_counter); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 2); + gtk_widget_show(button); + gtk_widget_show(hbox); + xsane_setup.increase_filename_counter_button = button; + + /* increase filename counter */ + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + button = gtk_check_button_new_with_label(RADIO_BUTTON_SKIP_EXISTING_NRS); + xsane_back_gtk_set_tooltip(dialog->tooltips, button, DESC_SKIP_EXISTING); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), preferences.skip_existing_numbers); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 2); + gtk_widget_show(button); + gtk_widget_show(hbox); + xsane_setup.skip_existing_numbers_button = button; + +#ifdef HAVE_LIBJPEG + xsane_separator_new(vbox, 4); +#else +#ifdef HAVE_LIBTIFF + xsane_separator_new(vbox, 4); +#else +#ifdef HAVE_LIBPNG +#ifdef HAVE_LIBZ + xsane_separator_new(vbox, 4); +#endif +#endif +#endif +#endif + +#ifdef HAVE_LIBJPEG + xsane_scale_new(GTK_BOX(vbox), TEXT_SETUP_JPEG_QUALITY, DESC_JPEG_QUALITY, 0.0, 100.0, 1.0, 1.0, 0.0, 0, + &preferences.jpeg_quality, (GtkObject **) &xsane_setup.jpeg_image_quality_scale, 0, TRUE); +#else +#ifdef HAVE_LIBTIFF + xsane_scale_new(GTK_BOX(vbox), TEXT_SETUP_JPEG_QUALITY, DESC_JPEG_QUALITY, 0.0, 100.0, 1.0, 1.0, 0.0, 0, + &preferences.jpeg_quality, (GtkObject **) &xsane_setup.jpeg_image_quality_scale, 0, TRUE); +#endif +#endif + +#ifdef HAVE_LIBPNG +#ifdef HAVE_LIBZ + xsane_scale_new(GTK_BOX(vbox), TEXT_SETUP_PNG_COMPRESSION, DESC_PNG_COMPRESSION, 0.0, Z_BEST_COMPRESSION, 1.0, 1.0, 0.0, 0, + &preferences.png_compression, (GtkObject **) &xsane_setup.pnm_image_compression_scale, 0, TRUE); +#endif +#endif + +#ifdef HAVE_LIBTIFF + /* TIFF MULTI BIT IMAGES COMPRESSION */ + + hbox = gtk_hbox_new(FALSE, 2); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 2); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + label = gtk_label_new(TEXT_SETUP_TIFF_COMPRESSION); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + tiff_compression_option_menu = gtk_option_menu_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, tiff_compression_option_menu, DESC_TIFF_COMPRESSION); + gtk_box_pack_end(GTK_BOX(hbox), tiff_compression_option_menu, FALSE, FALSE, 2); + gtk_widget_show(tiff_compression_option_menu); + gtk_widget_show(hbox); + + tiff_compression_menu = gtk_menu_new(); + + for (i=1; i <= TIFF_COMPRESSION_NUMBER; i++) + { + tiff_compression_item = gtk_menu_item_new_with_label(tiff_compression_strings[i-1].name); + gtk_container_add(GTK_CONTAINER(tiff_compression_menu), tiff_compression_item); + gtk_signal_connect(GTK_OBJECT(tiff_compression_item), "activate", + (GtkSignalFunc) xsane_setup_tiff_compression_callback, (void *) tiff_compression_strings[i-1].number); + gtk_widget_show(tiff_compression_item); + if (tiff_compression_strings[i-1].number == preferences.tiff_compression_nr) + { + select = i-1; + } + } + + + gtk_option_menu_set_menu(GTK_OPTION_MENU(tiff_compression_option_menu), tiff_compression_menu); + gtk_option_menu_set_history(GTK_OPTION_MENU(tiff_compression_option_menu), select); + xsane_setup.tiff_compression_nr = preferences.tiff_compression_nr; + + + /* TIFF ONE BIT IMAGES COMPRESSION */ + + hbox = gtk_hbox_new(FALSE, 2); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 2); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + label = gtk_label_new(TEXT_SETUP_TIFF_COMPRESSION_1); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + tiff_compression_option_menu = gtk_option_menu_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, tiff_compression_option_menu, DESC_TIFF_COMPRESSION_1); + gtk_box_pack_end(GTK_BOX(hbox), tiff_compression_option_menu, FALSE, FALSE, 2); + gtk_widget_show(tiff_compression_option_menu); + gtk_widget_show(hbox); + + tiff_compression_menu = gtk_menu_new(); + + for (i=1; i <= TIFF_COMPRESSION1_NUMBER; i++) + { + tiff_compression_item = gtk_menu_item_new_with_label(tiff_compression1_strings[i-1].name); + gtk_container_add(GTK_CONTAINER(tiff_compression_menu), tiff_compression_item); + gtk_signal_connect(GTK_OBJECT(tiff_compression_item), "activate", + (GtkSignalFunc) xsane_setup_tiff_compression_1_callback, (void *) tiff_compression1_strings[i-1].number); + gtk_widget_show(tiff_compression_item); + if (tiff_compression1_strings[i-1].number == preferences.tiff_compression_1_nr) + { + select = i-1; + } + } + + gtk_option_menu_set_menu(GTK_OPTION_MENU(tiff_compression_option_menu), tiff_compression_menu); + gtk_option_menu_set_history(GTK_OPTION_MENU(tiff_compression_option_menu), select); + + xsane_setup.tiff_compression_1_nr = preferences.tiff_compression_1_nr; + +#endif + + xsane_separator_new(vbox, 4); + + + /* apply button */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + button = gtk_button_new_with_label(BUTTON_APPLY); + gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_saving_apply_changes, 0); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + gtk_widget_show(hbox); + + + + + + /* Display options notebook page */ + + setup_vbox = gtk_vbox_new(FALSE, 5); + + label = gtk_label_new(NOTEBOOK_DISPLAY_OPTIONS); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), setup_vbox, label); + gtk_widget_show(setup_vbox); + + frame = gtk_frame_new(0); + gtk_container_set_border_width(GTK_CONTAINER(frame), 4); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); + gtk_box_pack_start(GTK_BOX(setup_vbox), frame, TRUE, TRUE, 0); /* sizeable framehight */ + gtk_widget_show(frame); + + vbox = gtk_vbox_new(FALSE, 1); + gtk_container_add(GTK_CONTAINER(frame), vbox); + gtk_widget_show(vbox); + + /* main window fixed: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + button = gtk_check_button_new_with_label(RADIO_BUTTON_WINDOW_FIXED); + xsane_back_gtk_set_tooltip(dialog->tooltips, button, DESC_MAIN_WINDOW_FIXED); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), preferences.main_window_fixed); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 2); + gtk_widget_show(button); + gtk_widget_show(hbox); + xsane_setup.main_window_fixed_button = button; + + + /* preserve preview image: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + button = gtk_check_button_new_with_label(RADIO_BUTTON_PRESERVE_PRVIEW); + xsane_back_gtk_set_tooltip(dialog->tooltips, button, DESC_PREVIEW_PRESERVE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), preferences.preserve_preview); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 2); + gtk_widget_show(button); + gtk_widget_show(hbox); + xsane_setup.preview_preserve_button = button; + + + /* private colormap: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + button = gtk_check_button_new_with_label(RADIO_BUTTON_PRIVATE_COLORMAP); + xsane_back_gtk_set_tooltip(dialog->tooltips, button, DESC_PREVIEW_COLORMAP); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), preferences.preview_own_cmap); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 2); + gtk_widget_show(button); + gtk_widget_show(hbox); + xsane_setup.preview_own_cmap_button = button; + + + xsane_separator_new(vbox, 2); + + + /* preview gamma correction value: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + gtk_widget_show(hbox); + + label = gtk_label_new(TEXT_SETUP_PREVIEW_GAMMA); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + snprintf(buf, sizeof(buf), "%1.2f", preferences.preview_gamma); + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PREVIEW_GAMMA); + gtk_widget_set_usize(text, 50, 0); + gtk_entry_set_text(GTK_ENTRY(text), buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + xsane_setup.preview_gamma_entry = text; + + /* red preview gamma correction value: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + gtk_widget_show(hbox); + + label = gtk_label_new(TEXT_SETUP_PREVIEW_GAMMA_RED); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + snprintf(buf, sizeof(buf), "%1.2f", preferences.preview_gamma_red); + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PREVIEW_GAMMA_RED); + gtk_widget_set_usize(text, 50, 0); + gtk_entry_set_text(GTK_ENTRY(text), buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + xsane_setup.preview_gamma_red_entry = text; + + /* green preview gamma correction value: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + gtk_widget_show(hbox); + + label = gtk_label_new(TEXT_SETUP_PREVIEW_GAMMA_GREEN); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + snprintf(buf, sizeof(buf), "%1.2f", preferences.preview_gamma_green); + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PREVIEW_GAMMA_GREEN); + gtk_widget_set_usize(text, 50, 0); + gtk_entry_set_text(GTK_ENTRY(text), buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + xsane_setup.preview_gamma_green_entry = text; + + /* blue preview gamma correction value: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + gtk_widget_show(hbox); + + label = gtk_label_new(TEXT_SETUP_PREVIEW_GAMMA_BLUE); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + snprintf(buf, sizeof(buf), "%1.2f", preferences.preview_gamma_blue); + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_PREVIEW_GAMMA_BLUE); + gtk_widget_set_usize(text, 50, 0); + gtk_entry_set_text(GTK_ENTRY(text), buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + xsane_setup.preview_gamma_blue_entry = text; + + + xsane_separator_new(vbox, 2); + + + /* docviewer */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_HELPFILE_VIEWER); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_DOC_VIEWER); + gtk_widget_set_usize(text, 250, 0); + gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.doc_viewer); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.doc_viewer_entry = text; + + + xsane_separator_new(vbox, 4); + + + /* apply button */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + button = gtk_button_new_with_label(BUTTON_APPLY); + gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_display_apply_changes, 0); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + gtk_widget_show(hbox); + + + + + /* Fax options notebook page */ + + setup_vbox = gtk_vbox_new(FALSE, 5); + + label = gtk_label_new(NOTEBOOK_FAX_OPTIONS); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), setup_vbox, label); + gtk_widget_show(setup_vbox); + + frame = gtk_frame_new(0); + gtk_container_set_border_width(GTK_CONTAINER(frame), 4); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); + gtk_box_pack_start(GTK_BOX(setup_vbox), frame, TRUE, TRUE, 0); /* sizeable framehight */ + gtk_widget_show(frame); + + vbox = gtk_vbox_new(FALSE, 1); + gtk_container_add(GTK_CONTAINER(frame), vbox); + gtk_widget_show(vbox); + + /* faxcommand : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_FAX_COMMAND); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_FAX_COMMAND); + gtk_widget_set_usize(text, 250, 0); + gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.fax_command); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.fax_command_entry = text; + + + /* fax receiver option: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_FAX_RECEIVER_OPTION); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_FAX_RECEIVER_OPT); + gtk_widget_set_usize(text, 50, 0); + gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.fax_receiver_option); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.fax_receiver_option_entry = text; + + +/* fax postscript option: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_FAX_POSTSCRIPT_OPT); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_FAX_POSTSCRIPT_OPT); + gtk_widget_set_usize(text, 50, 0); + gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.fax_postscript_option); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.fax_postscript_option_entry = text; + + + /* fax normal mode option : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_FAX_NORMAL_MODE_OPT); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_FAX_NORMAL_OPT); + gtk_widget_set_usize(text, 50, 0); + gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.fax_normal_option); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.fax_normal_option_entry = text; + + + /* fax fine mode option : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_FAX_FINE_MODE_OPT); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_FAX_FINE_OPT); + gtk_widget_set_usize(text, 50, 0); + gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.fax_fine_option); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.fax_fine_option_entry = text; + + + xsane_separator_new(vbox, 2); + + + /* faxviewer */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_FAX_VIEWER); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_FAX_VIEWER); + gtk_widget_set_usize(text, 250, 0); + gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.fax_viewer); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.fax_viewer_entry = text; + + + xsane_separator_new(vbox, 4); + + /* fax width: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_FAX_WIDTH); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_FAX_WIDTH); + gtk_widget_set_usize(text, 50, 0); + snprintf(buf, sizeof(buf), "%3.2f", preferences.fax_width); + gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.fax_width_entry = text; + + /* fax height: */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_FAX_HEIGHT); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_FAX_HEIGHT); + gtk_widget_set_usize(text, 50, 0); + snprintf(buf, sizeof(buf), "%3.2f", preferences.fax_height); + gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.fax_height_entry = text; + + /* fax left offset : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_FAX_LEFT); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_FAX_LEFTOFFSET); + gtk_widget_set_usize(text, 50, 0); + snprintf(buf, sizeof(buf), "%3.2f", preferences.fax_leftoffset); + gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.fax_leftoffset_entry = text; + + /* fax bottom offset : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_FAX_BOTTOM); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(dialog->tooltips, text, DESC_FAX_BOTTOMOFFSET); + gtk_widget_set_usize(text, 50, 0); + snprintf(buf, sizeof(buf), "%3.2f", preferences.fax_bottomoffset); + gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.fax_bottomoffset_entry = text; + + xsane_separator_new(vbox, 4); + + /* apply button */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + button = gtk_button_new_with_label(BUTTON_APPLY); + gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_fax_apply_changes, 0); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + gtk_widget_show(hbox); + + + + + /* fill in action area: */ + hbox = GTK_DIALOG(setup_dialog)->action_area; + + button = gtk_button_new_with_label(BUTTON_OK); + GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_options_ok_callback, setup_dialog); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + gtk_widget_grab_default(button); + gtk_widget_show(button); + + button = gtk_button_new_with_label(BUTTON_CANCEL); + gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_close_setup_dialog_callback, setup_dialog); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + gtk_widget_show(setup_dialog); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ diff --git a/frontend/xsane-setup.h b/frontend/xsane-setup.h new file mode 100644 index 0000000..411faa8 --- /dev/null +++ b/frontend/xsane-setup.h @@ -0,0 +1,33 @@ +/* xsane -- a graphical (X11, gtk) scanner-oriented SANE frontend + + xsane-setup.h + + Oliver Rauch + Copyright (C) 1998-2000 Oliver Rauch + This file is part of the XSANE package. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +#include + +/* ---------------------------------------------------------------------------------------------------------------------- */ + +extern void xsane_new_printer(void); +extern void xsane_update_int(GtkWidget *widget, int *val); +extern void xsane_setup_dialog(GtkWidget *widget, gpointer data); + +/* ---------------------------------------------------------------------------------------------------------------------- */ diff --git a/frontend/xsane-style.rc b/frontend/xsane-style.rc new file mode 100644 index 0000000..de6662d --- /dev/null +++ b/frontend/xsane-style.rc @@ -0,0 +1,34 @@ +# style [= ] +# { +#