Scantool part 1(5) (shar)

Was a Sunny day gunnar at falcon.ericsson.se
Tue Jun 18 22:42:54 AEST 1991


Here is the scantool package.

It allows connecting a Microtek MSF-300A 
monochrome flatbed scanner to a Sun workstation
for input of images into Sun rasterfiles.
Quite useful for people like Framemaker users.
I have tested it under SunOS 4.1 and except for
some minor trouble it seems to work.

It contains tools for both Xview and Sunview.

Send me a postcard if it works.

It is written by Rich Burridge at Sun in Australia and
he has released it for public use as long as no money is
made out of it. I got his permission to post it.

His address is :

Rich Burridge,          DOMAIN: richb at Aus.Sun.COM
PHONE: +61 2 413 2666   ACSNET: richb at sunaus.sun.oz

Happy scanning!
-------------------------------------------------------------------
                       Gunnar Forsgren
             (__)      Ericsson Telecom AB     
             (oo)      Department for Standard Computer Systems	
      /-------\/       126 25 Stockholm
     / |  G  ||        SWEDEN
    *  ||----||        email: gunnar at beppe.ericsson.se
       ~~    ~~
                       Disclaimer: I'm acting on behalf of myself.
-------------------------------------------------------------------

------------Cut here------------------------------------------------
#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 06/18/1991 08:31 UTC by gunnar at falcon
#
# existing files will NOT be overwritten unless -c is specified
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   2345 -rw-r--r-- CHANGES
#   1063 -rw-r--r-- Imakefile
#   9590 -rw-r--r-- Makefile
#   2832 -rw-r--r-- README
#   2559 -rw-r--r-- README.etx
#   2184 -rw-r--r-- black.codes
#   1933 -rw-r--r-- button.invert.icon
#   1933 -rw-r--r-- button.normal.icon
#   1933 -rw-r--r-- exclaim.icon
#    193 -rw-r--r-- frame.cursor
#  12024 -rw-r--r-- graphics.c
#    193 -rw-r--r-- help.cursor
#   1552 -rw-r--r-- images.h
#    193 -rw-r--r-- main.cursor
#    156 -r-xr-xr-x make.sunview
#   4598 -rw-r--r-- makefile.sunview
#  11483 -rw-r--r-- misc.c
#  12908 -rw-r--r-- notify.h
#    563 -rw-r--r-- patchlevel.h
#   3375 -rw-r--r-- scan.1
#  19810 -rw-r--r-- scan.c
#   3171 -rw-r--r-- scan.h
#   6931 -rw-r--r-- scan_compress.c
#   1744 -rw-r--r-- scan_extern.h
#   6726 -rw-r--r-- scantool.1
#   6453 -rw-r--r-- scantool.c
#   4982 -rw-r--r-- scantool.h
#   5356 -rw-r--r-- scantool.help
#   1933 -rw-r--r-- scantool.icon
#   2593 -rw-r--r-- scantool_extern.h
#  13894 -rw-r--r-- sunview.c
#    193 -rw-r--r-- switch.invert.cursor
#    193 -rw-r--r-- switch.normal.cursor
#   2080 -rw-r--r-- white.codes
#  16935 -rw-r--r-- xview.c
#
if test -r _shar_seq_.tmp; then
	echo 'Must unpack archives in sequence!'
	echo Please unpack part `cat _shar_seq_.tmp` next
	exit 1
fi
# ============= CHANGES ==============
if test -f 'CHANGES' -a X"$1" != X"-c"; then
	echo 'x - skipping CHANGES (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting CHANGES (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'CHANGES' &&
Scantool change history.
------------------------
X
v1.4 - patchlevel 0. - 2nd April 1990.
X
X       * First freely available version.
X
X       * Includes new XView graphics driver.
X
X       * Scanning process is now a separate program.
X
v1.4 - patchlevel 1. - 3rd April 1990.
X
X       * Added a SIGKILL signal handler to the scan program, so that an
X         ETX character can be sent to the scanner to terminate correctly.
X
X       * Added a destroy handler to the scantool program, so that if we
X         were scanning, then the child scan process can be properly killed.
X
X       * Scantool buttons now correctly invert.
X
X       * WIN_STOP events are now correctly handled with the SunView version.
X
X       * The switches have been changed to be check boxes and not panel
X         choice items.
X
v1.4 - patchlevel 2 - 4th April 1990.        (Apply with patch -N).
X
X       * The definitions for the bold and normal fonts were the wrong way
X         around in the XView graphics driver.
X
X       * The rasterop function for all the cursors has been set to the
X         default.
X
X       * The infinite testing loop in scan.c has been removed.
X
X       * The use of the Stop (L1) function key has been replaced with a
X         special Cancel button. WIN_STOP events don't appear to be handled
X         correctly under XView.
X
X       * The checkbox switches were not being ropped to the canvas correctly
X         with the XView version.
X
X       * The input focus was not being set to the scantool canvas when the
X         mouse entered it with the XView version.
X
X       * The width of the fonts used under SunView and XView are different,
X         so the definition FONT_WIDTH has been removed and replaced with a
X         variable font_width.
X
X       * The line "cursor" used in the Set picture name routine is now
X         positioned using get_strwidth instead of being hard-wired.
X
X       * Cursors can now be correctly set with the XView version.
X
v1.4 - patchlevel 3 - 10th April 1990.
X
X       * Fixed up the XView version for creating a new scanning frame.
X
X       * Changed the rasterop function for ropgc from GXor to GXcopy.
X         Button inversion now works correctly.
v1.x - general fix - 18th June 1991.
X       * Make generates xview tool. To make Sunview tool, run the script
X         'make.sunview'.
X         Works under SunOS 4.1
X       
SHAR_EOF
chmod 0644 CHANGES ||
echo 'restore of CHANGES failed'
Wc_c="`wc -c < 'CHANGES'`"
test 2345 -eq "$Wc_c" ||
	echo 'CHANGES: original size 2345, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= Imakefile ==============
