home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume16 / xmag / part01 < prev    next >
Encoding:
Text File  |  1992-02-12  |  46.2 KB  |  1,732 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!think.com!mips!msi!dcmartin
  3. From: pjs@pa.dec.com (Philip Schneider)
  4. Subject: v16i085: Magnifier (MOTIF), Part01/01
  5. Message-ID: <1992Feb13.190100.9618@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. Date: Thu, 13 Feb 1992 19:01:00 GMT
  10. Approved: dcmartin@msi.com
  11.  
  12. Submitted-by: pjs@pa.dec.com (Philip Schneider)
  13. Posting-number: Volume 16, Issue 85
  14. Archive-name: xmag/part01
  15.  
  16. # This is a shell archive.  Remove anything before this line, then feed it
  17. # into a shell via "sh file" or similar.  To overwrite existing files,
  18. # type "sh file -c".
  19. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  20. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  21. # If this archive is complete, you will see the following message at the end:
  22. #        "End of archive 1 (of 1)."
  23. # Contents:  README Imakefile Makefile Makefile.simple mag.xbm
  24. #   patchlevel.h xmag.c xmag.man
  25. # Wrapped by dcmartin@fascet on Thu Feb 13 11:00:26 1992
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'README' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'README'\"
  29. else
  30. echo shar: Extracting \"'README'\" \(1961 characters\)
  31. sed "s/^X//" >'README' <<'END_OF_FILE'
  32. X                XMAG NOTES
  33. X                ------------
  34. XDescription
  35. X-----------
  36. X    Xmag is an X11/Motif tool whose purpose is to magnify (square) regions
  37. Xof your screen.
  38. X
  39. XHistory 
  40. X--------
  41. X    The first version of this program was written in 1987-1988 by
  42. XDanny Shapiro of DEC Workstation Systems Engineering, using the
  43. XDECWindows widget set.  Philip Schneider ported it to Motif 1.1.1
  44. Xin 1991.
  45. X
  46. XCompiling
  47. X---------
  48. X    On most systems,  just typing in the following should do what you want:
  49. X
  50. X    xmkmf <top-level X directory> .
  51. X    make depend
  52. X    make
  53. X
  54. X    A non-imake Makefile exists for those who might want/need it, called
  55. X    Makefile.simple.
  56. X
  57. X    You may need/want to change the following things in the IMakefile 
  58. X    (or in the Makefile.simple, if you're using that) :
  59. X
  60. X    MOTIFLIBS    --    locations of libXm.a and libXt.a
  61. X    MOTIFINCS    --    include file directories
  62. X    BINDIR         --    where to install xmag
  63. X
  64. X    This program has been tested only on DEC Ultrix workstations.  It
  65. X*should* be portable to any X/Unix/Motif-"compliant" system.  Please let
  66. Xus know if you run into problems compiling/running this program on
  67. Xother systems.
  68. X
  69. XApplication Defaults / Command-line Options
  70. X-------------------------------------------
  71. X    Xmag (should :-) correctly parse all Xt arguments, and all the usual
  72. XXt resources (e.g., in one's .Xdefaults file) apply to xmag. (These are
  73. Xthings like -display, -geometry, -foreground, etc.).  There are no
  74. Xother xmag-specific flags or resources.
  75. X
  76. XCopying Restrictions
  77. X--------------------
  78. X    Copyright 1988, 1991 Danny Shapiro and Philip Schneider.
  79. X
  80. X    Permission to use, copy, modify, and distribute this software
  81. X    and documentation for any purpose other than financial gain
  82. X    without fee, provided that the above copyright notice appears
  83. X    in all copies.
  84. X    It is provided "as is" without express or implied warranty.
  85. X
  86. XBug Reports
  87. X-----------
  88. X    Please send bug reports, comments, job offers, money, etc. to :
  89. X
  90. X    Philip Schneider
  91. X    pjs@pa.dec.com
  92. X    (415)853-6538
  93. X
  94. END_OF_FILE
  95. if test 1961 -ne `wc -c <'README'`; then
  96.     echo shar: \"'README'\" unpacked with wrong size!
  97. fi
  98. # end of 'README'
  99. fi
  100. if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  101.   echo shar: Will not clobber existing file \"'Imakefile'\"
  102. else
  103. echo shar: Extracting \"'Imakefile'\" \(325 characters\)
  104. sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
  105. X
  106. XSRCS = xmag.c
  107. XOBJS = xmag.o
  108. X
  109. X     MOTIF = /usr/lib/DXM
  110. XMOTIF_LIBS = $(MOTIF)/lib/Xm/libXm.a $(MOTIF)/lib/Xt/libXt.a
  111. XMOTIF_INCS = -I$(MOTIF)/lib -I$(MOTIF)/lib/Xt
  112. X  INCLUDES = -I. $(MOTIF_INCS)
  113. X    BINDIR = /udir/pjs/bin
  114. X
  115. X
  116. XLOCAL_LIBRARIES = $(MOTIF_LIBS)
  117. X  SYS_LIBRARIES = -lX11 -lm
  118. X
  119. X
  120. Xall:: xmag
  121. X
  122. XComplexProgramTarget(xmag)
  123. X
  124. END_OF_FILE
  125. if test 325 -ne `wc -c <'Imakefile'`; then
  126.     echo shar: \"'Imakefile'\" unpacked with wrong size!
  127. fi
  128. # end of 'Imakefile'
  129. fi
  130. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  131.   echo shar: Will not clobber existing file \"'Makefile'\"
  132. else
  133. echo shar: Extracting \"'Makefile'\" \(10491 characters\)
  134. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  135. X# Makefile generated by imake - do not edit!
  136. X# $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
  137. X#
  138. X# The cpp used on this machine replaces all newlines and multiple tabs and
  139. X# spaces in a macro expansion with a single space.  Imake tries to compensate
  140. X# for this, but is not always successful.
  141. X#
  142. X
  143. X# -------------------------------------------------------------------------
  144. X# Makefile generated from "Imake.tmpl" and <Imakefile>
  145. X# $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
  146. X#
  147. X# Platform-specific parameters may be set in the appropriate <vendor>.cf
  148. X# configuration files.  Site-specific parameters should be set in the file
  149. X# site.def.  Full rebuilds are recommended if any parameters are changed.
  150. X#
  151. X# If your C preprocessor does not define any unique symbols, you will need
  152. X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
  153. X# "make World" the first time).
  154. X#
  155. X
  156. X# -------------------------------------------------------------------------
  157. X# site-specific configuration parameters that need to come before
  158. X# the platform-specific parameters - edit site.def to change
  159. X
  160. X# site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  161. X
  162. X# -------------------------------------------------------------------------
  163. X# platform-specific configuration parameters - edit sun.cf to change
  164. X
  165. X# platform:  $XConsortium: sun.cf,v 1.68 91/07/30 11:34:39 rws Exp $
  166. X
  167. X# operating system:  SunOS 4.1.1
  168. X
  169. X# $XConsortium: sunLib.rules,v 1.6 91/03/24 17:55:58 rws Exp $
  170. X
  171. X# -------------------------------------------------------------------------
  172. X# site-specific configuration parameters that go after
  173. X# the platform-specific parameters - edit site.def to change
  174. X
  175. X# site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  176. X
  177. X            SHELL = /bin/sh
  178. X
  179. X              TOP = .
  180. X      CURRENT_DIR = .
  181. X
  182. X               AR = ar clq
  183. X  BOOTSTRAPCFLAGS =
  184. X               CC = cc
  185. X               AS = as
  186. X
  187. X         COMPRESS = compress
  188. X              CPP = /lib/cpp $(STD_CPP_DEFINES)
  189. X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
  190. X          INSTALL = install
  191. X               LD = ld
  192. X             LINT = lint
  193. X      LINTLIBFLAG = -C
  194. X         LINTOPTS = -axz
  195. X               LN = ln -s
  196. X             MAKE = make
  197. X               MV = mv
  198. X               CP = cp
  199. X
  200. X           RANLIB = ranlib
  201. X  RANLIBINSTFLAGS =
  202. X
  203. X               RM = rm -f
  204. X            TROFF = psroff
  205. X         MSMACROS = -ms
  206. X              TBL = tbl
  207. X              EQN = eqn
  208. X     STD_INCLUDES =
  209. X  STD_CPP_DEFINES =
  210. X      STD_DEFINES =
  211. X EXTRA_LOAD_FLAGS =
  212. X  EXTRA_LIBRARIES =
  213. X             TAGS = ctags
  214. X
  215. X    SHAREDCODEDEF = -DSHAREDCODE
  216. X         SHLIBDEF = -DSUNSHLIB
  217. X
  218. X    PROTO_DEFINES =
  219. X
  220. X     INSTPGMFLAGS =
  221. X
  222. X     INSTBINFLAGS = -m 0755
  223. X     INSTUIDFLAGS = -m 4755
  224. X     INSTLIBFLAGS = -m 0644
  225. X     INSTINCFLAGS = -m 0444
  226. X     INSTMANFLAGS = -m 0444
  227. X     INSTDATFLAGS = -m 0444
  228. X    INSTKMEMFLAGS = -m 4755
  229. X
  230. X      PROJECTROOT = /usr/X11/R5
  231. X
  232. X     TOP_INCLUDES = -I$(INCROOT)
  233. X
  234. X      CDEBUGFLAGS = -O
  235. X        CCOPTIONS = -pipe
  236. X
  237. X      ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
  238. X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
  239. X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
  240. X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
  241. X
  242. X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  243. X
  244. X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
  245. X
  246. X   LDCOMBINEFLAGS = -X -r
  247. X      DEPENDFLAGS =
  248. X
  249. X        MACROFILE = sun.cf
  250. X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
  251. X
  252. X    IMAKE_DEFINES =
  253. X
  254. X         IRULESRC = $(CONFIGDIR)
  255. X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
  256. X
  257. X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
  258. X            $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
  259. X            $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
  260. X
  261. X# -------------------------------------------------------------------------
  262. X# X Window System Build Parameters
  263. X# $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
  264. X
  265. X# -------------------------------------------------------------------------
  266. X# X Window System make variables; this need to be coordinated with rules
  267. X
  268. X          PATHSEP = /
  269. X        USRLIBDIR = /usr/X11/R5/lib
  270. X           BINDIR = /usr/X11/R5/bin
  271. X          INCROOT = /usr/X11/R5/include
  272. X     BUILDINCROOT = $(TOP)
  273. X      BUILDINCDIR = $(BUILDINCROOT)/X11
  274. X      BUILDINCTOP = ..
  275. X           INCDIR = $(INCROOT)/X11
  276. X           ADMDIR = /usr/adm
  277. X           LIBDIR = $(USRLIBDIR)/X11
  278. X        CONFIGDIR = $(LIBDIR)/config
  279. X       LINTLIBDIR = $(USRLIBDIR)/lint
  280. X
  281. X          FONTDIR = $(LIBDIR)/fonts
  282. X         XINITDIR = $(LIBDIR)/xinit
  283. X           XDMDIR = $(LIBDIR)/xdm
  284. X           TWMDIR = $(LIBDIR)/twm
  285. X          MANPATH = /usr/X11/R5/man
  286. X    MANSOURCEPATH = $(MANPATH)/man
  287. X        MANSUFFIX = n
  288. X     LIBMANSUFFIX = 3
  289. X           MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
  290. X        LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
  291. X           NLSDIR = $(LIBDIR)/nls
  292. X        PEXAPIDIR = $(LIBDIR)/PEX
  293. X      XAPPLOADDIR = $(LIBDIR)/app-defaults
  294. X       FONTCFLAGS = -t
  295. X
  296. X     INSTAPPFLAGS = $(INSTDATFLAGS)
  297. X
  298. X            IMAKE = imake
  299. X           DEPEND = makedepend
  300. X              RGB = rgb
  301. X
  302. X            FONTC = bdftopcf
  303. X
  304. X        MKFONTDIR = mkfontdir
  305. X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
  306. X
  307. X        CONFIGSRC = $(TOP)/config
  308. X       DOCUTILSRC = $(TOP)/doc/util
  309. X        CLIENTSRC = $(TOP)/clients
  310. X          DEMOSRC = $(TOP)/demos
  311. X           LIBSRC = $(TOP)/lib
  312. X          FONTSRC = $(TOP)/fonts
  313. X       INCLUDESRC = $(TOP)/X11
  314. X        SERVERSRC = $(TOP)/server
  315. X          UTILSRC = $(TOP)/util
  316. X        SCRIPTSRC = $(UTILSRC)/scripts
  317. X       EXAMPLESRC = $(TOP)/examples
  318. X       CONTRIBSRC = $(TOP)/../contrib
  319. X           DOCSRC = $(TOP)/doc
  320. X           RGBSRC = $(TOP)/rgb
  321. X        DEPENDSRC = $(UTILSRC)/makedepend
  322. X         IMAKESRC = $(CONFIGSRC)
  323. X         XAUTHSRC = $(LIBSRC)/Xau
  324. X          XLIBSRC = $(LIBSRC)/X
  325. X           XMUSRC = $(LIBSRC)/Xmu
  326. X       TOOLKITSRC = $(LIBSRC)/Xt
  327. X       AWIDGETSRC = $(LIBSRC)/Xaw
  328. X       OLDXLIBSRC = $(LIBSRC)/oldX
  329. X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
  330. X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
  331. X      BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
  332. X      BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
  333. X     MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
  334. X         FSLIBSRC = $(FONTSRC)/lib/fs
  335. X    FONTSERVERSRC = $(FONTSRC)/server
  336. X     EXTENSIONSRC = $(TOP)/extensions
  337. X         XILIBSRC = $(EXTENSIONSRC)/lib/xinput
  338. X      PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
  339. X
  340. X# $XConsortium: sunLib.tmpl,v 1.11 91/07/31 11:32:08 rws Exp $
  341. X
  342. XSHLIBLDFLAGS = -assert pure-text
  343. XPICFLAGS = -pic
  344. X
  345. X  DEPEXTENSIONLIB =
  346. X     EXTENSIONLIB = -lXext
  347. X
  348. X          DEPXLIB = $(DEPEXTENSIONLIB)
  349. X             XLIB = $(EXTENSIONLIB) -lX11
  350. X
  351. X        DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV)
  352. X           XMULIB = -lXmu
  353. X
  354. X       DEPOLDXLIB =
  355. X          OLDXLIB = -loldX
  356. X
  357. X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV)
  358. X         XTOOLLIB = -lXt
  359. X
  360. X        DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV)
  361. X           XAWLIB = -lXaw
  362. X
  363. X        DEPXILIB =
  364. X           XILIB = -lXi
  365. X
  366. X        SOXLIBREV = 4.10
  367. X          SOXTREV = 4.10
  368. X         SOXAWREV = 5.0
  369. X        SOOLDXREV = 4.10
  370. X         SOXMUREV = 4.10
  371. X        SOXEXTREV = 4.10
  372. X      SOXINPUTREV = 4.10
  373. X
  374. X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
  375. X         XAUTHLIB =  -lXau
  376. X      DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
  377. X         XDMCPLIB =  -lXdmcp
  378. X
  379. X        DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
  380. X           PHIGSLIB =  -lphigs
  381. X
  382. X       DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
  383. X          XBSDLIB =  -lXbsd
  384. X
  385. X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
  386. X         LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
  387. X          LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
  388. X        LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
  389. X          LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
  390. X           LINTXI = $(LINTLIBDIR)/llib-lXi.ln
  391. X        LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
  392. X
  393. X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  394. X
  395. X         DEPLIBS1 = $(DEPLIBS)
  396. X         DEPLIBS2 = $(DEPLIBS)
  397. X         DEPLIBS3 = $(DEPLIBS)
  398. X
  399. X# -------------------------------------------------------------------------
  400. X# Imake rules for building libraries, programs, scripts, and data files
  401. X# rules:  $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
  402. X
  403. X# -------------------------------------------------------------------------
  404. X# start of Imakefile
  405. X
  406. XSRCS = xmag.c
  407. XOBJS = xmag.o
  408. X
  409. X     MOTIF = /usr/lib/DXM
  410. XMOTIF_LIBS = $(MOTIF)/lib/Xm/libXm.a $(MOTIF)/lib/Xt/libXt.a
  411. XMOTIF_INCS = -I$(MOTIF)/lib -I$(MOTIF)/lib/Xt
  412. X  INCLUDES = -I. $(MOTIF_INCS)
  413. X    BINDIR = /udir/pjs/bin
  414. X
  415. XLOCAL_LIBRARIES = $(MOTIF_LIBS)
  416. X  SYS_LIBRARIES = -lX11 -lm
  417. X
  418. Xall:: xmag
  419. X
  420. X PROGRAM = xmag
  421. X
  422. Xall:: xmag
  423. X
  424. Xxmag: $(OBJS) $(DEPLIBS)
  425. X    $(RM) $@
  426. X    $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
  427. X
  428. Xsaber_xmag:: $(SRCS)
  429. X    # load $(ALLDEFINES) $(SRCS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  430. X
  431. Xosaber_xmag:: $(OBJS)
  432. X    # load $(ALLDEFINES) $(OBJS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  433. X
  434. Xinstall:: xmag
  435. X    @if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
  436. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
  437. X    $(INSTALL) -c $(INSTPGMFLAGS)  xmag $(DESTDIR)$(BINDIR)
  438. X
  439. Xinstall.man:: xmag.man
  440. X    @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
  441. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
  442. X    $(INSTALL) -c $(INSTMANFLAGS) xmag.man $(DESTDIR)$(MANDIR)/xmag.$(MANSUFFIX)
  443. X
  444. Xdepend::
  445. X    $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  446. X
  447. Xlint:
  448. X    $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
  449. Xlint1:
  450. X    $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
  451. X
  452. Xclean::
  453. X    $(RM) $(PROGRAM)
  454. X
  455. X# -------------------------------------------------------------------------
  456. X# common rules for all Makefiles - do not edit
  457. X
  458. Xemptyrule::
  459. X
  460. Xclean::
  461. X    $(RM_CMD) "#"*
  462. X
  463. XMakefile::
  464. X    -@if [ -f Makefile ]; then set -x; \
  465. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  466. X    else exit 0; fi
  467. X    $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
  468. X
  469. Xtags::
  470. X    $(TAGS) -w *.[ch]
  471. X    $(TAGS) -xw *.[ch] > TAGS
  472. X
  473. Xsaber:
  474. X    # load $(ALLDEFINES) $(SRCS)
  475. X
  476. Xosaber:
  477. X    # load $(ALLDEFINES) $(OBJS)
  478. X
  479. X# -------------------------------------------------------------------------
  480. X# empty rules for directories that do not have SUBDIRS - do not edit
  481. X
  482. Xinstall::
  483. X    @echo "install in $(CURRENT_DIR) done"
  484. X
  485. Xinstall.man::
  486. X    @echo "install.man in $(CURRENT_DIR) done"
  487. X
  488. XMakefiles::
  489. X
  490. Xincludes::
  491. X
  492. X# -------------------------------------------------------------------------
  493. X# dependencies generated by makedepend
  494. X
  495. END_OF_FILE
  496. if test 10491 -ne `wc -c <'Makefile'`; then
  497.     echo shar: \"'Makefile'\" unpacked with wrong size!
  498. fi
  499. # end of 'Makefile'
  500. fi
  501. if test -f 'Makefile.simple' -a "${1}" != "-c" ; then 
  502.   echo shar: Will not clobber existing file \"'Makefile.simple'\"
  503. else
  504. echo shar: Extracting \"'Makefile.simple'\" \(1078 characters\)
  505. sed "s/^X//" >'Makefile.simple' <<'END_OF_FILE'
  506. X
  507. XSRCS = xmag.c
  508. XOBJS = xmag.o
  509. X
  510. XXLIB      = -lX11
  511. XMOTIFLIBS = /usr/lib/DXM/lib/Xm/libXm.a /usr/lib/DXM/lib/Xt/libXt.a
  512. X#EXTENSIONLIB = /x/R4/mit/extensions/lib/libXext.a
  513. XSYSLIBS   = -lm
  514. XLIBS      = $(MOTIFLIBS) $(EXTENSIONLIB) $(XLIB) $(SYSLIBS)
  515. X
  516. XLOCALINCS = -I.
  517. XMOTIFINCS = -I/usr/lib/DXM/lib -I/usr/lib/DXM/lib/Xt
  518. XINCS      = $(LOCALINCS) $(MOTIFINCS)
  519. X
  520. XCDEBUGFLAGS = -g
  521. XCFLAGS = $(INCS) $(CDEBUGFLAGS)
  522. X
  523. XBINDIR = /udir/pjs/bin
  524. X
  525. XPROG  = xmag
  526. XDEBUG = debug
  527. X
  528. XDEPEND = makedepend
  529. X
  530. X.SUFFIXES: .o .c
  531. X
  532. X.c.o:
  533. X    $(CC) -c $(INCS) $(CFLAGS) $*.c
  534. X
  535. Xall: $(PROG)
  536. X
  537. X$(PROG): $(SRCS) Makefile
  538. X    $(CC) -o $(PROG) $(CFLAGS)  $(SRCS) $(LIBS)
  539. X    strip $(PROG)
  540. X    rm -f *.u
  541. X
  542. X$(DEBUG): $(OBJS) Makefile
  543. X    $(CC) -o $(DEBUG) $(OBJS) $(LIBS)
  544. X
  545. Xinstall: $(PROG)
  546. X    install -c -s $(PROG) $(BINDIR)
  547. X
  548. X
  549. Xsaber_src: 
  550. X    #load $(CFLAGS) $(SRCS) $(LIBS) 
  551. Xsaber_obj: $(OJBS) $(LIBOBJS)
  552. X    #load $(CFLAGS) $(OBJS) $(LIBS) 
  553. X  
  554. Xlint:
  555. X    lint $(INCS) $(SRCS) > lint_errs
  556. X
  557. Xclean: 
  558. X    rm -f *~ *.bak core *.o \#*\# $(PROG) $(DEBUG) *.u lint_errs
  559. X
  560. Xdepend:
  561. X    $(DEPEND) $(INCS) $(SRCS)
  562. X
  563. X
  564. X# DO NOT DELETE THIS LINE -- make depend depends on it.
  565. END_OF_FILE
  566. if test 1078 -ne `wc -c <'Makefile.simple'`; then
  567.     echo shar: \"'Makefile.simple'\" unpacked with wrong size!
  568. fi
  569. # end of 'Makefile.simple'
  570. fi
  571. if test -f 'mag.xbm' -a "${1}" != "-c" ; then 
  572.   echo shar: Will not clobber existing file \"'mag.xbm'\"
  573. else
  574. echo shar: Extracting \"'mag.xbm'\" \(2261 characters\)
  575. sed "s/^X//" >'mag.xbm' <<'END_OF_FILE'
  576. X#define mag_width 50
  577. X#define mag_height 50
  578. Xstatic char mag_bits[] = {
  579. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  580. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  581. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0x00,
  582. X   0x00, 0x80, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x3c, 0x00,
  583. X   0x00, 0x00, 0x00, 0xf8, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00,
  584. X   0xc0, 0x03, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
  585. X   0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, 0x00,
  586. X   0x00, 0x80, 0x03, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00,
  587. X   0x0c, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0xc0, 0x00,
  588. X   0x00, 0x00, 0x18, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00,
  589. X   0x60, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x30,
  590. X   0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x60, 0x00, 0x00,
  591. X   0x00, 0x30, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x60,
  592. X   0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x30, 0x00,
  593. X   0x00, 0xe0, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,
  594. X   0x18, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x80, 0x01,
  595. X   0x00, 0x00, 0x0c, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x00,
  596. X   0x00, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07,
  597. X   0x00, 0x00, 0x00, 0x0e, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x1f, 0x00,
  598. X   0xc0, 0x01, 0x00, 0x00, 0x80, 0x7b, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xc0,
  599. X   0xe1, 0x01, 0x3c, 0x00, 0x00, 0x00, 0xf0, 0x80, 0xff, 0x0f, 0x00, 0x00,
  600. X   0x00, 0x78, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00,
  601. X   0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00,
  602. X   0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
  603. X   0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00,
  604. X   0x00, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00,
  605. X   0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00,
  606. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  607. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  608. X   0x00, 0x00};
  609. END_OF_FILE
  610. if test 2261 -ne `wc -c <'mag.xbm'`; then
  611.     echo shar: \"'mag.xbm'\" unpacked with wrong size!
  612. fi
  613. # end of 'mag.xbm'
  614. fi
  615. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  616.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  617. else
  618. echo shar: Extracting \"'patchlevel.h'\" \(21 characters\)
  619. sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  620. X#define PATCHLEVEL 0
  621. END_OF_FILE
  622. if test 21 -ne `wc -c <'patchlevel.h'`; then
  623.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  624. fi
  625. # end of 'patchlevel.h'
  626. fi
  627. if test -f 'xmag.c' -a "${1}" != "-c" ; then 
  628.   echo shar: Will not clobber existing file \"'xmag.c'\"
  629. else
  630. echo shar: Extracting \"'xmag.c'\" \(23199 characters\)
  631. sed "s/^X//" >'xmag.c' <<'END_OF_FILE'
  632. X/*
  633. X *
  634. X *    XMAG
  635. X *
  636. X *    Screen magnification program
  637. X *
  638. X *    Written by Danny Shapiro
  639. X *    Workstation Systems Engineering
  640. X *    Digital Equipment Corporation
  641. X *    February 29, 1988
  642. X *
  643. X *      Ported to Motif by Philip Schneider
  644. X *    Advanced Technology Development
  645. X *    Digital Equipment Corporation
  646. X *    November 5, 1991
  647. X *
  648. X *    Copyright 1988, 1991 Danny Shapiro and Philip Schneider 
  649. X *
  650. X */
  651. X#include <stdio.h>
  652. X
  653. X#include <X11/Xlib.h>
  654. X#include <X11/Intrinsic.h>
  655. X#include <X11/StringDefs.h>
  656. X#include <X11/Xatom.h>
  657. X#include <X11/Xutil.h>
  658. X#include <X11/Xresource.h>
  659. X#include <X11/cursorfont.h>
  660. X
  661. X#include <Xm/Xm.h>
  662. X#include <Xm/Form.h>
  663. X#include <Xm/DrawingA.h>
  664. X#include <Xm/RowColumn.h>
  665. X#include <Xm/CascadeB.h>
  666. X#include <Xm/PushB.h>
  667. X#include <Xm/ToggleB.h>
  668. X#include <Xm/Label.h>
  669. X#include <Xm/TextF.h>
  670. X#include <Xm/MainW.h>
  671. X
  672. X#include "mag.xbm"
  673. X
  674. X#include "patchlevel.h"
  675. X
  676. X#define MINZOOM        4        /* zoom resolutions */
  677. X#define MAXZOOM     128
  678. X
  679. X#define MIN(a,b) ((a < b) ? a : b)
  680. X#define MAX(a,b) ((a > b) ? a : b)
  681. X
  682. X#define GRAB        1        /* menu codes */
  683. X#define ZOOMIN        2
  684. X#define ZOOMOUT     3
  685. X#define GRID        4
  686. X#define QUIT        5
  687. X#define CLEAR        6
  688. X
  689. Xstatic    XtAppContext     appContext;
  690. Xstatic    Display            *dpy;        /* display */
  691. Xstatic  Colormap    cMap;
  692. Xstatic    Window             win,        /* zoom window id */
  693. X                       root;        /* root window id */
  694. Xstatic    u_long           black, white;     /* black, white pixel values */
  695. X
  696. Xstatic    GC                 gc;              /* zoom window gc */
  697. Xstatic    GC        gcOverlay;    /* root window xor gc */
  698. Xstatic    int         zoom = 32;       /* number of cells in zoom window */
  699. Xstatic    int        w,        /* size of window in pixels */
  700. X            h;
  701. Xstatic    int        exX, exY,    /* expose event dimensions */
  702. X            exW, exH;    
  703. Xstatic    int        zX, zY;        /* x and y screen positions */
  704. Xstatic    int        init = 0;    /* initialization flag */
  705. Xstatic    int        grid = 0;    /* grid toggle flag */
  706. Xstatic    int        maxX;        /* max x and y values on screen */
  707. Xstatic    int         maxY;
  708. Xstatic    int        lastRow    = -1,
  709. X              lastColumn = -1;
  710. Xstatic    XImage         *image;        /* used in the getimage call */
  711. X
  712. X
  713. Xstatic    Widget        work;        /* work area widget */
  714. Xstatic    Widget        pixelValue;
  715. Xstatic    Widget        rgbValue;
  716. Xstatic  Widget         grab;        /* menu buttons */
  717. Xstatic  Widget         zoomIn;
  718. Xstatic  Widget         zoomOut;
  719. Xstatic  Widget         gridToggle;    
  720. Xstatic  Widget         quit;
  721. Xstatic  Widget        clear;
  722. X
  723. X
  724. X/*
  725. X *    main()
  726. X */
  727. Xmain(argc, argv)
  728. X    int        argc;
  729. X    char     *argv[];
  730. X{
  731. X    Widget        topLevel;        /* top level widget */
  732. X    Widget        mainW;
  733. X    Widget        form;
  734. X    Widget         menu;            /* menu widget */
  735. X
  736. X    Widget        pixelLabel;
  737. X    Widget        rgbLabel;
  738. X
  739. X    XGCValues           gcValues;        
  740. X    XColor        actual,
  741. X            closest;
  742. X    int            success;
  743. X    int            n;
  744. X    Arg            args[20];
  745. X    static Widget     MakeMenu();    /* toolkit menu initialization */
  746. X    Cursor              arrow;
  747. X
  748. X    /*
  749. X     *  Hack to keep Saber-C happy
  750. X     */
  751. X    argv[0] = "xmag";
  752. X    
  753. X    /*
  754. X     *  Open up the toolkit, etc.
  755. X     */
  756. X    topLevel = XtAppInitialize(&appContext, "XMag", 
  757. X                   NULL,
  758. X                   0,
  759. X                   (unsigned int *)&argc, argv,
  760. X                   NULL,
  761. X                   NULL, 0);
  762. X    /*
  763. X     *  Stash away some often-used X stuff
  764. X     */
  765. X    dpy  = XtDisplay(topLevel);
  766. X    root = RootWindow(dpy, 0);
  767. X    maxX = XDisplayWidth(dpy, 0);
  768. X    maxY = XDisplayHeight(dpy, 0);
  769. X    cMap = DefaultColormap(dpy, 0);
  770. X
  771. X    /*
  772. X     * Grab some colors
  773. X     */
  774. X    success = XAllocNamedColor(dpy, cMap, "black",
  775. X                   &actual, &closest);
  776. X    if (success) {
  777. X    black = closest.pixel;
  778. X    } else {
  779. X    black = BlackPixel(dpy, DefaultScreen(dpy));
  780. X    }
  781. X    
  782. X    success = XAllocNamedColor(dpy, cMap, "white",
  783. X                   &actual, &closest);
  784. X    if (success) {
  785. X    white = closest.pixel;
  786. X    } else {
  787. X    white = WhitePixel(dpy, DefaultScreen(dpy));
  788. X    }
  789. X    
  790. X
  791. X    /*
  792. X     *  Start creating the widgets
  793. X     */
  794. X    /*
  795. X     *  Create main window
  796. X     */
  797. X    n = 0;
  798. X    mainW = XmCreateMainWindow(topLevel, "mainW", args, n);
  799. X    XtManageChild(mainW);
  800. X
  801. X    /*
  802. X     *  Form widget holds drawing area and pixel value display
  803. X     */
  804. X    n = 0;
  805. X    form = XmCreateForm(mainW, "form", args, n);
  806. X    XtManageChild(form);
  807. X
  808. X    /*
  809. X     *  Create a menu bar and associated menus
  810. X     */
  811. X    menu = MakeMenu(mainW);
  812. X
  813. X    /*
  814. X     *  Create the pixel and rgb value displays
  815. X     */
  816. X    n = 0;
  817. X    XtSetArg(args[n], XmNtopAttachment,    XmATTACH_NONE);    n++;
  818. X    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);    n++;
  819. X    XtSetArg(args[n], XmNbottomOffset,     4);            n++;
  820. X    XtSetArg(args[n], XmNleftAttachment,   XmATTACH_POSITION);    n++;
  821. X    XtSetArg(args[n], XmNleftPosition,     50);            n++;
  822. X    XtSetArg(args[n], XmNrightAttachment,  XmATTACH_NONE);    n++;
  823. X    rgbLabel = XmCreateLabel(form, "RGB :", args, n);
  824. X    XtManageChild(rgbLabel);
  825. X
  826. X    n = 0;
  827. X    XtSetArg(args[n], XmNtopAttachment,    XmATTACH_NONE);    n++;
  828. X    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);    n++;
  829. X    XtSetArg(args[n], XmNbottomOffset,     4);            n++;
  830. X    XtSetArg(args[n], XmNleftAttachment,   XmATTACH_WIDGET);    n++;
  831. X    XtSetArg(args[n], XmNleftWidget,       rgbLabel);        n++;
  832. X    XtSetArg(args[n], XmNrightAttachment,  XmATTACH_NONE);    n++;
  833. X    XtSetArg(args[n], XmNrightOffset,      4);            n++;
  834. X    XtSetArg(args[n], XmNeditable,         False);        n++;    
  835. X    XtSetArg(args[n], XmNcolumns,          10);            n++;    
  836. X    XtSetArg(args[n], XmNmarginHeight,     1);            n++;    
  837. X    XtSetArg(args[n], XmNshadowThickness,  0);            n++;
  838. X    rgbValue = XmCreateTextField(form, "rgbValue", args, n);
  839. X    XtManageChild(rgbValue);
  840. X
  841. X    n = 0;
  842. X    XtSetArg(args[n], XmNtopAttachment,    XmATTACH_NONE);    n++;
  843. X    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);    n++;
  844. X    XtSetArg(args[n], XmNbottomOffset,     4);            n++;
  845. X    XtSetArg(args[n], XmNleftAttachment,   XmATTACH_NONE);    n++;
  846. X    XtSetArg(args[n], XmNrightAttachment,  XmATTACH_WIDGET);    n++;
  847. X    XtSetArg(args[n], XmNrightWidget,      rgbLabel);        n++;
  848. X    XtSetArg(args[n], XmNrightOffset,      10);            n++;
  849. X    XtSetArg(args[n], XmNeditable,         False);        n++;    
  850. X    XtSetArg(args[n], XmNcolumns,          8);            n++;    
  851. X    XtSetArg(args[n], XmNmarginHeight,     1);            n++;    
  852. X    XtSetArg(args[n], XmNshadowThickness,  0);            n++;
  853. X    pixelValue = XmCreateTextField(form, "pixelValue", args, n);
  854. X    XtManageChild(pixelValue);
  855. X
  856. X    n = 0;
  857. X    XtSetArg(args[n], XmNtopAttachment,    XmATTACH_NONE);    n++;
  858. X    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);    n++;
  859. X    XtSetArg(args[n], XmNbottomOffset,     4);            n++;
  860. X    XtSetArg(args[n], XmNleftAttachment,   XmATTACH_NONE);    n++;
  861. X    XtSetArg(args[n], XmNrightAttachment,  XmATTACH_WIDGET);    n++;
  862. X    XtSetArg(args[n], XmNrightWidget,      pixelValue);        n++;
  863. X    pixelLabel = XmCreateLabel(form, "Pixel :", args, n);
  864. X    XtManageChild(pixelLabel);
  865. X
  866. X    {
  867. X    Dimension    height;
  868. X    
  869. X    n = 0;
  870. X    XtSetArg(args[n], XmNheight, &height);    n++;
  871. X    XtGetValues(pixelValue, args, n);
  872. X
  873. X    n = 0;
  874. X    XtSetArg(args[n], XmNheight, height);    n++;
  875. X    XtSetValues(pixelLabel, args, n);
  876. X    XtSetValues(rgbLabel, args, n);
  877. X    }
  878. X
  879. X
  880. X    /*
  881. X     *  xmag display area
  882. X     */
  883. X    n = 0;
  884. X    XtSetArg(args[n], XmNtopAttachment,    XmATTACH_FORM);    n++;
  885. X    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);    n++;
  886. X    XtSetArg(args[n], XmNbottomWidget,     pixelValue);        n++;
  887. X    XtSetArg(args[n], XmNleftAttachment,   XmATTACH_FORM);    n++;
  888. X    XtSetArg(args[n], XmNrightAttachment,  XmATTACH_FORM);    n++;
  889. X    XtSetArg(args[n], XmNleftOffset,       4);            n++;
  890. X    XtSetArg(args[n], XmNrightOffset,       4);            n++;
  891. X    XtSetArg(args[n], XmNtopOffset,       4);            n++;
  892. X    XtSetArg(args[n], XmNbottomOffset,       4);            n++;
  893. X    XtSetArg(args[n], XmNwidth,            w = 8 * zoom);    n++;
  894. X    XtSetArg(args[n], XmNheight,           h = 8 * zoom);    n++;
  895. X    work = XmCreateDrawingArea(form, "work", args, n);
  896. X    XtManageChild (work);
  897. X
  898. X    {
  899. X    static XtCallbackProc ResizeCallback();    /* Resize window callback */
  900. X    static XtCallbackProc ExposeCallback();    /* Expose window callback */
  901. X
  902. X    XtAddCallback(work, XmNresizeCallback, ResizeCallback, NULL);
  903. X    XtAddCallback(work, XmNexposeCallback, ExposeCallback, NULL);
  904. X    }
  905. X
  906. X    
  907. X    XtRealizeWidget(topLevel);
  908. X
  909. X
  910. X    /*
  911. X     *  Set minimum size for xmag
  912. X     */
  913. X    {
  914. X    Dimension    width, height;
  915. X    int        n;
  916. X    Arg        args[3];
  917. X    
  918. X    n = 0;
  919. X    XtSetArg(args[n], XmNwidth,  &width);    n++;
  920. X    XtSetArg(args[n], XmNheight, &height);    n++;
  921. X    XtGetValues(topLevel, args, n);
  922. X
  923. X    n = 0;
  924. X    XtSetArg(args[n], XmNminWidth,  width);    n++;
  925. X    XtSetArg(args[n], XmNminHeight, height);n++;
  926. X    XtSetValues(topLevel, args, n);
  927. X    }
  928. X    
  929. X    
  930. X    /*
  931. X     *  Set up GCs
  932. X     */
  933. X    win = XtWindow(work);
  934. X    gc = XCreateGC(dpy, win, 0, NULL);
  935. X    XSetBackground(dpy, gc, black);
  936. X    
  937. X    gcOverlay = XCreateGC(dpy, root, 0, NULL);
  938. X    gcValues.subwindow_mode = IncludeInferiors;
  939. X    XChangeGC(dpy, gcOverlay, GCSubwindowMode, &gcValues);
  940. X    XSetFunction(dpy, gcOverlay, GXinvert);
  941. X
  942. X    XSetForeground(dpy, gcOverlay, black);
  943. X    XSetBackground(dpy, gcOverlay, white);
  944. X    
  945. X    /*
  946. X     *  Create cursors
  947. X     */
  948. X    arrow = XCreateFontCursor(dpy, XC_top_left_arrow);
  949. X    XDefineCursor(dpy, XtWindow(form), arrow);
  950. X
  951. X
  952. X    /*
  953. X     *  Make a more interesting icon pixmap
  954. X     */
  955. X    {
  956. X    Pixmap     iconPixmap;
  957. X
  958. X    iconPixmap = XCreateBitmapFromData(XtDisplay(topLevel),
  959. X                       XtScreen(topLevel)->root,
  960. X                       mag_bits,
  961. X                       mag_width, mag_height);
  962. X    n = 0;
  963. X    XtSetArg(args[n], XmNiconPixmap, iconPixmap);    n++;
  964. X    XtSetValues(topLevel, args, n);
  965. X    }
  966. X
  967. X
  968. X    /*
  969. X     *  Define actions for xmag display window
  970. X     */
  971. X    {
  972. X    XtTranslations    transTable;
  973. X    extern void    PixelPokeCallback();
  974. X    
  975. X    static XtActionsRec    actionsTable[] = {
  976. X        {"poke",    PixelPokeCallback},
  977. X    };
  978. X    
  979. X    static char    newTranslations[] = "\
  980. X        <Btn1Down>:    poke()\n\
  981. X        <Btn2Down>: poke()\n\
  982. X        <Btn3Down>: poke()\n";
  983. X    
  984. X    XtAppAddActions(appContext, actionsTable, XtNumber(actionsTable));
  985. X    transTable = XtParseTranslationTable(newTranslations);
  986. X    XtOverrideTranslations(work, transTable);
  987. X    }
  988. X
  989. X    /*
  990. X     *  Setup main window contents
  991. X     */
  992. X    XmMainWindowSetAreas(mainW, menu, NULL, NULL, NULL, form);
  993. X    
  994. X    /*
  995. X     *  Crank it up . . .
  996. X     */
  997. X    XtAppMainLoop(appContext);
  998. X}
  999. X
  1000. X
  1001. X/*
  1002. X *    Displays zoomed region 
  1003. X */
  1004. Xstatic void DrawZoom(flag) 
  1005. X    int flag;
  1006. X{
  1007. X    int        x, y;                /* window coordinates     */
  1008. X    int     i, j;                /* loop counters     */
  1009. X    int     iMin, jMin;            /* loop bounds         */
  1010. X    int     iMax, jMax;            /* loop bounds         */
  1011. X    int     minDim;
  1012. X    u_int     xSize;
  1013. X    u_int     ySize;
  1014. X    int     xOffset;
  1015. X    int     yOffset;
  1016. X    Dimension    width, height;
  1017. X    int        n;
  1018. X    Arg        args[3];
  1019. X    
  1020. X    if (!init || !image) {
  1021. X    /* no image grabbed yet */
  1022. X    return;
  1023. X    }
  1024. X    
  1025. X    /*
  1026. X     *  Get the actual width and height of the drawing area
  1027. X     */
  1028. X    n = 0;
  1029. X    XtSetArg(args[n], XmNwidth,  &width);    n++;
  1030. X    XtSetArg(args[n], XmNheight, &height);    n++;
  1031. X    XtGetValues(work, args, n);
  1032. X    
  1033. X    minDim = w < h ? w : h;
  1034. X    xSize = minDim / zoom;/* size of zoomed pixel */
  1035. X    ySize = minDim / zoom;
  1036. X    
  1037. X    xOffset = ((int)width - zoom * xSize) / 2;/* centers image in window */
  1038. X     yOffset = ((int)height - zoom * ySize) / 2;
  1039. X
  1040. X    if (xSize < 1) {
  1041. X    xSize = 1;
  1042. X    }
  1043. X    if (ySize < 1) {
  1044. X    ySize = 1;
  1045. X    }
  1046. X    
  1047. X    if (!flag)    {
  1048. X    /* only need to redraw where     */
  1049. X    /* exposed            */
  1050. X    jMin =
  1051. X      MAX(0, 
  1052. X          ((float)((exX - xOffset))) /
  1053. X          ((int)width - xOffset - xOffset) * zoom);
  1054. X    iMin =
  1055. X      MAX(0,
  1056. X          ((float)((exY - yOffset))) /
  1057. X          ((int)height - yOffset - yOffset) * zoom);
  1058. X    jMax =
  1059. X      MIN(zoom, (int)(0.5 + 1 +
  1060. X              ((float)(((exX+exW) - xOffset))) /
  1061. X              ((int)width - xOffset - xOffset) * zoom));
  1062. X    iMax =
  1063. X      MIN(zoom, (int)(0.5 + 1 +
  1064. X              ((float)(((exY+exH) - yOffset))) /
  1065. X              ((int)height - yOffset - yOffset) * zoom));
  1066. X    } else {                    /* draw all */
  1067. X    iMax = jMax = zoom;
  1068. X    iMin = jMin = 0;
  1069. X    XSetBackground(dpy, gc, white);
  1070. X    XClearWindow(dpy, win);
  1071. X    }
  1072. X    
  1073. X    for (i = iMin; i < iMax; i++) {        /* loop through pixels */
  1074. X    y =  i * ySize + yOffset;
  1075. X    for (j = jMin; j < jMax; j++) {
  1076. X        x = j * xSize + xOffset;
  1077. X        XSetForeground(dpy, gc, XGetPixel(image, j, i ));
  1078. X        XFillRectangle(dpy, win, gc, x, y, xSize, ySize);
  1079. X    }
  1080. X    }
  1081. X    
  1082. X    if (grid && xSize > 1 && ySize > 1) {    /* draw a grid */
  1083. X    XSetForeground(dpy, gc, black);
  1084. X    for (i = 0; i <= zoom; i++) {
  1085. X        XDrawLine(dpy, win, gc, xOffset, i * ySize + yOffset, 
  1086. X              width - xOffset, i * ySize + yOffset);
  1087. X        XDrawLine(dpy, win, gc, i * xSize + xOffset, yOffset, 
  1088. X              i * xSize + xOffset, height - yOffset);
  1089. X    }
  1090. X    }
  1091. X    XFlush(dpy);
  1092. X}
  1093. X
  1094. X
  1095. X
  1096. X
  1097. X/* 
  1098. X *    Draws overlay box while pointer is grabbed
  1099. X */
  1100. Xstatic void DrawBox(x, y)
  1101. X    int x, y;
  1102. X{
  1103. X    x -= (zoom / 2) + 1;            /* locate upper left corner */
  1104. X    y -= (zoom / 2) + 1;
  1105. X    
  1106. X    if (x < 0) {                /* check screen bounds */
  1107. X    x = 0;
  1108. X    } else if (x > (maxX - zoom - 1)) {
  1109. X    x = maxX - zoom - 1;
  1110. X    }
  1111. X    
  1112. X    if (y < 0) {
  1113. X    y = 0;
  1114. X    } else if (y > (maxY - zoom - 1)) {
  1115. X    y = maxY - zoom - 1;
  1116. X    }
  1117. X    
  1118. X    XDrawRectangle(dpy, root, gcOverlay, x, y, zoom + 1, zoom + 1);
  1119. X}
  1120. X
  1121. X
  1122. X/*
  1123. X *    Get pixels to zoom
  1124. X */
  1125. Xstatic void ZoomIt(x, y, flag)
  1126. X    int x, y;
  1127. X    int    flag;
  1128. X{
  1129. X    if (flag && !image) {
  1130. X    return;
  1131. X    }
  1132. X
  1133. X    x -= (zoom / 2);            /* locate upper left corner */
  1134. X    y -= (zoom / 2);
  1135. X    
  1136. X    if (x < 0) {                /* check screen bounds */
  1137. X    x = 0;
  1138. X    } else if (x > (maxX - zoom)) {
  1139. X    x = maxX - zoom;
  1140. X    }
  1141. X    
  1142. X    if (y < 0) {
  1143. X    y = 0;
  1144. X    } else if (y > (maxY - zoom)) {
  1145. X    y = maxY - zoom;
  1146. X    }
  1147. X    
  1148. X    if (image) {
  1149. X    XDestroyImage(image);        /* clear old image out */
  1150. X    }
  1151. X    image = XGetImage(dpy, root, x, y,    /* get new image */
  1152. X              zoom, zoom, XAllPlanes(), ZPixmap);
  1153. X    DrawZoom(1);            /* display zoomed region */
  1154. X
  1155. X    {
  1156. X    XEvent    event;
  1157. X
  1158. X    while (XCheckWindowEvent(dpy, win, ExposureMask, &event));
  1159. X    }
  1160. X}
  1161. X
  1162. X
  1163. X/*
  1164. X *    Toolkit callback routine which parses menu selections
  1165. X */
  1166. Xstatic XtCallbackProc PushbuttonPressed(widget, tag, callData)
  1167. X    Widget    widget;
  1168. X    char    *tag;
  1169. X    XtPointer    callData;
  1170. X{
  1171. X    int     done = 0;        /* flag signifies end of grab */
  1172. X    int     button;            /* which button was pressed */
  1173. X    Window     tmp, child;        /* used in QueryPointer */
  1174. X    int     x, y,             /* cursor position */
  1175. X        oX, oY,         /* old cursor position */
  1176. X        junkX, junkY;        /* used in QueryPointer */
  1177. X    short     state;            /* used in QueryPointer */
  1178. X    Boolean    exposed = False;
  1179. X    static Cursor    crosshair = (Cursor)NULL;
  1180. X
  1181. X    if (!crosshair) {
  1182. X    crosshair = XCreateFontCursor(dpy, XC_crosshair);
  1183. X    }
  1184. X
  1185. X    switch ((int) tag)    {    /* which pull down was selected */
  1186. X    case GRAB : {
  1187. X        extern void ResetValueDisplay();
  1188. X
  1189. X        ResetValueDisplay();
  1190. X        DrawZoom(0);
  1191. X
  1192. X        {
  1193. X        int status;
  1194. X
  1195. X        status = XtGrabPointer(work, True,
  1196. X                       ButtonPressMask, GrabModeAsync,
  1197. X                       GrabModeAsync,
  1198. X                       RootWindow(dpy, DefaultScreen(dpy)),
  1199. X                       crosshair, CurrentTime);
  1200. X        if (status != GrabSuccess) {
  1201. X            fprintf(stderr, "Error Grabbing Pointer!\n");
  1202. X            exit(-1);
  1203. X        }
  1204. X        }
  1205. X
  1206. X        XQueryPointer(dpy, root, &tmp, &child, &x, &y,
  1207. X              &junkX, &junkY, &state);
  1208. X        DrawBox(x, y);
  1209. X
  1210. X        while (!done) {
  1211. X        XEvent    event;
  1212. X
  1213. X        XSync(dpy, False);
  1214. X        if (XtAppPending(appContext))  {
  1215. X            XtAppNextEvent(appContext, &event);
  1216. X
  1217. X            if (event.type == ButtonPress) {
  1218. X            button = ((XButtonPressedEvent *)
  1219. X                  &event)->button;
  1220. X            if (button == 1) {
  1221. X                init = 1;
  1222. X                XtSetSensitive(zoomIn, 1);
  1223. X                XtSetSensitive(zoomOut, 1);
  1224. X                XtSetSensitive(gridToggle, 1);
  1225. X                zX = ((XButtonPressedEvent *)
  1226. X                  &event)->x_root;
  1227. X                zY = ((XButtonPressedEvent *)
  1228. X                  &event)->y_root;
  1229. X                DrawBox(x, y);
  1230. X                ZoomIt(zX, zY, 0);
  1231. X                DrawBox(x, y);
  1232. X            } else if (button == 3) {
  1233. X                done = 1;
  1234. X                XtUngrabPointer(work, 
  1235. X                        CurrentTime);
  1236. X                DrawBox(x, y);
  1237. X            }
  1238. X            } else if (event.type == Expose &&
  1239. X                   ((XExposeEvent *)(&event))->window == win) {
  1240. X            if (((XExposeEvent *)(&event))->count == 0) {
  1241. X                exposed = True;
  1242. X                DrawZoom(1);
  1243. X            }
  1244. X            DrawBox(x, y);
  1245. X            
  1246. X            } else {
  1247. X            XtDispatchEvent(&event);
  1248. X            }
  1249. X        } else {
  1250. X            oX = x;
  1251. X            oY = y;
  1252. X            XQueryPointer(dpy, root, &tmp, &child, &x, &y,
  1253. X                  &junkX, &junkY, &state);
  1254. X            if ((oX != x) || (oY != y)) {
  1255. X            if (exposed) {
  1256. X                DrawZoom(1);
  1257. X                exposed = False;
  1258. X            } else {
  1259. X                DrawBox(oX, oY);
  1260. X            }
  1261. X            DrawBox(x, y);
  1262. X            }
  1263. X        }
  1264. X        }
  1265. X        break;
  1266. X    }
  1267. X    case ZOOMIN : {
  1268. X        extern void ResetValueDisplay();
  1269. X
  1270. X        ResetValueDisplay();
  1271. X
  1272. X        if (zoom > MINZOOM) {
  1273. X        zoom /= 2;
  1274. X        ZoomIt(zX, zY, 1);
  1275. X        }
  1276. X        break;
  1277. X    }
  1278. X    case ZOOMOUT : {
  1279. X        extern void ResetValueDisplay();
  1280. X
  1281. X        ResetValueDisplay();
  1282. X        if (zoom < MAXZOOM) {
  1283. X        zoom *= 2;
  1284. X        ZoomIt(zX, zY, 1);
  1285. X        }
  1286. X        break;
  1287. X    }
  1288. X    case GRID : {
  1289. X        grid = !grid;
  1290. X        DrawZoom(1);
  1291. X        break;
  1292. X    }
  1293. X    case CLEAR : {
  1294. X        extern void Reset();
  1295. X
  1296. X        Reset();
  1297. X        break;
  1298. X    }
  1299. X    case QUIT : {
  1300. X        XtUnmanageChild(widget);
  1301. X        exit(1);
  1302. X        break;
  1303. X    }
  1304. X    }
  1305. X}
  1306. X
  1307. X
  1308. X
  1309. Xstatic void Reset()
  1310. X{
  1311. X    int        n;
  1312. X    Arg        args[2];
  1313. X
  1314. X    if (image) {
  1315. X    XDestroyImage(image);
  1316. X    image = NULL;
  1317. X    }
  1318. X
  1319. X    XSetBackground(dpy, gc, white);
  1320. X    XClearWindow(dpy, win);
  1321. X
  1322. X    n = 0;
  1323. X    XtSetArg(args[n], XmNvalue, "  ");    n++;
  1324. X    
  1325. X    XtSetValues(pixelValue, args, n);
  1326. X    XtSetValues(rgbValue, args, n);
  1327. X}
  1328. X
  1329. X
  1330. X
  1331. X
  1332. X/*
  1333. X *    Build the pulldown menu
  1334. X */
  1335. Xstatic Widget MakeMenu(p)
  1336. X    Widget p;
  1337. X{
  1338. X    Widget     bar;        /* menu bar */
  1339. X    Widget     m;         /* pulldown menu */
  1340. X    Arg     args[10];    /* arg list */
  1341. X    int     n = 0;        /* arg count */
  1342. X    Widget    label;
  1343. X
  1344. X    n = 0;
  1345. X    bar = XmCreateMenuBar(p, "menubar", args, n);
  1346. X
  1347. X    n = 0;
  1348. X    m = XmCreatePulldownMenu(bar, "m", args, n);
  1349. X
  1350. X    n = 0;
  1351. X    XtSetArg(args[n], XmNsubMenuId, m);    n++;
  1352. X    label = XmCreateCascadeButton(bar, "Actions", args, n);
  1353. X    XtManageChild(label);
  1354. X
  1355. X    /* create pulldown pushbuttons with callbacks */
  1356. X    n = 0;
  1357. X    grab = XmCreatePushButton(m, "Grab", args, n);
  1358. X    XtManageChild(grab);
  1359. X    XtAddCallback(grab, XmNactivateCallback, PushbuttonPressed, GRAB);
  1360. X
  1361. X    n = 0;
  1362. X    zoomIn = XmCreatePushButton(m, "Zoom In", args, n);
  1363. X    XtManageChild(zoomIn);
  1364. X    XtAddCallback(zoomIn, XmNactivateCallback, PushbuttonPressed, ZOOMIN);
  1365. X
  1366. X    n = 0;
  1367. X    zoomOut = XmCreatePushButton(m, "Zoom Out", args, n);
  1368. X    XtManageChild(zoomOut);
  1369. X    XtAddCallback(zoomOut, XmNactivateCallback, PushbuttonPressed, ZOOMOUT);
  1370. X
  1371. X    n = 0;
  1372. X    gridToggle = XmCreateToggleButton(m, "Grid", args, n);
  1373. X    XtManageChild(gridToggle);
  1374. X    XtAddCallback(gridToggle, XmNvalueChangedCallback,
  1375. X          PushbuttonPressed, GRID);
  1376. X
  1377. X    n = 0;
  1378. X    clear = XmCreatePushButton(m, "Clear", args, n);
  1379. X    XtManageChild(clear);
  1380. X    XtAddCallback(clear, XmNactivateCallback, PushbuttonPressed, CLEAR);
  1381. X
  1382. X    n = 0;
  1383. X    quit = XmCreatePushButton(m, "Quit", args, n);
  1384. X    XtManageChild(quit);
  1385. X    XtAddCallback(quit, XmNactivateCallback, PushbuttonPressed, QUIT);
  1386. X
  1387. X
  1388. X    XtManageChild(bar);
  1389. X    XtSetSensitive(zoomIn,     False);
  1390. X    XtSetSensitive(zoomOut,    False);
  1391. X    XtSetSensitive(gridToggle, False);
  1392. X
  1393. X    return(bar);
  1394. X}
  1395. X
  1396. X
  1397. X
  1398. X
  1399. X/* 
  1400. X *    Resized window callback
  1401. X */
  1402. Xstatic XtCallbackProc ResizeCallback(widget, clientData, callData)
  1403. X    Widget            widget;
  1404. X    XtPointer            clientData;
  1405. X    XmDrawingAreaCallbackStruct    *callData;
  1406. X{
  1407. X    Dimension    width, height;
  1408. X    int        n;
  1409. X    Arg        args[3];
  1410. X    
  1411. X    n = 0;
  1412. X    XtSetArg(args[n], XmNwidth,  &width);    n++;
  1413. X    XtSetArg(args[n], XmNheight, &height);    n++;
  1414. X    XtGetValues(widget, args, n);
  1415. X
  1416. X    w = (int)width-1;                /* get new dimensions */
  1417. X    h = (int)height-1;
  1418. X    DrawZoom(1);                /* redraw window */
  1419. X}
  1420. X
  1421. X
  1422. X/* 
  1423. X *    Expose window callback
  1424. X */
  1425. Xstatic XtCallbackProc ExposeCallback(widget, clientData, callData)
  1426. X    Widget               widget;
  1427. X    XtPointer            clientData;
  1428. X    XmDrawingAreaCallbackStruct    *callData;
  1429. X{
  1430. X    XExposeEvent    *event = (XExposeEvent *)(callData->event);
  1431. X    
  1432. X    exX = event->x;
  1433. X    exY = event->y;
  1434. X    exW = event->width;
  1435. X    exH = event->height;
  1436. X
  1437. X    DrawZoom(0);
  1438. X}
  1439. X
  1440. X
  1441. Xstatic void PixelPokeCallback(w, event, params, numParams)
  1442. X    Widget        w;
  1443. X    XButtonEvent    *event;
  1444. X    String        *params;
  1445. X    Cardinal        *numParams;
  1446. X{
  1447. X    u_int     button;            /* which button was pressed */
  1448. X    Window     tmp, child;        /* used in QueryPointer */
  1449. X    int     x, y,             /* cursor position */
  1450. X        junkX, junkY;        /* used in QueryPointer */
  1451. X    int        lastX, lastY;
  1452. X    short     state;            /* used in QueryPointer */
  1453. X    int        done = 0;
  1454. X    extern void    DisplayPixelValue();
  1455. X    Dimension    width, height;
  1456. X
  1457. X    if (!init || !image) {
  1458. X    return;
  1459. X    }
  1460. X
  1461. X    {
  1462. X    int        n;
  1463. X    Arg        args[3];
  1464. X    
  1465. X    n = 0;
  1466. X    XtSetArg(args[n], XmNwidth,  &width);    n++;
  1467. X    XtSetArg(args[n], XmNheight, &height);    n++;
  1468. X    XtGetValues(w, args, n);
  1469. X    }
  1470. X
  1471. X    button = event->button;
  1472. X    
  1473. X    XSync(dpy, False);
  1474. X    XQueryPointer(dpy, win, &tmp, &child, &x, &y,
  1475. X          &junkX, &junkY, &state);
  1476. X
  1477. X    lastX = junkX;
  1478. X    lastY = junkY;
  1479. X
  1480. X    DisplayPixelValue(junkX, junkY);
  1481. X
  1482. X    while (!done) {
  1483. X    XEvent    event;
  1484. X
  1485. X    XSync(dpy, False);
  1486. X    
  1487. X    if (XtAppPending(appContext))  {
  1488. X        XtAppNextEvent(appContext, &event);
  1489. X
  1490. X        switch (event.type) {
  1491. X        case ButtonRelease : {
  1492. X            if (((XButtonEvent *)(&event))->button == button) {
  1493. X            done = 1;
  1494. X            return;
  1495. X            }
  1496. X            break;
  1497. X        }
  1498. X        case ButtonPress : 
  1499. X        case KeyPress    : {
  1500. X            break;
  1501. X        }
  1502. X        default : {
  1503. X            XtDispatchEvent(&event);
  1504. X            break;
  1505. X        }
  1506. X        }
  1507. X    } else {
  1508. X        XQueryPointer(dpy, win, &tmp, &child, &x, &y,
  1509. X              &junkX, &junkY, &state);
  1510. X        if ((junkX != lastX ||
  1511. X         junkY != lastY) &&
  1512. X        junkX >= 0 && junkX < (int)width &&
  1513. X        junkY >= 0 && junkY < (int)height) {
  1514. X        DisplayPixelValue(junkX, junkY);
  1515. X        lastX = junkX;
  1516. X        lastY = junkY;
  1517. X        }
  1518. X    }
  1519. X    }
  1520. X}
  1521. X
  1522. X
  1523. Xstatic void DisplayPixelValue(x, y)
  1524. X    int    x, y;
  1525. X{
  1526. X    u_long    pixel;
  1527. X
  1528. X    char    pixelStr[80];
  1529. X    char    rgbStr[80];
  1530. X    int     minDim = w < h ? w : h;
  1531. X    u_int    xSize = minDim / zoom;          /* size of zoomed pixels */
  1532. X    u_int    ySize = minDim / zoom;
  1533. X    int     xOffset = (w - zoom * xSize) / 2; /* centers image in window */
  1534. X    int        yOffset = (h - zoom * ySize) / 2;
  1535. X    int        row, column;
  1536. X    Dimension    width, height;
  1537. X    int        n;
  1538. X    Arg        args[3];
  1539. X    
  1540. X    if (!init) {
  1541. X    return;                /* no image grabbed yet */
  1542. X    }
  1543. X
  1544. X    n = 0;
  1545. X    XtSetArg(args[n], XmNwidth,  &width);    n++;
  1546. X    XtSetArg(args[n], XmNheight, &height);    n++;
  1547. X    XtGetValues(work, args, n);
  1548. X
  1549. X    
  1550. X    if (xSize < 1) {
  1551. X    xSize = 1;
  1552. X    }
  1553. X    if (ySize < 1) {
  1554. X    ySize = 1;
  1555. X    }
  1556. X
  1557. X    column = ((float)((x - xOffset)))/((int)width - xOffset - xOffset) * zoom;
  1558. X    row = ((float)((y - yOffset)))/((int)height - yOffset - yOffset) * zoom;
  1559. X
  1560. X    if (x >= xOffset && y >= yOffset &&
  1561. X    row >= 0 && row < zoom && column >= 0 && column < zoom) {
  1562. X    
  1563. X    if (column != lastColumn || row != lastRow) {
  1564. X        lastColumn = column;
  1565. X        lastRow = row;
  1566. X
  1567. X        pixel = XGetPixel(image, column, row);
  1568. X        
  1569. X        sprintf(pixelStr, "%d", pixel);
  1570. X        
  1571. X        {
  1572. X        XColor    color;
  1573. X        
  1574. X        color.pixel = pixel;
  1575. X        XQueryColor(dpy, cMap, &color);
  1576. X        
  1577. X        sprintf(rgbStr, "%d %d %d",
  1578. X            color.red/256, color.green/256, color.blue/256);
  1579. X        }
  1580. X        
  1581. X        n = 0;
  1582. X        XtSetArg(args[n], XmNvalue, pixelStr);    n++;
  1583. X        XtSetValues(pixelValue, args, n);
  1584. X        
  1585. X        n = 0;
  1586. X        XtSetArg(args[n], XmNvalue, rgbStr);    n++;
  1587. X        XtSetValues(rgbValue, args, n);
  1588. X    } 
  1589. X    } else {
  1590. X    n = 0;
  1591. X    XtSetArg(args[n], XmNvalue, "  ");    n++;
  1592. X    
  1593. X    XtSetValues(pixelValue, args, n);
  1594. X    XtSetValues(rgbValue, args, n);
  1595. X    
  1596. X    }
  1597. X}
  1598. X    
  1599. X
  1600. X
  1601. Xstatic void ResetValueDisplay()
  1602. X{
  1603. X    /*
  1604. X     *  This call will force the "Pixel" and "RGB"
  1605. X     *  strings to be "erased", because the arguments
  1606. X     *  put the cursor outside the window, causing
  1607. X     *  null strings to be displayed.
  1608. X     */
  1609. X    DisplayPixelValue(-100, -100);
  1610. X
  1611. X    lastRow    = -1;
  1612. X    lastColumn = -1;
  1613. X}
  1614. END_OF_FILE
  1615. if test 23199 -ne `wc -c <'xmag.c'`; then
  1616.     echo shar: \"'xmag.c'\" unpacked with wrong size!
  1617. fi
  1618. # end of 'xmag.c'
  1619. fi
  1620. if test -f 'xmag.man' -a "${1}" != "-c" ; then 
  1621.   echo shar: Will not clobber existing file \"'xmag.man'\"
  1622. else
  1623. echo shar: Extracting \"'xmag.man'\" \(1906 characters\)
  1624. sed "s/^X//" >'xmag.man' <<'END_OF_FILE'
  1625. X.TH XMAG 1 "Release 4" "X Version 11"
  1626. X.SH NAME
  1627. X.B xmag - 
  1628. XX Window System Screen Magnification Program
  1629. X.PP
  1630. X.SH SYNOPSIS
  1631. X.ta 8n
  1632. X\fBxmag\fP    [-\fItoolkit option\fP ...] 
  1633. X.PP
  1634. X.SH DESCRIPTION
  1635. X.I Xmag
  1636. Xis an application which allows square regions of the screen to be 
  1637. Xmagnified, and which shows the pixel value and RGB value for each
  1638. Xmagnified pixel. 
  1639. X.SH MENU
  1640. X.PP
  1641. XUse the left mouse button to activate the pull down menu.
  1642. X.PP
  1643. X.IP Grab 0.95i
  1644. Xgrabs the pointer.
  1645. XThe cursor will change to a crosshair.
  1646. XA square box the size of the region to be magnified will track
  1647. Xthe cursor.  Press the 
  1648. X.I left mouse button 
  1649. Xto magnify the desired region.
  1650. XPress the 
  1651. X.I right mouse button 
  1652. Xto ungrab the pointer.  
  1653. X.PP
  1654. X.IP "Zoom In" 0.95i
  1655. Xhalves the resolution.
  1656. X.PP
  1657. X.IP "Zoom Out" 0.95i
  1658. Xdoubles the resolution.
  1659. X.PP
  1660. X.IP "Grid On/Off" 0.95i
  1661. Xtoggles a grid overlay.
  1662. X.IP "Clear" 0.95i
  1663. Xclears the xmag window.
  1664. X.PP
  1665. X.IP Quit 0.95i
  1666. Xexits the application.
  1667. X.PP
  1668. X.PP
  1669. X.SH NOTES
  1670. XUse 
  1671. X.I Zoom In 
  1672. Xand 
  1673. X.I Zoom Out 
  1674. Xto adjust the dimensions of the magnifaction box.
  1675. X.PP
  1676. XResizing the window, affects the size, and not the number of magnified pixels.
  1677. X.PP
  1678. X.I Looking at pixel values
  1679. XWhen there is an image xmag display area, holding the mouse button
  1680. Xdown with the cursor in the xmag window will result in the pixel value
  1681. X(for the pixel at the current cursor location) being displayed at the
  1682. Xbottom of the xmag window, as well as the RGB value for that pixel.
  1683. X.PP
  1684. X.PP
  1685. X.SH BUGS
  1686. XIf you specify a size (with the -geometry flag) that is smaller
  1687. Xthan the normal/default size, there may not be enough room in the
  1688. Xwindow for the pixel value and RGB value display strings.
  1689. X.PP
  1690. X.SH AUTHOR
  1691. XCopyright 1988, 1991, Danny Shapiro and Philip Schneider
  1692. X.PP
  1693. X.nf
  1694. XDanny Shapiro
  1695. XDigital Equipment Corporation
  1696. XWorkstation Systems Engineering
  1697. XPalo Alto, CA  94301
  1698. X
  1699. XPhilip Schneider
  1700. XDigital Equipment Corporation
  1701. XAdvanced Technology Development
  1702. XPalo Alto, CA  94301
  1703. X
  1704. X.fi
  1705. END_OF_FILE
  1706. if test 1906 -ne `wc -c <'xmag.man'`; then
  1707.     echo shar: \"'xmag.man'\" unpacked with wrong size!
  1708. fi
  1709. # end of 'xmag.man'
  1710. fi
  1711. echo shar: End of archive 1 \(of 1\).
  1712. cp /dev/null ark1isdone
  1713. MISSING=""
  1714. for I in 1 ; do
  1715.     if test ! -f ark${I}isdone ; then
  1716.     MISSING="${MISSING} ${I}"
  1717.     fi
  1718. done
  1719. if test "${MISSING}" = "" ; then
  1720.     echo You have the archive.
  1721.     rm -f ark[1-9]isdone
  1722. else
  1723.     echo You still need to unpack the following archives:
  1724.     echo "        " ${MISSING}
  1725. fi
  1726. ##  End of shell archive.
  1727. exit 0
  1728. -- 
  1729. Molecular Simulations, Inc.             mail: dcmartin@msi.com
  1730. 796 N. Pastoria Avenue                  uucp: uunet!dcmartin
  1731. Sunnyvale, California 94086             at&t: 408/522-9236
  1732.