diff -urNP ../siag-3.3.8/ChangeLog ./ChangeLog --- ../siag-3.3.8/ChangeLog Thu May 25 17:39:03 2000 +++ ./ChangeLog Thu Jun 15 08:25:33 2000 @@ -1,4 +1,27 @@ +000615 Fixed a bunch of compiler warnings in Xfiler. + Released 3.3.9. + +000613 Egon: margins and paper sizes for printing. Removed print.c. + +000607 Egon: format stubs for HTML, MagicPoint and plain text. + Powerpoint support through pptHtml (added register-converters + in egon.scm). + Moved fileio_ps.c to xegon and implemented printing! + +000606 Egon: background gradients. + +000601 Changed grab mode in dialog_input to XtGrabExclusive. + +000531 Egon: added the necessary code for multiple buffers and sheets. + +000530 Egon: reversed the user interface, so that it is the stage that + is popped up from the editing interface. + Egon: make a full-screen stage if the size is specified as 0x0. + +000526 Egon's default size changed from 600x400 to the same size + as the root window. + 000525 common/common.c/spawn: close the child's stderr to avoid popping up its error messages. xcommon/fonts.c: new function ps_set_color to set the color diff -urNP ../siag-3.3.8/TODO ./TODO --- ../siag-3.3.8/TODO Wed May 17 10:58:08 2000 +++ ./TODO Sun May 28 23:10:55 2000 @@ -1,4 +1,35 @@ +LaTeX plugin: wrap a single line in this: + \documentclass{article} + \pagestyle{empty} + \thispagestyle{empty} + \begin{document} + the line the user typed + \end{document} +Call LaTeX on the result, then dvips to get an eps image which can be +displayed in a Ghostscript widget. The whole thing will be very similar +to the clipart plugin. One use will be as a formula editor, where +mathematical formulas can be written like this example: + $$ a(k,l) = (\sum_{i=k}^l X_i) \bmod M $$ +This isn't necessarily the most WYSIWYG formula editor ever designed, +but it will no doubt produce good results. Mathematicians are expected +to grok symbolic language anyway. +This functionality can be added to the existing clipart plugin, simply +by letting it handle files with the extensions tex and dvi differently. +The new behaviour is: +1. If extension is tex, call "latex filename.tex" and proceed with 2. +2. If extension is dvi, call "dvips -E filename.dvi" and proceed with 3. +3. Load file as postscript. +The clipart plugin needs a few enhancements. It isn't currently very +good at figuring out its own geometry. To do this we should look for +a BoundingBox line: + %%BoundingBox: x1 y1 x2 y2 +I *think* that this information is already picked up somehow, otherwise +it wouldn't display the right part of the image. But I don't know +if it is the clipart code or the widget that does it. +Finally, a way to edit the TeX code would be useful: click on the +window to pop up a text widget or even a text editor such as XedPlus. + Plugins should go into $prefix/lib rather than $prefix/libexec in order to be FHS compliant. diff -urNP ../siag-3.3.8/acinclude.m4 ./acinclude.m4 --- ../siag-3.3.8/acinclude.m4 Mon May 8 07:29:45 2000 +++ ./acinclude.m4 Thu Jun 15 07:04:20 2000 @@ -199,23 +199,23 @@ dnl Try to figure out what libraries are required for xmagick dnl Mostly snarfed from ImageMagick configure script -AC_DEFUN(AC_CHECK_XMAGICK, -[ -AC_CHECK_LIB(m, sqrt) -AC_CHECK_LIB(z, compress) -AC_CHECK_LIB(bz2, bzBuffToBuffCompress) -AC_CHECK_LIB(dnet, dnet_ntoa) -AC_CHECK_LIB(dps, DPSInitialize) -AC_CHECK_LIB(dpstk, XDPSPixelsPerPoint) -AC_CHECK_LIB(fpx, FPX_OpenImageByFilename) -AC_CHECK_LIB(png, png_info_init) -AC_CHECK_LIB(jpeg, jpeg_read_header) -AC_CHECK_LIB(ttf, TT_Init_FreeType) -AC_CHECK_LIB(tiff, TIFFOpen) -AC_CHECK_LIB(df, DFANputlabel) -AC_CHECK_LIB(jbig, jbg_dec_init) -AC_CHECK_LIB(socket, socket) -AC_CHECK_LIB(nsl, gethostbyname) -AC_CHECK_LIB(Magick, main) -]) +dnl AC_DEFUN(AC_CHECK_XMAGICK, +dnl [ +dnl AC_CHECK_LIB(m, sqrt) +dnl AC_CHECK_LIB(z, compress) +dnl AC_CHECK_LIB(bz2, bzBuffToBuffCompress) +dnl AC_CHECK_LIB(dnet, dnet_ntoa) +dnl AC_CHECK_LIB(dps, DPSInitialize) +dnl AC_CHECK_LIB(dpstk, XDPSPixelsPerPoint) +dnl AC_CHECK_LIB(fpx, FPX_OpenImageByFilename) +dnl AC_CHECK_LIB(png, png_info_init) +dnl AC_CHECK_LIB(jpeg, jpeg_read_header) +dnl AC_CHECK_LIB(ttf, TT_Init_FreeType) +dnl AC_CHECK_LIB(tiff, TIFFOpen) +dnl AC_CHECK_LIB(df, DFANputlabel) +dnl AC_CHECK_LIB(jbig, jbg_dec_init) +dnl AC_CHECK_LIB(socket, socket) +dnl AC_CHECK_LIB(nsl, gethostbyname) +dnl AC_CHECK_LIB(Magick, main) +dnl ]) diff -urNP ../siag-3.3.8/aclocal.m4 ./aclocal.m4 --- ../siag-3.3.8/aclocal.m4 Tue May 23 11:13:21 2000 +++ ./aclocal.m4 Thu Jun 15 07:04:40 2000 @@ -211,25 +211,25 @@ dnl Try to figure out what libraries are required for xmagick dnl Mostly snarfed from ImageMagick configure script -AC_DEFUN(AC_CHECK_XMAGICK, -[ -AC_CHECK_LIB(m, sqrt) -AC_CHECK_LIB(z, compress) -AC_CHECK_LIB(bz2, bzBuffToBuffCompress) -AC_CHECK_LIB(dnet, dnet_ntoa) -AC_CHECK_LIB(dps, DPSInitialize) -AC_CHECK_LIB(dpstk, XDPSPixelsPerPoint) -AC_CHECK_LIB(fpx, FPX_OpenImageByFilename) -AC_CHECK_LIB(png, png_info_init) -AC_CHECK_LIB(jpeg, jpeg_read_header) -AC_CHECK_LIB(ttf, TT_Init_FreeType) -AC_CHECK_LIB(tiff, TIFFOpen) -AC_CHECK_LIB(df, DFANputlabel) -AC_CHECK_LIB(jbig, jbg_dec_init) -AC_CHECK_LIB(socket, socket) -AC_CHECK_LIB(nsl, gethostbyname) -AC_CHECK_LIB(Magick, main) -]) +dnl AC_DEFUN(AC_CHECK_XMAGICK, +dnl [ +dnl AC_CHECK_LIB(m, sqrt) +dnl AC_CHECK_LIB(z, compress) +dnl AC_CHECK_LIB(bz2, bzBuffToBuffCompress) +dnl AC_CHECK_LIB(dnet, dnet_ntoa) +dnl AC_CHECK_LIB(dps, DPSInitialize) +dnl AC_CHECK_LIB(dpstk, XDPSPixelsPerPoint) +dnl AC_CHECK_LIB(fpx, FPX_OpenImageByFilename) +dnl AC_CHECK_LIB(png, png_info_init) +dnl AC_CHECK_LIB(jpeg, jpeg_read_header) +dnl AC_CHECK_LIB(ttf, TT_Init_FreeType) +dnl AC_CHECK_LIB(tiff, TIFFOpen) +dnl AC_CHECK_LIB(df, DFANputlabel) +dnl AC_CHECK_LIB(jbig, jbg_dec_init) +dnl AC_CHECK_LIB(socket, socket) +dnl AC_CHECK_LIB(nsl, gethostbyname) +dnl AC_CHECK_LIB(Magick, main) +dnl ]) # Define a conditional. diff -urNP ../siag-3.3.8/config.h.in ./config.h.in --- ../siag-3.3.8/config.h.in Thu Apr 6 14:52:55 2000 +++ ./config.h.in Thu Jun 15 07:05:08 2000 @@ -204,59 +204,20 @@ /* Define if you have the header file. */ #undef HAVE_SYS_NDIR_H -/* Define if you have the Magick library (-lMagick). */ -#undef HAVE_LIBMAGICK - -/* Define if you have the bz2 library (-lbz2). */ -#undef HAVE_LIBBZ2 - -/* Define if you have the df library (-ldf). */ -#undef HAVE_LIBDF - -/* Define if you have the dnet library (-ldnet). */ -#undef HAVE_LIBDNET - -/* Define if you have the dps library (-ldps). */ -#undef HAVE_LIBDPS - -/* Define if you have the dpstk library (-ldpstk). */ -#undef HAVE_LIBDPSTK - -/* Define if you have the fpx library (-lfpx). */ -#undef HAVE_LIBFPX - /* Define if you have the gen library (-lgen). */ #undef HAVE_LIBGEN -/* Define if you have the jbig library (-ljbig). */ -#undef HAVE_LIBJBIG - -/* Define if you have the jpeg library (-ljpeg). */ -#undef HAVE_LIBJPEG - /* Define if you have the m library (-lm). */ #undef HAVE_LIBM /* Define if you have the nsl library (-lnsl). */ #undef HAVE_LIBNSL -/* Define if you have the png library (-lpng). */ -#undef HAVE_LIBPNG - /* Define if you have the pthread library (-lpthread). */ #undef HAVE_LIBPTHREAD /* Define if you have the socket library (-lsocket). */ #undef HAVE_LIBSOCKET - -/* Define if you have the tiff library (-ltiff). */ -#undef HAVE_LIBTIFF - -/* Define if you have the ttf library (-lttf). */ -#undef HAVE_LIBTTF - -/* Define if you have the z library (-lz). */ -#undef HAVE_LIBZ /* Name of package */ #undef PACKAGE diff -urNP ../siag-3.3.8/configure ./configure --- ../siag-3.3.8/configure Tue May 23 11:14:33 2000 +++ ./configure Thu Jun 15 07:04:47 2000 @@ -706,7 +706,7 @@ PACKAGE=siag -VERSION=3.3.8 +VERSION=3.3.9 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -4990,756 +4990,6 @@ fi - - - -echo $ac_n "checking for sqrt in -lm""... $ac_c" 1>&6 -echo "configure:4998: 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 compress in -lz""... $ac_c" 1>&6 -echo "configure:5045: checking for compress in -lz" >&5 -ac_lib_var=`echo z'_'compress | 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 - -echo $ac_n "checking for bzBuffToBuffCompress in -lbz2""... $ac_c" 1>&6 -echo "configure:5092: checking for bzBuffToBuffCompress in -lbz2" >&5 -ac_lib_var=`echo bz2'_'bzBuffToBuffCompress | 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="-lbz2 $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 bz2 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - -echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:5139: checking for dnet_ntoa in -ldnet" >&5 -ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldnet $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 dnet | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - -echo $ac_n "checking for DPSInitialize in -ldps""... $ac_c" 1>&6 -echo "configure:5186: checking for DPSInitialize in -ldps" >&5 -ac_lib_var=`echo dps'_'DPSInitialize | 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="-ldps $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 dps | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - -echo $ac_n "checking for XDPSPixelsPerPoint in -ldpstk""... $ac_c" 1>&6 -echo "configure:5233: checking for XDPSPixelsPerPoint in -ldpstk" >&5 -ac_lib_var=`echo dpstk'_'XDPSPixelsPerPoint | 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="-ldpstk $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 dpstk | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - -echo $ac_n "checking for FPX_OpenImageByFilename in -lfpx""... $ac_c" 1>&6 -echo "configure:5280: checking for FPX_OpenImageByFilename in -lfpx" >&5 -ac_lib_var=`echo fpx'_'FPX_OpenImageByFilename | 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="-lfpx $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 fpx | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - -echo $ac_n "checking for png_info_init in -lpng""... $ac_c" 1>&6 -echo "configure:5327: checking for png_info_init in -lpng" >&5 -ac_lib_var=`echo png'_'png_info_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="-lpng $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 - -echo $ac_n "checking for jpeg_read_header in -ljpeg""... $ac_c" 1>&6 -echo "configure:5374: checking for jpeg_read_header in -ljpeg" >&5 -ac_lib_var=`echo jpeg'_'jpeg_read_header | 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 - -echo $ac_n "checking for TT_Init_FreeType in -lttf""... $ac_c" 1>&6 -echo "configure:5421: checking for TT_Init_FreeType in -lttf" >&5 -ac_lib_var=`echo ttf'_'TT_Init_FreeType | 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="-lttf $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 ttf | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - -echo $ac_n "checking for TIFFOpen in -ltiff""... $ac_c" 1>&6 -echo "configure:5468: 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 - -echo $ac_n "checking for DFANputlabel in -ldf""... $ac_c" 1>&6 -echo "configure:5515: checking for DFANputlabel in -ldf" >&5 -ac_lib_var=`echo df'_'DFANputlabel | 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="-ldf $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 df | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - -echo $ac_n "checking for jbg_dec_init in -ljbig""... $ac_c" 1>&6 -echo "configure:5562: checking for jbg_dec_init in -ljbig" >&5 -ac_lib_var=`echo jbig'_'jbg_dec_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="-ljbig $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 jbig | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - -echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:5609: checking for socket in -lsocket" >&5 -ac_lib_var=`echo socket'_'socket | 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="-lsocket $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 socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - -echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:5656: checking for gethostbyname in -lnsl" >&5 -ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lnsl $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 nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - -echo $ac_n "checking for main in -lMagick""... $ac_c" 1>&6 -echo "configure:5703: checking for main in -lMagick" >&5 -ac_lib_var=`echo Magick'_'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="-lMagick $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 Magick | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi diff -urNP ../siag-3.3.8/configure.in ./configure.in --- ../siag-3.3.8/configure.in Fri May 19 08:01:55 2000 +++ ./configure.in Thu Jun 15 07:04:36 2000 @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(README) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(siag, 3.3.8) +AM_INIT_AUTOMAKE(siag, 3.3.9) dnl Set of available languages dnl ALL_LINGUAS="" @@ -59,7 +59,7 @@ dnl Check things for Siag AC_CHECK_SIAG -AC_CHECK_XMAGICK +dnl AC_CHECK_XMAGICK dnl Configure XawM AC_CONFIG_SUBDIRS(XawM) diff -urNP ../siag-3.3.8/egon/Makefile.am ./egon/Makefile.am --- ../siag-3.3.8/egon/Makefile.am Wed Mar 17 14:07:52 1999 +++ ./egon/Makefile.am Tue Jun 13 22:18:11 2000 @@ -4,8 +4,9 @@ noinst_LIBRARIES = libegon.a libegon_a_SOURCES = main.c railway.c matrix.c fileio.c cmds.c \ - buffer.c print.c \ - fileio_egon.c fileio_c.c fileio_ps.c fileio_scm.c \ + buffer.c \ + fileio_egon.c fileio_c.c fileio_scm.c \ + fileio_html.c fileio_mgp.c fileio_txt.c \ siodi.c guilei.c tcli.c pythoni.c noinst_HEADERS = egon.h types.h user_interface.h diff -urNP ../siag-3.3.8/egon/Makefile.in ./egon/Makefile.in --- ../siag-3.3.8/egon/Makefile.in Fri May 26 08:26:58 2000 +++ ./egon/Makefile.in Thu Jun 15 08:25:51 2000 @@ -87,7 +87,7 @@ noinst_LIBRARIES = libegon.a -libegon_a_SOURCES = main.c railway.c matrix.c fileio.c cmds.c buffer.c print.c fileio_egon.c fileio_c.c fileio_ps.c fileio_scm.c siodi.c guilei.c tcli.c pythoni.c +libegon_a_SOURCES = main.c railway.c matrix.c fileio.c cmds.c buffer.c fileio_egon.c fileio_c.c fileio_scm.c fileio_html.c fileio_mgp.c fileio_txt.c siodi.c guilei.c tcli.c pythoni.c noinst_HEADERS = egon.h types.h user_interface.h @@ -113,8 +113,8 @@ X_PRE_LIBS = @X_PRE_LIBS@ libegon_a_LIBADD = libegon_a_OBJECTS = main.o railway.o matrix.o fileio.o cmds.o buffer.o \ -print.o fileio_egon.o fileio_c.o fileio_ps.o fileio_scm.o siodi.o \ -guilei.o tcli.o pythoni.o +fileio_egon.o fileio_c.o fileio_scm.o fileio_html.o fileio_mgp.o \ +fileio_txt.o siodi.o guilei.o tcli.o pythoni.o AR = ar CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -318,27 +318,14 @@ user_interface.h fileio.o: fileio.c egon.h ../common/fonts.h types.h ../common/common.h \ ../common/cmalloc.h user_interface.h -fileio_c.o: fileio_c.c egon.h ../common/fonts.h types.h \ +fileio_html.o: fileio_html.c egon.h ../common/fonts.h types.h \ ../common/common.h -fileio_egon.o: fileio_egon.c ../common/oldfonts.h egon.h \ - ../common/fonts.h types.h user_interface.h ../common/common.h \ - ../common/cmalloc.h ../common/plugin.h -fileio_ps.o: fileio_ps.c egon.h ../common/fonts.h types.h \ +fileio_mgp.o: fileio_mgp.c egon.h ../common/fonts.h types.h \ ../common/common.h -fileio_scm.o: fileio_scm.c egon.h ../common/fonts.h types.h \ - user_interface.h ../common/common.h ../common/cmalloc.h -guilei.o: guilei.c -main.o: main.c egon.h ../common/fonts.h types.h user_interface.h \ - ../common/common.h ../common/cmalloc.h ../siod/siod.h -matrix.o: matrix.c egon.h ../common/fonts.h types.h ../common/cmalloc.h \ +fileio_ps.o: fileio_ps.c egon.h ../common/fonts.h types.h \ ../common/common.h -print.o: print.c ../common/common.h types.h egon.h ../common/fonts.h -pythoni.o: pythoni.c -railway.o: railway.c types.h egon.h ../common/fonts.h ../siod/siod.h \ - ../common/common.h ../common/cmalloc.h -siodi.o: siodi.c types.h egon.h ../common/fonts.h ../siod/siod.h \ +fileio_txt.o: fileio_txt.c egon.h ../common/fonts.h types.h \ ../common/common.h -tcli.o: tcli.c info-am: info: info-recursive diff -urNP ../siag-3.3.8/egon/buffer.c ./egon/buffer.c --- ../siag-3.3.8/egon/buffer.c Thu Apr 6 14:53:10 2000 +++ ./egon/buffer.c Thu Jun 15 06:58:04 2000 @@ -1,6 +1,6 @@ /* Egon Animator - Copyright (C) 1997 Ulric Eriksson + Copyright (C) 1997-2000 Ulric Eriksson 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 @@ -39,6 +39,18 @@ a function for finding a certain buffer, given its name. --- */ +char *paper_name = "A4"; +int paper_height = 842; +int paper_width = 595; +int left_margin = 72, right_margin = 72, top_margin = 72, bottom_margin = 72; +int header_margin = 36, footer_margin = 36; +char *header = "&n"; /* buffer name */ +char *footer = "&p"; /* page number */ +int header_on_first = 1; +int first_page_number = 1; +int orientation = LANDSCAPE; +int tab_distance = 36; + buffer *b_list; static int unique_name(char *p) @@ -78,6 +90,73 @@ return name; /* unlikely and no problem */ } +sheet new_sheet(void) +{ + sheet s; + char *p = "Empty Sheet"; + s.name = cstrdup(p); + s.cast = NULL; + s.delta = 100; + s.duration = 1000; + s.bg = NULL; + s.bgrad = cstrdup("100 100 128 0 1 black blue"); + s.now = 0; + s.plugin = NULL; + s.nplugin = 0; + return s; +} + +static int sheet_name_taken(buffer *b, char *n) +{ + int i; + + for (i = 0; i < b->nsht; i++) + if (!strcmp(b->sht[i].name, n)) return 1; + return 0; +} + +int buffer_add_sheet(buffer *b, int n) +{ + int i; + char name[1000]; + + if (n < 0 || n > b->nsht) return b->nsht; + + b->nsht++; + b->sht = (sheet *)crealloc(b->sht, b->nsht*sizeof(sheet)); + for (i = b->nsht-1; i > n; i--) { + b->sht[i] = b->sht[i-1]; + } + b->sht[n] = new_sheet(); + cfree(b->sht[n].name); + + for (i = b->nsht; i < 1000; i++) { + sprintf(name, _("Sheet %d"), i); + if (!sheet_name_taken(b, name)) break; + } + b->sht[n].name = cstrdup(name); + return b->nsht; +} + +int buffer_remove_sheet(buffer *b, int n) +{ + int i; + + if (n < 0 || n >= b->nsht || b->nsht <= 1) return b->nsht; + b->nsht--; + for (i = n; i < b->nsht; i++) { + b->sht[i] = b->sht[i+1]; + } + return b->nsht; +} + +void buffer_rename_sheet(buffer *b, int n, char *name) +{ + if (n < 0 || n > b->nsht) return; + cfree(b->sht[n].name); + b->sht[n].name = cstrdup(name); +} + /* --- Creates a new buffer with name as name. It is the responsability of the caller to make sure that the name is unique. The new buffer is @@ -96,19 +175,29 @@ b->next = b_list->next; /* add to list */ b_list->next = b; - b->cast = NULL; - strcpy(b->name, name); - strcpy(b->path, path); - b->delta = 100; - b->duration = 1000; + b->sht = NULL; + b->nsht = 0; + buffer_add_sheet(b, 0); + strncpy(b->name, name, 1000); + strncpy(b->path, path, 1000); b->width = 600; b->height = 400; - b->bg = NULL; b->change = FALSE; - b->now = 0; b->state = ANI_STOP; - b->plugin = NULL; - b->nplugin = 0; + b->paper_name = paper_name; + b->paper_width = paper_width; + b->paper_height = paper_height; + b->top_margin = top_margin; + b->bottom_margin = bottom_margin; + b->left_margin = left_margin; + b->right_margin = right_margin; + b->header_margin = header_margin; + b->footer_margin = footer_margin; + b->header = header; + b->footer = footer; + b->header_on_first = header_on_first; + b->first_page_number = first_page_number; + b->orientation = orientation; return b; } @@ -149,11 +238,16 @@ static int plugin_name_taken(char *name) { buffer *b = b_list; + int s = 0; int i; do { - for (i = 0; i < b->nplugin; i++) - if (!strcmp(b->plugin[i].name, name)) return 1; + for (s = 0; s < b->nsht; s++) { + for (i = 0; i < b->sht[s].nplugin; i++) { + if (!strcmp(b->sht[s].plugin[i].name, name)) + return 1; + } + } b = b->next; } while (b != b_list); return 0; @@ -197,6 +291,7 @@ buffer *find_buffer_by_name(char *name) { buffer *b; + int s; if ((b = b_list) == NULL) return NULL; @@ -204,12 +299,54 @@ do { if (!strcmp(name, b->name)) return b; + for (s = 0; s < b->nsht; s++) { + if (!strcmp(name, b->sht[s].name)) return b; + } b = b->next; } while (b != b_list); return NULL; } +buffer *find_sheet_by_name(char *name, buffer *defb, int *s) +{ + buffer *b; + char bname[1000], sname[1000]; + char *p; + + if (b_list == NULL) return NULL; + + p = strchr(name, ':'); + if (!p) { + b = defb; + strncpy(sname, name, 999); + sname[999] = '\0'; + } else { + size_t n = p-name; + if (n == 0) { + b = defb; + } else { + if (n > 999) n = 999; + strncpy(bname, name, n); + bname[n] = '\0'; + b = find_buffer_by_name(bname); + } + strncpy(sname, p+1, 999); + sname[999] = '\0'; + } + if (!b) return NULL; + + if (sname[0] == '\0') { + *s = 0; + return b; + } + for (*s = 0; *s < b->nsht; (*s)++) { + if (!strcmp(sname, b->sht[*s].name)) return b; + } + return NULL; +} + + /* --- Get the plugin's index in this buffer. */ @@ -217,11 +354,12 @@ int buffer_plugin2index(buffer *buf, int ph) { int n; + int sht = w_list->sht; if (!buf) return -1; - for (n = 0; n < buf->nplugin; n++) - if (ph == buf->plugin[n].ph) return n; + for (n = 0; n < buf->sht[sht].nplugin; n++) + if (ph == buf->sht[sht].plugin[n].ph) return n; return -1; } diff -urNP ../siag-3.3.8/egon/cmds.c ./egon/cmds.c --- ../siag-3.3.8/egon/cmds.c Fri May 5 11:53:22 2000 +++ ./egon/cmds.c Thu Jun 15 06:59:29 2000 @@ -1,6 +1,6 @@ /* Egon Animator - Copyright (C) 1997-1999 Ulric Eriksson + Copyright (C) 1997-2000 Ulric Eriksson 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 @@ -267,6 +267,29 @@ return NIL; } +static LISP lsavematrix(LISP path, LISP bname, LISP format) +{ + char *p, *fmt; + buffer *b; + + if (NULLP(bname)) b = w_list->buf; + else b = find_buffer_by_name(get_c_string(bname)); + if (!b) { + llpr("No such buffer"); + return NIL; + } + p = get_c_string(path); + if (NULLP(format)) fmt = guess_file_format(p); + else fmt = get_c_string(format); + + if (savematrix(p, b, fmt)) { + llpr("File saved"); + return NIL; + } else { + return a_true_value(); + } +} + /* --- Save the buffer in the currently active window to a named file. */ @@ -411,24 +434,12 @@ return NIL; } -/* --- -*/ -static LISP preview_block(void) -{ - preview(); - return NIL; -} -/* --- -*/ -static LISP print_block(void) -{ - int nr, nk; +extern char *psformat; - nr = 0; - nk = 0; - printer(); - return NIL; +static LISP lpsformat(void) +{ + return strcons(strlen(psformat), psformat); } /* --- @@ -634,13 +645,15 @@ static LISP ani_begin(void) { buffer *b = w_list->buf; + int sht = w_list->sht; + sheet *s = &b->sht[sht]; /* should free old objects first */ - b->cast = NULL; - b->delta = 100; - b->duration = 1000; + s->cast = NULL; + s->delta = 100; + s->duration = 1000; b->width = 600; b->height = 400; - b->bg = NULL; + s->bg = NULL; b->change = TRUE; w_list->object = NULL; w_list->script = NULL; @@ -655,7 +668,8 @@ { char *string = get_c_string(name); - ani_object *o = w_list->buf->cast; + int sht = w_list->sht; + ani_object *o = w_list->buf->sht[sht].cast; while (o) { if (!strcmp(o->name, string)) break; @@ -703,13 +717,14 @@ ani_object *lasto = w_list->object, *newo; ani_script *lasts; int t = get_c_long(obj); + int sht = w_list->sht; newo = (ani_object *)cmalloc(sizeof(ani_object)); if (lasto) { /* put newo after lasto */ newo->next = lasto->next; lasto->next = newo; } else { /* put newo first in object list */ - b->cast = newo; + b->sht[sht].cast = newo; newo->next = NULL; } w_list->object = newo; @@ -756,15 +771,16 @@ static LISP del_object(void) { buffer *b = w_list->buf; + int sht = w_list->sht; ani_object *o = w_list->object; - ani_object *o1 = w_list->buf->cast; + ani_object *o1 = w_list->buf->sht[sht].cast; if (!o) { llpr("None selected"); return NIL; } if (o == o1) { /* first object */ - w_list->buf->cast = o->next; + w_list->buf->sht[sht].cast = o->next; w_list->object = o->next; } else { /* some other object; find the one before */ while (o1->next != o) o1 = o1->next; @@ -811,8 +827,13 @@ static LISP ani_background(LISP bgp) { buffer *b = w_list->buf; - if (b->bg) cfree(b->bg); - b->bg = cstrdup(get_c_string(bgp)); + int sht = w_list->sht; + if (b->sht[sht].bg) cfree(b->sht[sht].bg); + if (NULLP(bgp)) { + b->sht[sht].bg = NULL; + } else { + b->sht[sht].bg = cstrdup(get_c_string(bgp)); + } b->change = TRUE; pr_scr_flag = TRUE; return NIL; @@ -820,6 +841,31 @@ /* --- */ +static LISP ani_bgrad(LISP bgp) +{ + buffer *b = w_list->buf; + int sht = w_list->sht; + if (b->sht[sht].bgrad) cfree(b->sht[sht].bgrad); + if (NULLP(bgp)) { + b->sht[sht].bgrad = NULL; + } else { + b->sht[sht].bgrad = cstrdup(get_c_string(bgp)); + } + b->change = TRUE; + pr_scr_flag = TRUE; + return NIL; +} + +static LISP get_bgrad(void) +{ + buffer *b = w_list->buf; + int sht = w_list->sht; + if (b->sht[sht].bgrad) return strcons(-1, b->sht[sht].bgrad); + return strcons(-1, ""); +} + +/* --- +*/ static LISP ani_time(LISP tim) { ani_object *o = w_list->object; @@ -851,7 +897,8 @@ static LISP lani_duration(LISP tim) { buffer *b = w_list->buf; - b->duration = get_c_long(tim); + int sht = w_list->sht; + b->sht[sht].duration = get_c_long(tim); pr_scr_flag = TRUE; return NIL; } @@ -861,7 +908,8 @@ static LISP lani_delta(LISP tim) { buffer *b = w_list->buf; - b->delta = get_c_long(tim); + int sht = w_list->sht; + b->sht[sht].delta = get_c_long(tim); pr_scr_flag = TRUE; return NIL; } @@ -941,6 +989,77 @@ get_c_long(b))); } +static LISP ladd_sheet(void) +{ + buffer *b = w_list->buf; + int n = b->nsht; + int m = buffer_add_sheet(b, n); + pr_scr_flag = 1; + b->change = 1; + return flocons(m); +} + +static LISP lremove_sheet(void) +{ + buffer *b = w_list->buf; + int m; + pr_scr_flag = 1; + b->change = 1; + m = buffer_remove_sheet(b, w_list->sht); + if (w_list->sht >= m) { + w_list->sht = m-1; + } + return flocons(m); +} + +static LISP lrename_sheet(void) +{ + char name[1000]; + buffer *b = w_list->buf; + strcpy(name, b->sht[w_list->sht].name); + if (ask_for_str("Name: ", name)) { + buffer_rename_sheet(b, w_list->sht, name); + pr_scr_flag = 1; + b->change = 1; + } + return NIL; +} + +static LISP lmove_sheet(LISP f, LISP t) +{ + int from = get_c_long(f); + int to = get_c_long(t); + buffer *b = w_list->buf; + int nsht = b->nsht; + sheet sht; + int i; + + if (from < 0 || from >= nsht || to < -1 || to >= nsht) + return NIL; + + if (to == -1) to = nsht-1; + + sht = b->sht[from]; + + for (i = from; i < nsht-1; i++) + b->sht[i] = b->sht[i+1]; + + for (i = nsht-1; i > to; i--) + b->sht[i] = b->sht[i-1]; + + b->sht[to] = sht; + + w_list->sht = to; + + pr_scr_flag = 1; + b->change = 1; + return NIL; +} + +static LISP lget_sheet(void) +{ + return flocons(w_list->sht); +} /* --- */ @@ -1067,6 +1186,7 @@ buffer *buf = w_list->buf; int n; plugin_t plugin; + int sht = w_list->sht; /* ask for file name */ if (path[0] == '\0') getcwd(path, 1024); @@ -1104,10 +1224,10 @@ if (plugin.ph == -1) return; /* prepare the buffer */ - n = buf->nplugin++; - buf->plugin = (plugin_t *)crealloc(buf->plugin, - buf->nplugin*sizeof(plugin_t)); - buf->plugin[n] = plugin; + n = buf->sht[sht].nplugin++; + buf->sht[sht].plugin = (plugin_t *)crealloc(buf->sht[sht].plugin, + buf->sht[sht].nplugin*sizeof(plugin_t)); + buf->sht[sht].plugin[n] = plugin; buf->change = TRUE; pr_scr_flag = TRUE; } @@ -1138,11 +1258,12 @@ { char *plugin[20]; int i; + int sht = w_list->sht; - if (b->nplugin == 0) return -1; - if (b->nplugin == 1) return 0; - for (i = 0; i < 20 && i < b->nplugin; i++) - plugin[i] = b->plugin[i].name; + if (b->sht[sht].nplugin == 0) return -1; + if (b->sht[sht].nplugin == 1) return 0; + for (i = 0; i < 20 && i < b->sht[sht].nplugin; i++) + plugin[i] = b->sht[sht].plugin[i].name; i = select_from_list("Select Plugin:", plugin, i); return i; } @@ -1157,6 +1278,7 @@ int n; char fn[1024], pn[1024], cmd[1024], path[1024], fmt[80]; buffer *buf = w_list->buf; + int sht = w_list->sht; /* pick plugin from list */ n = select_plugin(buf); @@ -1165,11 +1287,12 @@ /* get description of the handler */ /* ask for file name */ getcwd(path, 1024); - strcpy(fn, buf->plugin[n].name); + strcpy(fn, buf->sht[sht].plugin[n].name); if (!select_file(path, fn, NULL, fmt, 1)) return NIL; /* save the file */ - sprintf(pn, "%s/%s", plugin_basedir(buf, NULL), buf->plugin[n].name); + sprintf(pn, "%s/%s", plugin_basedir(buf, NULL), + buf->sht[sht].plugin[n].name); sprintf(cmd, "cp %s %s/%s", pn, path, fn); system(cmd); return NIL; @@ -1179,17 +1302,18 @@ { int n; buffer *buf = w_list->buf; + int sht = w_list->sht; /* pick plugin from list */ n = select_plugin(buf); if (n == -1) return NIL; /* remove plugin */ - plugin_stop(buf->plugin[n].ph); - cfree(buf->plugin[n].name); - buf->nplugin--; - for (; n < buf->nplugin; n++) - buf->plugin[n] = buf->plugin[n+1]; + plugin_stop(buf->sht[sht].plugin[n].ph); + cfree(buf->sht[sht].plugin[n].name); + buf->sht[sht].nplugin--; + for (; n < buf->sht[sht].nplugin; n++) + buf->sht[sht].plugin[n] = buf->sht[sht].plugin[n+1]; buf->change = pr_scr_flag = TRUE; return NIL; } @@ -1198,17 +1322,225 @@ { int n; buffer *buf = w_list->buf; + int sht = w_list->sht; /* pick plugin from list */ n = select_plugin(buf); if (n == -1) return NIL; - buf->plugin[n].row = 1; - buf->plugin[n].col = 1; + buf->sht[sht].plugin[n].row = 1; + buf->sht[sht].plugin[n].col = 1; buf->change = pr_scr_flag = TRUE; return NIL; } +static LISP lpaper_get(LISP b) +{ + char *n; + int w, h, o; + if (NULLP(b)) { + n = paper_name; + w = paper_width; + h = paper_height; + o = orientation; + } else { + buffer *buf; + char *bn = get_c_string(b); + if (bn[0]) buf = find_buffer_by_name(bn); + else buf = w_list->buf; + if (!buf) return NIL; + n = buf->paper_name; + w = buf->paper_width; + h = buf->paper_height; + o = buf->orientation; + } + return cons(strcons(strlen(n), n), + cons(flocons(w), + cons(flocons(h), + cons(flocons(o), NIL)))); +} + +static LISP lpaper_set(LISP b, LISP p) +{ + char *n; + int w, h, o; + + n = cstrdup(get_c_string(CAR(p))); + w = get_c_long(CAR(CDR(p))); + h = get_c_long(CAR(CDR(CDR(p)))); + o = get_c_long(CAR(CDR(CDR(CDR(p))))); + if (NULLP(b)) { + paper_name = n; + paper_width = w; + paper_height = h; + orientation = o; + } else { + buffer *buf; + char *bn = get_c_string(b); + if (bn[0]) buf = find_buffer_by_name(bn); + else buf = w_list->buf; + if (!buf) return NIL; + buf->paper_name = n; + buf->paper_width = w; + buf->paper_height = h; + buf->orientation = o; + buf->change = pr_scr_flag = TRUE; + } + return NIL; +} + +static LISP lmargin_get(LISP b) +{ + int tm, bm, lm, rm, hm, fm; + + if (NULLP(b)) { + tm = top_margin; + bm = bottom_margin; + lm = left_margin; + rm = right_margin; + hm = header_margin; + fm = footer_margin; + } else { + buffer *buf; + char *bn = get_c_string(b); + if (bn[0]) buf = find_buffer_by_name(bn); + else buf = w_list->buf; + if (!buf) return NIL; + tm = buf->top_margin; + bm = buf->bottom_margin; + lm = buf->left_margin; + rm = buf->right_margin; + hm = buf->header_margin; + fm = buf->footer_margin; + } + return cons(flocons(tm), + cons(flocons(bm), + cons(flocons(lm), + cons(flocons(rm), + cons(flocons(hm), + cons(flocons(fm), NIL)))))); +} + +static LISP lmargin_set(LISP b, LISP m) +{ + int tm, bm, lm, rm, hm, fm; + + tm = get_c_long(CAR(m)); + bm = get_c_long(CAR(CDR(m))); + lm = get_c_long(CAR(CDR(CDR(m)))); + rm = get_c_long(CAR(CDR(CDR(CDR(m))))); + hm = get_c_long(CAR(CDR(CDR(CDR(CDR(m)))))); + fm = get_c_long(CAR(CDR(CDR(CDR(CDR(CDR(m))))))); + if (NULLP(b)) { + top_margin = tm; + bottom_margin = bm; + left_margin = lm; + right_margin = rm; + header_margin = hm; + footer_margin = fm; + } else { + buffer *buf; + char *bn = get_c_string(b); + if (bn[0]) buf = find_buffer_by_name(bn); + else buf = w_list->buf; + if (!buf) return NIL; + buf->top_margin = tm; + buf->bottom_margin = bm; + buf->left_margin = lm; + buf->right_margin = rm; + buf->header_margin = hm; + buf->footer_margin = fm; + buf->change = pr_scr_flag = TRUE; + } + return NIL; +} + +static LISP lheadfoot_get(LISP b) +{ + char *h, *f; + int fp; + + if (NULLP(b)) { + h = header; + f = footer; + fp = header_on_first; + } else { + buffer *buf; + char *bn = get_c_string(b); + if (bn[0]) buf = find_buffer_by_name(bn); + else buf = w_list->buf; + if (!buf) return NIL; + h = buf->header; + f = buf->footer; + fp = buf->header_on_first; + } + return cons(strcons(strlen(h), h), + cons(strcons(strlen(f), f), + cons(flocons(fp), NIL))); +} + +static LISP lheadfoot_set(LISP b, LISP hf) +{ + char *h, *f; + int fp; + + h = cstrdup(get_c_string(CAR(hf))); + f = cstrdup(get_c_string(CAR(CDR(hf)))); + fp = get_c_long(CAR(CDR(CDR(hf)))); + if (NULLP(b)) { + header = h; + footer = f; + header_on_first = fp; + } else { + buffer *buf; + char *bn = get_c_string(b); + if (bn[0]) buf = find_buffer_by_name(bn); + else buf = w_list->buf; + if (!buf) return NIL; + buf->header = h; + buf->footer = f; + buf->header_on_first = fp; + buf->change = pr_scr_flag = TRUE; + } + return NIL; +} + +static LISP lfirst_page_get(LISP b) +{ + int n; + + if (NULLP(b)) { + n = first_page_number; + } else { + buffer *buf; + char *bn = get_c_string(b); + if (bn[0]) buf = find_buffer_by_name(bn); + else buf = w_list->buf; + if (!buf) return NIL; + n = buf->first_page_number; + } + return flocons(n); +} + +static LISP lfirst_page_set(LISP b, LISP no) +{ + int n = get_c_long(no); + + if (NULLP(b)) { + first_page_number = n; + } else { + buffer *buf; + char *bn = get_c_string(b); + if (bn[0]) buf = find_buffer_by_name(bn); + else buf = w_list->buf; + if (!buf) return NIL; + buf->first_page_number = n; + buf->change = pr_scr_flag = TRUE; + } + return NIL; +} + + static LISP lmake_backups(LISP p) { make_backups = get_c_long(p); @@ -1225,9 +1557,7 @@ /* editing */ - /* block commands */ - {"preview", preview_block}, - {"print-block", print_block}, + {"psformat", lpsformat}, /* new window */ {"delete-window", delete_window}, @@ -1251,6 +1581,12 @@ {"quit-program", quit_egon}, /* low level functions */ + {"add-sheet", ladd_sheet}, + {"remove-sheet", lremove_sheet}, + {"rename-sheet", lrename_sheet}, + {"get-sheet", lget_sheet}, + {"get-bgrad", get_bgrad}, + {"ani-begin", ani_begin}, {"ani-end", ani_end}, {"del-object", del_object}, @@ -1276,6 +1612,7 @@ {"ani-object", lani_object}, {"ani-background", ani_background}, + {"ani-bgrad", ani_bgrad}, {"ani-time", ani_time}, {"ani-duration", lani_duration}, {"ani-delta", lani_delta}, @@ -1285,6 +1622,10 @@ {"set-format", set_format}, {"decode-format", ldecode_format}, {"encode-format", lencode_format}, + {"paper-get", lpaper_get}, + {"margin-get", lmargin_get}, + {"headfoot-get", lheadfoot_get}, + {"first-page-get", lfirst_page_get}, {"make-backups", lmake_backups}, {NULL, NULL} }; @@ -1296,6 +1637,11 @@ {"ani-geometry", lani_geometry}, {"font-alias", lfont_alias}, + {"move-sheet", lmove_sheet}, + {"paper-set", lpaper_set}, + {"margin-set", lmargin_set}, + {"headfoot-set", lheadfoot_set}, + {"first-page-set", lfirst_page_set}, {NULL, NULL} }; @@ -1317,6 +1663,7 @@ init_subr_5("register-ps-font", lregister_ps_font); init_subr_5("register-t1-font", lregister_t1_font); init_subr_4("register-color", lregister_color); + init_subr_3("savematrix", lsavematrix); init_subr_3("plugin-register", lplugin_register); init_subr_0("plugin-select", lplugin_select); init_subr_1("plugin-import", lplugin_import); diff -urNP ../siag-3.3.8/egon/egon.h ./egon/egon.h --- ../siag-3.3.8/egon/egon.h Thu Apr 6 14:53:11 2000 +++ ./egon/egon.h Tue Jun 13 19:28:09 2000 @@ -1,6 +1,6 @@ /* Egon Animator - Copyright (C) 1997, 1998 Ulric Eriksson + Copyright (C) 1997-2000 Ulric Eriksson 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 @@ -32,23 +32,39 @@ int displayed; /* started yet? */ } plugin_t; -typedef struct s_buffer { - char name[1024]; /* identifies the buffer */ - char path[1024]; /* file name */ +typedef struct sheet { + char *name; + char *bgrad; /* background gradient */ + char *bg; /* background pixmap */ ani_object *cast; /* objects in animation sequence */ unsigned int now; /* time in ms */ unsigned int delta; /* ms between frames */ unsigned int duration; /* of animation */ + plugin_t *plugin; /* array of plugins */ + int nplugin; /* number of plugins */ +} sheet; + +typedef struct s_buffer { + char name[1024]; /* identifies the buffer */ + char path[1024]; /* file name */ + sheet *sht; /* the sheet array */ + int nsht; /* number of sheets */ unsigned int width, height; int state; /* ANI_STOP et al */ - char *bg; /* background */ int change; /* if there are pending changes */ - plugin_t *plugin; /* array of plugins */ - int nplugin; /* number of plugins */ + char *paper_name; /* A4, letter... */ + int paper_width, paper_height; /* in points */ + int top_margin, bottom_margin, left_margin, right_margin; /* 72 */ + int header_margin, footer_margin; + char *header, *footer; + int header_on_first; /* default True */ + int first_page_number; /* default 1 */ + int orientation; /* default portrait */ struct s_buffer *next; /* next buffer in buffer ring */ } buffer; typedef struct s_window { + int sht; /* sheet number */ ani_object *object; /* selected object */ ani_script *script; /* selected tick */ buffer *buf; /* buffer */ @@ -56,6 +72,8 @@ struct s_window *next; /* next window in window ring */ } window; +enum {PORTRAIT = 0, LANDSCAPE}; + /* from window.c */ extern window *w_list; @@ -71,16 +89,12 @@ extern void show_cur(window *); extern void hide_cur(window *); -extern void draw_input(char *); -extern void draw_status(char *); -extern void draw_buffer(window *); - extern void mainloop(void); /* from matrix.c */ extern void free_matrix(ani_object *); -extern ani_object *last_object(buffer *); +extern ani_object *last_object(sheet *); extern ani_script *last_script(ani_object *); extern int ins_format(buffer *, ani_object *, ani_script *, int); extern int ret_format(buffer *, ani_object *, ani_script *); @@ -92,11 +106,24 @@ /* from buffer.c */ extern buffer *b_list; +extern char *paper_name; +extern int paper_width; +extern int paper_height; +extern int left_margin, right_margin, top_margin, bottom_margin; +extern int header_margin, footer_margin; +extern char *header, *footer; +extern int header_on_first; +extern int first_page_number; +extern int orientation; extern char *buffer_name(char *); +extern int buffer_add_sheet(buffer *, int); +extern int buffer_remove_sheet(buffer *, int); +extern void buffer_rename_sheet(buffer *, int, char *); extern buffer *new_buffer(char *, char *); extern buffer *free_buffer(buffer *); extern void plugin_unique_name(char *, char *); extern char *plugin_basedir(buffer *, char *); +extern buffer *find_sheet_by_name(char *, buffer *, int *); extern buffer *find_buffer_by_name(char *); extern int buffer_plugin2index(buffer *, int); diff -urNP ../siag-3.3.8/egon/egon.scm ./egon/egon.scm --- ../siag-3.3.8/egon/egon.scm Tue Apr 4 20:17:35 2000 +++ ./egon/egon.scm Wed Jun 14 06:49:05 2000 @@ -39,6 +39,19 @@ (define *tooltip-mode* 2) +(define (preview) + (let ((fn (string-append "/tmp/siagprint" (number->string (getpid)) ".ps"))) + (if (savematrix fn nil (psformat)) + (spawn (string-append viewer-command " " fn)) + (llpr "Can't make Postscript")))) + +(define (print) + (let ((fn (string-append "/tmp/siagprint" (number->string (getpid)) ".ps"))) + (if (savematrix fn nil (psformat)) + (spawn (string-append lpr-command " " fn)) + (llpr "Can't make Postscript")))) + + (define FMT_SHIFT 16) (define FMT_MASK (ash 15 FMT_SHIFT)) @@ -178,6 +191,15 @@ (define (set-background) (ani-background (ask-for-file))) +(define (clear-background) + (ani-background nil)) + +(define (set-bgrad) + (ani-bgrad (ask-for-str "Gradient: " (get-bgrad)))) + +(define (clear-bgrad) + (ani-bgrad nil)) + (define (set-timing) (let* ((timing (form-record "Delta" "Duration")) (delta (cdr (assoc "Delta" timing))) @@ -206,5 +228,143 @@ ;(require (string-append datadir "/common/fonts.scm")) +(define (move-sheet-up) + (let ((s (get-sheet))) + (if (> s 0) + (move-sheet s (- s 1))))) + +(define (move-sheet-down) + (let ((s (get-sheet))) + (move-sheet s (+ s 1)))) + +(define (move-sheet-top) + (let ((s (get-sheet))) + (move-sheet s 0))) + +(define (move-sheet-bottom) + (let ((s (get-sheet))) + (move-sheet s -1))) + +(define (change-margins buf) + (let* ((old (margin-get buf)) + (tm (car old)) + (bm (cadr old)) + (lm (caddr old)) + (rm (cadddr old)) + (hm (car (cddddr old))) + (fm (cadr (cddddr old))) + (new nil)) + (form-begin) + (input-field "Top:" 80 "top" 100 tm) + (input-field "Bottom:" 80 "bottom" 100 bm) + (input-field "Left:" 80 "left" 100 lm) + (input-field "Right:" 80 "right" 100 rm) + (input-field "Header:" 80 "header" 100 hm) + (input-field "Footer:" 80 "footer" 100 fm) + (form-okbutton "Ok") + (form-cancelbutton "Cancel") + (set! new (form-end)) + (set! lm (extract-number "left" new)) + (set! rm (extract-number "right" new)) + (set! tm (extract-number "top" new)) + (set! bm (extract-number "bottom" new)) + (set! hm (extract-number "header" new)) + (set! fm (extract-number "footer" new)) + (margin-set buf (list tm bm lm rm hm fm)))) + +(define paper-sizes + '(("Letter" 612 792) + ("LetterSmall" 612 792) + ("Tabloid" 792 1224) + ("Ledger" 1224 792) + ("Legal" 612 1008) + ("Statement" 396 612) + ("Executive" 540 720) + ("A3" 842 1190) + ("A4" 595 842) + ("A4Small" 595 842) + ("A5" 420 595) + ("B4" 729 1032) + ("B5" 516 729) + ("Folio" 612 936) + ("Quarto" 610 780) + ("10x14" 720 1008))) + +(define (paper-add-size l) + (if l (begin (form-menuentry (caar l)) + (paper-add-size (cdr l))))) + +(define (change-paper-size buf) + (let* ((old (paper-get buf)) + (p (car old)) + (w (cadr old)) + (h (caddr old)) + (o (cadddr old)) + (new nil)) + (form-begin) + (form-label "Size:") + (form-properties XtNwidth 80) + (form-menu "size") + (paper-add-size paper-sizes) + (form-properties XtNlabel p XtNwidth 150) + (form-newline) + (form-check "landscape" "Landscape") + (form-properties XtNstate o) + (form-newline) + (form-okbutton "Ok") + (form-cancelbutton "Cancel") + (set! new (form-end)) + (set! p (extract-string "size" new)) + (set! w (cadr (assoc p paper-sizes))) + (set! h (caddr (assoc p paper-sizes))) + (set! o (extract-number "landscape" new)) + (paper-set buf (list p w h o)))) + +(define (change-headfoot buf) + (let* ((old (headfoot-get buf)) + (h (car old)) + (f (cadr old)) + (fp (caddr old)) + (new nil)) + (form-begin) + (input-field "Header:" 80 "header" 200 h) + (input-field "Footer:" 80 "footer" 200 f) + (form-check "first" "Header on first page") + (form-properties XtNstate fp) + (form-newline) + (form-okbutton "Ok") + (form-cancelbutton "Cancel") + (set! new (form-end)) + (set! h (extract-string "header" new)) + (set! f (extract-string "footer" new)) + (set! fp (extract-number "first" new)) + (headfoot-set buf (list h f fp)))) + +(define (change-first-page buf) + (let* ((old (first-page-get buf)) + (new nil)) + (form-begin) + (input-field "First page number:" 160 "first" 100 old) + (form-okbutton "OK") + (form-cancelbutton "Cancel") + (set! new (form-end)) + (first-page-set buf (extract-number "first" new)))) + (define (add-pseudo-menu name) nil) + +(define (try-executable dirs fn) + (cond ((null? dirs) nil) + ((stat (string-append (car dirs) "/" fn)) t) + (t (try-executable (cdr dirs) fn)))) + +(define (executable-file fn) + (let* ((path (getenv "PATH")) + (dirs (strbreakup path ":"))) + (try-executable dirs fn))) + +(define (register-converters) + (if (executable-file "pptHtml") + (register-converter "MS Powerpoint (*.ppt)" + "*.html" "pptHtml %s > %s" + nil nil))) diff -urNP ../siag-3.3.8/egon/fileio.c ./egon/fileio.c --- ../siag-3.3.8/egon/fileio.c Thu Apr 6 14:53:11 2000 +++ ./egon/fileio.c Wed Jun 7 08:25:13 2000 @@ -1,6 +1,6 @@ /* Egon Animator - Copyright (C) 1997 Ulric Eriksson + Copyright (C) 1997-2000 Ulric Eriksson 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 @@ -45,12 +45,16 @@ char *pattern; } fileformats[MAX_FORMATS]; -/* These are not declared in calc.h because they will only be called here */ +/* These are not declared in egon.h because they will only be called here */ extern void fileio_egon_init(void); extern void fileio_c_init(void); extern void fileio_gif_init(void); extern void fileio_ps_init(void); extern void fileio_scm_init(void); +extern void fileio_mgp_init(void); +extern void fileio_txt_init(void); +extern void fileio_ps_init(void); +extern void fileio_html_init(void); static int siag_fmt; @@ -129,6 +133,9 @@ /* Register Egon format first */ siag_fmt = format_count; fileio_egon_init(); + fileio_mgp_init(); + fileio_txt_init(); + fileio_html_init(); fileio_c_init(); fileio_gif_init(); fileio_ps_init(); diff -urNP ../siag-3.3.8/egon/fileio_c.c ./egon/fileio_c.c --- ../siag-3.3.8/egon/fileio_c.c Thu Apr 6 14:53:11 2000 +++ ./egon/fileio_c.c Thu Jun 1 01:45:56 2000 @@ -1,6 +1,6 @@ /* Egon Animator - Copyright (C) 1997-1998 Ulric Eriksson + Copyright (C) 1997-2000 Ulric Eriksson 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 @@ -64,18 +64,18 @@ for (; *p; p++) if (!isalnum(*p)) *p = '_'; - fprintf(fp, "int %s_delta = %d;\n", basename, buf->delta); - fprintf(fp, "int %s_duration = %d;\n", basename, buf->duration); + fprintf(fp, "int %s_delta = %d;\n", basename, buf->sht[0].delta); + fprintf(fp, "int %s_duration = %d;\n", basename, buf->sht[0].duration); fprintf(fp, "int %s_width = %d;\n", basename, buf->width); fprintf(fp, "int %s_height = %d;\n", basename, buf->height); - if (buf->bg) - fprintf(fp, "char *%s_background = \"%s\";\n", basename, buf->bg); + if (buf->sht[0].bg) + fprintf(fp, "char *%s_background = \"%s\";\n", basename, buf->sht[0].bg); else fprintf(fp, "char *%s_background = NULL;\n", basename); /* save the scripts for all the objects */ i = 0; - for (o = buf->cast; o; o = o->next) { + for (o = buf->sht[0].cast; o; o = o->next) { j = 0; fprintf(fp, "ani_script %s_script_%d[] = {\n", basename, i); for (s = o->script; s; s = s->next) { @@ -97,7 +97,7 @@ /* then save the objects */ fprintf(fp, "ani_object %s_objects[] = {\n", basename); i = 0; - for (o = buf->cast; o; o = o->next) { + for (o = buf->sht[0].cast; o; o = o->next) { fprintf(fp, "/* Object %s */\n", o->name); if (o->next) { /* not the last one */ fprintf(fp, "\t{%d, \"%s\", %s_script_%d, %d, \"%s\", &%s_objects[%d]},\n", diff -urNP ../siag-3.3.8/egon/fileio_egon.c ./egon/fileio_egon.c --- ../siag-3.3.8/egon/fileio_egon.c Thu Apr 6 14:53:11 2000 +++ ./egon/fileio_egon.c Fri Jun 2 00:27:03 2000 @@ -1,6 +1,6 @@ /* Egon Animator - Copyright (C) 1997-1999 Ulric Eriksson + Copyright (C) 1997-2000 Ulric Eriksson 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 @@ -91,6 +91,7 @@ char b[1024]; char *used_fmt = ccalloc(nformat+1, 1); int fmt; + int sht; if (!fp) return 1; @@ -98,31 +99,34 @@ fprintf(fp, "# Creator: %s\n", version); fprintf(fp, "# %s\n", buf->name); - fprintf(fp, ".delta %d\n", buf->delta); - fprintf(fp, ".duration %d\n", buf->duration); fprintf(fp, ".geometry %d %d\n", buf->width, buf->height); - if (buf->bg) - fprintf(fp, ".background %s\n", buf->bg); - for (o = buf->cast; o; o = o->next) { - fprintf(fp, "# Object %s\n", o->name); - /* strip off directory part of image files in - a structured file */ - if (o->type == ANI_PIXMAP && - !strncmp(o->string, b, strlen(b))) - string = strrchr(o->string, '/')+1; - else - string = o->string; - fmt = o->fmt; - if (!used_fmt[fmt]) { - save_formats(fp, fmt); - used_fmt[fmt] = 1; + for (sht = 0; sht < buf->nsht; sht++) { + fprintf(fp, ".sheet %d %s\n", sht, buf->sht[sht].name); + fprintf(fp, ".delta %d\n", buf->sht[sht].delta); + fprintf(fp, ".duration %d\n", buf->sht[sht].duration); + if (buf->sht[sht].bg) + fprintf(fp, ".background %s\n", buf->sht[sht].bg); + for (o = buf->sht[sht].cast; o; o = o->next) { + fprintf(fp, "# Object %s\n", o->name); + /* strip off directory part of image files in + a structured file */ + if (o->type == ANI_PIXMAP && + !strncmp(o->string, b, strlen(b))) + string = strrchr(o->string, '/')+1; + else + string = o->string; + fmt = o->fmt; + if (!used_fmt[fmt]) { + save_formats(fp, fmt); + used_fmt[fmt] = 1; + } + fprintf(fp, ".object %d %s %d %s\n", + o->type, o->name, o->fmt, string?string:""); + for (s = o->script; s; s = s->next) + fprintf(fp, ".tick %d %d %d %d %d %d\n", + s->time, s->x, s->y, + s->width, s->height, s->visible); } - fprintf(fp, ".object %d %s %d %s\n", - o->type, o->name, o->fmt, string?string:""); - for (s = o->script; s; s = s->next) - fprintf(fp, ".tick %d %d %d %d %d %d\n", - s->time, s->x, s->y, - s->width, s->height, s->visible); } fclose(fp); cfree(used_fmt); @@ -145,34 +149,45 @@ int *fmts = NULL; int nfmt = -1; int f; + int sht = 0; if ((fp = fopen(fn, "r")) == NULL) return 1; plugin_basedir(buf, b); - buf->delta = 100; - buf->duration = 4000; - buf->now = 0; + buf->sht[sht].delta = 100; + buf->sht[sht].duration = 4000; + buf->sht[sht].now = 0; buf->width = 600; buf->height = 400; - buf->cast = NULL; + buf->sht[sht].cast = NULL; buf->state = ANI_STOP; - buf->bg = NULL; + buf->sht[sht].bg = NULL; buf->change = FALSE; - buf->plugin = NULL; - buf->nplugin = 0; + buf->sht[sht].plugin = NULL; + buf->sht[sht].nplugin = 0; while (fgets(instring, 1024, fp) != NULL) { if (instring[0] == '#') { continue; + } else if (!strncmp(instring, ".sheet ", 7)) { + char name[1000]; + sscanf(instring, ".sheet %d %[^\n]", &sht, name); + if (sht >= buf->nsht) { + buffer_add_sheet(buf, sht); + } + buffer_rename_sheet(buf, sht, name); } else if (!strncmp(instring, ".delta ", 7)) { - sscanf(instring, ".delta %d", &buf->delta); + sscanf(instring, ".delta %d", &buf->sht[sht].delta); } else if (!strncmp(instring, ".duration ", 10)) { - sscanf(instring, ".duration %d", &buf->duration); + sscanf(instring, ".duration %d", &buf->sht[sht].duration); } else if (!strncmp(instring, ".geometry ", 10)) { sscanf(instring, ".geometry %d %d", &buf->width, &buf->height); + } else if (!strncmp(instring, ".background ", 12)) { + sscanf(instring, ".background %[^\n]", b); + buf->sht[sht].bg = cstrdup(b); } else if (!strncmp(instring, ".ft ", 4)) { int n; sscanf(instring, ".ft%d", &n); @@ -183,9 +198,9 @@ } fmts[n] = load_formats(fp); } else if (!strncmp(instring, ".object ", 8)) { - if (buf->cast == NULL) { + if (buf->sht[sht].cast == NULL) { o = (ani_object *)cmalloc(sizeof(ani_object)); - buf->cast = o; + buf->sht[sht].cast = o; } else { o->next = (ani_object *)cmalloc(sizeof(ani_object)); o = o->next; @@ -259,7 +274,9 @@ char cmd[1024], bak[1024]; char *dir, *b, *p; int i, result; - ani_object *o; + ani_object *o = NULL; + int sht; + int structured = 0; if (make_backups) { /* make backup copy */ @@ -267,10 +284,20 @@ rename(fn, bak); } - for (o = buf->cast; o; o = o->next) - if (o->type == ANI_PIXMAP) break; + for (sht = 0; sht < buf->nsht; sht++) { + for (o = buf->sht[sht].cast; o; o = o->next) { + if (o->type == ANI_PIXMAP) { + structured = 1; + break; + } + } + if (buf->sht[sht].nplugin) { + structured = 1; + break; + } + } - if (o == NULL && buf->nplugin == 0) { + if (!structured) { /* no images or plugins, save as usual */ return save_flat(fn, buf); } @@ -280,11 +307,13 @@ p = strrchr(dir, '/'); if (p) *p = '\0'; mkdir(dir, 0700); - for (i = 0; i < buf->nplugin; i++) { - b = file_name(buf, buf->plugin[i].name); - plugin_save(buf->plugin[i].ph, b); - cfree(b); - } + for (sht = 0; sht < buf->nsht; sht++) { + for (i = 0; i < buf->sht[sht].nplugin; i++) { + b = file_name(buf, buf->sht[sht].plugin[i].name); + plugin_save(buf->sht[sht].plugin[i].ph, b); + cfree(b); + } + } /* save the main file */ b = file_name(buf, "INDEX.egon"); result = save_flat(b, buf); diff -urNP ../siag-3.3.8/egon/fileio_html.c ./egon/fileio_html.c --- ../siag-3.3.8/egon/fileio_html.c Thu Jan 1 01:00:00 1970 +++ ./egon/fileio_html.c Wed Jun 7 08:06:17 2000 @@ -0,0 +1,64 @@ +/* + Egon Animator + Copyright (C) 2000 Ulric Eriksson + + 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, 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. + */ + +/* + * fileio_html.c + */ + + +#include +#include +#include +#include + +#include "egon.h" +#include "types.h" +#include "../common/common.h" + + +/* --- +format guessing: + 1. extension .htm or .html + 2. not empty +*/ + +static int myformat(char *fn) +{ + char *ext; + FILE *fp = NULL; + char b[250]; + int result; + + result = ((ext = strrchr(fn, '.')) && + !cstrncasecmp(ext, ".txt", 4) && + (fp = fopen(fn, "r")) && + fgets(b, sizeof b, fp)); + if (fp) fclose(fp); + return result; +} + +/* --- +*/ +void fileio_html_init(void) +{ + register_format(NULL, NULL, myformat, + "Hypertext Markup Language (*.html)"); +} + diff -urNP ../siag-3.3.8/egon/fileio_mgp.c ./egon/fileio_mgp.c --- ../siag-3.3.8/egon/fileio_mgp.c Thu Jan 1 01:00:00 1970 +++ ./egon/fileio_mgp.c Wed Jun 7 08:03:30 2000 @@ -0,0 +1,65 @@ +/* + Egon Animator + Copyright (C) 2000 Ulric Eriksson + + 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, 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. + */ + +/* + * fileio_mgp.c + */ + + +#include +#include +#include +#include + +#include "egon.h" +#include "types.h" +#include "../common/common.h" + +#define MGP_MAGIC "%" + +/* --- +format guessing: + 1. extension .mgp + 2. Starts with "%" +*/ + +static int myformat(char *fn) +{ + char *ext; + FILE *fp = NULL; + char b[250]; + int result; + + result = ((ext = strrchr(fn, '.')) && + !cstrcasecmp(ext, ".mgp") && + (fp = fopen(fn, "r")) && + fgets(b, sizeof b, fp) && + !strncmp(b, MGP_MAGIC, strlen(MGP_MAGIC))); + if (fp) fclose(fp); + return result; +} + +/* --- +*/ +void fileio_mgp_init(void) +{ + register_format(NULL, NULL, myformat, "MagicPoint (*.mgp)"); +} + diff -urNP ../siag-3.3.8/egon/fileio_ps.c ./egon/fileio_ps.c --- ../siag-3.3.8/egon/fileio_ps.c Thu Apr 6 14:53:11 2000 +++ ./egon/fileio_ps.c Thu Jan 1 01:00:00 1970 @@ -1,65 +0,0 @@ -/* - Egon Animator - Copyright (C) 1997 Ulric Eriksson - - 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, 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. - */ - -/* - * fileio_ps.c - */ - - -#include -#include -#include -#include - -#include "egon.h" -#include "types.h" -#include "../common/common.h" - -#define PS_MAGIC "%!PS" - -/* --- -format guessing: - 1. extension .ps - 2. Starts with "%!PS" -*/ - -static int myformat(char *fn) -{ - char *ext; - FILE *fp = NULL; - char b[250]; - int result; - - result = ((ext = strrchr(fn, '.')) && - !cstrcasecmp(ext, ",ps") && - (fp = fopen(fn, "r")) && - fgets(b, sizeof b, fp) && - !strncmp(b, PS_MAGIC, strlen(PS_MAGIC))); - if (fp) fclose(fp); - return result; -} - -/* --- -*/ -void fileio_ps_init(void) -{ - register_format(NULL, NULL, myformat, "Postscript (*.ps)"); -} - diff -urNP ../siag-3.3.8/egon/fileio_txt.c ./egon/fileio_txt.c --- ../siag-3.3.8/egon/fileio_txt.c Thu Jan 1 01:00:00 1970 +++ ./egon/fileio_txt.c Wed Jun 7 08:04:59 2000 @@ -0,0 +1,63 @@ +/* + Egon Animator + Copyright (C) 2000 Ulric Eriksson + + 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, 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. + */ + +/* + * fileio_txt.c + */ + + +#include +#include +#include +#include + +#include "egon.h" +#include "types.h" +#include "../common/common.h" + + +/* --- +format guessing: + 1. extension .txt + 2. not empty +*/ + +static int myformat(char *fn) +{ + char *ext; + FILE *fp = NULL; + char b[250]; + int result; + + result = ((ext = strrchr(fn, '.')) && + !cstrcasecmp(ext, ".txt") && + (fp = fopen(fn, "r")) && + fgets(b, sizeof b, fp)); + if (fp) fclose(fp); + return result; +} + +/* --- +*/ +void fileio_txt_init(void) +{ + register_format(NULL, NULL, myformat, "Text (*.txt)"); +} + diff -urNP ../siag-3.3.8/egon/matrix.c ./egon/matrix.c --- ../siag-3.3.8/egon/matrix.c Thu Apr 6 14:53:11 2000 +++ ./egon/matrix.c Wed May 31 17:31:55 2000 @@ -1,6 +1,6 @@ /* Egon Animator - Copyright (C) 1997 Ulric Eriksson + Copyright (C) 1997-2000 Ulric Eriksson 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 @@ -69,7 +69,7 @@ /* --- */ -ani_object *last_object(buffer *b) +ani_object *last_object(sheet *b) { ani_object *o; if (!b) return NULL; diff -urNP ../siag-3.3.8/egon/menu.scm ./egon/menu.scm --- ../siag-3.3.8/egon/menu.scm Thu Apr 6 14:53:12 2000 +++ ./egon/menu.scm Tue Jun 13 22:28:34 2000 @@ -8,10 +8,15 @@ (add-menu-entry "File" "Save As" "(save-buffer-as)") (add-menu-entry "File" "Preview" "(preview)") (add-menu-entry "File" "Print" "(print)") +(add-menu-entry "File" "Print Format" "(print-format)") (add-menu-entry "File" "-" "-") (add-submenu "File" "Backup Copies") (add-submenu-entry "File" "Backup Copies" "Yes" "(make-backups 1)") (add-submenu-entry "File" "Backup Copies" "No" "(make-backups 0)") +(add-submenu "File" "Settings") +(add-submenu-entry "File" "Settings" "Margins" "(change-margins nil)") +(add-submenu-entry "File" "Settings" "Paper Size" "(change-paper-size nil)") +(add-submenu-entry "File" "Settings" "Header and Footer" "(change-headfoot nil)") (add-menu-entry "File" "-" "-") (add-menu-entry "File" "Load External" "(load-external)") (add-menu-entry "File" "Save External" "(save-external)") @@ -19,8 +24,8 @@ (add-menu-entry "File" "Exit" "(quit-program)") (add-menu "Edit") -(add-menu-entry "Edit" "Show Editor" "(popup-editor)") -(add-menu-entry "Edit" "Hide Editor" "(popdown-editor)") +;(add-menu-entry "Edit" "Show Editor" "(popup-editor)") +(add-menu-entry "Edit" "Hide Stage" "(popdown-stage)") (add-menu-entry "Edit" "Begin Empty Animation" "(ani-begin)") (add-submenu "Edit" "Add Object") (add-submenu-entry "Edit" "Add Object" "Line" "(add-line)") @@ -40,9 +45,27 @@ (add-menu-entry "Edit" "Edit Properties" "(ins-properties)") (add-menu-entry "Edit" "-" "-") (add-menu-entry "Edit" "Set Background" "(set-background)") +(add-menu-entry "Edit" "Clear Background" "(clear-background)") +(add-menu-entry "Edit" "Set Gradient" "(set-bgrad)") +(add-menu-entry "Edit" "Clear Gradient" "(clear-bgrad)") (add-menu-entry "Edit" "Timing" "(set-timing)") (add-menu-entry "Edit" "Set Geometry" "(set-geometry)") +(add-menu "Format") +(add-menu-entry "Format" "Margins" "(change-margins \"\")") +(add-menu-entry "Format" "Paper Size" "(change-paper-size \"\")") +(add-menu-entry "Format" "Header and Footer" "(change-headfoot \"\")") +(add-menu-entry "Format" "First Page Number" "(change-first-page \"\")") + +(add-menu "Window") +(add-menu-entry "Window" "Change Buffer" "(switch-to-buffer)") + +(add-menu "Window") +(add-menu-entry "Window" "Change Buffer" "(switch-to-buffer)") + +(add-menu "Window") +(add-menu-entry "Window" "Change Buffer" "(switch-to-buffer)") + (add-menu "Window") (add-menu-entry "Window" "Change Buffer" "(switch-to-buffer)") (add-menu-entry "Window" "Delete Buffer" "(kill-buffer)") @@ -52,6 +75,16 @@ (add-menu-entry "Window" "One Window" "(delete-other-windows)") (add-menu-entry "Window" "Change Window" "(other-window)") (add-menu-entry "Window" "-" "-") +(add-menu-entry "Window" "Add Sheet" "(add-sheet)") +(add-menu-entry "Window" "Remove Sheet" "(remove-sheet)") +(add-menu-entry "Window" "Rename Sheet" "(rename-sheet)") +(add-submenu "Window" "Move Sheet") +(add-submenu-entry "Window" "Move Sheet" "Up" "(move-sheet-up)") +(add-submenu-entry "Window" "Move Sheet" "Down" "(move-sheet-down)") +(add-submenu-entry "Window" "Move Sheet" "Top" "(move-sheet-top)") +(add-submenu-entry "Window" "Move Sheet" "Bottom" "(move-sheet-bottom)") + +(add-menu-entry "Window" "-" "-") (define (tooltip-set m) (set! *tooltip-mode* m) @@ -106,13 +139,15 @@ (add-pseudo-menu "Shortcuts") -(add-menu-entry "Shortcuts" "Show editor" "(popup-editor)") -(add-menu-entry "Shortcuts" "Hide editor" "(popdown-editor)") +;(add-menu-entry "Shortcuts" "Show editor" "(popup-editor)") +(add-menu-entry "Shortcuts" "Hide stage" "(popdown-stage)") (add-menu-entry "Shortcuts" "-" "-") (add-menu-entry "Shortcuts" "Open file" "(load-buffer)") (add-menu-entry "Shortcuts" "Save file" "(save-buffer-as)") (add-menu-entry "Shortcuts" "-" "-") -;(add-menu-entry "Shortcuts" "Quit animation" "(ani-ctl ANI_QUIT 0)") +(add-menu-entry "Shortcuts" "Next page" "(next-page)") +(add-menu-entry "Shortcuts" "Previous page" "(previous-page)") +(add-menu-entry "Shortcuts" "-" "-") (add-menu-entry "Shortcuts" "Stop animation" "(ani-ctl ANI_STOP 0)") (add-menu-entry "Shortcuts" "Previous frame" "(ani-ctl ANI_PREVIOUS 0)") (add-menu-entry "Shortcuts" "Next frame" "(ani-ctl ANI_NEXT 0)") diff -urNP ../siag-3.3.8/egon/print.c ./egon/print.c --- ../siag-3.3.8/egon/print.c Thu Apr 6 14:53:12 2000 +++ ./egon/print.c Thu Jan 1 01:00:00 1970 @@ -1,99 +0,0 @@ -/* - Egon Animator - Copyright (C) 1997 Ulric Eriksson - - 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, 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. - */ - -/* --- - print.c - - Produces data suitable for printing on a Postscript device. I have made - several assumptions to simplify things: - - paper size is A4 = 595x842 points - - margin on all sides = 72 points = 1 inch - - 1 pixel = 1 point means no scaling is necessary - - PS font has same geometry as X font - - no background pattern - - don't draw the grid - - The lpr command is used for printing - - This works for me, but will probably break (more or less) for anyone - not using my printer (a NEC S62P) with A4 paper. ---- */ - -#include -#include -#include -#include -#include - -#include "../common/common.h" - -#include "types.h" -#include "egon.h" - -int paper_height = 842; -int paper_width = 595; -int margin = 72; - -extern int font_size[8]; - -extern char *psformat; /* from fileio_ps.c */ - -#if 1 /* boo! */ -char *psformat = "Foo"; -#endif /* keep compiler happy */ - -/* --- -*/ -void preview(void) -{ - char fn[256]; - - sprintf(fn, "%s/siagprint%ld.ps", siag_tmpdir, (long)getpid()); - if (!savematrix(fn, w_list->buf, psformat)) { - if (!fork()) { - execlp("gv", "GV", fn, NULL); - llpr("Can't exec GV"); -#ifdef DEBUG - fprintf(stderr, "Can't exec GV\n"); -#endif - exit(1); - } - } else - llpr("Can\'t make postscript\n"); -} - -/* --- -*/ -void printer(void) -{ - char fn[256]; - - sprintf(fn, "%s/siagprint%ld.ps", siag_tmpdir, (long)getpid()); - if (!savematrix(fn, w_list->buf, psformat)) { - if (!fork()) { - execlp("lpr", "lpr", fn, NULL); - llpr("Can't exec lpr"); -#ifdef DEBUG - fprintf(stderr, "Can't exec lpr\n"); -#endif - exit(1); - } - } -} - diff -urNP ../siag-3.3.8/plugins/clipart.c ./plugins/clipart.c --- ../siag-3.3.8/plugins/clipart.c Wed May 24 05:36:05 2000 +++ ./plugins/clipart.c Thu Jun 15 07:01:56 2000 @@ -499,9 +499,7 @@ */ {"WIN", win}, {"QUIT", quit}, -#if 1 /* currently broken, doesn't handle scaling */ {"PRNT", prnt}, -#endif { NULL, NULL } }; diff -urNP ../siag-3.3.8/xcommon/Animator.c ./xcommon/Animator.c --- ../siag-3.3.8/xcommon/Animator.c Fri May 5 02:19:48 2000 +++ ./xcommon/Animator.c Thu Jun 15 08:02:15 2000 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -29,11 +30,18 @@ #include "../common/common.h" #include "../common/fonts.h" +#include "xcommon.h" #include "xfonts.h" #include #include "AnimatorP.h" +typedef struct s_ani_image { + char *filename; + Pixmap pixmap, mask; + struct s_ani_image *next; +} ani_image; + static void plugin_coords(Widget, XtPointer, int *, int *); #define offset(field) XtOffsetOf(AnimatorRec, animator.field) @@ -87,6 +95,14 @@ XtRString, (XtPointer)0 }, { + XtNgradient, + XtCGradient, + XtRString, + sizeof(String), + offset(bgrad), + XtRString, + (XtPointer)0 + }, { XtNanimatorPluginCoords, XtCAnimatorPluginCoords, XtRPointer, @@ -262,12 +278,17 @@ point to the head of the image list. */ -ani_image *name2image(Display *display, Window ani_win, char *name) +static ani_image *name2image(Widget w, char *name) { + XpmAttributes xa; ani_image *i; int err; char b[1024]; char tmpfile[1024]; + Display *display = XtDisplay(w); + Window ani_win = XRootWindowOfScreen(XtScreen(w)); + + if (!XtIsRealized(w)) return NULL; sprintf(tmpfile, "%s/siagimage.xpm", siag_tmpdir); if (!name) return NULL; @@ -280,11 +301,11 @@ system(b); i = (ani_image *)cmalloc(sizeof(ani_image)); - i->xa.closeness = 40000; - i->xa.exactColors = FALSE; - i->xa.valuemask = XpmCloseness | XpmExactColors; + xa.closeness = 40000; + xa.exactColors = FALSE; + xa.valuemask = XpmCloseness | XpmExactColors; err = XpmReadFileToPixmap(display, ani_win, - tmpfile, &(i->pixmap), &(i->mask), &(i->xa)); + tmpfile, &(i->pixmap), &(i->mask), &xa); if (err != XpmSuccess) { cfree(i); fprintf(stderr, "XpmReadFileToPixmap returns %s\n", @@ -317,6 +338,116 @@ return ri; } + +static void draw_gradient(Widget w, Pixmap scribble) +{ + AnimatorWidget aw = (AnimatorWidget)w; + char *bgrad = aw->animator.bgrad; + Display *dpy = XtDisplay(w); + int screen = DefaultScreen(dpy); + Visual *visual = DefaultVisual(dpy, screen); + Colormap colormap = DefaultColormap(dpy, screen); + int bitmap_pad = XBitmapPad(dpy); + GC gc = aw->animator.gc; + int bytes_per_line = 0; + XColor color; + unsigned long pixel; + int format = ZPixmap; + int offset = 0; + char *data = NULL; + unsigned int width, height, depth; + int x, y; + int bw, bh, bc, ba, bz, bn; + char bc1[100], bc2[100]; + XColor top, bot, dummy; + + unsigned int neww = aw->core.width; + unsigned int newh = aw->core.height; + unsigned int ox, oy; + unsigned int oldw = width, oldh = height; + + + /* we're going from black at the top to blue + at the bottom */ + if (bgrad == NULL) bgrad = ""; + if (aw->animator.ximage == NULL) { + XImage *img; + bn = sscanf(bgrad, "%d %d %d %d %d %s %s", + &bw, &bh, &bc, &ba, &bz, bc1, bc2); + switch (bn) { + case 0: bw = 100; + case 1: bh = 100; + case 2: bc = 128; + case 3: ba = 0; + case 4: bz = 1; + case 5: strcpy(bc1, "black"); + case 6: strcpy(bc2, "blue"); + default: ; + } + width = aw->core.width*bw/100; + height = aw->core.height*bh/100; + depth = aw->core.depth; + img = aw->animator.ximage = XCreateImage(dpy, + visual, depth, format, offset, data, + width, height, bitmap_pad, bytes_per_line); + img->data = cmalloc(img->bytes_per_line + *img->height*img->depth); + XLookupColor(dpy, colormap, bc1, &top, &dummy); + XLookupColor(dpy, colormap, bc2, &bot, &dummy); + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++ ) { + color.red = (int)top.red + +((int)bot.red-top.red)*y/height; + color.green = (int)top.green + +((int)bot.green-top.green)*y/height; + color.blue = (int)top.blue + +((int)bot.blue-top.blue)*y/height; + alloc_color(dpy, colormap, &color); + pixel = color.pixel; + XPutPixel(img, x, y, pixel); + } + } + aw->animator.ximage = XCreateImage(dpy, + visual, depth, format, offset, data, + aw->core.width, aw->core.height, + bitmap_pad, bytes_per_line); + aw->animator.ximage->data = cmalloc( + aw->animator.ximage->bytes_per_line + *aw->animator.ximage->height + *aw->animator.ximage->depth); + + neww = aw->core.width; + newh = aw->core.height; + oldw = width, oldh = height; + + if (bz) { /* zoom */ + /* snarfed from Image widget */ + for (y = 0; y < newh; y++) { + oy = y*oldh/newh; + for (x = 0; x < neww; x++) { + ox = x*oldw/neww; + pixel = XGetPixel(img, ox, oy); + XPutPixel(aw->animator.ximage, + x, y, pixel); + } + } + } else { /* tile */ + for (y = 0; y < newh; y++) { + oy = y % oldh; + for (x = 0; x < neww; x++) { + ox = x % oldw; + pixel = XGetPixel(img, ox, oy); + XPutPixel(aw->animator.ximage, + x, y, pixel); + } + } + } + XDestroyImage(img); + } + XPutImage(dpy, scribble, gc, aw->animator.ximage, + 0, 0, 0, 0, aw->core.width, aw->core.height); +} + /* --- create, draw and return a pixmap of the stage at time now. Caller must free @@ -324,9 +455,12 @@ so it can be called at any time from anywhere with any parameters */ -Pixmap ani_pixmap(Display *display, Window ani_win, GC ani_gc, - ani_object *cast, char *bg_pixmap, int ani_now) +Pixmap ani_pixmap(Widget w, int ani_now) { + AnimatorWidget aw = (AnimatorWidget)w; + GC ani_gc = aw->animator.gc; + Display *display = XtDisplay(w); + Window ani_win = XtWindow(w); int color_index; unsigned long color; @@ -340,40 +474,45 @@ ani_object *actor; ani_image *img, *bg_image; Pixmap scribble; - Window ani_root; - int ani_x, ani_y; - unsigned int ani_width, ani_height, ani_border, ani_depth; + unsigned int ani_width, ani_height, ani_depth; rich_char *p; + char *bg_pixmap = aw->animator.bg_pixmap; + + if (!XtIsRealized(w)) return None; - XGetGeometry(display, ani_win, &ani_root, - &ani_x, &ani_y, &ani_width, &ani_height, - &ani_border, &ani_depth); + ani_width = aw->core.width; + ani_height = aw->core.height; + ani_depth = aw->core.depth; if (ani_width > 2000 || ani_height > 2000) return None; scribble = XCreatePixmap(display, ani_win, ani_width, ani_height, ani_depth); + draw_gradient(w, scribble); + /* tile the background */ - bg_image = name2image(display, ani_win, bg_pixmap); + bg_image = name2image(w, bg_pixmap); + if (bg_image) { int bg_x, bg_y; unsigned int bg_width, bg_height, bg_border, bg_depth; - XSetClipMask(display, ani_gc, None); + XSetClipMask(display, ani_gc, bg_image->mask); XGetGeometry(display, bg_image->pixmap, &root, &bg_x, &bg_y, &bg_width, &bg_height, &bg_border, &bg_depth); for (y = 0; y < ani_height; y += bg_height) { for (x = 0; x < ani_width; x += bg_width) { + XSetClipOrigin(display, ani_gc, x, y); XCopyArea(display, bg_image->pixmap, scribble, - ani_gc, 0, 0, bg_width, bg_height, x, y); + ani_gc, 0, 0, + bg_width, bg_height, x, y); } } } - /* now loop over the objects, drawing each in the right place */ - for (actor = cast; actor; actor = actor->next) { + for (actor = aw->animator.cast; actor; actor = actor->next) { /* find the tick before and after ani_now and interpolate to find position and size. the script always contains a tick for time=0 */ @@ -438,8 +577,7 @@ 0, 64*360); break; case ANI_PIXMAP: - img = name2image(display, ani_win, - actor->string); + img = name2image(w, actor->string); if (!img) break; XGetGeometry(display, img->pixmap, &root, &x1, &y1, @@ -488,6 +626,14 @@ /* end of snip from animator.c */ +static GC get_gc(Widget w) +{ + unsigned long valuemask = 0; + XGCValues values; + + return XCreateGC(XtDisplay(w), XtWindow(w), valuemask, &values); +} + /* This seems to be the only way to avoid BadDrawable errors */ #define superclass (&coreClassRec) static void Realize(Widget w, XtValueMask *valueMask, @@ -497,6 +643,8 @@ (*superclass->core_class.realize) (w, valueMask, attributes); aw->animator.waiting = False; aw->animator.mode = aw->animator.newmode; + aw->animator.gc = get_gc(w); + aw->animator.ximage = NULL; } static void Destroy(Widget w) @@ -505,46 +653,29 @@ aw->animator.mode = ANI_QUIT; if (aw->animator.waiting) XtRemoveTimeOut(aw->animator.timeout); + if (aw->animator.ximage) + XDestroyImage(aw->animator.ximage); } static void Redisplay(Widget w, XEvent *xevent, Region r) { AnimatorWidget aw = (AnimatorWidget) w; Pixmap scribble; - Window ani_root; - int ani_x, ani_y; - unsigned int ani_width, ani_height, ani_border, ani_depth; - GC ani_gc; - unsigned long valuemask = 0; - XGCValues values; + GC ani_gc = aw->animator.gc; if (!XtIsRealized(w)) return; /* but that doesn't work */ if (!XtIsManaged(w)) return; /* what about this */ - if (!aw->animator.cast) { - XClearWindow(XtDisplay(w), XtWindow(w)); - return; - } - - /* must use Xlib function because we want to change the GC */ - ani_gc = XCreateGC(XtDisplay(aw), XtWindow(aw), - valuemask, &values); - XSetGraphicsExposures(XtDisplay(aw), ani_gc, 0); - - scribble = ani_pixmap(XtDisplay(aw), XtWindow(aw), - ani_gc, aw->animator.cast, - aw->animator.bg_pixmap, aw->animator.now); - XGetGeometry(XtDisplay(aw), scribble, &ani_root, - &ani_x, &ani_y, &ani_width, &ani_height, - &ani_border, &ani_depth); + XSetGraphicsExposures(XtDisplay(w), ani_gc, 0); + + scribble = ani_pixmap(w, aw->animator.now); - XCopyArea(XtDisplay(aw), scribble, XtWindow(aw), + XCopyArea(XtDisplay(w), scribble, XtWindow(w), ani_gc, 0, 0, - ani_width, ani_height, 0, 0); + aw->core.width, aw->core.height, 0, 0); /* and now we don't need this any more */ - XFreePixmap(XtDisplay(aw), scribble); - XFreeGC(XtDisplay(aw), ani_gc); + XFreePixmap(XtDisplay(w), scribble); /* update plugin positions */ DoLayout(aw); } @@ -562,21 +693,26 @@ } if ((curaw->animator.now != newaw->animator.now) /*|| (curaw->animator.mode != newaw->animator.mode)*/) { -#ifdef WANT_FLICKER do_redisplay = True; -#else - Redisplay(new, NULL, None); -#endif } if (curaw->animator.cast != newaw->animator.cast) { -#ifdef WANT_FLICKER do_redisplay = True; -#else + } + if (curaw->animator.bgrad == NULL + || newaw->animator.bgrad == NULL + || strcmp(curaw->animator.bgrad, newaw->animator.bgrad)) { + if (newaw->animator.ximage) { + XDestroyImage(newaw->animator.ximage); + } + newaw->animator.ximage = NULL; + } +#ifndef WANT_FLICKER + if (do_redisplay) { Redisplay(new, NULL, None); + do_redisplay = False; #endif } - if (newaw->animator.cast == NULL) do_redisplay = True; return do_redisplay; } @@ -602,7 +738,8 @@ static void Resize(Widget w) { - DoLayout((AnimatorWidget)w); + AnimatorWidget aw = (AnimatorWidget)w; + DoLayout(aw); } /* Resize */ /* diff -urNP ../siag-3.3.8/xcommon/Animator.h ./xcommon/Animator.h --- ../siag-3.3.8/xcommon/Animator.h Thu Apr 6 14:53:28 2000 +++ ./xcommon/Animator.h Sun Jun 4 21:51:25 2000 @@ -1,5 +1,5 @@ /* - Copyright (C) 1996, 1997 Ulric Eriksson + Copyright (C) 1996-2000 Ulric Eriksson This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -58,6 +58,7 @@ #define XtNanimatorMode "animatorMode" #define XtNanimatorBgPixmap "animatorBgPixmap" #define XtNanimatorPluginCoords "animatorPluginCoords" +#define XtNgradient "gradient" #define XtCAnimatorCast "AnimatorCast" #define XtCAnimatorNow "AnimatorNow" @@ -66,6 +67,7 @@ #define XtCAnimatorMode "AnimatorMode" #define XtCAnimatorBgPixmap "AnimatorBgPixmap" #define XtCAnimatorPluginCoords "AnimatorPluginCoords" +#define XtCGradient "Gradient" /* declare specific AnimatorWidget class and instance datatypes */ @@ -79,16 +81,7 @@ #include "../egon/types.h" -typedef struct s_ani_image { - char *filename; - Pixmap pixmap, mask; - XpmAttributes xa; - struct s_ani_image *next; -} ani_image; - -extern ani_image *name2image(Display *, Window, char *); -extern Pixmap ani_pixmap(Display *, Window, GC, - ani_object *, char *, int); +extern Pixmap ani_pixmap(Widget, int); #endif /* s_Animator_h */ diff -urNP ../siag-3.3.8/xcommon/AnimatorP.h ./xcommon/AnimatorP.h --- ../siag-3.3.8/xcommon/AnimatorP.h Thu Apr 6 14:53:28 2000 +++ ./xcommon/AnimatorP.h Sun Jun 4 22:39:01 2000 @@ -1,5 +1,5 @@ /* - Copyright (C) 1996, 1997 Ulric Eriksson + Copyright (C) 1996-2000 Ulric Eriksson This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -46,11 +46,14 @@ int now, delta, duration; int newmode; char *bg_pixmap; + char *bgrad; void (*plugin_coords)(Widget, XtPointer, int *, int *); /* private state */ int mode; XtIntervalId timeout; Boolean waiting; + GC gc; + XImage *ximage; } AnimatorPart; typedef struct s_AnimatorRec { diff -urNP ../siag-3.3.8/xcommon/Makefile.in ./xcommon/Makefile.in --- ../siag-3.3.8/xcommon/Makefile.in Fri May 26 08:26:50 2000 +++ ./xcommon/Makefile.in Thu Jun 15 08:25:45 2000 @@ -315,8 +315,8 @@ fi; \ done Animator.o: Animator.c ../common/cmalloc.h ../common/common.h \ - ../common/fonts.h xfonts.h ../config.h ../common/richchar.h \ - AnimatorP.h Animator.h ../egon/types.h + ../common/fonts.h xcommon.h xfonts.h ../config.h \ + ../common/richchar.h AnimatorP.h Animator.h ../egon/types.h Canvas.o: Canvas.c xfonts.h ../config.h ../common/richchar.h CanvasP.h \ Canvas.h Check.o: Check.c ../common/common.h ../common/cmalloc.h CheckP.h Check.h \ diff -urNP ../siag-3.3.8/xcommon/dialogs.c ./xcommon/dialogs.c --- ../siag-3.3.8/xcommon/dialogs.c Thu Apr 6 15:23:02 2000 +++ ./xcommon/dialogs.c Thu Jun 1 13:20:40 2000 @@ -441,7 +441,7 @@ XtNinsertPosition, strlen(buffr), (char *)0); center(pw, pshell); - XtPopup(pshell, XtGrabNonexclusive); + XtPopup(pshell, XtGrabExclusive); XSetWMProtocols(XtDisplay(pshell), XtWindow(pshell), &wm_delete_window, 1); if (input_warp_pointer) diff -urNP ../siag-3.3.8/xcommon/xcommon.c ./xcommon/xcommon.c --- ../siag-3.3.8/xcommon/xcommon.c Thu Apr 6 14:53:35 2000 +++ ./xcommon/xcommon.c Thu Jun 15 07:58:49 2000 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -201,5 +202,123 @@ return None; } return pm_return; +} + +/* color allocation stuff snarfed from the xmagick library */ +#ifndef USHRT_MAX +#define USHRT_MAX 65535 +#endif + +static int rgb_shift = 10; + +typedef struct xmagick_color { + XColor color; + unsigned long rgb; +} xmagick_color; + +static xmagick_color known_colors[128]; +static int ncolors, maxcolors = 128, lastcolor; + +void free_colors(void) +{ + free(known_colors); +/* known_colors = NULL; +*/ + ncolors = 0; + lastcolor = -1; +} + +void alloc_color(Display *display, Colormap colormap, XColor *color) +{ + int i, j, lower, upper; + int cr, cg, cb, d; + unsigned long rgb; + cr = color->red >> rgb_shift; + cg = color->green >> rgb_shift; + cb = color->blue >> rgb_shift; + rgb = (cr << 16) + (cg << 8) + cb; + + if (lastcolor != -1 && known_colors[lastcolor].rgb == rgb) { + color->pixel = known_colors[lastcolor].color.pixel; + return; + } + lower = 0; + upper = ncolors-1; + while (lower <= upper) { + i = (lower+upper)/2; + d = rgb-known_colors[i].rgb; + if (d == 0) { + lastcolor = i; + color->pixel = known_colors[i].color.pixel; + return; + } else if (d > 0) { + lower = i+1; + } else { + upper = i-1; + } + } + if (ncolors >= maxcolors) { + color->pixel = 0; + return; + } + if (XAllocColor(display, colormap, color) == 0) { + int dr, dg, db, bd = INT_MAX, best = 0; + for (j = 0; j < ncolors; j++) { + XColor c = known_colors[j].color; + dr = cr - (c.red >> rgb_shift); + dg = cg - (c.green >> rgb_shift); + db = cb - (c.blue >> rgb_shift); + d = dr*dr+dg*dg+db*db; + if (d < bd) { + bd = d; + best = j; + } + } + color->pixel = known_colors[best].color.pixel; + } + if (known_colors[upper].rgb > rgb) i = upper; + else i = lower; + if (i < 0) i = 0; + if (i > ncolors) i = ncolors; + for (j = ncolors; j > i; j--) { + known_colors[j] = known_colors[j-1]; + } + known_colors[i].color = *color; + known_colors[i].rgb = rgb; + known_colors[i].color.pixel = color->pixel; + lastcolor = i; + ncolors++; +} + +void query_color(Display *display, Colormap colormap, XColor *color) +{ + int i; + + for (i = 0; i < ncolors; i++) { + if (known_colors[i].color.pixel == color->pixel) { + color->red = known_colors[i].color.red; + color->green = known_colors[i].color.green; + color->blue = known_colors[i].color.blue; + return; + } + } + if (i >= maxcolors) { + color->red = 0; + color->green = 0; + color->blue = 0; + return; + } + XQueryColor(display, colormap, color); + known_colors[i].color = *color; + ncolors++; +} + +int xerror_handler(Display *dpy, XErrorEvent *event) +{ + char b[1000]; + + XGetErrorText(dpy, event->error_code, b, 999); + puts(b); + return 0; } diff -urNP ../siag-3.3.8/xcommon/xcommon.h ./xcommon/xcommon.h --- ../siag-3.3.8/xcommon/xcommon.h Thu Apr 6 15:24:46 2000 +++ ./xcommon/xcommon.h Thu Jun 15 07:59:18 2000 @@ -27,6 +27,10 @@ extern void start_splash(void); extern void stop_splash(void); extern Pixmap load_pixmap(Widget, char *); +extern void free_colors(void); +extern void alloc_color(Display *, Colormap, XColor *); +extern void query_color(Display *, Colormap, XColor *); +extern int xerror_handler(Display *, XErrorEvent *); /* tooltip.c */ extern void tooltip_init(Widget); diff -urNP ../siag-3.3.8/xegon/Egon.ad ./xegon/Egon.ad --- ../siag-3.3.8/xegon/Egon.ad Thu Apr 6 14:53:36 2000 +++ ./xegon/Egon.ad Sat Jun 3 23:28:54 2000 @@ -14,6 +14,7 @@ ! Settings for individual widgets Egon*edit_shell.geometry: 600x300 +Egon*ani_shell.geometry: 600x400 Egon*textframe.topShadowContrast: -40 Egon*textframe.bottomShadowContrast: -20 @@ -88,7 +89,19 @@ Egon*label3.gridy: 1 Egon*viewport.xLayout: 2 50% 2 100 2 50% 2 -Egon*viewport.yLayout: 2 100% 2 +Egon*viewport.yLayout: 2 100% 15 2 + +Egon*tabbox.gridx: 1 +Egon*tabbox.gridy: 2 +Egon*tabbox.gridWidth: 5 +Egon*tabbox.xLayout: 25 25 100% + +Egon*tabl.label: << + +Egon*tabr.gridx: 1 +Egon*tabr.label: >> + +Egon*tab.gridx: 2 Egon*objf.gridx: 1 Egon*objf.gridy: 1 @@ -244,8 +257,19 @@ Egon*grid.bottom: ChainBottom ! : pr-grid() \n\ +Egon*stage.gradient: 100 100 128 0 1 black blue + Egon*stage.translations:\ - :: place-shortcuts() XtMenuPopup(shortcuts) + :: execute(next-page) \n\ + :: place-shortcuts() XtMenuPopup(shortcuts) \n\ + :h: execute(popdown-stage) \n\ + o: execute(load-buffer) \n\ + s: execute(save-buffer-as) \n\ + q: execute(quit-program) \n\ + s: execute(ani-ctl ANI_STOP 0) \n\ + p: execute(ani-ctl ANI_PREVIOUS 0) \n\ + n: execute(ani-ctl ANI_NEXT 0) \n\ + c: execute(ani-ctl ANI_CONTINUE 0) !Egon*viewport.translations:\ ! :Home: execute(beginning-of-line) \n\ diff -urNP ../siag-3.3.8/xegon/Makefile.am ./xegon/Makefile.am --- ../siag-3.3.8/xegon/Makefile.am Thu Apr 6 14:53:36 2000 +++ ./xegon/Makefile.am Wed Jun 7 08:23:21 2000 @@ -1,7 +1,7 @@ bin_PROGRAMS = egon -egon_SOURCES = window.c selection.c fileio_gif.c xegon.c +egon_SOURCES = window.c selection.c fileio_gif.c fileio_ps.c xegon.c noinst_HEADERS = app-defaults.h xegon.h diff -urNP ../siag-3.3.8/xegon/Makefile.in ./xegon/Makefile.in --- ../siag-3.3.8/xegon/Makefile.in Fri May 26 08:26:59 2000 +++ ./xegon/Makefile.in Thu Jun 15 08:25:53 2000 @@ -85,7 +85,7 @@ bin_PROGRAMS = egon -egon_SOURCES = window.c selection.c fileio_gif.c xegon.c +egon_SOURCES = window.c selection.c fileio_gif.c fileio_ps.c xegon.c noinst_HEADERS = app-defaults.h xegon.h @@ -113,7 +113,7 @@ X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ -egon_OBJECTS = window.o selection.o fileio_gif.o xegon.o +egon_OBJECTS = window.o selection.o fileio_gif.o fileio_ps.o xegon.o egon_DEPENDENCIES = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -121,7 +121,7 @@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ HEADERS = $(noinst_HEADERS) -DIST_COMMON = Makefile.am Makefile.in +DIST_COMMON = Makefile.am Makefile.in TODO DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) @@ -234,13 +234,11 @@ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done -fileio_gif.o: fileio_gif.c ../xcommon/Animator.h \ - ../xcommon/../egon/types.h ../egon/egon.h \ - ../egon/../common/fonts.h ../egon/types.h xegon.h \ - ../common/common.h ../xcommon/embed.h ../common/cmalloc.h -selection.o: selection.c ../common/common.h ../egon/types.h \ - ../xcommon/Animator.h ../xcommon/../egon/types.h ../egon/egon.h \ - ../egon/../common/fonts.h +fileio_ps.o: fileio_ps.c ../egon/egon.h ../egon/../common/fonts.h \ + ../egon/types.h ../common/common.h ../xcommon/xcommon.h \ + ../xcommon/Animator.h ../xcommon/../egon/types.h \ + ../xcommon/xfonts.h ../xcommon/../config.h \ + ../xcommon/../common/richchar.h xegon.h window.o: window.c ../Nws/Menu.h ../Nws/cvt.h ../Nws/MenuBar.h \ ../Nws/Row.h ../Nws/BaseConst.h ../Nws/MBButton.h \ ../Nws/LabelME.h ../Nws/BaseME.h ../Nws/LineME.h ../Nws/SubME.h \ @@ -254,16 +252,10 @@ ../xcommon/../common/plugin.h ../common/bitmaps/egon.xpm \ ../xcommon/icon.h ../xcommon/dialogs.h ../xcommon/filesel.h \ ../xcommon/Rudegrid.h ../xcommon/Tooltip.h ../xcommon/Handle.h \ - ../xcommon/../XawM/Label.h ../xcommon/DragAndDrop.h \ - ../xcommon/DragAndDropTypes.h ../xcommon/xcommon-ad.h \ - ../xcommon/dialogs-ad.h ../xcommon/filesel-ad.h \ - ../xcommon/nws-ad.h app-defaults.h -xegon.o: xegon.c ../siod/siod.h ../common/common.h ../common/cmalloc.h \ - ../xcommon/Animator.h ../xcommon/../egon/types.h \ - ../xcommon/dialogs.h ../xcommon/plugin.h \ - ../xcommon/../common/plugin.h ../xcommon/filesel.h \ - ../egon/egon.h ../egon/../common/fonts.h ../egon/types.h \ - xegon.h + ../xcommon/../XawM/Label.h ../xcommon/Tabbing.h \ + ../xcommon/DragAndDrop.h ../xcommon/DragAndDropTypes.h \ + ../xcommon/xcommon-ad.h ../xcommon/dialogs-ad.h \ + ../xcommon/filesel-ad.h ../xcommon/nws-ad.h app-defaults.h info-am: info: info-am diff -urNP ../siag-3.3.8/xegon/TODO ./xegon/TODO --- ../siag-3.3.8/xegon/TODO Thu Jan 1 01:00:00 1970 +++ ./xegon/TODO Thu Jun 15 06:52:26 2000 @@ -0,0 +1,69 @@ + +To do for 3.3.9: + +Backgrounds: tiled, centered, stretched images + gradients + solid + OK, let's make this compatible with magicpoint. Their bgrad +directive has the following format: +%bgrad xsize ysize ncolors angle zoom color color... +Default is 0 0 128 0 1 blue black +This means "blue at the top, black at the bottom". +xsize is in percent of screen width; 0 means 100 (why?) +ysize is in percent of screen height; 0 means 100. +ncolors is the number of different colours that are used in the gradient. +I don't think I'll use that. +angle is the direction of the gradient: 0 for top to bottom, 90 for +left to right, 180 for bottom to top, 270 for right to left. Negative +angles give nonlinear gradients, something I intend to ignore. +zoom is 0 to tile pattern, 1 to expand. +The colour list can contain more than two colours, which complicates things +slightly. +To make the gradient, first create an XImage of the specified size. Then, +for each pixel of the XImage, calculate the RGB coordinates. Finally +transfer the XImage to the "scribble" Pixmap, either by stretching the pixels +to fit or by tiling. +This doesn't quite do all I want. A feature that exists in the current +Egon is to use an image from a file as background. This should obviously +be possible also in the future. However, I can keep the background image +and combine it with the new "bgrad". First the gradient is drawn, then +the image is tiled on top. The image has a clipmask, which allows the +gradient to show through. In the words of Basil Fawlty: Brilliant! +Soo... let's start by adding the bgrad property to the Animator widget. +Bgrad is a String with the same format as in mgp. Then we'll add the +draw_gradient function to Animator.c. Get to work! At first we can +ignore most of the options; all of them even. + +Change buffer (by tabbing or by loading from file) without hiding +the stage first. It currently either crashes or comes up with the +size of the previous buffer. + +General bugfixing: make sure it doesn't crash from normal use. + +Make a few fullscreen presentations to include as examples. + +Read MagicPoint files. + +Read PowerPoint files. + +Read and write HTML files. + +Read and write plaintext files. + +Keyboard control even in fullscreen mode. + + +To do later: + +Page flipping effects. + +Make plugins work properly. + +More convenient editing interface. + +Wizards. + +Templates. + +DND drop target for background images. + diff -urNP ../siag-3.3.8/xegon/app-defaults.h ./xegon/app-defaults.h --- ../siag-3.3.8/xegon/app-defaults.h Thu Apr 6 14:53:36 2000 +++ ./xegon/app-defaults.h Mon Jun 5 22:50:13 2000 @@ -1,6 +1,7 @@ "Egon.geometry: 600x400", "Egon*combo_viewport.allowHoriz: False", "Egon*edit_shell.geometry: 600x300", +"Egon*ani_shell.geometry: 600x400", "Egon*textframe.topShadowContrast: -40", "Egon*textframe.bottomShadowContrast: -20", "Egon*topbox.xLayout: 100%", @@ -62,7 +63,15 @@ "Egon*label3.gridx: 3", "Egon*label3.gridy: 1", "Egon*viewport.xLayout: 2 50% 2 100 2 50% 2", -"Egon*viewport.yLayout: 2 100% 2", +"Egon*viewport.yLayout: 2 100% 15 2", +"Egon*tabbox.gridx: 1", +"Egon*tabbox.gridy: 2", +"Egon*tabbox.gridWidth: 5", +"Egon*tabbox.xLayout: 25 25 100%", +"Egon*tabl.label: <<", +"Egon*tabr.gridx: 1", +"Egon*tabr.label: >>", +"Egon*tab.gridx: 2", "Egon*objf.gridx: 1", "Egon*objf.gridy: 1", "Egon*objf.shadowType: Groove", @@ -185,8 +194,18 @@ "Egon*grid.right: ChainRight", "Egon*grid.top: ChainTop", "Egon*grid.bottom: ChainBottom", +"Egon*stage.gradient: 100 100 128 0 1 red yellow", "Egon*stage.translations:\ - :: place-shortcuts() XtMenuPopup(shortcuts)", + :: execute(next-page) \\n\ + :: place-shortcuts() XtMenuPopup(shortcuts) \\n\ + :h: execute(popdown-stage) \\n\ + o: execute(load-buffer) \\n\ + s: execute(save-buffer-as) \\n\ + q: execute(quit-program) \\n\ + s: execute(ani-ctl ANI_STOP 0) \\n\ + p: execute(ani-ctl ANI_PREVIOUS 0) \\n\ + n: execute(ani-ctl ANI_NEXT 0) \\n\ + c: execute(ani-ctl ANI_CONTINUE 0)", "Egon*hscroll.left: ChainLeft", "Egon*hscroll.right: ChainRight", "Egon*hscroll.top: ChainBottom", diff -urNP ../siag-3.3.8/xegon/fileio_gif.c ./xegon/fileio_gif.c --- ../siag-3.3.8/xegon/fileio_gif.c Thu Apr 6 14:53:37 2000 +++ ./xegon/fileio_gif.c Sun Jun 4 21:41:00 2000 @@ -1,6 +1,6 @@ /* Egon Animator - Copyright (C) 1997 Ulric Eriksson + Copyright (C) 1997-2000 Ulric Eriksson 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 @@ -49,9 +49,6 @@ { unsigned long now = 0; Widget shell, w; - GC gc; - unsigned long valuemask = 0; - XGCValues values; Pixmap pm; char tmpxpm[256]; /* for xpm file */ char tmpgif[256]; /* for gif file */ @@ -78,19 +75,17 @@ animatorWidgetClass, shell, XtNheight, buf->height, XtNwidth, buf->width, - XtNanimatorCast, buf->cast, + XtNanimatorCast, buf->sht[0].cast, XtNanimatorNow, now, - XtNanimatorBgPixmap, buf->bg, + XtNanimatorBgPixmap, buf->sht[0].bg, + XtNgradient, buf->sht[0].bgrad, NULL); XtPopup(shell, XtGrabNone); - gc = XCreateGC(XtDisplay(w), XtWindow(w), - valuemask, &values); /* start by saving one gif for time now=0 */ - for (now = 0; now <= buf->duration; now += buf->delta) { - pm = ani_pixmap(XtDisplay(w), XtWindow(w), gc, - buf->cast, buf->bg, now); + for (now = 0; now <= buf->sht[0].duration; now += buf->sht[0].delta) { + pm = ani_pixmap(w, now); sprintf(tmpxpm, "%s/egon-%ld.xpm", siag_tmpdir, now); sprintf(tmpgif, "%s/egon-%ld.gif", siag_tmpdir, now); if (tmpgifs == NULL) { @@ -111,11 +106,11 @@ } p = (char *)cmalloc(strlen(tmpgifs)+100); - sprintf(p, "gifmerge -%d -l0 %s > %s", buf->delta/10, tmpgifs, fn); + sprintf(p, "gifmerge -%d -l0 %s > %s", + buf->sht[0].delta/10, tmpgifs, fn); system(p); sprintf(p, "rm %s", tmpgifs); system(p); - XFreeGC(XtDisplay(w), gc); XtPopdown(shell); XtDestroyWidget(shell); cfree(tmpgifs); diff -urNP ../siag-3.3.8/xegon/fileio_ps.c ./xegon/fileio_ps.c --- ../siag-3.3.8/xegon/fileio_ps.c Thu Jan 1 01:00:00 1970 +++ ./xegon/fileio_ps.c Thu Jun 15 06:58:51 2000 @@ -0,0 +1,281 @@ +/* + Egon Animator + Copyright (C) 1997-2000 Ulric Eriksson + + 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, 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. + */ + +/* + * fileio_ps.c + */ + + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "../egon/egon.h" +#include "../egon/types.h" +#include "../common/common.h" +#include "../xcommon/xcommon.h" +#include "../xcommon/Animator.h" +#include "../xcommon/xfonts.h" +#include "xegon.h" + +#define PS_MAGIC "%!PS" + +char *psformat; + +static int pageno; +static int ps_paper_width, ps_paper_height; + +static void expand(FILE *fp, int x, int y, char *from, char *name, int number) +{ + char b[1024], c[1024]; + int i; + time_t t; + struct tm *lt; + + unsigned int txt_height, txt_width; + + ps_set_font(fp, 0); + time(&t); + lt = localtime(&t); + strftime(c, sizeof c, from, lt); + from = c; + i = 0; + while (*from && (i < sizeof b)) { + if (*from == '&') { + from++; + if (*from == '\0') break; + else switch (*from) { + case 'n': + strcpy(b+i, name); + i += strlen(b+i); + break; + case 'p': + sprintf(b+i, "%d", number); + i += strlen(b+i); + break; + default: + b[i++] = *from; + break; + } + } else b[i++] = *from; + from++; + } + b[i] = '\0'; + txt_height = font_height(0); + txt_width = font_width(0, b); + fprintf(fp, "newpath\n"); + ps_set_color(fp, 0, 0, 0); + fprintf(fp, "%d %d moveto\n", x-txt_width/2, y-txt_height/2); + fprintf(fp, "("); + for (i = 0; b[i]; i++) { + int c = b[i] & 0xFF; + if (isalnum(c)) + putc(c, fp); + else + fprintf(fp, "\\%03o", c); + } + fprintf(fp, ")A\n"); +} + +static void page_header(FILE *fp, buffer *buf) +{ + char *ps_page_header = buf->header; + if (pageno == buf->first_page_number && buf->header_on_first == 0) + return; + + if (!ps_page_header) ps_page_header = "&n"; + expand(fp, ps_paper_width/2, + ps_paper_height-buf->header_margin, + ps_page_header, buf->name, pageno); +} + +static void page_footer(FILE *fp, buffer *buf) +{ + char *ps_page_footer = buf->footer; + if (pageno == buf->first_page_number && buf->header_on_first == 0) + return; + + if (!ps_page_footer) ps_page_footer = "&n"; + expand(fp, ps_paper_width/2, + buf->footer_margin, + ps_page_footer, buf->name, pageno); +} + +static void print_page(FILE *fp, buffer *buf, int s) +{ + Display *display; + Colormap colormap; + Pixmap pm; + Widget shell, w; + XImage *ximage; + XColor color; + int width = buf->width, height = buf->height, depth = 8; + int x, y, col; + unsigned long pixel; + shell = XtVaCreatePopupShell("shell", + transientShellWidgetClass, topLevel, + (char *)0); + w = XtVaCreateManagedWidget("animator", + animatorWidgetClass, shell, + XtNheight, height, + XtNwidth, width, + XtNanimatorCast, buf->sht[s].cast, + XtNanimatorNow, 0, + XtNanimatorBgPixmap, buf->sht[s].bg, + XtNgradient, buf->sht[s].bgrad, + (char *)0); + XtRealizeWidget(shell); + pm = ani_pixmap(w, 0); + display = XtDisplay(w); + colormap = XDefaultColormapOfScreen(XtScreen(w)); + ximage = XGetImage(display, pm, 0, 0, + width, height, ~0, ZPixmap); + fprintf(fp, "gsave\n"); + if (buf->orientation == LANDSCAPE) { + fprintf(fp, "90 rotate\n"); + fprintf(fp, "0 %d translate\n", -ps_paper_height); + } + page_header(fp, buf); + page_footer(fp, buf); + + /* center the image */ + fprintf(fp, "%d %d translate\n", + buf->left_margin+(ps_paper_width-width + -buf->left_margin-buf->right_margin)/2, + buf->bottom_margin+(ps_paper_height-height + -buf->top_margin-buf->bottom_margin)/2); + + fprintf(fp, "/inch {72 mul} def\n"); + fprintf(fp, "%d %d scale\n", width, height); + fprintf(fp, "/line %d string def\n", 3*width); + fprintf(fp, "%d %d %d\n", width, height, depth); + fprintf(fp, "[ %d %d %d %d %d %d ]\n", width, 0, 0, -height, 0, height); + fprintf(fp, "{currentfile line readhexstring pop}\n"); + fprintf(fp, "false 3 colorimage\n"); + + /* print all the pixels */ + col = 0; + + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + pixel = XGetPixel(ximage, x, y); + color.pixel = pixel; + query_color(display, colormap, &color); + fprintf(fp, "%02hx%02hx%02hx", + (color.red / 256) & 255, + (color.green / 256) & 255, + (color.blue / 256) & 255); + col += 6; + if (col > 72) { + fprintf(fp, "\n"); + col = 0; + } + } + } + + if (col) fprintf(fp, "\n"); + fprintf(fp, "%%\n"); + fprintf(fp, "showpage\n"); + fprintf(fp, "grestore\n"); + XDestroyImage(ximage); + XFreePixmap(display, pm); + XtDestroyWidget(shell); +} + +static int save(char *fn, buffer *buf) +{ + FILE *fp = fopen(fn, "w"); + int pages; + int s = 0; + time_t t; + if (!fp) return 1; + fprintf(fp, "%%!PS-Adobe-2.0\n"); + fprintf(fp, "%%%%Creator: Egon Animator\n"); + fprintf(fp, "%%%%Title: egon\n"); + t = time(NULL); + fprintf(fp, "%%%%CreationDate: %s", ctime(&t)); + fprintf(fp, "%%%%Pages: (atend)\n"); + fprintf(fp, "%%%%PageOrder: Ascend\n"); + fprintf(fp, "%%%%BoundingBox: %d %d %d %d\n", + 0, 0, buf->paper_width, buf->paper_height); + if (buf->orientation == LANDSCAPE) { + fprintf(fp, "%%%%Orientation: Landscape\n"); + ps_paper_width = buf->paper_height; + ps_paper_height = buf->paper_width; + } else { + fprintf(fp, "%%%%Orientation: Portrait\n"); + ps_paper_width = buf->paper_width; + ps_paper_height = buf->paper_height; + } + fprintf(fp, "%%%%DocumentPaperSizes: %s\n", buf->paper_name); + fprintf(fp, "%%%%EndComments\n"); + fprintf(fp, "/A {show} def\n"); + fprintf(fp, "%%%%EndProlog\n"); + + pages = 0; + pageno = buf->first_page_number; + for (s = 0; s < buf->nsht; s++) { + pages++; + ps_set_font(fp, -1); /* force setfont */ + fprintf(fp, "%%%%Page: %d %d\n", pages, pages); + print_page(fp, buf, s); + pageno++; + } + fclose(fp); + return 0; +} + +/* --- +format guessing: + 1. extension .ps + 2. Starts with "%!PS" +*/ + +static int myformat(char *fn) +{ + char *ext; + FILE *fp = NULL; + char b[250]; + int result; + + result = ((ext = strrchr(fn, '.')) && + !cstrcasecmp(ext, ".ps") && + (fp = fopen(fn, "r")) && + fgets(b, sizeof b, fp) && + !strncmp(b, PS_MAGIC, strlen(PS_MAGIC))); + if (fp) fclose(fp); + return result; +} + +/* --- +*/ +void fileio_ps_init(void) +{ + register_format(NULL, save, myformat, psformat = "Postscript (*.ps)"); +} + diff -urNP ../siag-3.3.8/xegon/window.c ./xegon/window.c --- ../siag-3.3.8/xegon/window.c Mon May 15 00:26:38 2000 +++ ./xegon/window.c Thu Jun 15 08:00:52 2000 @@ -40,11 +40,11 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -82,13 +82,13 @@ #include "../common/bitmaps/egon.xpm" #include "../xcommon/Animator.h" #include "../xcommon/icon.h" -#include "../xcommon/embed.h" #include "../xcommon/dialogs.h" #include "../xcommon/xcommon.h" #include "../xcommon/filesel.h" #include "../xcommon/Rudegrid.h" #include "../xcommon/Tooltip.h" #include "../xcommon/Handle.h" +#include "../xcommon/Tabbing.h" #include "../xcommon/DragAndDrop.h" @@ -109,21 +109,18 @@ static XtAppContext app_context; -Widget topLevel, topbox, frame1, frame2, frame3, menubox, toolbox, formatbox; -Widget textbox, statusbox, form, gridpane; -Widget text1, label1, label2, label3; - -/* The toolbar */ -Widget tbOpen, tbSave, tbView, tbPrint, tbHelp; - -Widget btnFont, mnuFont, btnSize, mnuSize, btnStyle, mnuStyle, btnColor, mnuColor; -Widget cmdBold, cmdItalic, cmdHLeft, cmdHCenter, cmdHRight; -Widget shortcuts, tooltip; -Widget edit_shell, stage; +Widget topLevel; +static Widget topbox, frame1, frame2, frame3, menubox, toolbox, formatbox; +static Widget textbox, statusbox, gridpane; +static Widget label1, label2, label3; + +static Widget btnFont, btnSize, btnStyle, btnColor; +static Widget cmdBold, cmdItalic, cmdHLeft, cmdHCenter, cmdHRight; +static Widget shortcuts, tooltip; static int bars = 0; -AppData app_data; +static AppData app_data; #define XtNplugin "plugin" #define XtCPlugin "Plugin" @@ -158,11 +155,14 @@ }; window *w_list; -int editor_popped = 0; +static int stage_popped = 0; -Atom wm_delete_window; /* Atom sent to destroy a window */ +static Atom wm_delete_window; /* Atom sent to destroy a window */ extern Atom target_atom; /* used for selection */ +static void draw_buffer(window *); +static window *find_window_by_widget(Widget); + /* --- */ int ask_for_str_comp(char *prompt, char *buffr, int (*comp) (char *)) @@ -615,7 +615,7 @@ /* --- */ -void setup_buttons(void) +static void setup_buttons(void) { Widget formatframe; unsigned long bg; @@ -634,7 +634,7 @@ comboWidgetClass, formatframe, XtNcomboList, cb_font, XtNcomboText, cb_font, - XtNcomboTop, edit_shell, + XtNcomboTop, topLevel, XtNcomboData, combo_fonts, XtNcomboNData, ncombo_fonts, XtNwidth, 160, @@ -649,7 +649,7 @@ comboWidgetClass, formatframe, XtNcomboList, cb_size, XtNcomboText, cb_size, - XtNcomboTop, edit_shell, + XtNcomboTop, topLevel, XtNcomboData, combo_sizes, XtNcomboNData, XtNumber(combo_sizes), XtNwidth, 40, @@ -665,7 +665,7 @@ comboWidgetClass, formatframe, XtNcomboList, cb_object, XtNcomboText, cb_object, - XtNcomboTop, edit_shell, + XtNcomboTop, topLevel, XtNcomboData, combo_objects, XtNcomboNData, XtNumber(combo_objects), XtNwidth, 100, @@ -681,7 +681,7 @@ comboWidgetClass, formatframe, XtNcomboList, cb_color, XtNcomboText, cb_color, - XtNcomboTop, edit_shell, + XtNcomboTop, topLevel, XtNcomboData, combo_colors, XtNcomboNData, ncombo_colors, XtNwidth, 80, @@ -689,42 +689,30 @@ TooltipAdd(tooltip, btnColor, _("Change the color")); } -static LISP popup_editor(void) +static LISP popup_stage(void) { - XtVaSetValues(btnFont, XtNwidth, 160, (char *)0); - XtVaSetValues(btnSize, XtNwidth, 40, (char *)0); - XtVaSetValues(btnStyle, XtNwidth, 100, (char *)0); - XtVaSetValues(btnColor, XtNwidth, 80, (char *)0); - XtPopup(edit_shell, XtGrabNone); - XSetWMProtocols(XtDisplay(edit_shell), XtWindow(edit_shell), + stage_init(w_list); + XtPopup(w_list->ui->ani_shell, XtGrabNone); + XSetWMProtocols(XtDisplay(w_list->ui->ani_shell), + XtWindow(w_list->ui->ani_shell), &wm_delete_window, 1); - editor_popped = 1; + stage_popped = 1; return NIL; } -static LISP popdown_editor(void) +static LISP popdown_stage(void) { - editor_popped = 0; - XtPopdown(edit_shell); + stage_popped = 0; + XtPopdown(w_list->ui->ani_shell); + w_list->ui->stage = NULL; + XtDestroyWidget(w_list->ui->ani_shell); + w_list->ui->ani_shell = NULL; return NIL; } -static void editor_init(void) -{ - edit_shell = XtVaCreatePopupShell("edit_shell", - topLevelShellWidgetClass, topLevel, - XtNtitle, _("Egon Editor"), - (char *)0); - topbox = XtCreateManagedWidget("topbox", - rudegridWidgetClass, edit_shell, NULL, 0); - XtOverrideTranslations(edit_shell, - XtParseTranslationTable( - "WM_PROTOCOLS: execute(quit-program)")); -} - /* --- */ -void drop_handler(Widget w, XtPointer data, +static void drop_handler(Widget w, XtPointer data, XEvent *event, Boolean *b) { unsigned char *Data, *filename; @@ -750,12 +738,18 @@ void activate_window(window *w) { char b[256]; + int tab, s = w->sht; w_list = w; if (w) { strcpy(b, "Egon Animator: "); strncat(b, w->buf->name, 200); XtVaSetValues(topLevel, XtNtitle, b, NULL); + tab = TabbingTextToPos(w->ui->tab, w->buf->sht[s].name); + if (tab < 0) { + w_list->sht = s = tab = 0; + } + XtVaSetValues(w->ui->tab, XtNtabbingSelected, tab, (char *)0); } } @@ -783,24 +777,27 @@ /* --- */ -void draw_input(char *text) +static void draw_input(char *text) { char b[256]; + buffer *buf = w_list->buf; + int sht = w_list->sht; + if (!w_list->object) sprintf(b, "No object selected"); else sprintf(b, _("[%s at %d] [size = %dx%d] [duration=%d delta=%d]"), w_list->object->name, w_list->script->time, - w_list->buf->width, w_list->buf->height, - w_list->buf->duration, w_list->buf->delta); + buf->width, buf->height, + buf->sht[sht].duration, buf->sht[sht].delta); label_set(label1, b); label_set(label3, "Egon"); } /* --- */ -void draw_status(char *text) +static void draw_status(char *text) { label_set(label2, text); XFlush(XtDisplay(topLevel)); @@ -835,7 +832,7 @@ /* --- */ -void draw_buffer(window *w) +static void draw_buffer(window *w) { buffer *b = w->buf; ani_object *o; @@ -844,6 +841,7 @@ static String fallback[1] = {""}; static int on = 0, sn = 0, pn = 0; static char **ol = NULL, **sl = NULL, **pl = NULL; + int sht = w->sht; FREE_LIST(ol, on) FREE_LIST(sl, sn) @@ -851,12 +849,12 @@ /* select the first object if none is selected */ if (!w->object) { - w->object = w->buf->cast; + w->object = b->sht[sht].cast; if (w->object) w->script = w->object->script; } on = 0; - for (o = b->cast; o; o = o->next) on++; + for (o = b->sht[sht].cast; o; o = o->next) on++; if (!on) { XawListChange(w->ui->objl, fallback, 1, 0, True); @@ -868,7 +866,7 @@ ol = (char **)cmalloc(on*sizeof(char *)); on = 0; - for (o = b->cast; o; o = o->next) { + for (o = b->sht[sht].cast; o; o = o->next) { ol[on] = cstrdup(o->name); on++; } @@ -904,40 +902,38 @@ The_end: - XtVaSetValues(topLevel, - XtNwidth, b->width, - XtNheight, b->height, - (char *)0); - - XtVaSetValues(stage, - XtNwidth, b->width, - XtNheight, b->height, - XtNanimatorCast, b->cast, - XtNanimatorDelta, b->delta, - XtNanimatorDuration, b->duration, - XtNanimatorBgPixmap, b->bg, - XtNanimatorNow, b->now, - XtNanimatorMode, b->state, - (char *)0); - XtVaSetValues(topLevel, - XtNwidth, b->width, - XtNheight, b->height, - (char *)0); -/* XtMapWidget(topLevel); -*/ + if (w->ui->ani_shell) { + + XtVaSetValues(w->ui->stage, + XtNanimatorCast, b->sht[sht].cast, + XtNanimatorDelta, b->sht[sht].delta, + XtNanimatorDuration, b->sht[sht].duration, + XtNanimatorBgPixmap, b->sht[sht].bg, + XtNgradient, b->sht[sht].bgrad, + XtNanimatorNow, b->sht[sht].now, + XtNanimatorMode, b->state, + (char *)0); + } draw_input(NULL); } /* --- */ -window *find_window_by_widget(Widget wdg) +static window *find_window_by_widget(Widget wdg) { window *w = w_list; + egon_ui *u; do { - if (w->ui->viewport == wdg || - w->ui->objv == wdg || w->ui->objl == wdg || - w->ui->tickv == wdg || w->ui->tickl == wdg || - w->ui->propv == wdg || w->ui->propl == wdg) + u = w->ui; + if (u->viewport == wdg || + u->objv == wdg || u->objl == wdg || + u->objf == wdg || u->objt == wdg || + u->tickv == wdg || u->tickl == wdg || + u->tickf == wdg || u->tickt == wdg || + u->propv == wdg || u->propl == wdg || + u->propf == wdg || u->propt == wdg || + u->tabbox == wdg || u->tab == wdg || + u->tabl == wdg || u->tabr == wdg) return w; w = w->next; } while (w != w_list); @@ -960,6 +956,48 @@ cfree(w); } +static void select_tab(Widget w, int pos) +{ + buffer *b; + int s; + char *name = TabbingPosToText(w, pos); + if (name == NULL) return; + + w_list = find_window_by_widget(w); + if (w_list == NULL) + fprintf(stderr, "find_window_by_widget returns NULL\n"); + b = find_sheet_by_name(name, w_list->buf, &s); + if (b == NULL) return; + + XtVaSetValues(w, XtNtabbingSelected, pos, (char *)0); + XtVaGetValues(w, XtNtabbingSelected, &pos, (char *)0); + + w_list->buf = b; + w_list->sht = s; + pr_scr_flag = TRUE; + activate_window(w_list); + show_cur(w_list); +} + +static void tabs_left(Widget w, XtPointer client_data, XtPointer call_data) +{ + Widget tw = (Widget)client_data; + int n; + + XtVaGetValues(tw, XtNtabbingTop, &n, (char *)0); + XtVaSetValues(tw, XtNtabbingTop, n-1, (char *)0); +} + +static void tabs_right(Widget w, XtPointer client_data, XtPointer call_data) +{ + Widget tw = (Widget)client_data; + int n; + + XtVaGetValues(tw, XtNtabbingTop, &n, (char *)0); + XtVaSetValues(tw, XtNtabbingTop, n+1, (char *)0); +} + + /* --- When running as player, return a window structure without any widgets Slightly modified for Egon: only one window at a time @@ -995,6 +1033,7 @@ w->ui->objf = XtVaCreateManagedWidget("objf", frameWidgetClass, w->ui->viewport, (char *)0); + w->ui->objt = XtVaCreateManagedWidget("objt", labelWidgetClass, w->ui->objf, (char *)0); @@ -1008,7 +1047,6 @@ w->ui->objl = XtVaCreateManagedWidget("objl", listWidgetClass, w->ui->objv, NULL); XtAddCallback(w->ui->objl, XtNcallback, object_select, NULL); - w->ui->tickf = XtVaCreateManagedWidget("tickf", frameWidgetClass, w->ui->viewport, (char *)0); @@ -1042,16 +1080,24 @@ w->ui->propl = XtVaCreateManagedWidget("propl", listWidgetClass, w->ui->propv, (char *)0); - XtVaSetValues(stage, - XtNanimatorCast, b->cast, - XtNanimatorNow, 0, - XtNanimatorDelta, b->delta, - XtNanimatorDuration, b->duration, - XtNanimatorMode, ANI_STOP, - XtNanimatorBgPixmap, b->bg, - XtNwidth, b->width, - XtNheight, b->height, + w->ui->tabbox = XtVaCreateManagedWidget("tabbox", + rudegridWidgetClass, w->ui->viewport, (char *)0); + w->ui->tab = XtVaCreateManagedWidget("tab", + tabbingWidgetClass, w->ui->tabbox, + XtNtabbingSelect, select_tab, + (char *)0); + w->ui->tabl = XtVaCreateManagedWidget("tabl", + repeaterWidgetClass, w->ui->tabbox, + (char *)0); + XtAddCallback(w->ui->tabl, XtNcallback, + tabs_left, (XtPointer)w->ui->tab); + w->ui->tabr = XtVaCreateManagedWidget("tabr", + repeaterWidgetClass, w->ui->tabbox, + (char *)0); + XtAddCallback(w->ui->tabr, XtNcallback, + tabs_right, (XtPointer)w->ui->tab); + return w; } @@ -1060,8 +1106,9 @@ */ int ani_ctl(int mode, unsigned int now) { - XtVaSetValues(stage, - XtNanimatorMode, mode, (char *)0); + XtVaSetValues(w_list->ui->stage, + XtNanimatorMode, mode, + (char *)0); return ANI_OK; } @@ -1198,20 +1245,60 @@ static void handle_plugin_exit(int ph) { buffer *b = b_list; + int s = w_list->sht; do { int n = buffer_plugin2index(b, ph); if (n != -1) { - cfree(b->plugin[n].name); - b->nplugin--; - for (; n < b->nplugin; n++) - b->plugin[n] = b->plugin[n+1]; + cfree(b->sht[s].plugin[n].name); + b->sht[s].nplugin--; + for (; n < b->sht[s].nplugin; n++) + b->sht[s].plugin[n] = b->sht[s].plugin[n+1]; b->change = pr_scr_flag = TRUE; } b = b->next; } while (b != b_list); } +void stage_init(window *w) +{ + buffer *b = w->buf; + Display *dpy = XtDisplay(topLevel); + Window root; + int x, y; + unsigned int width, height, border, depth; + + if (w->ui->ani_shell) return; + + if (b->width == 0 || b->height == 0) { /* full screen */ + XGetGeometry(dpy, XtWindow(topLevel), &root, + &x, &y, &width, &height, &border, &depth); + XGetGeometry(dpy, root, &root, + &x, &y, &width, &height, &border, &depth); + w->ui->ani_shell = XtVaCreatePopupShell("ani_shell", + overrideShellWidgetClass, topLevel, + (char *)0); + } else { + width = b->width; + height = b->height; + w->ui->ani_shell = XtVaCreatePopupShell("ani_shell", + topLevelShellWidgetClass, topLevel, + (char *)0); + } + w->ui->stage = XtVaCreateManagedWidget("stage", + animatorWidgetClass, w->ui->ani_shell, + XtNanimatorCast, NULL, + XtNanimatorMode, ANI_STOP, + XtNanimatorNow, 0, + (char *)0); + XtPopup(w->ui->ani_shell, XtGrabNone); + XtVaSetValues(w->ui->ani_shell, + XtNwidth, width, + XtNheight, height, + (char *)0); + draw_buffer(w); +} + static void init_windows1(int *argc, char **argv) { XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); @@ -1227,26 +1314,25 @@ t1_init(topLevel); + XSetErrorHandler(xerror_handler); + XtGetApplicationResources(topLevel, &app_data, resources, XtNumber(resources), NULL, 0); XtAppAddActions(app_context, actions, XtNumber(actions)); - shortcuts = XtVaCreatePopupShell("shortcuts", - menuWidgetClass, topLevel, (char *)0); - - stage = XtVaCreateManagedWidget("stage", - animatorWidgetClass, topLevel, - XtNanimatorCast, NULL, - XtNanimatorMode, ANI_STOP, - XtNanimatorNow, 0, - (char *)0); - editor_init(); + topbox = XtCreateManagedWidget("topbox", + rudegridWidgetClass, topLevel, NULL, 0); + XtOverrideTranslations(topLevel, + XtParseTranslationTable( + "WM_PROTOCOLS: execute(quit-program)")); - tooltip_init(edit_shell); + tooltip_init(topLevel); tooltip = XtVaCreatePopupShell("tooltip", tooltipWidgetClass, topLevel, (char *)0); + shortcuts = XtVaCreatePopupShell("shortcuts", + menuWidgetClass, topLevel, (char *)0); init_menu(); init_toolbar(); @@ -1292,7 +1378,6 @@ void init_windows(buffer * b, int *argc, char **argv) { Display *dpy; - unsigned long highlight_color, unhighlight_color; start_splash(); @@ -1304,13 +1389,14 @@ init_format(dpy); encode_format(~0, &fmt0); + w_list = new_window(b, NULL); XtRealizeWidget(topLevel); stderr_redir(topLevel); plugin_init(topLevel, handle_plugin_exit, handle_plugin_cmd); - activate_window(new_window(b, NULL)); + activate_window(w_list); wm_delete_window = XInternAtom(dpy, "WM_DELETE_WINDOW", False); XtOverrideTranslations(topLevel, @@ -1328,8 +1414,8 @@ ok2print = 1; - init_subr_0("popup-editor", popup_editor); - init_subr_0("popdown-editor", popdown_editor); + init_subr_0("popup-stage", popup_stage); + init_subr_0("popdown-stage", popdown_stage); init_subr_1("add-menu", add_menu); init_subr_3("add-menu-entry", add_menu_entry); init_subr_2("add-submenu", add_submenu); @@ -1342,12 +1428,6 @@ DndInitialize(topLevel); DndRegisterOtherDrop(drop_handler); - highlight_color = WhitePixel(XtDisplay(topLevel), - DefaultScreen(XtDisplay(topLevel))); - XtVaGetValues(label1, /* or any widget with grey bg */ - XtNbackground, &unhighlight_color, - NULL); - stop_splash(); } @@ -1365,6 +1445,37 @@ free_window(w_list); } +static void replace_tabs(window *w) +{ + int n, top; + buffer *b; + XtVaGetValues(w->ui->tab, + XtNtabbingCount, &n, + XtNtabbingTop, &top, + (char *)0); + while (n) TabbingRemove(w->ui->tab, --n); + for (n = 0; n < w->buf->nsht; n++) { + TabbingInsert(w->ui->tab, w->buf->sht[n].name, n); + } + if (top >= w->buf->nsht) + top = w->buf->nsht-1; + + b = b_list; + do { + if (b != w->buf) { + char p[1000]; + sprintf(p, "%s:", b->name); + TabbingInsert(w->ui->tab, p, -1); + } + b = b->next; + } while (b != b_list); + + XtVaSetValues(w->ui->tab, + XtNtabbingSelected, w->sht, + XtNtabbingTop, top, + (char *)0); +} + /* --- static void pr_scr() Prints and refreshes all the windows. @@ -1375,18 +1486,20 @@ { window *w; int i; + int s = w_list->sht; draw_status(""); w = w_list; do { draw_buffer(w); - for (i = 0; i < w->buf->nplugin; i++) { - if (!w->buf->plugin[i].displayed) { - plugin_show(w->buf->plugin[i].ph, - stage); - w->buf->plugin[i].displayed = 1; + for (i = 0; i < w->buf->sht[s].nplugin; i++) { + if (!w->buf->sht[s].plugin[i].displayed) { + plugin_show(w->buf->sht[s].plugin[i].ph, + w->ui->stage); + w->buf->sht[s].plugin[i].displayed = 1; } } + replace_tabs(w); w = w->next; } while (w != w_list); pr_scr_flag = FALSE; @@ -1397,7 +1510,7 @@ /* --- */ -void show_format(void) +static void show_format(void) { static int last_fmt = -1; int f = ret_format(w_list->buf, @@ -1412,7 +1525,7 @@ decode_format(f, ~0, &fmt); /* menus */ - if (editor_popped) { + if (1) { int type; if (!w_list->buf || !w_list->object || !w_list->script) type = 0; @@ -1432,8 +1545,6 @@ state_set(cmdHRight, (hadj_right?1:0), 1, 0); last_fmt = f; } - -int cursor_visible = FALSE; /* --- void show_cur(window *w) diff -urNP ../siag-3.3.8/xegon/xegon.c ./xegon/xegon.c --- ../siag-3.3.8/xegon/xegon.c Thu Apr 6 14:53:37 2000 +++ ./xegon/xegon.c Fri Jun 2 07:12:45 2000 @@ -162,7 +162,62 @@ static LISP lani_ctl(LISP mode, LISP now) { int m = get_c_long(mode); - XtVaSetValues(stage, XtNanimatorMode, m, (char *)0); + stage_init(w_list); + XtVaSetValues(w_list->ui->stage, + XtNanimatorMode, m, + (char *)0); + return NIL; +} + +static LISP lnext_page(void) +{ + int sht = w_list->sht+1; + buffer *b = w_list->buf; + + if (sht >= b->nsht) return NIL; + + b->state = ANI_STOP; + b->sht[sht].now = 0; + + /* stop the animation */ + XtVaSetValues(w_list->ui->stage, + XtNanimatorMode, b->state, + (char *)0); + /* replace the cast */ + XtVaSetValues(w_list->ui->stage, + XtNanimatorCast, b->sht[sht].cast, + XtNanimatorDelta, b->sht[sht].delta, + XtNanimatorDuration, b->sht[sht].duration, + XtNanimatorBgPixmap, b->sht[sht].bg, + XtNanimatorNow, b->sht[sht].now, + (char *)0); + w_list->sht = sht; + return NIL; +} + +static LISP lprevious_page(void) +{ + int sht = w_list->sht-1; + buffer *b = w_list->buf; + + if (sht < 0) return NIL; + + b->state = ANI_STOP; + b->sht[sht].now = 0; + + /* stop the animation */ + XtVaSetValues(w_list->ui->stage, + XtNanimatorMode, b->state, + (char *)0); + /* replace the cast */ + XtVaSetValues(w_list->ui->stage, + XtNanimatorCast, b->sht[sht].cast, + XtNanimatorDelta, b->sht[sht].delta, + XtNanimatorDuration, b->sht[sht].duration, + XtNanimatorBgPixmap, b->sht[sht].bg, + XtNanimatorNow, b->sht[sht].now, + (char *)0); + w_list->sht = sht; return NIL; } @@ -237,6 +292,8 @@ init_subr_0("image-filename", limage_filename); init_subr_2("ani-property", ani_property); init_subr_2("ani-ctl", lani_ctl); + init_subr_0("next-page", lnext_page); + init_subr_0("previous-page", lprevious_page); XtAppAddActions(app_context, actions, XtNumber(actions)); } diff -urNP ../siag-3.3.8/xegon/xegon.h ./xegon/xegon.h --- ../siag-3.3.8/xegon/xegon.h Thu Apr 6 14:53:37 2000 +++ ./xegon/xegon.h Thu Jun 1 10:21:01 2000 @@ -1,6 +1,6 @@ /* Egon Animator - Copyright (C) 1997 Ulric Eriksson + Copyright (C) 1997-2000 Ulric Eriksson 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 @@ -27,14 +27,15 @@ /* Each list has a frame, a title, a viewport and a list */ typedef struct egon_ui { - Widget viewport, /* really a rudegrid */ + Widget viewport, /* really a rudegrid */ objf, objt, objv, objl, /* cast */ tickf, tickt, tickv, tickl, /* script */ propf, propt, propv, propl; /* properties */ + Widget ani_shell, stage; + Widget tabbox, tab, tabl, tabr; /* tabbing stuff */ } egon_ui; -extern window *find_window_by_widget(Widget); extern Atom target_atom; /* from selection.c */ @@ -60,7 +61,6 @@ extern void interp_startup(void); /* from main.c */ -extern Widget topLevel, topbox, box, form, label1, label2, label3, - gridpane, edit_shell, stage; -extern Widget btnFont, btnSize, btnStyle, btnColor; -extern Widget cmdBold, cmdItalic, cmdHLeft, cmdHCenter, cmdHRight; +extern Widget topLevel; +extern void stage_init(window *); + diff -urNP ../siag-3.3.8/xfiler/Chmod.c ./xfiler/Chmod.c --- ../siag-3.3.8/xfiler/Chmod.c Fri Sep 24 00:51:47 1999 +++ ./xfiler/Chmod.c Thu Jun 15 08:06:34 2000 @@ -17,10 +17,10 @@ #include #include +#include "Files.h" + #include "../common/common.h" #include "../xcommon/xcommon.h" - -#include "Files.h" #define FORM_WIDTH 96 diff -urNP ../siag-3.3.8/xfiler/Comms.c ./xfiler/Comms.c --- ../siag-3.3.8/xfiler/Comms.c Wed Apr 28 18:25:15 1999 +++ ./xfiler/Comms.c Thu Jun 15 08:07:47 2000 @@ -158,11 +158,10 @@ } if (c->message_type == xfm_update_window) return; - if (c->message_type == wm_protocols) - if (w == toplevel) + if (c->message_type == wm_protocols) { + if (w == toplevel) { toplevelCloseCb(w, file_windows, (XtPointer)NULL); - else - { + } else { FileWindowRec *fw; for (fw = file_windows; fw; fw = fw->next) if (w == fw->shell) break; @@ -171,6 +170,7 @@ else fileCloseCb(w, fw, (XtPointer)NULL); } + } in_use = 0; } diff -urNP ../siag-3.3.8/xfiler/Delete.c ./xfiler/Delete.c --- ../siag-3.3.8/xfiler/Delete.c Wed Apr 28 18:25:15 1999 +++ ./xfiler/Delete.c Thu Jun 15 08:09:11 2000 @@ -35,7 +35,7 @@ goto out; } - for (i=0; i < fw->n_files; i++) + for (i=0; i < fw->n_files; i++) { if (fw->files[i]->selected) { if (!fw->files[i]->sym_link && S_ISDIR(fw->files[i]->stats.st_mode)) if (!strcmp(fw->files[i]->name, ".") || @@ -45,17 +45,17 @@ } else if (resources.confirm_delete_folder && !confirm("Do you REALLY wish to delete folder", fw->files[i]->name, - "and ALL items contained in it?")) - if (aborted) - break; - else - continue; + "and ALL items contained in it?")) { + if (aborted) break; + else continue; + } if (rdel(fw->files[i]->name)) { sprintf(error_string, "Error deleting %s:", fw->files[i]->name); sysError(error_string); } else n_deleted++; } + } if (n_deleted) { markForUpdate(fw->directory); @@ -89,22 +89,22 @@ goto out; } - for (i=0; i < fw->n_files; i++) + for (i=0; i < fw->n_files; i++) { if (strcmp(fw->files[i]->name, ".") && strcmp(fw->files[i]->name, "..")) { if (!fw->files[i]->sym_link && S_ISDIR(fw->files[i]->stats.st_mode) && resources.confirm_delete_folder && !confirm("Do you REALLY wish to delete folder", fw->files[i]->name, - "and ALL items contained in it?")) - if (aborted) - break; - else - continue; + "and ALL items contained in it?")) { + if (aborted) break; + else continue; + } if (rdel(fw->files[i]->name)) { sprintf(error_string, "Error deleting %s:", fw->files[i]->name); sysError(error_string); } else n_deleted++; } + } if (n_deleted) { markForUpdate(fw->directory); diff -urNP ../siag-3.3.8/xfiler/Dnd.c ./xfiler/Dnd.c --- ../siag-3.3.8/xfiler/Dnd.c Tue May 16 11:20:29 2000 +++ ./xfiler/Dnd.c Thu Jun 15 08:09:44 2000 @@ -397,11 +397,10 @@ char s[MAXPATHLEN]; sprintf(s, "%s file %s already exists at destination", move?"Move:":"Copy:", tmp+strlen(workingdir)+1); - if (!confirm(s, "Overwrite?", "")) - if (aborted) - break; - else - continue; + if (!confirm(s, "Overwrite?", "")) { + if (aborted) break; + else continue; + } } if (move ? rename(tmp,destination) : rcopy(tmp,destination)) { @@ -468,11 +467,7 @@ if (!strcmp(cmd, "EDIT")) { -#if 0 - strcpy(cmd, resources.default_editor); -#else sprintf(cmd, "siagrun editor"); -#endif strcat(cmd, " "); strcat(cmd, directory); strcat(cmd, "/"); diff -urNP ../siag-3.3.8/xfiler/Fw.c ./xfiler/Fw.c --- ../siag-3.3.8/xfiler/Fw.c Thu Apr 6 14:53:38 2000 +++ ./xfiler/Fw.c Thu Jun 15 08:20:18 2000 @@ -36,6 +36,8 @@ #include +#include "Files.h" + #include "../common/common.h" #include "../common/cmalloc.h" #include "../xcommon/Frame.h" @@ -45,8 +47,6 @@ #include "../xcommon/TextField.h" #include "../xcommon/xcommon.h" -#include "Files.h" - #define FW_WIDTH 400 #define FW_HEIGHT 300 #define TEXT_PADDING 10 @@ -838,22 +838,26 @@ } else if (S_ISDIR(file->stats.st_mode)) { icon_toggle_args[3].value = (XtArgVal) dir_translations; - if (icon == None) - if (file->sym_link) + if (icon == None) { + if (file->sym_link) { icon = (XtArgVal) bm[DIRLNK_BM]; - else if (!strcmp(file->name, "..")) + } else if (!strcmp(file->name, "..")) { icon = (XtArgVal) bm[UPDIR_BM]; - else + } else { icon = (XtArgVal) bm[DIR_BM]; + } + } icontype = 0; } else if (file->stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { icon_toggle_args[3].value = (XtArgVal) exec_translations; - if (icon == None) - if (file->sym_link) + if (icon == None) { + if (file->sym_link) { icon = (XtArgVal) bm[EXECLNK_BM]; - else + } else { icon = (XtArgVal) bm[EXEC_BM]; + } + } icontype = 2; } else { @@ -867,14 +871,16 @@ /* This is our opportunity to load a custom icon /Ulric */ icon = load_custom_icon(file->icon.form, file->name); - if (icon == None) - if (file->type) + if (icon == None) { + if (file->type) { icon = (XtArgVal) file->type->icon_bm; - else if (file->sym_link) + } else if (file->sym_link) { icon = (XtArgVal) bm[SYMLNK_BM]; - else + } else { icon = (XtArgVal) bm[FILE_BM]; + } icontype = 1; + } } icon_toggle_args[2].value = icon; @@ -1424,7 +1430,7 @@ fw->next = file_windows; file_windows = fw; - if (!getwd(fw->directory)) { + if (!getcwd(fw->directory, MAXPATHLEN)) { sysError("Can't open folder:"); return NULL; } diff -urNP ../siag-3.3.8/xfiler/FwActions.c ./xfiler/FwActions.c --- ../siag-3.3.8/xfiler/FwActions.c Tue May 16 11:21:52 2000 +++ ./xfiler/FwActions.c Thu Jun 15 08:20:30 2000 @@ -15,9 +15,9 @@ #include #include -#include "../common/common.h" - #include "Files.h" + +#include "../common/common.h" /*--------------------------------------------------------------------------- PUBLIC FUNCTIONS ---------------------------------------------------------------------------*/ @@ -301,7 +301,7 @@ return; if (chdir(fw->directory) || chdir(fw->files[i]->name)) sysError("Can't open folder:"); - else if (!getwd(path)) + else if (!getcwd(path, MAXPATHLEN)) sysError("System error:"); else { strcpy(fw->directory, path); @@ -427,11 +427,7 @@ if (resources.default_editor) { -#if 0 - strcpy(path, resources.default_editor); -#else sprintf(path, "siagrun editor"); -#endif strcat(path, " "); strcat(path, fname); @@ -480,11 +476,7 @@ if (resources.default_viewer) { -#if 0 - strcpy(path, resources.default_viewer); -#else sprintf(path, "siagrun editor"); -#endif strcat(path, " "); strcat(path, fname); diff -urNP ../siag-3.3.8/xfiler/FwCb.c ./xfiler/FwCb.c --- ../siag-3.3.8/xfiler/FwCb.c Tue May 16 11:24:03 2000 +++ ./xfiler/FwCb.c Thu Jun 15 08:21:39 2000 @@ -17,12 +17,12 @@ #include #include +#include "Files.h" + #include "../common/common.h" #include "../common/cmalloc.h" #include "../xcommon/dialogs.h" -#include "Files.h" - /*----------------------------------------------------------------------------- This function is also used in FmFwActions when a directory is pulled onto the root window. In this case, w will be zero and we use this to popup @@ -226,11 +226,13 @@ FileWindowRec *p; int d; - if (fw == file_windows && fw->next == NULL) - if (!resources.confirm_quit || confirm("", "Exit file manager?", "")) + if (fw == file_windows && fw->next == NULL) { + if (!resources.confirm_quit || confirm("", "Exit file manager?", "")) { quit(); - else + } else { return; + } + } if ((d = findDev(fw->directory)) != -1) umountDev(d); @@ -269,9 +271,9 @@ freeze = True; if (chdir(user.home)) sysError("Can't open folder:"); - else if (!getwd(fw->directory)) + else if (!getcwd(fw->directory, MAXPATHLEN)) sysError("System error:"); - getwd(fw->directory); + getcwd(fw->directory, MAXPATHLEN); updateFileDisplay(fw); freeze = False; } @@ -283,9 +285,9 @@ freeze = True; if (chdir(fw->directory) || chdir("..")) sysError("Can't open folder:"); - else if (!getwd(fw->directory)) + else if (!getcwd(fw->directory, MAXPATHLEN)) sysError("System error:"); - getwd(fw->directory); + getcwd(fw->directory, MAXPATHLEN); updateFileDisplay(fw); freeze = False; } @@ -307,10 +309,10 @@ for (i=0; in_files; i++) if (fw->files[i]->icon.arrow == w) { -/* getwd(fw->directory); */ +/* getcwd(fw->directory, MAXPATHLEN); */ if (chdir(fw->directory) || chdir(fw->files[i]->name)) sysError("Can't open folder:"); - else if (!getwd(fw->directory)) + else if (!getcwd(fw->directory, MAXPATHLEN)) sysError("System error:"); break; } @@ -411,7 +413,7 @@ if (p) { *(p+1) = '\0'; chdir(files[n]); - getwd(fw->directory); + getcwd(fw->directory, MAXPATHLEN); updateFileDisplay(fw); } else { ; /* bogus path, ignore */ diff -urNP ../siag-3.3.8/xfiler/Info.c ./xfiler/Info.c --- ../siag-3.3.8/xfiler/Info.c Fri Sep 24 00:52:05 1999 +++ ./xfiler/Info.c Thu Jun 15 08:13:57 2000 @@ -20,9 +20,9 @@ #include #include +#include "Files.h" #include "../common/common.h" #include "../xcommon/xcommon.h" -#include "Files.h" #define LABEL_WIDTH 200 #define PADDING 30 diff -urNP ../siag-3.3.8/xfiler/Main.c ./xfiler/Main.c --- ../siag-3.3.8/xfiler/Main.c Thu Mar 30 00:24:05 2000 +++ ./xfiler/Main.c Thu Jun 15 08:22:14 2000 @@ -33,12 +33,12 @@ #include #endif +#include "Files.h" + #include "../common/common.h" #include "../xcommon/xcommon.h" #include "../xcommon/Tooltip.h" -#include "Files.h" - #define XtRDisplayType "DisplayType" #define XtRSortType "SortType" /*--------------------------------------------------------------------------- @@ -410,7 +410,7 @@ if ((s = getenv("HOME"))) strcpy(user.home,s); else - getwd(user.home); + getcwd(user.home, MAXPATHLEN); if ((s = getenv("SHELL"))) strcpy(user.shell,s); diff -urNP ../siag-3.3.8/xfiler/Makefile.in ./xfiler/Makefile.in --- ../siag-3.3.8/xfiler/Makefile.in Fri May 26 08:27:01 2000 +++ ./xfiler/Makefile.in Thu Jun 15 08:25:54 2000 @@ -456,9 +456,9 @@ pixmaps/xfm_blackhole.xpm pixmaps/xfm_icon.xpm Files.h \ ../config.h ../xcommon/DragAndDrop.h \ ../xcommon/DragAndDropTypes.h -Chmod.o: Chmod.c ../common/common.h ../xcommon/xcommon.h Files.h \ - ../config.h ../xcommon/DragAndDrop.h \ - ../xcommon/DragAndDropTypes.h +Chmod.o: Chmod.c Files.h ../config.h ../xcommon/DragAndDrop.h \ + ../xcommon/DragAndDropTypes.h ../common/common.h \ + ../xcommon/xcommon.h Comms.o: Comms.c Files.h ../config.h ../xcommon/DragAndDrop.h \ ../xcommon/DragAndDropTypes.h Comms.h Confirm.o: Confirm.c ../xcommon/xcommon.h Files.h ../config.h \ @@ -474,35 +474,36 @@ Exec.o: Exec.c Files.h ../config.h ../xcommon/DragAndDrop.h \ ../xcommon/DragAndDropTypes.h Fw.o: Fw.c ../Nws/MenuBar.h ../Nws/Row.h ../Nws/BaseConst.h ../Nws/cvt.h \ - ../common/common.h ../common/cmalloc.h ../xcommon/Frame.h \ - ../xcommon/Handle.h ../xcommon/../XawM/Label.h \ - ../xcommon/Tooltip.h ../xcommon/Rudegrid.h \ - ../xcommon/TextField.h ../xcommon/xcommon.h Files.h ../config.h \ - ../xcommon/DragAndDrop.h ../xcommon/DragAndDropTypes.h -FwActions.o: FwActions.c ../common/common.h Files.h ../config.h \ - ../xcommon/DragAndDrop.h ../xcommon/DragAndDropTypes.h -FwCb.o: FwCb.c ../common/common.h ../common/cmalloc.h \ - ../xcommon/dialogs.h Files.h ../config.h \ - ../xcommon/DragAndDrop.h ../xcommon/DragAndDropTypes.h -Info.o: Info.c ../common/common.h ../xcommon/xcommon.h Files.h \ - ../config.h ../xcommon/DragAndDrop.h \ - ../xcommon/DragAndDropTypes.h -Main.o: Main.c ../common/common.h ../xcommon/xcommon.h \ - ../xcommon/Tooltip.h Files.h ../config.h \ - ../xcommon/DragAndDrop.h ../xcommon/DragAndDropTypes.h \ + Files.h ../config.h ../xcommon/DragAndDrop.h \ + ../xcommon/DragAndDropTypes.h ../common/common.h \ + ../common/cmalloc.h ../xcommon/Frame.h ../xcommon/Handle.h \ + ../xcommon/../XawM/Label.h ../xcommon/Tooltip.h \ + ../xcommon/Rudegrid.h ../xcommon/TextField.h \ + ../xcommon/xcommon.h +FwActions.o: FwActions.c Files.h ../config.h ../xcommon/DragAndDrop.h \ + ../xcommon/DragAndDropTypes.h ../common/common.h +FwCb.o: FwCb.c Files.h ../config.h ../xcommon/DragAndDrop.h \ + ../xcommon/DragAndDropTypes.h ../common/common.h \ + ../common/cmalloc.h ../xcommon/dialogs.h +Info.o: Info.c Files.h ../config.h ../xcommon/DragAndDrop.h \ + ../xcommon/DragAndDropTypes.h ../common/common.h \ + ../xcommon/xcommon.h +Main.o: Main.c Files.h ../config.h ../xcommon/DragAndDrop.h \ + ../xcommon/DragAndDropTypes.h ../common/common.h \ + ../xcommon/xcommon.h ../xcommon/Tooltip.h \ ../xcommon/xcommon-ad.h ../xcommon/dialogs-ad.h \ ../xcommon/nws-ad.h xfiler-ad.h -Ops.o: Ops.c ../common/common.h Files.h ../config.h \ - ../xcommon/DragAndDrop.h ../xcommon/DragAndDropTypes.h -Popup.o: Popup.c ../common/common.h ../xcommon/dialogs.h \ - ../xcommon/TextField.h Files.h ../config.h \ - ../xcommon/DragAndDrop.h ../xcommon/DragAndDropTypes.h +Ops.o: Ops.c Files.h ../config.h ../xcommon/DragAndDrop.h \ + ../xcommon/DragAndDropTypes.h ../common/common.h +Popup.o: Popup.c Files.h ../config.h ../xcommon/DragAndDrop.h \ + ../xcommon/DragAndDropTypes.h ../common/common.h \ + ../xcommon/dialogs.h ../xcommon/TextField.h Utils.o: Utils.c ../Nws/utils.h ../Nws/cvt.h ../Nws/MenuBar.h \ ../Nws/Row.h ../Nws/BaseConst.h ../Nws/Menu.h ../Nws/MBButton.h \ ../Nws/LabelME.h ../Nws/BaseME.h ../Nws/LineME.h \ - ../xcommon/TextField.h ../common/common.h ../common/cmalloc.h \ - Files.h ../config.h ../xcommon/DragAndDrop.h \ - ../xcommon/DragAndDropTypes.h blank.xpm dot.xpm + ../xcommon/TextField.h Files.h ../config.h \ + ../xcommon/DragAndDrop.h ../xcommon/DragAndDropTypes.h \ + ../common/common.h ../common/cmalloc.h blank.xpm dot.xpm exec.o: exec.c Files.h ../config.h ../xcommon/DragAndDrop.h \ ../xcommon/DragAndDropTypes.h magic.o: magic.c magic.h regexp.h diff -urNP ../siag-3.3.8/xfiler/Ops.c ./xfiler/Ops.c --- ../siag-3.3.8/xfiler/Ops.c Mon Apr 12 18:45:50 1999 +++ ./xfiler/Ops.c Thu Jun 15 08:16:00 2000 @@ -14,10 +14,10 @@ #include #include -#include "../common/common.h" - #include "Files.h" +#include "../common/common.h" + /* split a string into substrings delimited by a given character */ char *split(char *s, char c) @@ -131,17 +131,19 @@ pattern++; if (*pattern == ']') return 0; - else if (pattern[0] == '-' && pattern > start && pattern[1] != ']') - if (pattern[-1] <= *fn && *fn <= pattern[1]) + else if (pattern[0] == '-' && pattern > start && pattern[1] != ']') { + if (pattern[-1] <= *fn && *fn <= pattern[1]) { break; - else { + } else { start = (++pattern)+1; goto next; } + } } while (*fn != *pattern); - while (*pattern != ']') + while (*pattern != ']') { if (!*pattern++) return 0; + } break; default: @@ -197,11 +199,10 @@ if (!(t = strchr(s, ':'))) t = strchr(s, 0); if (s == t) goto next; - if (s[0] == '.') - if ((t = s+1)) - s = t; - else if (s[1] == '/') - s += 2; + if (s[0] == '.') { + if ((t = s+1)) s = t; + else if (s[1] == '/') s += 2; + } l = t-s; strncpy(s1, s, l); if (l > 0 && s1[l - 1] != '/') diff -urNP ../siag-3.3.8/xfiler/Popup.c ./xfiler/Popup.c --- ../siag-3.3.8/xfiler/Popup.c Mon Apr 19 10:28:44 1999 +++ ./xfiler/Popup.c Thu Jun 15 08:23:13 2000 @@ -22,13 +22,13 @@ #include #include +#include "Files.h" + #include "../common/common.h" /* for ABORT */ #include "../xcommon/dialogs.h" #include "../xcommon/TextField.h" -#include "Files.h" - /*--------------------------------------------------------------------------- STATIC DATA ---------------------------------------------------------------------------*/ @@ -404,7 +404,7 @@ char s[0xff]; sprintf(s, "Can't open folder %s:", b); sysError(s); - } else if (!getwd(b)) + } else if (!getcwd(b, MAXPATHLEN)) sysError("System error:"); else { strcpy(popups.fw->directory, b); @@ -452,7 +452,7 @@ if (!stat(to, &stats) && S_ISDIR(stats.st_mode)) { - if (chdir(to) || !getwd(to) || chdir(popups.fw->directory)) { + if (chdir(to) || !getcwd(to, MAXPATHLEN) || chdir(popups.fw->directory)) { sysError("System error:"); goto out; } else if (!strcmp(popups.fw->directory, to)) { @@ -480,11 +480,10 @@ if (exists(to) && resources.confirm_overwrite) { char s[0xff]; sprintf(s, "Move: file %s already exists at destination", from); - if (!confirm(s, "Overwrite?", "")) - if (aborted) - break; - else - continue; + if (!confirm(s, "Overwrite?", "")) { + if (aborted) break; + else continue; + } } if (rename(from,to)) { char s[0xff]; @@ -536,7 +535,7 @@ } else { n_moved = 1; dir_prefix(todir, to); - if ((*todir?chdir(todir):0) || !getwd(todir)) + if ((*todir?chdir(todir):0) || !getcwd(todir, MAXPATHLEN)) sysError("System error:"); } } @@ -591,7 +590,7 @@ if (!stat(to, &stats) && S_ISDIR(stats.st_mode)) { - if (chdir(to) || !getwd(to) || chdir(popups.fw->directory)) { + if (chdir(to) || !getcwd(to, MAXPATHLEN) || chdir(popups.fw->directory)) { sysError("System error:"); goto out; } else if (!strcmp(popups.fw->directory, to)) { @@ -619,11 +618,10 @@ if (exists(to) && resources.confirm_overwrite) { char s[0xff]; sprintf(s, "Copy: file %s already exists at destination", from); - if (!confirm(s, "Overwrite?", "")) - if (aborted) - break; - else - continue; + if (!confirm(s, "Overwrite?", "")) { + if (aborted) break; + else continue; + } } if (rcopy(from,to)) { char s[0xff]; @@ -675,7 +673,7 @@ } else { n_copied = 1; dir_prefix(todir, to); - if ((*todir?chdir(todir):0) || !getwd(todir)) + if ((*todir?chdir(todir):0) || !getcwd(todir, MAXPATHLEN)) sysError("System error:"); } } @@ -739,7 +737,7 @@ if (!stat(to, &stats) && S_ISDIR(stats.st_mode)) { - if (chdir(to) || !getwd(to) || chdir(popups.fw->directory)) { + if (chdir(to) || !getcwd(to, MAXPATHLEN) || chdir(popups.fw->directory)) { sysError("System error:"); goto out; } else if (!strcmp(popups.fw->directory, to)) { @@ -763,11 +761,10 @@ if (exists(to) && resources.confirm_overwrite) { char s[0xff]; sprintf(s, "Link: file %s already exists at destination", from); - if (!confirm(s, "Overwrite?", "")) - if (aborted) - break; - else - continue; + if (!confirm(s, "Overwrite?", "")) { + if (aborted) break; + else continue; + } } if (symlink(name,to)) { char s[0xff]; @@ -818,7 +815,7 @@ } else { n_linked = 1; dir_prefix(todir, to); - if ((*todir?chdir(todir):0) || !getwd(todir)) + if ((*todir?chdir(todir):0) || !getcwd(todir, MAXPATHLEN)) sysError("System error:"); } } diff -urNP ../siag-3.3.8/xfiler/Utils.c ./xfiler/Utils.c --- ../siag-3.3.8/xfiler/Utils.c Wed Feb 2 10:38:45 2000 +++ ./xfiler/Utils.c Thu Jun 15 08:17:30 2000 @@ -28,9 +28,9 @@ #include #include "../xcommon/TextField.h" +#include "Files.h" #include "../common/common.h" #include "../common/cmalloc.h" -#include "Files.h" #include "blank.xpm" #include "dot.xpm" diff -urNP ../siag-3.3.8/xpw/window.c ./xpw/window.c --- ../siag-3.3.8/xpw/window.c Thu May 25 22:44:19 2000 +++ ./xpw/window.c Thu Jun 15 08:00:48 2000 @@ -1446,6 +1446,8 @@ t1_init(topLevel); + XSetErrorHandler(xerror_handler); + XtGetApplicationResources(topLevel, &app_data, resources, XtNumber(resources), NULL, 0); plugin = app_data.plugin; diff -urNP ../siag-3.3.8/xsiag/window.c ./xsiag/window.c --- ../siag-3.3.8/xsiag/window.c Fri May 19 08:11:01 2000 +++ ./xsiag/window.c Thu Jun 15 08:00:33 2000 @@ -1942,6 +1942,8 @@ t1_init(topLevel); + XSetErrorHandler(xerror_handler); + XtGetApplicationResources(topLevel, &app_data, resources, XtNumber(resources), NULL, 0); plugin = app_data.plugin;