if test -f 'Imakefile' -a X"$1" != X"-c"; then
	echo 'x - skipping Imakefile (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting Imakefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Imakefile' &&
#
#  @(#)Imakefile 1.2 90/04/12
#
#  Copyright (c) Rich Burridge - Sun Microsystems Australia.
#                                Al rights reservered.
#
#  Permission is given to distribute these sources, as long as the
#  copyright messages are not removed, and no monies are exchanged.
#
#  No responsibility is taken for any errors inherent either in the comments
#  or the code of this program, but if reported to me then an attempt will
#  be made to fix them.
X
LIBRARY_DEST = /usr/openwin/lib
HEADER_DEST = /usr/openwin/include
X
PROGRAMS = scantool scan
HELPNAME = -DHELPNAME=\"/usr/local/lib/scantool/scantool.help\"
X
DEFINES = $(HELPNAME) $(SELTYPE) $(SIGRET)
X
INCLUDES = -I$(HEADER_DEST) $(DEFINES)
DEPLIBS =
LOCAL_LIBRARIES =  $(LIBRARY_DEST)/libxview.a $(LIBRARY_DEST)/libolgx.a \
X		   $(LIBRARY_DEST)/libX11.a -lpixrect
X
SRCS = scantool.c graphics.c misc.c xview.c
OBJS = scantool.o graphics.o misc.o xview.o
X
SRCS2 = scan.c scan_compress.c
OBJS2 = scan.o scan_compress.o
X
ComplexProgramTarget(scantool)
SingleProgramTarget(scan, $(OBJS2), /**/, /**/)
SHAR_EOF
chmod 0644 Imakefile ||
echo 'restore of Imakefile failed'
Wc_c="`wc -c < 'Imakefile'`"
test 1063 -eq "$Wc_c" ||
	echo 'Imakefile: original size 1063, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= Makefile ==============
if test -f 'Makefile' -a X"$1" != X"-c"; then
	echo 'x - skipping Makefile (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
