home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume20 / xarchie / part22 < prev    next >
Encoding:
Text File  |  1993-06-14  |  50.5 KB  |  1,583 lines

  1. Newsgroups: comp.sources.x
  2. From: ferguson@cs.rochester.edu (George Ferguson)
  3. Subject: v20i050:  xarchie - An X browser interface to Archie, v2.0.6, Part22/24
  4. Message-ID: <1993Jun15.223544.1959@sparky.imd.sterling.com>
  5. X-Md4-Signature: 4699e2175b9c67a9cabb085daa6b58e0
  6. Sender: chris@sparky.imd.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Tue, 15 Jun 1993 22:35:44 GMT
  9. Approved: chris@sparky.imd.sterling.com
  10.  
  11. Submitted-by: ferguson@cs.rochester.edu (George Ferguson)
  12. Posting-number: Volume 20, Issue 50
  13. Archive-name: xarchie/part22
  14. Environment: X11
  15. Supersedes: xarchie: Volume 14, Issue 82-90
  16.  
  17. Submitted-by: ferguson@cs.rochester.edu
  18. Archive-name: xarchie-2.0.6/part22
  19.  
  20. #!/bin/sh
  21. # this is Part.22 (part 22 of xarchie-2.0.6)
  22. # do not concatenate these parts, unpack them in order with /bin/sh
  23. # file xarchie-2.0.6/FWF/FileChooser/Makefile continued
  24. #
  25. if test ! -r _shar_seq_.tmp; then
  26.     echo 'Please unpack part 1 first!'
  27.     exit 1
  28. fi
  29. (read Scheck
  30.  if test "$Scheck" != 22; then
  31.     echo Please unpack part "$Scheck" next!
  32.     exit 1
  33.  else
  34.     exit 0
  35.  fi
  36. ) < _shar_seq_.tmp || exit 1
  37. if test ! -f _shar_wnt_.tmp; then
  38.     echo 'x - still skipping xarchie-2.0.6/FWF/FileChooser/Makefile'
  39. else
  40. echo 'x - continuing file xarchie-2.0.6/FWF/FileChooser/Makefile'
  41. sed 's/^X//' << 'SHAR_EOF' >> 'xarchie-2.0.6/FWF/FileChooser/Makefile' &&
  42. X         SHLIBDEF = -DSUNSHLIB
  43. X
  44. X    PROTO_DEFINES =
  45. X
  46. X     INSTPGMFLAGS =
  47. X
  48. X     INSTBINFLAGS = -m 0755
  49. X     INSTUIDFLAGS = -m 4755
  50. X     INSTLIBFLAGS = -m 0644
  51. X     INSTINCFLAGS = -m 0444
  52. X     INSTMANFLAGS = -m 0444
  53. X     INSTDATFLAGS = -m 0444
  54. X    INSTKMEMFLAGS = -g kmem -m 2755
  55. X
  56. X      PROJECTROOT = /usr/staff
  57. X
  58. X     TOP_INCLUDES = -I$(INCROOT)
  59. X
  60. X      CDEBUGFLAGS = -O
  61. X        CCOPTIONS = -pipe
  62. X
  63. X      ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
  64. X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
  65. X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
  66. X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
  67. X
  68. X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  69. X
  70. X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
  71. X
  72. X   LDCOMBINEFLAGS = -X -r
  73. X      DEPENDFLAGS =
  74. X
  75. X        MACROFILE = sun.cf
  76. X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
  77. X
  78. X    IMAKE_DEFINES =
  79. X
  80. X         IRULESRC = $(CONFIGDIR)
  81. X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
  82. X
  83. X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
  84. X            $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
  85. X            $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
  86. X
  87. # -------------------------------------------------------------------------
  88. # X Window System Build Parameters
  89. # $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
  90. X
  91. # -------------------------------------------------------------------------
  92. # X Window System make variables; this need to be coordinated with rules
  93. X
  94. X          PATHSEP = /
  95. X        USRLIBDIR = /usr/staff/lib
  96. X           BINDIR = /usr/staff/bin
  97. X          INCROOT = /usr/staff/include
  98. X     BUILDINCROOT = $(TOP)
  99. X      BUILDINCDIR = $(BUILDINCROOT)/X11
  100. X      BUILDINCTOP = ..
  101. X           INCDIR = $(INCROOT)/X11
  102. X           ADMDIR = /usr/adm
  103. X           LIBDIR = $(USRLIBDIR)/X11
  104. X        CONFIGDIR = $(LIBDIR)/config
  105. X       LINTLIBDIR = $(USRLIBDIR)/lint
  106. X
  107. X          FONTDIR = $(LIBDIR)/fonts
  108. X         XINITDIR = $(LIBDIR)/xinit
  109. X           XDMDIR = $(LIBDIR)/xdm
  110. X           TWMDIR = $(LIBDIR)/twm
  111. X          MANPATH = /usr/staff/man
  112. X    MANSOURCEPATH = $(MANPATH)/man
  113. X        MANSUFFIX = 1
  114. X     LIBMANSUFFIX = 3
  115. X           MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
  116. X        LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
  117. X           NLSDIR = $(LIBDIR)/nls
  118. X        PEXAPIDIR = $(LIBDIR)/PEX
  119. X      XAPPLOADDIR = $(LIBDIR)/app-defaults
  120. X       FONTCFLAGS = -t
  121. X
  122. X     INSTAPPFLAGS = $(INSTDATFLAGS)
  123. X
  124. X            IMAKE = imake
  125. X           DEPEND = makedepend
  126. X              RGB = rgb
  127. X
  128. X            FONTC = bdftopcf
  129. X
  130. X        MKFONTDIR = mkfontdir
  131. X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
  132. X
  133. X        CONFIGSRC = $(TOP)/config
  134. X       DOCUTILSRC = $(TOP)/doc/util
  135. X        CLIENTSRC = $(TOP)/clients
  136. X          DEMOSRC = $(TOP)/demos
  137. X           LIBSRC = $(TOP)/lib
  138. X          FONTSRC = $(TOP)/fonts
  139. X       INCLUDESRC = $(TOP)/X11
  140. X        SERVERSRC = $(TOP)/server
  141. X          UTILSRC = $(TOP)/util
  142. X        SCRIPTSRC = $(UTILSRC)/scripts
  143. X       EXAMPLESRC = $(TOP)/examples
  144. X       CONTRIBSRC = $(TOP)/../contrib
  145. X           DOCSRC = $(TOP)/doc
  146. X           RGBSRC = $(TOP)/rgb
  147. X        DEPENDSRC = $(UTILSRC)/makedepend
  148. X         IMAKESRC = $(CONFIGSRC)
  149. X         XAUTHSRC = $(LIBSRC)/Xau
  150. X          XLIBSRC = $(LIBSRC)/X
  151. X           XMUSRC = $(LIBSRC)/Xmu
  152. X       TOOLKITSRC = $(LIBSRC)/Xt
  153. X       AWIDGETSRC = $(LIBSRC)/Xaw
  154. X       OLDXLIBSRC = $(LIBSRC)/oldX
  155. X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
  156. X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
  157. X      BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
  158. X      BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
  159. X     MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
  160. X         FSLIBSRC = $(FONTSRC)/lib/fs
  161. X    FONTSERVERSRC = $(FONTSRC)/server
  162. X     EXTENSIONSRC = $(TOP)/extensions
  163. X         XILIBSRC = $(EXTENSIONSRC)/lib/xinput
  164. X      PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
  165. X
  166. # $XConsortium: sunLib.tmpl,v 1.14.1.1 92/03/17 14:58:46 rws Exp $
  167. X
  168. SHLIBLDFLAGS = -assert pure-text
  169. PICFLAGS = -pic
  170. X
  171. X  DEPEXTENSIONLIB =
  172. X     EXTENSIONLIB = -lXext
  173. X
  174. X          DEPXLIB = $(DEPEXTENSIONLIB)
  175. X             XLIB = $(EXTENSIONLIB) -lX11
  176. X
  177. X        DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV)
  178. X       XMULIBONLY = -lXmu
  179. X           XMULIB = -lXmu
  180. X
  181. X       DEPOLDXLIB =
  182. X          OLDXLIB = -loldX
  183. X
  184. X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV)
  185. X         XTOOLLIB = -lXt
  186. X
  187. X        DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV)
  188. X           XAWLIB = -lXaw
  189. X
  190. X        DEPXILIB =
  191. X           XILIB = -lXi
  192. X
  193. X        SOXLIBREV = 4.10
  194. X          SOXTREV = 4.10
  195. X         SOXAWREV = 5.0
  196. X        SOOLDXREV = 4.10
  197. X         SOXMUREV = 4.10
  198. X        SOXEXTREV = 4.10
  199. X      SOXINPUTREV = 4.10
  200. X
  201. X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
  202. X         XAUTHLIB =  -lXau
  203. X      DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
  204. X         XDMCPLIB =  -lXdmcp
  205. X
  206. X        DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
  207. X           PHIGSLIB =  -lphigs
  208. X
  209. X       DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
  210. X          XBSDLIB =  -lXbsd
  211. X
  212. X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
  213. X         LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
  214. X          LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
  215. X        LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
  216. X          LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
  217. X           LINTXI = $(LINTLIBDIR)/llib-lXi.ln
  218. X        LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
  219. X
  220. X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  221. X
  222. X         DEPLIBS1 = $(DEPLIBS)
  223. X         DEPLIBS2 = $(DEPLIBS)
  224. X         DEPLIBS3 = $(DEPLIBS)
  225. X
  226. # -------------------------------------------------------------------------
  227. # Imake rules for building libraries, programs, scripts, and data files
  228. # rules:  $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
  229. X
  230. # -------------------------------------------------------------------------
  231. # start of Imakefile
  232. X
  233. #
  234. # Imakefile for FileChooser
  235. #
  236. # Note that this Imakefile is just sufficient to build the FileChooser
  237. # for use with xarchie. The original FWF distribution contains a more
  238. # elaborate Imakefile for a variety of purposes. See the file ../README.
  239. #
  240. # George Ferguson, ferguson@cs.rochester.edu, 28 Jan 1993.
  241. #
  242. X
  243. SRCS = FChooser.c
  244. OBJS = FChooser.o
  245. X
  246. INCLUDES = -I. -I../Dir
  247. X
  248. all:: libFChooser.a
  249. X
  250. libFChooser.a: $(OBJS)
  251. X    $(RM) $@
  252. X    $(AR) $@ $(OBJS)
  253. X    $(RANLIB) $@
  254. X
  255. depend::
  256. X    $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  257. X
  258. # -------------------------------------------------------------------------
  259. # common rules for all Makefiles - do not edit
  260. X
  261. emptyrule::
  262. X
  263. clean::
  264. X    $(RM_CMD) "#"*
  265. X
  266. Makefile::
  267. X    -@if [ -f Makefile ]; then set -x; \
  268. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  269. X    else exit 0; fi
  270. X    $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
  271. X
  272. tags::
  273. X    $(TAGS) -w *.[ch]
  274. X    $(TAGS) -xw *.[ch] > TAGS
  275. X
  276. saber:
  277. X    # load $(ALLDEFINES) $(SRCS)
  278. X
  279. osaber:
  280. X    # load $(ALLDEFINES) $(OBJS)
  281. X
  282. # -------------------------------------------------------------------------
  283. # empty rules for directories that do not have SUBDIRS - do not edit
  284. X
  285. install::
  286. X    @echo "install in $(CURRENT_DIR) done"
  287. X
  288. install.man::
  289. X    @echo "install.man in $(CURRENT_DIR) done"
  290. X
  291. Makefiles::
  292. X
  293. includes::
  294. X
  295. # -------------------------------------------------------------------------
  296. # dependencies generated by makedepend
  297. X
  298. SHAR_EOF
  299. echo 'File xarchie-2.0.6/FWF/FileChooser/Makefile is complete' &&
  300. chmod 0644 xarchie-2.0.6/FWF/FileChooser/Makefile ||
  301. echo 'restore of xarchie-2.0.6/FWF/FileChooser/Makefile failed'
  302. Wc_c="`wc -c < 'xarchie-2.0.6/FWF/FileChooser/Makefile'`"
  303. test 9856 -eq "$Wc_c" ||
  304.     echo 'xarchie-2.0.6/FWF/FileChooser/Makefile: original size 9856, current size' "$Wc_c"
  305. rm -f _shar_wnt_.tmp
  306. fi
  307. # ============= xarchie-2.0.6/FWF/FileChooser/Makefile.dst ==============
  308. if test -f 'xarchie-2.0.6/FWF/FileChooser/Makefile.dst' -a X"$1" != X"-c"; then
  309.     echo 'x - skipping xarchie-2.0.6/FWF/FileChooser/Makefile.dst (File already exists)'
  310.     rm -f _shar_wnt_.tmp
  311. else
  312. > _shar_wnt_.tmp
  313. echo 'x - extracting xarchie-2.0.6/FWF/FileChooser/Makefile.dst (Text)'
  314. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/FileChooser/Makefile.dst' &&
  315. # This Makefile is for use with FileChooser if you don't have imake/xmkmf.
  316. X
  317. RM = rm -f
  318. AR = ar clq
  319. RANLIB = ranlib
  320. X
  321. # These should be set in the master Makefile
  322. XXINCS = -I/usr/local/include
  323. CDEBUGFLAGS = -g
  324. X
  325. OBJS = FChooser.o
  326. INCLUDES = -I.
  327. CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(XINCS)
  328. X
  329. libFChooser.a: $(OBJS)
  330. X    $(RM) $@
  331. X    $(AR) $@ $(OBJS)
  332. X    $(RANLIB) $(@)
  333. X
  334. clean:
  335. X    $(RM) libFChooser.a $(OBJS)
  336. SHAR_EOF
  337. chmod 0644 xarchie-2.0.6/FWF/FileChooser/Makefile.dst ||
  338. echo 'restore of xarchie-2.0.6/FWF/FileChooser/Makefile.dst failed'
  339. Wc_c="`wc -c < 'xarchie-2.0.6/FWF/FileChooser/Makefile.dst'`"
  340. test 391 -eq "$Wc_c" ||
  341.     echo 'xarchie-2.0.6/FWF/FileChooser/Makefile.dst: original size 391, current size' "$Wc_c"
  342. rm -f _shar_wnt_.tmp
  343. fi
  344. # ============= xarchie-2.0.6/FWF/FileChooser/README ==============
  345. if test -f 'xarchie-2.0.6/FWF/FileChooser/README' -a X"$1" != X"-c"; then
  346.     echo 'x - skipping xarchie-2.0.6/FWF/FileChooser/README (File already exists)'
  347.     rm -f _shar_wnt_.tmp
  348. else
  349. > _shar_wnt_.tmp
  350. echo 'x - extracting xarchie-2.0.6/FWF/FileChooser/README (Text)'
  351. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/FileChooser/README' &&
  352. X            README for FileChooser
  353. X                   
  354. X               George Ferguson
  355. X              ferguson@cs.rochester.edu
  356. X                   
  357. X               Last Change: 28 Jan 1993
  358. X
  359. X
  360. Description
  361. X
  362. X    This file documents the FileChooser widget, which provides an
  363. X    interface like that shown below (in ASCII) for selecting a file from a
  364. X    directory:
  365. X
  366. X        +==================================+
  367. X        |+--------------------------------+|
  368. X        ||     /parent/parent/dir         ||
  369. X        |+--------------------------------+|
  370. X        ||# File1                         ||
  371. X        ||# File2                         ||
  372. X        ||# Subdir/                       ||
  373. X        ||# File3                         ||
  374. X        ||#                               ||
  375. X        |+--------------------------------+|
  376. X        +==================================+
  377. X
  378. X    The top component is a MenuButton that, when clicked on, presents a
  379. X    menu of the ancestor directories of the current directory. The bottom
  380. X    component is List that presents the contents of the current directory.
  381. X    The FileChooser widget's callbacks are called whenever the selection
  382. X    changes. Selecting a subdirectory causes its contents to be displayed.
  383. X
  384. X    This widget is meant to function within, say, a Form, which would
  385. X    provide buttons and perhaps a Text item for entering new filenames.
  386. X    The test program FChooserT.c illustrates such usage.
  387. X
  388. X    Use of the FileChooser widget requires the Dir package from the
  389. X    Free Widget Foundation (free-widgets-request@kazoo.cs.uiuc.edu).
  390. X
  391. Implementation Notes
  392. X
  393. X    FileChooser is based on the FileSelector widget by Brian Totty
  394. X    (totty@cs.uiuc.edu). The major differences are as follows:
  395. X    - FileChooser does not provide any buttons or Text widgets,
  396. X      just the directory menu and list of files. Thus it is meant
  397. X      to be used within a larger application, for example, to
  398. X      allow new filenames to be entered. Because of this, it does
  399. X      not enforce any particular policy regarding selections.
  400. X    - FileChooser uses a MenuButton and a dynamically generated
  401. X      SimpleMenu to present the ancestor directories, similar to
  402. X      the Macintosh (tm) interface. This results in about a 50%
  403. X      saving in screen real estate.
  404. X
  405. X    FileChooser attempts to resize its children whenever it is
  406. X    resized. It makes both the MenuButton and the List as wide as the
  407. X    FileChooser, and makes the List occupy the entire bottom of the
  408. X    FileChooser (with a small gap below the MenuButton). The string
  409. X    being displayed in the MenuButton (the current directory) is
  410. X    adjusted if it is too long to fit in the given width: it is
  411. X    right-aligned, with a "<" at the left edge to indicate truncation.
  412. X    It would be nice if the "justify" resource of the MenuButton
  413. X    looked after this, but c'est la vie.
  414. SHAR_EOF
  415. chmod 0644 xarchie-2.0.6/FWF/FileChooser/README ||
  416. echo 'restore of xarchie-2.0.6/FWF/FileChooser/README failed'
  417. Wc_c="`wc -c < 'xarchie-2.0.6/FWF/FileChooser/README'`"
  418. test 2725 -eq "$Wc_c" ||
  419.     echo 'xarchie-2.0.6/FWF/FileChooser/README: original size 2725, current size' "$Wc_c"
  420. rm -f _shar_wnt_.tmp
  421. fi
  422. # ============= xarchie-2.0.6/FWF/MultiList/Imakefile ==============
  423. if test ! -d 'xarchie-2.0.6/FWF/MultiList'; then
  424.     echo 'x - creating directory xarchie-2.0.6/FWF/MultiList'
  425.     mkdir 'xarchie-2.0.6/FWF/MultiList'
  426. fi
  427. if test -f 'xarchie-2.0.6/FWF/MultiList/Imakefile' -a X"$1" != X"-c"; then
  428.     echo 'x - skipping xarchie-2.0.6/FWF/MultiList/Imakefile (File already exists)'
  429.     rm -f _shar_wnt_.tmp
  430. else
  431. > _shar_wnt_.tmp
  432. echo 'x - extracting xarchie-2.0.6/FWF/MultiList/Imakefile (Text)'
  433. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/MultiList/Imakefile' &&
  434. #
  435. # Imakefile for MultiList
  436. #
  437. # Note that this Imakefile is just sufficient to build the MultiList
  438. # for use with xarchie. The original FWF distribution contains a more
  439. # elaborate Imakefile for a variety of purposes. See the file ../README.
  440. #
  441. # George Ferguson, ferguson@cs.rochester.edu, 21 Jul 1992.
  442. #
  443. X
  444. SRCS = MultiList.c
  445. OBJS = MultiList.o
  446. X
  447. INCLUDES = -I.
  448. X
  449. NormalLibraryTarget(MultiList,$(OBJS))
  450. X
  451. DependTarget()
  452. SHAR_EOF
  453. chmod 0644 xarchie-2.0.6/FWF/MultiList/Imakefile ||
  454. echo 'restore of xarchie-2.0.6/FWF/MultiList/Imakefile failed'
  455. Wc_c="`wc -c < 'xarchie-2.0.6/FWF/MultiList/Imakefile'`"
  456. test 416 -eq "$Wc_c" ||
  457.     echo 'xarchie-2.0.6/FWF/MultiList/Imakefile: original size 416, current size' "$Wc_c"
  458. rm -f _shar_wnt_.tmp
  459. fi
  460. # ============= xarchie-2.0.6/FWF/MultiList/Makefile ==============
  461. if test -f 'xarchie-2.0.6/FWF/MultiList/Makefile' -a X"$1" != X"-c"; then
  462.     echo 'x - skipping xarchie-2.0.6/FWF/MultiList/Makefile (File already exists)'
  463.     rm -f _shar_wnt_.tmp
  464. else
  465. > _shar_wnt_.tmp
  466. echo 'x - extracting xarchie-2.0.6/FWF/MultiList/Makefile (Text)'
  467. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/MultiList/Makefile' &&
  468. # Makefile generated by imake - do not edit!
  469. # $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
  470. #
  471. # The cpp used on this machine replaces all newlines and multiple tabs and
  472. # spaces in a macro expansion with a single space.  Imake tries to compensate
  473. # for this, but is not always successful.
  474. #
  475. X
  476. # -------------------------------------------------------------------------
  477. # Makefile generated from "Imake.tmpl" and </tmp/IIf.a12678>
  478. # $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
  479. #
  480. # Platform-specific parameters may be set in the appropriate <vendor>.cf
  481. # configuration files.  Site-specific parameters should be set in the file
  482. # site.def.  Full rebuilds are recommended if any parameters are changed.
  483. #
  484. # If your C preprocessor does not define any unique symbols, you will need
  485. # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
  486. # "make World" the first time).
  487. #
  488. X
  489. # -------------------------------------------------------------------------
  490. # site-specific configuration parameters that need to come before
  491. # the platform-specific parameters - edit site.def to change
  492. X
  493. # site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  494. X
  495. # -------------------------------------------------------------------------
  496. # platform-specific configuration parameters - edit sun.cf to change
  497. X
  498. # platform:  $XConsortium: sun.cf,v 1.72.1.1 92/03/18 13:13:37 rws Exp $
  499. X
  500. # operating system:  SunOS 4.1.1
  501. X
  502. # $XConsortium: sunLib.rules,v 1.7 91/12/20 11:19:47 rws Exp $
  503. X
  504. # -------------------------------------------------------------------------
  505. # site-specific configuration parameters that go after
  506. # the platform-specific parameters - edit site.def to change
  507. X
  508. # site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  509. X
  510. X            SHELL = /bin/sh
  511. X
  512. X              TOP = ../../.
  513. X      CURRENT_DIR = ./FWF/MultiList
  514. X
  515. X               AR = ar clq
  516. X  BOOTSTRAPCFLAGS =
  517. X               CC = cc
  518. X               AS = as
  519. X
  520. X         COMPRESS = compress
  521. X              CPP = /lib/cpp $(STD_CPP_DEFINES)
  522. X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
  523. X          INSTALL = install
  524. X               LD = ld
  525. X             LINT = lint
  526. X      LINTLIBFLAG = -C
  527. X         LINTOPTS = -axz
  528. X               LN = ln -s
  529. X             MAKE = make
  530. X               MV = mv
  531. X               CP = cp
  532. X
  533. X           RANLIB = ranlib
  534. X  RANLIBINSTFLAGS =
  535. X
  536. X               RM = rm -f
  537. X            TROFF = psroff
  538. X         MSMACROS = -ms
  539. X              TBL = tbl
  540. X              EQN = eqn
  541. X     STD_INCLUDES =
  542. X  STD_CPP_DEFINES =
  543. X      STD_DEFINES =
  544. X EXTRA_LOAD_FLAGS =
  545. X  EXTRA_LIBRARIES =
  546. X             TAGS = ctags
  547. X
  548. X    SHAREDCODEDEF = -DSHAREDCODE
  549. X         SHLIBDEF = -DSUNSHLIB
  550. X
  551. X    PROTO_DEFINES =
  552. X
  553. X     INSTPGMFLAGS =
  554. X
  555. X     INSTBINFLAGS = -m 0755
  556. X     INSTUIDFLAGS = -m 4755
  557. X     INSTLIBFLAGS = -m 0644
  558. X     INSTINCFLAGS = -m 0444
  559. X     INSTMANFLAGS = -m 0444
  560. X     INSTDATFLAGS = -m 0444
  561. X    INSTKMEMFLAGS = -g kmem -m 2755
  562. X
  563. X      PROJECTROOT = /usr/staff
  564. X
  565. X     TOP_INCLUDES = -I$(INCROOT)
  566. X
  567. X      CDEBUGFLAGS = -O
  568. X        CCOPTIONS = -pipe
  569. X
  570. X      ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
  571. X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
  572. X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
  573. X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
  574. X
  575. X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  576. X
  577. X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
  578. X
  579. X   LDCOMBINEFLAGS = -X -r
  580. X      DEPENDFLAGS =
  581. X
  582. X        MACROFILE = sun.cf
  583. X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
  584. X
  585. X    IMAKE_DEFINES =
  586. X
  587. X         IRULESRC = $(CONFIGDIR)
  588. X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
  589. X
  590. X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
  591. X            $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
  592. X            $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
  593. X
  594. # -------------------------------------------------------------------------
  595. # X Window System Build Parameters
  596. # $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
  597. X
  598. # -------------------------------------------------------------------------
  599. # X Window System make variables; this need to be coordinated with rules
  600. X
  601. X          PATHSEP = /
  602. X        USRLIBDIR = /usr/staff/lib
  603. X           BINDIR = /usr/staff/bin
  604. X          INCROOT = /usr/staff/include
  605. X     BUILDINCROOT = $(TOP)
  606. X      BUILDINCDIR = $(BUILDINCROOT)/X11
  607. X      BUILDINCTOP = ..
  608. X           INCDIR = $(INCROOT)/X11
  609. X           ADMDIR = /usr/adm
  610. X           LIBDIR = $(USRLIBDIR)/X11
  611. X        CONFIGDIR = $(LIBDIR)/config
  612. X       LINTLIBDIR = $(USRLIBDIR)/lint
  613. X
  614. X          FONTDIR = $(LIBDIR)/fonts
  615. X         XINITDIR = $(LIBDIR)/xinit
  616. X           XDMDIR = $(LIBDIR)/xdm
  617. X           TWMDIR = $(LIBDIR)/twm
  618. X          MANPATH = /usr/staff/man
  619. X    MANSOURCEPATH = $(MANPATH)/man
  620. X        MANSUFFIX = 1
  621. X     LIBMANSUFFIX = 3
  622. X           MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
  623. X        LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
  624. X           NLSDIR = $(LIBDIR)/nls
  625. X        PEXAPIDIR = $(LIBDIR)/PEX
  626. X      XAPPLOADDIR = $(LIBDIR)/app-defaults
  627. X       FONTCFLAGS = -t
  628. X
  629. X     INSTAPPFLAGS = $(INSTDATFLAGS)
  630. X
  631. X            IMAKE = imake
  632. X           DEPEND = makedepend
  633. X              RGB = rgb
  634. X
  635. X            FONTC = bdftopcf
  636. X
  637. X        MKFONTDIR = mkfontdir
  638. X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
  639. X
  640. X        CONFIGSRC = $(TOP)/config
  641. X       DOCUTILSRC = $(TOP)/doc/util
  642. X        CLIENTSRC = $(TOP)/clients
  643. X          DEMOSRC = $(TOP)/demos
  644. X           LIBSRC = $(TOP)/lib
  645. X          FONTSRC = $(TOP)/fonts
  646. X       INCLUDESRC = $(TOP)/X11
  647. X        SERVERSRC = $(TOP)/server
  648. X          UTILSRC = $(TOP)/util
  649. X        SCRIPTSRC = $(UTILSRC)/scripts
  650. X       EXAMPLESRC = $(TOP)/examples
  651. X       CONTRIBSRC = $(TOP)/../contrib
  652. X           DOCSRC = $(TOP)/doc
  653. X           RGBSRC = $(TOP)/rgb
  654. X        DEPENDSRC = $(UTILSRC)/makedepend
  655. X         IMAKESRC = $(CONFIGSRC)
  656. X         XAUTHSRC = $(LIBSRC)/Xau
  657. X          XLIBSRC = $(LIBSRC)/X
  658. X           XMUSRC = $(LIBSRC)/Xmu
  659. X       TOOLKITSRC = $(LIBSRC)/Xt
  660. X       AWIDGETSRC = $(LIBSRC)/Xaw
  661. X       OLDXLIBSRC = $(LIBSRC)/oldX
  662. X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
  663. X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
  664. X      BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
  665. X      BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
  666. X     MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
  667. X         FSLIBSRC = $(FONTSRC)/lib/fs
  668. X    FONTSERVERSRC = $(FONTSRC)/server
  669. X     EXTENSIONSRC = $(TOP)/extensions
  670. X         XILIBSRC = $(EXTENSIONSRC)/lib/xinput
  671. X      PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
  672. X
  673. # $XConsortium: sunLib.tmpl,v 1.14.1.1 92/03/17 14:58:46 rws Exp $
  674. X
  675. SHLIBLDFLAGS = -assert pure-text
  676. PICFLAGS = -pic
  677. X
  678. X  DEPEXTENSIONLIB =
  679. X     EXTENSIONLIB = -lXext
  680. X
  681. X          DEPXLIB = $(DEPEXTENSIONLIB)
  682. X             XLIB = $(EXTENSIONLIB) -lX11
  683. X
  684. X        DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV)
  685. X       XMULIBONLY = -lXmu
  686. X           XMULIB = -lXmu
  687. X
  688. X       DEPOLDXLIB =
  689. X          OLDXLIB = -loldX
  690. X
  691. X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV)
  692. X         XTOOLLIB = -lXt
  693. X
  694. X        DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV)
  695. X           XAWLIB = -lXaw
  696. X
  697. X        DEPXILIB =
  698. X           XILIB = -lXi
  699. X
  700. X        SOXLIBREV = 4.10
  701. X          SOXTREV = 4.10
  702. X         SOXAWREV = 5.0
  703. X        SOOLDXREV = 4.10
  704. X         SOXMUREV = 4.10
  705. X        SOXEXTREV = 4.10
  706. X      SOXINPUTREV = 4.10
  707. X
  708. X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
  709. X         XAUTHLIB =  -lXau
  710. X      DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
  711. X         XDMCPLIB =  -lXdmcp
  712. X
  713. X        DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
  714. X           PHIGSLIB =  -lphigs
  715. X
  716. X       DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
  717. X          XBSDLIB =  -lXbsd
  718. X
  719. X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
  720. X         LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
  721. X          LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
  722. X        LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
  723. X          LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
  724. X           LINTXI = $(LINTLIBDIR)/llib-lXi.ln
  725. X        LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
  726. X
  727. X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  728. X
  729. X         DEPLIBS1 = $(DEPLIBS)
  730. X         DEPLIBS2 = $(DEPLIBS)
  731. X         DEPLIBS3 = $(DEPLIBS)
  732. X
  733. # -------------------------------------------------------------------------
  734. # Imake rules for building libraries, programs, scripts, and data files
  735. # rules:  $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
  736. X
  737. # -------------------------------------------------------------------------
  738. # start of Imakefile
  739. X
  740. #
  741. # Imakefile for MultiList
  742. #
  743. # Note that this Imakefile is just sufficient to build the MultiList
  744. # for use with xarchie. The original FWF distribution contains a more
  745. # elaborate Imakefile for a variety of purposes. See the file ../README.
  746. #
  747. # George Ferguson, ferguson@cs.rochester.edu, 21 Jul 1992.
  748. #
  749. X
  750. SRCS = MultiList.c
  751. OBJS = MultiList.o
  752. X
  753. INCLUDES = -I.
  754. X
  755. all:: libMultiList.a
  756. X
  757. libMultiList.a: $(OBJS)
  758. X    $(RM) $@
  759. X    $(AR) $@ $(OBJS)
  760. X    $(RANLIB) $@
  761. X
  762. depend::
  763. X    $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  764. X
  765. # -------------------------------------------------------------------------
  766. # common rules for all Makefiles - do not edit
  767. X
  768. emptyrule::
  769. X
  770. clean::
  771. X    $(RM_CMD) "#"*
  772. X
  773. Makefile::
  774. X    -@if [ -f Makefile ]; then set -x; \
  775. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  776. X    else exit 0; fi
  777. X    $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
  778. X
  779. tags::
  780. X    $(TAGS) -w *.[ch]
  781. X    $(TAGS) -xw *.[ch] > TAGS
  782. X
  783. saber:
  784. X    # load $(ALLDEFINES) $(SRCS)
  785. X
  786. osaber:
  787. X    # load $(ALLDEFINES) $(OBJS)
  788. X
  789. # -------------------------------------------------------------------------
  790. # empty rules for directories that do not have SUBDIRS - do not edit
  791. X
  792. install::
  793. X    @echo "install in $(CURRENT_DIR) done"
  794. X
  795. install.man::
  796. X    @echo "install.man in $(CURRENT_DIR) done"
  797. X
  798. Makefiles::
  799. X
  800. includes::
  801. X
  802. # -------------------------------------------------------------------------
  803. # dependencies generated by makedepend
  804. X
  805. SHAR_EOF
  806. chmod 0644 xarchie-2.0.6/FWF/MultiList/Makefile ||
  807. echo 'restore of xarchie-2.0.6/FWF/MultiList/Makefile failed'
  808. Wc_c="`wc -c < 'xarchie-2.0.6/FWF/MultiList/Makefile'`"
  809. test 9845 -eq "$Wc_c" ||
  810.     echo 'xarchie-2.0.6/FWF/MultiList/Makefile: original size 9845, current size' "$Wc_c"
  811. rm -f _shar_wnt_.tmp
  812. fi
  813. # ============= xarchie-2.0.6/FWF/MultiList/Makefile.dst ==============
  814. if test -f 'xarchie-2.0.6/FWF/MultiList/Makefile.dst' -a X"$1" != X"-c"; then
  815.     echo 'x - skipping xarchie-2.0.6/FWF/MultiList/Makefile.dst (File already exists)'
  816.     rm -f _shar_wnt_.tmp
  817. else
  818. > _shar_wnt_.tmp
  819. echo 'x - extracting xarchie-2.0.6/FWF/MultiList/Makefile.dst (Text)'
  820. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/MultiList/Makefile.dst' &&
  821. # This Makefile is for use with MultiList if you don't have imake/xmkmf.
  822. X
  823. RM = rm -f
  824. AR = ar clq
  825. RANLIB = ranlib
  826. X
  827. # These should be set in the master Makefile
  828. XXINCS = -I/usr/local/include
  829. CDEBUGFLAGS = -g
  830. X
  831. OBJS = MultiList.o
  832. INCLUDES = -I.
  833. CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(XINCS)
  834. X
  835. libMultiList.a: $(OBJS)
  836. X    $(RM) $@
  837. X    $(AR) $@ $(OBJS)
  838. X    $(RANLIB) $(@)
  839. X
  840. clean:
  841. X    $(RM) libMultiList.a $(OBJS)
  842. SHAR_EOF
  843. chmod 0644 xarchie-2.0.6/FWF/MultiList/Makefile.dst ||
  844. echo 'restore of xarchie-2.0.6/FWF/MultiList/Makefile.dst failed'
  845. Wc_c="`wc -c < 'xarchie-2.0.6/FWF/MultiList/Makefile.dst'`"
  846. test 392 -eq "$Wc_c" ||
  847.     echo 'xarchie-2.0.6/FWF/MultiList/Makefile.dst: original size 392, current size' "$Wc_c"
  848. rm -f _shar_wnt_.tmp
  849. fi
  850. # ============= xarchie-2.0.6/FWF/MultiList/MultiList.c ==============
  851. if test -f 'xarchie-2.0.6/FWF/MultiList/MultiList.c' -a X"$1" != X"-c"; then
  852.     echo 'x - skipping xarchie-2.0.6/FWF/MultiList/MultiList.c (File already exists)'
  853.     rm -f _shar_wnt_.tmp
  854. else
  855. > _shar_wnt_.tmp
  856. echo 'x - extracting xarchie-2.0.6/FWF/MultiList/MultiList.c (Text)'
  857. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/MultiList/MultiList.c' &&
  858. /****************************************************************************
  859. X
  860. X    MultiList.c
  861. X
  862. X    This file contains the implementation of the Picasso List
  863. X    widget.  Its functionality is intended to be similar to
  864. X    The Athena List widget, with some extra features added.
  865. X
  866. X    This code is loosely based on the Athena List source which
  867. X    is why the MIT copyright notice appears below.
  868. X
  869. X    The code was changed substantially in V3.4 to change the
  870. X    action/callback interface which was unnecessarily ugly.  Code
  871. X    using some features of the old interface may need to be changed.
  872. X    Hope the changes don't make people's lives too miserable.
  873. X
  874. X ****************************************************************************/
  875. X
  876. /*
  877. X * Author:
  878. X *     Brian Totty
  879. X *     Department of Computer Science
  880. X *     University Of Illinois at Urbana-Champaign
  881. X *    1304 West Springfield Avenue
  882. X *     Urbana, IL 61801
  883. X * 
  884. X *     totty@cs.uiuc.edu
  885. X *     
  886. X */ 
  887. X
  888. /*
  889. X * Copyright 1989 Massachusetts Institute of Technology
  890. X *
  891. X * Permission to use, copy, modify, distribute, and sell this software and its
  892. X * documentation for any purpose is hereby granted without fee, provided that
  893. X * the above copyright notice appear in all copies and that both that
  894. X * copyright notice and this permission notice appear in supporting
  895. X * documentation, and that the name of M.I.T. not be used in advertising or
  896. X * publicity pertaining to distribution of the software without specific,
  897. X * written prior permission.  M.I.T. makes no representations about the
  898. X * suitability of this software for any purpose.  It is provided "as is"
  899. X * without express or implied warranty.
  900. X *
  901. X * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  902. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
  903. X * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  904. X * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  905. X * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
  906. X * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  907. X *
  908. X * Original Athena Author:  Chris D. Peterson, MIT X Consortium
  909. X */
  910. X
  911. #include <stdio.h>
  912. #include <ctype.h>
  913. X
  914. #include <X11/IntrinsicP.h>
  915. #include <X11/StringDefs.h>
  916. X
  917. #include <MultiListP.h>
  918. X
  919. /*===========================================================================*
  920. X
  921. X          D E C L A R A T I O N S    A N D    D E F I N I T I O N S
  922. X
  923. X *===========================================================================*/
  924. X
  925. Pixmap XmuCreateStippledPixmap();
  926. extern void XawInitializeWidgetSet();
  927. X
  928. #define    SUPERCLASS    &(simpleClassRec)
  929. X
  930. #define    FontAscent(f)    ((f)->max_bounds.ascent)
  931. #define    FontDescent(f)    ((f)->max_bounds.descent)
  932. #define    FontH(f)    (FontAscent(f) + FontDescent(f) + 2)
  933. #define    FontW(f,s)    (XTextWidth(f,s,strlen(s)) + 1)
  934. #define    FontMaxCharW(f)    ((f)->max_bounds.rbearing-(f)->min_bounds.lbearing+1)
  935. X
  936. #ifndef abs
  937. #define abs(a)            ((a) < 0 ? -(a) : (a))
  938. #endif
  939. X
  940. #define max(a,b)        ((a) > (b) ? (a) : (b))
  941. #define min(a,b)        ((a) < (b) ? (a) : (b))
  942. #define XtStrlen(s)        ((s) ? strlen(s) : 0)
  943. X
  944. #define    TypeAlloc(t,n)        (t *)malloc(sizeof(t) * n)
  945. #define    StrCopy(s)        strcpy(TypeAlloc(char,strlen(s)+1),s)
  946. #define    StrCopyRetLength(s,lp)    strcpy(TypeAlloc(char,(*lp=(strlen(s)+1))),s)
  947. X
  948. #define CoreFieldOffset(f)    XtOffset(Widget,core.f)
  949. #define    SimpleFieldOffset(f)    XtOffset(XfwfMultiListWidget,simple.f)
  950. #define MultiListFieldOffset(f)    XtOffset(XfwfMultiListWidget,multiList.f)
  951. X
  952. /*===========================================================================*
  953. X
  954. X        I N T E R N A L    P R O C E D U R E    D E C L A R A T I O N S
  955. X
  956. X *===========================================================================*/
  957. X
  958. #if (!NeedFunctionPrototypes)
  959. X
  960. static void            Initialize();
  961. static void            Redisplay();
  962. static XtGeometryResult        PreferredGeometry();
  963. static void            Resize();
  964. static Boolean            SetValues();
  965. X
  966. static void            DestroyOldData();
  967. static void            InitializeNewData();
  968. static void            CreateNewGCs();
  969. X
  970. static void            RecalcCoords();
  971. static void            NegotiateSizeChange();
  972. static Boolean            Layout();
  973. X
  974. static void            RedrawAll();
  975. static void            RedrawItem();
  976. static void            RedrawRowColumn();
  977. X
  978. static void            PixelToRowColumn();
  979. static void            RowColumnToPixels();
  980. static Boolean            RowColumnToItem();
  981. static Boolean            ItemToRowColumn();
  982. X
  983. static void            Select();
  984. static void            Unselect();
  985. static void            Toggle();
  986. static void            Extend();
  987. static void            Notify();
  988. X
  989. #else
  990. X
  991. static void        Initialize(Widget request, Widget new);
  992. static void         Redisplay(XfwfMultiListWidget mlw,
  993. X                XEvent *event, Region rectangle_union);
  994. static XtGeometryResult PreferredGeometry(XfwfMultiListWidget mlw,
  995. X                XtWidgetGeometry *parent_idea,
  996. X                XtWidgetGeometry *our_idea);
  997. static void        Resize(XfwfMultiListWidget mlw);
  998. static Boolean        SetValues(XfwfMultiListWidget cpl,
  999. X                XfwfMultiListWidget rpl,
  1000. X            XfwfMultiListWidget npl);
  1001. static void        DestroyOldData(XfwfMultiListWidget mlw);
  1002. static void        InitializeNewData(XfwfMultiListWidget mlw);
  1003. static void        CreateNewGCs(XfwfMultiListWidget mlw);
  1004. static void        RecalcCoords(XfwfMultiListWidget mlw,
  1005. X                Boolean width_changeable,
  1006. X                Boolean height_changeable);
  1007. static void        NegotiateSizeChange(XfwfMultiListWidget mlw,
  1008. X                Dimension width, Dimension height);
  1009. static Boolean        Layout(XfwfMultiListWidget mlw,
  1010. X                Boolean w_changeable, Boolean h_changeable,
  1011. X                Dimension *w_ptr, Dimension *h_ptr);
  1012. static void        RedrawAll(XfwfMultiListWidget mlw);
  1013. static void        RedrawItem(XfwfMultiListWidget mlw, int item_index);
  1014. static void        RedrawRowColumn(XfwfMultiListWidget mlw,
  1015. X                int row, int column);
  1016. static void        PixelToRowColumn(XfwfMultiListWidget mlw,
  1017. X                int x, int y, int *row_ptr, int *column_ptr);
  1018. static void        RowColumnToPixels(XfwfMultiListWidget mlw,
  1019. X                int row, int col, int *x_ptr, int *y_ptr,
  1020. X                int *w_ptr, int *h_ptr);
  1021. static Boolean        RowColumnToItem(XfwfMultiListWidget mlw,
  1022. X                int row, int column, int *item_ptr);
  1023. static Boolean        ItemToRowColumn(XfwfMultiListWidget mlw,
  1024. X                int item_index, int *row_ptr, int *column_ptr);
  1025. static void        Select(XfwfMultiListWidget mlw, XEvent *event,
  1026. X                String *params, Cardinal *num_params);
  1027. static void        Unselect(XfwfMultiListWidget mlw, XEvent *event,
  1028. X                String *params, Cardinal *num_params);
  1029. static void        Toggle(XfwfMultiListWidget mlw, XEvent *event,
  1030. X                String *params, Cardinal *num_params);
  1031. static void        Extend(XfwfMultiListWidget mlw, XEvent *event,
  1032. X                String *params, Cardinal *num_params);
  1033. static void        Notify(XfwfMultiListWidget mlw, XEvent *event,
  1034. X                String *params, Cardinal *num_params);
  1035. #endif
  1036. X
  1037. /*===========================================================================*
  1038. X
  1039. X              R E S O U R C E    I N I T I A L I Z A T I O N
  1040. X
  1041. X *===========================================================================*/
  1042. X
  1043. static XtResource resources[] =
  1044. {
  1045. X    {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension),
  1046. X        CoreFieldOffset(width), XtRString, "0"},
  1047. X    {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension),
  1048. X        CoreFieldOffset(height), XtRString, "0"},
  1049. X    {XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel),
  1050. X        CoreFieldOffset(background_pixel),XtRString,"XtDefaultBackground"},
  1051. X
  1052. X    {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor),
  1053. X        SimpleFieldOffset(cursor), XtRString, "left_ptr"},
  1054. X
  1055. X    {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
  1056. X        MultiListFieldOffset(foreground), XtRString,"XtDefaultForeground"},
  1057. X    {XtNhighlightForeground, XtCHForeground, XtRPixel, sizeof(Pixel),
  1058. X        MultiListFieldOffset(highlight_fg), XtRString, "XtDefaultBackground"},
  1059. X    {XtNhighlightBackground, XtCHBackground, XtRPixel, sizeof(Pixel),
  1060. X        MultiListFieldOffset(highlight_bg), XtRString, "XtDefaultForeground"},
  1061. X    {XtNcolumnSpacing, XtCSpacing, XtRDimension, sizeof(Dimension),
  1062. X        MultiListFieldOffset(column_space), XtRImmediate, (caddr_t)8},
  1063. X    {XtNrowSpacing, XtCSpacing, XtRDimension, sizeof(Dimension),
  1064. X        MultiListFieldOffset(row_space), XtRImmediate, (caddr_t)0},
  1065. X    {XtNdefaultColumns, XtCColumns, XtRInt,  sizeof(int),
  1066. X        MultiListFieldOffset(default_cols), XtRImmediate, (caddr_t)1},
  1067. X    {XtNforceColumns, XtCColumns, XtRBoolean, sizeof(Boolean),
  1068. X        MultiListFieldOffset(force_cols), XtRString, (caddr_t) "False"},
  1069. X    {XtNpasteBuffer, XtCBoolean, XtRBoolean, sizeof(Boolean),
  1070. X        MultiListFieldOffset(paste), XtRString, (caddr_t) "False"},
  1071. X    {XtNverticalList, XtCBoolean, XtRBoolean,  sizeof(Boolean),
  1072. X        MultiListFieldOffset(row_major), XtRString, (caddr_t) "False"},
  1073. X    {XtNlongest, XtCLongest, XtRInt,  sizeof(int),
  1074. X        MultiListFieldOffset(longest), XtRImmediate, (caddr_t)0},
  1075. X    {XtNnumberStrings, XtCNumberStrings, XtRInt,  sizeof(int),
  1076. X        MultiListFieldOffset(nitems), XtRImmediate, (caddr_t)0},
  1077. X    {XtNfont,  XtCFont, XtRFontStruct, sizeof(XFontStruct *),
  1078. X        MultiListFieldOffset(font),XtRString, "XtDefaultFont"},
  1079. X    {XtNlist, XtCList, XtRPointer, sizeof(char **),
  1080. X        MultiListFieldOffset(list), XtRString, NULL},
  1081. X    {XtNsensitiveArray, XtCList, XtRPointer, sizeof(Boolean *),
  1082. X        MultiListFieldOffset(sensitive_array), XtRString, NULL},
  1083. X    {XtNcallback, XtCCallback, XtRCallback, sizeof(caddr_t),
  1084. X        MultiListFieldOffset(callback), XtRCallback, NULL},
  1085. X    {XtNmaxSelectable, XtCValue, XtRInt, sizeof(int),
  1086. X        MultiListFieldOffset(max_selectable), XtRImmediate, (caddr_t) 1},
  1087. X
  1088. X    {XtNshadeSurplus, XtCBoolean, XtRBoolean, sizeof(Boolean),
  1089. X        MultiListFieldOffset(shade_surplus), XtRString, "True"},
  1090. X
  1091. X    {XtNcolumnWidth, XtCValue, XtRDimension, sizeof(Dimension),
  1092. X        MultiListFieldOffset(col_width), XtRImmediate, (caddr_t)0},
  1093. X    {XtNrowHeight, XtCValue, XtRDimension, sizeof(Dimension),
  1094. X        MultiListFieldOffset(row_height), XtRImmediate, (caddr_t)0},
  1095. };
  1096. X
  1097. /*===========================================================================*
  1098. X
  1099. X        A C T I O N    A N D    T R A N S L A T I O N    T A B L E S
  1100. X
  1101. X *===========================================================================*/
  1102. X
  1103. X
  1104. static char defaultTranslations[] =
  1105. "    Shift <Btn1Down>:            Toggle()\n\
  1106. X    Ctrl <Btn1Down>:            Unselect()\n\
  1107. X    <Btn1Down>:                Select()\n\
  1108. X    Button1 <Btn1Motion>:            Extend()\n\
  1109. X    <Btn1Up>:                Notify()";
  1110. X
  1111. static XtActionsRec actions[] =
  1112. {
  1113. X    {"Select",                (XtActionProc)Select},
  1114. X    {"Unselect",                (XtActionProc)Unselect},
  1115. X    {"Toggle",                (XtActionProc)Toggle},
  1116. X    {"Extend",                (XtActionProc)Extend},
  1117. X    {"Notify",                (XtActionProc)Notify},
  1118. X    {NULL,                    (XtActionProc)NULL}
  1119. };
  1120. X
  1121. /*===========================================================================*
  1122. X
  1123. X                    C L A S S    A L L O C A T I O N
  1124. X
  1125. X *===========================================================================*/
  1126. X
  1127. XXfwfMultiListClassRec xfwfMultiListClassRec =
  1128. {
  1129. X    {
  1130. X        /* superclass        */    (WidgetClass)SUPERCLASS,
  1131. X        /* class_name        */    "XfwfMultiList",
  1132. X        /* widget_size        */    sizeof(XfwfMultiListRec),
  1133. X        /* class_initialize    */    NULL,
  1134. X        /* class_part_initialize*/    NULL,
  1135. X        /* class_inited        */    FALSE,
  1136. X        /* initialize        */    (XtInitProc)Initialize,
  1137. X        /* initialize_hook    */    NULL,
  1138. X        /* realize        */    XtInheritRealize,
  1139. X        /* actions        */    actions,
  1140. X        /* num_actions        */    XtNumber(actions),
  1141. X        /* resources        */    resources,
  1142. X        /* resource_count    */    XtNumber(resources),
  1143. X        /* xrm_class        */    NULLQUARK,
  1144. X        /* compress_motion    */    TRUE,
  1145. X        /* compress_exposure    */    FALSE,
  1146. X        /* compress_enterleave    */    TRUE,
  1147. X        /* visible_interest    */    FALSE,
  1148. X        /* destroy        */    NULL,
  1149. X        /* resize        */    (XtWidgetProc)Resize,
  1150. X        /* expose        */    (XtExposeProc)Redisplay,
  1151. X        /* set_values        */    (XtSetValuesFunc)SetValues,
  1152. X        /* set_values_hook    */    NULL,
  1153. X        /* set_values_almost    */    XtInheritSetValuesAlmost,
  1154. X        /* get_values_hook    */    NULL,
  1155. X        /* accept_focus        */    NULL,
  1156. X        /* version        */    XtVersion,
  1157. X        /* callback_private    */    NULL,
  1158. X        /* tm_table        */    defaultTranslations,
  1159. X        /* query_geometry       */    (XtGeometryHandler)
  1160. X                            PreferredGeometry,
  1161. X        /* display_accelerator  */    XtInheritDisplayAccelerator,
  1162. X        /* extension            */    NULL
  1163. X    }, /* Core Part */
  1164. X    {
  1165. X        /* change_sensitive     */    XtInheritChangeSensitive
  1166. X    }
  1167. };
  1168. X
  1169. WidgetClass xfwfMultiListWidgetClass = (WidgetClass)&xfwfMultiListClassRec;
  1170. X
  1171. /*===========================================================================*
  1172. X
  1173. X                       T O O L K I T    M E T H O D S
  1174. X
  1175. X *===========================================================================*/
  1176. X
  1177. /*---------------------------------------------------------------------------*
  1178. X
  1179. X    Initialize()
  1180. X
  1181. X    This procedure is called by the X toolkit to initialize
  1182. X    the widget instance.  The hook to this routine is in the
  1183. X    initialize part of the core part of the class.
  1184. X
  1185. X *---------------------------------------------------------------------------*/
  1186. X
  1187. /* ARGSUSED */
  1188. static void Initialize(request,new)
  1189. Widget request,new;
  1190. {
  1191. X    XfwfMultiListWidget mlw;
  1192. X
  1193. X    mlw = (XfwfMultiListWidget)new;
  1194. X    CreateNewGCs(mlw);
  1195. X    InitializeNewData(mlw);
  1196. X    RecalcCoords(mlw,(MultiListWidth(mlw) == 0),
  1197. X             (MultiListHeight(mlw) == 0));
  1198. } /* Initialize */
  1199. X
  1200. X
  1201. /*---------------------------------------------------------------------------*
  1202. X
  1203. X    Redisplay(mlw,event,rectangle_union)
  1204. X
  1205. X    This routine redraws the MultiList widget <mlw> based on the exposure
  1206. X    region requested in <event>.
  1207. X
  1208. X *---------------------------------------------------------------------------*/
  1209. X
  1210. /* ARGSUSED */
  1211. static void Redisplay(mlw,event,rectangle_union)
  1212. XXfwfMultiListWidget mlw;
  1213. XXEvent *event;
  1214. Region rectangle_union;
  1215. {
  1216. X    GC shade_gc;
  1217. X    int i,x1,y1,w,h,x2,y2,row,col,ul_row,ul_col,lr_row,lr_col;
  1218. X
  1219. X    if (MultiListShadeSurplus(mlw))
  1220. X        shade_gc = MultiListGrayGC(mlw);
  1221. X        else
  1222. X        shade_gc = MultiListEraseGC(mlw);
  1223. X    if (event == NULL)
  1224. X    {
  1225. X        XFillRectangle(XtDisplay(mlw),XtWindow(mlw),shade_gc,0,0,
  1226. X                   MultiListWidth(mlw),MultiListHeight(mlw));
  1227. X        for (i = 0; i < MultiListNumItems(mlw); i++) RedrawItem(mlw,i);
  1228. X    }
  1229. X        else
  1230. X    {
  1231. X        x1 = event->xexpose.x;
  1232. X        y1 = event->xexpose.y;
  1233. X        w = event->xexpose.width;
  1234. X        h = event->xexpose.height;
  1235. X        x2 = x1 + w;
  1236. X        y2 = y1 + h;
  1237. X        XFillRectangle(XtDisplay(mlw),XtWindow(mlw),
  1238. X                   shade_gc,x1,y1,w,h);
  1239. X        PixelToRowColumn(mlw,x1,y1,&ul_row,&ul_col);
  1240. X        PixelToRowColumn(mlw,x2,y2,&lr_row,&lr_col);
  1241. X        lr_row = min(lr_row,MultiListNumRows(mlw) - 1);
  1242. X        lr_col = min(lr_col,MultiListNumCols(mlw) - 1);
  1243. X        for (col = ul_col; col <= lr_col; col++)
  1244. X        {
  1245. X            for (row = ul_row; row <= lr_row; row++)
  1246. X            {
  1247. X                RedrawRowColumn(mlw,row,col);
  1248. X            }
  1249. X        }
  1250. X    }
  1251. } /* End Redisplay */
  1252. X
  1253. X
  1254. /*---------------------------------------------------------------------------*
  1255. X
  1256. X    PreferredGeometry(mlw,parent_idea,our_idea)
  1257. X
  1258. X    This routine is called by the parent to tell us about the
  1259. X    parent's idea of our width and/or height.  We then suggest
  1260. X    our preference through <our_idea> and return the information
  1261. X    to the parent.
  1262. X
  1263. X *---------------------------------------------------------------------------*/
  1264. X
  1265. static XtGeometryResult PreferredGeometry(mlw,parent_idea,our_idea)
  1266. XXfwfMultiListWidget mlw;
  1267. XXtWidgetGeometry *parent_idea,*our_idea;
  1268. {
  1269. X    Dimension nw,nh;
  1270. X    Boolean parent_wants_w,parent_wants_h,we_changed_size;
  1271. X    
  1272. X    parent_wants_w = (parent_idea->request_mode) & CWWidth;
  1273. X    parent_wants_h = (parent_idea->request_mode) & CWHeight;
  1274. X
  1275. X    if (parent_wants_w)
  1276. X        nw = parent_idea->width;
  1277. X        else
  1278. X        nw = MultiListWidth(mlw);
  1279. X
  1280. X    if (parent_wants_h)
  1281. X        nh = parent_idea->height;
  1282. X        else
  1283. X        nh = MultiListHeight(mlw);
  1284. X
  1285. X    our_idea->request_mode = 0;
  1286. X    if (!parent_wants_w && !parent_wants_h) return(XtGeometryYes);
  1287. X
  1288. X    we_changed_size = Layout(mlw,!parent_wants_w,!parent_wants_h,&nw,&nh);
  1289. X    our_idea->request_mode |= (CWWidth | CWHeight);
  1290. X    our_idea->width = nw;
  1291. X    our_idea->height = nh;
  1292. X
  1293. X    if (we_changed_size)
  1294. X        return(XtGeometryAlmost);
  1295. X        else
  1296. X        return(XtGeometryYes);
  1297. } /* End PreferredGeometry */
  1298. X
  1299. X
  1300. /*---------------------------------------------------------------------------*
  1301. X
  1302. X    Resize(mlw)
  1303. X
  1304. X    This function is called when the widget is being resized.  It
  1305. X    recalculates the layout of the widget.
  1306. X
  1307. X *---------------------------------------------------------------------------*/
  1308. X
  1309. static void Resize(mlw)
  1310. XXfwfMultiListWidget mlw;
  1311. {
  1312. X    Dimension width,height;
  1313. X
  1314. X    width = MultiListWidth(mlw);
  1315. X    height = MultiListHeight(mlw);
  1316. X    Layout(mlw,False,False,&width,&height);
  1317. } /* End Resize */
  1318. X
  1319. X
  1320. /*---------------------------------------------------------------------------*
  1321. X
  1322. X    SetValues(cpl,rpl,npl)
  1323. X
  1324. X    This routine is called when the user is changing resources.  <cpl>
  1325. X    is the current widget before the user's changes have been instituted.
  1326. X    <rpl> includes the original changes as requested by the user.  <npl>
  1327. X    is the new resulting widget with the requested changes and with all
  1328. X    superclass changes already made.
  1329. X
  1330. X *---------------------------------------------------------------------------*/
  1331. X
  1332. /*ARGSUSED*/
  1333. static Boolean SetValues(cpl,rpl,npl)
  1334. XXfwfMultiListWidget cpl,rpl,npl;
  1335. {
  1336. X    Boolean redraw,recalc;
  1337. X
  1338. X    redraw = False;
  1339. X    recalc = False;
  1340. X
  1341. X        /* Graphic Context Changes */
  1342. X
  1343. X    if ((MultiListFG(cpl) != MultiListFG(npl)) ||
  1344. X        (MultiListBG(cpl) != MultiListBG(npl)) ||
  1345. X        (MultiListHighlightFG(cpl) != MultiListHighlightFG(npl)) ||
  1346. X        (MultiListHighlightBG(cpl) != MultiListHighlightBG(npl)) ||
  1347. X        (MultiListFont(cpl) != MultiListFont(npl)))
  1348. X    {
  1349. X        XtDestroyGC(MultiListEraseGC(cpl));
  1350. X        XtDestroyGC(MultiListDrawGC(cpl));
  1351. X        XtDestroyGC(MultiListHighlightForeGC(cpl));
  1352. X        XtDestroyGC(MultiListHighlightBackGC(cpl));
  1353. X        XtDestroyGC(MultiListGrayGC(cpl));
  1354. X        CreateNewGCs(npl);
  1355. X        redraw = True;
  1356. X    }
  1357. X
  1358. X        /* Changes That Require Redraw */
  1359. X
  1360. X    if ((MultiListSensitive(cpl) != MultiListSensitive(npl)) ||
  1361. X        (MultiListAncesSensitive(cpl) != MultiListAncesSensitive(npl)))
  1362. X    {
  1363. X        redraw = True;
  1364. X    }
  1365. X
  1366. X        /* Changes That Require Selection Changes */
  1367. X
  1368. X    if ((MultiListMaxSelectable(cpl) != MultiListMaxSelectable(npl)))
  1369. X    {
  1370. X        XtWarning("Dynamic change to maxSelectable unimplemented");
  1371. X    }
  1372. X
  1373. X        /* Changes That Require Data Initialization */
  1374. X
  1375. X    if ((MultiListList(cpl) != MultiListList(npl)) ||
  1376. X        (MultiListNumItems(cpl) != MultiListNumItems(npl)) ||
  1377. X        (MultiListSensitiveArray(cpl) != MultiListSensitiveArray(npl)))
  1378. X    {
  1379. X        DestroyOldData(cpl);
  1380. X        InitializeNewData(npl);
  1381. X        recalc = True;
  1382. X        redraw = True;
  1383. X    }
  1384. X
  1385. X        /* Changes That Require Recalculating Coordinates */
  1386. X
  1387. X    if ((MultiListWidth(cpl) != MultiListWidth(npl)) ||
  1388. X        (MultiListHeight(cpl) != MultiListHeight(npl)) ||
  1389. X        (MultiListColumnSpace(cpl) != MultiListColumnSpace(npl)) ||
  1390. X        (MultiListRowSpace(cpl) != MultiListRowSpace(npl)) ||
  1391. X        (MultiListDefaultCols(cpl) != MultiListDefaultCols(npl)) ||
  1392. X        ((MultiListForceCols(cpl) != MultiListForceCols(npl)) &&
  1393. X         (MultiListNumCols(cpl) != MultiListNumCols(npl))) ||
  1394. X        (MultiListRowMajor(cpl) != MultiListRowMajor(npl)) ||
  1395. X        (MultiListFont(cpl) != MultiListFont(npl)) ||
  1396. X        (MultiListLongest(cpl) != MultiListLongest(npl)))
  1397. X    {
  1398. X        recalc = True;
  1399. X        redraw = True;
  1400. X    }
  1401. X
  1402. X    if (MultiListColWidth(cpl) != MultiListColWidth(npl))
  1403. X    {
  1404. X        XtWarning("columnWidth Resource Is Read-Only");
  1405. X        MultiListColWidth(npl) = MultiListColWidth(cpl);
  1406. X    }
  1407. X    if (MultiListRowHeight(cpl) != MultiListRowHeight(npl))
  1408. X    {
  1409. X        XtWarning("rowHeight Resource Is Read-Only");
  1410. X        MultiListRowHeight(npl) = MultiListRowHeight(cpl);
  1411. X    }
  1412. X
  1413. X    if (recalc)
  1414. X    {
  1415. X        RecalcCoords(npl,!MultiListWidth(npl),!MultiListHeight(npl));
  1416. X    }
  1417. X    
  1418. X    if (!XtIsRealized((Widget)cpl))
  1419. X        return(False);
  1420. X        else
  1421. X        return(redraw);
  1422. } /* End SetValues */
  1423. X
  1424. /*===========================================================================*
  1425. X
  1426. X                  D A T A    I N I T I A L I Z A T I O N
  1427. X
  1428. X *===========================================================================*/
  1429. X
  1430. /*---------------------------------------------------------------------------*
  1431. X
  1432. X    DestroyOldData(mlw)
  1433. X
  1434. X    This routine frees the internal list item array and sets the
  1435. X    item count to 0.  This is normally done immediately before
  1436. X    calling InitializeNewData() to rebuild the internal item
  1437. X    array from new user specified arrays.
  1438. X
  1439. X *---------------------------------------------------------------------------*/
  1440. X
  1441. static void DestroyOldData(mlw)
  1442. XXfwfMultiListWidget mlw;
  1443. {
  1444. X    int i;
  1445. X
  1446. X    if (MultiListItemArray(mlw) != NULL)    /* Free Old List */
  1447. X    {
  1448. X        for (i = 0; i < MultiListNumItems(mlw); i++)
  1449. X        {
  1450. X            free(MultiListItemString(MultiListNthItem(mlw,i)));
  1451. X        }
  1452. X        free((char *)MultiListItemArray(mlw));
  1453. X    }
  1454. X    if (MultiListSelArray(mlw) != NULL)
  1455. X        free((char *)MultiListSelArray(mlw));
  1456. X    MultiListSelArray(mlw) = NULL;
  1457. X    MultiListNumSelected(mlw) = 0;
  1458. X    MultiListItemArray(mlw) = NULL;
  1459. X    MultiListNumItems(mlw) = 0;
  1460. } /* End DestroyOldData */
  1461. X
  1462. X
  1463. /*---------------------------------------------------------------------------*
  1464. X
  1465. X    InitializeNewData(mlw)
  1466. X
  1467. X    This routine takes a MultiList widget <mlw> and builds up new
  1468. X    data item tables based on the string list and the sensitivity array.
  1469. X    All previous data should have already been freed.  If the number
  1470. X    of items is 0, they will be counted, so the array must be NULL
  1471. X    terminated.  If the list of strings is NULL, this is treated as
  1472. X    a list of 0 elements.  If the sensitivity array is NULL, all
  1473. X    items are treated as sensitive.
  1474. X
  1475. X    When this routine is done, the string list and sensitivity array
  1476. X    fields will all be set to NULL, and the widget will not reference
  1477. X    them again.
  1478. X
  1479. X *---------------------------------------------------------------------------*/
  1480. X
  1481. static void InitializeNewData(mlw)
  1482. XXfwfMultiListWidget mlw;
  1483. {
  1484. X    int i;
  1485. X    XfwfMultiListItem *item;
  1486. X    String *string_array;
  1487. X
  1488. X    string_array = MultiListList(mlw);
  1489. X    if (string_array == NULL) MultiListNumItems(mlw) = 0;
  1490. X
  1491. X    if (MultiListNumItems(mlw) == 0)        /* Count Elements */
  1492. X    {
  1493. X        if (string_array == NULL)        /* No elements */
  1494. X        {
  1495. X            MultiListNumItems(mlw) = 0;
  1496. X        }
  1497. X            else
  1498. X        {
  1499. X            for (i = 0; string_array[i] != NULL; i++);
  1500. X            MultiListNumItems(mlw) = i;
  1501. X        }
  1502. X    }
  1503. X    if (MultiListNumItems(mlw) == 0)        /* No Items */
  1504. X    {
  1505. X        MultiListItemArray(mlw) = NULL;
  1506. X    }
  1507. X        else
  1508. X    {
  1509. X        MultiListItemArray(mlw) =
  1510. X            TypeAlloc(XfwfMultiListItem,MultiListNumItems(mlw));
  1511. X        for (i = 0; i < MultiListNumItems(mlw); i++)
  1512. X        {
  1513. X            item = MultiListNthItem(mlw,i);
  1514. X            if (MultiListSensitiveArray(mlw) == NULL ||
  1515. X                (MultiListSensitiveArray(mlw)[i] == True))
  1516. X            {
  1517. X                MultiListItemSensitive(item) = True;
  1518. X            }
  1519. X                else
  1520. X            {
  1521. X                MultiListItemSensitive(item) = False;
  1522. X            }
  1523. X            MultiListItemString(item) = StrCopy(string_array[i]);
  1524. X            MultiListItemHighlighted(item) = False;
  1525. X        }
  1526. X    }
  1527. X    if (MultiListMaxSelectable(mlw) == 0)
  1528. X    {
  1529. X        MultiListSelArray(mlw) = NULL;
  1530. X        MultiListNumSelected(mlw) = 0;
  1531. X    }
  1532. X        else
  1533. X    {
  1534. X        MultiListSelArray(mlw) =
  1535. X            TypeAlloc(int,MultiListMaxSelectable(mlw));
  1536. X        MultiListNumSelected(mlw) = 0;
  1537. X    }
  1538. X
  1539. X    MultiListList(mlw) = NULL;
  1540. X    MultiListSensitiveArray(mlw) = NULL;
  1541. } /* End InitializeNewData */
  1542. X        
  1543. X
  1544. /*---------------------------------------------------------------------------*
  1545. X
  1546. X    CreateNewGCs(mlw)
  1547. X
  1548. X    This routine takes a MultiList widget <mlw> and creates a new set of
  1549. X    graphic contexts for the widget based on the colors, fonts, etc.
  1550. X    in the widget.  Any previous GCs are assumed to have already been
  1551. X    destroyed.
  1552. X
  1553. X *---------------------------------------------------------------------------*/
  1554. X
  1555. static void CreateNewGCs(mlw)
  1556. XXfwfMultiListWidget mlw;
  1557. {
  1558. X    XGCValues values;
  1559. X    unsigned int attribs;
  1560. X
  1561. X    attribs = GCForeground | GCBackground | GCFont;
  1562. X    values.foreground = MultiListFG(mlw);
  1563. X    values.background = MultiListBG(mlw);
  1564. X    values.font = MultiListFont(mlw)->fid;
  1565. X    MultiListDrawGC(mlw) = XtGetGC((Widget)mlw,attribs,&values);
  1566. X
  1567. X    values.foreground = MultiListBG(mlw);
  1568. X    MultiListEraseGC(mlw) = XtGetGC((Widget)mlw,attribs,&values);
  1569. SHAR_EOF
  1570. true || echo 'restore of xarchie-2.0.6/FWF/MultiList/MultiList.c failed'
  1571. fi
  1572. echo 'End of xarchie-2.0.6 part 22'
  1573. echo 'File xarchie-2.0.6/FWF/MultiList/MultiList.c is continued in part 23'
  1574. echo 23 > _shar_seq_.tmp
  1575. exit 0
  1576.  
  1577. exit 0 # Just in case...
  1578. -- 
  1579.   // chris@IMD.Sterling.COM       | Send comp.sources.x submissions to:
  1580. \X/  Amiga - The only way to fly! |    sources-x@imd.sterling.com
  1581.  "It's intuitively obvious to the |
  1582.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  1583.