# Makefile generated by imake - do not edit!
# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $
#
# The cpp used on this machine replaces all newlines and multiple tabs and
# spaces in a macro expansion with a single space.  Imake tries to compensate
# for this, but is not always successful.
#
X
###########################################################################
# Makefile generated from "Imake.tmpl" and </tmp/IIf.a00291>
# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $
#
# Platform-specific parameters may be set in the appropriate .cf
# configuration files.  Site-wide parameters may be set in the file
# site.def.  Full rebuilds are recommended if any parameters are changed.
#
# If your C preprocessor doesn't define any unique symbols, you'll need
# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
# "make Makefile", "make Makefiles", or "make World").
#
# If you absolutely can't get imake to work, you'll need to set the
# variables at the top of each Makefile as well as the dependencies at the
# bottom (makedepend will do this automatically).
#
X
###########################################################################
# platform-specific configuration parameters - edit sun.cf to change
X
# platform:  $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $
# operating system:  SunOS 4.1.1
X
###########################################################################
# site-specific configuration parameters - edit site.def to change
X
# site:  $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $
X
X            SHELL = /bin/sh
X
X              TOP = .
X      CURRENT_DIR = .
X
X               AR = ar cq
X  BOOTSTRAPCFLAGS =
X               CC = cc
X
X         COMPRESS = compress
X              CPP = /lib/cpp $(STD_CPP_DEFINES)
X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
X          INSTALL = install
X               LD = ld
X             LINT = lint
X      LINTLIBFLAG = -C
X         LINTOPTS = -axz
X               LN = ln -s
X             MAKE = make
X               MV = mv
X               CP = cp
X           RANLIB = ranlib
X  RANLIBINSTFLAGS =
X               RM = rm -f
X     STD_INCLUDES =
X  STD_CPP_DEFINES =
X      STD_DEFINES =
X EXTRA_LOAD_FLAGS =
X  EXTRA_LIBRARIES =
X             TAGS = ctags
X
X    PROTO_DEFINES =
X
X     INSTPGMFLAGS =
X
X     INSTBINFLAGS = -m 0755
X     INSTUIDFLAGS = -m 4755
X     INSTLIBFLAGS = -m 0664
X     INSTINCFLAGS = -m 0444
X     INSTMANFLAGS = -m 0444
X     INSTDATFLAGS = -m 0444
X    INSTKMEMFLAGS = -m 4755
X
X          DESTDIR =
X
X     TOP_INCLUDES = -I$(INCROOT)
X
X      CDEBUGFLAGS = -O
X        CCOPTIONS =
X      COMPATFLAGS =
X
X      ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES)
X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS)
X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)
X   LDCOMBINEFLAGS = -X -r
X
X        MACROFILE = sun.cf
X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
X
X    IMAKE_DEFINES =
X
X         IRULESRC = $(CONFIGDIR)
X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
X
X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
X			$(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
X			$(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
X
###########################################################################
# X Window System Build Parameters
# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
###########################################################################
# X Window System make variables; this need to be coordinated with rules
# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X          PATHSEP = /
X        USRLIBDIR = /usr/local/lib
X           BINDIR = $(DESTDIR)/usr/bin/X11
X          INCROOT = $(DESTDIR)/usr/include
X     BUILDINCROOT = $(TOP)
X      BUILDINCDIR = $(BUILDINCROOT)/X11
X      BUILDINCTOP = ..
X           INCDIR = $(INCROOT)/X11
X           ADMDIR = $(DESTDIR)/usr/adm
X           LIBDIR = $(USRLIBDIR)/X11
X        CONFIGDIR = $(LIBDIR)/config
X       LINTLIBDIR = $(USRLIBDIR)/lint
X
X          FONTDIR = $(LIBDIR)/fonts
X         XINITDIR = $(LIBDIR)/xinit
X           XDMDIR = $(LIBDIR)/xdm
X           AWMDIR = $(LIBDIR)/awm
X           TWMDIR = $(LIBDIR)/twm
X           GWMDIR = $(LIBDIR)/gwm
X          MANPATH = $(DESTDIR)/usr/local/man
X    MANSOURCEPATH = $(MANPATH)/man
X           MANDIR = $(MANSOURCEPATH)n
X        LIBMANDIR = $(MANSOURCEPATH)3
X      XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X       FONTCFLAGS = -t
X
X     INSTAPPFLAGS = $(INSTDATFLAGS)
X
X            IMAKE = imake
X           DEPEND = makedepend
X              RGB = rgb
X            FONTC = bdftosnf
X        MKFONTDIR = mkfontdir
X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh
X
X        CONFIGSRC = $(TOP)/config
X        CLIENTSRC = $(TOP)/clients
X          DEMOSRC = $(TOP)/demos
X           LIBSRC = $(TOP)/lib
X          FONTSRC = $(TOP)/fonts
X       INCLUDESRC = $(TOP)/X11
X        SERVERSRC = $(TOP)/server
X          UTILSRC = $(TOP)/util
X        SCRIPTSRC = $(UTILSRC)/scripts
X       EXAMPLESRC = $(TOP)/examples
X       CONTRIBSRC = $(TOP)/../contrib
X           DOCSRC = $(TOP)/doc
X           RGBSRC = $(TOP)/rgb
X        DEPENDSRC = $(UTILSRC)/makedepend
X         IMAKESRC = $(CONFIGSRC)
X         XAUTHSRC = $(LIBSRC)/Xau
X          XLIBSRC = $(LIBSRC)/X
X           XMUSRC = $(LIBSRC)/Xmu
X       TOOLKITSRC = $(LIBSRC)/Xt
X       AWIDGETSRC = $(LIBSRC)/Xaw
X       OLDXLIBSRC = $(LIBSRC)/oldX
X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
X     MKFONTDIRSRC = $(FONTSRC)/mkfontdir
X     EXTENSIONSRC = $(TOP)/extensions
X
X  DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a
X     EXTENSIONLIB =  -lXext
X
X          DEPXLIB = $(DEPEXTENSIONLIB) $(USRLIBDIR)/libX11.a
X             XLIB = $(EXTENSIONLIB)  -lX11
X
X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
X         XAUTHLIB =  -lXau
X
X        DEPXMULIB = $(USRLIBDIR)/libXmu.a
X           XMULIB =  -lXmu
X
X       DEPOLDXLIB = $(USRLIBDIR)/liboldX.a
X          OLDXLIB =  -loldX
X
X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.a
X         XTOOLLIB =  -lXt
X
X        DEPXAWLIB = $(USRLIBDIR)/libXaw.a
X           XAWLIB =  -lXaw
X
X LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln
X         LINTXLIB = $(USRLIBDIR)/llib-lX11.ln
X          LINTXMU = $(USRLIBDIR)/llib-lXmu.ln
X        LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln
X          LINTXAW = $(USRLIBDIR)/llib-lXaw.ln
X
X        XWLIBSRC = $(CONTRIBSRC)/toolkits/Xw
X        DEPXWLIB = $(USRLIBDIR)/libXw.a
X        XWLIB =  -lXw
X
X          DEPLIBS = $(LOCAL_LIBRARIES)
X
X         DEPLIBS1 = $(DEPLIBS)
X         DEPLIBS2 = $(DEPLIBS)
X         DEPLIBS3 = $(DEPLIBS)
X
###########################################################################
# Imake rules for building libraries, programs, scripts, and data files
# rules:  $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $
X
###########################################################################
# start of Imakefile
X
#
#  @(#)Imakefile 1.2 90/04/12
#
#  Copyright (c) Rich Burridge - Sun Microsystems Australia.
#                                Al rights reservered.
#
#  Permission is given to distribute these sources, as long as the
#  copyright messages are not removed, and no monies are exchanged.
#
#  No responsibility is taken for any errors inherent either in the comments
#  or the code of this program, but if reported to me then an attempt will
#  be made to fix them.
X
LIBRARY_DEST = /usr/openwin/lib
HEADER_DEST = /usr/openwin/include
X
PROGRAMS = scantool scan
HELPNAME = -DHELPNAME=\"/usr/local/lib/scantool/scantool.help\"
X
DEFINES = $(HELPNAME) $(SELTYPE) $(SIGRET)
X
INCLUDES = -I$(HEADER_DEST) $(DEFINES)
DEPLIBS =
LOCAL_LIBRARIES =  $(LIBRARY_DEST)/libxview.a $(LIBRARY_DEST)/libolgx.a \
X		   $(LIBRARY_DEST)/libX11.a -lpixrect
X
SRCS = scantool.c graphics.c misc.c xview.c
OBJS = scantool.o graphics.o misc.o xview.o
X
SRCS2 = scan.c scan_compress.c
OBJS2 = scan.o scan_compress.o
X
X PROGRAM = scantool
X
all:: scantool
X
scantool: $(OBJS) $(DEPLIBS)
X	$(RM) $@
X	$(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
X
install:: scantool
X	$(INSTALL) -c $(INSTPGMFLAGS)   scantool $(BINDIR)
X
install.man:: scantool.man
X	$(INSTALL) -c $(INSTMANFLAGS) scantool.man $(MANDIR)/scantool.n
X
depend::
X	$(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
X
lint:
X	$(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
lint1:
X	$(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
X
clean::
X	$(RM) $(PROGRAM)
X
scan:  $(OBJS2)
X	$(RM) $@
X	$(CC) -o $@  $(OBJS2) $(LDOPTIONS)   $(LDLIBS)   $(EXTRA_LOAD_FLAGS)
X
clean::
X	$(RM) scan
X
###########################################################################
# common rules for all Makefiles - do not edit
X
emptyrule::
X
clean::
X	$(RM_CMD) \#*
X
Makefile::
X	- at if [ -f Makefile ]; then \
X	echo "	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X	else exit 0; fi
X	$(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
X
tags::
X	$(TAGS) -w *.[ch]
X	$(TAGS) -xw *.[ch] > TAGS
X
###########################################################################
# empty rules for directories that do not have SUBDIRS - do not edit
X
install::
X	@echo "install in $(CURRENT_DIR) done"
X
install.man::
X	@echo "install.man in $(CURRENT_DIR) done"
X
Makefiles::
X
includes::
X
###########################################################################
# dependencies generated by makedepend
X
SHAR_EOF
chmod 0644 Makefile ||
echo 'restore of Makefile failed'
Wc_c="`wc -c < 'Makefile'`"
test 9590 -eq "$Wc_c" ||
	echo 'Makefile: original size 9590, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= README ==============
if test -f 'README' -a X"$1" != X"-c"; then
	echo 'x - skipping README (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting README (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'README' &&
X
This is version 1.4 of the scantool program. It can interface to a Microtek
MS300A scanner, scan the document, and turn the image into a Sun rasterfile,
which can be read by dtp programs such as Frame Maker.
X
Permission is given to distribute these sources, as long as the copyright
notices are not removed, and no monies are exchanged.
X
Fixes and improvements in version 1.4 include:
X
X  +Fixed the exhaustion of file descriptors problem.
X  +All values from the Grain and Resolution menus are now selectable.
X  +All scans now produce valid scanning frames.
X  +Compressed scans now fully work.
X  +Format of the rasterfiles has been changed from RT_OLD to RT_STANDARD.
X  +Show option has been added.
X  +The RETURN key is now also valid for the confirm popup.
X  +Window resizing is prevented.
X  +Graphics code has been isolated and program has been generally tidyed up.
X  +Support for SunOS v3.x and SunOS v4.x
X  +The scanning operation has been separated out into a second program.
X  +Inclusion of an XView graphics driver.
X
The software is now divided into two programs; scantool a frontend window
based program for setting the scanning options, and scan, the program that
will actually perform the scan. It should also be possible to run this
scan program on it's own, but there are several command line options to
setup, so it's probably easier through scantool.
X
**IMPORTANT NOTE**
X
I no longer have access to a Microtek MS300A scanner. If you find problems
in this area, then you are on your own. I will be very happy to incorporate
any fixes you make, so other people can enjoy them as well.
X
Installation.
-------------
X
Firstly you should look at the beginning of the Makefile to see if you need
to tweak any of the initial definitions there. If you are generating a SunView
version under SunOS v4.0.x, then this is unlikely.
X
Next you either select "make sunview" or "make xview", to generate the
version you require. This should be followed by a "make install" and a
"make clean".
X
The program currently assumes the scanner is attached to the Sun's A or B
RS232 port. A serial cable will be needed to run between the scanner and the
Sun. I have used the following setup in the past:
X
X         MS-300A                           SUN
X      ------------                     ----------
X    Pin No.    Name      Direction     Pin No.    Name
X   ---------  ------  --------------  ---------  ------
X       2       TXD    Scanner to Sun      3       RXD
X       3       RXD    Sun to scanner      2       TXD
X       7       GND        ---             7       GND
X
Suggestions for furthur improvement would be most welcome, plus bugs,
comments and flames.
X
Rich Burridge,          DOMAIN: richb at Aus.Sun.COM
PHONE: +61 2 413 2666   ACSNET: richb at sunaus.sun.oz
X                        UUCP:   {uunet,mcvax,ukc}!munnari!sunaus.oz!richb
SHAR_EOF
chmod 0644 README ||
echo 'restore of README failed'
Wc_c="`wc -c < 'README'`"
test 2832 -eq "$Wc_c" ||
	echo 'README: original size 2832, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= README.etx ==============
if test -f 'README.etx' -a X"$1" != X"-c"; then
	echo 'x - skipping README.etx (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting README.etx (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'README.etx' &&
Brief notes by Gunnar Forsgren Ericsson Telecom, Sweden.
X
Date  91-06-18
X
I have written a brief report of
using 'scantool' together with the
Microtek MSF-300A scanner to include
scanned images into FrameMaker documents.
X
This possibility should be of general
interest to users,
especially for those writing documentation that
consists of graphic illustrations, figures, etc.
The report is available upon request.
X
'scantool' is the only public domain tool I have
seen (at this date and price) that allows image scanning into Sun bitmaps.
X
For buying a MSF-300A in Sweden,
X
Contact 
X
Professional Systems
Malaxgatan 7
164 75 Kista
Yvonne Jansson
08-752 00 70
X
They have no software support for Sun systems, only
towards PC or Mac. I had the scanner on loan for a week
and managed to get it to work with 'scantool'.
X
The scanner costs 7800 :- (Ericsson price).
Indeed a fair price considering the new possibilities.
X
I assume NO maintenance responsibility !
X
To make Xview tool, first edit Imakefile to adjust any
differences in directories used for help files, include files,
libraries, etc. Then do 'xmkmf' to adjust
Makefile to your X environment.
Then just do 'make' to compile the Xview tool which
will be 'scantool'.
X
To make the Sunview version, run the script
make.sunview 
which uses the file makefile.sunview and
creates a sunview tool named 'sv_scantool'.
Rename it to 'scantool' if you want it as
your tool instead of the Xview version.
X
Then run 'scantool &' to get the tool up on
your screen.
X
X
%%% Hardware connection of Microtek MSF-300A scanner : %%%
X
I connected the scanner to serial port A of the back of a 
Sparcstation 1+. It should work on any Sun WS.
X
The scanner hardware should be strapped for 'RS-232', which
means that the strap on the internal interface board (which can be
reached after removing the cover and a black metal shielding box,
a total of 10 screws I think) should be at the 'frontmost' position
towards the marking 'RS-232'. A serial cable with three wires
is required :
X
X  Sun             Scanner
Pin   Name      Pin    Name
----------------------------
X 2    TXD        3     RXD
X 3    RXD        2     TXD
X 7    GND        7     GND
X
The file /etc/ttytab must have the entry for 'ttya' set to :
X
ttya    "/usr/etc/getty std.9600"       unknown         off local offsecure
X
==========================================
VB2/ETX/TM/FM Gunnar Forsgren
X
Phone..: +46 8 7196118
Fax....: +46 8 7192900
email..: gunnar at falcon.ericsson.se
MEMO...: ETX.ETXGFN
VAX....: VAXN::FORSGREN
==========================================
SHAR_EOF
chmod 0644 README.etx ||
echo 'restore of README.etx failed'
Wc_c="`wc -c < 'README.etx'`"
test 2559 -eq "$Wc_c" ||
	echo 'README.etx: original size 2559, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= black.codes ==============
if test -f 'black.codes' -a X"$1" != X"-c"; then
	echo 'x - skipping black.codes (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting black.codes (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'black.codes' &&
X    0     0000110111
X    1            010
X    2             11
X    3             10
X    4            011
X    5           0011
X    6           0010
X    7          00011
X    8         000101
X    9         000100
X   10        0000100
X   11        0000101
X   12        0000111
X   13       00000100
X   14       00000111
X   15      000011000
X   16     0000010111
X   17     0000011000
X   18     0000001000
X   19    00001100111
X   20    00001101000
X   21    00001101100
X   22    00000110111
X   23    00000101000
X   24    00000010111
X   25    00000011000
X   26   000011001010
X   27   000011001011
X   28   000011001100
X   29   000011001101
X   30   000001101000
X   31   000001101001
X   32   000001101010
X   33   000001101011
X   34   000011010010
X   35   000011010011
X   36   000011010100
X   37   000011010101
X   38   000011010110
X   39   000011010111
X   40   000001101100
X   41   000001101101
X   42   000011011010
X   43   000011011011
X   44   000001010100
X   45   000001010101
X   46   000001010110
X   47   000001010111
X   48   000001100100
X   49   000001100101
X   50   000001010010
X   51   000001010011
X   52   000000100100
X   53   000000110111
X   54   000000111000
X   55   000000100111
X   56   000000101000
X   57   000001011000
X   58   000001011001
X   59   000000101011
X   60   000000101100
X   61   000001011010
X   62   000001100110
X   63   000001100111
X   64     0000001111
X  128   000011001000
X  192   000011001001
X  256   000001011011
X  320   000000110011
X  384   000000110100
X  448   000000110101
X  512  0000001101100
X  576  0000001101101
X  640  0000001001010
X  704  0000001001011
X  768  0000001001100
X  832  0000001001101
X  896  0000001110010
X  960  0000001110011
X 1024  0000001110100
X 1088  0000001110101
X 1152  0000001110110
X 1216  0000001110111
X 1280  0000001010010
X 1344  0000001010011
X 1408  0000001010100
X 1472  0000001010101
X 1536  0000001011010
X 1600  0000001011011
X 1664  0000001100100
X 1728  0000001100101
X 1792    00000001000
X 1856    00000001100
X 1920    00000001101
X 1984   000000010010
X 2048   000000010011
X 2112   000000010100
X 2176   000000010101
X 2240   000000010110
X 2304   000000010111
X 2368   000000011100
X 2432   000000011101
X 2496   000000011110
X   -1   000000000001
SHAR_EOF
chmod 0644 black.codes ||
echo 'restore of black.codes failed'
Wc_c="`wc -c < 'black.codes'`"
test 2184 -eq "$Wc_c" ||
	echo 'black.codes: original size 2184, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= button.invert.icon ==============
if test -f 'button.invert.icon' -a X"$1" != X"-c"; then
	echo 'x - skipping button.invert.icon (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting button.invert.icon (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'button.invert.icon' &&
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X */
X	0x03FF,0xFFFF,0xFFFF,0xFFC0,0x0C00,0x0000,0x0000,0x0030,
X	0x1000,0x0000,0x0000,0x0008,0x23FF,0xFFFF,0xFFFF,0xFFC4,
X	0x47FF,0xFFFF,0xFFFF,0xFFE2,0x4FFF,0xFFFF,0xFFFF,0xFFF2,
X	0x9FFF,0xFFFF,0xFFFF,0xFFF3,0x9FFF,0xFFFF,0xFFFF,0xFFF3,
X	0x9FFF,0xFFFF,0xFFFF,0xFFF3,0x9FFF,0xFFFF,0xFFFF,0xFFF3,
X	0x9FFF,0xFFFF,0xFFFF,0xFFF3,0x9FFF,0xFFFF,0xFFFF,0xFFF3,
X	0x9FFF,0xFFFF,0xFFFF,0xFFF3,0x9FFF,0xFFFF,0xFFFF,0xFFF3,
X	0x9FFF,0xFFFF,0xFFFF,0xFFF3,0x9FFF,0xFFFF,0xFFFF,0xFFF3,
X	0x9FFF,0xFFFF,0xFFFF,0xFFF3,0x9FFF,0xFFFF,0xFFFF,0xFFF3,
X	0x9FFF,0xFFFF,0xFFFF,0xFFF3,0x9FFF,0xFFFF,0xFFFF,0xFFF3,
X	0x9FFF,0xFFFF,0xFFFF,0xFFF3,0x9FFF,0xFFFF,0xFFFF,0xFFE7,
X	0x4FFF,0xFFFF,0xFFFF,0xFFE6,0x47FF,0xFFFF,0xFFFF,0xFFCE,
X	0x2000,0x0000,0x0000,0x001C,0x1000,0x0000,0x0000,0x0038,
X	0x0FFF,0xFFFF,0xFFFF,0xFFF0,0x03FF,0xFFFF,0xFFFF,0xFFC0,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
SHAR_EOF
chmod 0644 button.invert.icon ||
echo 'restore of button.invert.icon failed'
Wc_c="`wc -c < 'button.invert.icon'`"
test 1933 -eq "$Wc_c" ||
	echo 'button.invert.icon: original size 1933, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= button.normal.icon ==============
if test -f 'button.normal.icon' -a X"$1" != X"-c"; then
	echo 'x - skipping button.normal.icon (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting button.normal.icon (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'button.normal.icon' &&
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X */
X	0x03FF,0xFFFF,0xFFFF,0xFFC0,0x0C00,0x0000,0x0000,0x0030,
X	0x1000,0x0000,0x0000,0x0008,0x2000,0x0000,0x0000,0x0004,
X	0x4000,0x0000,0x0000,0x0002,0x4000,0x0000,0x0000,0x0003,
X	0x8000,0x0000,0x0000,0x0003,0x8000,0x0000,0x0000,0x0003,
X	0x8000,0x0000,0x0000,0x0003,0x8000,0x0000,0x0000,0x0003,
X	0x8000,0x0000,0x0000,0x0003,0x8000,0x0000,0x0000,0x0003,
X	0x8000,0x0000,0x0000,0x0003,0x8000,0x0000,0x0000,0x0003,
X	0x8000,0x0000,0x0000,0x0003,0x8000,0x0000,0x0000,0x0003,
X	0x8000,0x0000,0x0000,0x0003,0x8000,0x0000,0x0000,0x0003,
X	0x8000,0x0000,0x0000,0x0003,0x8000,0x0000,0x0000,0x0003,
X	0x8000,0x0000,0x0000,0x0003,0x8000,0x0000,0x0000,0x0007,
X	0x4000,0x0000,0x0000,0x0006,0x4000,0x0000,0x0000,0x000E,
X	0x2000,0x0000,0x0000,0x001C,0x1000,0x0000,0x0000,0x0038,
X	0x0FFF,0xFFFF,0xFFFF,0xFFF0,0x03FF,0xFFFF,0xFFFF,0xFFC0,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
SHAR_EOF
chmod 0644 button.normal.icon ||
echo 'restore of button.normal.icon failed'
Wc_c="`wc -c < 'button.normal.icon'`"
test 1933 -eq "$Wc_c" ||
	echo 'button.normal.icon: original size 1933, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= exclaim.icon ==============
if test -f 'exclaim.icon' -a X"$1" != X"-c"; then
	echo 'x - skipping exclaim.icon (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting exclaim.icon (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'exclaim.icon' &&
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X */
X	0xFFFF,0xFFF0,0x0000,0x0000,0x8000,0x0010,0x0000,0x0000,
X	0x8000,0x0010,0x0000,0x0000,0x801F,0xF810,0x0000,0x0000,
X	0x8020,0x0410,0x0000,0x0000,0x8040,0x0210,0x0000,0x0000,
X	0x8080,0x0110,0x0000,0x0000,0x8100,0x0090,0x0000,0x0000,
X	0x8103,0x0090,0x0000,0x0000,0x8103,0x0090,0x0000,0x0000,
X	0x8103,0x0090,0x0000,0x0000,0x8103,0x0090,0x0000,0x0000,
X	0x8103,0x0090,0x0000,0x0000,0x8103,0x0090,0x0000,0x0000,
X	0x8103,0x0090,0x0000,0x0000,0x8103,0x0090,0x0000,0x0000,
X	0x8103,0x0090,0x0000,0x0000,0x8103,0x0090,0x0000,0x0000,
X	0x8103,0x0090,0x0000,0x0000,0x8103,0x0090,0x0000,0x0000,
X	0x8103,0x0090,0x0000,0x0000,0x8100,0x0090,0x0000,0x0000,
X	0x8103,0x0090,0x0000,0x0000,0x8103,0x0090,0x0000,0x0000,
X	0x8300,0x0090,0x0000,0x0000,0xFE00,0x0110,0x0000,0x0000,
X	0x9000,0x0210,0x0000,0x0000,0x9FFF,0xFC10,0x0000,0x0000,
X	0x8000,0x0010,0x0000,0x0000,0x8000,0x0010,0x0000,0x0000,
X	0x8000,0x0010,0x0000,0x0000,0xFFFF,0xFFF0,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
SHAR_EOF
chmod 0644 exclaim.icon ||
echo 'restore of exclaim.icon failed'
Wc_c="`wc -c < 'exclaim.icon'`"
test 1933 -eq "$Wc_c" ||
	echo 'exclaim.icon: original size 1933, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= frame.cursor ==============
if test -f 'frame.cursor' -a X"$1" != X"-c"; then
	echo 'x - skipping frame.cursor (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting frame.cursor (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'frame.cursor' &&
/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
X */
X	0x0100,0x0100,0x0100,0x1390,0x0C60,0x0820,0x1010,0xF01E,
X	0x1010,0x0820,0x0C60,0x1390,0x0100,0x0100,0x0100,0x0000
SHAR_EOF
chmod 0644 frame.cursor ||
echo 'restore of frame.cursor failed'
Wc_c="`wc -c < 'frame.cursor'`"
test 193 -eq "$Wc_c" ||
	echo 'frame.cursor: original size 193, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= graphics.c ==============
if test -f 'graphics.c' -a X"$1" != X"-c"; then
	echo 'x - skipping graphics.c (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting graphics.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'graphics.c' &&
X 
/*  @(#)graphics.c 1.5 90/04/10
X *
X *  Independent graphics routines associated with the scantool program.
X *
X *  Copyright (c) Rich Burridge.
X *                Sun Microsystems, Australia - All rights reserved.
X *
X *  Permission is given to distribute these sources, as long as the
X *  copyright messages are not removed, and no monies are exchanged.
X *
X *  No responsibility is taken for any errors or inaccuracies inherent
X *  either to the comments or the code of this program, but if
X *  reported to me, then an attempt will be made to fix them.
X */
X
#include <stdio.h>
#include <strings.h>
#include <signal.h>
#include "scantool.h"
#include "scantool_extern.h"
X
X
do_repaint()         /* Draw titleline and page layout. */
{
X  int i ;
X 
X  draw_area(0, 0, SCAN_WIDTH, SCAN_HEIGHT, GCLR) ;
X  draw_text(0*MBAR_WIDTH+10, 15, STEN_OFF, BFONT, "Brightness") ;
X  draw_text(1*MBAR_WIDTH+10, 15, STEN_OFF, BFONT, "Contrast") ;
X  draw_text(2*MBAR_WIDTH+10, 15, STEN_OFF, BFONT, "Grain") ;
X  draw_text(3*MBAR_WIDTH+10, 15, STEN_OFF, BFONT, "Help") ;
X  draw_text(4*MBAR_WIDTH+10, 15, STEN_OFF, BFONT, "Resolution") ;
X  draw_text(5*MBAR_WIDTH+10, 15, STEN_OFF, BFONT, "Set") ;
X  draw_area(0, 0, SCAN_WIDTH, MBAR_HEIGHT, GNOT) ;
X
X  make_switch(SCAN_WIDTH-150, 0*SWITCH_HEIGHT+40,
X              "Mode", "Line Art", "Halftone") ;
X  make_switch(SCAN_WIDTH-150, 1*SWITCH_HEIGHT+40,
X              "Data Transfer", "Uncompressed", "Compressed") ;
X  make_switch(SCAN_WIDTH-150, 2*SWITCH_HEIGHT+40,
X              "Serial Port", "A", "B") ;
X  make_switch(SCAN_WIDTH-150, 3*SWITCH_HEIGHT+40,
X              "Baud Rate", "9600", "19200") ;
X
X  for (i = 0; i < 4; i++)
X    set_switch(SCAN_WIDTH-150, i*SWITCH_HEIGHT+50+switches[i]*20, ON) ;
X
X  if (scanning)
X    make_button(SCAN_WIDTH-150, 4*SWITCH_HEIGHT+20, "Scan", B_INVERT) ;
X  else make_button(SCAN_WIDTH-150, 4*SWITCH_HEIGHT+20, "Scan", B_NORMAL) ;
X
X  make_button(SCAN_WIDTH-150, 4*SWITCH_HEIGHT+60, "Cancel", B_NORMAL) ;
X
X  if (showing)
X    make_button(SCAN_WIDTH-150, 4*SWITCH_HEIGHT+100, "Show", B_INVERT) ;
X  else make_button(SCAN_WIDTH-150, 4*SWITCH_HEIGHT+100, "Show", B_NORMAL) ;
X
X  draw_scanning_frame(SCAN_FRAME_X, SCAN_FRAME_Y) ;
X
X  switch ((int) drawstate)
X    {
X      case DO_NOTHING  : break ;
X      case DO_PICNAME  : draw_picarea() ;
X                         break ;
X      case DO_MESSAGE  : make_message() ;
X                         break ;
X      case DO_HELP     : get_help() ;
X                         break ;
X      case DO_SETTINGS : draw_settings() ;
X    }
}
X
X
draw_frame(x, y, width, height)
int x, y, width, height ;
{
X  draw_area(x,   y,   width,    height,    GSET) ;
X  draw_area(x+1, y+1, width-2,  height-2,  GCLR) ;
X  draw_area(x+3, y+3, width-6,  height-6,  GSET) ;
X  draw_area(x+5, y+5, width-10, height-10, GCLR) ;
}
X
X
draw_picarea()
{
X  char dummy[MAXLINE] ;
X  int nochars, x, y ;
X
X  x = (SCAN_WIDTH - 500) / 2 ;
X  y = (SCAN_HEIGHT - 50) / 2 ;
X  draw_frame(x, y, 500, 50) ;
X  draw_text(x + 10, y + 27, STEN_OFF, BFONT, "Name:") ;
X  draw_rect(x + 70, y + 10, x + 265, y + 35, GSET) ;
X  nochars = (strlen(picname) <= 20) ? strlen(picname) : 20 ;
X  STRNCPY(dummy, &picname[strlen(picname) - nochars], nochars) ;
X  dummy[nochars] = '\0' ;
X  draw_text(x + 80, y + 27, STEN_OFF, BFONT, dummy) ;
X  draw_line(x + 80 + get_strwidth(BFONT, dummy), y + 15,
X            x + 80 + get_strwidth(BFONT, dummy), y + 30, GSET) ;
X  make_button(x + 300, y + 10, "OK", B_NORMAL) ;
X  make_button(x + 400, y + 10, "Cancel", B_NORMAL) ;
X  drawstate = DO_PICNAME ;
X  butx = x ;
X  buty = y ;
}
X
X
draw_rect(x1, y1, x2, y2, op)
int x1, y1, x2, y2 ;
enum op_type op ;
{
X  draw_line(x1, y1, x2, y1, op) ;
X  draw_line(x1, y1, x1, y2, op) ;
X  draw_line(x2, y1, x2, y2, op) ;
X  draw_line(x1, y2, x2, y2, op) ;
}
X
X
draw_scanning_frame(x, y)     /* Draw the current scanning frame. */
int x, y ;
{
X  char number[3] ;
X  int i ;
X
X  for (i = 0; i <= 35; i++)       /* Draw horizontal rule. */
X    if (!(i % 4))
X      {
X        SPRINTF(number, "%1d", i / 4) ;
X        draw_text(x+i*LINEGAP+2, y-15, STEN_ON, NFONT, number) ;
X        draw_line(x+i*LINEGAP, y-10, x+i*LINEGAP, y-26, GSET) ;
X      }
X    else if (!(i % 2))
X      draw_line(x+i*LINEGAP, y-10, x+i*LINEGAP, y-18, GSET) ;
X    else draw_line(x+i*LINEGAP, y-10, x+i*LINEGAP, y-14, GSET) ;
X
X  draw_line(x, y-10, x+36*LINEGAP, y-10, GSET) ;
X
X  for (i = 0; i <= 45; i++)       /* Draw vertical rule. */
X    if (!(i % 4))
X      {
X        SPRINTF(number, "%1d", i / 4) ;
X        draw_text(x-26, y+i*LINEGAP+12, STEN_ON, NFONT, number) ;
X        draw_line(x-10, y+i*LINEGAP, x-26, y+i*LINEGAP, GSET) ;
X      }
X    else if (!(i % 2))
X      draw_line(x-10, y+i*LINEGAP, x-18, y+i*LINEGAP, GSET) ;
X    else draw_line(x-10, y+i*LINEGAP, x-14, y+i*LINEGAP, GSET) ;
X
X  draw_line(x-10, y, x-10, y+46*LINEGAP, GSET) ;
X
/* Initial page frame. */
X  draw_rect(x,   y,   x+34*LINEGAP,   y+44*LINEGAP,   GSET) ;
X  draw_rect(x+1, y+1, x+34*LINEGAP+1, y+44*LINEGAP+1, GSET) ;
X
/* Make gray surrondings. */
X  draw_line(x, y+44*LINEGAP, x, SCAN_HEIGHT, GSET) ;
X  draw_line(x+34*LINEGAP, y,x+36*LINEGAP, y, GSET) ;
X  draw_line(x+36*LINEGAP, y-26,x+36*LINEGAP, SCAN_HEIGHT, GSET) ;
X  grey_area(x+1, y+44*LINEGAP+2, 36*LINEGAP-1, 2*LINEGAP-2) ;
X  grey_area(x+LINEGAP*34+2, y+1, 2*LINEGAP-2, SCAN_HEIGHT-65) ;
X
/* Draw initial scanning frame. */
X  draw_rect(x+framevals[X1]*FRAMEGAP, y+framevals[Y1]*FRAMEGAP,
X            x+framevals[X2]*FRAMEGAP, y+framevals[Y2]*FRAMEGAP, GSET) ;
}
X
X
get_picname()       /* Get new picture name. */
{
X  char c, dummy[MAXLINE] ;
X  int finished, nochars, state ;
X
X  finished = 0 ;
X  if (type == LEFT_DOWN)
X    {
X           if (curx > butx+300 && curx < butx+300+BUTTON_WIDTH &&
X               cury > buty+10  && cury < buty+10+BUTTON_HEIGHT)
X        {
X          make_button(butx+300, buty+10, "OK", B_INVERT) ;
X          state = OK ;
X          finished = 1 ;
SHAR_EOF
true || echo 'restore of graphics.c failed'
fi
echo 'End of  part 1'
echo 'File graphics.c is continued in part 2'
echo 2 > _shar_seq_.tmp
exit 0



More information about the Alt.sources mailing list